#include <sys/types.h>
#include <libintl.h>
+#include <stdbool.h>
#include <dlog.h>
BT_AVRCP_CONTROL_EVENT,
BT_A2DP_SOURCE_EVENT,
BT_HID_DEVICE_EVENT,
+ BT_MAP_CLIENT_EVENT,
#ifdef GATT_NO_RELAY
BT_GATT_BLUEZ_EVENT, /* GattValueChanged from bluez directly */
#endif
+//#ifndef GATT_DIRECT
+ BT_GATT_SERVER_EVENT,
+//#endif
+#ifdef TIZEN_GATT_CLIENT
+ BT_GATT_CLIENT_EVENT,
+#endif
+ BT_TDS_EVENT,
+ BT_OTP_EVENT,
+ BT_HDP_EVENT,
/* Will be added */
} bt_event_type_t;
#define BT_SERVER_ACCEPT_TIMEOUT 2000 /* 2 seconds */
#define BT_FILE_PATH_MAX 256
#define BT_META_DATA_MAX_LEN 512 + 1
+#define BT_MAX_HANDLE_LENGTH 50
#define BT_HFP_AUDIO_GATEWAY_UUID "0000111f-0000-1000-8000-00805f9b34fb"
#define BT_HSP_AUDIO_GATEWAY_UUID "00001112-0000-1000-8000-00805f9b34fb"
#define BT_AVRCP_TARGET_UUID "0000110c-0000-1000-8000-00805f9b34fb"
#define BT_OPP_UUID "00001105-0000-1000-8000-00805f9b34fb"
#define BT_FTP_UUID "00001106-0000-1000-8000-00805f9b34fb"
+#define BT_MAP_UUID "00001134-0000-1000-8000-00805f9b34fb"
#define BT_SPP_UUID "00001101-0000-1000-8000-00805f9b34fb"
#define BT_HID_UUID "00001124-0000-1000-8000-00805f9b34fb"
#define BT_PAN_PANU_UUID "00001115-0000-1000-8000-00805f9b34fb"
#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))
+#define BT_FUNC_TDS_BASE ((int)(BT_FUNC_MAP_BASE + 0x0020))
+#define BT_FUNC_OTP_BASE ((int)(BT_FUNC_TDS_BASE + 0x0020))
typedef enum {
BT_CHECK_ADAPTER = BT_FUNC_BASE,
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,
BT_UPDATE_LE_CONNECTION_MODE,
BT_SET_PROFILE_TRUSTED,
BT_GET_PROFILE_TRUSTED,
- BT_SET_PROFILE_RESTRICTED,
- BT_GET_PROFILE_RESTRICTED,
+ BT_DISCONNECT_DEVICE,
BT_HID_CONNECT = BT_FUNC_HID_BASE,
BT_HID_DISCONNECT,
BT_HID_DEVICE_ACTIVATE,
BT_GET_SPEAKER_GAIN,
BT_SET_SPEAKER_GAIN,
BT_SET_CONTENT_PROTECT,
+ BT_AUDIO_SELECT_ROLE,
BT_OOB_READ_LOCAL_DATA = BT_FUNC_OOB_BASE,
BT_OOB_ADD_REMOTE_DATA,
BT_OOB_REMOVE_REMOTE_DATA,
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,
+ BT_AVRCP_TRANSPORT_SET_PROPERTY,
BT_OPP_PUSH_FILES = BT_FUNC_OPP_BASE,
BT_OPP_CANCEL_PUSH,
BT_OPP_IS_PUSHING_FILES,
BT_OPP_GET_TRANSFER_PROGRESS,
+ BT_MAP_CREATE_SESSION = BT_FUNC_MAP_BASE,
+ BT_MAP_DESTROY_SESSION,
+ BT_MAP_SET_FOLDER,
+ BT_MAP_LIST_FOLDERS,
+ BT_MAP_LIST_FILTER_FIELDS,
+ BT_MAP_LIST_MESSAGES,
+ BT_MAP_UPDATE_INBOX,
+ BT_MAP_PUSH_MESSAGE,
+ BT_MAP_GET_MESSAGE,
BT_OBEX_SERVER_ALLOCATE,
BT_OBEX_SERVER_DEALLOCATE,
BT_OBEX_SERVER_IS_ACTIVATED,
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,
BT_HDP_SEND_DATA,
BT_HDP_REGISTER_SINK_APP,
BT_HDP_UNREGISTER_SINK_APP,
- BT_GATT_GET_PRIMARY_SERVICES = BT_FUNC_GATT_BASE,
+ BT_HDP_GET_FD,
+
+ BT_GATT_GET_PRIMARY_SERVICES = BT_FUNC_GATT_BASE, /* GATT Client */
+#ifdef TIZEN_GATT_CLIENT
+ BT_GATT_CLIENT_REGISTER, /* GATT Client */
+ BT_GATT_CLIENT_UNREGISTER, /* GATT Client */
+ BT_GATT_GET_SERVICE_PROPERTIES, /* GATT Client */
+ BT_GATT_GET_CHARACTERISTIC_PROPERTIES, /* GATT Client */
+ BT_GATT_GET_INCLUDED_SERVICES, /* GATT Client */
+#endif
BT_GATT_DISCOVER_CHARACTERISTICS,
BT_GATT_SET_PROPERTY_REQUEST,
- BT_GATT_READ_CHARACTERISTIC,
+ BT_GATT_READ_CHARACTERISTIC, /* GATT Client*/
+#ifdef TIZEN_GATT_CLIENT
+ BT_GATT_READ_DESCRIPTOR_VALUE, /* GATT Client */
+ 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
BT_GATT_WATCH_CHARACTERISTIC,
BT_GATT_REGISTER_APPLICATION,
BT_GATT_REGISTER_SERVICE,
BT_GATT_SEND_RESPONSE,
+//#ifndef GATT_DIRECT
+ BT_GATT_SERVER_REGISTER,
+ BT_GATT_SERVER_ADD_SERVICE,
+ BT_GATT_SERVER_ADD_CHARACTERISTIC,
+ BT_GATT_SERVER_ADD_DESCRIPTOR,
+ BT_GATT_SERVER_START_SERVICE,
+ 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,
+//#endif
BT_LE_IPSP_INIT = BT_FUNC_IPSP_BASE,
BT_LE_IPSP_DEINIT,
BT_LE_IPSP_CONNECT,
BT_PXP_REPORTER_REGISTER,
BT_PXP_REPORTER_UNREGISTER,
BT_PXP_REPORTER_GET_PROPERTY,
+ BT_TDS_PROVIDER_REGISTER = BT_FUNC_TDS_BASE,
+ BT_TDS_PROVIDER_UNREGISTER,
+ BT_TDS_PROVIDER_SET_MANUF_DATA,
+ BT_TDS_PROVIDER_CREATE,
+ BT_TDS_PROVIDER_DESTROY,
+ BT_TDS_PROVIDER_SET_TRANSPORT_DATA,
+ BT_TDS_SEND_ACTIVATION_RESPONSE,
+ BT_TDS_READ_TRANSPORT_DATA,
+ BT_TDS_ENABLE_CONTROL_POINT,
+ BT_TDS_ACTIVATE_CONTROL_POINT,
+ BT_OTP_SERVER_INIT = BT_FUNC_OTP_BASE,
+ BT_OTP_SERVER_DEINIT,
+ BT_OTP_READ_VALUE,
+ BT_OTP_ENABLE_NOTIFICATION,
+ BT_OTP_WRITE_VALUE,
+ BT_LE_OTC_CONNECT,
+ BT_LE_OTC_DISCONNECT,
} bt_function_t;
typedef struct {
#define BT_DPM_SYSPOPUP "dpm-syspopup"
#endif
-#ifndef TIZEN_PROFILE_WEARABLE
#define BT_FILE_VISIBLE_TIME "file/private/libug-setting-bluetooth-efl/visibility_time"
-#endif
#define BT_OFF_DUE_TO_FLIGHT_MODE "file/private/bt-core/flight_mode_deactivated"
#define BT_OFF_DUE_TO_POWER_SAVING_MODE "file/private/bt-core/powersaving_mode_deactivated"
#define BT_NETWORK_PATH "/org/projectx/bt/newtork"
#define BT_OPP_CLIENT_PATH "/org/projectx/bt/opp_client"
#define BT_OPP_SERVER_PATH "/org/projectx/bt/opp_server"
+#define BT_MAP_CLIENT_PATH "/org/projectx/bt/map_client"
#define BT_PBAP_CLIENT_PATH "/org/projectx/bt/pbap_client"
#define BT_RFCOMM_CLIENT_PATH "/org/projectx/bt/rfcomm_client"
#define BT_RFCOMM_SERVER_PATH "/org/projectx/bt/rfcomm_server"
#define BT_AVRCP_CONTROL_PATH "/org/projectx/bt/avrcp_control"
#define BT_A2DP_SOURCE_PATH "/org/projectx/bt/a2dp_source"
#define BT_HID_DEVICE_PATH "/org/projectx/bt/hid_device"
+#define BT_TDS_PATH "/org/projectx/bt/tds"
+#define BT_OTP_PATH "/org/projectx/bt/otp"
+#define BT_HDP_DEVICE_PATH "/org/projectx/bt/hdp_device"
+
+#ifndef GATT_DIRECT
+#define BT_GATT_SERVER_PATH "/org/projectx/bt/gatt_server"
+#endif
+
+#ifdef TIZEN_GATT_CLIENT
+#define BT_GATT_CLIENT_PATH "/org/projectx/bt/gatt_client"
+#endif
#define BT_ENABLED "Enabled"
#define BT_DISABLED "Disabled"
#define BT_NETWORK_SERVER_DISCONNECTED "NetworkServerDisconnected"
#define BT_OPP_CONNECTED "OppConnected"
#define BT_OPP_DISCONNECTED "OppDisconnected"
+#define BT_MAP_CONNECTED "MapConnected"
+#define BT_MAP_DISCONNECTED "MapDisconnected"
+#define BT_MAP_LIST_FOLDERS_COMPLETE "ListFoldersComplete"
+#define BT_MAP_FILTER_FIELDS_COMPLETE "MapListFiltersFieldComplete"
+#define BT_MAP_LIST_MESSAGES_COMPLETE "MapListMessagesComplete"
+#define BT_MAP_GET_MESSAGE_COMPLETE "MapGetMessageComplete"
+#define BT_MAP_PUSH_MESSAGE_COMPLETE "MapPushMessageComplete"
#define BT_TRANSFER_CONNECTED "TransferConnected"
#define BT_TRANSFER_DISCONNECTED "TransferDisonnected"
#define BT_TRANSFER_STARTED "TransferStarted"
#define BT_MEDIA_PLAY_STATUS "MediaPlayStatus"
#define BT_MEDIA_POSITION_STATUS "MediaPositionStatus"
#define BT_MEDIA_TRACK_CHANGE "MediaTrackStatus"
+#define BT_MEDIA_DELAY_CHANGE "MediaDelayStatus"
#define BT_NAME_OWNER_CHANGED "NameOwnerChanged"
+
+#ifdef TIZEN_GATT_CLIENT
+#define BT_GATT_SERVER_CONNECTED "GattServerConnected"
+#define BT_GATT_SERVER_DISCONNECTED "GattServerDisconnected"
+#define BT_GATT_CLIENT_CONNECTED "GattClientConnected"
+#define BT_GATT_CLIENT_DISCONNECTED "GattClientDisconnected"
+#else
#define BT_GATT_CONNECTED "GattConnected"
#define BT_GATT_DISCONNECTED "GattDisconnected"
+#endif
+
+#ifndef GATT_DIRECT
+#define BT_GATT_VALUE_CHANGED "GattValueChanged"
+#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
+#define BT_GATT_CLIENT_READ_CHAR "GattReadCharValue"
+#define BT_GATT_CLIENT_WRITE_CHAR "GattWriteCharValue"
+#define BT_GATT_CLIENT_READ_DESC "GattReadDescriptor"
+#define BT_GATT_CLIENT_WRITE_DESC "GattWriteDescriptor"
+#endif
+
#define BT_GATT_REQ_ATT_MTU_CHANGED "GattReqAttMtuChanged"
#define BT_GATT_CHAR_VAL_CHANGED "GattCharValueChanged"
#ifdef GATT_NO_RELAY
#define BT_IPSP_CONNECTED "IpspConnected"
#define BT_IPSP_DISCONNECTED "IpspDisconnected"
#define BT_LE_DATA_LENGTH_CHANGED "LEDataLengthChanged"
+#define BT_HDP_CONNECTED "HDPConnected"
+#define BT_HDP_DISCONNECTED "HDPDisconnected"
+#define BT_IBEACON_DEVICE_FOUND "iBeaconDeviceFound"
#define BT_PXP_PROPERTY_CHANGED "PxpValueChanged"
+/* TDS */
+#define BT_TDS_ACTIVATION_REQUESTED "TdsActivationRequested"
+#define BT_TDS_TRANSPORT_DATA_RECEIVED "TdsBlockDataReceived"
+#define BT_TDS_ACTIVATION_RESULT "TdsActivationResult"
+#define BT_TDS_CONTROL_POINT_ENABLED "TdsControlPointEnabled"
+#define BT_TDS_ACTIVATION_INDICATION "TdsActivationIndication"
+
+/* OTP */
+#define BT_OTP_SERVER_STATE_CHANGED "OtpServerStateChanged"
+#define BT_OTP_READ_CHAR_VAL "OtpReadCharVal"
+#define BT_OTP_NOTIFICATION_ENABLED "OtpNotificationEnabled"
+#define BT_OTP_WRITE_CHAR_VAL "OtpWriteCharVal"
+#define BT_OTP_INDICATION "OtpIndication"
+#define BT_OTC_STATE_CHANGED "OtcStateChanged"
+
+#define HEADED_PLUGIN_FILEPATH "/usr/lib/bt-plugin-headed.so"
+#define HEADED_PLUGIN_FILEPATH64 "/usr/lib64/bt-plugin-headed.so"
+#define FILEPATH_ARCH_64 "/usr/lib64"
+
+struct bluetooth_headed_plugin_t {
+ int (*bt_launch_dpmpopup) (char *mode);
+ int (*bt_launch_system_popup)(int event_type,
+ const char *device_name,
+ const unsigned char *auth_info,
+ char *passkey,
+ const char *filename,
+ const char *agent_path);
+ void (*bt_destroy_popup_all)(void);
+ bool (*bt_launch_unable_to_pairing_syspopup)(int result);
+ bool (*bt_is_tethering_enabled)(void);
+ int (*bt_get_mime_type)(char *file_name, char **mime_type);
+};
+
+typedef struct {
+ gboolean plugin_headed_enabled;
+ void *handle_headed;
+ struct bluetooth_headed_plugin_t *headed_plugin;
+} bt_plugin_info_t;
+
+typedef enum {
+ _PROFILE_UNKNOWN = 0,
+ _PROFILE_MOBILE = 0x1,
+ _PROFILE_WEARABLE = 0x2,
+ _PROFILE_TV = 0x4,
+ _PROFILE_IVI = 0x8,
+ _PROFILE_IOT = 0x10,
+ _PROFILE_COMMON = 0x20,
+} tizen_profile_t;
+
+/* For optimization, make this extern and define in a shared C file */
+extern tizen_profile_t profile;
+extern bt_plugin_info_t *headed_plugin_info;
+
+/* Accessing system info */
+int system_info_get_platform_string(const char *key, char **value);
+
+void bluetooth_plugin_init();
+void bluetooth_plugin_deinit();
+
+static inline tizen_profile_t get_tizen_profile()
+{
+ char *profileName = NULL;
+
+ if (__builtin_expect(profile != _PROFILE_UNKNOWN, 1))
+ return profile;
+
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+
+ /* To pass the checking of g_ir */
+ if (!profileName)
+ return _PROFILE_UNKNOWN;
+
+ switch (*profileName) {
+ case 'm':
+ case 'M':
+ profile = _PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ profile = _PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ profile = _PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ 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;
+ }
+ free(profileName);
+
+ return profile;
+}
+#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)
+#define TIZEN_PROFILE_MOBILE (get_tizen_profile() == _PROFILE_MOBILE)
+
+#define TIZEN_FEATURE_NETWORK_TETHERING_ENABLE (get_tizen_profile() & (_PROFILE_MOBILE))
+#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))
+
#ifdef __cplusplus
}
#endif /* __cplusplus */