PV1_MakeProject/include/boardlink_iot.h

45 lines
1.1 KiB
C
Raw Normal View History

2018-08-03 11:08:48 +00:00
#ifndef BOARDLINK_IOT_H
#define BOARDLINK_IOT_H
2018-08-10 02:22:55 +00:00
#ifndef PLATFORM_CPU
2018-08-03 11:08:48 +00:00
#define BL_IOT_MSG_TAGS ("BLNLINK")
#define BL_MAX_MSG (1024)
2018-08-10 02:22:55 +00:00
#define ETH_ALEN (6)
2018-08-03 11:08:48 +00:00
typedef enum
{
MSG_IN_DISCOVERY_MODE = 0,
MSG_OUT_DISCOVERY_MODE,
2018-08-10 02:22:55 +00:00
MSG_GET_WLAN_INFO,
2018-08-03 11:08:48 +00:00
MSG_BYPASS_MODE,
} BL_IOT_MSG_TYPE;
#pragma pack (push)
#pragma pack (1)
typedef struct
{
unsigned char msgTags[8];
2018-08-10 02:22:55 +00:00
unsigned char dstMac[ETH_ALEN];
2018-08-03 11:08:48 +00:00
unsigned char msgType;
unsigned int msglen;
unsigned char msgData[BL_MAX_MSG];
} BL_IOT_MSG, *PBL_IOT_MSG;
2018-08-10 02:22:55 +00:00
typedef struct
{
unsigned char channel;
unsigned char dev_mac[ETH_ALEN];
unsigned char bssid[ETH_ALEN];
unsigned char ssid[32];
} WL_INFO, *PWL_INFO;
2018-08-03 11:08:48 +00:00
#pragma pack (pop)
2018-08-10 02:22:55 +00:00
#define BL_IOT_MSG_LEN(len) (sizeof(BL_IOT_MSG) - BL_MAX_MSG + len)
typedef void (*BlMsgCb)(PBL_IOT_MSG pMsg);
int BL_Init(BlMsgCb cbOnMsg);
int BL_SendBLMsg(BL_IOT_MSG_TYPE msgType, unsigned char* pData, unsigned int len);
int BL_SendBLMsgTo(BL_IOT_MSG_TYPE msgType, unsigned char* pData, unsigned int len, unsigned char dstMac[ETH_ALEN]);
#endif
2018-08-03 11:08:48 +00:00
#endif