- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone,
I tried to get the peer bd address but it does not work.
My guess is that it is related to the whole bonding, pairing procedures.
I originally wanted to have a connection without any authentication and encryption.
-> Gap Settings -> Security level: No Security ; Bonding requirement: Bonding
When connected to a peer central device I wanted to get the peer bluetooth address by calling
Cy_BLE_GAP_GetPeerBdAddr(&peerBdAdd);
cy_stc_ble_gap_peer_addr_info_t peerBdAdd;
The next step would be to have an encrypted connection without any authentication.
I know the meaning of the Security Levels: What is the difference between Bluetooth LE Secure Connections LE security mode 1 and level 3 and 4?...
What I do not know are the available (working) functions depending on the Security Level and what actions need to be taken.
Could you write a knowledge based article about this topic with code examples for each setting? If so please do not add any other functionality because it is confusing to have multiple options without knowning how they effect each other.
Thanks and best regards
Philipp
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I found my failur by studying the CE212742 example.
I wanted to use the function cy_en_ble_api_result_t Cy_BLE_GAP_GetPeerBdAddr (cy_stc_ble_gap_peer_addr_info_t * param);
In the PDL (which I really, really love working with) the parameter cy_stc_ble_gap_peer_addr_info_t * param is defined as follows:
parameter is of type cy_stc_ble_gap_peer_addr_info_t, where
param->bdHandle: Peer bdHandle
param->bdAddr: Empty buffer where the peer Bluetooth device address will be stored.
That means:
- that a variable has to be declared of type cy_stc_ble_gap_peer_addr_info_t
- (and for me it was not really obvious, but it could be me ) that I have to copy the bdHandle into this structur under .bdHandle.
- Then I can give this structur to the function to get the bdAdress.
This could look like this:
case CY_BLE_EVT_GATT_CONNECT_IND :
uint8 returns;
connectionIndParameter = *(cy_stc_ble_conn_handle_t*) eventParam; // parameter given by the connection event of type cy_stc_ble_conn_handle_t
peerBdAdd.bdHandle = connectionIndParameter.bdHandle; // Is of type cy_stc_ble_gap_peer_addr_info_t
returns = Cy_BLE_GAP_GetPeerBdAddr(&peerBdAdd);
printf("\r\n Error: %x",returns);
printf( "\r\n - > Device bdAddress:");
for(uint i=CY_BLE_BD_ADDR_SIZE ; i>0 ; i--){
printf( " %x", peerBdAdd.bdAddr.bdAddr[i-1]);
}
printf("\r\n"); // Don't forget this one
break;
Best regards
Philipp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I found my failur by studying the CE212742 example.
I wanted to use the function cy_en_ble_api_result_t Cy_BLE_GAP_GetPeerBdAddr (cy_stc_ble_gap_peer_addr_info_t * param);
In the PDL (which I really, really love working with) the parameter cy_stc_ble_gap_peer_addr_info_t * param is defined as follows:
parameter is of type cy_stc_ble_gap_peer_addr_info_t, where
param->bdHandle: Peer bdHandle
param->bdAddr: Empty buffer where the peer Bluetooth device address will be stored.
That means:
- that a variable has to be declared of type cy_stc_ble_gap_peer_addr_info_t
- (and for me it was not really obvious, but it could be me ) that I have to copy the bdHandle into this structur under .bdHandle.
- Then I can give this structur to the function to get the bdAdress.
This could look like this:
case CY_BLE_EVT_GATT_CONNECT_IND :
uint8 returns;
connectionIndParameter = *(cy_stc_ble_conn_handle_t*) eventParam; // parameter given by the connection event of type cy_stc_ble_conn_handle_t
peerBdAdd.bdHandle = connectionIndParameter.bdHandle; // Is of type cy_stc_ble_gap_peer_addr_info_t
returns = Cy_BLE_GAP_GetPeerBdAddr(&peerBdAdd);
printf("\r\n Error: %x",returns);
printf( "\r\n - > Device bdAddress:");
for(uint i=CY_BLE_BD_ADDR_SIZE ; i>0 ; i--){
printf( " %x", peerBdAdd.bdAddr.bdAddr[i-1]);
}
printf("\r\n"); // Don't forget this one
break;
Best regards
Philipp