Merge "Mesh: Fix issues in Mesh Model Subscrition" into tizen
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / oal-avrcp-tg.c
index c7ac558..31e0795 100644 (file)
@@ -453,41 +453,14 @@ oal_status_t avrcp_set_property(int type, unsigned int value)
        }
        case AVRCP_STATUS:
                if (value != player_setting.status) {
-                       btrc_play_status_t play_status = player_setting.status;
-
                        player_setting.status = (value == STATUS_ERROR) ? BTRC_PLAYSTATE_ERROR : value;
 
                        if (registered_notifications.play_status) {
-                               gboolean is_timer = FALSE;
-
                                response.play_status = player_setting.status;
                                ret = avrcp_api->register_notification_rsp(BTRC_EVT_PLAY_STATUS_CHANGED,
                                                BTRC_NOTIFICATION_TYPE_CHANGED, &response);
                                if (ret != BT_STATUS_SUCCESS)
                                        BT_ERR("Notif send failed: %s", status2string(ret));
-
-                               /* Check if old and new status value are changed from NOT PLAYING to PLAYING */
-                               switch (play_status) {
-                               case BTRC_PLAYSTATE_ERROR:      /* Intentional fall-through */
-                               case BTRC_PLAYSTATE_STOPPED:    /* Intentional fall-through */
-                               case BTRC_PLAYSTATE_PAUSED:     /* Intentional fall-through */
-                                       if (STATUS_PLAYING == value ||
-                                                       STATUS_REVERSE_SEEK == value ||
-                                                       STATUS_FORWARD_SEEK == value) {
-                                               BT_INFO("Play status changed from stopped to playing");
-                                               is_timer = TRUE;
-                                       }
-                                       break;
-                               default:
-                                       is_timer = FALSE;
-                               }
-
-                               if (is_timer) {
-                                       BT_DBG("Player is playing mode, start sending pos change notifications");
-                                       remove_pos_timer();
-                                       send_pos_timer = g_timeout_add(registered_notifications.interval * 1000,
-                                                       send_pos_timeout, NULL);
-                               }
                        }
                }
                break;
@@ -506,6 +479,61 @@ oal_status_t avrcp_set_property(int type, unsigned int value)
        return OAL_STATUS_SUCCESS;
 }
 
+oal_status_t avrcp_tg_set_volume(bt_address_t *rem_addr, unsigned int volume)
+{
+       int result = OAL_STATUS_SUCCESS;
+       bt_status_t status;
+       bdstr_t bdstr;
+
+       API_TRACE();
+
+       CHECK_OAL_AVRCP_ENABLED();
+       OAL_CHECK_PARAMETER(rem_addr, return);
+
+       BT_INFO("BT Audio Address: %s", bdt_bd2str(rem_addr, &bdstr));
+
+#ifdef TIZEN_BT_HAL
+       status = avrcp_api->set_volume((bt_bdaddr_t *)rem_addr, volume);
+       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
+               BT_ERR("set volume failed, err: %s", status2string(status));;
+               result = convert_to_oal_status(status);
+       }
+#else
+       BT_INFO("Not Supported");
+       result = OAL_STATUS_NOT_SUPPORT;
+#endif
+
+       return result;
+}
+
+oal_status_t avrcp_tg_get_volume(bt_address_t *rem_addr, unsigned int *volume)
+{
+       int result = OAL_STATUS_SUCCESS;
+       bt_status_t status;
+       bdstr_t bdstr;
+
+       API_TRACE();
+
+       CHECK_OAL_AVRCP_ENABLED();
+       OAL_CHECK_PARAMETER(rem_addr, return);
+
+       BT_INFO("BT Audio Address: %s", bdt_bd2str(rem_addr, &bdstr));
+
+#ifdef TIZEN_BT_HAL
+       status = avrcp_api->get_volume((bt_bdaddr_t *)rem_addr, volume);
+       if ((status != BT_STATUS_SUCCESS) && (status != BT_STATUS_DONE)) {
+               BT_ERR("set volume failed, err: %s", status2string(status));;
+               result = convert_to_oal_status(status);
+       }
+#else
+       BT_INFO("Not Supported");
+       result = OAL_STATUS_NOT_SUPPORT;
+#endif
+
+       return result;
+}
+
+
 #ifdef TIZEN_BT_HAL
 static void cb_connection_state(bt_bdaddr_t* bd_addr, btrc_connection_state_t state)
 {