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