Move HID APIs header related with HID device role into bluetooth. 03/68803/44
authorTaejin Woo <tt.woo@samsung.com>
Wed, 25 May 2016 03:44:08 +0000 (12:44 +0900)
committerTaejin Woo <tt.woo@samsung.com>
Thu, 16 Jun 2016 08:13:22 +0000 (17:13 +0900)
Change-Id: If8d5248b250ab7c598f2399f1ce1ef23fd8840a7
Signed-off-by: Taejin Woo <tt.woo@samsung.com>
include/mobile/bluetooth_internal.h
include/mobile/bluetooth_type.h
include/mobile/bluetooth_type_internal.h
include/tv/bluetooth_internal.h
include/tv/bluetooth_type.h
include/tv/bluetooth_type_internal.h
include/wearable/bluetooth.h
include/wearable/bluetooth_internal.h
include/wearable/bluetooth_type.h
src/bluetooth-hid.c
test/bt_unit_test.c

index ed6ce9379ec61bc0ce2e6ac3f9cd792809f5a3ce..b028b0fd2e3714ad13f61f517304442dd683fa4a 100644 (file)
@@ -2619,7 +2619,7 @@ int bt_hid_device_deactivate(void);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Initiates HID device Connection with device role
+ * @brief Initiates HID device Connection with device role, asynchronously.
  * @since_tizen 2.3.1
  * @privlevel platform
  * @privilege %http://tizen.org/privilege/bluetooth.admin
@@ -2638,6 +2638,7 @@ int bt_hid_device_deactivate(void);
  * @retval #BT_ERROR_ALREADY_DONE   Already connected
  *
  * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @pre The local device must be bonded with the remote device by bt_device_create_bond().
  * @see bt_initialize()
  * @see bt_hid_device_activate()
  */
@@ -2645,7 +2646,7 @@ int bt_hid_device_connect(const char *remote_address);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Disconnects the connection with HID Host device.
+ * @brief Disconnects the connection with HID Host device, asynchronously.
  * @since_tizen 2.3.1
  * @privlevel platform
  * @privilege %http://tizen.org/privilege/bluetooth.admin
@@ -2744,8 +2745,8 @@ int bt_hid_device_unset_data_received_cb(void);
  * @privilege %http://tizen.org/privilege/bluetooth.admin
  *
  * @param[in] remote_address device address of remote device.
- * @param[in] htype Header type to be there in response
- * @param[in] ptype Parameter type to be there in response.
+ * @param[in] header_type Header type to be there in response
+ * @param[in] param_type Parameter type to be there in response.
  * @param[in] data Data to be present in data payload of response.
  * @param[in] data_len The length of the response data
  * @retval #BT_ERROR_NONE  Successful
@@ -2758,7 +2759,7 @@ int bt_hid_device_unset_data_received_cb(void);
  * @see bt_hid_device_connection_state_changed_cb()
  */
 int bt_hid_device_reply_to_report(const char *remote_address,
-               bluetooth_hid_header_type_t htype, bluetooth_hid_param_type_t ptype,
+               bt_hid_header_type_e header_type, bt_hid_param_type_e param_type,
                const char *data, unsigned int data_len);
 
 /**
index ccddfb756f31f1db47ac0d76e35c5961114e45ac..178c1bfbede4e0784f33d7fed321a72e8d0c0432 100644 (file)
@@ -1736,63 +1736,6 @@ typedef void (*bt_nap_connection_state_changed_cb) (bool connected, const char *
  */
 typedef void (*bt_panu_connection_state_changed_cb) (int result, bool connected, const char *remote_address, bt_panu_service_type_e type, void *user_data);
 
