Merge "Providing bluetooth usage data for battery monitor framework" into tizen
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-media-control.h
old mode 100644 (file)
new mode 100755 (executable)
index 906be7c..fee7914
@@ -1,13 +1,11 @@
 /*
- * bluetooth-frwk
- *
- *Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *              http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
 extern "C" {
 #endif /*__cplusplus*/
 
-#include <glib.h>
-
 #define BT_MEDIA_ERROR_NONE ((int)0)
 
 #define BT_MEDIA_ERROR_BASE ((int)0)
 #define BT_MEDIA_ERROR_INTERNAL ((int)BT_MEDIA_ERROR_BASE - 0x01)
 #define BT_MEDIA_ERROR_ALREADY_INITIALIZED ((int)BT_MEDIA_ERROR_BASE - 0x02)
+#define BT_MEDIA_ERROR_NOT_CONNECTED ((int)BT_MEDIA_ERROR_BASE - 0x15)
 
 typedef enum {
-       PLAYBACKSTATUS = 0x1,
+       EQUALIZER = 0x01,
+       REPEAT,
        SHUFFLE,
-       LOOPSTATUS,
+       SCAN,
        POSITION,
        METADATA,
-       EQUALIZER = 0x02,       /* bluez 4.101 */
-       REPEAT,                 /* bluez 4.101 */
-       SCAN,                   /* bluez 4.101 */
-       STATUS,                 /* bluez 4.101 */
+       STATUS
 } media_player_property_type;
 
