• 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_MAIN_H
17 #define IOT_MAIN_H
18 
19 typedef void  (*fnMsgCallBack)(int qos, const char *topic, const char *payload);
20 
21 /**
22  * This is the iot main function. Please call this function first
23 */
24 int IoTMain(void);
25 /**
26  * Use this function to set the message call back function, when some messages comes,
27  * the callback will be called, if you don't care about the message, set it to NULL
28 */
29 int IoTSetMsgCallback(fnMsgCallBack msgCallback);
30 /**
31  * When you want to send some messages to the iot server(including the response message),
32  * please call this api
33  * @param qos: the mqtt qos,:0,1,2
34  * @param topic: the iot mqtt topic
35  * @param payload: the mqtt payload
36  *
37  * @return 0 success while others failed
38  *
39  * @instruction: if success means we write the message to the queue susccess,
40  * not means communicate with the server success
41 */
42 int IotSendMsg(int qos, const char *topic, const char *payload);
43 
44 #endif /* IOT_MAIN_H_ */