Eddystone是谷歌公司制定的標(biāo)準(zhǔn)。Eddystone相對于iBeacon功能更為廣泛,可以廣播自定義唯一的信標(biāo)ID(UID)、廣播網(wǎng)(URL)、廣播自身數(shù)據(jù)(TLM/ETLM)、加密的臨時標(biāo)識符(EID)。
協(xié)議如下所示:
詳情可以參考
https://blog.csdn.net/yplwrt/article/details/129107710
由于不熟悉gap廣播,參照ibeacon的定義
static uint8_t advertData[] =
{
? // Flags; this sets the device to use limited discoverable
? // mode (advertises for 30 seconds at a time) instead of general
? // discoverable mode (advertises indefinitely)
? 0x02,? ?// length of this data
? GAP_ADTYPE_FLAGS,
? DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
? //ibeacon
?26,0xff,0x4c,0x00,0x02,0x15,0xe2,0xc5,0x6d,0xb5,0xdf,0xfb,0x48,0xd2,0xb0,0x60,0xd0,0xf5,0xa7,0x10,0x96,0xe0,0x88,0xab,0x04,0x12,0xd7
};
定義Eddystone定義錯了
static uint8_t advertData[] =
{
? // Flags; this sets the device to use limited discoverable
? // mode (advertises for 30 seconds at a time) instead of general
? // discoverable mode (advertises indefinitely)
? 0x02,? ?// length of this data
? GAP_ADTYPE_FLAGS,
? DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
? //Eddystone
? 0x1f,0x02,0x01,0x06,0x03,0x03,0xaa,0xfe,0x17,0x16,0xaa,0xfe,0x00,-10,0x00,0x01,0x02,0x03,0x04,0x05 ,0x06,
? 0x07,0x08,0x09,0x0a,0x0b,0x0e,0x0f,0x00,0x00,0x00,0x00
};
然后發(fā)送失敗,發(fā)現(xiàn)超過了31字節(jié)
修改后Eddystone能正常掃描到
static uint8_t advertData[] =
{
? 0x02,0x01,0x06,0x03,0x03,0xaa,0xfe,0x17,0x16,0xaa,0xfe,0x00,-10,0x00,0x01,0x02,0x03,0x04,0x05 ,0x06,
? 0x07,0x08,0x09,0x0a,0x0b,0x0e,0x0f,0x00,0x00,0x00,0x00
};