-/* bluez 4.101 */
+typedef enum {
+       DELAY = 0x01,
+       VOLUME
+} media_transport_property_type;
+
 typedef enum {
        EQUALIZER_OFF = 0x01,
        EQUALIZER_ON,
@@ -55,28 +54,17 @@ typedef enum {
        REPEAT_MODE_OFF = 0x01,
        REPEAT_SINGLE_TRACK,
        REPEAT_ALL_TRACK,
-       REPEAT_GROUP,           /* bluez 4.101 */
+       REPEAT_GROUP,
        REPEAT_INVALID,
 } media_player_repeat_status;
 
 typedef enum {
-        STATUS_STOPPED = 0x00,
-        STATUS_PLAYING,
-        STATUS_PAUSED,
-       STATUS_FORWARD_SEEK,    /* bluez 4.101 */
-       STATUS_REVERSE_SEEK,    /* bluez 4.101 */
-       STATUS_ERROR,           /* bluez 4.101 */
-        STATUS_INVALID
-} media_player_status;
-
-typedef enum {
        SHUFFLE_MODE_OFF = 0x01,
        SHUFFLE_ALL_TRACK,
        SHUFFLE_GROUP,
        SHUFFLE_INVALID,
 } media_player_shuffle_status;
 
-/* bluez 4.101 */
 typedef enum {
        SCAN_MODE_OFF = 0x01,
        SCAN_ALL_TRACK,
@@ -84,30 +72,48 @@ typedef enum {
        SCAN_INVALID,
 } media_player_scan_status;
 
+typedef enum {
+       STATUS_STOPPED = 0x00,
+       STATUS_PLAYING,
+       STATUS_PAUSED,
+       STATUS_FORWARD_SEEK,
+       STATUS_REVERSE_SEEK,
+       STATUS_ERROR,
+       STATUS_INVALID
+} media_player_status;
+
+typedef enum {
+       PLAY = 0x01,
+       PAUSE,
+       STOP,
+       NEXT,
+       PREVIOUS,
+       PRESS_FAST_FORWARD,
+       RELEASE_FAST_FORWARD,
+       PRESS_REWIND,
+       RELEASE_REWIND,
+       VOLUME_UP,
+       VOLUME_DOWN
+} media_player_control_cmd;
+
 typedef struct {
        const char *title;
-       const char **artists;
+       const char *artist;
        const char *album;
-       const char **genres;
-       unsigned int tracknumber;
-       const char *artist;             /* bluez 4.101 */
-       const char *genre;              /* bluez 4.101 */
-       unsigned int total_tracks;      /* bluez 4.101 */
-       unsigned int number;            /* bluez 4.101 */
+       const char *genre;
+       unsigned int total_tracks;
+       unsigned int number;
        unsigned int duration;
 } media_metadata_attributes_t;
 
 typedef struct {
-       media_player_repeat_status      loopstatus;
-       media_player_status     playbackstatus;
-       gboolean        shuffle_mode;
-       gint64  position;
-       media_metadata_attributes_t     metadata;
-       media_player_equalizer_status equalizer;        /* bluez 4.101 */
-       media_player_repeat_status  repeat;             /* bluez 4.101 */
-       media_player_shuffle_status  shuffle;           /* bluez 4.101 */
-       media_player_scan_status scan;                  /* bluez 4.101 */
-       media_player_status status;                     /* bluez 4.101 */
+       media_player_equalizer_status equalizer;
+       media_player_repeat_status  repeat;
+       media_player_shuffle_status  shuffle;
+       media_player_scan_status scan;
+       media_player_status status;
+       unsigned int position;
+       media_metadata_attributes_t metadata;
 } media_player_settings_t;
 
 typedef struct {
@@ -167,7 +173,7 @@ int bluetooth_media_player_deinit(void);
  * @param[in]   setting - The music player properties
  *
  * @remark       None
- * @see         None
+ * @see        None
  */
 int bluetooth_media_player_set_properties(
                        media_player_settings_t *setting);
@@ -188,7 +194,7 @@ int bluetooth_media_player_set_properties(
  *                      value - Value of the property which is changed
  *
  * @remark       None
- * @see         None
+ * @see        None
  */
 int bluetooth_media_player_change_property(
                        media_player_property_type type,
@@ -205,14 +211,181 @@ int bluetooth_media_player_change_property(
  *              BT_MEDIA_CONTROL_ERROR - Error \n
  *
  * @exception   None
- * @param[in]    metadata -Meida attributes
+ * @param[in]  metadata -Meida attributes
  *
  * @remark       None
- * @see         None
+ * @see        None
  */
 int bluetooth_media_player_change_track(
                        media_metadata_attributes_t *metadata);
 
+/**
+ * @fn int bluetooth_media_control_init(media_cb_func_ptr callback_ptr, void *user_data)
+ * @brief Initialize AVRCP control and register the callback
+ *
+ * This function is a synchronous call.
+ *
+ * @param[in]   callback_ptr - Callback function (AVRCP connected / Disconnected)
+ * @param[in]   user_data - User data
+ *
+ * @return  BT_MEDIA_ERROR_NONE  - Success \n
+ *              BT_MEDIA_ERROR_ALREADY_INITIALIZED   - Already initialized \n
+ *              BT_MEDIA_ERROR_INTERNAL  - Internal error \n
+ *
+ * @remark      None
+ *
+ */
+int bluetooth_media_control_init(media_cb_func_ptr callback_ptr,
+                                               void *user_data);
+
+/**
+ * @fn int bluetooth_media_control_deinit(void)
+ * @brief Deinitialize AVRCP Control and deregister callback
+ *
+ * This function is a synchronous call.
+ *
+ * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
+ *              BT_MEDIA_CONTROL_ERROR - Error \n
+ *
+ * @remark      None
+ *
+ */
+int bluetooth_media_control_deinit(void);
+
+/**
+ * @brief      The function bluetooth_media_control_connect is called to establish an AVRCP
+ *     control role connection with  the specified device.
+ *
+ * @param[in]  remote_address  Bluetooth device address.
+ * @return     int     Zero on Success or reason for error if any.
+ *
+ */
+int bluetooth_media_control_connect(bluetooth_device_address_t *remote_address);
+
+/**
+ * @brief      The function bluetooth_media_control_disconnect is called to disconnect an
+ *     existing AVRCP Control role connection with the specified device.
+ *
+ * @param[in]  remote_address  Bluetooth device address.
+ * @return     int     Zero on Success or reason for error if any.
+ *
+ */
+int bluetooth_media_control_disconnect(bluetooth_device_address_t *remote_address);
+
+/**
+ * @brief      The function bluetooth_media_target_connect is called to establish an AVRCP
+ *     target role connection with  the specified device.
+ *
+ * @param[in]  remote_address  Bluetooth device address.
+ * @return     int     Zero on Success or reason for error if any.
+ *
+ */
+int bluetooth_media_target_connect(bluetooth_device_address_t *remote_address);
+
+/**
+ * @brief      The function bluetooth_media_target_disconnect is called to disconnect an
+ *     existing AVRCP target role connection with the specified device.
+ *
+ * @param[in]  remote_address  Bluetooth device address.
+ * @return     int     Zero on Success or reason for error if any.
+ *
+ */
+int bluetooth_media_target_disconnect(bluetooth_device_address_t *remote_address);
+
+/**
+ * @brief      The function bluetooth_media_control_command is called to send
+ *     the  AVRCP Control command like Play, Pause, FF, Rewind to the target device.
+ *
+ * @param[in]  type    media_player_control_cmd.
+ * @return     int     Zero on Success or reason for error if any.
+ *
+ */
+int bluetooth_media_control_command(media_player_control_cmd type);
+
+/**
+ * @brief      The function bluetooth_media_control_command_to_dest is called to send
+ *     the  AVRCP Control command like Play, Pause, FF, Rewind to the specific target device.
+ *
+ * @param[in]  type    media_player_control_cmd.
+ * @param[in]  remote_address  Bluetooth device address.
+ * @return     int     Zero on Success or reason for error if any.
+ *
+ */
+int bluetooth_media_control_command_to_dest(media_player_control_cmd type,
+                                       bluetooth_device_address_t *remote_address);
+
+/**
+ * @fn int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value)
+ * @brief Notifies the remote bluetooth target with change in music control settings
+ *
+ * This function is a asynchronous call.
+ * No event for this api.
+ *
+ * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
+ *              BT_MEDIA_CONTROL_ERROR - Error \n
+ *
+ * @exception   None
+ * @param[in]   setting - The music control properties
+ *
+ * @remark       None
+ * @see        None
+ */
+int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value);
+
+/**
+ * @fn int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value)
+ * @brief reads the setting of the remote bluetooth target with change in music control settings
+ *
+ * This function is a asynchronous call.
+ * No event for this api.
+ *
+ * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
+ *              BT_MEDIA_CONTROL_ERROR - Error \n
+ *
+ * @exception   None
+ * @param[in]   setting - The music control properties
+ *
+ * @remark       None
+ * @see        None
+ */
+int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value);
+
+/**
+ * @fn int bluetooth_media_transport_set_property(media_transport_property_type type, unsigned int value)
+ * @brief Notifies the remote bluetooth target with change in audio transport settings
+ *
+ * This function is a asynchronous call.
+ * No event for this api.
+ *
+ * @return  BT_MEDIA_TRANSPORT_SUCCESS  - Success \n
+ *              BT_MEDIA_TRANSPORT_ERROR - Error \n
+ *
+ * @exception   None
+ * @param[in]   setting - The audio transport properties
+ *
+ * @remark       None
+ * @see        None
+ */
+int bluetooth_media_transport_set_property(media_transport_property_type type, unsigned int value);
+
+/**
+ * @fn int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata)
+ * @brief reads the track metadata from the remote target player.
+ *
+ * This function is a asynchronous call.
+ * No event for this api.
+ *
+ * @return  BT_MEDIA_CONTROL_SUCCESS  - Success \n
+ *              BT_MEDIA_CONTROL_ERROR - Error \n
+ *
+ * @exception   None
+ * @param[in]   metadata - The music meta data information.
+ *
+ * @remark       None
+ * @see        None
+ */
+int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata);
+
 #ifdef __cplusplus
 }
 #endif /*__cplusplus*/