10a7ce71fSopenharmony_ci/*
20a7ce71fSopenharmony_ci * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
30a7ce71fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
40a7ce71fSopenharmony_ci * you may not use this file except in compliance with the License.
50a7ce71fSopenharmony_ci * You may obtain a copy of the License at
60a7ce71fSopenharmony_ci *
70a7ce71fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
80a7ce71fSopenharmony_ci *
90a7ce71fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
100a7ce71fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
110a7ce71fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120a7ce71fSopenharmony_ci * See the License for the specific language governing permissions and
130a7ce71fSopenharmony_ci * limitations under the License.
140a7ce71fSopenharmony_ci */
150a7ce71fSopenharmony_ci
160a7ce71fSopenharmony_ci#ifndef IOT_PROFILE_H_
170a7ce71fSopenharmony_ci#define IOT_PROFILE_H_
180a7ce71fSopenharmony_ci#include "iot_profile.h"
190a7ce71fSopenharmony_ci#include "app_demo_multi_sample.h"
200a7ce71fSopenharmony_ci
210a7ce71fSopenharmony_citypedef hi_void (*ClflCallBackFunc) (HiColorfulLightMode currentMode, HiControlModeType currentType);
220a7ce71fSopenharmony_citypedef hi_void (*TrflCallBackFunc) (HiTrafficLightMode currentMode,  HiControlModeType currentType);
230a7ce71fSopenharmony_citypedef hi_void (*EnvCallBackFunc)  (HiEnvironmentMode currentMode,   HiControlModeType currentType);
240a7ce71fSopenharmony_ci
250a7ce71fSopenharmony_ci#define OC_BEEP_STATUS_ON       ((hi_u8) 0x01)
260a7ce71fSopenharmony_ci#define OC_BEEP_STATUS_OFF      ((hi_u8) 0x00)
270a7ce71fSopenharmony_ci
280a7ce71fSopenharmony_ci////< enum all the data type for the oc profile
290a7ce71fSopenharmony_citypedef enum {
300a7ce71fSopenharmony_ci    EN_IOT_DATATYPE_INT = 0,
310a7ce71fSopenharmony_ci    EN_IOT_DATATYPE_LONG,
320a7ce71fSopenharmony_ci    EN_IOT_DATATYPE_FLOAT,
330a7ce71fSopenharmony_ci    EN_IOT_DATATYPE_DOUBLE,
340a7ce71fSopenharmony_ci    EN_IOT_DATATYPE_STRING, ///< must be ended with '\0'
350a7ce71fSopenharmony_ci    EN_IOT_DATATYPE_LAST,
360a7ce71fSopenharmony_ci}IoTDataType;
370a7ce71fSopenharmony_ci
380a7ce71fSopenharmony_citypedef enum {
390a7ce71fSopenharmony_ci    OC_LED_ON = 1,
400a7ce71fSopenharmony_ci    OC_LED_OFF
410a7ce71fSopenharmony_ci}LedValue;
420a7ce71fSopenharmony_ci
430a7ce71fSopenharmony_citypedef struct {
440a7ce71fSopenharmony_ci    HiColorfulLightMode  *colorfulLightModule;
450a7ce71fSopenharmony_ci    void  *colorfulDeviceOnlineTime;
460a7ce71fSopenharmony_ci    void  *clfRedValue;
470a7ce71fSopenharmony_ci    void  *clfGreenValue;
480a7ce71fSopenharmony_ci    void  *clfBlueValue;
490a7ce71fSopenharmony_ci    void  *humanTestModuleValue;
500a7ce71fSopenharmony_ci    void  *humanTestModuleTimeCount;
510a7ce71fSopenharmony_ci}ColorfulLightDef;
520a7ce71fSopenharmony_ci
530a7ce71fSopenharmony_citypedef struct {
540a7ce71fSopenharmony_ci    HiTrafficLightMode  *trafficLightModule;
550a7ce71fSopenharmony_ci    void  *trafficDeviceOnlineTime;
560a7ce71fSopenharmony_ci    void  *trfRedValue;
570a7ce71fSopenharmony_ci    void  *trfYellowValue;
580a7ce71fSopenharmony_ci    void  *trfGreenValue;
590a7ce71fSopenharmony_ci}TrafficLightDef;
600a7ce71fSopenharmony_ci
610a7ce71fSopenharmony_citypedef struct {
620a7ce71fSopenharmony_ci    HiEnvironmentMode  *environmentModule;
630a7ce71fSopenharmony_ci    void  *envDeviceOnlineTime;
640a7ce71fSopenharmony_ci    void  *envTemperratureValue;
650a7ce71fSopenharmony_ci    void  *envHumidityValue;
660a7ce71fSopenharmony_ci}EnvironmentDef;
670a7ce71fSopenharmony_ci
680a7ce71fSopenharmony_citypedef struct {
690a7ce71fSopenharmony_ci    void    *nxt;  ///< ponit to the next key
700a7ce71fSopenharmony_ci    const char   *key;
710a7ce71fSopenharmony_ci    const char   *value;
720a7ce71fSopenharmony_ci    int   iValue;
730a7ce71fSopenharmony_ci    hi_float  environmentValue;
740a7ce71fSopenharmony_ci    IoTDataType  type;
750a7ce71fSopenharmony_ci}IoTProfileKV;
760a7ce71fSopenharmony_ci
770a7ce71fSopenharmony_citypedef struct {
780a7ce71fSopenharmony_ci    void *nxt;
790a7ce71fSopenharmony_ci    char *serviceID; ///< the service id in the profile, which could not be NULL
800a7ce71fSopenharmony_ci    char *eventTime; ///< eventtime, which could be NULL means use the platform time
810a7ce71fSopenharmony_ci    IoTProfileKV *serviceProperty; ///< the property in the profile, which could not be NULL
820a7ce71fSopenharmony_ci}IoTProfileService;
830a7ce71fSopenharmony_ci
840a7ce71fSopenharmony_citypedef struct {
850a7ce71fSopenharmony_ci    int  retCode; ///< response code, 0 success while others failed
860a7ce71fSopenharmony_ci    const char   *respName; ///< response name
870a7ce71fSopenharmony_ci    const char   *requestID;///< specified by the message command
880a7ce71fSopenharmony_ci    IoTProfileKV  *paras;  ///< the command paras
890a7ce71fSopenharmony_ci}IoTCmdResp;
900a7ce71fSopenharmony_ci/**
910a7ce71fSopenharmony_ci * Use this function to make the command response here
920a7ce71fSopenharmony_ci * and you must supplied the device id, and the payload defines as IoTCmdResp_t
930a7ce71fSopenharmony_ci *
940a7ce71fSopenharmony_ci*/
950a7ce71fSopenharmony_ciint IoTProfileCmdResp(char *deviceID, IoTCmdResp *payload);
960a7ce71fSopenharmony_ci/**
970a7ce71fSopenharmony_ci * use this function to report the property to the iot platform
980a7ce71fSopenharmony_ci *
990a7ce71fSopenharmony_ci*/
1000a7ce71fSopenharmony_ciint IoTProfilePropertyReport(char *deviceID, IoTProfileService *payload);
1010a7ce71fSopenharmony_ci
1020a7ce71fSopenharmony_cihi_void SetupTrflControlModule(HiTrafficLightMode currentMode, HiControlModeType currentType);
1030a7ce71fSopenharmony_cihi_void SetupTrflAutoModule(HiTrafficLightMode currentMode, HiControlModeType currentType);
1040a7ce71fSopenharmony_cihi_void SetupTrflHumanModule(HiTrafficLightMode currentMode, HiControlModeType currentType);
1050a7ce71fSopenharmony_cihi_void SetupCleanTrflStatus(HiTrafficLightMode early_mode);
1060a7ce71fSopenharmony_cihi_void TrafficLightStatusReport(HiTrafficLightMode currentMode, TrflCallBackFunc msg_report);
1070a7ce71fSopenharmony_cihi_void EnvironmentStatusReport(HiEnvironmentMode currentMode, EnvCallBackFunc msg_report);
1080a7ce71fSopenharmony_cihi_void SetupEnvCombustibleGasModule(HiEnvironmentMode currentMode, HiControlModeType currentType);
1090a7ce71fSopenharmony_cihi_void SetupEnvHumidityModule(HiEnvironmentMode currentMode, HiControlModeType currentType);
1100a7ce71fSopenharmony_cihi_void SetupEnvTemperatureModule(HiEnvironmentMode currentMode, HiControlModeType currentType);
1110a7ce71fSopenharmony_cihi_void SetupEnvAllModule(HiEnvironmentMode currentMode, HiControlModeType currentType);
1120a7ce71fSopenharmony_cihi_void SetupClflControlModule(HiColorfulLightMode currentMode, HiControlModeType currentType);
1130a7ce71fSopenharmony_cihi_void SetupClflColorfulLightModule(HiColorfulLightMode currentMode, HiControlModeType currentType);
1140a7ce71fSopenharmony_cihi_void SetupClflPwmControlModule(HiColorfulLightMode currentMode, HiControlModeType currentType);
1150a7ce71fSopenharmony_cihi_void SetupClflBrightnessModule(HiColorfulLightMode currentMode, HiControlModeType currentType);
1160a7ce71fSopenharmony_cihi_void SetupClflHumanDetectModule(HiColorfulLightMode currentMode, HiControlModeType currentType);
1170a7ce71fSopenharmony_cihi_void SetupClflLightDetectModule(HiColorfulLightMode currentMode, HiControlModeType currentType);
1180a7ce71fSopenharmony_cihi_void SetupClflUnionDetectModule(HiColorfulLightMode currentMode, HiControlModeType currentType);
1190a7ce71fSopenharmony_cihi_void ColorfulLightStatusReport(HiColorfulLightMode currentMode,  ClflCallBackFunc msgReport);
1200a7ce71fSopenharmony_cihi_void ReportLedLightTimeCount(hi_void);
1210a7ce71fSopenharmony_ci#endif