return written;
}
+BT_EXPORT_API int bluetooth_hid_device_send_rc_key_event(const char *remote_addr,
+ hid_send_rc_key_event_t send_event)
+{
+ int result;
+ int written = 0;
+ int socket_fd;
+ hid_connected_device_info_t *info = NULL;
+
+ switch (privilege_token_send_key) {
+ case 0:
+ result = _bt_check_privilege(BT_BLUEZ_SERVICE, BT_HID_DEVICE_SEND_KEY_EVENT);
+
+ if (result == BLUETOOTH_ERROR_NONE) {
+ privilege_token_send_key = 1; /* Have a permission */
+ } else if (result == BLUETOOTH_ERROR_PERMISSION_DEINED) {
+ BT_ERR("Don't have a privilege to use this API");
+ privilege_token_send_key = -1; /* Don't have a permission */
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ } else {
+ /* Just break - It is not related with permission error */
+ }
+ break;
+ case 1:
+ /* Already have a privilege */
+ break;
+ case -1:
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ default:
+ /* Invalid privilge token value */
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ info = __find_hid_info_with_address(remote_addr);
+ if (info == NULL) {
+ BT_ERR("Connection Information not found");
+ return BLUETOOTH_ERROR_INVALID_PARAM;
+ }
+
+ if (info->intr_fd != -1 && info->ctrl_fd == -1)
+ socket_fd = info->intr_fd;
+ else
+ socket_fd = info->ctrl_fd;
+
+ written = write(socket_fd, &send_event, sizeof(send_event));
+ return written;
+}
+
BT_EXPORT_API int bluetooth_hid_device_reply_to_report(const char *remote_addr,
bluetooth_hid_header_type_t htype,
bluetooth_hid_param_type_t ptype,
unsigned char key[8];
} hid_send_key_event_t;
+typedef struct {
+ unsigned char btcode;
+ unsigned char rep_id;
+ unsigned short key[3];
+} hid_send_rc_key_event_t;
+
typedef void (*hid_cb_func_ptr)(int, hid_event_param_t *, void *);
typedef struct {
hid_send_key_event_t send_event);
/**
+ * @fn int bluetooth_hid_device_send_rc_key_event(
+ * const char *remote_addr, hid_send_rc_key_event_t send_event)
+ *
+ * @brief write the event data on the socket.
+ *
+ * This function is a asynchronous call.
+ *
+ * @return HID_ERROR_NONE - Success \n
+ * HID_ERROR_INVALID_PARAM - Invalid parameter \n
+ * HID_ERROR_NOT_INITIALIZED - Internal Error \n
+ * HID_ERROR_NOT_ENABLED - Not enabled \n
+ * HID_ERROR_INTERNAL - Not enabled \n
+ *
+ * @exception None
+ * @param[in] remote_addr device address of remote device.
+ * @param[in] send_event This indicates the event data to send to remote device.
+ * @remark None
+ */
+int bluetooth_hid_device_send_rc_key_event(const char *remote_addr,
+ hid_send_rc_key_event_t send_event);
+/**
* @fn int bluetooth_hid_device_reply_to_report(const char *remote_addr,
* bluetooth_hid_header_type_t htype,
* bluetooth_hid_param_type_t ptype,