ESP8266_RTOS_SDK  v1.4.0
Enumerations | Functions
AirKiss APIs

AirKiss APIs. More...

Enumerations

enum  airkiss_lan_ret_t {
  AIRKISS_LAN_ERR_OVERFLOW = -5, AIRKISS_LAN_ERR_CMD = -4, AIRKISS_LAN_ERR_PAKE = -3, AIRKISS_LAN_ERR_PARA = -2,
  AIRKISS_LAN_ERR_PKG = -1, AIRKISS_LAN_CONTINUE = 0, AIRKISS_LAN_SSDP_REQ = 1, AIRKISS_LAN_PAKE_READY = 2
}
 
enum  airkiss_lan_cmdid_t { AIRKISS_LAN_SSDP_REQ_CMD = 0x1, AIRKISS_LAN_SSDP_RESP_CMD = 0x1001, AIRKISS_LAN_SSDP_NOTIFY_CMD = 0x1002 }
 

Functions

const char * airkiss_version (void)
 Get the version information of AirKiss lib. More...
 
int airkiss_lan_recv (const void *body, unsigned short length, const airkiss_config_t *config)
 Parse the UDP packet sent by AirKiss. More...
 
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. More...
 

Detailed Description

AirKiss APIs.

API airkiss_lan_recv and airkiss_lan_pack are provided for the function that AirKiss can detect the ESP8266 devices in LAN, more details about AirKiss please refer to WeChat : http://iot.weixin.qq.com.

Workflow : Create a UDP transmission. When UDP data is received, call API airkiss_lan_recv and input the UDP data, if the airkiss_lan_recv returns AIRKISS_LAN_SSDP_REQ, airkiss_lan_pack can be called to make a response packet.

Enumeration Type Documentation

Enumerator
AIRKISS_LAN_ERR_OVERFLOW 

the length of the data buffer is lack

AIRKISS_LAN_ERR_CMD 

Do not support the type of instruction

AIRKISS_LAN_ERR_PAKE 

Error reading data package

AIRKISS_LAN_ERR_PARA 

Error function passing parameters

AIRKISS_LAN_ERR_PKG 

Packet data error

AIRKISS_LAN_CONTINUE 

Message format is correct

AIRKISS_LAN_SSDP_REQ 

Find equipment request packet is received

AIRKISS_LAN_PAKE_READY 

Packet packaging complete

Function Documentation

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.

Parameters
airkiss_lan_cmdid_tak_lan_cmdid : type of the packet.
void*appid : Vendor's Wechat public number id, got from WeChat.
void*deviceid : device model id, got from WeChat.
void*_datain : user data waiting for packet assembly.
unsignedshort inlength : the lenth of user data.
void*_dataout : data buffer addr, to store the packet got by _datain packet assembly.
unsignedshort* outlength : the size of data buffer.
constairkiss_config_t* config : input struct airkiss_config_t
Returns
>=0 : succeed (reference airkiss_lan_ret_t)
<0 : error code (reference airkiss_lan_ret_t)
int airkiss_lan_recv ( const void *  body,
unsigned short  length,
const airkiss_config_t config 
)

Parse the UDP packet sent by AirKiss.

Parameters
constvoid* body : the start of the UDP message body data pointer.
unsignedshort length : the effective length of data.
constairkiss_config_t* config : input struct airkiss_config_t
Returns
>=0 : succeed (reference airkiss_lan_ret_t)
<0 : error code (reference airkiss_lan_ret_t)
const char* airkiss_version ( void  )

Get the version information of AirKiss lib.

Attention
The lenth of version is unknown
Parameters
null.
Returns
the version information of AirKiss lib