下标为4Access Address 为Dongle 自己MAC地址。
下标为5Adv PDU Type 广播报文类型为ADV_IND 解释如下
#define GAP_ADTYPE_ADV_IND 0x00 //!< Connectable undirected advertisement
可非定向广播连接。
在程序中的位置为
static void gapRole_init(void)
{
// Register the current thread as an ICall dispatcher application
// so that the application can send and receive messages.
ICall_registerApp(&selfEntity, &sem);
gapRole_state = GAPROLE_INIT;
gapRole_ConnectionHandle = INVALID_CONNHANDLE;
// Get link DB maximum number of connections
linkDBNumConns = linkDB_NumConns();
// Setup timers as one-shot timers 分派一个时钟。
Util_constructClock(&startAdvClock, gapRole_clockHandler,
0, 0, false, START_ADVERTISING_EVT);
Util_constructClock(&startUpdateClock, gapRole_clockHandler,
0, 0, false, START_CONN_UPDATE_EVT);
Util_constructClock(&updateTimeoutClock, gapRole_clockHandler,
0, 0, false, CONN_PARAM_TIMEOUT_EVT);
// Initialize the Profile Advertising and Connection Parameters
gapRole_profileRole = GAP_PROFILE_PERIPHERAL;
VOID memset(gapRole_IRK, 0, KEYLEN);
VOID memset(gapRole_SRK, 0, KEYLEN);
gapRole_signCounter = 0;
gapRole_AdvEventType = GAP_ADTYPE_ADV_IND;
gapRole_AdvDirectType = ADDRTYPE_PUBLIC;
gapRole_AdvChanMap = GAP_ADVCHAN_ALL;
gapRole_AdvFilterPolicy = GAP_FILTER_POLICY_ALL;
// Restore Items from NV
VOID osal_snv_read(BLE_NVID_IRK, KEYLEN, gapRole_IRK);
VOID osal_snv_read(BLE_NVID_CSRK, KEYLEN, gapRole_SRK);
VOID osal_snv_read(BLE_NVID_SIGNCOUNTER, sizeof(uint32_t),
&gapRole_signCounter);
}
下标为6 Adv PDU Header 报头。
广播类型是通用广播(Type 为0 见AdvPDU Type)。
地址类型都是public即gapRole_AdvDirectType = ADDRTYPE_PUBLIC;见上图。(TxAdd和RxAdd都为0)。
长度字段指示PDU-Length 指AdvA + AdvData之和。
下标为7的AdvA 为本机MAC地址。在第一章中已经提到。
下标为8的AdvData为广播数据,可以在
// GAP - Advertisement data (max size = 31 bytes, though this is
// best kept short to conserve power while advertisting)
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,
// service UUID, to notify central devices what services are included
// in this peripheral
0x03, // length of this data
GAP_ADTYPE_16BIT_MORE, // some of the UUID's, but not all
#ifdef FEATURE_OAD
LO_UINT16(OAD_SERVICE_UUID),
HI_UINT16(OAD_SERVICE_UUID)
#else
LO_UINT16(SIMPLEPROFILE_SERV_UUID),
HI_UINT16(SIMPLEPROFILE_SERV_UUID)
#endif //!FEATURE_OAD
};
中找到答案。
|