MeterLogger
airkiss.h
Go to the documentation of this file.
1 /*
2  * airkiss.h
3  *
4  * Created on: 2015-1-26
5  * Author: peterfan
6  */
7 
8 #ifndef AIRKISS_H_
9 #define AIRKISS_H_
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 
16 typedef void* (*airkiss_memset_fn) (void* ptr, int value, unsigned int num);
17 typedef void* (*airkiss_memcpy_fn) (void* dst, const void* src, unsigned int num);
18 typedef int (*airkiss_memcmp_fn) (const void* ptr1, const void* ptr2, unsigned int num);
19 typedef int (*airkiss_printf_fn) (const char* format, ...);
20 
21 
22 
23 typedef struct
24 {
29 
31 
32 /**
33  * @brief Get airkiss lib version.
34  *
35  * @attention The lenth of version is unknown
36  *
37  * @param null.
38  *
39  * @return const char*
40  */
41 
42 const char* airkiss_version(void);
43 
44 
45 typedef enum
46 {
47  /* the length of the data buffer is lack*/
49 
50  /* Do not support the type of instruction */
52 
53  /* Error reading data package */
55 
56  /* Error function passing parameters */
58 
59  /* Packet data error */
61 
62  /* Message format is correct */
64 
65  /* Find equipment request packet is received */
67 
68  /* Packet packaging complete */
70 
71 
73 
74 
75 typedef enum
76 {
81 
82 /**
83  * @brief Receive UDP packet and input this API for analyzing.
84  *
85  * @attention null.
86  *
87  * @param const void* body : The start of the UDP message body data pointer.
88  * @param unsigned short length : the effective length of data.
89  * @param const airkiss_config_t* config : input struct airkiss_config_t
90  *
91  * @return >=0 : succeed (reference airkiss_lan_ret_t)
92  * @return <0 : error code (reference airkiss_lan_ret_t)
93  */
94 
95 int airkiss_lan_recv(const void* body, unsigned short length, const airkiss_config_t* config);
96 
97 
98 /**
99  * @brief Packaging the UDP packet to send.
100  *
101  * @attention null.
102  *
103  * @param airkiss_lan_cmdid_t ak_lan_cmdid : The packet type.
104  * @param void* appid : Vendor's Wechat public number id.
105  * @param void* deviceid : device model id.
106  * @param void* _datain : the data to be sent.
107  * @param unsigned short inlength : the lenth of data to be sent.
108  * @param void* _dataout : Data buffer addr.
109  * @param unsigned short* outlength : the size of data buffer.
110  * @param const airkiss_config_t* config : input struct airkiss_config_t
111  *
112  * @return >=0 : succeed (reference airkiss_lan_ret_t)
113  * @return <0 : error code (reference airkiss_lan_ret_t)
114  */
115 
116 int airkiss_lan_pack(airkiss_lan_cmdid_t ak_lan_cmdid, void* appid, void* deviceid, void* _datain, unsigned short inlength, void* _dataout, unsigned short* outlength, const airkiss_config_t* config);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* AIRKISS_H_ */
airkiss_lan_cmdid_t
Definition: airkiss.h:75
airkiss_lan_ret_t
Definition: airkiss.h:45
airkiss_memcmp_fn memcmp
Definition: airkiss.h:27
void *(* airkiss_memset_fn)(void *ptr, int value, unsigned int num)
Definition: airkiss.h:16
int airkiss_lan_pack(airkiss_lan_cmdid_t ak_lan_cmdid, void *appid, void *deviceid, void *_datain, unsigned short inlength, void *_dataout, unsigned short *outlength, const airkiss_config_t *config)
Packaging the UDP packet to send.
int(* airkiss_printf_fn)(const char *format,...)
Definition: airkiss.h:19
int airkiss_lan_recv(const void *body, unsigned short length, const airkiss_config_t *config)
Receive UDP packet and input this API for analyzing.
void *(* airkiss_memcpy_fn)(void *dst, const void *src, unsigned int num)
Definition: airkiss.h:17
const char * airkiss_version(void)
Get airkiss lib version.
airkiss_memset_fn memset
Definition: airkiss.h:25
int(* airkiss_memcmp_fn)(const void *ptr1, const void *ptr2, unsigned int num)
Definition: airkiss.h:18
airkiss_memcpy_fn memcpy
Definition: airkiss.h:26
airkiss_printf_fn printf
Definition: airkiss.h:28