GAP
generic access profile
以下命令都是在广播过程应用的命令
C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\source\ti\blestack\profiles\roles\peripheral_broadcaster.c
调用API-设置
bStatus_t GAPRole_SetParameter(uint16_t param, uint8_t len, void *pValue)
调用API-获取
bStatus_t GAPRole_GetParameter( uint16 param, void *pValue )
举例:设置广播数据,注意多个参数时的写法
// Advertisement data (max size = 31 bytes, though this is
// best kept short to conserve power while advertising)
static uint8_t advertData[] =
{
// Flags: this field sets the device to use general discoverable
// mode (advertises indefinitely) instead of general
// discoverable mode (advertise for 30 seconds at a time)
0x02, // length of this data
GAP_ADTYPE_FLAGS,
DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
0x05,
GAP_ADTYPE_MANUFACTURER_SPECIFIC,
0x55,
0x55,
0x55,
0x55,
0x55,
// 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
LO_UINT16(SIMPLEPROFILE_SERV_UUID),
HI_UINT16(SIMPLEPROFILE_SERV_UUID)
};
GAPRole_SetParameter(GAPROLE_ADVERT_DATA, sizeof(advertData), advertData);
设备角色配置命令
C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\source\ti\blestack\profiles\roles\cc26xx\peripheral.h
命令 | 说明 |
---|---|
GAPROLE_PROFILEROLE | 此参数将返回设备角色类型(只读),4种 |
GAPROLE_IRK | 身份解析密钥(读/写)大小为uint8_t [KEYLEN]。 |
GAPROLE_SRK</ |