Add the AVRCP delay changed callback function 05/174905/2
authorHyuk Lee <hyuk0512.lee@samsung.com>
Thu, 5 Apr 2018 04:44:38 +0000 (13:44 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Thu, 26 Apr 2018 04:14:42 +0000 (13:14 +0900)
Change-Id: I5308f0eacfd3ee388d487f17fc2637143c5e8fa2
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
include/bluetooth_internal.h
include/bluetooth_private.h
include/bluetooth_type_internal.h
src/bluetooth-avrcp.c
src/bluetooth-common.c

index 359195f04ad43fddc1ee36aa8ef3d5cf939b5541..50d72776c3781bb1f04097b3e61e0cf5210e2386 100644 (file)
@@ -3519,6 +3519,40 @@ int bt_avrcp_control_set_absolute_volume(unsigned int value);
  */
 int bt_avrcp_control_send_delay_report(unsigned int value);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
+ * @brief  Registers a callback function that will be invoked when the delay is changed.
+ * @since_tizen 5.0
+ * @param[in] callback The callback function to register
+ * @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_SUPPORTED  Not supported
+ *
+ * @pre The AVRCP service must be initialized with bt_avrcp_target_initialize() or bt_avrcp_control_initialize().
+ * @see bt_avrcp_target_initialize()
+ * @see bt_avrcp_control_initialize()
+ */
+int bt_avrcp_set_delay_changed_cb(bt_avrcp_delay_changed_cb callback, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
+ * @brief  Unregisters a callback function that will be invoked when the delay is changed.
+ * @since_tizen 5.0
+ * @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_SUPPORTED  Not supported
+ *
+ * @pre The AVRCP service must be initialized with bt_avrcp_target_initialize() or bt_avrcp_control_initialize().
+ * @see bt_avrcp_target_initialize()
+ * @see bt_avrcp_control_initialize()
+ * @see bt_avrcp_set_delay_changed_cb()
+ */
+int bt_avrcp_unset_delay_changed_cb(void);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_PROXIMITY_MODULE
  * @brief Creates the Proximity Profile Reporter Role.
index 094ad49d26ccf159d0e557c7aa5dec1d697eaef1..39e25b9be94301fd615ab53443cb3c888bc4c498 100644 (file)
@@ -107,6 +107,7 @@ typedef enum {
        BT_EVENT_AVRCP_PLAY_STATUS_CHANGED, /**< AVRCP scan mode change callback */
        BT_EVENT_AVRCP_SONG_POSITION_CHANGED, /**< AVRCP scan mode change callback */
        BT_EVENT_AVRCP_TRACK_INFO_CHANGED, /**< AVRCP scan mode change callback */
+       BT_EVENT_AVRCP_DELAY_CHANGED, /**< AVRCP scan mode change callback */
        BT_EVENT_HID_CONNECTION_STATUS, /**< HID connection status callback */
        BT_EVENT_HID_DEVICE_CONNECTION_STATUS, /**< HID Device connection status callback */
        BT_EVENT_HID_DEVICE_DATA_RECEIVED, /**< HID Device Data received callback */
index 650ab1d9b4742e45c6f26ed9e16ca3e87a5a65f5..babfb95c68ea7c7458802e35b3f9e397539504b5 100644 (file)
@@ -123,6 +123,17 @@ typedef enum {
  */
 typedef void (*bt_adapter_le_state_changed_cb)(int result, bt_adapter_le_state_e adapter_le_state, void *user_data);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
+ * @brief  Called when the delay is changed by the remote device.
+ * @since_tizen 5.0
+ * @param[in] delay Streaming delay in milliseconds.
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see bt_avrcp_set_delay_changed_cb()
+ * @see bt_avrcp_unset_delay_changed_cb()
+ */
+typedef void (*bt_avrcp_delay_changed_cb) (unsigned int delay, void *user_data);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
  * @brief  Enumerations for the call state
index 150ab5ab0a09c91ff4952efdce4b7c2a8bb7842a..48c3945ac388d06d60d982a4921e08a7aedea514 100644 (file)
@@ -718,6 +718,23 @@ int bt_avrcp_unset_position_changed_cb(void)
        return BT_ERROR_NONE;
 }
 
+int bt_avrcp_set_delay_changed_cb(bt_avrcp_delay_changed_cb callback, void *user_data)
+{
+       BT_CHECK_AVRCP_SUPPORT();
+       BT_CHECK_INIT_STATUS();
+       BT_CHECK_INPUT_PARAMETER(callback);
+       _bt_set_cb(BT_EVENT_AVRCP_DELAY_CHANGED, callback, user_data);
+       return BT_ERROR_NONE;
+}
+
+int bt_avrcp_unset_delay_changed_cb(void)
+{
+       BT_CHECK_AVRCP_SUPPORT();
+       BT_CHECK_INIT_STATUS();
+       _bt_unset_cb(BT_EVENT_AVRCP_DELAY_CHANGED);
+       return BT_ERROR_NONE;
+}
+
 int bt_avrcp_set_play_status_changed_cb(bt_avrcp_play_status_changed_cb callback, void *user_data)
 {
        BT_CHECK_AVRCP_SUPPORT();
index f94a18a0732352660ea079582fd96b89b08f5ee5..c7adf14a84625dd57c05d0ce75883bbd47937f2e 100644 (file)
@@ -1965,6 +1965,12 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                ((bt_avrcp_position_changed_cb)bt_event_slot_container[event_index].callback)
                (*postion, bt_event_slot_container[event_index].user_data);
                break;
+       case BLUETOOTH_EVENT_AVRCP_DELAY_CHANGED:
+               BT_INFO("BLUETOOTH_EVENT_AVRCP_DELAY_CHANGED ");
+               unsigned int *delay = (unsigned int *)(param->param_data);
+               ((bt_avrcp_delay_changed_cb)bt_event_slot_container[event_index].callback)
+               (*delay, bt_event_slot_container[event_index].user_data);
+               break;
        case BLUETOOTH_EVENT_AVRCP_TRACK_CHANGED:
                BT_INFO("BLUETOOTH_EVENT_AVRCP_TRACK_CHANGED ");
                bt_avrcp_metadata_attributes_info_s meta_info = {0, };
@@ -3447,6 +3453,8 @@ static int __bt_get_cb_index(int event)
                return BT_EVENT_AVRCP_PLAY_STATUS_CHANGED;
        case  BLUETOOTH_EVENT_AVRCP_TRACK_CHANGED:
                return BT_EVENT_AVRCP_TRACK_INFO_CHANGED;
+       case  BLUETOOTH_EVENT_AVRCP_DELAY_CHANGED:
+               return BT_EVENT_AVRCP_DELAY_CHANGED;
        case BLUETOOTH_HID_CONNECTED:
                return  BT_EVENT_HID_CONNECTION_STATUS;
        case BLUETOOTH_HID_DISCONNECTED: