Sync with product git. 55/101055/4
authorDeokhyun Kim <dukan.kim@samsung.com>
Mon, 5 Dec 2016 09:36:17 +0000 (18:36 +0900)
committerDeokhyun Kim <dukan.kim@samsung.com>
Mon, 5 Dec 2016 09:36:45 +0000 (18:36 +0900)
Change-Id: I153cea8aa8a5692062a5af4e7726d6159e332c26
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
include/bluetooth_private.h
include/mobile/bluetooth_internal.h
include/mobile/bluetooth_type_internal.h
include/wearable/bluetooth_internal.h
include/wearable/bluetooth_type_internal.h
src/bluetooth-audio.c

index 7b4b5524ed1801f607bdf2d23252563a63dddfc6..36ac2ca93cde291f0a8468872f7eaa549ef49e29 100644 (file)
@@ -481,60 +481,6 @@ typedef void (*bt_rssi_strength_cb)(char *bt_address,
 typedef void (*_bt_gatt_client_value_changed_cb)(char *char_path,
                unsigned char *value, int value_length, void *user_data);
 
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Enumaration for the address type field in manufactrer specific data
- * @since_tizen 3.0
- */
-typedef enum {
-       ADDRESS_NONE_TYPE = 0x00,
-       WI_FI_P2P_ADDRESS = 0x01,
-       BLUETOOTH_ADDRESS = 0x02,
-       INDICATION_ADDRESS = 0x04,
-       IPV4_ADDRESS = 0x08,
-       IPV6_ADDRESS = 0x10,
-       UNKNOWN_ADDRESS = 0xff
-} connectivity_address_t;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Enumaration for the proximity locality type field in manufactrer specific data
- * @since_tizen 3.0
- */
-typedef enum {
-       NONE_TYPE = 0x00,
-       PROXIMITY = 0x01,
-       CO_PRESENCE = 0x02,
-       UNKNOWN_TYPE = 0xff
-} bt_proximity_locality_t;
-
-/**
- * @internal
- * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
- * @brief Structure of samsung specific manufacturer data
- * @since_tizen 3.0
- */
-typedef struct {
-       unsigned char version;
-       unsigned char service_id;
-       unsigned char discovery_version;
-       unsigned char associated_service_id;
-       bt_proximity_locality_t proximity_locality_type;
-       unsigned char proximity_locality_info;
-       unsigned char device_type;
-       unsigned char device_icon;
-       unsigned char auth_info[5];
-       connectivity_address_t addr_type;
-       unsigned char addr1[6];
-       unsigned char addr2[6];
-       unsigned char channel_info;
-       unsigned char associated_service_data_len;
-       unsigned char *associated_service_data_val;
-       char *name;
-} bt_manufacturer_data;
-
 /**
  * @internal
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
index e2a7effa6361cb792e95328f2e8527fc8cafccf0..32218e5ed3a290db4c059dca239619d25ad2ae54 100644 (file)
@@ -414,6 +414,47 @@ int bt_adapter_set_connectable(bool connectable);
  */
 int bt_adapter_set_manufacturer_data(char *data, int len);
 
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Parse the samsung specific manufacturer data of discovered device.
+ *
+ * @remarks bt_adapter_free_manufacturer_data should be invoked
+ * to free the memory associated with parsed data
+ *
+ * @param[in]   manufacturer_data      The manufacturer specific data of the discovered Bluetooth device.
+ * @param[in]   len            length of the received manufacturer data
+ * @param[out] data Parsed manufacturer data
+ *
+ * @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
+ *
+ * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ *
+ * @see bt_adapter_free_manufacturer_data()
+ */
+int bt_adapter_parse_manufacturer_data(bt_manufacturer_data *data,
+               char *manufacturer_data, int manufacturer_data_len);
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Free the memory associated with parsed manufacturer data
+ *
+ * @param[in] data parsed manufactrer data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ *
+ * @see bt_adapter_parse_manufacturer_data()
+ */
+int bt_adapter_free_manufacturer_data(bt_manufacturer_data *data);
+
 /**
  * @internal
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
@@ -1160,6 +1201,29 @@ int bt_device_set_profile_restricted(const char *device_address, bt_restricted_p
  */
 int bt_device_get_profile_restricted(const char *device_address, bt_restricted_profile_t profile, int *restricted);
 
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief   Registers a callback function to be invoked when Trusted Profiles are changed.
+ * @since_tizen 2.4
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not supported
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid Parameter
+ */
+int bt_device_set_trusted_profile_cb(bt_device_trusted_profiles_cb callback, void *user_data);
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief   Unregisters the callback function registered with bt_device_set_trusted_profile_cb().
+ * @since_tizen 2.4
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not supported
+ */
+int bt_device_unset_trusted_profile_cb(void);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
  * @brief Request to change ATT MTU value
@@ -1725,6 +1789,39 @@ int bt_call_list_reset(bt_call_list_h list);
  */
 int bt_call_list_add(bt_call_list_h list, unsigned int call_id, bt_ag_call_state_e state, const char *phone_number);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
+ * @brief  Registers a callback function that will be invoked when a XSATvendor AT command is transmitted from Hands-Free.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 Bluetooth audio service must be initialized with bt_audio_initialize().
+ * @see bt_audio_initialize()
+ * @see bt_ag_vendor_cmd_cb()
+ * @see bt_ag_unset_vendor_cmd_cb()
+ */
+int bt_ag_set_vendor_cmd_cb(bt_ag_vendor_cmd_cb callback, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
+ * @brief  Unregisters a callback function that will be invoked when a XSATvendor AT command is transmitted from Hands-Free
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 Bluetooth audio service must be initialized with bt_audio_initialize().
+ * @see bt_audio_initialize()
+ * @see bt_ag_vendor_cmd_cb()
+ * @see bt_ag_set_vendor_cmd_cb()
+ */
+int bt_ag_unset_vendor_cmd_cb(void);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
  * @brief Checks whether the remoted device is wbs (Wide Band Speech) mode or not.
index 65fd3715b92f612d3670c533dabd55f128f8165d..94cc3c27ab386ea8d6a1a9d3ef17434d67e0ee80 100644 (file)
@@ -376,6 +376,60 @@ typedef void (*bt_hid_device_connection_state_changed_cb) (int result,
  */
 typedef void (*bt_hid_device_data_received_cb)(const bt_hid_device_received_data_s *data, void *user_data);
 
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Enumaration for the address type field in manufactrer specific data
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ADDRESS_NONE_TYPE = 0x00,
+       WI_FI_P2P_ADDRESS = 0x01,
+       BLUETOOTH_ADDRESS = 0x02,
+       INDICATION_ADDRESS = 0x04,
+       IPV4_ADDRESS = 0x08,
+       IPV6_ADDRESS = 0x10,
+       UNKNOWN_ADDRESS = 0xff
+} connectivity_address_t;
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Enumaration for the proximity locality type field in manufactrer specific data
+ * @since_tizen 3.0
+ */
+typedef enum {
+       NONE_TYPE = 0x00,
+       PROXIMITY = 0x01,
+       CO_PRESENCE = 0x02,
+       UNKNOWN_TYPE = 0xff
+} bt_proximity_locality_t;
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Structure of samsung specific manufacturer data
+ * @since_tizen 3.0
+ */
+typedef struct {
+       unsigned char version;
+       unsigned char service_id;
+       unsigned char discovery_version;
+       unsigned char associated_service_id;
+       bt_proximity_locality_t proximity_locality_type;
+       unsigned char proximity_locality_info;
+       unsigned char device_type;
+       unsigned char device_icon;
+       unsigned char auth_info[5];
+       connectivity_address_t addr_type;
+       unsigned char addr1[6];
+       unsigned char addr2[6];
+       unsigned char channel_info;
+       unsigned char associated_service_data_len;
+       unsigned char *associated_service_data_val;
+       char *name;
+} bt_manufacturer_data;
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
  * @brief Trusted Profile enumeration.
index 1d4f78ec819f4349d59fe6826969bf38931ec99f..a4c5ad17c37907593aa6efed654f044f2058f6b1 100644 (file)
@@ -414,6 +414,47 @@ int bt_adapter_set_connectable(bool connectable);
  */
 int bt_adapter_set_manufacturer_data(char *data, int len);
 
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Parse the samsung specific manufacturer data of discovered device.
+ *
+ * @remarks bt_adapter_free_manufacturer_data should be invoked
+ * to free the memory associated with parsed data
+ *
+ * @param[in]   manufacturer_data      The manufacturer specific data of the discovered Bluetooth device.
+ * @param[in]   len            length of the received manufacturer data
+ * @param[out] data Parsed manufacturer data
+ *
+ * @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
+ *
+ * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
+ *
+ * @see bt_adapter_free_manufacturer_data()
+ */
+int bt_adapter_parse_manufacturer_data(bt_manufacturer_data *data,
+               char *manufacturer_data, int manufacturer_data_len);
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Free the memory associated with parsed manufacturer data
+ *
+ * @param[in] data parsed manufactrer data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ *
+ * @see bt_adapter_parse_manufacturer_data()
+ */
+int bt_adapter_free_manufacturer_data(bt_manufacturer_data *data);
+
 /**
  * @internal
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
@@ -1130,6 +1171,29 @@ int bt_device_set_profile_restricted(const char *device_address, bt_restricted_p
  */
 int bt_device_get_profile_restricted(const char *device_address, bt_restricted_profile_t profile, int *restricted);
 
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief   Registers a callback function to be invoked when Trusted Profiles are changed.
+ * @since_tizen 2.4
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not supported
+ * @retval #BT_ERROR_INVALID_PARAMETER Invalid Parameter
+ */
+int bt_device_set_trusted_profile_cb(bt_device_trusted_profiles_cb callback, void *user_data);
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
+ * @brief   Unregisters the callback function registered with bt_device_set_trusted_profile_cb().
+ * @since_tizen 2.4
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not supported
+ */
+int bt_device_unset_trusted_profile_cb(void);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
  * @brief Request to change ATT MTU value
@@ -1695,6 +1759,39 @@ int bt_call_list_reset(bt_call_list_h list);
  */
 int bt_call_list_add(bt_call_list_h list, unsigned int call_id, bt_ag_call_state_e state, const char *phone_number);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
+ * @brief  Registers a callback function that will be invoked when a XSATvendor AT command is transmitted from Hands-Free.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 Bluetooth audio service must be initialized with bt_audio_initialize().
+ * @see bt_audio_initialize()
+ * @see bt_ag_vendor_cmd_cb()
+ * @see bt_ag_unset_vendor_cmd_cb()
+ */
+int bt_ag_set_vendor_cmd_cb(bt_ag_vendor_cmd_cb callback, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
+ * @brief  Unregisters a callback function that will be invoked when a XSATvendor AT command is transmitted from Hands-Free
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 Bluetooth audio service must be initialized with bt_audio_initialize().
+ * @see bt_audio_initialize()
+ * @see bt_ag_vendor_cmd_cb()
+ * @see bt_ag_set_vendor_cmd_cb()
+ */
+int bt_ag_unset_vendor_cmd_cb(void);
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
  * @brief Checks whether the remoted device is wbs (Wide Band Speech) mode or not.
index dd48f47181f1d530847f2dd27ac66d769eaca219..15efec876ae2055b52274fce6cc229443bd55687 100644 (file)
@@ -393,6 +393,60 @@ typedef struct {
        char **uuids;
 } bt_dpm_uuids_list_s;
 
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Enumaration for the address type field in manufactrer specific data
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ADDRESS_NONE_TYPE = 0x00,
+       WI_FI_P2P_ADDRESS = 0x01,
+       BLUETOOTH_ADDRESS = 0x02,
+       INDICATION_ADDRESS = 0x04,
+       IPV4_ADDRESS = 0x08,
+       IPV6_ADDRESS = 0x10,
+       UNKNOWN_ADDRESS = 0xff
+} connectivity_address_t;
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Enumaration for the proximity locality type field in manufactrer specific data
+ * @since_tizen 3.0
+ */
+typedef enum {
+       NONE_TYPE = 0x00,
+       PROXIMITY = 0x01,
+       CO_PRESENCE = 0x02,
+       UNKNOWN_TYPE = 0xff
+} bt_proximity_locality_t;
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Structure of samsung specific manufacturer data
+ * @since_tizen 3.0
+ */
+typedef struct {
+       unsigned char version;
+       unsigned char service_id;
+       unsigned char discovery_version;
+       unsigned char associated_service_id;
+       bt_proximity_locality_t proximity_locality_type;
+       unsigned char proximity_locality_info;
+       unsigned char device_type;
+       unsigned char device_icon;
+       unsigned char auth_info[5];
+       connectivity_address_t addr_type;
+       unsigned char addr1[6];
+       unsigned char addr2[6];
+       unsigned char channel_info;
+       unsigned char associated_service_data_len;
+       unsigned char *associated_service_data_val;
+       char *name;
+} bt_manufacturer_data;
+
 /**
  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
  * @brief Trusted Profile enumeration.
index 5929f96bc8939fb038b01b6b21f30fd96146288b..107c7578971039c30b69e8c623e9a80597742922 100644 (file)
@@ -679,6 +679,27 @@ int bt_ag_unset_multi_call_handling_event_cb(void)
        return BT_ERROR_NONE;
 }
 
+int bt_ag_set_vendor_cmd_cb(bt_ag_vendor_cmd_cb callback,
+                                               void *user_data)
+{
+       BT_CHECK_HFP_SUPPORT();
+       BT_CHECK_INIT_STATUS();
+       BT_CHECK_AG_INIT_STATUS();
+       BT_CHECK_INPUT_PARAMETER(callback);
+       _bt_set_cb(BT_EVENT_AG_VENDOR_CMD, callback, user_data);
+       return BT_ERROR_NONE;
+}
+
+int bt_ag_unset_vendor_cmd_cb(void)
+{
+       BT_CHECK_HFP_SUPPORT();
+       BT_CHECK_INIT_STATUS();
+       BT_CHECK_AG_INIT_STATUS();
+       if (_bt_check_cb(BT_EVENT_AG_VENDOR_CMD) == true)
+               _bt_unset_cb(BT_EVENT_AG_VENDOR_CMD);
+       return BT_ERROR_NONE;
+}
+
 int bt_ag_set_dtmf_transmitted_cb(bt_ag_dtmf_transmitted_cb callback,
                                                void *user_data)
 {