-/* HID device related type */
-typedef struct {
-       unsigned char btcode;
-       unsigned char rep_id;
-       unsigned char button;
-       signed char axis_x;
-       signed char axis_y;
-       signed char axis_z;
-} bt_hid_mouse_data_s;
-
-typedef struct {
-       unsigned char btcode;
-       unsigned char rep_id;
-       unsigned char modify;
-       unsigned char key[8];
-} bt_hid_key_data_s;
-
-typedef enum {
-       BT_HID_HEADER_HANDSHAKE,
-       BT_HID_HEADER_HID_CONTROL,
-       BT_HID_HEADER_GET_REPORT,
-       BT_HID_HEADER_SET_REPORT,
-       BT_HID_HEADER_GET_PROTOCOL,
-       BT_HID_HEADER_SET_PROTOCOL,
-       BT_HID_HEADER_DATA,
-       BT_HID_HEADER_UNKNOWN
-} bluetooth_hid_header_type_t;
-
-typedef enum {
-       BT_HID_PARAM_DATA_RTYPE_INPUT,
-       BT_HID_PARAM_DATA_RTYPE_OUTPUT
-} bluetooth_hid_param_type_t;
-
-typedef enum {
-       BT_HID_HANDSHAKE_SUCCESSFUL = 0x00, /**< Handshake error code none */
-       BT_HID_HANDSHAKE_NOT_READY, /**< Handshake error code Not Ready */
-       BT_HID_HANDSHAKE_ERR_INVALID_REPORT_ID, /**< Handshake error code send invalid report id */
-       BT_HID_HANDSHAKE_ERR_UNSUPPORTED_REQUEST, /**< Handshake error code request unsupported request */
-       BT_HID_HANDSHAKE_ERR_INVALID_PARAMETER, /**< Handshake error code received invalid parameter */
-       BT_HID_HANDSHAKE_ERR_UNKNOWN = 0x0e, /**< unknown error */
-       BT_HID_HANDSHAKE_ERR_FATAL /**< Fatal error */
-} bluetooth_hid_handshake_type_t;
-
-typedef struct {
-       const char *address;
-       bluetooth_hid_header_type_t type;
-       bluetooth_hid_param_type_t param;
-       int data_size;  /**< The length of the received data */
-       const char *data;     /**< The received data */
-} bt_hid_device_received_data_s;
-
-typedef void (*bt_hid_device_connection_state_changed_cb) (int result,
-       bool connected, const char *remote_address, void *user_data);
-
-typedef void (*bt_hid_device_data_received_cb)(const bt_hid_device_received_data_s *data, void *user_data);
-/* HID device related type */
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 3c594127af1e4728c270216d0ad319dd3e6ea1bb..4284fe6c16c187eac53632df3e91aa5645037f35 100644 (file)
@@ -339,6 +339,64 @@ typedef struct {
        char **uuids;
 } bt_dpm_uuids_list_s;
 
+/* HID device related type */
+typedef struct {
+      unsigned char btcode;
+      unsigned char rep_id;
+      unsigned char button;
+      signed char axis_x;
+      signed char axis_y;
+      signed char padding;
+} bt_hid_mouse_data_s;
+
+typedef struct {
+      unsigned char btcode;
+      unsigned char rep_id;
+      unsigned char modifier;
+      unsigned char key[8];
+} bt_hid_key_data_s;
+
+typedef enum {
+      BT_HID_HEADER_HANDSHAKE,
+      BT_HID_HEADER_HID_CONTROL,
+      BT_HID_HEADER_GET_REPORT,
+      BT_HID_HEADER_SET_REPORT,
+      BT_HID_HEADER_GET_PROTOCOL,
+      BT_HID_HEADER_SET_PROTOCOL,
+      BT_HID_HEADER_DATA,
+      BT_HID_HEADER_UNKNOWN
+} bt_hid_header_type_e;
+
+typedef enum {
+      BT_HID_PARAM_DATA_RTYPE_INPUT,
+      BT_HID_PARAM_DATA_RTYPE_OUTPUT
+} bt_hid_param_type_e;
+
+typedef enum {
+      BT_HID_HANDSHAKE_SUCCESSFUL = 0x00, /**< Handshake error code none */
+      BT_HID_HANDSHAKE_NOT_READY, /**< Handshake error code Not Ready */
+      BT_HID_HANDSHAKE_ERR_INVALID_REPORT_ID, /**< Handshake error code send invalid report id */
+      BT_HID_HANDSHAKE_ERR_UNSUPPORTED_REQUEST, /**< Handshake error code request unsupported request */
+      BT_HID_HANDSHAKE_ERR_INVALID_PARAMETER, /**< Handshake error code received invalid parameter */
+      BT_HID_HANDSHAKE_ERR_UNKNOWN = 0x0e, /**< unknown error */
+      BT_HID_HANDSHAKE_ERR_FATAL /**< Fatal error */
+} bt_hid_handshake_type_e;
+
+typedef struct {
+      const char *address;
+      bt_hid_header_type_e header_type;
+      bt_hid_param_type_e param_type;
+      int data_size;  /**< The length of the received data */
+      const char *data;     /**< The received data */
+} bt_hid_device_received_data_s;
+
+typedef void (*bt_hid_device_connection_state_changed_cb) (int result,
+      bool connected, const char *remote_address, void *user_data);
+
+typedef void (*bt_hid_device_data_received_cb)(const bt_hid_device_received_data_s *data, void *user_data);
+/* HID device related type */
+
+
 /**
  * @}
  */
index cedf9dcbe59ba3bf28850b8ab8acc991e80e57c0..acf8fe89f877bbd647a12ecfcfe0c6b243f7570a 100644 (file)
@@ -2620,7 +2620,7 @@ int bt_hid_device_deactivate(void);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Initiates HID device Connection with device role
+ * @brief Initiates HID device Connection with device role, asynchronously.
  * @since_tizen 2.3.1
  * @privlevel platform
  * @privilege %http://tizen.org/privilege/bluetooth.admin
@@ -2639,6 +2639,7 @@ int bt_hid_device_deactivate(void);
  * @retval #BT_ERROR_ALREADY_DONE   Already connected
  *
  * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @pre The local device must be bonded with the remote device by bt_device_create_bond().
  * @see bt_initialize()
  * @see bt_hid_device_activate()
  */
