Add the auto accept logic for the headless speaker profile
[platform/core/connectivity/bluetooth-frwk.git] / include / bt-internal-types.h
index 728d9c4..2a47799 100644 (file)
@@ -141,7 +141,7 @@ typedef enum {
 #define BT_FUNC_PBAP_BASE ((int)(BT_FUNC_RFCOMM_BASE + 0x0020))
 #define BT_FUNC_HDP_BASE ((int)(BT_FUNC_PBAP_BASE + 0x0020))
 #define BT_FUNC_GATT_BASE ((int)(BT_FUNC_HDP_BASE + 0x0020))
-#define BT_FUNC_IPSP_BASE ((int)(BT_FUNC_GATT_BASE + 0x0020))
+#define BT_FUNC_IPSP_BASE ((int)(BT_FUNC_GATT_BASE + 0x0040))
 #define BT_FUNC_DPM_BASE ((int)(BT_FUNC_IPSP_BASE + 0x0020))
 #define BT_FUNC_PXP_BASE ((int)(BT_FUNC_DPM_BASE + 0x0030)) /* Adding 0x0030 to base, as DPM has more use case */
 #define BT_FUNC_MAP_BASE ((int)(BT_FUNC_PXP_BASE + 0x0020))
@@ -185,6 +185,8 @@ typedef enum {
        BT_GET_SCAN_RESPONSE_DATA,
        BT_SET_SCAN_RESPONSE_DATA,
        BT_IS_ADVERTISING,
+       BT_IS_LE_2M_PHY_SUPPORTED,
+       BT_IS_LE_CODED_PHY_SUPPORTED,
        BT_SET_MANUFACTURER_DATA,
        BT_LE_CONN_UPDATE,
        BT_LE_READ_MAXIMUM_DATA_LENGTH,
@@ -221,6 +223,7 @@ typedef enum {
        BT_UPDATE_LE_CONNECTION_MODE,
        BT_SET_PROFILE_TRUSTED,
        BT_GET_PROFILE_TRUSTED,
+       BT_DISCONNECT_DEVICE,
        BT_HID_CONNECT = BT_FUNC_HID_BASE,
        BT_HID_DISCONNECT,
        BT_HID_DEVICE_ACTIVATE,
@@ -262,6 +265,7 @@ typedef enum {
        BT_AVRCP_TARGET_CONNECT,
        BT_AVRCP_TARGET_DISCONNECT,
        BT_AVRCP_HANDLE_CONTROL,
+       BT_AVRCP_HANDLE_CONTROL_TO_DEST,
        BT_AVRCP_CONTROL_SET_PROPERTY,
        BT_AVRCP_CONTROL_GET_PROPERTY,
        BT_AVRCP_GET_TRACK_INFO,
@@ -298,6 +302,7 @@ typedef enum {
        BT_RFCOMM_SOCKET_WRITE,
        BT_RFCOMM_CREATE_SOCKET,
        BT_RFCOMM_REMOVE_SOCKET,
+       BT_RFCOMM_LISTEN_AND_ACCEPT,
        BT_RFCOMM_LISTEN,
        BT_RFCOMM_IS_UUID_AVAILABLE,
        BT_RFCOMM_ACCEPT_CONNECTION,
@@ -345,6 +350,7 @@ typedef enum {
        BT_GATT_WRITE_CHARACTERISTIC_VALUE_BY_TYPE, /* GATT Client */
        BT_GATT_WRITE_DESCRIPTOR_VALUE, /* GATT Client */
        BT_GATT_WATCH_SERVICE_CHANGED_INDICATION, /* GATT Client */
+       BT_GATT_ACQUIRE_WRITE, /* GATT Client */
 #endif
        BT_GATT_DISCOVER_CHARACTERISTICS_DESCRIPTOR,
 #ifndef GATT_NO_RELAY
@@ -363,6 +369,8 @@ typedef enum {
        BT_GATT_SERVER_STOP_SERVICE,
        BT_GATT_SERVER_DELETE_SERVICE,
        BT_GATT_SERVER_SEND_RESPONSE,
+       BT_GATT_SERVER_ACQURE_WRITE_RESPONSE,
+       BT_GATT_SERVER_ACQUIRE_NOTIFY_RESPONSE,
        BT_GATT_SERVER_SEND_INDICATION,
        BT_GATT_SERVER_UPDATE_VALUE,
        BT_GATT_SERVER_DEREGISTER,
@@ -611,6 +619,8 @@ typedef struct {
 #define BT_GATT_SERVER_READ_REQ "GattServerReadReq"
 #define BT_GATT_SERVER_NOTIFICATION_COMPLETED "GattServerNotification"
 #define BT_GATT_SERVER_NOTIFICATION_CHANGED "GattServerNotifChanged"
+#define BT_GATT_SERVER_ACQUIRE_WRITE "GattServerACquireWrite"
+#define BT_GATT_SERVER_ACQUIRE_NOTIFICATION "GattServerAcquireNotify"
 #endif
 
 #ifdef TIZEN_GATT_CLIENT
@@ -684,11 +694,24 @@ typedef enum {
        _PROFILE_WEARABLE = 0x2,
        _PROFILE_TV = 0x4,
        _PROFILE_IVI = 0x8,
-       _PROFILE_COMMON = 0x10,
+       _PROFILE_IOT = 0x10,
+       _PROFILE_COMMON = 0x20,
 } tizen_profile_t;
 
+typedef enum {
+       _MODEL_UNKNOWN = 0,
+       _MODEL_COMMON = 0x1,
+       _MODEL_TM1 = 0x2,
+       _MODEL_TM2 = 0x4,
+       _MODEL_TW1 = 0x8,
+       _MODEL_TW2 = 0x10,
+       _MODEL_TW3 = 0x20,
+       _MODEL_RPI3 = 0x40,
+} tizen_model_t;
+
 /* For optimization, make this extern and define in a shared C file */
 extern tizen_profile_t profile;
+static tizen_model_t model = _MODEL_UNKNOWN;
 extern bt_plugin_info_t *headed_plugin_info;
 
 /* Accessing system info */
@@ -725,7 +748,12 @@ static inline tizen_profile_t get_tizen_profile()
                break;
        case 'i':
        case 'I':
-               profile = _PROFILE_IVI;
+               if (!strncasecmp(profileName, "ivi", 3))
+                       profile = _PROFILE_IVI;
+               else if (!strncasecmp(profileName, "iot", 3))
+                       profile = _PROFILE_IOT;
+               else
+                       profile = _PROFILE_COMMON;
                break;
        default: // common or unknown ==> ALL ARE COMMON.
                profile = _PROFILE_COMMON;
@@ -734,6 +762,41 @@ static inline tizen_profile_t get_tizen_profile()
 
        return profile;
 }
+
+static inline tizen_model_t get_tizen_model(void)
+{
+       char *model_name = NULL;
+
+       if (__builtin_expect(model != _MODEL_UNKNOWN, 1))
+               return model;
+
+       system_info_get_platform_string("http://tizen.org/system/model_name", &model_name);
+
+       if (model_name == NULL) {
+               model = _MODEL_COMMON;
+               return model;
+       }
+
+       if (!strcasecmp(model_name, "TM1"))
+               model = _MODEL_TM1;
+       else if (!strcasecmp(model_name, "TM2"))
+               model = _MODEL_TM2;
+       else if (!strcasecmp(model_name, "TW1"))
+               model = _MODEL_TW1;
+       else if (!strcasecmp(model_name, "TW2"))
+               model = _MODEL_TW2;
+       else if (!strcasecmp(model_name, "TW3"))
+               model = _MODEL_TW3;
+       else if (!strcasecmp(model_name, "rpi3"))
+               model = _MODEL_RPI3;
+       else
+               model = _MODEL_COMMON;
+
+       free(model_name);
+
+       return model;
+}
+
 #define TIZEN_PROFILE_WEARABLE (get_tizen_profile() == _PROFILE_WEARABLE)
 #define TIZEN_PROFILE_IVI (get_tizen_profile() == _PROFILE_IVI)
 #define TIZEN_PROFILE_TV (get_tizen_profile() == _PROFILE_TV)
@@ -743,6 +806,7 @@ static inline tizen_profile_t get_tizen_profile()
 #define TIZEN_FEATURE_TELEPHONY_ENABLED (get_tizen_profile() & (_PROFILE_MOBILE))
 #define TIZEN_FEATURE_FLIGHTMODE_ENABLED (get_tizen_profile() & (_PROFILE_MOBILE | _PROFILE_WEARABLE))
 #define TIZEN_FEATURE_BT_USB_DONGLE (get_tizen_profile() & (_PROFILE_TV))
+#define TIZEN_FEATURE_BLUEZ_SPEAKER_REFERENCE ((get_tizen_model()) == _MODEL_RPI3 && (get_tizen_profile()) == _PROFILE_COMMON)
 
 #ifdef __cplusplus
 }