- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I tried to get RSSI value when using Bluetooth Mouse HID Example in situation when mouse is connected.
I add to file: host_main.c file in callback function: void AppCallBack(uint32_t event, void* eventParam)
case CY_BLE_EVT_GATTC_HANDLE_VALUE_NTF:
Cy_BLE_GetRssiPeer(0);
break;
case CY_BLE_EVT_GET_RSSI_COMPLETE:
DBG_PRINTF("CONNECTION %x \r\n",(*(cy_stc_ble_gap_auth_info_t *)eventParam).bdHandle);
DBG_PRINTF("RSSI VALUE: %d \r\n\r\n", (((cy_stc_ble_rssi_info_t*) ((cy_stc_ble_events_param_generic_t*) eventParam)->eventParams)->rssi));
break;
The problem is that CY_BLE_EVT_GATTC_HANDLE_VALUE_NTF or CY_BLE_EVT_GET_RSSI_COMPLETE events are never called.
I will be very thank full for any suggestions.
My main idea is to get bluetooth mouse that automatically connect/disconnect to nearest PC. Main problem is to get rssi and when it will be below given value mouse should disconnect.
Regards,
Bartek
Solved! Go to Solution.
- Labels:
-
PSoC 6 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
It works. THANK YOU !!! 🙂
I put in mouse hid example :
...
for(i = 0u; i < CY_BLE_CONN_COUNT; i++)
{
/* Simulate and send notifications of mouse events and battery level (each 1 second) thrue all active
* connections if device is connected, pass authentication procedure (pairing) and HID host device is
* not in the suspend mode. */
if((Cy_BLE_GetConnectionState(cy_ble_connHandle[i]) == CY_BLE_CONN_STATE_CONNECTED) &&
(HidsGetSuspendState() != CY_BLE_HIDS_CP_SUSPEND) && (Cy_BLE_IsDevicePaired(&cy_ble_connHandle[i]) == true))
{
//GET RSSI
Cy_BLE_GetRssiPeer(cy_ble_connHandle[i].bdHandle);
/* Simulate mouse events */
HidsSimulateMouse(cy_ble_connHandle[i]);
....
As you mentioned and now works perfect and call event.
I'm really thank full, it helps a lot.
Best Regards,
Bartosz Niedźwiedź
ue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Bartek,
The configuration for the BLE HID mouse code example is Peripheral and Server. So you will not get the event CY_BLE_EVT_GATTC_HANDLE_VALUE_NTF in the event_handler function since the event is received by the Client when the notification is sent.
So please try calling the function Cy_BLE_GetRssiPeer(0) in the for loop of the function and see if you are getting the CY_BLE_EVT_GET_RSSI_COMPLETE event.
Thanks and regards
Ganesh
Thanks and regards
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I put it in main loop:
/***************************************************************************
* Main polling loop
***************************************************************************/
while(1)
{
Cy_BLE_GetRssiPeer(0);
uint32_t i;
/* Cy_BLE_ProcessEvents() allows BLE stack to process pending events */
Cy_BLE_ProcessEvents();
.....
Still it doesn't trigger CY_BLE_EVT_GET_RSSI_COMPLETE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The bdhandle of the connection should be given as an argument to the Cy_BLE_GetRssiPeer().
Please find the attached project in which the event CY_BLE_EVT_GET_RSSI_COMPLETE is added at line 425 of the BLEFindMe.c file.
Please note that the function Cy_BLE_GetRssiPeer() should be called only after the connection is set. This API is called in line 173 of the attached project. You can connect the kit to the PC, open the tera term and see the RSSI values printed on the terminal.
Thanks and regards
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
It works. THANK YOU !!! 🙂
I put in mouse hid example :
...
for(i = 0u; i < CY_BLE_CONN_COUNT; i++)
{
/* Simulate and send notifications of mouse events and battery level (each 1 second) thrue all active
* connections if device is connected, pass authentication procedure (pairing) and HID host device is
* not in the suspend mode. */
if((Cy_BLE_GetConnectionState(cy_ble_connHandle[i]) == CY_BLE_CONN_STATE_CONNECTED) &&
(HidsGetSuspendState() != CY_BLE_HIDS_CP_SUSPEND) && (Cy_BLE_IsDevicePaired(&cy_ble_connHandle[i]) == true))
{
//GET RSSI
Cy_BLE_GetRssiPeer(cy_ble_connHandle[i].bdHandle);
/* Simulate mouse events */
HidsSimulateMouse(cy_ble_connHandle[i]);
....
As you mentioned and now works perfect and call event.
I'm really thank full, it helps a lot.
Best Regards,
Bartosz Niedźwiedź
ue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now I try to run two connections at once l.( two computers connected to ble mouse) .
It works fine, but does any one knows how to distinguish in event CY_BLE_EVT_GET_RSSI_COMPLETE connected comouters. It means to get information with rssi is relevant to with connected device ?
I will be very thankfull for any answer.
Regards,
Bartek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bartek,
The event parameter of the event CY_BLE_EVT_GET_RSSI_COMPLETE contains the information of bdhandle which represents the connection to which the event is belonged to.
Please refer to the image attached. For more information, you can refer BLE API reference manual in the peripheral driver library.
Thanks and regards
Ganesh