@@ -2646,7 +2647,7 @@ int bt_hid_device_connect(const char *remote_address);
 
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Disconnects the connection with HID Host device.
+ * @brief Disconnects the connection with HID Host device, asynchronously.
  * @since_tizen 2.3.1
  * @privlevel platform
  * @privilege %http://tizen.org/privilege/bluetooth.admin
@@ -2745,8 +2746,8 @@ int bt_hid_device_unset_data_received_cb(void);
  * @privilege %http://tizen.org/privilege/bluetooth.admin
  *
  * @param[in] remote_address device address of remote device.
- * @param[in] htype Header type to be there in response
- * @param[in] ptype Parameter type to be there in response.
+ * @param[in] header_type Header type to be there in response
+ * @param[in] param_type Parameter type to be there in response.
  * @param[in] data Data to be present in data payload of response.
  * @param[in] data_len The length of the response data
  * @retval #BT_ERROR_NONE  Successful
@@ -2759,7 +2760,7 @@ int bt_hid_device_unset_data_received_cb(void);
  * @see bt_hid_device_connection_state_changed_cb()
  */
 int bt_hid_device_reply_to_report(const char *remote_address,
-               bluetooth_hid_header_type_t htype, bluetooth_hid_param_type_t ptype,
+               bt_hid_header_type_e header_type, bt_hid_param_type_e param_type,
                const char *data, unsigned int data_len);
 
 /**
index 9da5a01a95bdb9bd55da10ab978dbd4dc527193e..81771ed550784cd7ee6b543889bd44d2c614257f 100644 (file)
@@ -1738,64 +1738,6 @@ typedef void (*bt_nap_connection_state_changed_cb) (bool connected, const char *
  */
 typedef void (*bt_panu_connection_state_changed_cb) (int result, bool connected, const char *remote_address, bt_panu_service_type_e type, void *user_data);
 
-/* HID device related type */
-typedef struct {
-       unsigned char btcode;
-       unsigned char rep_id;
-       unsigned char button;
-       signed char axis_x;
-       signed char axis_y;
-       signed char axis_z;
-} bt_hid_mouse_data_s;
-
-typedef struct {
-       unsigned char btcode;
-       unsigned char rep_id;
-       unsigned char modify;
-       unsigned char key[8];
-} bt_hid_key_data_s;
-
-typedef enum {
-       BT_HID_HEADER_HANDSHAKE,
-       BT_HID_HEADER_HID_CONTROL,
-       BT_HID_HEADER_GET_REPORT,
-       BT_HID_HEADER_SET_REPORT,
-       BT_HID_HEADER_GET_PROTOCOL,
-       BT_HID_HEADER_SET_PROTOCOL,
-       BT_HID_HEADER_DATA,
-       BT_HID_HEADER_UNKNOWN
-} bluetooth_hid_header_type_t;
-
-typedef enum {
-       BT_HID_PARAM_DATA_RTYPE_INPUT,
-       BT_HID_PARAM_DATA_RTYPE_OUTPUT
-} bluetooth_hid_param_type_t;
-
-typedef enum {
-       BT_HID_HANDSHAKE_SUCCESSFUL = 0x00, /**< Handshake error code none */
-       BT_HID_HANDSHAKE_NOT_READY, /**< Handshake error code Not Ready */
-       BT_HID_HANDSHAKE_ERR_INVALID_REPORT_ID, /**< Handshake error code send invalid report id */
-       BT_HID_HANDSHAKE_ERR_UNSUPPORTED_REQUEST, /**< Handshake error code request unsupported request */
-       BT_HID_HANDSHAKE_ERR_INVALID_PARAMETER, /**< Handshake error code received invalid parameter */
-       BT_HID_HANDSHAKE_ERR_UNKNOWN = 0x0e, /**< unknown error */
-       BT_HID_HANDSHAKE_ERR_FATAL /**< Fatal error */
-} bluetooth_hid_handshake_type_t;
-
-typedef struct {
-       const char *address;
-       bluetooth_hid_header_type_t type;
-       bluetooth_hid_param_type_t param;
-       int data_size;  /**< The length of the received data */
-       const char *data;     /**< The received data */
-} bt_hid_device_received_data_s;
-
-typedef void (*bt_hid_device_connection_state_changed_cb) (int result,
-       bool connected, const char *remote_address,
-       void *user_data);
-
-typedef void (*bt_hid_device_data_received_cb)(const bt_hid_device_received_data_s *data, void *user_data);
-/* HID device related type */
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 85159c4da6679740b51bced55bf29bc04fb5b562..56e122bf5b7575b44c47f12a8ee9f2872530964c 100644 (file)
@@ -339,6 +339,65 @@ typedef struct {
        char **uuids;
 } bt_dpm_uuids_list_s;
 
