cc254x cc2640 WeChat access airsync-broadcast data
[Copy link]
1. Experimental purpose:
Modify ble broadcast data to comply with airsync protocol
2. Experimental environment:
Hardware platform: cc2540, cc2541, cc2640
Protocol stack version: The broadcast data of each version of the protocol stack is consistent
Compiler: iar
airsync Verification method: mac address verification
Test tool: airsyncdebugger
3. Broadcast data protocol format:
1. The protocol stipulates that the broadcast data must end with a 6-bit mac address, and the last 78 bits are manufacturer information, which can be filled with 0; the broadcast service must include WeChat service
2. Specific implementation code:
static uint8 advertData[] =
{
0x02, // length of first data structure (2 bytes excluding length byte)
GAP_ADTYPE_FLAGS, // AD Type = Flags
DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
// service UUID, to notify central devices what services are included
// in this peripheral
0x05, // length of second data structure (7 bytes excluding length byte)
GAP_ADTYPE_16BIT_MORE, // list of 16-bit UUID's available, but not complete list
LO_UINT16( WECHAT_SERV_UUID ), //Wechat Service
HI_UINT16( WECHAT_SERV_UUID ),
LO_UINT16( xxx_SERV_UUID ), //Custom Service
HI_UINT16( xxx_SERV_UUID ),
0x09,
GAP_ADTYPE_MANUFACTURER_SPECIFIC,
/*Manufacturer information, can be filled with 0*/
0x00,
0x00,
/*Device MAC address, needs to be filled when the program is running (6 Bytes)*/
0,0,0,0,0,0
};
4. Experimental results:
After modifying the broadcast data, you can test it through airsyncdebugger. Passing the first step of the test proves that the broadcast data has been modified successfully.
|