• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef IOT_PROFILE_H
17 #define IOT_PROFILE_H
18 
19 #define OC_BEEP_STATUS_ON   ((hi_u8) 0x01)
20 #define OC_BEEP_STATUS_OFF  ((hi_u8) 0x00)
21 
22 // //<enum all the data type for the oc profile
23 typedef enum {
24     EN_IOT_DATATYPE_INT = 0,
25     EN_IOT_DATATYPE_LONG,
26     EN_IOT_DATATYPE_FLOAT,
27     EN_IOT_DATATYPE_DOUBLE,
28     EN_IOT_DATATYPE_STRING, // /<must be ended with '\0'
29     EN_IOT_DATATYPE_LAST,
30 }IoTDataTypeT;
31 
32 typedef enum {
33     OC_LED_ON = 1,
34     OC_LED_OFF
35 }OcLedValue;
36 
37 typedef struct {
38     void    *nxt; // /<ponit to the next key
39     const char    *key;
40     const char    *value;
41     double *dvalue;
42     float *fvalue;
43     int    iValue;
44     IoTDataTypeT    type;
45 }IoTProfileKVT;
46 
47 typedef struct {
48     void    *nxt;
49     char    *serviceID; // /<the service id in the profile, which could not be NULL
50     char    *eventTime; // /<eventtime, which could be NULL means use the platform time
51     IoTProfileKVT    *serviceProperty; // /<the property in the profile, which could not be NULL
52 }IoTProfileServiceT;
53 
54 typedef struct {
55     int    retCode; // /<response code, 0 success while others failed
56     const char    *respName; // /<response name
57     const char    *requestID; // /<specified by the message command
58     IoTProfileKVT    *paras; // /<the command paras
59 }IoTCmdRespT;
60 /*
61  * Use this function to make the command response here
62  * and you must supplied the device id, and the payload defines as IoTCmdResp_t
63  */
64 int IoTProfileCmdResp(const char *deviceID, IoTCmdRespT *payload);
65 
66 /*
67  * use this function to report the property to the iot platform
68  */
69 int IoTProfilePropertyReport(char *deviceID, IoTProfileServiceT *payload);
70 
71 
72 #endif