+/* HID device related type */
+typedef struct {
+      unsigned char btcode;
+      unsigned char rep_id;
+      unsigned char button;
+      signed char axis_x;
+      signed char axis_y;
+      signed char axis_z;
+} bt_hid_mouse_data_s;
+
+typedef struct {
+      unsigned char btcode;
+      unsigned char rep_id;
+      unsigned char modify;
+      unsigned char key[8];
+} bt_hid_key_data_s;
+
+typedef enum {
+      BT_HID_HEADER_HANDSHAKE,
+      BT_HID_HEADER_HID_CONTROL,
+      BT_HID_HEADER_GET_REPORT,
+      BT_HID_HEADER_SET_REPORT,
+      BT_HID_HEADER_GET_PROTOCOL,
+      BT_HID_HEADER_SET_PROTOCOL,
+      BT_HID_HEADER_DATA,
+      BT_HID_HEADER_UNKNOWN
+} bt_hid_header_type_e;
+
+typedef enum {
+      BT_HID_PARAM_DATA_RTYPE_INPUT,
+      BT_HID_PARAM_DATA_RTYPE_OUTPUT
+} bt_hid_param_type_e;
+
+typedef enum {
+      BT_HID_HANDSHAKE_SUCCESSFUL = 0x00, /**< Handshake error code none */
+      BT_HID_HANDSHAKE_NOT_READY, /**< Handshake error code Not Ready */
+      BT_HID_HANDSHAKE_ERR_INVALID_REPORT_ID, /**< Handshake error code send invalid report id */
+      BT_HID_HANDSHAKE_ERR_UNSUPPORTED_REQUEST, /**< Handshake error code request unsupported request */
+      BT_HID_HANDSHAKE_ERR_INVALID_PARAMETER, /**< Handshake error code received invalid parameter */
+      BT_HID_HANDSHAKE_ERR_UNKNOWN = 0x0e, /**< unknown error */
+      BT_HID_HANDSHAKE_ERR_FATAL /**< Fatal error */
+} bluetooth_hid_handshake_type_e;
+
+typedef struct {
+      const char *address;
+      bt_hid_header_type_e type;
+      bt_hid_param_type_e param;
+      int data_size;  /**< The length of the received data */
+      const char *data;     /**< The received data */
+} bt_hid_device_received_data_s;
+
+typedef void (*bt_hid_device_connection_state_changed_cb) (int result,
+      bool connected, const char *remote_address,
+      void *user_data);
+
+typedef void (*bt_hid_device_data_received_cb)(const bt_hid_device_received_data_s *data, void *user_data);
+/* HID device related type */
+
+
 /**
  * @}
  */
