TI BLE-Stack for Bluetooth 4.2 API Documentation
3.01.00.07
|
Files | |
file | simple_np_gap.h |
SNP GAP Layer API. | |
Functions | |
uint8_t | SNP_getGapParam (snpGetGapParamReq_t *cmdStruct) |
SNP Get GAP Parameter. More... | |
uint8_t | SNP_sendSecurityRequest (void) |
SNP Send Security Request. More... | |
uint8_t | SNP_setAdvData (snpSetAdvDataReq_t *cmdData, uint8_t len) |
SNP Set Advertisement Data. More... | |
uint8_t | SNP_setAuthenticationData (snpSetAuthDataReq_t *pReq) |
SNP Set Authentication Data. More... | |
uint8_t | SNP_setGapParam (snpSetGapParamReq_t *cmdStruct) |
SNP Set GAP Parameter. More... | |
uint8_t | SNP_setSecurityParams (snpSetSecParamReq_t *pReq) |
SNP Set Security Parameters. More... | |
uint8_t | SNP_setWhiteListFilterPolicy (snpSetWhiteListReq_t *pReq) |
SNP Set White List Filter Policy. More... | |
uint8_t | SNP_startAdv (snpStartAdvReq_t *cmdStartAdv) |
SNP Start Advertisement. More... | |
uint8_t | SNP_stopAdv (void) |
SNP Stop Advertisement. More... | |
uint8_t | SNP_terminateConn (snpTermConnReq_t *cmdStruct) |
SNP Terminate Connection. More... | |
uint8_t | SNP_updateConnParam (snpUpdateConnParamReq_t *cmdData) |
SNP Update Connection Parameters. More... | |
uint8_t SNP_getGapParam | ( | snpGetGapParamReq_t * | cmdStruct | ) |
SNP Get GAP Parameter.
AP -> NP (SNP_getGapParam)
CMD 0 | CMD 1 |
---|---|
0x35 | 0x49 |
SNP_NPI_SYNC_REQ_TYPE | SNP_GET_GAP_PARAM_REQ |
NP -> AP (SNP_getGapParam)
CMD 0 | CMD 1 |
---|---|
0x75 | 0x49 |
SNP_NPI_SYNC_RSP_TYPE | SNP_GET_GAP_PARAM_RSP |
The SNP Get GAP Parameter command is sent to the SNP to read the value of a GAP parameter.
The GAP parameters that can be retrieved are GAP Parameter IDs
AP -> NP
snpGetGapParamReq_t
Size | Description |
---|---|
2 Byte | GAP Parameter ID to Get value from. GAP Parameter IDs |
NP -> AP
snpGetGapParamRsp_t
Size | Description |
---|---|
1 Byte | Status list of status generated by the SNP. |
2 Byte | GAP Parameter ID, GAP Parameter IDs |
2 Byte | Value of GAP Parameter |
[in] | cmdStruct | :Get GAP Parameter Request Structure, snpGetGapParamReq_t |
uint8_t SNP_sendSecurityRequest | ( | void | ) |
SNP Send Security Request.
AP -> NP (SNP_sendSecurityRequest)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x4B |
SNP_NPI_ASYNC_CMD_TYPE | SNP_SEND_SECURITY_REQUEST_REQ |
NP -> AP (N/A)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x05 |
SNP_NPI_ASYNC_CMD_TYPE | SNP_EVENT_IND |
The SNP Send Security command is sent to the SNP to request the central device to establish security.
This command does not start pairing or bonding, the central may or may not choose to start the pairing/bonding process.
If the central does require pairing/bonding, SNP_EVENT_IND with SNP_SECURITY_EVT will be sent to the AP.
AP -> NP
No Parameter Structure
NP -> AP
snpEvt_t
Size | Description |
---|---|
2 Byte | SNP_SECURITY_EVT |
1 Byte | Security State Security States |
1 Byte | Status list of status generated by the SNP. |
uint8_t SNP_setAdvData | ( | snpSetAdvDataReq_t * | cmdData, |
uint8_t | len | ||
) |
SNP Set Advertisement Data.
AP -> NP (SNP_stopAdv)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x43 |
SNP_NPI_ASYNC_CMD_TYPE | SNP_SET_ADV_DATA_REQ |
NP -> AP (N/A)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x43 |
SNP_NPI_ASYNC_CMD_TYPE | SNP_SET_ADV_DATA_CNF |
The SNP Set Advertisement Data command is sent to the SNP to update the raw data of either the scan response or the advertisement information.
There are 2 buffers for the advertisement data:
When not in a connection, if advertisement is requested, the advertisement data stored in the non-connected state buffer will be advertised.
When in a connection, if advertisement is requested, the advertisement data stored in the connected state buffer will be advertised. If the connected state buffer has not been set, then the advertising data of the non-connected mode will be used. If the user does not care about differentiating advertising data in connected mode and non-connected modes, the connected mode data buffer does not have to be set.
The maximum advertisement / scan response size is 31 Bytes.
[(length of flags) 0x02, (Adv type flags) 0x01, (General Disc, no BDEDR) 0x06, 'S' 0x53, 'N' 0x4E, 'P' 0x50]
AP -> NP
snpSetAdvDataReq_t
Size | Description |
---|---|
1 Byte | Type of Advertisement Data to update Adv. data buffer |
X Byte | New Advertisement data to update with, up to 31 Bytes |
NP -> AP
snpSetAdvDataCnf_t
Size | Description |
---|---|
1 Byte | Status list of status generated by the SNP. |
[in] | *cmdData | : Advertisement Data Structure, snpSetAdvDataReq_t |
[in] | len | : Length in Bytes of snpSetAdvDataReq_t::pData |
uint8_t SNP_setAuthenticationData | ( | snpSetAuthDataReq_t * | pReq | ) |
SNP Set Authentication Data.
AP -> NP (SNP_setAuthenticationData)
CMD 0 | CMD 1 |
---|---|
0x35 | 0x4C |
SNP_NPI_SYNC_REQ_TYPE | SNP_SET_AUTHENTICATION_DATA_REQ |
NP -> AP (SNP_setAuthenticationData)
CMD 0 | CMD 1 |
---|---|
0x75 | 0x4C |
SNP_NPI_SYNC_RSP_TYPE | SNP_SEND_AUTHENTICATION_DATA_RSP |
The SNP Set Authentication data command is sent to the SNP to provide Authentication data for the pairing process.
AP -> NP
snpSetAuthDataReq_t
Size | Description |
---|---|
4 Byte | Authentication Data, 000000 - 999999 for passcode or TRUE/FALSE |
NP -> AP
snpSetAuthDataRsp_t
Size | Description |
---|---|
1 Byte | Status list of status generated by the SNP. |
[in] | pReq | : Set Authentication Data Request Structure, snpSetAuthDataReq_t |
uint8_t SNP_setGapParam | ( | snpSetGapParamReq_t * | cmdStruct | ) |
SNP Set GAP Parameter.
AP -> NP (SNP_setGapParam)
CMD 0 | CMD 1 |
---|---|
0x35 | 0x48 |
SNP_NPI_SYNC_REQ_TYPE | SNP_SET_GAP_PARAM_REQ |
NP -> AP (SNP_setGapParam)
CMD 0 | CMD 1 |
---|---|
0x75 | 0x48 |
SNP_NPI_SYNC_RSP_TYPE | SNP_SET_GAP_PARAM_RSP |
The SNP Set GAP Parameter command is sent to the SNP to modify the value of a GAP parameter.
The GAP parameters that can be set are GAP Parameter IDs
AP -> NP
snpSetGapParamReq_t
Size | Description |
---|---|
2 Byte | GAP Parameter ID to Set value to. GAP Parameter IDs |
2 Byte | Value to set |
NP -> AP
snpSetGapParamRsp_t
Size | Description |
---|---|
1 Byte | Status list of status generated by the SNP. |
[in] | cmdStruct | :Set GAP Parameter Request Structure, snpSetGapParamReq_t |
uint8_t SNP_setSecurityParams | ( | snpSetSecParamReq_t * | pReq | ) |
SNP Set Security Parameters.
AP -> NP (SNP_setSecurityParams)
CMD 0 | CMD 1 |
---|---|
0x35 | 0x4A |
SNP_NPI_SYNC_REQ_TYPE | SNP_SET_SECURITY_PARAM_REQ |
NP -> AP (SNP_setSecurityParams)
CMD 0 | CMD 1 |
---|---|
0x75 | 0x4A |
SNP_NPI_SYNC_RSP_TYPE | SNP_SET_SECURITY_PARAM_RSP |
The SNP Set Security Parameter command is used to set how device responses to security requests.
SNP_SUCCESS in SNP_SET_SECURITY_PARAM_RSP does not mean parameters have been changed, only that the NP has successfully sent the request.
AP -> NP
snpSetSecParamReq_t
Size | Description |
---|---|
2 Byte | GAP Parameter ID to Set value to. GAP Parameter IDs |
2 Byte | Value to set |
NP -> AP
snpSetSecParamRsp_t
Size | Description |
---|---|
1 Byte | Status list of status generated by the SNP. |
[in] | pReq | :Security parameter to set, snpSetSecParamReq_t |
uint8_t SNP_setWhiteListFilterPolicy | ( | snpSetWhiteListReq_t * | pReq | ) |
SNP Set White List Filter Policy.
AP -> NP (SNP_setGapParam)
CMD 0 | CMD 1 |
---|---|
0x35 | 0x4D |
SNP_NPI_SYNC_REQ_TYPE | SNP_SET_WHITE_LIST_POLICY_REQ |
NP -> AP (SNP_setGapParam)
CMD 0 | CMD 1 |
---|---|
0x75 | 0x4D |
SNP_NPI_SYNC_RSP_TYPE | SNP_SET_WHITE_LIST_POLICY_RSP |
This command is can be sent to the SNP in order to set the White List Filter Policy for Scanning and Connections.
AP -> NP
snpSetWhiteListReq_t
Size | Description |
---|---|
1 Byte | Requested white list filter policy Advertisement Filter Policy Type |
NP -> AP
snpSetWhiteListRsp_t
Size | Description |
---|---|
1 Byte | Status list of status generated by the SNP. |
[in] | pReq | : Set White List Request Structure, snpSetWhiteListReq_t |
uint8_t SNP_startAdv | ( | snpStartAdvReq_t * | cmdStartAdv | ) |
SNP Start Advertisement.
AP -> NP (SNP_startAdv)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x42 |
SNP_NPI_ASYNC_CMD_TYPE | SNP_START_ADV_REQ |
NP -> AP (N/A)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x05 |
SNP_NPI_ASYNC_CMD_TYPE | SNP_EVENT_IND |
The SNP Start Advertisement command is sent to the SNP to start advertising on all 3 channels.
Note that the SNP_setAdvData (0x43) command should be called before this command in order to set the advertising data.
If a timeout value equal to 0 is used, the SNP will advertise infinitely if it is in general advertisement mode or for 180 seconds if it is in limited discovery mode. See SNP_setGapParam (0x49) command for setting the advertising mode.
If an interval value equal to 0 is used, the default value of 100 ms will be used.
Since the SNP only supports one connection, advertisement in a connection can only be non-connectable advertisement.
If the behavior parameter is set to SNP_ADV_RESTART_ON_CONN_EST, advertising will continue with non-connectable advertising when a connection is established. The advertising interval in this case is set by the TGAP_CONN_ADV_INT_MIN and TGAP_CONN_ADV_INT_MAX parameters.
By default, those parameters are set to 1280ms. They can be changed by using SNP_setGapParam (0x49) command.
Directed Advertisements are not supported.
This event also gets sent upon power up, upon reception of this event previous connection is lost.
AP -> NP
snpStartAdvReq_t
Size | Description |
---|---|
1 Byte | Type of Advertisement Advertisement Type |
2 Byte | Timeout of advertisement (in multiple of 625us) |
2 Byte | Advertisement Interval (in multiple of 625us) |
1 Byte | (Reserved) Advertisement Filter Policy |
1 Byte | (Reserved) Initiator Address Type |
6 Byte | (Reserved) Initiator Address |
1 Byte | Behavior of Advertisement upon Connection Adv. behavior when connection are established or terminated. |
NP -> AP
snpEvt_t
Size | Description |
---|---|
2 Byte | SNP_ADV_STARTED_EVT |
1 Byte | Status list of status generated by the SNP. |
[in] | *cmdStartAdv | :advertising request structure, snpStartAdvReq_t |
uint8_t SNP_stopAdv | ( | void | ) |
SNP Stop Advertisement.
AP -> NP (SNP_stopAdv)
CMD 0 | CMD 1 |
---|---|
0x35 | 0x44 |
SNP_NPI_SYNC_REQ_TYPE | SNP_STOP_ADV_REQ |
NP -> AP (N/A)
CMD 0 | CMD 1 |
---|---|
0x75 | 0x05 |
SNP_NPI_SYNC_RSP_TYPE | SNP_EVENT_IND |
The SNP Stop Advertisement command is sent to the SNP to stop advertising.
AP -> NP
No Parameter Structure
NP -> AP
snpEvt_t
Size | Description |
---|---|
2 Byte | SNP_ADV_ENDED_EVT |
1 Byte | Status list of status generated by the SNP. |
uint8_t SNP_terminateConn | ( | snpTermConnReq_t * | cmdStruct | ) |
SNP Terminate Connection.
AP -> NP (SNP_terminateConn)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x46 |
SNP_NPI_ASYNC_CMD_TYPE | SNP_TERMINATE_CONN_REQ |
NP -> AP (N/A)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x05 |
SNP_NPI_ASYNC_CMD_TYPE | SNP_EVENT_IND |
Terminate current BLE connection.
Once connection has been terminated, SNP_EVENT_IND with SNP_CONN_TERM_EVT is sent to the AP.
AP -> NP
snpTermConnReq_t
Size | Description |
---|---|
2 Byte | Connection Handle to Terminate |
1 Byte | Termination Method GAP GATT Terminate connection request option field |
NP -> AP
snpEvt_t
Size | Description |
---|---|
2 Byte | SNP_ADV_ENDED_EVT |
2 Byte | Connection Handle Terminated |
1 Byte | Reason of Termination connection termination reason. |
[in] | cmdStruct | :Terminate Connection Request Structure, snpTermConnReq_t |
uint8_t SNP_updateConnParam | ( | snpUpdateConnParamReq_t * | cmdData | ) |
SNP Update Connection Parameters.
AP -> NP (SNP_updateConnParam)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x45 |
SNP_NPI_ASYNC_CMD_TYPE | SNP_UPDATE_CONN_PARAM_REQ |
NP -> AP (N/A)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x45 |
SNP_NPI_ASYNC_CMD_TYPE | SNP_UPDATE_CONN_PARAM_CNF |
NP -> AP (N/A)
CMD 0 | CMD 1 |
---|---|
0x55 | 0x05 |
SNP_NPI_ASYNC_CMD_TYPE | SNP_EVENT_IND |
This command is sent to the SNP to update the connection parameters while in a connection.
SNP_UPDATE_CONN_PARAM_CNF will follow the request SNP_UPDATE_CONN_PARAM_REQ, containing the status of the request as snpUpdateConnParamCnf_t structure.
Once connection parameters are updated and active, SNP_EVENT_IND with SNP_CONN_PARAM_UPDATED_EVT is sent to the AP.
AP -> NP
snpUpdateConnParamReq_t
Size | Description |
---|---|
2 Byte | Connection Handle to update parameters on |
2 Byte | Connection Interval Minimum (multiple of 1.25 ms) 7.5 ms to 4 s |
2 Byte | Connection Interval Maximum (multiple of 1.25 ms) 7.5 ms to 4 s |
2 Byte | Slave Latency (number of connection events) 0x0000 to 0x0C80 |
2 Byte | Supervision Timeout (multiple of 10 ms) 0x000A to 0x0C80 |
NP -> AP
snpUpdateConnParamCnf_t
Size | Description |
---|---|
1 Byte | Status list of status generated by the SNP. |
2 Byte | Connection Handle that connection parameter updates will occur for |
NP -> AP
snpEvt_t
Size | Description |
---|---|
2 Byte | SNP_CONN_PARAM_UPDATED_EVT |
2 Byte | Connection Handle to update parameters on |
2 Byte | Connection Interval (multiple of 1.25 ms) 7.5 ms to 4 s |
2 Byte | Slave Latency (number of connection events) 0x0000 to 0x0C80 |
2 Byte | Supervision Timeout (multiple of 10 ms) 0x000A to 0x0C80 |
[in] | *cmdData | : Update Connection Parameter Request Structure, snpUpdateConnParamReq_t |