Languages

Menu
Sites
Language
Bluetooth HID Device

I am trying to get my watch to send a "left click" event to my computer using the Bluetooth HID API. I have made sure to bond my watch and computer together. I have also made sure to initiate the HID device connection and actived the HID device role. However, when I attempt to send a mouseEvent "bt_hid_device_send_mouse_event", on the logs I see an error:

12-24 13:15:17.675 : Debug / CHRIS ( 7330 : 7330 ) : The bluetooth adapter is already enabled!
12-24 13:15:17.811 : Info / BLUETOOTH_FRWK_API ( 7330 : 7330 ) : bt-device.c: bluetooth_unbond_device(186) >  Async Request => type=BT_BLUEZ_SERVICE, fn=BT_UNBOND_DEVICE(0x55) 
12-24 13:15:17.991 : Info / CAPI_NETWORK_BLUETOOTH ( 2751 : 2751 ) : bluetooth-common.c: __bt_event_proxy(1232) > bt_device_bond_destroyed_cb() will be called
12-24 13:15:17.995 : Info / BLUETOOTH_FRWK_API ( 7330 : 7330 ) : bt-device.c: bluetooth_bond_device(104) >  Async Request => type=BT_BLUEZ_SERVICE, fn=BT_BOND_DEVICE(0x50) 
12-24 13:15:18.035 : Warning / WECONN ( 2751 : 2751 ) : <manager.c::wc_manager_get_device_with_identifier#769> couldn't find device with given identifier. bearer=bluetooth
12-24 13:15:19.031 : Info / CAPI_NETWORK_BLUETOOTH ( 3046 : 3046 ) : bluetooth-common.c: __bt_event_proxy(1309) > bt_device_connection_state_changed_cb() will be called
12-24 13:15:19.035 : Info / CAPI_NETWORK_BLUETOOTH ( 2751 : 2751 ) : bluetooth-common.c: __bt_event_proxy(1309) > bt_device_connection_state_changed_cb() will be called
12-24 13:15:19.039 : Warning / WECONN ( 2751 : 2751 ) : <manager.c::wc_manager_get_device_with_identifier#769> couldn't find device with given identifier. bearer=bluetooth
12-24 13:15:20.371 : Info / BLUETOOTH_SYSPOPUP ( 7329 : 7329 ) : bt-syspopup.c: __bluetooth_reset(2207) > event_type : passkey-confirm-request
12-24 13:15:20.467 : Info / BLUETOOTH_SYSPOPUP ( 7329 : 7329 ) : bt-syspopup.c: __bluetooth_launch_handler(1779) > Event Type = [0x1]
12-24 13:15:20.587 : Info / BLUETOOTH_SYSPOPUP ( 7329 : 7329 ) : bt-syspopup.c: __bluetooth_launch_handler(1995) > -
12-24 13:15:20.591 : Info / BLUETOOTH_SYSPOPUP ( 7329 : 7329 ) : bt-syspopup.c: __bluetooth_reset(2262) > Block mode is not set
12-24 13:15:24.843 : Info / BLUETOOTH_SYSPOPUP ( 7329 : 7329 ) : bt-syspopup.c: __bluetooth_passkey_confirm_cb(527) > Accept the pairing passkey
12-24 13:15:24.887 : Info / BLUETOOTH_SYSPOPUP ( 7329 : 7329 ) : bt-syspopup.c: __bluetooth_remove_all_event(329) > Remove event 0X1
12-24 13:15:25.751 : Info / CAPI_NETWORK_BLUETOOTH ( 3046 : 3046 ) : bluetooth-common.c: __bt_event_proxy(1223) > bt_device_bond_created_cb() will be called
12-24 13:15:25.755 : Info / CAPI_NETWORK_BLUETOOTH ( 2751 : 2751 ) : bluetooth-common.c: __bt_event_proxy(1223) > bt_device_bond_created_cb() will be called
12-24 13:15:25.775 : Warning / WECONN ( 2751 : 2751 ) : <manager.c::wc_manager_get_device_with_identifier#769> couldn't find device with given identifier. bearer=bluetooth
12-24 13:15:25.875 : Info / BLUETOOTH_HID_AGENT ( 3085 : 3085 ) : bluetooth-hid-agent.c: __hid_agent_method(177) > method IsHidConnectable
12-24 13:15:25.875 : Info / BLUETOOTH_HID_AGENT ( 3085 : 3085 ) : bluetooth-hid-agent.c: __hid_agent_method(225) > is_hid_connectable : Connectable
12-24 13:15:25.895 : Info / CAPI_NETWORK_BLUETOOTH ( 3480 : 3480 ) : bluetooth-common.c: __bt_event_proxy(1922) > BLUETOOTH_EVENT_AVRCP_CONNECTED 
12-24 13:15:25.959 : Info / CAPI_NETWORK_BLUETOOTH ( 3110 : 3110 ) : bluetooth-common.c: __bt_event_proxy(2020) > BLUETOOTH_HID_CONNECTED
12-24 13:15:25.999 : Error / BLUETOOTH_FRWK_API ( 3480 : 3491 ) : bt-avrcp.c: bluetooth_media_player_change_track(175) > Error in copying Genre
12-24 13:15:25.999 : Info / BLUETOOTH_FRWK_API ( 3480 : 3491 ) : bt-avrcp.c: bluetooth_media_player_change_track(196) >  Sync Request => type=BT_BLUEZ_SERVICE, fn=BT_AVRCP_SET_TRACK_INFO(0xf0) 
12-24 13:15:26.115 : Info / BLUETOOTH_FRWK_API ( 3480 : 3491 ) : bt-avrcp.c: bluetooth_media_player_change_property(98) >  Sync Request => type=BT_BLUEZ_SERVICE, fn=BT_AVRCP_SET_PROPERTY(0xf1) 
12-24 13:15:26.179 : Info / BLUETOOTH_FRWK_API ( 3480 : 3491 ) : bt-avrcp.c: bluetooth_media_player_change_property(98) >  Sync Request => type=BT_BLUEZ_SERVICE, fn=BT_AVRCP_SET_PROPERTY(0xf1) 
12-24 13:15:26.243 : Info / BLUETOOTH_FRWK_API ( 3480 : 3491 ) : bt-avrcp.c: bluetooth_media_player_change_property(98) >  Sync Request => type=BT_BLUEZ_SERVICE, fn=BT_AVRCP_SET_PROPERTY(0xf1) 
12-24 13:15:31.927 : Info / BLUETOOTH_FRWK_API ( 7330 : 7330 ) : bt-hid-device.c: bluetooth_hid_device_init(583) > BT_HID_DEVICE_EVENT
12-24 13:15:31.995 : Info / BLUETOOTH_HID_AGENT ( 3085 : 3085 ) : bluetooth-hid-agent.c: __hid_agent_method(177) > method RegisterApplication
12-24 13:15:31.995 : Info / BLUETOOTH_HID_AGENT ( 3085 : 3085 ) : bluetooth-hid-manager.c: __bt_hid_check_for_callpath(70) > Sender [:1.3517] is not registered
12-24 13:15:31.995 : Info / BLUETOOTH_HID_AGENT ( 3085 : 3085 ) : bluetooth-hid-manager.c: _bt_hid_register_application(88) > Registered [sender::1.3517]
12-24 13:15:31.999 : Info / bluetooth ( 7330 : 7330 ) : bluetooth hid_device_actived!
12-24 13:15:32.035 : Error / BLUETOOTH_FRWK_API ( 7330 : 7330 ) : bt-hid-device.c: bluetooth_hid_device_send_mouse_event(773) > Connection Information not found
12-24 13:15:32.035 : Error / CAPI_NETWORK_BLUETOOTH ( 7330 : 7330 ) : bluetooth-hid.c: bt_hid_device_send_mouse_event(275) > Write failed, ret = -22

Does anyone have info? I'm assuming I'm doing something wrong on the "bt_hid_device_connect(address);"? Thank you.

Edited by: Chris DLC on 24 Dec, 2019

Responses

2 Replies
Slawek Kowalski

Why you don't check what does mean error -22?

 

int error =    bt_hid_device_send_mouse_event(const char *remote_address,
                    const bt_hid_mouse_data_s *mouse_data);

char * str = get_error_message(error);

 

Chris DLC

Thank you so much. That did help.