index 1bb867be29aa74d14a9dc5217d29d9ebe79e4471..15d3b19ab69b915ec9295c1b3768e938beb7ccc4 100644 (file)
@@ -2211,7 +2211,7 @@ int bt_opp_client_push_files(const char *remote_address, bt_opp_client_push_resp
 int bt_opp_client_cancel_push(void);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_HOST_MODULE
  * @brief Initializes the Bluetooth HID(Human Interface Device) Host.
  * @since_tizen 2.3.1
  * @remarks This function must be called before Bluetooth HID Host starts. \n
@@ -2233,7 +2233,7 @@ int bt_opp_client_cancel_push(void);
 int bt_hid_host_initialize(bt_hid_host_connection_state_changed_cb connection_cb, void *user_data);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_HOST_MODULE
  * @brief Deinitializes the Bluetooth HID(Human Interface Device) Host.
  * @since_tizen 2.3.1
  * @return 0 on success, otherwise a negative error value.
@@ -2248,7 +2248,7 @@ int bt_hid_host_initialize(bt_hid_host_connection_state_changed_cb connection_cb
 int bt_hid_host_deinitialize(void);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_HOST_MODULE
  * @brief Connects the remote device with the HID(Human Interface Device) service, asynchronously.
  * @since_tizen 2.3.1
  * @privlevel public
@@ -2272,7 +2272,7 @@ int bt_hid_host_deinitialize(void);
 int bt_hid_host_connect(const char *remote_address);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_HOST_MODULE
  * @brief Disconnects the remote device with the HID(Human Interface Device) service, asynchronously.
  * @since_tizen 2.3.1
  * @privlevel public
@@ -2295,6 +2295,213 @@ int bt_hid_host_connect(const char *remote_address);
  */
 int bt_hid_host_disconnect(const char *remote_address);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Activates the Bluetooth HID Device role.
+ * @since_tizen 3.0
+ * @privlevel pubilc
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @remarks This function must be called to register HID UUID.
+ * Only then a remote device is able to identify this one as a HID device.
+ *
+ * @param[in] callback  The callback called when the connection state is changed
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED  Not enabled
+ * @retval #BT_ERROR_NOW_IN_PROGRESS  Already activated
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @see bt_initialize()
+ * @see bt_hid_device_deactivate()
+ */
+int bt_hid_device_activate(bt_hid_device_connection_state_changed_cb callback, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Deactivates the Bluetooth HID Device role.
+ * @since_tizen 3.0
+ * @privlevel pubilc
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @remarks This function must be called to deregister the HID UUID.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED  Not enabled
+ * @retval #BT_ERROR_NOT_IN_PROGRESS  Not activated
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @see bt_initialize()
+ * @see bt_hid_device_activate()
+ */
+int bt_hid_device_deactivate(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Initiates the HID device connection with the Device role, asynchronously.
+ * @since_tizen 3.0
+ * @privlevel pubilc
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @remarks This function must be called to Initiate the HID device role connection.
+ *
+ * @param[in] remote_address The remote device's address.
+
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED  Not enabled
+ * @retval #BT_ERROR_NOT_IN_PROGRESS  Not activated
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_ALREADY_DONE   Already connected
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @pre The local device must be bonded with the remote device by bt_device_create_bond().
+ * @see bt_initialize()
+ * @see bt_hid_device_activate()
+ */
+int bt_hid_device_connect(const char *remote_address);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Disconnects from the HID Host device, asynchronously.
+ * @since_tizen 3.0
+ * @privlevel pubilc
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] remote_address The remote device's address.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED  Not enabled
+ * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @pre The Bluetooth service must be initialized with bt_initialize().
+ * @see bt_initialize()
+ * @see bt_hid_device_connection_state_changed_cb()
+ */
+int bt_hid_device_disconnect(const char *remote_address);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Sends the mouse event data to the remote device.
+ * @since_tizen 3.0
+ * @privlevel pubilc
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] remote_address The remote device's address.
+ * @param[in] mouse_data The mouse data to be passed to the remote device.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @pre The HID connection must be established.
+ * @see bt_hid_device_connection_state_changed_cb()
+ */
+int bt_hid_device_send_mouse_event(const char *remote_address,
+                  const bt_hid_mouse_data_s *mouse_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Sends the keyboard event data to the remote device.
+ * @since_tizen 3.0
+ * @privlevel pubilc
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] remote_address The remote device's address.
+ * @param[in] key_data The key data to be passed to the remote device
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @pre The HID connection must be established.
+ * @see bt_hid_device_connection_state_changed_cb()
+ */
+int bt_hid_device_send_key_event(const char *remote_address,
+                  const bt_hid_key_data_s *key_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Sets the callback called when the device receives data from the HID Host.
+ * @since_tizen 3.0
+ *
+ * @param[in] callback The callback function to be set when data is received.
+ * @param[in] user_data The user data to be passed to the callback.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @see bt_hid_device_connection_state_changed_cb()
+ */
+int bt_hid_device_set_data_received_cb(bt_hid_device_data_received_cb callback, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Unsets the data received callback.
+ * @since_tizen 3.0
+ *
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @see bt_hid_device_connection_state_changed_cb()
+ */
+int bt_hid_device_unset_data_received_cb(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Responds to reports from the HID Host.
+ * @since_tizen 3.0
+ * @privlevel pubilc
+ * @privilege %http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] remote_address The remote device's address.
+ * @param[in] header_type The response header type
+ * @param[in] param_type The response parameter type
+ * @param[in] data The response data
+ * @param[in] data_len The length of the response data
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED  Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
+ *
+ * @pre The HID connection must be established.
+ * @see bt_hid_device_connection_state_changed_cb()
+ */
+int bt_hid_device_reply_to_report(const char *remote_address,
+                               bt_hid_header_type_e header_type,
+                               bt_hid_param_type_e param_type,
+                           const char *data, unsigned int data_len);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
  * @brief Initializes the Bluetooth profiles related with audio.
index 8815bf3beba40795730b7a9246e899288959deda..5eef0e4d6f5a153b564253d5bfd679baca396d5b 100644 (file)
@@ -2911,203 +2911,6 @@ int bt_panu_disconnect(const char *remote_address);
 int bt_device_le_conn_update(const char *device_address,
                             const bt_le_conn_update_s *parameters);
 
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Registers the method for HID Device role
- * @since_tizen 2.3.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @remarks This function must be called to register HID UUID
- * then only remote device could be able identify this one as HID device
- *
- * @param[in] callback  The callback called when the connection state is changed
- * @param[in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_NOW_IN_PROGRESS  Already activated
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED   Not supported
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_hid_device_deactivate()
- */
-int bt_hid_device_activate(bt_hid_device_connection_state_changed_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Unregisters the method for HID Device role
- * @since_tizen 2.3.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @remarks This function must be called to deregister HID UUID
- *
- * @param[in] socket_fd on which uuid need to be deregistered.
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_NOT_IN_PROGRESS  Not activated
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_hid_device_activate()
- */
-int bt_hid_device_deactivate(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Initiates HID device Connection with device role
- * @since_tizen 2.3.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @remarks This function must be called to Initiate Hid device role connection
- *
- * @param[in] remote_address device address of remote device.
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_NOT_IN_PROGRESS  Not activated
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_ALREADY_DONE   Already connected
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_hid_device_activate()
- */
-int bt_hid_device_connect(const char *remote_address);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Disconnects the connection with HID Host device.
- * @since_tizen 2.3.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] remote_address device address of remote device.
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The Bluetooth service must be initialized with bt_initialize().
- * @see bt_initialize()
- * @see bt_hid_device_connection_state_changed_cb()
- */
-int bt_hid_device_disconnect(const char *remote_address);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Sends the mouse event data.
- * @since_tizen 2.3.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] remote_address device address of remote device.
- * @param[in] mouse_data mouse data that need to be passed to remote device
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The HID connection must be established.
- * @see bt_hid_device_connection_state_changed_cb()
- */
-int bt_hid_device_send_mouse_event(const char *remote_address,
-                       const bt_hid_mouse_data_s *mouse_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Sends the keyboard event data.
- * @since_tizen 2.3.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] remote_address device address of remote device.
- * @param[in] key_data  key data the need to be passed to remote device
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The HID connection must be established.
- * @see bt_hid_device_connection_state_changed_cb()
- */
-int bt_hid_device_send_key_event(const char *remote_address,
-                       const bt_hid_key_data_s *key_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Sets the callback when device gets some data from HID Host.
- * @since_tizen 2.3.1
- *
- * @param[in] callback  callback function to be set when data is received.
- * @param[in] user_data data from application which will be provided in callback.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see bt_hid_device_connection_state_changed_cb()
- */
-int bt_hid_device_set_data_received_cb(bt_hid_device_data_received_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Unsets the callback when device gets some data from HID Host.
- * @since_tizen 2.3.1
- *
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- *
- * @see bt_hid_device_connection_state_changed_cb()
- */
-int bt_hid_device_unset_data_received_cb(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
- * @brief Responds to the reports from HID Host.
- * @since_tizen 2.3.1
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] remote_address device address of remote device.
- * @param[in] htype Header type to be there in response
- * @param[in] ptype Parameter type to be there in response.
- * @param[in] data Data to be present in data payload of response.
- * @param[in] data_len The length of the response data
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- *
- * @pre The HID connection must be established.
- * @see bt_hid_device_connection_state_changed_cb()
- */
-int bt_hid_device_reply_to_report(const char *remote_address,
-               bluetooth_hid_header_type_t htype, bluetooth_hid_param_type_t ptype,
-               const char *data, unsigned int data_len);
-
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_DPM_MODULE
  * @brief Sets Restriction for BT mode(BT allowed or not).
index c7538f9353c86c3a358b276e80d0fbbad6a02cac..e9f7285ec68d5bce6f31b8cd8667e81caf308738 100644 (file)
@@ -1447,7 +1447,7 @@ typedef void (*bt_avrcp_shuffle_mode_changed_cb) (bt_avrcp_shuffle_mode_e shuffl
 typedef void (*bt_avrcp_scan_mode_changed_cb) (bt_avrcp_scan_mode_e scan, void *user_data);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_HOST_MODULE
  * @brief  Called when the connection state is changed.
  * @since_tizen 2.3.1
  *
@@ -1611,39 +1611,76 @@ typedef void (*bt_nap_connection_state_changed_cb) (bool connected, const char *
  */
 typedef void (*bt_panu_connection_state_changed_cb) (int result, bool connected, const char *remote_address, bt_panu_service_type_e type, void *user_data);
 
-/* HID device related type */
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Enumerations of the Bluetooth HID mouse's button.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BT_HID_MOUSE_BUTTON_NONE = 0x00, /**<The mouse's none value*/
+       BT_HID_MOUSE_BUTTON_LEFT = 0x01, /**<The mouse's left button value*/
+       BT_HID_MOUSE_BUTTON_RIGHT = 0x02,  /**<The mouse's right button value*/
+       BT_HID_MOUSE_BUTTON_MIDDLE = 0x04 /**<The mouse's middle button value*/
+} bt_hid_mouse_button_e;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief The structure type containing the HID mouse event information.
+ * @since_tizen 3.0
+ *
+ * @see bt_hid_device_send_mouse_event()
+ */
 typedef struct {
-       unsigned char btcode;
-       unsigned char rep_id;
-       unsigned char button;
-       signed char axis_x;
-       signed char axis_y;
-       signed char axis_z;
+       int buttons; /**< The button values, we can combine key's values when we pressed multiple mouse buttons*/
+       int axis_x; /**< The location's x value, -128 ~127 */
+       int axis_y; /**< The location's y value, -128 ~127 */
+       int padding; /**< The padding value, -128 ~127 */
 } bt_hid_mouse_data_s;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief The structure type containing the HID keyboard event information.
+ * @since_tizen 3.0
+ * @details If you want to know more detail values, refer to http://www.usb.org/developers/hidpage/ and see "HID Usage Tables"
+ *
+ * @see bt_hid_device_send_key_event()
+ */
 typedef struct {
-       unsigned char btcode;
-       unsigned char rep_id;
-       unsigned char modify;
-       unsigned char key[8];
+       unsigned char modifier; /**< The modifier keys : such as shift, alt */
+       unsigned char key[8]; /**< The key value - currently pressed keys : Max 8 at once */
 } bt_hid_key_data_s;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Enumerations of the Bluetooth HID header type.
+ * @since_tizen 3.0
+ */
 typedef enum {
-       BT_HID_HEADER_HANDSHAKE,
-       BT_HID_HEADER_HID_CONTROL,
-       BT_HID_HEADER_GET_REPORT,
-       BT_HID_HEADER_SET_REPORT,
-       BT_HID_HEADER_GET_PROTOCOL,
-       BT_HID_HEADER_SET_PROTOCOL,
-       BT_HID_HEADER_DATA,
-       BT_HID_HEADER_UNKNOWN
-} bluetooth_hid_header_type_t;
-
+       BT_HID_HEADER_HANDSHAKE, /**< The Bluetooth HID header type: Handshake */
+       BT_HID_HEADER_HID_CONTROL, /**< The Bluetooth HID header type: HID control */
+       BT_HID_HEADER_GET_REPORT, /**< The Bluetooth HID header type: Get report */
+       BT_HID_HEADER_SET_REPORT, /**< The Bluetooth HID header type: Set report */
+       BT_HID_HEADER_GET_PROTOCOL, /**< The Bluetooth HID header type: Get protocol */
+       BT_HID_HEADER_SET_PROTOCOL, /**< The Bluetooth HID header type: Set protocol */
+       BT_HID_HEADER_DATA, /**< The Bluetooth HID header type: Data */
+       BT_HID_HEADER_UNKNOWN /**< The Bluetooth HID header type: Unknown */
+} bt_hid_header_type_e;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Enumerations of the Bluetooth HID parameter type.
+ * @since_tizen 3.0
+ */
 typedef enum {
-       BT_HID_PARAM_DATA_RTYPE_INPUT,
-       BT_HID_PARAM_DATA_RTYPE_OUTPUT
-} bluetooth_hid_param_type_t;
+       BT_HID_PARAM_DATA_RTYPE_INPUT, /**< Parameter type: Input */
+       BT_HID_PARAM_DATA_RTYPE_OUTPUT /**< Parameter type: Output */
+} bt_hid_param_type_e;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief Enumerations of the Bluetooth HID handshake type.
+ * @since_tizen 3.0
+ */
 typedef enum {
        BT_HID_HANDSHAKE_SUCCESSFUL = 0x00, /**< Handshake error code none */
        BT_HID_HANDSHAKE_NOT_READY, /**< Handshake error code Not Ready */
@@ -1652,19 +1689,50 @@ typedef enum {
        BT_HID_HANDSHAKE_ERR_INVALID_PARAMETER, /**< Handshake error code received invalid parameter */
        BT_HID_HANDSHAKE_ERR_UNKNOWN = 0x0e, /**< unknown error */
        BT_HID_HANDSHAKE_ERR_FATAL /**< Fatal error */
-} bluetooth_hid_handshake_type_t;
+} bt_hid_handshake_type_e;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief The structure type containing data received from the HID Host.
+ * @since_tizen 3.0
+ */
 typedef struct {
-       const char *address;
-       bluetooth_hid_header_type_t type;
-       bluetooth_hid_param_type_t param;
+       const char *address;  /**< The remote device's address  */
+       bt_hid_header_type_e header_type;  /**< The header type */
+       bt_hid_param_type_e param_type;  /**< The parameter type */
        int data_size;  /**< The length of the received data */
        const char *data;     /**< The received data */
 } bt_hid_device_received_data_s;
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief  Called when the Bluetooth HID Device connection state changes.
+ * @details The following error codes can be delivered: \n
+ *             #BT_ERROR_NONE \n
+ *             #BT_ERROR_OPERATION_FAILED \n
+ * @since_tizen 3.0
+ *
+ * @param[in]   result  The result of changing the connection state.
+ * @param[in]   connected  The requested state. @a true means the connection is enabled, @false means the connection is disabled.
+ * @param[in]   remote_address  The remote device's address
+ * @param[in]   user_data  The user data passed from the callback registration function
+ * @see bt_hid_device_activate()
+ */
 typedef void (*bt_hid_device_connection_state_changed_cb) (int result,
        bool connected, const char *remote_address, void *user_data);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_HID_DEVICE_MODULE
+ * @brief  Called when the HID Device receives data from the HID Host.
+ * @details The following error codes can be delivered: \n
+ *             #BT_ERROR_NONE \n
+ *             #BT_ERROR_OPERATION_FAILED \n
+ * @since_tizen 3.0
+ *
+ * @param[in]   data  The data received from the HID Host.
+ * @param[in]   user_data  The user data passed from the callback registration function
+ * @see bt_hid_device_set_data_received_cb()
+ */
 typedef void (*bt_hid_device_data_received_cb)(const bt_hid_device_received_data_s *data, void *user_data);
 /* HID device related type */
 
index 5071e794d27644a4c43802f03869cdeecb7e08d3..06a59a57542334b74fbd05d76a8036e4ab95a3f3 100644 (file)
@@ -236,6 +236,23 @@ int bt_hid_device_send_mouse_event(const char *remote_address,
        BT_CHECK_INPUT_PARAMETER(remote_address);
        BT_CHECK_INPUT_PARAMETER(mouse_data);
 
+       if (mouse_data->buttons != BT_HID_MOUSE_BUTTON_LEFT ||
+               mouse_data->buttons != BT_HID_MOUSE_BUTTON_RIGHT ||
+               mouse_data->buttons != BT_HID_MOUSE_BUTTON_MIDDLE) {
+               return BT_ERROR_INVALID_PARAMETER;
+       }
+
+       if (mouse_data->axis_x > 127 || mouse_data->axis_x < -128) {
+               BT_ERR("Exceed range of axis_x");
+               return -1;
+       } else if (mouse_data->axis_y > 127 || mouse_data->axis_y < -128) {
+               BT_ERR("Exceed range of axis_y");
+               return -1;
+       } else if (mouse_data->padding > 127 || mouse_data->padding < -128) {
+               BT_ERR("Exceed range of padding");
+               return -1;
+       }
+
        ret = bluetooth_hid_device_send_mouse_event(remote_address,
                        *(hid_send_mouse_event_t *)mouse_data);
        if (ret <= 0) {
@@ -290,8 +307,8 @@ int bt_hid_device_send_key_event(const char *remote_address,
 }
 
 int bt_hid_device_reply_to_report(const char *remote_address,
-               bluetooth_hid_header_type_t htype,
-               bluetooth_hid_param_type_t ptype,
+               bt_hid_header_type_e header_type,
+               bt_hid_param_type_e param_type,
                const char *data, unsigned int data_len)
 {
        int ret;
@@ -299,8 +316,8 @@ int bt_hid_device_reply_to_report(const char *remote_address,
        BT_CHECK_INIT_STATUS();
        BT_CHECK_INPUT_PARAMETER(remote_address);
 
-       ret = bluetooth_hid_device_reply_to_report(remote_address, htype,
-                               ptype, data, data_len);
+       ret = bluetooth_hid_device_reply_to_report(remote_address, header_type,
+                               param_type, data, data_len);
        if (ret <= 0) {
                if (ret == -1) {
                        /* write fail case */
index 363c1281a2c361ed872ed1aae370ef7e3fd9c0ac..8ad58448426c5b059c1ddb6259f50a4dbedcb17e 100644 (file)
@@ -1653,10 +1653,10 @@ static void __bt_hid_device_data_received_cb(const bt_hid_device_received_data_s
                return;
        }
        TC_PRT("Address: %s", data->address);
-       TC_PRT("Type: %d", data->type);
-       TC_PRT("Param: %d", data->param);
+       TC_PRT("Type: %d", data->header_type);
+       TC_PRT("Param_type: %d", data->param_type);
 
-       switch (data->type) {
+       switch (data->header_type) {
        case BT_HID_HEADER_HANDSHAKE:
                TC_PRT("HANDSHAKE data");
                break;
@@ -1672,7 +1672,7 @@ static void __bt_hid_device_data_received_cb(const bt_hid_device_received_data_s
                /* Will send character 'a' */
                char    pressedkey[8]    = { 4, 0, 0, 0,  0, 0, 0, 0 };
                memcpy(send_data.key, pressedkey, 8);
-               send_data.modify = 0;
+               send_data.modifier = 0;
                if (data->data[1] == 0x02) {
                ret = bt_hid_device_reply_to_report(remote_addr,
                                BT_HID_HEADER_GET_REPORT,
@@ -1719,7 +1719,7 @@ static void __bt_hid_device_data_received_cb(const bt_hid_device_received_data_s
                break;
        }
 
-       switch (data->param) {
+       switch (data->param_type) {
        case BT_HID_PARAM_DATA_RTYPE_INPUT:
                TC_PRT("Input Report");
                break;
@@ -7263,8 +7263,8 @@ int test_input_callback(void *data)
                        bt_hid_mouse_data_s send_data;
                        int i;
 
-                       send_data.button = 1;
-                       send_data.axis_z  = 0x00;
+                       send_data.buttons = 1;
+                       send_data.padding  = BT_HID_MOUSE_BUTTON_LEFT;
 
                        send_data.axis_x = 10;
                        send_data.axis_y = 0;
@@ -7339,7 +7339,7 @@ int test_input_callback(void *data)
                        char    pressedkey[8]    = { 4, 0, 0, 0,  0, 0, 0, 0 };
                        char    pressedkey1[8]   = { 0, 0, 0, 0,  0, 0, 0, 0 };
                        memcpy(send_data.key, pressedkey, 8);
-                       send_data.modify = 0;
+                       send_data.modifier = 0;
                        ret = bt_hid_device_send_key_event(
                                        remote_addr, &send_data);
                        TC_PRT("returns %d\n", ret);