g_variant_get(parameters, "(i&sn@ay)", &result, &address, &data_len, &var);
data = (char *)g_variant_get_data(var);
- if(data) {
+ if (data) {
BT_DBG("Address [%s]", address);
BT_DBG("Data len [%d]", data_len);
g_free(info->data);
g_free(info);
}
- }
+ }
g_variant_unref(var);
} else if (strcasecmp(signal_name, BT_TDS_ACTIVATION_RESULT) == 0) {
BT_DBG("TDS Control point Activation result");
case BT_HEADSET_EVENT:
event_func = __bt_headset_event_filter;
path = BT_HEADSET_PATH;
- break;
+ break;
case BT_NETWORK_EVENT:
event_func = __bt_network_event_filter;
path = BT_NETWORK_PATH;
- break;
+ break;
case BT_AVRCP_EVENT:
event_func = __bt_avrcp_event_filter;
path = BT_AVRCP_PATH;
path = BT_HDP_DEVICE_PATH;
break;
#ifndef GATT_DIRECT
- case BT_GATT_SERVER_EVENT:
+ case BT_GATT_SERVER_EVENT:
event_func = __bt_gatt_server_event_filter;
path = BT_GATT_SERVER_PATH;
break;
#define LOG_COLOR_PURPLE "\033[35m"
#define DBG(fmt, args...) \
- SLOGD(fmt, ##args)
+ SLOGD(fmt, ##args)
#define INFO(fmt, args...) \
- SLOGI(fmt, ##args)
+ SLOGI(fmt, ##args)
#define ERR(fmt, args...) \
- SLOGE(fmt, ##args)
+ SLOGE(fmt, ##args)
#define INFO_C(fmt, arg...) \
- SLOGI_IF(TRUE, LOG_COLOR_GREEN" "fmt" "LOG_COLOR_RESET, ##arg)
+ SLOGI_IF(TRUE, LOG_COLOR_GREEN" "fmt" "LOG_COLOR_RESET, ##arg)
#define ERR_C(fmt, arg...) \
- SLOGI_IF(TRUE, LOG_COLOR_RED" "fmt" "LOG_COLOR_RESET, ##arg)
+ SLOGI_IF(TRUE, LOG_COLOR_RED" "fmt" "LOG_COLOR_RESET, ##arg)
#define DBG_SECURE(fmt, args...) SECURE_SLOGD(fmt, ##args)
#define ERR_SECURE(fmt, args...) SECURE_SLOGE(fmt, ##args)
These properties have to added to HAL bt_property_type_t enums */
struct hal_prop_device_service_rec {
- uint8_t uuid[16];
- uint16_t channel;
- uint8_t name_len;
- uint8_t name[];
+ uint8_t uuid[16];
+ uint16_t channel;
+ uint8_t name_len;
+ uint8_t name[];
} __attribute__((packed));
#define HAL_PROP_DEVICE_FRIENDLY_NAME 0x0a
#define HAL_PROP_DEVICE_IS_ALIAS_SET 0x19
struct hal_prop_device_info {
- uint8_t version;
- uint16_t sub_version;
- uint16_t manufacturer;
+ uint8_t version;
+ uint16_t sub_version;
+ uint16_t manufacturer;
} __attribute__((packed));
#define HAL_PROP_DEVICE_TIMESTAMP 0xFF
#define HAL_EV_ADAPTER_STATE_CHANGED 0x00
struct hal_ev_adapter_state_changed {
- uint8_t state;
+ uint8_t state;
} __attribute__((packed));
struct hal_property {
- uint8_t type;
- uint16_t len;
- uint8_t val[0];
+ uint8_t type;
+ uint16_t len;
+ uint8_t val[0];
} __attribute__((packed));
#define HAL_EV_ADAPTER_PROPS_CHANGED 0x01
struct hal_ev_adapter_props_changed {
- uint8_t status;
- uint8_t num_props;
- struct hal_property props[0];
+ uint8_t status;
+ uint8_t num_props;
+ struct hal_property props[0];
} __attribute__((packed));
#define HAL_EV_DISCOVERY_STATE_CHANGED 0x85
struct hal_ev_discovery_state_changed {
- uint8_t state;
+ uint8_t state;
} __attribute__((packed));
#define HAL_EV_REMOTE_DEVICE_PROPS 0x83
struct hal_ev_remote_device_props {
- uint8_t status;
- uint8_t bdaddr[6];
- uint8_t num_props;
- struct hal_property props[0];
+ uint8_t status;
+ uint8_t bdaddr[6];
+ uint8_t num_props;
+ struct hal_property props[0];
} __attribute__((packed));
#define HAL_EV_DEVICE_FOUND 0x84
struct hal_ev_device_found {
- uint8_t num_props;
- struct hal_property props[0];
+ uint8_t num_props;
+ struct hal_property props[0];
} __attribute__((packed));
/* Device callbacks */
#define HAL_EV_PIN_REQUEST 0x86
struct hal_ev_pin_request {
- uint8_t bdaddr[6];
- uint8_t name[249];
- uint32_t class_of_dev;
+ uint8_t bdaddr[6];
+ uint8_t name[249];
+ uint32_t class_of_dev;
} __attribute__((packed));
#define HAL_EV_SSP_REQUEST 0x87
struct hal_ev_ssp_request {
- uint8_t bdaddr[6];
- uint8_t name[249];
- uint32_t class_of_dev;
- uint8_t pairing_variant;
- uint32_t passkey;
+ uint8_t bdaddr[6];
+ uint8_t name[249];
+ uint32_t class_of_dev;
+ uint8_t pairing_variant;
+ uint32_t passkey;
} __attribute__((packed));
#define HAL_BOND_STATE_NONE 0
#define HAL_EV_BOND_STATE_CHANGED 0x88
struct hal_ev_bond_state_changed {
- uint8_t status;
- uint8_t bdaddr[6];
- uint8_t state;
+ uint8_t status;
+ uint8_t bdaddr[6];
+ uint8_t state;
} __attribute__((packed));
#define HAL_EV_AUTHORIZE_REQUEST 0x89
#ifdef TIZEN_BT_HAL
#define HAL_EV_SOCK_AUTHORIZE_REQUEST 0x90
struct hal_ev_sock_conn_auth {
- uint8_t uuid[16];
+ uint8_t uuid[16];
uint8_t bdaddr[6];
} __attribute__((packed));
#endif //TIZEN_BT_HAL
#define HAL_EV_ACL_STATE_CHANGED 0x8A
struct hal_ev_acl_state_changed {
- uint8_t status;
- uint8_t bdaddr[6];
- uint8_t state;
+ uint8_t status;
+ uint8_t bdaddr[6];
+ uint8_t state;
} __attribute__((packed));
#define HAL_DEVICE_TRUSTED 0x00
#define HAL_EV_DEVICE_TRUST_CHANGED 0x8B
struct hal_ev_device_trust_state_changed {
- uint8_t bdaddr[6];
- uint8_t trust;
+ uint8_t bdaddr[6];
+ uint8_t trust;
} __attribute__((packed));
#define BT_TRANSPORT_UNKNOWN 0x00
#define HAL_EV_HIDHOST_CONN_STATE 0x81
struct hal_ev_hidhost_conn_state {
- uint8_t bdaddr[6];
- uint8_t state;
+ uint8_t bdaddr[6];
+ uint8_t state;
} __attribute__((packed));
#define HAL_EV_HIDHOST_INFO 0x82
#define HAL_EV_A2DP_CONN_STATE 0x8C
struct hal_ev_a2dp_conn_state {
uint8_t state;
- uint8_t bdaddr[6];
+ uint8_t bdaddr[6];
} __attribute__((packed));
#define HAL_AUDIO_SUSPEND 0x00
#define HAL_EV_A2DP_AUDIO_STATE 0x8D
struct hal_ev_a2dp_audio_state {
- uint8_t state;
- uint8_t bdaddr[6];
+ uint8_t state;
+ uint8_t bdaddr[6];
} __attribute__((packed));
#define HAL_EV_A2DP_AUDIO_CONFIG 0x8E
struct hal_ev_a2dp_audio_config {
- uint8_t bdaddr[6];
- uint32_t sample_rate;
- uint8_t channel_count;
+ uint8_t bdaddr[6];
+ uint32_t sample_rate;
+ uint8_t channel_count;
} __attribute__((packed));
/* A2DP Sink Role connection*/
#define HAL_EV_HANDSFREE_CONN_STATE 0x91
struct hal_ev_handsfree_conn_state {
- uint8_t state;
- uint8_t bdaddr[6];
+ uint8_t state;
+ uint8_t bdaddr[6];
} __attribute__((packed));
#define HAL_EV_HANDSFREE_AUDIO_STATE_DISCONNECTED 0x00
#define HAL_EV_HANDSFREE_AUDIO_STATE 0x92
struct hal_ev_handsfree_audio_state {
- uint8_t state;
- uint8_t bdaddr[6];
+ uint8_t state;
+ uint8_t bdaddr[6];
} __attribute__((packed));
/* HDP HAL Events */
#define HAL_EV_HDP_CONN_STATE 0x94
struct hal_ev_hdp_conn_state {
uint16_t app_id;
- uint8_t bdaddr[6];
+ uint8_t bdaddr[6];
uint8_t mdep_index;
uint16_t channel_id;
uint8_t channel_state;
/* LE-GATT */
#define HAL_EV_SERVER_INSTANCE_INITIALIZED 0xA4
struct hal_ev_server_instance_registered {
- uint32_t status;
- uint32_t server_instance;
- uint8_t app_uuid[16];
+ uint32_t status;
+ uint32_t server_instance;
+ uint8_t app_uuid[16];
} __attribute__((packed));
#define HAL_EV_MULTI_ADV_DATA_SET 0xA5
struct hal_ev_multi_adv_data_set {
- uint8_t status;
- uint8_t server_instance;
+ uint8_t status;
+ uint8_t server_instance;
} __attribute__((packed));
#define HAL_EV_MULTI_ADV_ENABLE 0xA6
struct hal_ev_multi_adv_enable {
- uint32_t status;
- uint32_t server_instance;
+ uint32_t status;
+ uint32_t server_instance;
} __attribute__((packed));
#define HAL_EV_MULTI_ADV_DISABLE 0xA7
struct hal_ev_multi_adv_disable {
- uint32_t status;
- uint32_t server_instance;
+ uint32_t status;
+ uint32_t server_instance;
} __attribute__((packed));
#define HAL_EV_MULTI_ADV_UPDATE 0xA8
struct hal_ev_multi_adv_update {
- uint32_t status;
- uint32_t server_instance;
+ uint32_t status;
+ uint32_t server_instance;
} __attribute__((packed));
#define HAL_EV_LEGACY_ADV_ENABLE 0xA9
struct hal_ev_legacy_adv_status {
- uint32_t status;
- uint32_t server_instance;
+ uint32_t status;
+ uint32_t server_instance;
} __attribute__((packed));
#define HAL_EV_GATT_CLIENT_REGISTERED 0xAA
struct hal_ev_gatt_client_registered {
- uint32_t status;
- uint32_t client_if;
- uint8_t app_uuid[16];
+ uint32_t status;
+ uint32_t client_if;
+ uint8_t app_uuid[16];
} __attribute__((packed));
#define HAL_EV_GATT_CLIENT_SCAN_RESULT 0xAC
#define HAL_EV_GATT_SERVICE_ADDED 0xAD
struct hal_ev_gatt_service_added {
- uint32_t status;
- uint32_t server_instance;
+ uint32_t status;
+ uint32_t server_instance;
uint8_t is_primary;
uint8_t svc_uuid[16];
- uint32_t service_handle;
+ uint32_t service_handle;
} __attribute__((packed));
#define HAL_EV_GATT_CHAR_ADDED 0xAE
struct hal_ev_gatt_char_added {
- uint32_t status;
- uint32_t server_instance;
- uint32_t service_handle;
- uint32_t char_handle;
+ uint32_t status;
+ uint32_t server_instance;
+ uint32_t service_handle;
+ uint32_t char_handle;
uint8_t char_uuid[16];
} __attribute__((packed));
#define HAL_EV_GATT_DESC_ADDED 0xAF
struct hal_ev_gatt_desc_added {
- uint32_t status;
- uint32_t server_instance;
- uint32_t service_handle;
- uint32_t desc_handle;
+ uint32_t status;
+ uint32_t server_instance;
+ uint32_t service_handle;
+ uint32_t desc_handle;
uint8_t desc_uuid[16];
} __attribute__((packed));
#define HAL_EV_GATT_SERVICE_STARTED 0xB0
struct hal_ev_gatt_service_started {
- uint32_t status;
- uint32_t server_instance;
- uint32_t service_handle;
+ uint32_t status;
+ uint32_t server_instance;
+ uint32_t service_handle;
} __attribute__((packed));
#define HAL_EV_GATT_SERVICE_DELETED 0xB1
struct hal_ev_gatt_service_deleted {
- uint32_t status;
- uint32_t server_instance;
- uint32_t service_handle;
+ uint32_t status;
+ uint32_t server_instance;
+ uint32_t service_handle;
} __attribute__((packed));
#define HAL_EV_GATT_SERVER_CONNECTED 0xB2
struct hal_ev_gatt_server_connected {
- uint32_t conn_id;
- uint32_t server_instance;
- uint8_t connected;
+ uint32_t conn_id;
+ uint32_t server_instance;
+ uint8_t connected;
uint8_t bdaddr[6];
} __attribute__((packed));
#define HAL_EV_GATT_READ_REQUESTED 0xB3
struct hal_ev_gatt_server_read_req {
- uint32_t conn_id;
- uint32_t trans_id;
+ uint32_t conn_id;
+ uint32_t trans_id;
uint8_t bdaddr[6];
- uint32_t att_handle;
- uint32_t offset;
- uint8_t is_long;
+ uint32_t att_handle;
+ uint32_t offset;
+ uint8_t is_long;
} __attribute__((packed));
#define HAL_EV_GATT_WRITE_REQUESTED 0xB4
struct hal_ev_gatt_server_write_req {
- uint32_t conn_id;
- uint32_t trans_id;
+ uint32_t conn_id;
+ uint32_t trans_id;
uint8_t bdaddr[6];
- uint32_t att_handle;
- uint32_t offset;
- uint32_t length;
- uint8_t need_rsp;
- uint8_t is_prep;
- uint8_t value[0];
+ uint32_t att_handle;
+ uint32_t offset;
+ uint32_t length;
+ uint8_t need_rsp;
+ uint8_t is_prep;
+ uint8_t value[0];
} __attribute__((packed));
#define HAL_EV_GATT_INDICATE_CFM 0xB5
struct hal_ev_gatt_server_indicate_cfm {
- uint32_t conn_id;
- uint32_t trans_id;
- uint32_t att_handle;
+ uint32_t conn_id;
+ uint32_t trans_id;
+ uint32_t att_handle;
uint8_t bdaddr[6];
} __attribute__((packed));
#ifdef TIZEN_BT_HAL
#define HAL_EV_GATT_NOTIFICATION_CHANGE 0xB6
struct hal_ev_gatt_server_notifcation_change {
- uint32_t conn_id;
- uint32_t trans_id;
- uint32_t att_handle;
+ uint32_t conn_id;
+ uint32_t trans_id;
+ uint32_t att_handle;
uint8_t notify;
uint8_t bdaddr[6];
} __attribute__((packed));
#define HAL_EV_LE_STATE_CHANGED 0xB7
struct hal_ev_le_state_changed {
- uint8_t state;
+ uint8_t state;
} __attribute__((packed));
#endif /* TIZEN_BT_HAL */
#define HAL_EV_LE_CONN_STATE_CHANGED 0xB8
struct hal_ev_le_conn_state_changed {
- uint8_t status;
- uint8_t bdaddr[6];
- uint8_t state;
+ uint8_t status;
+ uint8_t bdaddr[6];
+ uint8_t state;
} __attribute__((packed));
#define HAL_EV_DEVICE_TRUSTED_PROFILES_CHANGED 0xB9
struct hal_ev_device_trusted_profiles_changed {
- uint8_t bdaddr[6];
- uint32_t trust_val;
+ uint8_t bdaddr[6];
+ uint32_t trust_val;
} __attribute__((packed));
#define HAL_RSSI_MONITORING_ENABLED 0x00
#define HAL_EV_RSSI_MONITOR_STATE_CHANGED 0xBA
struct hal_ev_rssi_monitor_state_changed {
- uint8_t bdaddr[6];
+ uint8_t bdaddr[6];
int32_t link_type;
- uint8_t state;
+ uint8_t state;
} __attribute__((packed));
#define HAL_EV_RSSI_ALERT_RECIEVED 0xBB
struct hal_ev_rssi_alert_recieved {
- uint8_t bdaddr[6];
+ uint8_t bdaddr[6];
int32_t link_type;
int32_t alert_type;
int32_t rssi;
#define HAL_EV_RAW_RSSI_RECIEVED 0xBC
struct hal_ev_raw_rssi_recieved {
- uint8_t bdaddr[6];
+ uint8_t bdaddr[6];
int32_t link_type;
int32_t rssi;
} __attribute__((packed));
};
static const char BASE_UUID_CONVERTED[BT_HAL_UUID_128] = {
- 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
- 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/** BT Profile Service UUID's */
}
static void __bt_a2dp_sink_connect_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
GError *g_error = NULL;
struct hal_ev_a2dp_conn_state ev;
int ret;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
}
static void __bt_a2dp_source_disconnect_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
GError *g_error = NULL;
struct hal_ev_a2dp_conn_state ev;
int ret;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
}
gconn = _bt_hal_get_system_gconn();
- if(!gconn) {
+ if (!gconn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
adapter_path = _bt_hal_get_adapter_path();
- if(!adapter_path) {
+ if (!adapter_path) {
ERR("adapter_path is NULL");
return BT_STATUS_FAIL;
}
static void __bt_hal_handle_a2dp_sink_events(int message, void *buf, uint16_t len)
{
- DBG("+");
- if (!interface_ready())
- return;
- switch(message) {
- case HAL_EV_A2DP_SOURCE_CONN_STATE:
- DBG("Event: HAL_EV_A2DP_SOURCE_CONN_STATE");
- __bt_hal_handle_a2dp_sink_conn_state(buf, len);
- break;
- case HAL_EV_A2DP_AUDIO_STATE:
- DBG("Event: HAL_EV_A2DP_AUDIO_STATE");
- __bt_hal_handle_a2dp_sink_audio_conn_state(buf, len);
- break;
- default:
- DBG("Event Currently not handled!!");
- break;
- }
- DBG("-");
+ DBG("+");
+ if (!interface_ready())
+ return;
+ switch (message) {
+ case HAL_EV_A2DP_SOURCE_CONN_STATE:
+ DBG("Event: HAL_EV_A2DP_SOURCE_CONN_STATE");
+ __bt_hal_handle_a2dp_sink_conn_state(buf, len);
+ break;
+ case HAL_EV_A2DP_AUDIO_STATE:
+ DBG("Event: HAL_EV_A2DP_AUDIO_STATE");
+ __bt_hal_handle_a2dp_sink_audio_conn_state(buf, len);
+ break;
+ default:
+ DBG("Event Currently not handled!!");
+ break;
+ }
+ DBG("-");
}
static bt_status_t init(btav_callbacks_t* callbacks)
struct hal_ev_adapter_state_changed ev;
gboolean *enable = (gboolean *)user_data;
- if(*enable == TRUE)
+ if (*enable == TRUE)
ev.state = HAL_POWER_ON;
else
ev.state = HAL_POWER_OFF;
if (!event_cb)
event_cb = _bt_get_adapter_event_cb();
- if (event_cb) {
+ if (event_cb)
event_cb(HAL_EV_ADAPTER_STATE_CHANGED, &ev, sizeof(ev));
- }
+
g_free(enable);
return false;
}
struct hal_ev_le_state_changed ev;
gboolean *enable = (gboolean *)user_data;
- if(*enable == TRUE)
+ if (*enable == TRUE)
ev.state = HAL_POWER_ON;
else
ev.state = HAL_POWER_OFF;
if (!event_cb)
event_cb = _bt_get_adapter_event_cb();
- if (event_cb) {
+ if (event_cb)
event_cb(HAL_EV_LE_STATE_CHANGED, &ev, sizeof(ev));
- }
+
g_free(enable);
return false;
DBG("+");
int le_value = VCONFKEY_BT_LE_STATUS_OFF;
- if (vconf_get_int(VCONFKEY_BT_LE_STATUS, &le_value)) {
+ if (vconf_get_int(VCONFKEY_BT_LE_STATUS, &le_value))
ERR("fail to get vconf key!");
- }
- if(_bt_hal_get_adapter_powered_state(&powered) == BT_STATUS_FAIL) {
+ if (_bt_hal_get_adapter_powered_state(&powered) == BT_STATUS_FAIL)
ERR("_bt_hal_get_adapter_powered_state failed");
- }
/*if LE is enabled and bluez is UP , send event from here and return.*/
- if((le_value == VCONFKEY_BT_LE_STATUS_ON)&&(powered == 1)) {
+ if ((le_value == VCONFKEY_BT_LE_STATUS_ON) && (powered == 1)) {
gboolean *user_data = g_new0(int, 1);
*user_data = TRUE;
g_idle_add(__bt_hal_send_adapter_event, (gpointer)user_data);
DBG("+");
- if (vconf_get_int(VCONFKEY_BT_STATUS, &adapter_value) != 0) {
+ if (vconf_get_int(VCONFKEY_BT_STATUS, &adapter_value) != 0)
ERR("fail to get vconf key!");
- }
- if(_bt_hal_get_adapter_powered_state(&powered) == BT_STATUS_FAIL) {
+ if (_bt_hal_get_adapter_powered_state(&powered) == BT_STATUS_FAIL)
ERR("_bt_hal_get_adapter_powered_state failed");
- }
- if((adapter_value == VCONFKEY_BT_STATUS_ON) && (powered == 1)) {
+ if ((adapter_value == VCONFKEY_BT_STATUS_ON) && (powered == 1)) {
gboolean *user_data = g_new0(int, 1);
*user_data = TRUE;
g_idle_add(__bt_hal_send_le_event, (gpointer)user_data);
int adapter_value = VCONFKEY_BT_STATUS_OFF;
DBG("+");
- if (vconf_get_int(VCONFKEY_BT_STATUS, &adapter_value) != 0) {
+ if (vconf_get_int(VCONFKEY_BT_STATUS, &adapter_value) != 0)
ERR("fail to get vconf key!");
- }
- if(adapter_value == VCONFKEY_BT_STATUS_ON) {
+ if (adapter_value == VCONFKEY_BT_STATUS_ON) {
gboolean *user_data = g_new0(int, 1);
*user_data = FALSE;
g_idle_add(__bt_hal_send_le_event, (gpointer)user_data);
{
DBG("+");
- if (g_strcmp0(item, "adv_inst_max") == 0) {
+ if (g_strcmp0(item, "adv_inst_max") == 0)
le_features[1] = atoi(value);
- } else if (g_strcmp0(item, "rpa_offloading") == 0) {
+ else if (g_strcmp0(item, "rpa_offloading") == 0)
le_features[2] = atoi(value);
- } else if (g_strcmp0(item, "max_filter") == 0) {
+ else if (g_strcmp0(item, "max_filter") == 0)
le_features[4] = atoi(value);
- } else {
+ else
DBG("No registered item");
- }
/*
* TODO: Need to check these usages for Bluez Case. In Bluedroid case,
DBG("@@Start parsing properties");
g_variant_get(result, "(a{sv})", &property_iter);
while (g_variant_iter_loop(property_iter, "{sv}", &key, &value)) {
- if(!g_strcmp0(key, "Address")) {
+ if (!g_strcmp0(key, "Address")) {
uint8_t bdaddr[6];
address = (gchar *) g_variant_get_string(value, NULL);
char **uuid_value;
int uuid_count = 0;
gsize size1 = 0;
- int i =0;
+ int i = 0;
size1 = g_variant_get_size(value);
int num_props_tmp = ev->num_props;
if (size1 > 0) {
int ret = BT_STATUS_FAIL;
/* Check Valid Adapter Path, followed by Adapter Powered state.
- If any of these fails, adapter will be considered Disabled */
+ If any of these fails, adapter will be considered Disabled */
adapter_path = _bt_hal_get_adapter_path();
if (adapter_path == NULL) {
if (size > 2) {
DBG("Send Adapter Properties changed event to HAL user,"
- " Num Prop [%d] total size [%d]",ev->num_props, size);
+ " Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_ADAPTER_PROPS_CHANGED, (void*) buf, size);
}
done:
if (size > 2) {
DBG("Send Adapter Properties changed event to HAL user,"
- " Num Prop [%d] total size [%d]",ev->num_props, size);
+ " Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_ADAPTER_PROPS_CHANGED, (void*) buf, size);
}
done:
if (size > 2) {
DBG("Send Adapter Properties changed event to HAL user,"
- " Num Prop [%d] total size [%d]",ev->num_props, size);
+ " Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_ADAPTER_PROPS_CHANGED, (void*) buf, size);
}
done:
strlen(name) + 1, name);
ev->num_props++;
- DBG("Device name [%s] property Num [%d]",name, ev->num_props);
+ DBG("Device name [%s] property Num [%d]", name, ev->num_props);
if (!event_cb)
event_cb = _bt_get_adapter_event_cb();
if (size > 2) {
DBG("Send Adapter Properties changed event to HAL user,"
- " Num Prop [%d] total size [%d]",ev->num_props, size);
+ " Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_ADAPTER_PROPS_CHANGED, (void*) buf, size);
}
done:
sizeof(bdaddr), bdaddr);
ev->num_props++;
- DBG("Device address [%s] property Num [%d]",address, ev->num_props);
+ DBG("Device address [%s] property Num [%d]", address, ev->num_props);
size += __bt_insert_hal_properties(buf + size, HAL_PROP_ADAPTER_ADDR,
sizeof(bdaddr), bdaddr);
if (size > 1) {
DBG("Send Device found event to HAL user,"
- " Num Prop [%d] total size [%d]",ev->num_props, size);
+ " Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_ADAPTER_PROPS_CHANGED, (void*) buf, size);
}
done:
g_variant_get(result, "(v)", &temp);
address = g_variant_dup_string(temp, NULL);
- if (address) {
+ if (address)
DBG("Address:%s", address);
- } else {
+ else
return BT_STATUS_FAIL;
- }
g_variant_unref(result);
g_variant_unref(temp);
gchar *key;
while (g_variant_iter_loop(item_iter, "{sv}", &key, &value)) {
- if (NULL == key || g_strcmp0(key,"Paired"))
+ if (NULL == key || g_strcmp0(key, "Paired"))
continue;
paired = g_variant_get_boolean(value);
/* Parse the signature: {oa{sa{sv}}} */
while (g_variant_iter_loop(iter, "{&oa{sa{sv}}}", &object_path, &interface_iter)) {
- if(object_path == NULL)
+ if (object_path == NULL)
continue;
while (g_variant_iter_loop(interface_iter, "{sa{sv}}",
if (size > 2) {
DBG("Send Adapter properties changed event to HAL user,"
- " Num Prop [%d] total size [%d]",ev->num_props, size);
+ " Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_ADAPTER_PROPS_CHANGED, (void*) buf, size);
}
done:
#include "bt-hal-gatt-server.h"
typedef struct {
- int adv_inst_max;
- int rpa_offloading;
- int max_filter;
+ int adv_inst_max;
+ int rpa_offloading;
+ int max_filter;
} bt_adapter_le_feature_info_t;
typedef struct {
int initialized;
gboolean is_multi_adv; /* To be removed once we complete descope Legacy Adv */
- int adv_handle;
- gboolean is_advertising;
- guint hold_timer_id;
+ int adv_handle;
+ gboolean is_advertising;
+ guint hold_timer_id;
bt_uuid_t app_uuid;
} bt_adapter_le_adv_slot_t;
typedef struct {
uint8_t event;
- int server_if;
- uint8_t status;
- uint8_t data[31];
+ int server_if;
+ uint8_t status;
+ uint8_t data[31];
} bt_hal_adv_event_data_t;
/* Macros */
if (le_adv_slot == NULL)
return;
- for (i = 0; i < le_feature_info.adv_inst_max; i++) {
+ for (i = 0; i < le_feature_info.adv_inst_max; i++)
memset(&le_adv_slot[i], 0x00, sizeof(bt_adapter_le_adv_slot_t));
- }
+
g_free(le_adv_slot);
le_adv_slot = NULL;
}
void _bt_hal_set_advertising_status(int slot_id, gboolean mode)
{
- DBG("Advertising enabled [%s] slot [%d]", mode? "TRUE": "FALSE", slot_id);
+ DBG("Advertising enabled [%s] slot [%d]", mode ? "TRUE" : "FALSE", slot_id);
bt_hal_adv_event_data_t *event;
if (le_adv_slot == NULL)
le_adv_slot[slot_id].is_advertising = mode;
event = g_malloc0(sizeof(bt_hal_adv_event_data_t));
- event->event = mode? BT_HAL_MULTI_ADV_ENB_EVT: BT_HAL_MULTI_ADV_DISABLE_EVT;
+ event->event = mode ? BT_HAL_MULTI_ADV_ENB_EVT : BT_HAL_MULTI_ADV_DISABLE_EVT;
event->server_if = slot_id;
event->status = BT_STATUS_SUCCESS;
/* To be removed later when we completely descope Legacy Adv concept */
dest[index+1] = 0x06; /* AD Type */
memcpy(&(dest[index + 2]), &src[12], byte_len);
/* Update current type */
- prev_byte_len = byte_len;
+ prev_byte_len = byte_len;
*length += 18;
break;
}
static gboolean __bt_hal_is_factory_test_mode(void)
{
- int mode = 0;
+ int mode = 0;
- if (vconf_get_bool(VCONFKEY_BT_DUT_MODE, &mode)) {
- ERR("Get the DUT Mode fail");
- return TRUE;
- }
+ if (vconf_get_bool(VCONFKEY_BT_DUT_MODE, &mode)) {
+ ERR("Get the DUT Mode fail");
+ return TRUE;
+ }
- if (mode != FALSE) {
- INFO("DUT Test Mode !!");
- return TRUE;
- }
+ if (mode != FALSE) {
+ INFO("DUT Test Mode !!");
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
static gboolean __bt_hal_adv_event_cb(gpointer param)
return FALSE;
}
- switch(event->event) {
+ switch (event->event) {
case BT_HAL_MULTI_ADV_ENB_EVT: {
INFO("BLE Advertising enabled slot [%d]", event->server_if);
struct hal_ev_multi_adv_enable ev;
}
int _bt_hal_set_advertising_params(int server_if, int min_interval,
- int max_interval,int adv_type,
- int chnl_map, int tx_power, int timeout_s)
+ int max_interval, int adv_type,
+ int chnl_map, int tx_power, int timeout_s)
{
DBG("+");
GDBusProxy *proxy;
- GVariant *ret;
- GError *error = NULL;
- guint32 min = 0;
- guint32 max = 0;
+ GVariant *ret;
+ GError *error = NULL;
+ guint32 min = 0;
+ guint32 max = 0;
bt_hal_adv_event_data_t *event;
proxy = _bt_hal_get_adapter_proxy();
- if (proxy == NULL)
+ if (proxy == NULL)
return BT_STATUS_FAIL;
if (min_interval > max_interval ||
- min_interval < BT_HAL_ADV_INTERVAL_MIN ||
- max_interval > BT_HAL_ADV_INTERVAL_MAX)
+ min_interval < BT_HAL_ADV_INTERVAL_MIN ||
+ max_interval > BT_HAL_ADV_INTERVAL_MAX)
return BT_STATUS_PARM_INVALID;
if (adv_type == BT_HAL_ADV_CONNECTABLE_DIRECT_HIGH ||
- adv_type == BT_HAL_ADV_CONNECTABLE_DIRECT_LOW ||
- adv_type == BT_HAL_ADV_NON_CONNECTABLE)
- return BT_STATUS_UNSUPPORTED;
+ adv_type == BT_HAL_ADV_CONNECTABLE_DIRECT_LOW ||
+ adv_type == BT_HAL_ADV_NON_CONNECTABLE)
+ return BT_STATUS_UNSUPPORTED;
min = min_interval / BT_HAL_ADV_INTERVAL_SPLIT;
- max = max_interval / BT_HAL_ADV_INTERVAL_SPLIT;
+ max = max_interval / BT_HAL_ADV_INTERVAL_SPLIT;
ret = g_dbus_proxy_call_sync(proxy, "SetAdvertisingParameters",
- g_variant_new("(uuuui)", min, max,
- BT_HAL_ADV_FILTER_POLICY_DEFAULT, adv_type,
- server_if), G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, &error);
+ g_variant_new("(uuuui)", min, max,
+ BT_HAL_ADV_FILTER_POLICY_DEFAULT, adv_type,
+ server_if), G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, &error);
if (error) {
- ERR("SetAdvertisingParameters Fail: %s", error->message);
- g_clear_error(&error);
+ ERR("SetAdvertisingParameters Fail: %s", error->message);
+ g_clear_error(&error);
return BT_STATUS_FAIL;
- }
+ }
INFO("Set advertising data");
- if (ret)
- g_variant_unref(ret);
+ if (ret)
+ g_variant_unref(ret);
/*
- * As we need to provide async callback to user from HAL, simply schedule a
- * callback method which will carry actual result
- */
+ * As we need to provide async callback to user from HAL, simply schedule a
+ * callback method which will carry actual result
+ */
event = g_malloc0(sizeof(bt_hal_adv_event_data_t));
event->event = BT_HAL_MULTI_ADV_UPDATE_EVT;
event->server_if = server_if;
event->status = BT_STATUS_SUCCESS;
- g_idle_add(__bt_hal_adv_event_cb, (gpointer)event);
+ g_idle_add(__bt_hal_adv_event_cb, (gpointer)event);
return BT_STATUS_SUCCESS;
}
uint8_t adv_data[31];
int index = 0;
GDBusProxy *proxy;
- GError *error = NULL;
- GVariant *ret = NULL;
- GVariant *temp = NULL;
- GVariantBuilder *builder;
+ GError *error = NULL;
+ GVariant *ret = NULL;
+ GVariant *temp = NULL;
+ GVariantBuilder *builder;
bt_hal_adv_event_data_t *event;
int length = 0;
- int i;
+ int i;
/* Parse data according to Bluez Interface */
if (__bt_hal_is_factory_test_mode()) {
- ERR("Unable to set advertising data in factory binary !!");
- return BT_STATUS_UNSUPPORTED;
- }
+ ERR("Unable to set advertising data in factory binary !!");
+ return BT_STATUS_UNSUPPORTED;
+ }
/* TODO: Check adapter and LE adapter status */
proxy = _bt_hal_get_adapter_proxy();
- if (proxy == NULL)
+ if (proxy == NULL)
return BT_STATUS_FAIL;
memset(&adv_data, 0, 31);
/* Create Builder */
builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
- for (i = 0; i < length; i++)
- g_variant_builder_add(builder, "y", adv_data[i]);
+ for (i = 0; i < length; i++)
+ g_variant_builder_add(builder, "y", adv_data[i]);
- temp = g_variant_new("ay", builder);
- g_variant_builder_unref(builder);
+ temp = g_variant_new("ay", builder);
+ g_variant_builder_unref(builder);
- DBG("####Adv data length [%d] Index [%d]", length, index);
- for (i = 0; i < length; i++)
- DBG("##Data[%d] [0x%x]", i, adv_data[i]);
+ DBG("####Adv data length [%d] Index [%d]", length, index);
+ for (i = 0; i < length; i++)
+ DBG("##Data[%d] [0x%x]", i, adv_data[i]);
if (adv_param_setup.set_scan_rsp == 0) {
/* Set Advertising data to stack */
-1, NULL, &error);
}
- if (error) {
- ERR("SetAdvertisingData Fail: %s", error->message);
- g_clear_error(&error);
- return BT_STATUS_FAIL;
- }
+ if (error) {
+ ERR("SetAdvertisingData Fail: %s", error->message);
+ g_clear_error(&error);
+ return BT_STATUS_FAIL;
+ }
INFO("Set advertising data");
- if (ret)
- g_variant_unref(ret);
+ if (ret)
+ g_variant_unref(ret);
/*
- * As we need to provide async callback to user from HAL, simply schedule a
- * callback method which will carry actual result
- */
+ * As we need to provide async callback to user from HAL, simply schedule a
+ * callback method which will carry actual result
+ */
event = g_malloc0(sizeof(bt_hal_adv_event_data_t));
event->event = BT_HAL_MULTI_ADV_DATA_EVT;
event->server_if = adv_param_setup.server_if;
event->status = BT_STATUS_SUCCESS;
memcpy(&event->data, adv_data, 31);
- g_idle_add(__bt_hal_adv_event_cb, (gpointer)event);
+ g_idle_add(__bt_hal_adv_event_cb, (gpointer)event);
- return BT_STATUS_SUCCESS;
+ return BT_STATUS_SUCCESS;
}
int _bt_hal_adapter_le_start_scan(void)
int _bt_hal_set_advertising_data(btgatt_adv_param_setup_t adv_param_setup);
int _bt_hal_set_advertising_params(int server_if, int min_interval,
- int max_interval, int adv_type,
+ int max_interval, int adv_type,
int chnl_map, int tx_power, int timeout_s);
int _bt_hal_enable_advertising(int server_if, bool enable, bool is_multi_adv);
#define BT_HAL_AGENT_SYSPOPUP_MAX_ATTEMPT 3
#define G_VARIANT_UNREF(variant) \
- g_variant_unref(variant); \
- variant = NULL
+ g_variant_unref(variant); \
+ variant = NULL
#define BT_HAL_MAX_EVENT_STR_LENGTH 50
static void *adapter_agent = NULL;
static gboolean __bt_hal_confirm_request(GapAgentPrivate *agent, GDBusProxy *device,
guint passkey);
static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *device,
- const char *uuid);
+ const char *uuid);
static gboolean __bt_hal_authorize_cancel_request(GapAgentPrivate *agent, const char *address);
static gboolean __bt_hal_pairing_cancel_request(GapAgentPrivate *agent, const char *address);
static GVariant *__bt_hal_service_getall(GDBusProxy *device, const char *interface);
static gboolean __bt_hal_device_is_hid_keyboard(unsigned int dev_class);
static int __bt_hal_device_generate_passkey(char *passkey, int size);
static gboolean __bt_hal_device_is_auto_response(uint32_t dev_class,
- const gchar *address, const gchar *name);
+ const gchar *address, const gchar *name);
static gboolean __bt_hal_device_is_device_blacklisted(const char *address, const char *name);
static gboolean __bt_hal_find_device_by_address_exactname(char *buffer,
- const char *address);
+ const char *address);
static gboolean __bt_hal_find_device_by_partial_name(char *buffer,
- const char *partial_name);
+ const char *partial_name);
static void __bt_hal_send_ssp_request_events(const gchar *address, const gchar *name,
guint passkey, uint32_t cod, unsigned char variant);
static void __bt_hal_send_authorize_request_event(const gchar *address, const char *uuid);
goto done;
}
- g_variant_get(reply_temp,"(@a{sv})", &reply); /* Format of reply a{sv}*/
+ g_variant_get(reply_temp, "(@a{sv})", &reply); /* Format of reply a{sv}*/
tmp_value = g_variant_lookup_value(reply, "Class", G_VARIANT_TYPE_UINT32);
g_variant_get(tmp_value, "u", &device_class);
goto done;
}
- g_variant_get(reply_temp,"(@a{sv})", &reply); /* Format of reply a{sv}*/
+ g_variant_get(reply_temp, "(@a{sv})", &reply); /* Format of reply a{sv}*/
- tmp_value = g_variant_lookup_value (reply, "Address", G_VARIANT_TYPE_STRING);
+ tmp_value = g_variant_lookup_value(reply, "Address", G_VARIANT_TYPE_STRING);
g_variant_get(tmp_value, "s", &address);
G_VARIANT_UNREF(tmp_value);
if (!address) {
goto done;
}
- g_variant_get(reply_temp,"(@a{sv})", &reply); /* Format of reply a{sv}*/
+ g_variant_get(reply_temp, "(@a{sv})", &reply); /* Format of reply a{sv}*/
- tmp_value = g_variant_lookup_value (reply, "Address", G_VARIANT_TYPE_STRING);
+ tmp_value = g_variant_lookup_value(reply, "Address", G_VARIANT_TYPE_STRING);
g_variant_get(tmp_value, "s", &address);
G_VARIANT_UNREF(tmp_value);
if (!address) {
NULL);
goto done;
}
- g_variant_get(reply_temp,"(@a{sv})", &reply); /* Format of reply a{sv}*/
+ g_variant_get(reply_temp, "(@a{sv})", &reply); /* Format of reply a{sv}*/
- tmp_value = g_variant_lookup_value (reply, "Address", G_VARIANT_TYPE_STRING);
+ tmp_value = g_variant_lookup_value(reply, "Address", G_VARIANT_TYPE_STRING);
g_variant_get(tmp_value, "s", &address);
G_VARIANT_UNREF(tmp_value);
- tmp_value = g_variant_lookup_value (reply, "Name", G_VARIANT_TYPE_STRING);
+ tmp_value = g_variant_lookup_value(reply, "Name", G_VARIANT_TYPE_STRING);
g_variant_get(tmp_value, "s", &name);
G_VARIANT_UNREF(tmp_value);
}
static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *device,
- const char *uuid)
+ const char *uuid)
{
const gchar *address;
const gchar *name;
goto done;
}
- g_variant_get(reply_temp,"(@a{sv})", &reply); /* Format of reply a{sv}*/
+ g_variant_get(reply_temp, "(@a{sv})", &reply); /* Format of reply a{sv}*/
- tmp_value = g_variant_lookup_value (reply, "Address", G_VARIANT_TYPE_STRING);
+ tmp_value = g_variant_lookup_value(reply, "Address", G_VARIANT_TYPE_STRING);
g_variant_get(tmp_value, "s", &address);
G_VARIANT_UNREF(tmp_value);
if (!address) {
headed_plugin_info->headed_plugin->bt_destroy_popup_all();
__bt_hal_agent_release_memory();
- return TRUE;
+ return TRUE;
}
static gboolean __bt_hal_device_is_hid_keyboard(unsigned int dev_class)
{
switch ((dev_class & 0x1f00) >> 8) {
- case 0x05:
- switch ((dev_class & 0xc0) >> 6) {
- case 0x01:
- /* input-keyboard" */
- return TRUE;
- }
- break;
+ case 0x05:
+ switch ((dev_class & 0xc0) >> 6) {
+ case 0x01:
+ /* input-keyboard" */
+ return TRUE;
+ }
+ break;
}
return FALSE;
return FALSE;
switch ((dev_class & 0x1f00) >> 8) {
- case 0x04:
- switch ((dev_class & 0xfc) >> 2) {
- case 0x01:
- case 0x02:
- /* Headset */
- is_headset = TRUE;
- break;
- case 0x06:
- /* Headphone */
- is_headset = TRUE;
- break;
- case 0x0b: /* VCR */
- case 0x0c: /* Video Camera */
- case 0x0d: /* Camcorder */
- break;
- default:
- /* Other audio device */
- is_headset = TRUE;
- break;
- }
+ case 0x04:
+ switch ((dev_class & 0xfc) >> 2) {
+ case 0x01:
+ case 0x02:
+ /* Headset */
+ is_headset = TRUE;
+ break;
+ case 0x06:
+ /* Headphone */
+ is_headset = TRUE;
+ break;
+ case 0x0b: /* VCR */
+ case 0x0c: /* Video Camera */
+ case 0x0d: /* Camcorder */
break;
- case 0x05:
- switch (dev_class & 0xff) {
- case 0x80: /* 0x80: Pointing device(Mouse) */
- is_mouse = TRUE;
- break;
-
- case 0x40: /* 0x40: input device (BT keyboard) */
-
- /* Get the LAP(Lower Address part) */
- g_strlcpy(lap_address, address, sizeof(lap_address));
-
- /* Need to Auto pair the blacklisted Keyboard */
- if (__bt_hal_device_is_device_blacklisted(lap_address, name) != TRUE) {
- DBG("Device is not black listed\n");
- return FALSE;
- } else {
- ERR("Device is black listed\n");
- return TRUE;
- }
+ default:
+ /* Other audio device */
+ is_headset = TRUE;
+ break;
+ }
+ break;
+ case 0x05:
+ switch (dev_class & 0xff) {
+ case 0x80: /* 0x80: Pointing device(Mouse) */
+ is_mouse = TRUE;
+ break;
+
+ case 0x40: /* 0x40: input device (BT keyboard) */
+
+ /* Get the LAP(Lower Address part) */
+ g_strlcpy(lap_address, address, sizeof(lap_address));
+
+ /* Need to Auto pair the blacklisted Keyboard */
+ if (__bt_hal_device_is_device_blacklisted(lap_address, name) != TRUE) {
+ DBG("Device is not black listed\n");
+ return FALSE;
+ } else {
+ ERR("Device is black listed\n");
+ return TRUE;
}
+ }
}
if ((!is_headset) && (!is_mouse))
static inline void stack_trim(void)
{
#ifdef STACK_FLUSH
- unsigned int sp;
- char buf[BUF_SIZE];
- FILE *file;
- unsigned int stacktop;
- int found = 0;
-
- asm volatile ("mov %0,sp " : "=r"(sp));
-
- sprintf(buf, "/proc/%d/maps", getpid());
- file = fopen(buf, "r");
- while (fgets(buf, BUF_SIZE, file) != NULL) {
- if (strstr(buf, "[stack]")) {
- found = 1;
- break;
- }
- }
- fclose(file);
-
- if (found) {
- sscanf(buf, "%x-", &stacktop);
- if (madvise((void *)PAGE_ALIGN(stacktop), PAGE_ALIGN(sp) - stacktop,
- MADV_DONTNEED) < 0)
- perror("stack madvise fail");
- }
+ unsigned int sp;
+ char buf[BUF_SIZE];
+ FILE *file;
+ unsigned int stacktop;
+ int found = 0;
+
+ asm volatile ("mov %0,sp " : "=r"(sp));
+
+ sprintf(buf, "/proc/%d/maps", getpid());
+ file = fopen(buf, "r");
+ while (fgets(buf, BUF_SIZE, file) != NULL) {
+ if (strstr(buf, "[stack]")) {
+ found = 1;
+ break;
+ }
+ }
+ fclose(file);
+
+ if (found) {
+ sscanf(buf, "%x-", &stacktop);
+ if (madvise((void *)PAGE_ALIGN(stacktop), PAGE_ALIGN(sp) - stacktop,
+ MADV_DONTNEED) < 0)
+ perror("stack madvise fail");
+ }
#endif
}
#include <stdio.h>
typedef enum {
- BT_HAL_AGENT_EVENT_PIN_REQUEST,
- BT_HAL_AGENT_EVENT_PASSKEY_CONFIRM_REQUEST,
- BT_HAL_AGENT_EVENT_PASSKEY_AUTO_ACCEPTED,
- BT_HAL_AGENT_EVENT_PASSKEY_REQUEST,
- BT_HAL_AGENT_EVENT_PASSKEY_DISPLAY_REQUEST,
- BT_HAL_AGENT_EVENT_AUTHORIZE_REQUEST,
- BT_HAL_AGENT_EVENT_CONFIRM_MODE_REQUEST,
- BT_HAL_AGENT_EVENT_APP_CONFIRM_REQUEST,
- BT_HAL_AGENT_EVENT_FILE_RECEIVED,
- BT_HAL_AGENT_EVENT_KEYBOARD_PASSKEY_REQUEST,
- BT_HAL_AGENT_EVENT_SECURITY,
- BT_HAL_AGENT_EVENT_TERMINATE,
- BT_HAL_AGENT_EVENT_EXCHANGE_REQUEST,
- BT_HAL_AGENT_EVENT_PBAP_REQUEST,
- BT_HAL_AGENT_EVENT_MAP_REQUEST,
- BT_HAL_AGENT_EVENT_SYSTEM_RESET_REQUEST,
- BT_HAL_AGENT_EVENT_LEGACY_PAIR_FAILED_FROM_REMOTE,
+ BT_HAL_AGENT_EVENT_PIN_REQUEST,
+ BT_HAL_AGENT_EVENT_PASSKEY_CONFIRM_REQUEST,
+ BT_HAL_AGENT_EVENT_PASSKEY_AUTO_ACCEPTED,
+ BT_HAL_AGENT_EVENT_PASSKEY_REQUEST,
+ BT_HAL_AGENT_EVENT_PASSKEY_DISPLAY_REQUEST,
+ BT_HAL_AGENT_EVENT_AUTHORIZE_REQUEST,
+ BT_HAL_AGENT_EVENT_CONFIRM_MODE_REQUEST,
+ BT_HAL_AGENT_EVENT_APP_CONFIRM_REQUEST,
+ BT_HAL_AGENT_EVENT_FILE_RECEIVED,
+ BT_HAL_AGENT_EVENT_KEYBOARD_PASSKEY_REQUEST,
+ BT_HAL_AGENT_EVENT_SECURITY,
+ BT_HAL_AGENT_EVENT_TERMINATE,
+ BT_HAL_AGENT_EVENT_EXCHANGE_REQUEST,
+ BT_HAL_AGENT_EVENT_PBAP_REQUEST,
+ BT_HAL_AGENT_EVENT_MAP_REQUEST,
+ BT_HAL_AGENT_EVENT_SYSTEM_RESET_REQUEST,
+ BT_HAL_AGENT_EVENT_LEGACY_PAIR_FAILED_FROM_REMOTE,
} bt_hal_agent_event_type_t;
void* _bt_hal_create_agent(const char *path, gboolean adapter);
}
static void __bt_av_connect_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
GError *g_error = NULL;
struct hal_ev_a2dp_conn_state ev;
GDBusConnection *conn;
int ret;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
}
static void __bt_av_disconnect_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
GError *g_error = NULL;
struct hal_ev_a2dp_conn_state ev;
GDBusConnection *conn;
int ret;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
}
gconn = _bt_hal_get_system_gconn();
- if(!gconn) {
+ if (!gconn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
adapter_path = _bt_hal_get_adapter_path();
- if(!adapter_path) {
+ if (!adapter_path) {
ERR("adapter_path is NULL");
return BT_STATUS_FAIL;
}
DBG("+");
if (!interface_ready())
return;
- switch(message) {
+ switch (message) {
case HAL_EV_A2DP_CONN_STATE:
DBG("Event: HAL_EV_A2DP_CONN_STATE");
__bt_hal_handle_av_conn_state(buf, len);
}
static void __bt_avrcp_target_connect_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
struct hal_ev_avrcp_ctrl_conn_state ev;
char *address = user_data;
int ret;
GDBusConnection *conn;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
}
static void __bt_avrcp_target_disconnect_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
struct hal_ev_avrcp_ctrl_conn_state ev;
char *address = user_data;
int ret;
GDBusConnection *conn;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
static const char *__bt_media_type_to_str(int type)
{
switch (type) {
- case BTRC_PLAYER_ATTR_EQUALIZER:
- return "Equalizer";
- case BTRC_PLAYER_ATTR_REPEAT:
- return "Repeat";
- case BTRC_PLAYER_ATTR_SHUFFLE:
- return "Shuffle";
- case BTRC_PLAYER_ATTR_SCAN:
- return "Scan";
- default :
- return NULL;
+ case BTRC_PLAYER_ATTR_EQUALIZER:
+ return "Equalizer";
+ case BTRC_PLAYER_ATTR_REPEAT:
+ return "Repeat";
+ case BTRC_PLAYER_ATTR_SHUFFLE:
+ return "Shuffle";
+ case BTRC_PLAYER_ATTR_SCAN:
+ return "Scan";
+ default:
+ return NULL;
}
return NULL;
}
proxy = _bt_hal_get_avrcp_ctrl_properties_proxy(bd_addr);
- if(proxy == NULL) {
+ if (proxy == NULL) {
ERR("Unable to allocate new proxy \n");
if (err) {
ERR("%s", err->message);
int ret = BT_STATUS_SUCCESS;
DBG("");
- for (i = 0; i < num_attrib; i++) {
+ for (i = 0; i < num_attrib; i++)
ret = _bt_hal_dbus_handler_avrcp_ctrl_set_property(bd_addr, type[i], value[i]);
- }
+
return ret;
}
btrc_play_status_t play_status;
play_status = BTRC_PLAYSTATE_ERROR;
- switch(status) {
- case BTRC_PLAYSTATE_STOPPED:
- play_status = BTRC_PLAYSTATE_STOPPED;
- break;
- case BTRC_PLAYSTATE_PLAYING:
- play_status = BTRC_PLAYSTATE_PLAYING;
- break;
- case BTRC_PLAYSTATE_PAUSED:
- play_status = BTRC_PLAYSTATE_PAUSED;
- break;
- case BTRC_PLAYSTATE_FWD_SEEK:
- play_status = BTRC_PLAYSTATE_FWD_SEEK;
- break;
- case BTRC_PLAYSTATE_REV_SEEK:
- play_status = BTRC_PLAYSTATE_REV_SEEK;
- break;
- default :
- DBG("Wrong play status received:");
- break;
+ switch (status) {
+ case BTRC_PLAYSTATE_STOPPED:
+ play_status = BTRC_PLAYSTATE_STOPPED;
+ break;
+ case BTRC_PLAYSTATE_PLAYING:
+ play_status = BTRC_PLAYSTATE_PLAYING;
+ break;
+ case BTRC_PLAYSTATE_PAUSED:
+ play_status = BTRC_PLAYSTATE_PAUSED;
+ break;
+ case BTRC_PLAYSTATE_FWD_SEEK:
+ play_status = BTRC_PLAYSTATE_FWD_SEEK;
+ break;
+ case BTRC_PLAYSTATE_REV_SEEK:
+ play_status = BTRC_PLAYSTATE_REV_SEEK;
+ break;
+ default:
+ DBG("Wrong play status received:");
+ break;
}
return play_status;
}
static void __bt_hal_handle_avrcp_ctrl_event(int message, void *buf, uint16_t len)
{
- DBG("+");
- if (!interface_ready())
- return;
- switch(message) {
- case HAL_EV_AVRCP_CTRL_CONN_STATE:
- DBG("Event: HAL_EV_AVRCP_CTRL_CONN_STATE");
- __bt_hal_handle_avrcp_ctrl_conn_state(buf, len);
- break;
- case HAL_EV_AVRCP_CTRL_PASS_THROUGH_RSP:
- DBG("Event: HAL_EV_AVRCP_CTRL_PASS_THROUGH_RSP");
- __bt_hal_handle_avrcp_ctrl_pass_cmd_res_event(buf, len);
- break;
- case HAL_EV_AVRCP_CTRL_SET_PLAYER_APP_SETTING_RSP:
- DBG("Event: HAL_EV_AVRCP_CTRL_SET_PLAYER_APP_SETTING_RSP");
- __bt_hal_handle_avrcp_ctrl_set_app_setting_res_event(buf, len);
- break;
- case HAL_EV_AVRCP_CTRL_PLAYER_APP_SETTING_CHANGED:
- DBG("Event: HAL_EV_AVRCP_CTRL_PLAYER_APP_SETTING_CHANGED");
- __bt_hal_handle_avrcp_ctrl_player_setting_changed(buf, len);
- break;
- case HAL_EV_AVRCP_CTRL_TRACK_CHANGED:
- DBG("Event: HAL_EV_AVRCP_CTRL_TRACK_CHANGED");
- __bt_hal_handle_avrcp_ctrl_track_changed_event(buf, len);
- break;
- case HAL_EV_AVRCP_CTRL_PLAY_POSITION_CHANGED:
- DBG("Event: HAL_EV_AVRCP_CTRL_PLAY_POSITION_CHANGED");
- __bt_hal_handle_avrcp_ctrl_playposition_changed_event(buf, len);
- break;
- case HAL_EV_AVRCP_CTRL_PLAY_STATUS_CHANGED:
- DBG("Event: HAL_EV_AVRCP_CTRL_PLAY_STATUS_CHANGED");
- __bt_hal_handle_avrcp_ctrl_playstatus_changed_event(buf, len);
- break;
- default:
- DBG("Event Currently not handled!!");
- break;
- }
-
- DBG("-");
+ DBG("+");
+ if (!interface_ready())
+ return;
+ switch (message) {
+ case HAL_EV_AVRCP_CTRL_CONN_STATE:
+ DBG("Event: HAL_EV_AVRCP_CTRL_CONN_STATE");
+ __bt_hal_handle_avrcp_ctrl_conn_state(buf, len);
+ break;
+ case HAL_EV_AVRCP_CTRL_PASS_THROUGH_RSP:
+ DBG("Event: HAL_EV_AVRCP_CTRL_PASS_THROUGH_RSP");
+ __bt_hal_handle_avrcp_ctrl_pass_cmd_res_event(buf, len);
+ break;
+ case HAL_EV_AVRCP_CTRL_SET_PLAYER_APP_SETTING_RSP:
+ DBG("Event: HAL_EV_AVRCP_CTRL_SET_PLAYER_APP_SETTING_RSP");
+ __bt_hal_handle_avrcp_ctrl_set_app_setting_res_event(buf, len);
+ break;
+ case HAL_EV_AVRCP_CTRL_PLAYER_APP_SETTING_CHANGED:
+ DBG("Event: HAL_EV_AVRCP_CTRL_PLAYER_APP_SETTING_CHANGED");
+ __bt_hal_handle_avrcp_ctrl_player_setting_changed(buf, len);
+ break;
+ case HAL_EV_AVRCP_CTRL_TRACK_CHANGED:
+ DBG("Event: HAL_EV_AVRCP_CTRL_TRACK_CHANGED");
+ __bt_hal_handle_avrcp_ctrl_track_changed_event(buf, len);
+ break;
+ case HAL_EV_AVRCP_CTRL_PLAY_POSITION_CHANGED:
+ DBG("Event: HAL_EV_AVRCP_CTRL_PLAY_POSITION_CHANGED");
+ __bt_hal_handle_avrcp_ctrl_playposition_changed_event(buf, len);
+ break;
+ case HAL_EV_AVRCP_CTRL_PLAY_STATUS_CHANGED:
+ DBG("Event: HAL_EV_AVRCP_CTRL_PLAY_STATUS_CHANGED");
+ __bt_hal_handle_avrcp_ctrl_playstatus_changed_event(buf, len);
+ break;
+ default:
+ DBG("Event Currently not handled!!");
+ break;
+ }
+
+ DBG("-");
}
static bt_status_t init(btrc_ctrl_callbacks_t* callbacks)
DBG("+");
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
char *address;
int ret;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
char *address;
int ret;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
DBG("+");
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
DBG("+");
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
DBG("+");
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
}
conn = _bt_hal_get_system_gconn();;
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
/* Forward declarations */
static void __bt_adapter_props_to_hal(bt_property_t *send_props, struct hal_property *prop, uint8_t num_props, uint16_t len);
static void __bt_device_props_to_hal(bt_property_t *send_props,
- struct hal_property *prop, uint8_t num_props,
- uint16_t len);
+ struct hal_property *prop, uint8_t num_props,
+ uint16_t len);
static void __bt_hal_handle_adapter_state_changed(void *buf, uint16_t len);
static void __bt_hal_handle_adapter_property_changed(void *buf, uint16_t len);
static void __bt_hal_handle_stack_messages(int message, void *buf, uint16_t len);
}
static int authorize_response(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
- uint8_t authorize, uint8_t save_settings)
+ uint8_t authorize, uint8_t save_settings)
{
DBG("+");
return _bt_hal_device_authorize_response(bd_addr, service_id, authorize, save_settings);
}
static int enable_rssi_monitoring(bt_bdaddr_t *bd_addr, uint32_t conn_link_type,
- int low_threshold, int in_range_threshold, int high_threshold)
+ int low_threshold, int in_range_threshold, int high_threshold)
{
DBG("");
return _bt_hal_device_enable_rssi_monitoring(bd_addr, conn_link_type,
switch (prop->type) {
/* TODO: Add Adapter Properties */
- default:
- send_props[i].len = prop->len;
- send_props[i].val = prop->val;
- break;
+ default:
+ send_props[i].len = prop->len;
+ send_props[i].val = prop->val;
+ break;
}
DBG("prop[%d]: %s", i, btproperty2str(&send_props[i]));
}
static void __bt_device_props_to_hal(bt_property_t *send_props,
- struct hal_property *prop, uint8_t num_props,
- uint16_t len)
+ struct hal_property *prop, uint8_t num_props,
+ uint16_t len)
{
void *buf = prop;
uint8_t i;
static void __bt_hal_handle_device_acl_state_changed_event(void *buf, uint16_t len)
{
- struct hal_ev_acl_state_changed *ev = (struct hal_ev_acl_state_changed*)buf;
- bt_bdaddr_t bd_addr;
- DBG("+");
+ struct hal_ev_acl_state_changed *ev = (struct hal_ev_acl_state_changed*)buf;
+ bt_bdaddr_t bd_addr;
+ DBG("+");
- memcpy(bd_addr.address, ev->bdaddr, 6);
- /* BD address*/
- DBG("[0x%x]", bd_addr.address[0]);
- DBG("[0x%x]", bd_addr.address[1]);
- DBG("[0x%x]", bd_addr.address[2]);
- DBG("[0x%x]", bd_addr.address[3]);
- DBG("[0x%x]", bd_addr.address[4]);
- DBG("[0x%x]", bd_addr.address[5]);
+ memcpy(bd_addr.address, ev->bdaddr, 6);
+ /* BD address*/
+ DBG("[0x%x]", bd_addr.address[0]);
+ DBG("[0x%x]", bd_addr.address[1]);
+ DBG("[0x%x]", bd_addr.address[2]);
+ DBG("[0x%x]", bd_addr.address[3]);
+ DBG("[0x%x]", bd_addr.address[4]);
+ DBG("[0x%x]", bd_addr.address[5]);
- DBG("ACL Status [0x%x]", ev->status);
- DBG("ACL State [0x%x]", ev->state);
+ DBG("ACL Status [0x%x]", ev->status);
+ DBG("ACL State [0x%x]", ev->state);
- if (!bt_hal_cbacks->acl_state_changed_cb) {
- ERR("HAL User acl_state_changed_cb is not set!!");
- return;
- }
+ if (!bt_hal_cbacks->acl_state_changed_cb) {
+ ERR("HAL User acl_state_changed_cb is not set!!");
+ return;
+ }
- bt_hal_cbacks->acl_state_changed_cb(ev->status, &bd_addr, ev->state);
- DBG("-");
+ bt_hal_cbacks->acl_state_changed_cb(ev->status, &bd_addr, ev->state);
+ DBG("-");
}
static void __bt_hal_handle_device_le_conn_state_changed_event(void *buf, uint16_t len)
{
- struct hal_ev_acl_state_changed *ev = (struct hal_ev_acl_state_changed*)buf;
- bt_bdaddr_t bd_addr;
- DBG("+");
+ struct hal_ev_acl_state_changed *ev = (struct hal_ev_acl_state_changed*)buf;
+ bt_bdaddr_t bd_addr;
+ DBG("+");
- memcpy(bd_addr.address, ev->bdaddr, 6);
- /* BD address */
- DBG("Address: [%02X:%02X:%02X:%02X:%02X:%02X]", bd_addr.address[0],
+ memcpy(bd_addr.address, ev->bdaddr, 6);
+ /* BD address */
+ DBG("Address: [%02X:%02X:%02X:%02X:%02X:%02X]", bd_addr.address[0],
bd_addr.address[1], bd_addr.address[2], bd_addr.address[3],
bd_addr.address[4], bd_addr.address[5]);
- DBG("LE conn Status [0x%x]", ev->status);
- DBG("LE conn State [0x%x]", ev->state);
+ DBG("LE conn Status [0x%x]", ev->status);
+ DBG("LE conn State [0x%x]", ev->state);
#ifdef TIZEN_BT_HAL
- if (!bt_hal_cbacks->le_conn_state_changed_cb) {
- ERR("HAL User le_conn_state_changed_cb is not set!!");
- return;
- }
+ if (!bt_hal_cbacks->le_conn_state_changed_cb) {
+ ERR("HAL User le_conn_state_changed_cb is not set!!");
+ return;
+ }
- bt_hal_cbacks->le_conn_state_changed_cb(ev->status, &bd_addr, ev->state);
+ bt_hal_cbacks->le_conn_state_changed_cb(ev->status, &bd_addr, ev->state);
#endif
- DBG("-");
+ DBG("-");
}
static void __bt_hal_handle_authorize_request_event(void *buf, uint16_t len)
static void __bt_hal_handle_device_trust_state_changed_event(void *buf, uint16_t len)
{
- struct hal_ev_device_trust_state_changed *ev = (struct hal_ev_device_trust_state_changed*)buf;
- bt_bdaddr_t bd_addr;
- DBG("+");
+ struct hal_ev_device_trust_state_changed *ev = (struct hal_ev_device_trust_state_changed*)buf;
+ bt_bdaddr_t bd_addr;
+ DBG("+");
- memcpy(bd_addr.address, ev->bdaddr, 6);
- /* BD address*/
- DBG("[0x%x]", bd_addr.address[0]);
- DBG("[0x%x]", bd_addr.address[1]);
- DBG("[0x%x]", bd_addr.address[2]);
- DBG("[0x%x]", bd_addr.address[3]);
- DBG("[0x%x]", bd_addr.address[4]);
- DBG("[0x%x]", bd_addr.address[5]);
+ memcpy(bd_addr.address, ev->bdaddr, 6);
+ /* BD address*/
+ DBG("[0x%x]", bd_addr.address[0]);
+ DBG("[0x%x]", bd_addr.address[1]);
+ DBG("[0x%x]", bd_addr.address[2]);
+ DBG("[0x%x]", bd_addr.address[3]);
+ DBG("[0x%x]", bd_addr.address[4]);
+ DBG("[0x%x]", bd_addr.address[5]);
- DBG("Device Trusted? [0x%x]", ev->trust);
+ DBG("Device Trusted? [0x%x]", ev->trust);
- if (!bt_hal_cbacks->device_trust_state_changed_cb) {
- ERR("HAL User device_trust_state_changed_cb is not set!!");
- return;
- }
+ if (!bt_hal_cbacks->device_trust_state_changed_cb) {
+ ERR("HAL User device_trust_state_changed_cb is not set!!");
+ return;
+ }
- bt_hal_cbacks->device_trust_state_changed_cb(&bd_addr, ev->trust);
- DBG("-");
+ bt_hal_cbacks->device_trust_state_changed_cb(&bd_addr, ev->trust);
+ DBG("-");
}
static void __bt_hal_handle_device_trusted_profiles_changed_event(void *buf, uint16_t len)
DBG("+");
#ifdef TIZEN_BT_HAL
- memcpy(bd_addr.address, ev->bdaddr, 6);
- DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]",
+ memcpy(bd_addr.address, ev->bdaddr, 6);
+ DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]",
bd_addr.address[0], bd_addr.address[1],
bd_addr.address[2], bd_addr.address[3],
bd_addr.address[4], bd_addr.address[5]);
DBG("+");
#ifdef TIZEN_BT_HAL
- memcpy(bd_addr.address, ev->bdaddr, 6);
- DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]",
+ memcpy(bd_addr.address, ev->bdaddr, 6);
+ DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]",
bd_addr.address[0], bd_addr.address[1],
bd_addr.address[2], bd_addr.address[3],
bd_addr.address[4], bd_addr.address[5]);
DBG("+");
#ifdef TIZEN_BT_HAL
- memcpy(bd_addr.address, ev->bdaddr, 6);
- DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]",
+ memcpy(bd_addr.address, ev->bdaddr, 6);
+ DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]",
bd_addr.address[0], bd_addr.address[1],
bd_addr.address[2], bd_addr.address[3],
bd_addr.address[4], bd_addr.address[5]);
static void __bt_hal_handle_stack_messages(int message, void *buf, uint16_t len)
{
DBG("+");
- switch(message) {
- case HAL_EV_ADAPTER_STATE_CHANGED:
- DBG("Event: HAL_EV_ADAPTER_STATE_CHANGED");
- __bt_hal_handle_adapter_state_changed(buf, len);
- break;
- case HAL_EV_ADAPTER_PROPS_CHANGED:
- DBG("Event: HAL_EV_ADAPTER_PROPS_CHANGED");
- __bt_hal_handle_adapter_property_changed(buf, len);
- break;
- case HAL_EV_DISCOVERY_STATE_CHANGED:
- DBG("Event: HAL_EV_DISCOVERY_STATE_CHANGED");
- __bt_hal_handle_adapter_discovery_state_changed(buf, len);
- break;
- case HAL_EV_DEVICE_FOUND:
- DBG("Event: HAL_EV_DEVICE_FOUND");
- __bt_hal_handle_device_found_event(buf, len);
- break;
- case HAL_EV_REMOTE_DEVICE_PROPS:
- DBG("Event: HAL_EV_REMOTE_DEVICE_PROPS");
- __bt_hal_handle_remote_device_properties_event(buf, len);
- break;
- case HAL_EV_BOND_STATE_CHANGED:
- DBG("Event: HAL_EV_BOND_STATE_CHANGED:");
- __bt_hal_handle_bond_state_changed_event(buf, len);
- break;
- case HAL_EV_ACL_STATE_CHANGED:
- DBG("Event: HAL_ACL_STATE_CONNECTED or Disconnected");
- __bt_hal_handle_device_acl_state_changed_event(buf, len);
- break;
- case HAL_EV_LE_CONN_STATE_CHANGED:
- DBG("Event: HAL_LE_CONN_STATE_CONNECTED or Disconnected");
- __bt_hal_handle_device_le_conn_state_changed_event(buf, len);
- break;
- case HAL_EV_SSP_REQUEST:
- DBG("Event: HAL_EV_SSP_REQUEST");
- __bt_hal_handle_ssp_request_event(buf, len);
- break;
- case HAL_EV_PIN_REQUEST:
- DBG("Event: HAL_EV_PIN_REQUEST");
- __bt_hal_handle_pin_request_event(buf, len);
- break;
- case HAL_EV_AUTHORIZE_REQUEST:
- DBG("Event: HAL_EV_AUTHORIZE_REQUEST");
- __bt_hal_handle_authorize_request_event(buf, len);
- break;
- case HAL_EV_DEVICE_TRUST_CHANGED:
- DBG("Event: HAL_EV_DEVICE_TRUST_CHANGED");
- __bt_hal_handle_device_trust_state_changed_event(buf, len);
- break;
+ switch (message) {
+ case HAL_EV_ADAPTER_STATE_CHANGED:
+ DBG("Event: HAL_EV_ADAPTER_STATE_CHANGED");
+ __bt_hal_handle_adapter_state_changed(buf, len);
+ break;
+ case HAL_EV_ADAPTER_PROPS_CHANGED:
+ DBG("Event: HAL_EV_ADAPTER_PROPS_CHANGED");
+ __bt_hal_handle_adapter_property_changed(buf, len);
+ break;
+ case HAL_EV_DISCOVERY_STATE_CHANGED:
+ DBG("Event: HAL_EV_DISCOVERY_STATE_CHANGED");
+ __bt_hal_handle_adapter_discovery_state_changed(buf, len);
+ break;
+ case HAL_EV_DEVICE_FOUND:
+ DBG("Event: HAL_EV_DEVICE_FOUND");
+ __bt_hal_handle_device_found_event(buf, len);
+ break;
+ case HAL_EV_REMOTE_DEVICE_PROPS:
+ DBG("Event: HAL_EV_REMOTE_DEVICE_PROPS");
+ __bt_hal_handle_remote_device_properties_event(buf, len);
+ break;
+ case HAL_EV_BOND_STATE_CHANGED:
+ DBG("Event: HAL_EV_BOND_STATE_CHANGED:");
+ __bt_hal_handle_bond_state_changed_event(buf, len);
+ break;
+ case HAL_EV_ACL_STATE_CHANGED:
+ DBG("Event: HAL_ACL_STATE_CONNECTED or Disconnected");
+ __bt_hal_handle_device_acl_state_changed_event(buf, len);
+ break;
+ case HAL_EV_LE_CONN_STATE_CHANGED:
+ DBG("Event: HAL_LE_CONN_STATE_CONNECTED or Disconnected");
+ __bt_hal_handle_device_le_conn_state_changed_event(buf, len);
+ break;
+ case HAL_EV_SSP_REQUEST:
+ DBG("Event: HAL_EV_SSP_REQUEST");
+ __bt_hal_handle_ssp_request_event(buf, len);
+ break;
+ case HAL_EV_PIN_REQUEST:
+ DBG("Event: HAL_EV_PIN_REQUEST");
+ __bt_hal_handle_pin_request_event(buf, len);
+ break;
+ case HAL_EV_AUTHORIZE_REQUEST:
+ DBG("Event: HAL_EV_AUTHORIZE_REQUEST");
+ __bt_hal_handle_authorize_request_event(buf, len);
+ break;
+ case HAL_EV_DEVICE_TRUST_CHANGED:
+ DBG("Event: HAL_EV_DEVICE_TRUST_CHANGED");
+ __bt_hal_handle_device_trust_state_changed_event(buf, len);
+ break;
#ifdef TIZEN_BT_HAL
- case HAL_EV_SOCK_AUTHORIZE_REQUEST:
- DBG("Event: HAL_EV_AUTHORIZE_REQUEST");
- __bt_hal_handle_socket_authorize_request_event(buf, len);
- break;
- case HAL_EV_LE_STATE_CHANGED:
- DBG("Event: HAL_EV_LE_STATE_CHANGED");
- __bt_hal_handle_le_state_changed(buf, len);
- break;
+ case HAL_EV_SOCK_AUTHORIZE_REQUEST:
+ DBG("Event: HAL_EV_AUTHORIZE_REQUEST");
+ __bt_hal_handle_socket_authorize_request_event(buf, len);
+ break;
+ case HAL_EV_LE_STATE_CHANGED:
+ DBG("Event: HAL_EV_LE_STATE_CHANGED");
+ __bt_hal_handle_le_state_changed(buf, len);
+ break;
#endif
- case HAL_EV_DEVICE_TRUSTED_PROFILES_CHANGED:
- DBG("Event: HAL_EV_DEVICE_TRUST_CHANGED");
- __bt_hal_handle_device_trusted_profiles_changed_event(buf, len);
- break;
- case HAL_EV_RSSI_MONITOR_STATE_CHANGED:
- DBG("Event: HAL_EV_RSSI_MONITOR_STATE_CHANGED");
- __bt_handle_rssi_monitor_state_changed(buf, len);
- break;
- case HAL_EV_RSSI_ALERT_RECIEVED:
- DBG("Event: HAL_EV_RSSI_ALERT_RECIEVED");
- __bt_handle_rssi_alert_recieved(buf, len);
- break;
- case HAL_EV_RAW_RSSI_RECIEVED:
- DBG("Event: HAL_EV_RAW_RSSI_RECIEVED");
- __bt_handle_raw_rssi_recieved(buf, len);
- break;
- default:
- DBG("Event Currently not handled!!");
- break;
+ case HAL_EV_DEVICE_TRUSTED_PROFILES_CHANGED:
+ DBG("Event: HAL_EV_DEVICE_TRUST_CHANGED");
+ __bt_hal_handle_device_trusted_profiles_changed_event(buf, len);
+ break;
+ case HAL_EV_RSSI_MONITOR_STATE_CHANGED:
+ DBG("Event: HAL_EV_RSSI_MONITOR_STATE_CHANGED");
+ __bt_handle_rssi_monitor_state_changed(buf, len);
+ break;
+ case HAL_EV_RSSI_ALERT_RECIEVED:
+ DBG("Event: HAL_EV_RSSI_ALERT_RECIEVED");
+ __bt_handle_rssi_alert_recieved(buf, len);
+ break;
+ case HAL_EV_RAW_RSSI_RECIEVED:
+ DBG("Event: HAL_EV_RAW_RSSI_RECIEVED");
+ __bt_handle_raw_rssi_recieved(buf, len);
+ break;
+ default:
+ DBG("Event Currently not handled!!");
+ break;
}
DBG("-");
}
if (system_gconn == NULL) {
system_gconn = _bt_hal_gdbus_init_system_gconn();
- } else if (g_dbus_connection_is_closed(system_gconn)){
+ } else if (g_dbus_connection_is_closed(system_gconn)) {
local_system_gconn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (system_conn == NULL) {
system_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL);
- if (system_conn == NULL) {
+ if (system_conn == NULL)
return NULL;
- }
}
manager_proxy = _bt_hal_get_manager_proxy();
- if (manager_proxy == NULL) {
+ if (manager_proxy == NULL)
return NULL;
- }
control_path = _bt_hal_get_control_device_path(bd_addr);
- if (control_path == NULL) {
+ if (control_path == NULL)
return NULL;
- }
proxy = g_dbus_proxy_new_sync(system_conn, G_DBUS_PROXY_FLAGS_NONE,
NULL, BT_HAL_BLUEZ_NAME,
control_path, BT_HAL_PLAYER_CONTROL_INTERFACE, NULL, NULL);
- if (proxy == NULL) {
+ if (proxy == NULL)
return NULL;
- }
avrcp_ctrl_proxy = proxy;
return proxy;
static GDBusConnection *__bt_hal_init_session_conn(void)
{
if (session_conn == NULL)
- session_conn =g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
+ session_conn = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
return session_conn;
}
DBG("+");
control_path = _bt_hal_get_control_device_path(bd_addr);
- if (control_path == NULL) {
+ if (control_path == NULL)
return NULL;
- }
+
DBG("control_path = %s", control_path);
conn = _bt_hal_get_system_gconn();
- if(conn == NULL) {
+ if (conn == NULL) {
ERR("FAIL to get system connection");
return NULL;
}
dev_addr += 4;
g_strlcpy(address, dev_addr, sizeof(address));
- while ((pos = strchr(address, '_')) != NULL) {
+ while ((pos = strchr(address, '_')) != NULL)
*pos = ':';
- }
g_strlcpy(device_address, address, BT_HAL_ADDRESS_STRING_SIZE);
}
}
void _bt_hal_convert_uuid_string_to_type(unsigned char *uuid,
- const char *device_uuid)
+ const char *device_uuid)
{
uint32_t uuid0, uuid4;
uint16_t uuid1, uuid2, uuid3, uuid5;
while (count > 0 && ((i + count) < length)) {
dest[i++] = *p;
p++;
- count --;
+ count--;
}
p = next;
}
if (arg < 0)
return -errno;
- if (arg & O_NONBLOCK) {
+ if (arg & O_NONBLOCK)
ERR("Already Non-blocking \n");
- }
arg |= O_NONBLOCK;
if (object_path == NULL)
return NULL;
_bt_hal_convert_device_path_to_address(object_path, device_address);
- if (g_strcmp0(address, device_address) == 0) {
+ if (g_strcmp0(address, device_address) == 0)
return g_strdup(object_path);
- }
}
return NULL;
}
char * _bt_hal_convert_disc_reason_to_string(int reason)
{
- switch(reason) {
+ switch (reason) {
case 1:
return "Link loss";
case 2:
INFO("No searched device");
adapter_proxy = _bt_hal_get_adapter_proxy();
- if(adapter_proxy == NULL) {
+ if (adapter_proxy == NULL) {
ERR("adapter_proxy == NULL, return");
return BT_STATUS_FAIL;
}
GVariant *ret = NULL;
INFO("No searched device");
adapter_proxy = _bt_hal_get_adapter_proxy();
- if(adapter_proxy == NULL) {
+ if (adapter_proxy == NULL) {
ERR("adapter_proxy == NULL, return");
return BT_STATUS_FAIL;
}
GError *err = NULL;
char **uuid_value = NULL;
gsize size;
- int i =0;
+ int i = 0;
GVariant *value = NULL;
GVariant *ret = NULL;
int result = BT_STATUS_FAIL;
DBG("+");
- if(remote_uuid == NULL) {
+ if (remote_uuid == NULL) {
ERR("remote_uuid == NULL, return");
return BT_STATUS_FAIL;
}
gconn = _bt_hal_get_system_gconn();
- if(gconn == NULL) {
+ if (gconn == NULL) {
ERR("gconn == NULL, return");
return BT_STATUS_FAIL;
}
object_path = _bt_hal_get_device_object_path(address);
- if(object_path == NULL) {
+ if (object_path == NULL) {
ERR("object_path == NULL, return");
return BT_STATUS_FAIL;
}
proxy = g_dbus_proxy_new_sync(gconn, G_DBUS_PROXY_FLAGS_NONE, NULL,
BT_HAL_BLUEZ_NAME, object_path, BT_HAL_PROPERTIES_INTERFACE, NULL,
&err);
- if(proxy == NULL) {
+ if (proxy == NULL) {
g_free(object_path);
ERR("proxy == NULL, return");
return BT_STATUS_FAIL;
if (temp_value)
g_variant_unref(temp_value);
- if(uuid_value) {
+ if (uuid_value) {
for (i = 0; uuid_value[i] != NULL; i++) {
DBG("Remote uuids %s, searched uuid: %s",
uuid_value[i], remote_uuid);
}
int bt_hal_gatt_convert_prop2string(
- bt_hal_gatt_characteristic_property_t properties,
- char *char_properties[])
+ bt_hal_gatt_characteristic_property_t properties,
+ char *char_properties[])
{
int flag_count = 0;
}
int bt_hal_gatt_convert_perm2string(
- bt_hal_gatt_permission_t properties,
- char *char_properties[])
+ bt_hal_gatt_permission_t properties,
+ char *char_properties[])
{
- int flag_count = 0;
-
- if (properties & BT_HAL_GATT_PERMISSION_READ) {
- char_properties[flag_count] = g_strdup("read");
- flag_count++;
- }
- if (properties & BT_HAL_GATT_PERMISSION_WRITE) {
- char_properties[flag_count] = g_strdup("write");
- flag_count++;
- }
- if (properties & BT_HAL_GATT_PERMISSION_ENCRYPT_READ) {
- char_properties[flag_count] = g_strdup("encrypt-read");
- flag_count++;
- }
- if (properties & BT_HAL_GATT_PERMISSION_ENCRYPT_WRITE) {
- char_properties[flag_count] = g_strdup("encrypt-write");
- flag_count++;
- }
- if (properties & BT_HAL_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_READ) {
- char_properties[flag_count] = g_strdup("encrypt-authenticated-read");
- flag_count++;
- }
- if (properties & BT_HAL_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_WRITE) {
- char_properties[flag_count] = g_strdup("encrypt-authenticated-write");
- flag_count++;
- }
-
- if (flag_count == 0) {
- char_properties[flag_count] = g_strdup("read");
- flag_count++;
- }
-
- return flag_count;
+ int flag_count = 0;
+
+ if (properties & BT_HAL_GATT_PERMISSION_READ) {
+ char_properties[flag_count] = g_strdup("read");
+ flag_count++;
+ }
+ if (properties & BT_HAL_GATT_PERMISSION_WRITE) {
+ char_properties[flag_count] = g_strdup("write");
+ flag_count++;
+ }
+ if (properties & BT_HAL_GATT_PERMISSION_ENCRYPT_READ) {
+ char_properties[flag_count] = g_strdup("encrypt-read");
+ flag_count++;
+ }
+ if (properties & BT_HAL_GATT_PERMISSION_ENCRYPT_WRITE) {
+ char_properties[flag_count] = g_strdup("encrypt-write");
+ flag_count++;
+ }
+ if (properties & BT_HAL_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_READ) {
+ char_properties[flag_count] = g_strdup("encrypt-authenticated-read");
+ flag_count++;
+ }
+ if (properties & BT_HAL_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_WRITE) {
+ char_properties[flag_count] = g_strdup("encrypt-authenticated-write");
+ flag_count++;
+ }
+
+ if (flag_count == 0) {
+ char_properties[flag_count] = g_strdup("read");
+ flag_count++;
+ }
+
+ return flag_count;
}
gboolean _bt_hal_is_service_enabled(const char *uuid)
#define BT_HAL_MAX_DBUS_TIMEOUT 45000
#define BT_HAL_TIMEOUT_MESSAGE "Did not receive a reply. Possible causes include: " \
- "the remote application did not send a reply, " \
- "the message bus security policy blocked the reply, " \
- "the reply timeout expired, or the network connection " \
- "was broken."
+ "the remote application did not send a reply, " \
+ "the message bus security policy blocked the reply, " \
+ "the reply timeout expired, or the network connection " \
+ "was broken."
#define BT_HAL_ACCESS_DENIED_MSG "Rejected send message"
#define BT_HAL_DISCOVERY_FINISHED_DELAY 200
#define BT_HAL_NAME_OWNER_CHANGED "NameOwnerChanged"
#define BT_HAL_PROPERTIES_CHANGED "PropertiesChanged"
-/**
- * This is Bluetooth error code
- */
+ /**
+ * This is Bluetooth error code
+ */
#define BT_HAL_ERROR_BASE ((int)0) /**< Error code base */
#define BT_HAL_ERROR_NONE ((int)0) /**< No error #0 */
#define BT_HAL_ERROR_CANCEL ((int)BT_HAL_ERROR_BASE - 0x01)
- /**< cancelled */
+ /**< cancelled */
#define BT_HAL_ERROR_INVALID_CALLBACK ((int)BT_HAL_ERROR_BASE - 0x02)
- /**< Callback error */
+ /**< Callback error */
#define BT_HAL_ERROR_INVALID_PARAM ((int)BT_HAL_ERROR_BASE - 0x03)
- /**< invalid paramerror */
+ /**< invalid paramerror */
#define BT_HAL_ERROR_INVALID_DATA ((int)BT_HAL_ERROR_BASE - 0x04)
- /**< invalid data error */
+ /**< invalid data error */
#define BT_HAL_ERROR_MEMORY_ALLOCATION ((int)BT_HAL_ERROR_BASE - 0x05)
- /**< Memory allocation error */
+ /**< Memory allocation error */
#define BT_HAL_ERROR_OUT_OF_MEMORY ((int)BT_HAL_ERROR_BASE - 0x06)
- /**< out of memory error */
+ /**< out of memory error */
#define BT_HAL_ERROR_TIMEOUT ((int)BT_HAL_ERROR_BASE - 0x07)
- /**< timeout error */
+ /**< timeout error */
#define BT_HAL_ERROR_NO_RESOURCES ((int)BT_HAL_ERROR_BASE - 0x08)
- /**< No resource error */
+ /**< No resource error */
#define BT_HAL_ERROR_INTERNAL ((int)BT_HAL_ERROR_BASE - 0x09)
- /**< internal error */
+ /**< internal error */
#define BT_HAL_ERROR_NOT_SUPPORT ((int)BT_HAL_ERROR_BASE - 0x0a)
- /**< Not supported error */
+ /**< Not supported error */
#define BT_HAL_ERROR_DEVICE_NOT_ENABLED ((int)BT_HAL_ERROR_BASE - 0x0b)
- /**< Operation is failed because
- of not enabled BT Adapter */
+ /**< Operation is failed because
+ of not enabled BT Adapter */
#define BT_HAL_ERROR_DEVICE_ALREADY_ENABLED ((int)BT_HAL_ERROR_BASE - 0x0c)
- /**< Enabling is failed because of
- already enabled BT Adapter */
+ /**< Enabling is failed because of
+ already enabled BT Adapter */
#define BT_HAL_ERROR_DEVICE_BUSY ((int)BT_HAL_ERROR_BASE - 0x0d)
- /**< Operation is failed because of
- other on going operation */
+ /**< Operation is failed because of
+ other on going operation */
#define BT_HAL_ERROR_ACCESS_DENIED ((int)BT_HAL_ERROR_BASE - 0x0e)
- /**< access denied error */
+ /**< access denied error */
#define BT_HAL_ERROR_MAX_CLIENT ((int)BT_HAL_ERROR_BASE - 0x0f)
- /**< max client error */
+ /**< max client error */
#define BT_HAL_ERROR_NOT_FOUND ((int)BT_HAL_ERROR_BASE - 0x10)
- /**< not found error */
+ /**< not found error */
#define BT_HAL_ERROR_SERVICE_SEARCH_ERROR ((int)BT_HAL_ERROR_BASE - 0x11)
- /**< service search fail */
+ /**< service search fail */
#define BT_HAL_ERROR_PARING_FAILED ((int)BT_HAL_ERROR_BASE - 0x12)
- /**< pairing failed error */
+ /**< pairing failed error */
#define BT_HAL_ERROR_NOT_PAIRED ((int)BT_HAL_ERROR_BASE - 0x13)
- /**< Not paired error */
+ /**< Not paired error */
#define BT_HAL_ERROR_SERVICE_NOT_FOUND ((int)BT_HAL_ERROR_BASE - 0x14)
- /**< no service error */
+ /**< no service error */
#define BT_HAL_ERROR_NOT_CONNECTED ((int)BT_HAL_ERROR_BASE - 0x15)
- /**< no connection error */
+ /**< no connection error */
#define BT_HAL_ERROR_ALREADY_CONNECT ((int)BT_HAL_ERROR_BASE - 0x16)
- /**< alread connected error */
+ /**< alread connected error */
#define BT_HAL_ERROR_CONNECTION_BUSY ((int)BT_HAL_ERROR_BASE - 0x17)
- /**< connection busy error */
+ /**< connection busy error */
#define BT_HAL_ERROR_CONNECTION_ERROR ((int)BT_HAL_ERROR_BASE - 0x18)
- /**< connection error */
+ /**< connection error */
#define BT_HAL_ERROR_MAX_CONNECTION ((int)BT_HAL_ERROR_BASE - 0x19)
- /**< max connection error*/
+ /**< max connection error*/
#define BT_HAL_ERROR_NOT_IN_OPERATION ((int)BT_HAL_ERROR_BASE - 0x1a)
- /**< Not in operation */
+ /**< Not in operation */
#define BT_HAL_ERROR_CANCEL_BY_USER ((int)BT_HAL_ERROR_BASE - 0x1b)
- /**< Cancelled by user */
+ /**< Cancelled by user */
#define BT_HAL_ERROR_REGISTRATION_FAILED ((int)BT_HAL_ERROR_BASE - 0x1c)
- /**< Service record registration failed */
+ /**< Service record registration failed */
#define BT_HAL_ERROR_IN_PROGRESS ((int)BT_HAL_ERROR_BASE - 0x1d)
- /**< Operation in progress */
+ /**< Operation in progress */
#define BT_HAL_ERROR_AUTHENTICATION_FAILED ((int)BT_HAL_ERROR_BASE - 0x1e)
- /**< authentication failed error when paring*/
+ /**< authentication failed error when paring*/
#define BT_HAL_ERROR_HOST_DOWN ((int)BT_HAL_ERROR_BASE - 0x1f)
- /**< Remote host is down */
+ /**< Remote host is down */
#define BT_HAL_ERROR_END_OF_DEVICE_LIST ((int)BT_HAL_ERROR_BASE - 0x20)
- /**< End of device list */
+ /**< End of device list */
#define BT_HAL_ERROR_AGENT_ALREADY_EXIST ((int)BT_HAL_ERROR_BASE - 0x21)
- /**< Obex agent already exists */
+ /**< Obex agent already exists */
#define BT_HAL_ERROR_AGENT_DOES_NOT_EXIST ((int)BT_HAL_ERROR_BASE - 0x22)
- /**< Obex agent does not exist */
+ /**< Obex agent does not exist */
#define BT_HAL_ERROR_ALREADY_INITIALIZED ((int)BT_HAL_ERROR_BASE - 0x23)
- /**< Already initialized */
+ /**< Already initialized */
#define BT_HAL_ERROR_PERMISSION_DEINED ((int)BT_HAL_ERROR_BASE - 0x24)
- /**< Permission deined */
+ /**< Permission deined */
#define BT_HAL_ERROR_ALREADY_DEACTIVATED ((int)BT_HAL_ERROR_BASE - 0x25)
- /**< Nap already done */
+ /**< Nap already done */
#define BT_HAL_ERROR_NOT_INITIALIZED ((int)BT_HAL_ERROR_BASE - 0x26)
- /**< Not initialized */
+ /**< Not initialized */
#define BT_HAL_ERROR_DEVICE_POLICY_RESTRICTION ((int)BT_HAL_ERROR_BASE - 0x27)
- /**< Device Policy Restricted */
-/**
-* Service class part of class of device returned from device discovery
-*/
-typedef enum {
- BT_HAL_DEVICE_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE = 0x002000,
- BT_HAL_DEVICE_SERVICE_CLASS_POSITIONING = 0x010000, /**< */
- BT_HAL_DEVICE_SERVICE_CLASS_NETWORKING = 0x020000, /**< */
- BT_HAL_DEVICE_SERVICE_CLASS_RENDERING = 0x040000, /**< */
- BT_HAL_DEVICE_SERVICE_CLASS_CAPTURING = 0x080000, /**< */
- BT_HAL_DEVICE_SERVICE_CLASS_OBJECT_TRANSFER = 0x100000, /**< */
- BT_HAL_DEVICE_SERVICE_CLASS_AUDIO = 0x200000, /**< */
- BT_HAL_DEVICE_SERVICE_CLASS_TELEPHONY = 0x400000, /**< */
- BT_HAL_DEVICE_SERVICE_CLASS_INFORMATION = 0x800000, /**< */
-} bt_hal_device_service_class_t;
-
-/**
- * Major device mask (For device discovery)
- */
-typedef enum {
- BT_HAL_DEVICE_MAJOR_MASK_MISC = 0x00,
- BT_HAL_DEVICE_MAJOR_MASK_COMPUTER = 0x0001,
- BT_HAL_DEVICE_MAJOR_MASK_PHONE = 0x0002,
- BT_HAL_DEVICE_MAJOR_MASK_LAN_ACCESS_POINT = 0x0004,
- BT_HAL_DEVICE_MAJOR_MASK_AUDIO = 0x0008,
- BT_HAL_DEVICE_MAJOR_MASK_PERIPHERAL = 0x0010,
- BT_HAL_DEVICE_MAJOR_MASK_IMAGING = 0x0020,
- BT_HAL_DEVICE_MAJOR_MASK_WEARABLE = 0x0040,
- BT_HAL_DEVICE_MAJOR_MASK_TOY = 0x0080,
- BT_HAL_DEVICE_MAJOR_MASK_HEALTH = 0x0100,
-} bt_hal_device_major_mask_t;
-
-/**
- * Major device class (part of Class of Device)
- */
-typedef enum {
- BT_HAL_DEVICE_MAJOR_CLASS_MISC = 0x00, /**< Miscellaneous major device class*/
- BT_HAL_DEVICE_MAJOR_CLASS_COMPUTER = 0x01, /**< Computer major device class*/
- BT_HAL_DEVICE_MAJOR_CLASS_PHONE = 0x02, /**< Phone major device class*/
- BT_HAL_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT = 0x03, /**< LAN major device class*/
- BT_HAL_DEVICE_MAJOR_CLASS_AUDIO = 0x04, /**< AUDIO major device class*/
- BT_HAL_DEVICE_MAJOR_CLASS_PERIPHERAL = 0x05, /**< Peripheral major device class*/
- BT_HAL_DEVICE_MAJOR_CLASS_IMAGING = 0x06, /**< Imaging major device class*/
- BT_HAL_DEVICE_MAJOR_CLASS_WEARABLE = 0x07, /**< Wearable device class*/
- BT_HAL_DEVICE_MAJOR_CLASS_TOY = 0x08, /**< Toy device class*/
- BT_HAL_DEVICE_MAJOR_CLASS_HEALTH = 0x09, /**< Health device class*/
- BT_HAL_DEVICE_MAJOR_CLASS_UNCLASSIFIED = 0x1F /**< Unknown major device class*/
-} bt_hal_device_major_class_t;
-
-
-typedef enum {
- BT_HAL_DEVICE_MINOR_CLASS_UNCLASSIFIED = 0x00, /**< unclassified minor class */
-
- /* About Computer Major class */
- BT_HAL_DEVICE_MINOR_CLASS_DESKTOP_WORKSTATION = 0x04, /**< desktop workstation
- minor class */
- BT_HAL_DEVICE_MINOR_CLASS_SERVER_CLASS_COMPUTER = 0x08, /**< server minor class */
- BT_HAL_DEVICE_MINOR_CLASS_LAPTOP = 0x0C, /**< laptop minor class */
- BT_HAL_DEVICE_MINOR_CLASS_HANDHELD_PC_OR_PDA = 0x10, /**< PDA minor class */
- BT_HAL_DEVICE_MINOR_CLASS_PALM_SIZED_PC_OR_PDA = 0x14, /**< PALM minor class */
- BT_HAL_DEVICE_MINOR_CLASS_WEARABLE_COMPUTER = 0x18, /**< Wearable PC minor class */
-
- /* About Phone Major class */
- BT_HAL_DEVICE_MINOR_CLASS_CELLULAR = 0x04, /**< Cellular minor class */
- BT_HAL_DEVICE_MINOR_CLASS_CORDLESS = 0x08, /**< cordless minor class */
- BT_HAL_DEVICE_MINOR_CLASS_SMART_PHONE = 0x0C, /**< smart phone minor class */
- BT_HAL_DEVICE_MINOR_CLASS_WIRED_MODEM_OR_VOICE_GATEWAY = 0x10,
- /**< voice gateway minor class */
- BT_HAL_DEVICE_MINOR_CLASS_COMMON_ISDN_ACCESS = 0x14, /**< ISDN minor class */
-
- /* About LAN/Network Access Point Major class */
- BT_HAL_DEVICE_MINOR_CLASS_FULLY_AVAILABLE = 0x04, /**< Fully available minor class */
- BT_HAL_DEVICE_MINOR_CLASS_1_TO_17_PERCENT_UTILIZED = 0x20, /**< 1-17% utilized minor class */
- BT_HAL_DEVICE_MINOR_CLASS_17_TO_33_PERCENT_UTILIZED = 0x40, /**< 17-33% utilized minor class */
- BT_HAL_DEVICE_MINOR_CLASS_33_TO_50_PERCENT_UTILIZED = 0x60, /**< 33-50% utilized minor class */
- BT_HAL_DEVICE_MINOR_CLASS_50_to_67_PERCENT_UTILIZED = 0x80, /**< 50-67% utilized minor class */
- BT_HAL_DEVICE_MINOR_CLASS_67_TO_83_PERCENT_UTILIZED = 0xA0, /**< 67-83% utilized minor class */
- BT_HAL_DEVICE_MINOR_CLASS_83_TO_99_PERCENT_UTILIZED = 0xC0, /**< 83-99% utilized minor class */
- BT_HAL_DEVICE_MINOR_CLASS_NO_SERVICE_AVAILABLE = 0xE0, /**< No service available minor class */
-
- /* About Audio/Video Major class */
- BT_HAL_DEVICE_MINOR_CLASS_HEADSET_PROFILE = 0x04, /**< Headset minor class */
- BT_HAL_DEVICE_MINOR_CLASS_HANDSFREE = 0x08, /**< Handsfree minor class*/
-
- BT_HAL_DEVICE_MINOR_CLASS_MICROPHONE = 0x10, /**< Microphone minor class */
- BT_HAL_DEVICE_MINOR_CLASS_LOUD_SPEAKER = 0x14, /**< Loud Speaker minor class */
- BT_HAL_DEVICE_MINOR_CLASS_HEADPHONES = 0x18, /**< Headphones minor class */
- BT_HAL_DEVICE_MINOR_CLASS_PORTABLE_AUDIO = 0x1C, /**< Portable Audio minor class */
- BT_HAL_DEVICE_MINOR_CLASS_CAR_AUDIO = 0x20, /**< Car Audio minor class */
- BT_HAL_DEVICE_MINOR_CLASS_SET_TOP_BOX = 0x24, /**< Set top box minor class */
- BT_HAL_DEVICE_MINOR_CLASS_HIFI_AUDIO_DEVICE = 0x28, /**< Hifi minor class */
- BT_HAL_DEVICE_MINOR_CLASS_VCR = 0x2C, /**< VCR minor class */
- BT_HAL_DEVICE_MINOR_CLASS_VIDEO_CAMERA = 0x30, /**< Video Camera minor class */
- BT_HAL_DEVICE_MINOR_CLASS_CAM_CORDER = 0x34, /**< CAM Corder minor class */
- BT_HAL_DEVICE_MINOR_CLASS_VIDEO_MONITOR = 0x38, /**<Video Monitor minor class */
- BT_HAL_DEVICE_MINOR_CLASS_VIDEO_DISPLAY_AND_LOUD_SPEAKER = 0x3C,
- /**< Video Display and Loud
- Speaker minor class */
- BT_HAL_DEVICE_MINOR_CLASS_VIDEO_CONFERENCING = 0x40, /**< Video Conferencing minor*/
-
- BT_HAL_DEVICE_MINOR_CLASS_GAMING_OR_TOY = 0x48, /**< Gaming or toy minor class */
-
- /* About Peripheral Major class */
- BT_HAL_DEVICE_MINOR_CLASS_KEY_BOARD = 0x40, /**< Key board minor class */
- BT_HAL_DEVICE_MINOR_CLASS_POINTING_DEVICE = 0x80, /**< Pointing Device minor class */
- BT_HAL_DEVICE_MINOR_CLASS_COMBO_KEYBOARD_OR_POINTING_DEVICE = 0xC0,
- /**< Combo Keyboard or pointing
- device minorclass */
-
- BT_HAL_DEVICE_MINOR_CLASS_JOYSTICK = 0x04, /**< JoyStick minor class */
- BT_HAL_DEVICE_MINOR_CLASS_GAME_PAD = 0x08, /**< Game Pad minor class */
- BT_HAL_DEVICE_MINOR_CLASS_REMOTE_CONTROL = 0x0C, /**< Remote Control minor class */
- BT_HAL_DEVICE_MINOR_CLASS_SENSING_DEVICE = 0x10, /**< Sensing Device minor class */
- BT_HAL_DEVICE_MINOR_CLASS_DIGITIZER_TABLET = 0x14, /**< Digitizer minor class */
- BT_HAL_DEVICE_MINOR_CLASS_CARD_READER = 0x18, /**< Card Reader minor class */
- BT_HAL_DEVICE_MINOR_CLASS_DIGITAL_PEN = 0x1C, /**< Digital pen minor class */
- BT_HAL_DEVICE_MINOR_CLASS_HANDHELD_SCANNER = 0x20, /**< Handheld scanner for bar-codes, RFID minor class */
- BT_HAL_DEVICE_MINOR_CLASS_HANDHELD_GESTURAL_INPUT_DEVICE = 0x24, /**< Handheld gestural input device minor class */
-
- /* About Imaging Major class */
- BT_HAL_DEVICE_MINOR_CLASS_DISPLAY = 0x10, /**< Display minor class */
- BT_HAL_DEVICE_MINOR_CLASS_CAMERA = 0x20, /**< Camera minor class */
- BT_HAL_DEVICE_MINOR_CLASS_SCANNER = 0x40, /**< Scanner minor class */
- BT_HAL_DEVICE_MINOR_CLASS_PRINTER = 0x80, /**< Printer minor class */
-
- /* About Wearable Major class */
- BT_HAL_DEVICE_MINOR_CLASS_WRIST_WATCH = 0x04, /**< Wrist watch minor class */
- BT_HAL_DEVICE_MINOR_CLASS_PAGER = 0x08, /**< Pager minor class */
- BT_HAL_DEVICE_MINOR_CLASS_JACKET = 0x0C, /**< Jacket minor class */
- BT_HAL_DEVICE_MINOR_CLASS_HELMET = 0x10, /**< Helmet minor class */
- BT_HAL_DEVICE_MINOR_CLASS_GLASSES = 0x14, /**< Glasses minor class */
-
- /* About Toy Major class */
- BT_HAL_DEVICE_MINOR_CLASS_ROBOT = 0x04, /**< Robot minor class */
- BT_HAL_DEVICE_MINOR_CLASS_VEHICLE = 0x08, /**< Vehicle minor class */
- BT_HAL_DEVICE_MINOR_CLASS_DOLL_OR_ACTION = 0x0C, /**< Doll or Action minor class */
- BT_HAL_DEVICE_MINOR_CLASS_CONTROLLER = 0x10, /**< Controller minor class */
- BT_HAL_DEVICE_MINOR_CLASS_GAME = 0x14, /**< Game minor class */
-
- /* About Health Major class */
- BT_HAL_DEVICE_MINOR_CLASS_BLOOD_PRESSURE_MONITOR = 0x04, /**< Blood Pressure minor class */
- BT_HAL_DEVICE_MINOR_CLASS_THERMOMETER = 0x08, /**< Thermometer minor class */
- BT_HAL_DEVICE_MINOR_CLASS_WEIGHING_SCALE = 0x0C, /**< Weighing Scale minor class */
- BT_HAL_DEVICE_MINOR_CLASS_GLUCOSE_METER = 0x10, /**< Glucose minor class */
- BT_HAL_DEVICE_MINOR_CLASS_PULSE_OXIMETER = 0x14, /**< Pulse Oximeter minor class */
- BT_HAL_DEVICE_MINOR_CLASS_HEART_OR_PULSE_RATE_MONITOR = 0x18,/**< Heart or pulse rate monitor minor class */
- BT_HAL_DEVICE_MINOR_CLASS_MEDICAL_DATA_DISPLAY = 0x1C, /**< Medical minor class */
- BT_HAL_DEVICE_MINOR_CLASS_STEP_COUNTER = 0x20, /**< Step Counter minor class */
- BT_HAL_DEVICE_MINOR_CLASS_BODY_COMPOSITION_ANALYZER = 0x24, /**< Body composition analyzer minor class */
- BT_HAL_DEVICE_MINOR_CLASS_PEAK_FLOW_MONITOR = 0x28, /**< Peak flow monitor minor class */
- BT_HAL_DEVICE_MINOR_CLASS_MEDICATION_MONITOR = 0x2C, /**< Medication monitor minor class */
- BT_HAL_DEVICE_MINOR_CLASS_KNEE_PROSTHESIS = 0x30, /**< Knee prosthesis minor class */
- BT_HAL_DEVICE_MINOR_CLASS_ANKLE_PROSTHESIS = 0x34, /**< Ankle prosthesis minor class */
-} bt_hal_device_minor_class_t;
-
-typedef enum {
- BT_HAL_GATT_PERMISSION_READ = 0x01,
- BT_HAL_GATT_PERMISSION_WRITE = 0x02,
- BT_HAL_GATT_PERMISSION_ENCRYPT_READ = 0x04,
- BT_HAL_GATT_PERMISSION_ENCRYPT_WRITE = 0x08,
- BT_HAL_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_READ = 0x10,
- BT_HAL_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_WRITE = 0x20,
-} bt_hal_gatt_permission_t;
-
-typedef enum {
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_BROADCAST = 0x01,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_READ = 0x02,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE = 0x04,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_WRITE = 0x08,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_NOTIFY = 0x10,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_INDICATE = 0x20,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_SIGNED_WRITE = 0x40,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_RELIABLE_WRITE = 0x80,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_WRITABLE_AUXILIARIES = 0x100,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_READ = 0x200,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_WRITE = 0x400,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_AUTHENTICATED_READ = 0x800,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_AUTHENTICATED_WRITE = 0x1000,
- BT_HAL_GATT_CHARACTERISTIC_PROPERTY_EXTENDED_PROPS = 0xffff,
-} bt_hal_gatt_characteristic_property_t;
-
-/**
- * This is Bluetooth device address type, fixed to 6 bytes ##:##:##:##:##:##
- */
-typedef struct {
- unsigned char addr[BT_HAL_ADDRESS_LENGTH_MAX];
-} bt_hal_device_address_t;
-
-/**
- * structure to hold the device information
- */
-typedef struct {
- bt_hal_device_major_class_t major_class; /**< major device class */
- bt_hal_device_minor_class_t minor_class; /**< minor device class */
- bt_hal_device_service_class_t service_class;
- /**< service device class */
-} bt_hal_device_class_t;
-
-/**
- * Connected state types
- */
-typedef enum {
- BT_HAL_CONNECTED_LINK_NONE = 0x00,
- BT_HAL_CONNECTED_LINK_BREDR = 0x01,
- BT_HAL_CONNECTED_LINK_LE = 0x02,
- BT_HAL_CONNECTED_LINK_BREDR_LE = 0x03,
-} bt_hal_connected_link_t;
-
-typedef struct {
- char *obj_path;
- char *uuid;
- gboolean authentication;
- gboolean authorization;
- char *role;
- char *service;
-} bt_hal_register_profile_info_t;
-
-typedef int (*bt_hal_new_connection_cb) (const char *path, int fd, bt_bdaddr_t *address);
-
-GDBusProxy *_bt_hal_get_adapter_proxy(void);
-GDBusProxy *_bt_hal_get_adapter_properties_proxy(void);
-GDBusConnection *_bt_hal_get_system_gconn(void);
-GDBusProxy *_bt_hal_get_manager_proxy(void);
-GDBusProxy *_bt_hal_get_profile_proxy(void);
-GDBusProxy *_bt_hal_get_avrcp_ctrl_proxy(bt_bdaddr_t *bd_addr);
-GDBusProxy *_bt_hal_get_avrcp_ctrl_properties_proxy(bt_bdaddr_t *bd_addr);
-char *_bt_hal_get_adapter_path(void);
-gboolean _bt_hal_is_adapter_powered(gboolean *powered);
-
-char *_bt_hal_get_device_object_path(char *address);
-void _bt_hal_convert_device_path_to_address(const char *device_path, char *device_address);
-
-void _bt_hal_convert_addr_string_to_type(unsigned char *addr, const char *address);
-void _bt_hal_convert_addr_type_to_string(char *address, const unsigned char *addr);
-void _bt_hal_convert_uuid_string_to_type(unsigned char *uuid, const char *device_uuid);
-void _bt_hal_convert_uuid_type_to_string(char *str, const unsigned char *uuid);
-
-int _bt_hal_connect_profile(char *address, char *uuid, void *cb, gpointer func_data);
-int _bt_hal_disconnect_profile(char *address, char *uuid, void *cb, gpointer func_data);
-int _bt_hal_register_profile(bt_hal_register_profile_info_t *info, gboolean use_default_rfcomm);
-void _bt_hal_unregister_profile(char *path);
-
-
-int _bt_hal_discover_services(char *address, char *uuid, void *cb, gpointer func_data);
-int _bt_hal_cancel_discovers(char *address);
-int _bt_hal_discover_service_uuids(char *address, char *remote_uuid);
-
-int _bt_hal_register_new_gdbus_object(const char *path, bt_hal_new_connection_cb cb);
-void _bt_hal_unregister_gdbus_object(int object_id);
-
-char *_bt_hal_get_control_device_path(bt_bdaddr_t *bd_addr);
-void _bt_hal_set_control_device_path(const char *path);
-void _bt_hal_remove_control_device_path(const char *path);
-
-
-int bt_hal_gatt_convert_prop2string(
- bt_hal_gatt_characteristic_property_t properties,
- char *char_properties[]);
-
-int bt_hal_gatt_convert_perm2string(
- bt_hal_gatt_permission_t properties,
- char *char_properties[]);
-
-gboolean _bt_hal_uuid_is_standard(bt_uuid_t *p_uuid);
-
-gboolean _bt_hal_is_service_enabled(const char *uuid);
+ /**< Device Policy Restricted */
+ /**
+ * Service class part of class of device returned from device discovery
+ */
+ typedef enum {
+ BT_HAL_DEVICE_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE = 0x002000,
+ BT_HAL_DEVICE_SERVICE_CLASS_POSITIONING = 0x010000, /**< */
+ BT_HAL_DEVICE_SERVICE_CLASS_NETWORKING = 0x020000, /**< */
+ BT_HAL_DEVICE_SERVICE_CLASS_RENDERING = 0x040000, /**< */
+ BT_HAL_DEVICE_SERVICE_CLASS_CAPTURING = 0x080000, /**< */
+ BT_HAL_DEVICE_SERVICE_CLASS_OBJECT_TRANSFER = 0x100000, /**< */
+ BT_HAL_DEVICE_SERVICE_CLASS_AUDIO = 0x200000, /**< */
+ BT_HAL_DEVICE_SERVICE_CLASS_TELEPHONY = 0x400000, /**< */
+ BT_HAL_DEVICE_SERVICE_CLASS_INFORMATION = 0x800000, /**< */
+ } bt_hal_device_service_class_t;
+
+ /**
+ * Major device mask (For device discovery)
+ */
+ typedef enum {
+ BT_HAL_DEVICE_MAJOR_MASK_MISC = 0x00,
+ BT_HAL_DEVICE_MAJOR_MASK_COMPUTER = 0x0001,
+ BT_HAL_DEVICE_MAJOR_MASK_PHONE = 0x0002,
+ BT_HAL_DEVICE_MAJOR_MASK_LAN_ACCESS_POINT = 0x0004,
+ BT_HAL_DEVICE_MAJOR_MASK_AUDIO = 0x0008,
+ BT_HAL_DEVICE_MAJOR_MASK_PERIPHERAL = 0x0010,
+ BT_HAL_DEVICE_MAJOR_MASK_IMAGING = 0x0020,
+ BT_HAL_DEVICE_MAJOR_MASK_WEARABLE = 0x0040,
+ BT_HAL_DEVICE_MAJOR_MASK_TOY = 0x0080,
+ BT_HAL_DEVICE_MAJOR_MASK_HEALTH = 0x0100,
+ } bt_hal_device_major_mask_t;
+
+ /**
+ * Major device class (part of Class of Device)
+ */
+ typedef enum {
+ BT_HAL_DEVICE_MAJOR_CLASS_MISC = 0x00, /**< Miscellaneous major device class*/
+ BT_HAL_DEVICE_MAJOR_CLASS_COMPUTER = 0x01, /**< Computer major device class*/
+ BT_HAL_DEVICE_MAJOR_CLASS_PHONE = 0x02, /**< Phone major device class*/
+ BT_HAL_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT = 0x03, /**< LAN major device class*/
+ BT_HAL_DEVICE_MAJOR_CLASS_AUDIO = 0x04, /**< AUDIO major device class*/
+ BT_HAL_DEVICE_MAJOR_CLASS_PERIPHERAL = 0x05, /**< Peripheral major device class*/
+ BT_HAL_DEVICE_MAJOR_CLASS_IMAGING = 0x06, /**< Imaging major device class*/
+ BT_HAL_DEVICE_MAJOR_CLASS_WEARABLE = 0x07, /**< Wearable device class*/
+ BT_HAL_DEVICE_MAJOR_CLASS_TOY = 0x08, /**< Toy device class*/
+ BT_HAL_DEVICE_MAJOR_CLASS_HEALTH = 0x09, /**< Health device class*/
+ BT_HAL_DEVICE_MAJOR_CLASS_UNCLASSIFIED = 0x1F /**< Unknown major device class*/
+ } bt_hal_device_major_class_t;
+
+
+ typedef enum {
+ BT_HAL_DEVICE_MINOR_CLASS_UNCLASSIFIED = 0x00, /**< unclassified minor class */
+
+ /* About Computer Major class */
+ BT_HAL_DEVICE_MINOR_CLASS_DESKTOP_WORKSTATION = 0x04, /**< desktop workstation
+ minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_SERVER_CLASS_COMPUTER = 0x08, /**< server minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_LAPTOP = 0x0C, /**< laptop minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_HANDHELD_PC_OR_PDA = 0x10, /**< PDA minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_PALM_SIZED_PC_OR_PDA = 0x14, /**< PALM minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_WEARABLE_COMPUTER = 0x18, /**< Wearable PC minor class */
+
+ /* About Phone Major class */
+ BT_HAL_DEVICE_MINOR_CLASS_CELLULAR = 0x04, /**< Cellular minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_CORDLESS = 0x08, /**< cordless minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_SMART_PHONE = 0x0C, /**< smart phone minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_WIRED_MODEM_OR_VOICE_GATEWAY = 0x10,
+ /**< voice gateway minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_COMMON_ISDN_ACCESS = 0x14, /**< ISDN minor class */
+
+ /* About LAN/Network Access Point Major class */
+ BT_HAL_DEVICE_MINOR_CLASS_FULLY_AVAILABLE = 0x04, /**< Fully available minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_1_TO_17_PERCENT_UTILIZED = 0x20, /**< 1-17% utilized minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_17_TO_33_PERCENT_UTILIZED = 0x40, /**< 17-33% utilized minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_33_TO_50_PERCENT_UTILIZED = 0x60, /**< 33-50% utilized minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_50_to_67_PERCENT_UTILIZED = 0x80, /**< 50-67% utilized minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_67_TO_83_PERCENT_UTILIZED = 0xA0, /**< 67-83% utilized minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_83_TO_99_PERCENT_UTILIZED = 0xC0, /**< 83-99% utilized minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_NO_SERVICE_AVAILABLE = 0xE0, /**< No service available minor class */
+
+ /* About Audio/Video Major class */
+ BT_HAL_DEVICE_MINOR_CLASS_HEADSET_PROFILE = 0x04, /**< Headset minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_HANDSFREE = 0x08, /**< Handsfree minor class*/
+
+ BT_HAL_DEVICE_MINOR_CLASS_MICROPHONE = 0x10, /**< Microphone minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_LOUD_SPEAKER = 0x14, /**< Loud Speaker minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_HEADPHONES = 0x18, /**< Headphones minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_PORTABLE_AUDIO = 0x1C, /**< Portable Audio minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_CAR_AUDIO = 0x20, /**< Car Audio minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_SET_TOP_BOX = 0x24, /**< Set top box minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_HIFI_AUDIO_DEVICE = 0x28, /**< Hifi minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_VCR = 0x2C, /**< VCR minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_VIDEO_CAMERA = 0x30, /**< Video Camera minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_CAM_CORDER = 0x34, /**< CAM Corder minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_VIDEO_MONITOR = 0x38, /**<Video Monitor minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_VIDEO_DISPLAY_AND_LOUD_SPEAKER = 0x3C,
+ /**< Video Display and Loud
+ Speaker minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_VIDEO_CONFERENCING = 0x40, /**< Video Conferencing minor*/
+
+ BT_HAL_DEVICE_MINOR_CLASS_GAMING_OR_TOY = 0x48, /**< Gaming or toy minor class */
+
+ /* About Peripheral Major class */
+ BT_HAL_DEVICE_MINOR_CLASS_KEY_BOARD = 0x40, /**< Key board minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_POINTING_DEVICE = 0x80, /**< Pointing Device minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_COMBO_KEYBOARD_OR_POINTING_DEVICE = 0xC0,
+ /**< Combo Keyboard or pointing
+ device minorclass */
+
+ BT_HAL_DEVICE_MINOR_CLASS_JOYSTICK = 0x04, /**< JoyStick minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_GAME_PAD = 0x08, /**< Game Pad minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_REMOTE_CONTROL = 0x0C, /**< Remote Control minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_SENSING_DEVICE = 0x10, /**< Sensing Device minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_DIGITIZER_TABLET = 0x14, /**< Digitizer minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_CARD_READER = 0x18, /**< Card Reader minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_DIGITAL_PEN = 0x1C, /**< Digital pen minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_HANDHELD_SCANNER = 0x20, /**< Handheld scanner for bar-codes, RFID minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_HANDHELD_GESTURAL_INPUT_DEVICE = 0x24, /**< Handheld gestural input device minor class */
+
+ /* About Imaging Major class */
+ BT_HAL_DEVICE_MINOR_CLASS_DISPLAY = 0x10, /**< Display minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_CAMERA = 0x20, /**< Camera minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_SCANNER = 0x40, /**< Scanner minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_PRINTER = 0x80, /**< Printer minor class */
+
+ /* About Wearable Major class */
+ BT_HAL_DEVICE_MINOR_CLASS_WRIST_WATCH = 0x04, /**< Wrist watch minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_PAGER = 0x08, /**< Pager minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_JACKET = 0x0C, /**< Jacket minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_HELMET = 0x10, /**< Helmet minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_GLASSES = 0x14, /**< Glasses minor class */
+
+ /* About Toy Major class */
+ BT_HAL_DEVICE_MINOR_CLASS_ROBOT = 0x04, /**< Robot minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_VEHICLE = 0x08, /**< Vehicle minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_DOLL_OR_ACTION = 0x0C, /**< Doll or Action minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_CONTROLLER = 0x10, /**< Controller minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_GAME = 0x14, /**< Game minor class */
+
+ /* About Health Major class */
+ BT_HAL_DEVICE_MINOR_CLASS_BLOOD_PRESSURE_MONITOR = 0x04, /**< Blood Pressure minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_THERMOMETER = 0x08, /**< Thermometer minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_WEIGHING_SCALE = 0x0C, /**< Weighing Scale minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_GLUCOSE_METER = 0x10, /**< Glucose minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_PULSE_OXIMETER = 0x14, /**< Pulse Oximeter minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_HEART_OR_PULSE_RATE_MONITOR = 0x18,/**< Heart or pulse rate monitor minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_MEDICAL_DATA_DISPLAY = 0x1C, /**< Medical minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_STEP_COUNTER = 0x20, /**< Step Counter minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_BODY_COMPOSITION_ANALYZER = 0x24, /**< Body composition analyzer minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_PEAK_FLOW_MONITOR = 0x28, /**< Peak flow monitor minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_MEDICATION_MONITOR = 0x2C, /**< Medication monitor minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_KNEE_PROSTHESIS = 0x30, /**< Knee prosthesis minor class */
+ BT_HAL_DEVICE_MINOR_CLASS_ANKLE_PROSTHESIS = 0x34, /**< Ankle prosthesis minor class */
+ } bt_hal_device_minor_class_t;
+
+ typedef enum {
+ BT_HAL_GATT_PERMISSION_READ = 0x01,
+ BT_HAL_GATT_PERMISSION_WRITE = 0x02,
+ BT_HAL_GATT_PERMISSION_ENCRYPT_READ = 0x04,
+ BT_HAL_GATT_PERMISSION_ENCRYPT_WRITE = 0x08,
+ BT_HAL_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_READ = 0x10,
+ BT_HAL_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_WRITE = 0x20,
+ } bt_hal_gatt_permission_t;
+
+ typedef enum {
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_BROADCAST = 0x01,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_READ = 0x02,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE = 0x04,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_WRITE = 0x08,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_NOTIFY = 0x10,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_INDICATE = 0x20,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_SIGNED_WRITE = 0x40,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_RELIABLE_WRITE = 0x80,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_WRITABLE_AUXILIARIES = 0x100,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_READ = 0x200,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_WRITE = 0x400,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_AUTHENTICATED_READ = 0x800,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_AUTHENTICATED_WRITE = 0x1000,
+ BT_HAL_GATT_CHARACTERISTIC_PROPERTY_EXTENDED_PROPS = 0xffff,
+ } bt_hal_gatt_characteristic_property_t;
+
+ /**
+ * This is Bluetooth device address type, fixed to 6 bytes ##:##:##:##:##:##
+ */
+ typedef struct {
+ unsigned char addr[BT_HAL_ADDRESS_LENGTH_MAX];
+ } bt_hal_device_address_t;
+
+ /**
+ * structure to hold the device information
+ */
+ typedef struct {
+ bt_hal_device_major_class_t major_class; /**< major device class */
+ bt_hal_device_minor_class_t minor_class; /**< minor device class */
+ bt_hal_device_service_class_t service_class;
+ /**< service device class */
+ } bt_hal_device_class_t;
+
+ /**
+ * Connected state types
+ */
+ typedef enum {
+ BT_HAL_CONNECTED_LINK_NONE = 0x00,
+ BT_HAL_CONNECTED_LINK_BREDR = 0x01,
+ BT_HAL_CONNECTED_LINK_LE = 0x02,
+ BT_HAL_CONNECTED_LINK_BREDR_LE = 0x03,
+ } bt_hal_connected_link_t;
+
+ typedef struct {
+ char *obj_path;
+ char *uuid;
+ gboolean authentication;
+ gboolean authorization;
+ char *role;
+ char *service;
+ } bt_hal_register_profile_info_t;
+
+ typedef int (*bt_hal_new_connection_cb) (const char *path, int fd, bt_bdaddr_t *address);
+
+ GDBusProxy *_bt_hal_get_adapter_proxy(void);
+ GDBusProxy *_bt_hal_get_adapter_properties_proxy(void);
+ GDBusConnection *_bt_hal_get_system_gconn(void);
+ GDBusProxy *_bt_hal_get_manager_proxy(void);
+ GDBusProxy *_bt_hal_get_profile_proxy(void);
+ GDBusProxy *_bt_hal_get_avrcp_ctrl_proxy(bt_bdaddr_t *bd_addr);
+ GDBusProxy *_bt_hal_get_avrcp_ctrl_properties_proxy(bt_bdaddr_t *bd_addr);
+ char *_bt_hal_get_adapter_path(void);
+ gboolean _bt_hal_is_adapter_powered(gboolean *powered);
+
+ char *_bt_hal_get_device_object_path(char *address);
+ void _bt_hal_convert_device_path_to_address(const char *device_path, char *device_address);
+
+ void _bt_hal_convert_addr_string_to_type(unsigned char *addr, const char *address);
+ void _bt_hal_convert_addr_type_to_string(char *address, const unsigned char *addr);
+ void _bt_hal_convert_uuid_string_to_type(unsigned char *uuid, const char *device_uuid);
+ void _bt_hal_convert_uuid_type_to_string(char *str, const unsigned char *uuid);
+
+ int _bt_hal_connect_profile(char *address, char *uuid, void *cb, gpointer func_data);
+ int _bt_hal_disconnect_profile(char *address, char *uuid, void *cb, gpointer func_data);
+ int _bt_hal_register_profile(bt_hal_register_profile_info_t *info, gboolean use_default_rfcomm);
+ void _bt_hal_unregister_profile(char *path);
+
+
+ int _bt_hal_discover_services(char *address, char *uuid, void *cb, gpointer func_data);
+ int _bt_hal_cancel_discovers(char *address);
+ int _bt_hal_discover_service_uuids(char *address, char *remote_uuid);
+
+ int _bt_hal_register_new_gdbus_object(const char *path, bt_hal_new_connection_cb cb);
+ void _bt_hal_unregister_gdbus_object(int object_id);
+
+ char *_bt_hal_get_control_device_path(bt_bdaddr_t *bd_addr);
+ void _bt_hal_set_control_device_path(const char *path);
+ void _bt_hal_remove_control_device_path(const char *path);
+
+
+ int bt_hal_gatt_convert_prop2string(
+ bt_hal_gatt_characteristic_property_t properties,
+ char *char_properties[]);
+
+ int bt_hal_gatt_convert_perm2string(
+ bt_hal_gatt_permission_t properties,
+ char *char_properties[]);
+
+ gboolean _bt_hal_uuid_is_standard(bt_uuid_t *p_uuid);
+
+ gboolean _bt_hal_is_service_enabled(const char *uuid);
#ifdef __cplusplus
}
static void __bt_hal_bond_device_cb(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data);
static void __bt_hal_unbond_device_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data);
+ gpointer user_data);
static void __bt_hal_device_service_search_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data);
+ gpointer user_data);
int __bt_hal_dbus_enquire_remote_device_services(char *address);
static void __bt_device_parse_services(GVariant *result);
DBG("+");
result = _bt_hal_agent_reply_cancellation();
- if (result != BT_HAL_ERROR_NONE){
+ if (result != BT_HAL_ERROR_NONE) {
ERR("Fail to call reply cancellation");
return BT_STATUS_FAIL;
}
}
int _bt_hal_device_legacy_pin_reply(const bt_bdaddr_t *bd_addr,
- gboolean accept, uint8_t pin_len, char *pincode)
+ gboolean accept, uint8_t pin_len, char *pincode)
{
GapAgentPrivate *agent = _bt_hal_get_adapter_agent();
DBG("+");
DBG("pin_len [0x%x]", pin_len);
DBG("pincode [%s]", pincode);
- if (accept) {
+ if (accept)
gap_agent_reply_pin_code(agent, GAP_AGENT_ACCEPT, pincode, NULL);
- } else
+ else
gap_agent_reply_pin_code(agent, GAP_AGENT_REJECT, NULL, NULL);
DBG("-");
}
int _bt_hal_device_ssp_reply(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
- uint8_t accept, uint32_t passkey)
+ uint8_t accept, uint32_t passkey)
{
GapAgentPrivate *agent = _bt_hal_get_adapter_agent();
DBG("+");
return BT_STATUS_FAIL;
switch (variant) {
- case BT_SSP_VARIANT_PASSKEY_CONFIRMATION:
- DBG("SSP: PASSKEY_CONFIRMATION");
- if (accept)
- gap_agent_reply_confirmation(agent, GAP_AGENT_ACCEPT, NULL);
- else
- gap_agent_reply_confirmation(agent, GAP_AGENT_REJECT, NULL);
- break;
- case BT_SSP_VARIANT_PASSKEY_NOTIFICATION:
- DBG("SSP: PASSKEY_NOTIFICATION");
- break;
- case BT_SSP_VARIANT_PASSKEY_ENTRY:
- DBG("SSP: PASSKEY_ENTRY");
- if (accept) {
- char str_passkey[7];
- snprintf(str_passkey, sizeof(str_passkey), "%.6d", passkey);
- DBG("Passkey [%s]", str_passkey);
- gap_agent_reply_passkey(agent, GAP_AGENT_ACCEPT, str_passkey, NULL);
- } else
- gap_agent_reply_passkey(agent, GAP_AGENT_REJECT, NULL, NULL);
- break;
- case BT_SSP_VARIANT_CONSENT:
- DBG("SSP: VARIANT_CONSENT: Unhandled!");
- break;
- default:
- break;
+ case BT_SSP_VARIANT_PASSKEY_CONFIRMATION:
+ DBG("SSP: PASSKEY_CONFIRMATION");
+ if (accept)
+ gap_agent_reply_confirmation(agent, GAP_AGENT_ACCEPT, NULL);
+ else
+ gap_agent_reply_confirmation(agent, GAP_AGENT_REJECT, NULL);
+ break;
+ case BT_SSP_VARIANT_PASSKEY_NOTIFICATION:
+ DBG("SSP: PASSKEY_NOTIFICATION");
+ break;
+ case BT_SSP_VARIANT_PASSKEY_ENTRY:
+ DBG("SSP: PASSKEY_ENTRY");
+ if (accept) {
+ char str_passkey[7];
+ snprintf(str_passkey, sizeof(str_passkey), "%.6d", passkey);
+ DBG("Passkey [%s]", str_passkey);
+ gap_agent_reply_passkey(agent, GAP_AGENT_ACCEPT, str_passkey, NULL);
+ } else
+ gap_agent_reply_passkey(agent, GAP_AGENT_REJECT, NULL, NULL);
+ break;
+ case BT_SSP_VARIANT_CONSENT:
+ DBG("SSP: VARIANT_CONSENT: Unhandled!");
+ break;
+ default:
+ break;
}
DBG("-");
}
int _bt_hal_device_authorize_response(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
- uint8_t authorize, uint8_t save_settings)
+ uint8_t authorize, uint8_t save_settings)
{
int reply = GAP_AGENT_ACCEPT;
GapAgentPrivate *agent = _bt_hal_get_adapter_agent();
}
static void __bt_hal_device_service_search_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
/* Buffer and propety count management */
uint8_t buf[BT_HAL_MAX_PROPERTY_BUF_SIZE];
/* Check event pointer */
if (!event_cb)
- event_cb = _bt_hal_get_stack_message_handler();
- if (!event_cb) {
- ERR("event_cb is NULL, can not send Service search results to HAL User");
- goto cleanup;
- }
+ event_cb = _bt_hal_get_stack_message_handler();
+ if (!event_cb) {
+ ERR("event_cb is NULL, can not send Service search results to HAL User");
+ goto cleanup;
+ }
if (err != NULL) {
g_dbus_error_strip_remote_error(err);
ERR("Error occured in Proxy call [%s]\n", err->message);
- if (g_strrstr("Operation canceled", err->message)) {
+ if (g_strrstr("Operation canceled", err->message))
result = BT_HAL_ERROR_CANCEL_BY_USER;
- } else if (g_strrstr("In Progress", err->message)) {
+ else if (g_strrstr("In Progress", err->message))
result = BT_HAL_ERROR_IN_PROGRESS;
- } else if (g_strrstr("Host is down", err->message)) {
+ else if (g_strrstr("Host is down", err->message))
result = BT_HAL_ERROR_HOST_DOWN;
- } else {
+ else
result = BT_HAL_ERROR_CONNECTION_ERROR;
- }
+
if (result == BT_HAL_ERROR_HOST_DOWN ||
result == BT_HAL_ERROR_CONNECTION_ERROR) {
ev->num_props = 0;
size = sizeof(*ev);
ERR("Error: Failed to get Remote device properties after SDP,"
- " Num Prop [%d] total size [%d]",ev->num_props, size);
+ " Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_REMOTE_DEVICE_PROPS, (void*) buf, size);
cleanup:
char **uuid_value;
int uuid_count = 0;
gsize size1 = 0;
- int i =0;
+ int i = 0;
size1 = g_variant_get_size(value);
int num_props_tmp = ev->num_props;
if (size1 > 0) {
}
DBG("Send Remote Device services to HAL,"
- " Num Prop [%d] total size [%d]",ev->num_props, size);
+ " Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_REMOTE_DEVICE_PROPS, (void*) buf, size);
g_variant_unref(result);
}
static void __bt_hal_bond_device_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
GError *err = NULL;
const char *device_path;
}
static void __bt_hal_unbond_device_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
GError *err = NULL;
char *device_path = NULL;
const gchar *name = NULL;
unsigned int cod = 0;
gint rssi = 0;
- uint8_t trust=0;
- uint8_t paired=0;
+ uint8_t trust = 0;
+ uint8_t paired = 0;
int connected = 0;
GByteArray *manufacturer_data = NULL;
const gchar *key;
g_variant_get(result, "(a{sv})", &property_iter);
while (g_variant_iter_loop(property_iter, "{sv}", &key, &value)) {
- if(!g_strcmp0(key, "Address")) {
+ if (!g_strcmp0(key, "Address")) {
address = g_variant_get_string(value, NULL);
DBG("Address [%s]", address);
_bt_hal_convert_addr_string_to_type(ev->bdaddr, address);
size += __bt_insert_hal_properties(buf + size, HAL_PROP_DEVICE_CONNECTED,
sizeof(unsigned int), &connected);
ev->num_props++;
- } else if (!g_strcmp0(key,"Paired")) {
+ } else if (!g_strcmp0(key, "Paired")) {
paired = (g_variant_get_boolean(value) ? 1 : 0);
DBG("Paired [%d]", paired);
size += __bt_insert_hal_properties(buf + size,
char **uuid_value;
int uuid_count = 0;
gsize size1 = 0;
- int i =0;
+ int i = 0;
size1 = g_variant_get_size(value);
int num_props_tmp = ev->num_props;
if (size1 > 0) {
} else if (!g_strcmp0(key, "ManufacturerData")) {
manufacturer_data = g_byte_array_new();
g_variant_get(value, "ay", &char_value_iter);
- while(g_variant_iter_loop(char_value_iter, "y", &char_value)) {
+ while (g_variant_iter_loop(char_value_iter, "y", &char_value))
g_byte_array_append(manufacturer_data, &char_value, 1);
- }
if (manufacturer_data) {
if (manufacturer_data->len > 0) {
ev->num_props = 0;
size = sizeof(*ev);
DBG("Send Remote Device properties event to HAL,"
- " Num Prop [%d] total size [%d]",ev->num_props, size);
+ " Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_REMOTE_DEVICE_PROPS, (void*) buf, size);
} else {
if (size > 2) {
DBG("Send Remote Device properties event to HAL,"
- " Num Prop [%d] total size [%d]",ev->num_props, size);
+ " Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_REMOTE_DEVICE_PROPS, (void*) buf, size);
}
}
GDBusConnection *conn;
GVariant *result;
- if(!remote_addr) {
+ if (!remote_addr) {
ERR("Invalid device address ptr received");
return BT_STATUS_PARM_INVALID;
}
int _bt_hal_dbus_get_remote_device_services(const bt_bdaddr_t *remote_addr);
int _bt_hal_device_authorize_response(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
- uint8_t authorize, uint8_t save_settings);
+ uint8_t authorize, uint8_t save_settings);
int _bt_hal_device_set_trust(const bt_bdaddr_t *bd_addr, uint8_t trust);
static guint event_id;
/*State Management sepration Control for Adapter and LE */
-static gboolean is_adapter_activating=FALSE;
-static gboolean is_le_activating=FALSE;
+static gboolean is_adapter_activating = FALSE;
+static gboolean is_le_activating = FALSE;
typedef struct {
- gchar* sender_name;
- gchar* object_path;
- gchar* interface_name;
- gchar* signal_name;
- GVariant *parameters;
+ gchar* sender_name;
+ gchar* object_path;
+ gchar* interface_name;
+ gchar* signal_name;
+ GVariant *parameters;
} bt_hal_main_event_data_t;
/* Forward declarations */
static void __bt_hal_device_property_changed_event(GVariant *msg, const char *path);
static void __bt_hal_dbus_device_found_properties(const char *device_path);
static void __bt_hal_device_properties_lookup(GVariant *result, char *address);
-static void __bt_hal_handle_device_specific_events(GVariant *msg, const char *member,const char *path);
+static void __bt_hal_handle_device_specific_events(GVariant *msg, const char *member, const char *path);
static void __bt_hal_send_device_acl_connection_state_event(gboolean connected, const char *address);
static void __bt_hal_handle_input_event(GVariant *msg, const char *path);
static void __bt_hal_send_av_connection_state_event(gboolean connected, const char *address);
static void __bt_hal_send_device_trust_state_event(gboolean is_trusted, const char *address);
static int __bt_hal_register_audio_subscribe_signal(GDBusConnection *conn, int subscribe);
-static void __bt_hal_handle_headset_events(GVariant *msg, const char *member,const char *path);
+static void __bt_hal_handle_headset_events(GVariant *msg, const char *member, const char *path);
static void __bt_hal_send_hf_audio_connection_state_event(gboolean connected, const char *address);
static void __bt_hal_send_hf_connection_state_event(gboolean connected, const char *address);
static void __bt_hal_send_device_trusted_profile_changed_event(uint32_t trust_val, const char *address);
{
GVariantIter iter;
GVariant *child;
- char *interface_name= NULL;
+ char *interface_name = NULL;
GVariant *inner_iter = NULL;
g_variant_iter_init(&iter, msg);
while ((child = g_variant_iter_next_value(&iter))) {
- g_variant_get(child,"{&s@a{sv}}", &interface_name, &inner_iter);
+ g_variant_get(child, "{&s@a{sv}}", &interface_name, &inner_iter);
if (g_strcmp0(interface_name,
BT_HAL_DEVICE_INTERFACE) == 0) {
DBG("__bt_hal_parse_event: Interface: BT_HAL_DEVICE_INTERFACE");
GDBusProxy *adapter_proxy;
GError *err = NULL;
char *key = NULL;
- g_variant_iter_init (&value_iter, msg);
+ g_variant_iter_init(&value_iter, msg);
/* Buffer and propety count management */
uint8_t buf[BT_HAL_MAX_PROPERTY_BUF_SIZE];
unsigned int pairable_timeout;
gboolean scan_mode_property_update = FALSE;
gboolean is_discovering;
- gboolean is_le_discovering;
+ gboolean is_le_discovering;
memset(buf, 0, sizeof(buf));
size = sizeof(*ev);
DBG("+");
while (g_variant_iter_loop(&value_iter, "{sv}", &key, &value)) {
- if(!g_strcmp0(key, "Address")) {
+ if (!g_strcmp0(key, "Address")) {
uint8_t bdaddr[6];
address = g_variant_get_string(value, NULL);
_bt_hal_destroy_adapter_agent();
} else {
DBG("###### Adapter Powered Up ######");
- if(_bt_hal_get_adapter_request_state()) {
+ if (_bt_hal_get_adapter_request_state()) {
DBG("Sending STATE CHANGE EVENT for Adapter... ");
_bt_hal_set_adapter_request_state(FALSE);
struct hal_ev_adapter_state_changed ev;
event_cb(HAL_EV_ADAPTER_STATE_CHANGED, &ev, sizeof(ev));
}
#ifdef TIZEN_BT_HAL
- if(_bt_hal_get_le_request_state()) {
+ if (_bt_hal_get_le_request_state()) {
DBG("Sending STATE CHANGE EVENT for LE... ");
_bt_hal_set_le_request_state(FALSE);
struct hal_ev_le_state_changed ev;
char **uuid_value;
int uuid_count = 0;
gsize size1 = 0;
- int i =0;
+ int i = 0;
size1 = g_variant_get_size(value);
int num_props_tmp = ev->num_props;
if (size1 > 0) {
continue;
while (g_variant_iter_next(iter, "&s", &name) &&
- g_variant_iter_next(iter, "&s", &val)) {
+ g_variant_iter_next(iter, "&s", &val)) {
DBG("name = %s, Value = %s", name, val);
g_variant_iter_loop(iter, "s", &val);
if (FALSE == _bt_hal_update_le_feature_support(name, val))
g_variant_iter_free(iter);
} else if (!g_strcmp0(key, "IpspInitStateChanged")) {
- g_variant_get(value, "b" ,&ipsp_initialized);
+ g_variant_get(value, "b" , &ipsp_initialized);
DBG("##IPSP Initialized = %d", ipsp_initialized);
} else {
ERR("Unhandled Property:[%s]", key);
if (size > 2) {
- DBG("Send Adapter properties changed event to HAL user, Num Prop [%d] total size [%d]",ev->num_props, size);
+ DBG("Send Adapter properties changed event to HAL user, Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_ADAPTER_PROPS_CHANGED, buf, size);
}
g_variant_unref(value);
sizeof(bdaddr), bdaddr);
ev->num_props++;
- DBG("Device address [%s] property Num [%d]",address, ev->num_props);
+ DBG("Device address [%s] property Num [%d]", address, ev->num_props);
} else if (strcasecmp(key, "Class") == 0) {
unsigned int class = g_variant_get_uint32(val);
DBG("Device class [%d] Property num [%d]", class, ev->num_props);
} else if (strcasecmp(key, "name") == 0) {
char *name = g_variant_dup_string(val, &len);
- if(name) {
+ if (name) {
size += __bt_insert_hal_properties(buf + size, HAL_PROP_DEVICE_NAME,
strlen(name) + 1, name);
ev->num_props++;
char **uuid_value;
int uuid_count = 0;
gsize size1 = 0;
- int i =0;
+ int i = 0;
size1 = g_variant_get_size(val);
DBG("UUID count from size [%d]\n", size1);
int num_props_tmp = ev->num_props;
DBG("-");
if (size > 1) {
- DBG("Send Device found event to HAL user, Num Prop [%d] total size [%d]",ev->num_props, size);
+ DBG("Send Device found event to HAL user, Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_DEVICE_FOUND, (void*) buf, size);
}
DBG("connected: %d", connected);
DBG("address: %s", address);
- /* Prepare to send AVRCP Target connection state event */
- memset(&ev, 0, sizeof(ev));
+ /* Prepare to send AVRCP Target connection state event */
+ memset(&ev, 0, sizeof(ev));
_bt_hal_convert_addr_string_to_type(ev.bdaddr, address);
ev.state = state;
if (!avrcp_tg_event_cb)
char *interface_name = NULL;
GVariant *val = NULL;
- g_variant_get(msg, "(&s@a{sv}@as)", &interface_name, &val,NULL);
+ g_variant_get(msg, "(&s@a{sv}@as)", &interface_name, &val, NULL);
if (strcasecmp(interface_name, BT_HAL_ADAPTER_INTERFACE) == 0) {
DBG("Event: Property Changed: Interface: BT_HAL_ADAPTER_INTERFACE");
GVariant *child = NULL, *val = NULL;
DBG("+");
- g_variant_iter_init (&value_iter, msg);
- while ((child = g_variant_iter_next_value (&value_iter))) {
+ g_variant_iter_init(&value_iter, msg);
+ while ((child = g_variant_iter_next_value(&value_iter))) {
g_variant_get(child, "{sv}", &property, &val);
if (property == NULL)
GVariant *optional_param;
GVariantIter iter;
GVariant *child;
- char *interface_name= NULL;
+ char *interface_name = NULL;
GVariant *inner_iter = NULL;
g_variant_get(msg, "(&o@a{sa{sv}})",
&path, &optional_param);
g_variant_iter_init(&iter, optional_param);
while ((child = g_variant_iter_next_value(&iter))) {
- g_variant_get(child,"{&s@a{sv}}", &interface_name, &inner_iter);
+ g_variant_get(child, "{&s@a{sv}}", &interface_name, &inner_iter);
if (g_strcmp0(interface_name, BT_HAL_DEVICE_INTERFACE) == 0) {
DBG("Found a device: %s", path);
if (__bt_hal_parse_device_properties(inner_iter) == FALSE) {
DBG("Manager Event: Interface Name:BT_HAL_DEVICE_INTERFACE");
__bt_hal_handle_device_specific_events(param->parameters, param->signal_name, param->object_path);
} else if (g_strcmp0(param->interface_name, BT_HAL_PLAYER_CONTROL_INTERFACE) == 0) {
- DBG("Manager Event: Interface Name: BT_HAL_PLAYER_CONTROL_INTERFACE");
- __bt_hal_handle_avrcp_ctrl_events(param->parameters, param->signal_name, param->object_path);
- }
+ DBG("Manager Event: Interface Name: BT_HAL_PLAYER_CONTROL_INTERFACE");
+ __bt_hal_handle_avrcp_ctrl_events(param->parameters, param->signal_name, param->object_path);
+ }
/* Free data */
g_free(param->sender_name);
}
static void __bt_hal_manager_event_filter(GDBusConnection *connection,
- const gchar *sender_name,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *signal_name,
- GVariant *parameters,
- gpointer user_data)
+ const gchar *sender_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
{
if (signal_name == NULL)
return;
return;
}
-static void __bt_hal_handle_headset_events(GVariant *msg, const char *member,const char *path)
+static void __bt_hal_handle_headset_events(GVariant *msg, const char *member, const char *path)
{
gboolean property_flag = FALSE;
char *property = NULL;
}
static int __bt_hal_register_device_subscribe_signal(GDBusConnection *conn,
- int subscribe)
+ int subscribe)
{
static int subs_device_id = -1;
}
static int __bt_hal_register_audio_subscribe_signal(GDBusConnection *conn,
- int subscribe)
+ int subscribe)
{
if (conn == NULL)
return -1;
GVariantIter value_iter;
GVariant *value = NULL;
char *key = NULL;
- g_variant_iter_init (&value_iter, msg);
+ g_variant_iter_init(&value_iter, msg);
DBG("+");
while (g_variant_iter_loop(&value_iter, "{sv}", &key, &value)) {
- if(!g_strcmp0(key, "Connected")) {
+ if (!g_strcmp0(key, "Connected")) {
guint connected = 0;
g_variant_get(value, "i", &connected);
DBG("Device property changed : Connected [%d]", connected);
static void __bt_hal_dbus_device_found_properties(const char *device_path)
{
- char *address;
- GError *error = NULL;
- GDBusProxy *device_proxy;
- GDBusConnection *conn;
- GVariant *result;
- DBG("+");
-
- if(!device_path) {
- ERR("Invalid device path");
- return;
- }
-
- conn = _bt_hal_get_system_gconn();
- if (!conn) {
- ERR("_bt_hal_get_system_gconn failed");
- return;
- }
-
- device_proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- BT_HAL_BLUEZ_NAME,
- device_path,
- BT_HAL_PROPERTIES_INTERFACE,
- NULL, NULL);
-
- if (!device_proxy) {
- ERR("Error creating device_proxy");
- return;
- }
-
- result = g_dbus_proxy_call_sync(device_proxy,
- "GetAll",
- g_variant_new("(s)", BT_HAL_DEVICE_INTERFACE),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &error);
- if (!result) {
- ERR("Error occured in Proxy call");
- if (error != NULL) {
- ERR("Error occured in Proxy call (Error: %s)", error->message);
- g_clear_error(&error);
- }
- g_object_unref(device_proxy);
- return;
- }
-
- address = g_malloc0(BT_HAL_ADDRESS_STRING_SIZE);
- _bt_hal_convert_device_path_to_address(device_path, address);
-
- __bt_hal_device_properties_lookup(result, address);
-
- g_object_unref(device_proxy);
- g_free(address);
-
- DBG("-");
+ char *address;
+ GError *error = NULL;
+ GDBusProxy *device_proxy;
+ GDBusConnection *conn;
+ GVariant *result;
+ DBG("+");
+
+ if (!device_path) {
+ ERR("Invalid device path");
+ return;
+ }
+
+ conn = _bt_hal_get_system_gconn();
+ if (!conn) {
+ ERR("_bt_hal_get_system_gconn failed");
+ return;
+ }
+
+ device_proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ BT_HAL_BLUEZ_NAME,
+ device_path,
+ BT_HAL_PROPERTIES_INTERFACE,
+ NULL, NULL);
+
+ if (!device_proxy) {
+ ERR("Error creating device_proxy");
+ return;
+ }
+
+ result = g_dbus_proxy_call_sync(device_proxy,
+ "GetAll",
+ g_variant_new("(s)", BT_HAL_DEVICE_INTERFACE),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+ if (!result) {
+ ERR("Error occured in Proxy call");
+ if (error != NULL) {
+ ERR("Error occured in Proxy call (Error: %s)", error->message);
+ g_clear_error(&error);
+ }
+ g_object_unref(device_proxy);
+ return;
+ }
+
+ address = g_malloc0(BT_HAL_ADDRESS_STRING_SIZE);
+ _bt_hal_convert_device_path_to_address(device_path, address);
+
+ __bt_hal_device_properties_lookup(result, address);
+
+ g_object_unref(device_proxy);
+ g_free(address);
+
+ DBG("-");
}
static void __bt_hal_device_properties_lookup(GVariant *result, char *address)
g_variant_unref(result);
/* Alias */
- tmp_value = g_variant_lookup_value (value, "Alias", G_VARIANT_TYPE_STRING);
+ tmp_value = g_variant_lookup_value(value, "Alias", G_VARIANT_TYPE_STRING);
g_variant_get(tmp_value, "s", &name);
_bt_hal_convert_uuid_string_to_type(uuid, uuid_str);
#ifdef __TEST_
- for(z=0; z < 16; z++)
+ for (z = 0; z < 16; z++)
DBG("[0x%x]", uuid[z]);
#endif
size += __bt_insert_hal_properties(buf + size, HAL_PROP_DEVICE_ADDR,
sizeof(bdaddr), bdaddr);
ev->num_props++;
- DBG("Device address [%s] property Num [%d]",address, ev->num_props);
+ DBG("Device address [%s] property Num [%d]", address, ev->num_props);
g_free(name);
g_variant_unref(value);
ERR("result is NULL\n");
}
if (size > 1) {
- DBG("Send Device found event to HAL user, Num Prop [%d] total size [%d]",ev->num_props, size);
+ DBG("Send Device found event to HAL user, Num Prop [%d] total size [%d]", ev->num_props, size);
event_cb(HAL_EV_DEVICE_FOUND, (void*) buf, size);
}
DBG("-");
if (strcasecmp(property, "GattConnected") == 0) {
INFO("GATT Connected");
gboolean connected = FALSE;
- char *address;
- address = g_malloc0(BT_HAL_ADDRESS_STRING_SIZE);
+ char *address;
+ address = g_malloc0(BT_HAL_ADDRESS_STRING_SIZE);
- _bt_hal_convert_device_path_to_address(path, address);
- g_variant_get(msg, "(b)", &connected);
+ _bt_hal_convert_device_path_to_address(path, address);
+ g_variant_get(msg, "(b)", &connected);
INFO("Connected device address[%s] connnected[%d]", address, connected);
g_free(address);
} else if (state == BT_HAL_PROFILE_STATE_CONNECTING) {
DBG("AVRCP Controller Profile state changed: BT_HAL_PROFILE_STATE_CONNECTING");
}
- }
- else {
- DBG("Profile[%s] State changed status [%d] ", profile_uuid,state);
+ } else {
+ DBG("Profile[%s] State changed status [%d] ", profile_uuid, state);
}
g_free(address);
g_free(profile_uuid);
const char *key = NULL;
int i = 0;
- if(ev == NULL)
+ if (ev == NULL)
return;
g_variant_iter_init(&iter, item);
}
static void __bt_hal_handle_avrcp_ctrl_events(GVariant *msg, const char *member,
- const char *path)
+ const char *path)
{
const char *property = NULL;
GVariant *value = NULL;
void _bt_hal_set_adapter_request_state(bool enable)
{
- DBG("set_adapter_request_state %d",enable);
+ DBG("set_adapter_request_state %d", enable);
is_adapter_activating = enable;
}
void _bt_hal_set_le_request_state(bool enable)
{
- DBG("set_le_request_state %d",enable);
+ DBG("set_le_request_state %d", enable);
is_le_activating = enable;
}
static GQuark gap_agent_error_quark(void)
{
- static GQuark quark = 0;
- if (!quark)
- quark = g_quark_from_static_string("agent");
+ static GQuark quark = 0;
+ if (!quark)
+ quark = g_quark_from_static_string("agent");
- return quark;
+ return quark;
}
GError *error = NULL;
GVariant *reply;
- if (priv == NULL || priv->path == NULL|| connection == NULL )
+ if (priv == NULL || priv->path == NULL || connection == NULL)
return FALSE;
if (priv->agent_manager == NULL) {
addr += 4;
g_strlcpy(agent->pairing_addr, addr, sizeof(agent->pairing_addr));
- while ((pos = strchr(agent->pairing_addr, '_')) != NULL) {
+ while ((pos = strchr(agent->pairing_addr, '_')) != NULL)
*pos = ':';
- }
}
agent->cb.pincode_func(agent, device);
g_object_unref(device);
addr += 4;
g_strlcpy(priv->pairing_addr, addr, sizeof(priv->pairing_addr));
- while ((pos = strchr(priv->pairing_addr, '_')) != NULL) {
+ while ((pos = strchr(priv->pairing_addr, '_')) != NULL)
*pos = ':';
- }
}
priv->cb.passkey_func(priv, device);
g_object_unref(device);
addr += 4;
g_strlcpy(priv->pairing_addr, addr, sizeof(priv->pairing_addr));
- while ((pos = strchr(priv->pairing_addr, '_')) != NULL) {
+ while ((pos = strchr(priv->pairing_addr, '_')) != NULL)
*pos = ':';
- }
}
DBG("Pairing address [%s]", priv->pairing_addr);
g_strlcpy(priv->authorize_addr, addr,
sizeof(priv->authorize_addr));
- while ((pos = strchr(priv->authorize_addr, '_')) != NULL) {
+ while ((pos = strchr(priv->authorize_addr, '_')) != NULL)
*pos = ':';
- }
}
priv->cb.authorize_func(priv, device, uuid);
gap_agent_reply_confirmation(priv, accept, invocation);
} else if (g_strcmp0(method_name, "ReplyAuthorize") == 0) {
GapAgentPrivate *priv = user_data;
- const guint accept;
+ const guint accept;
- g_variant_get(parameters, "(u)", &accept);
- DBG("Accept: %d", accept);
- gap_agent_reply_authorize(priv, accept, invocation);
+ g_variant_get(parameters, "(u)", &accept);
+ DBG("Accept: %d", accept);
+ gap_agent_reply_authorize(priv, accept, invocation);
}
DBG("-");
}
gboolean gap_agent_reply_confirmation(GapAgentPrivate *agent, const guint accept,
- GDBusMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
DBG("+");
priv->canceled = FALSE;
} else {
switch (accept) {
- case GAP_AGENT_CANCEL:
- g_dbus_method_invocation_return_error(priv->reply_context,
- GAP_AGENT_ERROR, GAP_AGENT_ERROR_CANCEL,
- "CanceledbyUser");
- priv->canceled = TRUE;
- break;
- case GAP_AGENT_TIMEOUT:
- case GAP_AGENT_REJECT:
- default:
- g_dbus_method_invocation_return_error(priv->reply_context,
- GAP_AGENT_ERROR, GAP_AGENT_ERROR_REJECT,
- "Confirmation request rejected");
- priv->canceled = FALSE;
- break;
+ case GAP_AGENT_CANCEL:
+ g_dbus_method_invocation_return_error(priv->reply_context,
+ GAP_AGENT_ERROR, GAP_AGENT_ERROR_CANCEL,
+ "CanceledbyUser");
+ priv->canceled = TRUE;
+ break;
+ case GAP_AGENT_TIMEOUT:
+ case GAP_AGENT_REJECT:
+ default:
+ g_dbus_method_invocation_return_error(priv->reply_context,
+ GAP_AGENT_ERROR, GAP_AGENT_ERROR_REJECT,
+ "Confirmation request rejected");
+ priv->canceled = FALSE;
+ break;
}
}
}
}
gboolean gap_agent_reply_pin_code(GapAgentPrivate *agent, const guint accept,
- const char *pin_code,
- GDBusMethodInvocation *context)
+ const char *pin_code,
+ GDBusMethodInvocation *context)
{
DBG("+");
GapAgentPrivate *priv = agent;
priv->canceled = FALSE;
} else {
switch (accept) {
- case GAP_AGENT_CANCEL:
- g_dbus_method_invocation_return_error(priv->reply_context,
- GAP_AGENT_ERROR, GAP_AGENT_ERROR_CANCEL,
- "CanceledbyUser");
- priv->canceled = TRUE;
- break;
- case GAP_AGENT_TIMEOUT:
- case GAP_AGENT_REJECT:
- default:
- g_dbus_method_invocation_return_error(priv->reply_context,
- GAP_AGENT_ERROR, GAP_AGENT_ERROR_REJECT,
- "Pairing request rejected");
- priv->canceled = FALSE;
- break;
+ case GAP_AGENT_CANCEL:
+ g_dbus_method_invocation_return_error(priv->reply_context,
+ GAP_AGENT_ERROR, GAP_AGENT_ERROR_CANCEL,
+ "CanceledbyUser");
+ priv->canceled = TRUE;
+ break;
+ case GAP_AGENT_TIMEOUT:
+ case GAP_AGENT_REJECT:
+ default:
+ g_dbus_method_invocation_return_error(priv->reply_context,
+ GAP_AGENT_ERROR, GAP_AGENT_ERROR_REJECT,
+ "Pairing request rejected");
+ priv->canceled = FALSE;
+ break;
}
}
}
}
gboolean gap_agent_reply_passkey(GapAgentPrivate *agent, const guint accept,
- const char *passkey,
- GDBusMethodInvocation *context)
+ const char *passkey,
+ GDBusMethodInvocation *context)
{
DBG("+");
GapAgentPrivate *priv = agent;
priv->canceled = FALSE;
} else {
switch (accept) {
- case GAP_AGENT_CANCEL:
- g_dbus_method_invocation_return_error(priv->reply_context,
- GAP_AGENT_ERROR, GAP_AGENT_ERROR_CANCEL,
- "CanceledbyUser");
- priv->canceled = TRUE;
- break;
- case GAP_AGENT_TIMEOUT:
- case GAP_AGENT_REJECT:
- default:
- g_dbus_method_invocation_return_error(priv->reply_context,
- GAP_AGENT_ERROR, GAP_AGENT_ERROR_REJECT,
- "Passkey request rejected");
- priv->canceled = FALSE;
- break;
+ case GAP_AGENT_CANCEL:
+ g_dbus_method_invocation_return_error(priv->reply_context,
+ GAP_AGENT_ERROR, GAP_AGENT_ERROR_CANCEL,
+ "CanceledbyUser");
+ priv->canceled = TRUE;
+ break;
+ case GAP_AGENT_TIMEOUT:
+ case GAP_AGENT_REJECT:
+ default:
+ g_dbus_method_invocation_return_error(priv->reply_context,
+ GAP_AGENT_ERROR, GAP_AGENT_ERROR_REJECT,
+ "Passkey request rejected");
+ priv->canceled = FALSE;
+ break;
}
}
}
}
gboolean gap_agent_reply_authorize(GapAgentPrivate *agent, const guint accept,
- GDBusMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
gboolean ret = TRUE;
GapAgentPrivate *priv = agent;
g_dbus_method_invocation_return_value(priv->reply_context, NULL);
} else {
switch (accept) {
- case GAP_AGENT_CANCEL:
- g_dbus_method_invocation_return_error(priv->reply_context,
- GAP_AGENT_ERROR, GAP_AGENT_ERROR_CANCEL,
- "CanceledbyUser");
- break;
- case GAP_AGENT_TIMEOUT:
- case GAP_AGENT_REJECT:
- default:
- g_dbus_method_invocation_return_error(priv->reply_context,
- GAP_AGENT_ERROR, GAP_AGENT_ERROR_REJECT,
- "Authorization request rejected");
- break;
+ case GAP_AGENT_CANCEL:
+ g_dbus_method_invocation_return_error(priv->reply_context,
+ GAP_AGENT_ERROR, GAP_AGENT_ERROR_CANCEL,
+ "CanceledbyUser");
+ break;
+ case GAP_AGENT_TIMEOUT:
+ case GAP_AGENT_REJECT:
+ default:
+ g_dbus_method_invocation_return_error(priv->reply_context,
+ GAP_AGENT_ERROR, GAP_AGENT_ERROR_REJECT,
+ "Authorization request rejected");
+ break;
}
}
void _gap_agent_set_canceled(GapAgentPrivate *agent, gboolean value);
gboolean gap_agent_reply_pin_code(GapAgentPrivate *agent, const guint accept,
- const char *pin_code,
- GDBusMethodInvocation *context);
+ const char *pin_code,
+ GDBusMethodInvocation *context);
gboolean gap_agent_reply_passkey(GapAgentPrivate *agent, const guint accept,
- const char *passkey,
- GDBusMethodInvocation *context);
+ const char *passkey,
+ GDBusMethodInvocation *context);
gboolean gap_agent_reply_confirmation(GapAgentPrivate *agent, const guint accept,
- GDBusMethodInvocation *context);
+ GDBusMethodInvocation *context);
gboolean gap_agent_reply_authorize(GapAgentPrivate *agent, const guint accept,
- GDBusMethodInvocation *context);
+ GDBusMethodInvocation *context);
#ifdef TIZEN_BT_HAL
bt_hal_agent_osp_server_t *_bt_hal_gap_agent_find_osp_server_by_type(GSList *servers, unsigned int type);
#define NUMBER_OF_FLAGS 10
-#define GATT_SERV_INTERFACE "org.bluez.GattService1"
-#define GATT_CHAR_INTERFACE "org.bluez.GattCharacteristic1"
-#define GATT_DESC_INTERFACE "org.bluez.GattDescriptor1"
+#define GATT_SERV_INTERFACE "org.bluez.GattService1"
+#define GATT_CHAR_INTERFACE "org.bluez.GattCharacteristic1"
+#define GATT_DESC_INTERFACE "org.bluez.GattDescriptor1"
-#define BT_GATT_SERVICE_NAME "org.frwk.gatt_service"
-#define GATT_SERV_OBJECT_PATH "/service"
+#define BT_GATT_SERVICE_NAME "org.frwk.gatt_service"
+#define GATT_SERV_OBJECT_PATH "/service"
static GDBusProxy *manager_gproxy = NULL;
static int gatt_desc_handle = 30;
struct gatt_service_info {
- gchar *serv_path;
- guint serv_id;
- gchar *service_uuid;
- guint manager_id;
- guint prop_id;
- GSList *char_data;
- gboolean is_svc_registered;
- gboolean is_svc_primary;
+ gchar *serv_path;
+ guint serv_id;
+ gchar *service_uuid;
+ guint manager_id;
+ guint prop_id;
+ GSList *char_data;
+ gboolean is_svc_registered;
+ gboolean is_svc_primary;
int service_handle;
};
struct gatt_char_info {
- gchar *char_path;
- guint char_id;
- gchar *char_uuid;
- gchar *char_value;
- gchar *char_flags[NUMBER_OF_FLAGS];
- int value_length;
- int flags_length;
+ gchar *char_path;
+ guint char_id;
+ gchar *char_uuid;
+ gchar *char_value;
+ gchar *char_flags[NUMBER_OF_FLAGS];
+ int value_length;
+ int flags_length;
int char_handle;
- GSList *desc_data;
+ GSList *desc_data;
};
struct gatt_desc_info {
- gchar *desc_path;
- guint desc_id;
- gchar *desc_uuid;
- gchar *desc_value;
- gchar *desc_flags[NUMBER_OF_FLAGS];
- int value_length;
- int flags_length;
+ gchar *desc_path;
+ guint desc_id;
+ gchar *desc_uuid;
+ gchar *desc_value;
+ gchar *desc_flags[NUMBER_OF_FLAGS];
+ int value_length;
+ int flags_length;
int desc_handle;
};
* GATT Server Request type
*/
typedef enum {
- BT_HAL_GATT_REQUEST_TYPE_READ = 0x00, /* Read Requested */
- BT_HAL_GATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested */
- BT_HAL_GATT_REQUEST_TYPE_EXEC_WRITE = 0x02, /* Exec Write Requested */
+ BT_HAL_GATT_REQUEST_TYPE_READ = 0x00, /* Read Requested */
+ BT_HAL_GATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested */
+ BT_HAL_GATT_REQUEST_TYPE_EXEC_WRITE = 0x02, /* Exec Write Requested */
} bt_gatt_request_type_e;
struct gatt_req_info {
- gchar *attr_path;
- gchar *svc_path;
- guint request_id;
- guint offset;
- bt_gatt_request_type_e request_type; /* Read or Write request */
- GDBusMethodInvocation *context;
+ gchar *attr_path;
+ gchar *svc_path;
+ guint request_id;
+ guint offset;
+ bt_gatt_request_type_e request_type; /* Read or Write request */
+ GDBusMethodInvocation *context;
};
struct gatt_server_app {
/* GATT Client Info List Structure */
struct gatt_client_info_t {
- int connection_id; /* This value will uniquely identify a GATT client-server connection */
- int instance_id; /* This value unique identifies a GATT server instance */
- char *addr; /* Remote GATT client address */
+ int connection_id; /* This value will uniquely identify a GATT client-server connection */
+ int instance_id; /* This value unique identifies a GATT server instance */
+ char *addr; /* Remote GATT client address */
GSList *gatt_req_info_list; /* List of transactions per Connection*/
};
GAsyncResult *res, gpointer user_data);
static void __bt_hal_unregister_application_cb(GObject *object, GAsyncResult *res,
- gpointer user_data);
+ gpointer user_data);
static GDBusProxy *__bt_gatt_gdbus_get_gatt_manager_proxy(const gchar *service,
- const gchar *path, const gchar *interface);
+ const gchar *path, const gchar *interface);
/* Introspection data for the service we are exporting */
static const gchar service_introspection_xml[] =
for (l2 = serv_info->char_data; l2 != NULL; l2 = l2->next) {
struct gatt_char_info *char_info = l2->data;
- if (char_info->char_handle == char_hdl) {
+ if (char_info->char_handle == char_hdl)
return char_info->char_path;
- }
}
}
ERR("Not found");
for (l2 = serv_info->char_data; l2 != NULL; l2 = l2->next) {
struct gatt_char_info *char_info = l2->data;
- if (char_info->char_handle == char_hdl) {
+ if (char_info->char_handle == char_hdl)
return char_info;
- }
}
}
ERR("Not found");
}
static void __bt_gatt_manager_method_call(GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
{
GSList *l = NULL;
for (l = gatt_services; l != NULL; l = l->next) {
GVariantBuilder *svc_builder = NULL;
- GVariantBuilder *inner_builder = NULL;
+ GVariantBuilder *inner_builder = NULL;
struct gatt_service_info *serv_info = l->data;
INFO("GATT Service fetched handle [%d]", serv_info->service_handle);
}
static void __bt_gatt_desc_method_call(GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
{
if (g_strcmp0(method_name, "ReadValue") == 0) {
}
len = g_variant_get_size(var);
- if (len > 0) {
- char *data;
+ if (len > 0) {
+ char *data;
data = (char *)g_variant_get_data(var);
memcpy(ev.value, data, len);
ev.length = len;
}
static void __bt_gatt_char_method_call(GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
{
if (g_strcmp0(method_name, "ReadValue") == 0) {
gchar *addr = NULL;
}
if (!event_cb) {
- ERR("GATT callback NOT registered");
- g_dbus_method_invocation_return_value(invocation, NULL);
- return;
- }
+ ERR("GATT callback NOT registered");
+ g_dbus_method_invocation_return_value(invocation, NULL);
+ return;
+ }
g_variant_get(parameters, "(&suq)", &addr, &req_id, &offset);
DBG("Request id = %u, Offset = %u", req_id, offset);
int char_hdl = -1;
svc_info = __bt_gatt_find_gatt_service_from_char(object_path, &char_hdl);
- if (svc_info == NULL || event_cb == NULL) {
+ if (svc_info == NULL || event_cb == NULL)
return;
- }
/* Send HAL event */
- memset(&ev, 0, sizeof(ev));
- ev.conn_id = -1; /*TODO Bluez does not provide remote GATT client address, so no conn_id */
- ev.trans_id = -1; /*TODO Bluez does not provide request id or transacion ID */
- ev.att_handle = char_hdl;
+ memset(&ev, 0, sizeof(ev));
+ ev.conn_id = -1; /*TODO Bluez does not provide remote GATT client address, so no conn_id */
+ ev.trans_id = -1; /*TODO Bluez does not provide request id or transacion ID */
+ ev.att_handle = char_hdl;
ev.notify = true;
- /* Convert address to hex */
- _bt_hal_convert_addr_string_to_type(ev.bdaddr, "00:00:00:00:00"); /* TODO Bluez Does not provide address of GATT client */
+ /* Convert address to hex */
+ _bt_hal_convert_addr_string_to_type(ev.bdaddr, "00:00:00:00:00"); /* TODO Bluez Does not provide address of GATT client */
- event_cb(HAL_EV_GATT_NOTIFICATION_CHANGE, (void *)&ev, sizeof(ev));
+ event_cb(HAL_EV_GATT_NOTIFICATION_CHANGE, (void *)&ev, sizeof(ev));
#endif
} else if (g_strcmp0(method_name, "StopNotify") == 0) {
int char_hdl = -1;
svc_info = __bt_gatt_find_gatt_service_from_char(object_path, &char_hdl);
- if (svc_info == NULL || event_cb == NULL) {
+ if (svc_info == NULL || event_cb == NULL)
return;
- }
/* Send HAL event */
- memset(&ev, 0, sizeof(ev));
- ev.conn_id = -1; /*TODO Bluez does not provide remote GATT client address, so no conn_id */
- ev.trans_id = -1; /*TODO Bluez does not provide request id or transacion ID */
- ev.att_handle = char_hdl;
+ memset(&ev, 0, sizeof(ev));
+ ev.conn_id = -1; /*TODO Bluez does not provide remote GATT client address, so no conn_id */
+ ev.trans_id = -1; /*TODO Bluez does not provide request id or transacion ID */
+ ev.att_handle = char_hdl;
ev.notify = false;
- /* Convert address to hex */
- _bt_hal_convert_addr_string_to_type(ev.bdaddr, "00:00:00:00:00"); /* TODO Bluez DOes not provide address of GATT client */
+ /* Convert address to hex */
+ _bt_hal_convert_addr_string_to_type(ev.bdaddr, "00:00:00:00:00"); /* TODO Bluez DOes not provide address of GATT client */
- event_cb(HAL_EV_GATT_NOTIFICATION_CHANGE, (void *)&ev, sizeof(ev));
+ event_cb(HAL_EV_GATT_NOTIFICATION_CHANGE, (void *)&ev, sizeof(ev));
#endif
} else if (g_strcmp0(method_name, "IndicateConfirm") == 0) {
}
/* Send HAL event */
- memset(&ev, 0, sizeof(ev));
- ev.conn_id = conn_info->connection_id;
- ev.trans_id = -1; /*TODO Bluez does not provide Transaction ID or request ID */
- ev.att_handle = char_hdl;
+ memset(&ev, 0, sizeof(ev));
+ ev.conn_id = conn_info->connection_id;
+ ev.trans_id = -1; /*TODO Bluez does not provide Transaction ID or request ID */
+ ev.att_handle = char_hdl;
- /* Convert address to hex */
- _bt_hal_convert_addr_string_to_type(ev.bdaddr, addr);
+ /* Convert address to hex */
+ _bt_hal_convert_addr_string_to_type(ev.bdaddr, addr);
- event_cb(HAL_EV_GATT_INDICATE_CFM, (void *)&ev, sizeof(ev));
+ event_cb(HAL_EV_GATT_INDICATE_CFM, (void *)&ev, sizeof(ev));
}
g_dbus_method_invocation_return_value(invocation, NULL);
}
static const GDBusInterfaceVTable desc_interface_vtable = {
- __bt_gatt_desc_method_call,
- NULL,
- NULL,
+ __bt_gatt_desc_method_call,
+ NULL,
+ NULL,
};
static const GDBusInterfaceVTable char_interface_vtable = {
- __bt_gatt_char_method_call,
- NULL,
- NULL,
+ __bt_gatt_char_method_call,
+ NULL,
+ NULL,
};
static const GDBusInterfaceVTable serv_interface_vtable = {
- NULL,
- NULL,
- NULL,
+ NULL,
+ NULL,
+ NULL,
};
static const GDBusInterfaceVTable manager_interface_vtable = {
- __bt_gatt_manager_method_call,
- NULL,
- NULL
+ __bt_gatt_manager_method_call,
+ NULL,
+ NULL
};
static GDBusNodeInfo *__bt_gatt_create_method_node_info(
- const gchar *introspection_data)
+ const gchar *introspection_data)
{
GError *err = NULL;
GDBusNodeInfo *node_info = NULL;
info->app_path, info->slot);
/* Only if all services are deleted from the GATT Server, then only Unregister it.
- Reason: it is possible, GATT Server app oly wants to disable multi advertising
- In above case, only advertising block will be deallocated, Gatt Server will remain
- unaffected */
+ Reason: it is possible, GATT Server app oly wants to disable multi advertising
+ In above case, only advertising block will be deallocated, Gatt Server will remain
+ unaffected */
if (info->services == NULL) {
gatt_server_apps = g_slist_remove(gatt_server_apps, (gpointer)info);
INFO("Total gatt server apps still existing after removing above is [%d]",
static void __bt_gatt_close_gdbus_connection(void)
{
- GError *err = NULL;
- DBG("+");
+ GError *err = NULL;
+ DBG("+");
- if (g_conn == NULL)
+ if (g_conn == NULL)
return;
- if (!g_dbus_connection_flush_sync(g_conn, NULL, &err)) {
- ERR("Fail to flush the connection: %s", err->message);
- g_error_free(err);
- err = NULL;
- }
+ if (!g_dbus_connection_flush_sync(g_conn, NULL, &err)) {
+ ERR("Fail to flush the connection: %s", err->message);
+ g_error_free(err);
+ err = NULL;
+ }
- if (!g_dbus_connection_close_sync(g_conn, NULL, &err)) {
- if (err) {
- ERR("Fail to close the dbus connection: %s", err->message);
- g_error_free(err);
- }
- }
+ if (!g_dbus_connection_close_sync(g_conn, NULL, &err)) {
+ if (err) {
+ ERR("Fail to close the dbus connection: %s", err->message);
+ g_error_free(err);
+ }
+ }
- g_object_unref(g_conn);
- g_conn = NULL;
- DBG("-");
+ g_object_unref(g_conn);
+ g_conn = NULL;
+ DBG("-");
}
static GDBusConnection *__bt_gatt_get_gdbus_connection(void)
}
static void __bt_hal_unregister_application_cb(GObject *object, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
char *app_path = (char*)user_data;
- INFO("UnregisterApplication is completed app [%s]", app_path);
- GError *error = NULL;
- GVariant *result;
-
- result = g_dbus_proxy_call_finish(manager_gproxy, res, &error);
-
- if (result == NULL) {
- /* dBUS-RPC is failed */
- ERR("Dbus-RPC is failed\n");
-
- if (error != NULL) {
- /* dBUS gives error cause */
- ERR("D-Bus API failure: errCode[%x], message[%s]\n",
- error->code, error->message);
- g_clear_error(&error);
- }
- } else {
- g_variant_unref(result);
- }
+ INFO("UnregisterApplication is completed app [%s]", app_path);
+ GError *error = NULL;
+ GVariant *result;
+
+ result = g_dbus_proxy_call_finish(manager_gproxy, res, &error);
+
+ if (result == NULL) {
+ /* dBUS-RPC is failed */
+ ERR("Dbus-RPC is failed\n");
+
+ if (error != NULL) {
+ /* dBUS gives error cause */
+ ERR("D-Bus API failure: errCode[%x], message[%s]\n",
+ error->code, error->message);
+ g_clear_error(&error);
+ }
+ } else {
+ g_variant_unref(result);
+ }
g_free(app_path);
}
}
static struct gatt_service_info *__bt_gatt_find_gatt_service_info(int instance,
- int service_handle)
+ int service_handle)
{
GSList *l;
GSList *gatt_services = NULL;
for (l = gatt_services; l != NULL; l = g_slist_next(l)) {
struct gatt_service_info *info = l->data;
INFO("Got one service with handle [%d]", info->service_handle);
- if (info->service_handle == service_handle) {
+ if (info->service_handle == service_handle)
return info;
- }
}
ERR("Gatt service with handle [%d] not found", service_handle);
return NULL;
bt_uuid_t *uuid, int properties,
int permissions)
{
- GError *error = NULL;
- guint object_id;
- GDBusNodeInfo *node_info;
- gchar *path = NULL;
- GVariantBuilder *builder = NULL;
- GVariantBuilder *inner_builder = NULL;
- struct gatt_service_info *serv_info = NULL;
- struct gatt_char_info *char_info = NULL;
- GVariantBuilder *builder2 = NULL;
- GVariantBuilder *builder3 = NULL;
- GVariant *flags_val = NULL;
- int i = 0;
- char *char_flags[NUMBER_OF_FLAGS];
- int flag_count = 0;
+ GError *error = NULL;
+ guint object_id;
+ GDBusNodeInfo *node_info;
+ gchar *path = NULL;
+ GVariantBuilder *builder = NULL;
+ GVariantBuilder *inner_builder = NULL;
+ struct gatt_service_info *serv_info = NULL;
+ struct gatt_char_info *char_info = NULL;
+ GVariantBuilder *builder2 = NULL;
+ GVariantBuilder *builder3 = NULL;
+ GVariant *flags_val = NULL;
+ int i = 0;
+ char *char_flags[NUMBER_OF_FLAGS];
+ int flag_count = 0;
hal_gatt_char_added *user_data = NULL;
int *app_id;
#endif
/* Fetch service data for the GATT server */
serv_info = __bt_gatt_find_gatt_service_info(slot, service_handle);
- if (serv_info == NULL)
- return BT_STATUS_FAIL;
+ if (serv_info == NULL)
+ return BT_STATUS_FAIL;
/* Fetch list of characteristics from the service info */
l = serv_info->char_data;
/* Fetch last char info from the characteristic list */
char_info = g_slist_last(l)->data;
- if (char_info == NULL) {
+ if (char_info == NULL)
return BT_STATUS_FAIL;
- }
/* Fetch characteristic path from char info */
char_path = char_info->char_path;
DBG("gatt descriptor path is [%s]", path);
app_id = g_malloc0(sizeof(int));
- *app_id = slot;
+ *app_id = slot;
object_id = g_dbus_connection_register_object(g_conn, path,
node_info->interfaces[0],
}
static GDBusProxy *__bt_hal_gatt_gdbus_init_manager_proxy(const gchar *service,
- const gchar *path, const gchar *interface)
+ const gchar *path, const gchar *interface)
{
GDBusProxy *proxy;
GError *err = NULL;
}
static GDBusProxy *__bt_gatt_gdbus_get_gatt_manager_proxy(const gchar *service,
- const gchar *path, const gchar *interface)
+ const gchar *path, const gchar *interface)
{
- return (manager_gproxy) ? manager_gproxy :
- __bt_hal_gatt_gdbus_init_manager_proxy(service,
- path, interface);
+ return (manager_gproxy) ? manager_gproxy :
+ __bt_hal_gatt_gdbus_init_manager_proxy(service,
+ path, interface);
}
static void __bt_register_application_to_dbus(int slot)
if (serv_info == NULL)
return BT_STATUS_FAIL;
- if (serv_info->is_svc_registered) {
+ if (serv_info->is_svc_registered)
DBG("service already registered \n");
- }
serv_info->is_svc_registered = TRUE;
/* Send Service handle to application */
- user_data = g_malloc0(sizeof(hal_gatt_service_started));
- user_data->srvc_hdl = serv_info->service_handle;
- user_data->instance_data = server_if;
- g_idle_add(__bt_hal_gatt_service_started_cb, (gpointer)user_data);
+ user_data = g_malloc0(sizeof(hal_gatt_service_started));
+ user_data->srvc_hdl = serv_info->service_handle;
+ user_data->instance_data = server_if;
+ g_idle_add(__bt_hal_gatt_service_started_cb, (gpointer)user_data);
/* If this is nth Service that is started, then register application at this point */
if (__bt_is_service_last_in_server_list(server_if, service_handle)) {
/* Remove from GATT Server's list of services */
_bt_remote_service_from_gatt_server(server_if, service_handle);
- if (gatt_services == NULL) {
+ if (gatt_services == NULL)
INFO("All GATT Services of all GATT Servers are unregistered");
- }
if (err == BT_STATUS_SUCCESS) {
INFO("Send GATT Service deleted Event");
static gboolean __bt_gatt_get_service_state(const char *service_path)
{
- struct gatt_service_info *svc_info = NULL;
- GSList *l = NULL;
+ struct gatt_service_info *svc_info = NULL;
+ GSList *l = NULL;
- for (l= gatt_services; l; l = g_slist_next(l)) {
+ for (l = gatt_services; l; l = g_slist_next(l)) {
- svc_info = (struct gatt_service_info *)l->data;
- if (svc_info->serv_path == service_path) {
- DBG("Return the state of the gatt service %d",
- svc_info->is_svc_registered);
- return svc_info->is_svc_registered;
- }
- }
+ svc_info = (struct gatt_service_info *)l->data;
+ if (svc_info->serv_path == service_path) {
+ DBG("Return the state of the gatt service %d",
+ svc_info->is_svc_registered);
+ return svc_info->is_svc_registered;
+ }
+ }
- DBG("gatt service info is NULL");
- return FALSE;
+ DBG("gatt service info is NULL");
+ return FALSE;
}
static bt_status_t gatt_server_send_indication(int server_if, int attribute_handle, int conn_id,
/* For Notifying */
GVariantBuilder *outer_builder;
- GVariantBuilder *invalidated_builder;
+ GVariantBuilder *invalidated_builder;
/* For Value update via PropertyChange */
GVariantBuilder *outer_builder1;
DBG("Reponse Value length [%d]", response->attr_value.len);
/* DEBUG */
- for(i=0; i < response->attr_value.len; i++) {
+ for (i = 0; i < response->attr_value.len; i++)
DBG("Resonse [%d] = [0x%x]", response->attr_value.value[i]);
- }
if (req_info->request_type == BT_HAL_GATT_REQUEST_TYPE_READ) {
GVariantBuilder *inner_builder = NULL;
}
static bt_status_t gatt_server_update_att_value(int server_if, int attribute_handle,
- int value_length, char* att_value)
+ int value_length, char* att_value)
{
CHECK_BTGATT_INIT();
return _bt_hal_enable_advertising(server_if, TRUE, TRUE);
}
-static bt_status_t gatt_server_multi_adv_update(int server_if, int min_interval,int max_interval,int adv_type,
+static bt_status_t gatt_server_multi_adv_update(int server_if, int min_interval, int max_interval, int adv_type,
int chnl_map, int tx_power, int timeout_s)
{
CHECK_BTGATT_INIT();
/* GDBUS Connection Info validate */
conn = _bt_hal_get_system_gconn();
- if (conn == NULL) {
- ERR("Could not get System DBUS Connection");
- return BT_STATUS_FAIL;
- }
+ if (conn == NULL) {
+ ERR("Could not get System DBUS Connection");
+ return BT_STATUS_FAIL;
+ }
/* Connection Info validate */
conn_info = __bt_find_remote_gatt_client_info_from_conn(conn_id);
- if (conn_info == NULL) {
- ERR("No Connection Inforamtion!!!");
- return BT_STATUS_FAIL;
- }
+ if (conn_info == NULL) {
+ ERR("No Connection Inforamtion!!!");
+ return BT_STATUS_FAIL;
+ }
object_path = _bt_hal_get_device_object_path(conn_info->addr);
static bool interface_ready(void)
{
- return bt_gatt_callbacks != NULL;
+ return bt_gatt_callbacks != NULL;
}
static void __bt_hal_handle_server_instance_initialized(void *buf, uint16_t len)
static void __bt_hal_handle_gatt_server_write_requested(void *buf, uint16_t len)
{
- struct hal_ev_gatt_server_write_req *ev = buf;
+ struct hal_ev_gatt_server_write_req *ev = buf;
- if (len != sizeof(*ev) + ev->length) {
- ERR("gatt: invalid request write event, aborting");
+ if (len != sizeof(*ev) + ev->length) {
+ ERR("gatt: invalid request write event, aborting");
return;
- }
+ }
if (bt_gatt_callbacks->server->request_write_cb)
- bt_gatt_callbacks->server->request_write_cb(ev->conn_id, ev->trans_id,
- (bt_bdaddr_t *) ev->bdaddr,
- ev->att_handle, ev->offset,
- ev->length, ev->need_rsp,
- ev->is_prep, ev->value);
+ bt_gatt_callbacks->server->request_write_cb(ev->conn_id, ev->trans_id,
+ (bt_bdaddr_t *) ev->bdaddr,
+ ev->att_handle, ev->offset,
+ ev->length, ev->need_rsp,
+ ev->is_prep, ev->value);
}
static void __bt_hal_handle_gatt_server_indicate_confirmed(void *buf, uint16_t len)
if (!interface_ready())
return;
- switch(message) {
+ switch (message) {
case HAL_EV_SERVER_INSTANCE_INITIALIZED: {
__bt_hal_handle_server_instance_initialized(buf, len);
break;
** Returns bt_status_t
**
*******************************************************************************/
-static bt_status_t gatt_init(const btgatt_callbacks_t* callbacks )
+static bt_status_t gatt_init(const btgatt_callbacks_t* callbacks)
{
bt_gatt_callbacks = callbacks;
DBG("Register A2DP Src events callback function");
int channel_id;
char *obj_path;
int fd;
-}hdp_conn_info_t;
+} hdp_conn_info_t;
typedef struct {
int id;
char *path;
int channel_type;
GSList *conn_list;
-}hdp_app_data_t;
+} hdp_app_data_t;
static handle_stack_msg event_cb = NULL;
static int latest_id = -1;
if (!event_cb) {
ERR("HDP dbus handler callback not registered");
g_free(conn_info);
- }
- else
+ } else
event_cb(HAL_EV_HDP_CONN_STATE, (void *)&ev, sizeof(ev));
DBG("-");
DBG("+");
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return NULL;
}
DBG("+");
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return -1;
}
}
static int __hdp_filter_subscribe_signal(GDBusConnection *conn,
- gboolean subscribe)
+ gboolean subscribe)
{
static guint subs_add_filter_id = 0;
if (conn == NULL)
return BT_HAL_ERROR_INVALID_PARAM;
- if (subscribe && subs_add_filter_id) {
- }
-
if (subscribe) {
if (subs_add_filter_id == 0) {
subs_add_filter_id = g_dbus_connection_signal_subscribe(
DBG("+");
hdp_conn = _bt_hal_get_system_gconn();
- if(!hdp_conn) {
+ if (!hdp_conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_HAL_ERROR_INTERNAL;
}
DBG("+");
hdp_conn = _bt_hal_get_system_gconn();
- if(!hdp_conn) {
+ if (!hdp_conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_HAL_ERROR_INTERNAL;
}
DBG("dev_path: %s", dev_path);
conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
- if(!conn) {
+ if (!conn) {
ERR("ERROR: Can't get on system bus [%s]", err->message);
g_clear_error(&err);
g_free(dev_path);
DBG("+");
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
if (!interface_ready())
return;
- switch(message) {
+ switch (message) {
case HAL_EV_HDP_APP_REG_STATE:
DBG("Event: HAL_EV_HDP_APP_REG_STATE");
__bt_hal_handle_app_reg_state(buf, len);
}
static void __bt_hf_connect_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
GError *g_error = NULL;
struct hal_ev_handsfree_conn_state ev;
GDBusConnection *conn;
int ret;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
}
static void __bt_hf_disconnect_cb(GDBusProxy *proxy, GAsyncResult *res,
- gpointer user_data)
+ gpointer user_data)
{
GError *g_error = NULL;
struct hal_ev_handsfree_conn_state ev;
GDBusConnection *conn;
int ret;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
}
static bt_status_t hf_voume_control(bthf_volume_type_t type, int volume,
- bt_bdaddr_t *bd_addr)
+ bt_bdaddr_t *bd_addr)
{
DBG("");
return BT_STATUS_UNSUPPORTED;
}
static bt_status_t hf_device_status_notification(bthf_network_state_t ntk_state,
- bthf_service_type_t svc_type, int signal, int batt_chg)
+ bthf_service_type_t svc_type, int signal, int batt_chg)
{
DBG("");
return BT_STATUS_UNSUPPORTED;
}
static bt_status_t hf_cind_response(int svc, int num_active, int num_held,
- bthf_call_state_t call_setup_state,
- int signal, int roam, int batt_chg,
- bt_bdaddr_t *bd_addr)
+ bthf_call_state_t call_setup_state,
+ int signal, int roam, int batt_chg,
+ bt_bdaddr_t *bd_addr)
{
DBG("");
return BT_STATUS_UNSUPPORTED;
}
static bt_status_t hf_at_response(bthf_at_response_t response_code,
- int error_code, bt_bdaddr_t *bd_addr)
+ int error_code, bt_bdaddr_t *bd_addr)
{
DBG("");
return BT_STATUS_UNSUPPORTED;
}
static bt_status_t hf_clcc_response(int index, bthf_call_direction_t dir,
- bthf_call_state_t state, bthf_call_mode_t mode,
- bthf_call_mpty_type_t mpty, const char *number,
- bthf_call_addrtype_t type, bt_bdaddr_t *bd_addr)
+ bthf_call_state_t state, bthf_call_mode_t mode,
+ bthf_call_mpty_type_t mpty, const char *number,
+ bthf_call_addrtype_t type, bt_bdaddr_t *bd_addr)
{
DBG("");
return BT_STATUS_UNSUPPORTED;
}
static bt_status_t hf_phone_state_change(int num_active, int num_held, bthf_call_state_t call_setup_state,
- const char *number, bthf_call_addrtype_t type)
+ const char *number, bthf_call_addrtype_t type)
{
DBG("");
return BT_STATUS_UNSUPPORTED;
static void __bt_hal_handle_hf_conn_state(void *buf, uint16_t len)
{
- struct hal_ev_handsfree_conn_state *ev = buf;
+ struct hal_ev_handsfree_conn_state *ev = buf;
- if (bt_hal_hf_cbacks->connection_state_cb)
- bt_hal_hf_cbacks->connection_state_cb(ev->state, (bt_bdaddr_t *) ev->bdaddr);
+ if (bt_hal_hf_cbacks->connection_state_cb)
+ bt_hal_hf_cbacks->connection_state_cb(ev->state, (bt_bdaddr_t *) ev->bdaddr);
}
static void __bt_hal_handle_hf_audio_conn_state(void *buf, uint16_t len)
{
- struct hal_ev_handsfree_audio_state *ev = buf;
+ struct hal_ev_handsfree_audio_state *ev = buf;
- if (bt_hal_hf_cbacks->audio_state_cb)
- bt_hal_hf_cbacks->audio_state_cb(ev->state, (bt_bdaddr_t *) ev->bdaddr);
+ if (bt_hal_hf_cbacks->audio_state_cb)
+ bt_hal_hf_cbacks->audio_state_cb(ev->state, (bt_bdaddr_t *) ev->bdaddr);
}
static void __bt_hal_handle_hf_events(int message, void *buf, uint16_t len)
DBG("+");
if (!interface_ready())
return;
- switch(message) {
+ switch (message) {
case HAL_EV_HANDSFREE_CONN_STATE:
DBG("Event: HAL_EV_HANDSFREE_CONN_STATE");
__bt_hal_handle_hf_conn_state(buf, len);
}
static bthf_interface_t bthf_if = {
- .size = sizeof(bthf_if),
- .init = init,
- .connect = hf_connect,
- .disconnect = hf_disconnect,
- .connect_audio = hf_connect_audio,
- .disconnect_audio = hf_disconnect_audio,
- .start_voice_recognition = hf_start_voice_recognition,
- .stop_voice_recognition = hf_stop_voice_recognition,
- .volume_control = hf_voume_control,
- .device_status_notification = hf_device_status_notification,
- .cops_response = hf_cops_response,
- .cind_response = hf_cind_response,
- .formatted_at_response = hf_formatted_at_response,
- .at_response = hf_at_response,
- .clcc_response = hf_clcc_response,
- .phone_state_change = hf_phone_state_change,
- .cleanup = cleanup
+ .size = sizeof(bthf_if),
+ .init = init,
+ .connect = hf_connect,
+ .disconnect = hf_disconnect,
+ .connect_audio = hf_connect_audio,
+ .disconnect_audio = hf_disconnect_audio,
+ .start_voice_recognition = hf_start_voice_recognition,
+ .stop_voice_recognition = hf_stop_voice_recognition,
+ .volume_control = hf_voume_control,
+ .device_status_notification = hf_device_status_notification,
+ .cops_response = hf_cops_response,
+ .cind_response = hf_cind_response,
+ .formatted_at_response = hf_formatted_at_response,
+ .at_response = hf_at_response,
+ .clcc_response = hf_clcc_response,
+ .phone_state_change = hf_phone_state_change,
+ .cleanup = cleanup
};
/*******************************************************************************
*******************************************************************************/
const bthf_interface_t *bt_get_hf_interface()
{
- return &bthf_if;
+ return &bthf_if;
}
int ret;
char *uuid;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
int ret;
char *uuid;
- if(!bd_addr) {
+ if (!bd_addr) {
ERR("bd_addr is NULL, return");
return BT_STATUS_PARM_INVALID;
}
conn = _bt_hal_get_system_gconn();
- if(!conn) {
+ if (!conn) {
ERR("_bt_hal_get_system_gconn returned NULL, return");
return BT_STATUS_FAIL;
}
if (!interface_ready())
return;
- switch(message) {
+ switch (message) {
case HAL_EV_HIDHOST_CONN_STATE:
DBG("Event: HAL_EV_HIDHOST_CONN_STATE");
__bt_hal_handle_conn_state(buf, len);
#endif
typedef enum {
- BT_HAL_MANAGER_EVENT = 0x01,
- BT_HAL_ADAPTER_EVENT,
- BT_HAL_LE_ADAPTER_EVENT,
- BT_HAL_DEVICE_EVENT,
- BT_HAL_HID_EVENT,
- BT_HAL_NETWORK_EVENT,
- BT_HAL_HEADSET_EVENT,
- BT_HAL_AVRCP_EVENT,
- BT_HAL_OPP_CLIENT_EVENT,
- BT_HAL_OPP_SERVER_EVENT,
- BT_HAL_PBAP_CLIENT_EVENT,
- BT_HAL_RFCOMM_CLIENT_EVENT,
- BT_HAL_RFCOMM_SERVER_EVENT,
- BT_HAL_AGENT_EVENT,
- BT_HAL_OBJECT_MANAGER_EVENT,
- BT_HAL_MEDIA_TRANSFER_EVENT,
- BT_HAL_HF_AGENT_EVENT,
- BT_HAL_AVRCP_CONTROL_EVENT,
- BT_HAL_A2DP_SOURCE_EVENT,
- BT_HAL_HID_DEVICE_EVENT,
- /* Will be added */
+ BT_HAL_MANAGER_EVENT = 0x01,
+ BT_HAL_ADAPTER_EVENT,
+ BT_HAL_LE_ADAPTER_EVENT,
+ BT_HAL_DEVICE_EVENT,
+ BT_HAL_HID_EVENT,
+ BT_HAL_NETWORK_EVENT,
+ BT_HAL_HEADSET_EVENT,
+ BT_HAL_AVRCP_EVENT,
+ BT_HAL_OPP_CLIENT_EVENT,
+ BT_HAL_OPP_SERVER_EVENT,
+ BT_HAL_PBAP_CLIENT_EVENT,
+ BT_HAL_RFCOMM_CLIENT_EVENT,
+ BT_HAL_RFCOMM_SERVER_EVENT,
+ BT_HAL_AGENT_EVENT,
+ BT_HAL_OBJECT_MANAGER_EVENT,
+ BT_HAL_MEDIA_TRANSFER_EVENT,
+ BT_HAL_HF_AGENT_EVENT,
+ BT_HAL_AVRCP_CONTROL_EVENT,
+ BT_HAL_A2DP_SOURCE_EVENT,
+ BT_HAL_HID_DEVICE_EVENT,
+ /* Will be added */
} bt_hal_event_type_t;
/* Profile states matched to btd_service_state_t of bluez service.h */
if (g_io_channel_read_chars(io, (gchar *)buff,
BT_HAL_RFCOMM_MAX_BUFFER_SIZE,
&len, &err) == G_IO_STATUS_ERROR) {
- if( err )
+ if (err)
ERR("IO Channel read error: %s", err->message);
else
ERR("IO Channel read error client");
if (g_io_channel_read_chars(io, (gchar *)buff,
BT_HAL_RFCOMM_MAX_BUFFER_SIZE,
&len, &err) == G_IO_STATUS_ERROR) {
- if( err )
+ if (err)
ERR("IO Channel read error: %s", err->message);
else
ERR("IO Channel read error client");
if (g_io_channel_read_chars(io, (gchar *)buff,
BT_HAL_RFCOMM_MAX_BUFFER_SIZE,
&len, &err) == G_IO_STATUS_ERROR) {
- if( err )
+ if (err)
ERR("IO Channel read error: %s", err->message);
else
ERR("IO Channel read error client");
const char *_bt_hal_dump_uuid_name(int uuid_no)
{
- switch(uuid_no)
- {
- CASE_RETURN_STR(BASE)
- CASE_RETURN_STR(SDP)
- CASE_RETURN_STR(UDP)
- CASE_RETURN_STR(RFCOMM)
- CASE_RETURN_STR(TCP)
- CASE_RETURN_STR(TCS_BIN)
- CASE_RETURN_STR(TCS_AT)
- CASE_RETURN_STR(ATT)
- CASE_RETURN_STR(OBEX)
- CASE_RETURN_STR(IP)
- CASE_RETURN_STR(FTP)
- CASE_RETURN_STR(HTTP)
- CASE_RETURN_STR(WSP)
- CASE_RETURN_STR(BNEP)
- CASE_RETURN_STR(UPNP)
- CASE_RETURN_STR(HIDP)
- CASE_RETURN_STR(HardcopyControlChannel)
- CASE_RETURN_STR(HardcopyDataChannel)
- CASE_RETURN_STR(HardcopyNotification)
- CASE_RETURN_STR(AVCTP)
- CASE_RETURN_STR(AVDTP)
- CASE_RETURN_STR(CMTP)
- CASE_RETURN_STR(MCAPControlChannel)
- CASE_RETURN_STR(MCAPDataChannel)
- CASE_RETURN_STR(L2CAP)
- CASE_RETURN_STR(ServiceDiscoveryServerServiceClassID)
- CASE_RETURN_STR(BrowseGroupDescriptorServiceClassID)
- CASE_RETURN_STR(SerialPort)
- CASE_RETURN_STR(LANAccessUsingPPP)
- CASE_RETURN_STR(DialupNetworking)
- CASE_RETURN_STR(IrMCSync)
- CASE_RETURN_STR(OBEXObjectPush)
- CASE_RETURN_STR(OBEXFileTransfer)
- CASE_RETURN_STR(IrMCSyncCommand)
- CASE_RETURN_STR(Headset)
- CASE_RETURN_STR(CordlessTelephony)
- CASE_RETURN_STR(AudioSource)
- CASE_RETURN_STR(AudioSink)
- CASE_RETURN_STR(AV_RemoteControlTarget)
- CASE_RETURN_STR(AdvancedAudioDistribution)
- CASE_RETURN_STR(AV_RemoteControl)
- CASE_RETURN_STR(AV_RemoteControlController)
- CASE_RETURN_STR(Intercom)
- CASE_RETURN_STR(Fax)
- CASE_RETURN_STR(Headset_Audio_Gateway)
- CASE_RETURN_STR(WAP)
- CASE_RETURN_STR(WAP_CLIENT)
- CASE_RETURN_STR(PANU)
- CASE_RETURN_STR(NAP)
- CASE_RETURN_STR(GN)
+ switch (uuid_no) {
+ CASE_RETURN_STR(BASE)
+ CASE_RETURN_STR(SDP)
+ CASE_RETURN_STR(UDP)
+ CASE_RETURN_STR(RFCOMM)
+ CASE_RETURN_STR(TCP)
+ CASE_RETURN_STR(TCS_BIN)
+ CASE_RETURN_STR(TCS_AT)
+ CASE_RETURN_STR(ATT)
+ CASE_RETURN_STR(OBEX)
+ CASE_RETURN_STR(IP)
+ CASE_RETURN_STR(FTP)
+ CASE_RETURN_STR(HTTP)
+ CASE_RETURN_STR(WSP)
+ CASE_RETURN_STR(BNEP)
+ CASE_RETURN_STR(UPNP)
+ CASE_RETURN_STR(HIDP)
+ CASE_RETURN_STR(HardcopyControlChannel)
+ CASE_RETURN_STR(HardcopyDataChannel)
+ CASE_RETURN_STR(HardcopyNotification)
+ CASE_RETURN_STR(AVCTP)
+ CASE_RETURN_STR(AVDTP)
+ CASE_RETURN_STR(CMTP)
+ CASE_RETURN_STR(MCAPControlChannel)
+ CASE_RETURN_STR(MCAPDataChannel)
+ CASE_RETURN_STR(L2CAP)
+ CASE_RETURN_STR(ServiceDiscoveryServerServiceClassID)
+ CASE_RETURN_STR(BrowseGroupDescriptorServiceClassID)
+ CASE_RETURN_STR(SerialPort)
+ CASE_RETURN_STR(LANAccessUsingPPP)
+ CASE_RETURN_STR(DialupNetworking)
+ CASE_RETURN_STR(IrMCSync)
+ CASE_RETURN_STR(OBEXObjectPush)
+ CASE_RETURN_STR(OBEXFileTransfer)
+ CASE_RETURN_STR(IrMCSyncCommand)
+ CASE_RETURN_STR(Headset)
+ CASE_RETURN_STR(CordlessTelephony)
+ CASE_RETURN_STR(AudioSource)
+ CASE_RETURN_STR(AudioSink)
+ CASE_RETURN_STR(AV_RemoteControlTarget)
+ CASE_RETURN_STR(AdvancedAudioDistribution)
+ CASE_RETURN_STR(AV_RemoteControl)
+ CASE_RETURN_STR(AV_RemoteControlController)
+ CASE_RETURN_STR(Intercom)
+ CASE_RETURN_STR(Fax)
+ CASE_RETURN_STR(Headset_Audio_Gateway)
+ CASE_RETURN_STR(WAP)
+ CASE_RETURN_STR(WAP_CLIENT)
+ CASE_RETURN_STR(PANU)
+ CASE_RETURN_STR(NAP)
+ CASE_RETURN_STR(GN)
CASE_RETURN_STR(DirectPrinting)
- CASE_RETURN_STR(ReferencePrinting)
- CASE_RETURN_STR(Basic_Imaging_Profile)
- CASE_RETURN_STR(ImagingResponder)
- CASE_RETURN_STR(ImagingAutomaticArchive)
- CASE_RETURN_STR(ImagingReferencedObjects)
- CASE_RETURN_STR(Handsfree)
- CASE_RETURN_STR(HandsfreeAudioGateway)
- CASE_RETURN_STR(DirectPrintingReferenceObjectsService)
- CASE_RETURN_STR(ReflectedUI)
- CASE_RETURN_STR(BasicPrinting)
- CASE_RETURN_STR(PrintingStatus)
- CASE_RETURN_STR(HumanInterfaceDeviceService)
- CASE_RETURN_STR(HardcopyCableReplacement)
- CASE_RETURN_STR(HCR_Print)
- CASE_RETURN_STR(HCR_Scan)
- CASE_RETURN_STR(Common_ISDN_Access)
- CASE_RETURN_STR(SIM_Access)
- CASE_RETURN_STR(Phonebook_Access_PCE)
- CASE_RETURN_STR(Phonebook_Access_PSE)
- CASE_RETURN_STR(Phonebook_Access)
- CASE_RETURN_STR(Headset_HS)
- CASE_RETURN_STR(Message_Access_Server)
- CASE_RETURN_STR(Message_Notification_Server)
- CASE_RETURN_STR(Message_Access_Profile)
- CASE_RETURN_STR(GNSS)
- CASE_RETURN_STR(GNSS_Server)
- CASE_RETURN_STR(ThreeD_Display)
- CASE_RETURN_STR(ThreeD_Glasses)
- CASE_RETURN_STR(ThreeD_Synchronization)
- CASE_RETURN_STR(MPS_Profile)
- CASE_RETURN_STR(MPS_SC)
- CASE_RETURN_STR(CTN_Access_Service)
- CASE_RETURN_STR(CTN_Notification_Service)
- CASE_RETURN_STR(CTN_Profile)
- CASE_RETURN_STR(PnPInformation)
- CASE_RETURN_STR(GenericNetworking)
- CASE_RETURN_STR(GenericFileTransfer)
- CASE_RETURN_STR(GenericAudio)
- CASE_RETURN_STR(GenericTelephony)
- CASE_RETURN_STR(UPNP_Service)
- CASE_RETURN_STR(UPNP_IP_Service)
- CASE_RETURN_STR(ESDP_UPNP_IP_PAN)
- CASE_RETURN_STR(ESDP_UPNP_IP_LAP)
- CASE_RETURN_STR(ESDP_UPNP_L2CAP)
- CASE_RETURN_STR(VideoSource)
- CASE_RETURN_STR(VideoSink)
- CASE_RETURN_STR(VideoDistribution)
- CASE_RETURN_STR(HDP)
+ CASE_RETURN_STR(ReferencePrinting)
+ CASE_RETURN_STR(Basic_Imaging_Profile)
+ CASE_RETURN_STR(ImagingResponder)
+ CASE_RETURN_STR(ImagingAutomaticArchive)
+ CASE_RETURN_STR(ImagingReferencedObjects)
+ CASE_RETURN_STR(Handsfree)
+ CASE_RETURN_STR(HandsfreeAudioGateway)
+ CASE_RETURN_STR(DirectPrintingReferenceObjectsService)
+ CASE_RETURN_STR(ReflectedUI)
+ CASE_RETURN_STR(BasicPrinting)
+ CASE_RETURN_STR(PrintingStatus)
+ CASE_RETURN_STR(HumanInterfaceDeviceService)
+ CASE_RETURN_STR(HardcopyCableReplacement)
+ CASE_RETURN_STR(HCR_Print)
+ CASE_RETURN_STR(HCR_Scan)
+ CASE_RETURN_STR(Common_ISDN_Access)
+ CASE_RETURN_STR(SIM_Access)
+ CASE_RETURN_STR(Phonebook_Access_PCE)
+ CASE_RETURN_STR(Phonebook_Access_PSE)
+ CASE_RETURN_STR(Phonebook_Access)
+ CASE_RETURN_STR(Headset_HS)
+ CASE_RETURN_STR(Message_Access_Server)
+ CASE_RETURN_STR(Message_Notification_Server)
+ CASE_RETURN_STR(Message_Access_Profile)
+ CASE_RETURN_STR(GNSS)
+ CASE_RETURN_STR(GNSS_Server)
+ CASE_RETURN_STR(ThreeD_Display)
+ CASE_RETURN_STR(ThreeD_Glasses)
+ CASE_RETURN_STR(ThreeD_Synchronization)
+ CASE_RETURN_STR(MPS_Profile)
+ CASE_RETURN_STR(MPS_SC)
+ CASE_RETURN_STR(CTN_Access_Service)
+ CASE_RETURN_STR(CTN_Notification_Service)
+ CASE_RETURN_STR(CTN_Profile)
+ CASE_RETURN_STR(PnPInformation)
+ CASE_RETURN_STR(GenericNetworking)
+ CASE_RETURN_STR(GenericFileTransfer)
+ CASE_RETURN_STR(GenericAudio)
+ CASE_RETURN_STR(GenericTelephony)
+ CASE_RETURN_STR(UPNP_Service)
+ CASE_RETURN_STR(UPNP_IP_Service)
+ CASE_RETURN_STR(ESDP_UPNP_IP_PAN)
+ CASE_RETURN_STR(ESDP_UPNP_IP_LAP)
+ CASE_RETURN_STR(ESDP_UPNP_L2CAP)
+ CASE_RETURN_STR(VideoSource)
+ CASE_RETURN_STR(VideoSink)
+ CASE_RETURN_STR(VideoDistribution)
+ CASE_RETURN_STR(HDP)
CASE_RETURN_STR(HDP_Source)
- CASE_RETURN_STR(HDP_Sink)
- CASE_RETURN_STR(Generic_Access)
- CASE_RETURN_STR(Generic_Attribute)
- CASE_RETURN_STR(Immediate_Alert)
- CASE_RETURN_STR(Link_Loss)
- CASE_RETURN_STR(Tx_Power)
- CASE_RETURN_STR(Current_Time)
- CASE_RETURN_STR(Reference_Time_Update)
- CASE_RETURN_STR(Next_Dst_Change)
- CASE_RETURN_STR(Glucose)
- CASE_RETURN_STR(Health_Thermometer)
- CASE_RETURN_STR(Device_Information)
- CASE_RETURN_STR(Heart_Rate)
- CASE_RETURN_STR(Phone_Alert_Status)
- CASE_RETURN_STR(Battery_Service)
- CASE_RETURN_STR(Blood_Pressure)
- CASE_RETURN_STR(Alert_Notification)
- CASE_RETURN_STR(Human_Interface_Device)
- CASE_RETURN_STR(Scan_Parameters)
- CASE_RETURN_STR(Running_Speed_And_Cadence)
- CASE_RETURN_STR(Automation_IO)
- CASE_RETURN_STR(Cycling_Speed_And_Cadence)
- CASE_RETURN_STR(Cycling_Power)
- CASE_RETURN_STR(Location_And_Navigation)
- CASE_RETURN_STR(Environmental_Sensing)
- CASE_RETURN_STR(Body_Composition)
- CASE_RETURN_STR(User_Data)
- CASE_RETURN_STR(Weight_Scale)
- CASE_RETURN_STR(Bond_Management)
- CASE_RETURN_STR(Continuous_Glucose_Monitoring)
- CASE_RETURN_STR(Internet_Protocol_Support)
- CASE_RETURN_STR(Indoor_Positioning)
- CASE_RETURN_STR(Pulse_Oximeter)
- CASE_RETURN_STR(Http_Proxy)
- CASE_RETURN_STR(Transport_Discovery)
- CASE_RETURN_STR(Object_Transfer)
- CASE_RETURN_STR(Gap_Device_Name)
- CASE_RETURN_STR(Gap_Appearance)
- CASE_RETURN_STR(Gap_Peripheral_Privacy_Flag)
- CASE_RETURN_STR(Gap_Reconnection_Address)
- CASE_RETURN_STR(Gap_Peripheral_Preferred_Connection_Parameters)
- CASE_RETURN_STR(Gatt_Service_Changed)
- CASE_RETURN_STR(Alert_Level)
- CASE_RETURN_STR(Tx_Power_Level)
- CASE_RETURN_STR(Date_Time)
- CASE_RETURN_STR(Day_Of_Week)
- CASE_RETURN_STR(Day_Date_Time)
- CASE_RETURN_STR(Exact_Time_256)
- CASE_RETURN_STR(Dst_Offset)
- CASE_RETURN_STR(Time_Zone)
- CASE_RETURN_STR(Local_Time_Information)
- CASE_RETURN_STR(Time_With_Dst)
- CASE_RETURN_STR(Time_Accuracy)
- CASE_RETURN_STR(Time_Source)
- CASE_RETURN_STR(Reference_Time_Information)
- CASE_RETURN_STR(Time_Update_Control_Point)
- CASE_RETURN_STR(Time_Update_State)
- CASE_RETURN_STR(Glucose_Measurement)
- CASE_RETURN_STR(Battery_Level)
- CASE_RETURN_STR(Temperature_Measurement)
- CASE_RETURN_STR(Temperature_Type)
- CASE_RETURN_STR(Intermediate_Temperature)
- CASE_RETURN_STR(Measurement_Interval)
- CASE_RETURN_STR(Boot_Keyboard_Input_Report)
- CASE_RETURN_STR(System_Id)
- CASE_RETURN_STR(Model_Number_String)
- CASE_RETURN_STR(Serial_Number_String)
- CASE_RETURN_STR(Firmware_Revision_String)
- CASE_RETURN_STR(Hardware_Revision_String)
- CASE_RETURN_STR(Software_Revision_String)
- CASE_RETURN_STR(Manufacturer_Name_String)
- CASE_RETURN_STR(Regulatory_Certification_Data_List)
- CASE_RETURN_STR(Current_Time_Charac)
- CASE_RETURN_STR(Magnetic_Declination)
- CASE_RETURN_STR(Scan_Refresh)
- CASE_RETURN_STR(Boot_Keyboard_Output_Report)
- CASE_RETURN_STR(Boot_Mouse_Input_Report)
- CASE_RETURN_STR(Glucose_Measurement_Context)
- CASE_RETURN_STR(Blood_Pressure_Measurement)
- CASE_RETURN_STR(Intermediate_Cuff_Pressure)
- CASE_RETURN_STR(Heart_Rate_Measurement)
- CASE_RETURN_STR(Body_Sensor_Location)
- CASE_RETURN_STR(Heart_Rate_Control_Point)
- CASE_RETURN_STR(Alert_Status)
- CASE_RETURN_STR(Ringer_Control_Point)
- CASE_RETURN_STR(Ringer_Setting)
- CASE_RETURN_STR(Alert_Category_Id_Bit_Mask)
- CASE_RETURN_STR(Alert_Category_Id)
- CASE_RETURN_STR(Alert_Notification_Control_Point)
- CASE_RETURN_STR(Unread_Alert_Status)
- CASE_RETURN_STR(New_Alert)
- CASE_RETURN_STR(Supported_New_Alert_Category)
- CASE_RETURN_STR(Supported_Unread_Alert_Category)
- CASE_RETURN_STR(Blood_Pressure_Feature)
- CASE_RETURN_STR(Hid_Information)
- CASE_RETURN_STR(Report_Map)
- CASE_RETURN_STR(Hid_Control_Point)
- CASE_RETURN_STR(Report)
- CASE_RETURN_STR(Protocol_Mode)
- CASE_RETURN_STR(Scan_Interval_Window)
- CASE_RETURN_STR(Pnp_Id)
- CASE_RETURN_STR(Glucose_Feature)
- CASE_RETURN_STR(Record_Access_Control_Point)
- CASE_RETURN_STR(Rsc_Measurement)
- CASE_RETURN_STR(Rsc_Feature)
- CASE_RETURN_STR(Sc_Control_Point)
- CASE_RETURN_STR(Digital)
- CASE_RETURN_STR(Analog)
- CASE_RETURN_STR(Aggregate)
- CASE_RETURN_STR(Csc_Measurement)
- CASE_RETURN_STR(Csc_Feature)
- CASE_RETURN_STR(Sensor_Location)
- CASE_RETURN_STR(Plx_Spot_Check_Measurement)
- CASE_RETURN_STR(Plx_Continuous_Measurement)
- CASE_RETURN_STR(Plx_Features)
- CASE_RETURN_STR(Cycling_Power_Measurement)
- CASE_RETURN_STR(Cycling_Power_Vector)
- CASE_RETURN_STR(Cycling_Power_Feature)
- CASE_RETURN_STR(Cycling_Power_Control_Point)
- CASE_RETURN_STR(Location_And_Speed)
- CASE_RETURN_STR(Navigation)
- CASE_RETURN_STR(Position_Quality)
- CASE_RETURN_STR(Ln_Feature)
- CASE_RETURN_STR(Ln_Control_Point)
- CASE_RETURN_STR(Elevation)
- CASE_RETURN_STR(Pressure)
- CASE_RETURN_STR(Temperature)
- CASE_RETURN_STR(Humidity)
- CASE_RETURN_STR(True_Wind_Speed)
- CASE_RETURN_STR(True_Wind_Direction)
- CASE_RETURN_STR(Apparent_Wind_Speed)
- CASE_RETURN_STR(Apparent_Wind_Direction)
- CASE_RETURN_STR(Gust_Factor)
- CASE_RETURN_STR(Pollen_Concentration)
- CASE_RETURN_STR(Uv_Index)
- CASE_RETURN_STR(Irradiance)
- CASE_RETURN_STR(Rainfall)
- CASE_RETURN_STR(Wind_Chill)
- CASE_RETURN_STR(Heat_Index)
- CASE_RETURN_STR(Dew_Point)
- CASE_RETURN_STR(Descriptor_Value_Changed)
- CASE_RETURN_STR(Aerobic_Threshold)
- CASE_RETURN_STR(Age)
- CASE_RETURN_STR(Anaerobic_Heart_Rate_Lower_Limit)
- CASE_RETURN_STR(Anaerobic_Heart_Rate_Upper_Limit)
- CASE_RETURN_STR(Anaerobic_Threshold)
- CASE_RETURN_STR(Aerobic_Heart_Rate_Upper_Limit)
- CASE_RETURN_STR(Date_Of_Birth)
- CASE_RETURN_STR(Date_Of_Threshold_Assessment)
- CASE_RETURN_STR(Email_Address)
- CASE_RETURN_STR(Fat_Burn_Heart_Rate_Lower_Limit)
- CASE_RETURN_STR(Fat_Burn_Heart_Rate_Upper_Limit)
- CASE_RETURN_STR(First_Name)
- CASE_RETURN_STR(Five_Zone_Heart_Rate_Limits)
- CASE_RETURN_STR(Gender)
- CASE_RETURN_STR(Heart_Rate_Max)
- CASE_RETURN_STR(Height)
- CASE_RETURN_STR(Hip_Circumference)
- CASE_RETURN_STR(Last_Name)
- CASE_RETURN_STR(Maximum_Recommended_Heart_Rate)
- CASE_RETURN_STR(Resting_Heart_Rate)
- CASE_RETURN_STR(Sport_Type_For_Aerobic_And_Anaerobic_Thresholds)
- CASE_RETURN_STR(Three_Zone_Heart_Rate_Limits)
- CASE_RETURN_STR(Two_Zone_Heart_Rate_Limit)
- CASE_RETURN_STR(Vo2_Max)
- CASE_RETURN_STR(Waist_Circumference)
- CASE_RETURN_STR(Weight)
- CASE_RETURN_STR(Database_Change_Increment)
- CASE_RETURN_STR(User_Index)
- CASE_RETURN_STR(Body_Composition_Feature)
- CASE_RETURN_STR(Body_Composition_Measurement)
- CASE_RETURN_STR(Weight_Measurement)
- CASE_RETURN_STR(Weight_Scale_Feature)
- CASE_RETURN_STR(User_Control_Point)
- CASE_RETURN_STR(Magnetic_Flux_Density_2D)
- CASE_RETURN_STR(Magnetic_Flux_Density_3D)
- CASE_RETURN_STR(Language)
- CASE_RETURN_STR(Barometric_Pressure_Trend)
- CASE_RETURN_STR(Bond_Management_Control_Point)
- CASE_RETURN_STR(Bond_Management_Feature)
- CASE_RETURN_STR(Gap_Central_Address_Resolution_Support)
- CASE_RETURN_STR(Cgm_Measurement)
- CASE_RETURN_STR(Cgm_Feature)
- CASE_RETURN_STR(Cgm_Status)
- CASE_RETURN_STR(Cgm_Session_Start_Time)
- CASE_RETURN_STR(Cgm_Session_Run_Time)
- CASE_RETURN_STR(Cgm_Specific_Ops_Control_Point)
- CASE_RETURN_STR(Indoor_Positioning_Configuration)
- CASE_RETURN_STR(Latitude)
- CASE_RETURN_STR(Longitude)
- CASE_RETURN_STR(Local_North_Coordinate)
- CASE_RETURN_STR(Local_East_Coordinate)
- CASE_RETURN_STR(Floor_Number)
- CASE_RETURN_STR(Altitude)
- CASE_RETURN_STR(Uncertainty)
- CASE_RETURN_STR(Location_Name)
- CASE_RETURN_STR(Uri)
- CASE_RETURN_STR(Http_Headers)
- CASE_RETURN_STR(Http_Status_Code)
- CASE_RETURN_STR(Http_Entity_Body)
- CASE_RETURN_STR(Http_Control_Point)
- CASE_RETURN_STR(Https_Security)
- CASE_RETURN_STR(Tds_Control_Point)
- CASE_RETURN_STR(Ots_Feature)
- CASE_RETURN_STR(Object_Name)
- CASE_RETURN_STR(Object_Type)
- CASE_RETURN_STR(Object_Size)
- CASE_RETURN_STR(Object_First_Created)
- CASE_RETURN_STR(Object_Last_Modified)
- CASE_RETURN_STR(Object_Id)
- CASE_RETURN_STR(Object_Properties)
- CASE_RETURN_STR(Object_Action_Control_Point)
- CASE_RETURN_STR(Object_List_Control_Point)
- CASE_RETURN_STR(Object_List_Filter)
- CASE_RETURN_STR(Object_Changed)
- CASE_RETURN_STR(Fitness_Machine_Control_Point)
- CASE_RETURN_STR(Gatt_Characteristic_Extended_Properties)
- CASE_RETURN_STR(Gatt_Characteristic_User_Description)
- CASE_RETURN_STR(Gatt_Client_Characteristic_Configuration)
- CASE_RETURN_STR(Gatt_Server_Characteristic_Configuration)
- CASE_RETURN_STR(Gatt_Characteristic_Presentation_Format)
- CASE_RETURN_STR(Gatt_Characteristic_Aggregate_Format)
- CASE_RETURN_STR(Valid_Range)
- CASE_RETURN_STR(External_Report_Reference)
- CASE_RETURN_STR(Report_Reference)
- CASE_RETURN_STR(Number_Of_Digitals)
- CASE_RETURN_STR(Value_Trigger_Setting)
- CASE_RETURN_STR(Es_Configuration)
- CASE_RETURN_STR(Es_Measurement)
- CASE_RETURN_STR(Es_Trigger_Setting)
- CASE_RETURN_STR(Time_Trigger_Setting)
- CASE_RETURN_STR(Gatt_Primary_Service_Declaration)
- CASE_RETURN_STR(Gatt_Secondary_Service_Declaration)
- CASE_RETURN_STR(Gatt_Include_Declaration)
- CASE_RETURN_STR(Gatt_Characteristic_Declaration)
- default:
- return "--";
- }
+ CASE_RETURN_STR(HDP_Sink)
+ CASE_RETURN_STR(Generic_Access)
+ CASE_RETURN_STR(Generic_Attribute)
+ CASE_RETURN_STR(Immediate_Alert)
+ CASE_RETURN_STR(Link_Loss)
+ CASE_RETURN_STR(Tx_Power)
+ CASE_RETURN_STR(Current_Time)
+ CASE_RETURN_STR(Reference_Time_Update)
+ CASE_RETURN_STR(Next_Dst_Change)
+ CASE_RETURN_STR(Glucose)
+ CASE_RETURN_STR(Health_Thermometer)
+ CASE_RETURN_STR(Device_Information)
+ CASE_RETURN_STR(Heart_Rate)
+ CASE_RETURN_STR(Phone_Alert_Status)
+ CASE_RETURN_STR(Battery_Service)
+ CASE_RETURN_STR(Blood_Pressure)
+ CASE_RETURN_STR(Alert_Notification)
+ CASE_RETURN_STR(Human_Interface_Device)
+ CASE_RETURN_STR(Scan_Parameters)
+ CASE_RETURN_STR(Running_Speed_And_Cadence)
+ CASE_RETURN_STR(Automation_IO)
+ CASE_RETURN_STR(Cycling_Speed_And_Cadence)
+ CASE_RETURN_STR(Cycling_Power)
+ CASE_RETURN_STR(Location_And_Navigation)
+ CASE_RETURN_STR(Environmental_Sensing)
+ CASE_RETURN_STR(Body_Composition)
+ CASE_RETURN_STR(User_Data)
+ CASE_RETURN_STR(Weight_Scale)
+ CASE_RETURN_STR(Bond_Management)
+ CASE_RETURN_STR(Continuous_Glucose_Monitoring)
+ CASE_RETURN_STR(Internet_Protocol_Support)
+ CASE_RETURN_STR(Indoor_Positioning)
+ CASE_RETURN_STR(Pulse_Oximeter)
+ CASE_RETURN_STR(Http_Proxy)
+ CASE_RETURN_STR(Transport_Discovery)
+ CASE_RETURN_STR(Object_Transfer)
+ CASE_RETURN_STR(Gap_Device_Name)
+ CASE_RETURN_STR(Gap_Appearance)
+ CASE_RETURN_STR(Gap_Peripheral_Privacy_Flag)
+ CASE_RETURN_STR(Gap_Reconnection_Address)
+ CASE_RETURN_STR(Gap_Peripheral_Preferred_Connection_Parameters)
+ CASE_RETURN_STR(Gatt_Service_Changed)
+ CASE_RETURN_STR(Alert_Level)
+ CASE_RETURN_STR(Tx_Power_Level)
+ CASE_RETURN_STR(Date_Time)
+ CASE_RETURN_STR(Day_Of_Week)
+ CASE_RETURN_STR(Day_Date_Time)
+ CASE_RETURN_STR(Exact_Time_256)
+ CASE_RETURN_STR(Dst_Offset)
+ CASE_RETURN_STR(Time_Zone)
+ CASE_RETURN_STR(Local_Time_Information)
+ CASE_RETURN_STR(Time_With_Dst)
+ CASE_RETURN_STR(Time_Accuracy)
+ CASE_RETURN_STR(Time_Source)
+ CASE_RETURN_STR(Reference_Time_Information)
+ CASE_RETURN_STR(Time_Update_Control_Point)
+ CASE_RETURN_STR(Time_Update_State)
+ CASE_RETURN_STR(Glucose_Measurement)
+ CASE_RETURN_STR(Battery_Level)
+ CASE_RETURN_STR(Temperature_Measurement)
+ CASE_RETURN_STR(Temperature_Type)
+ CASE_RETURN_STR(Intermediate_Temperature)
+ CASE_RETURN_STR(Measurement_Interval)
+ CASE_RETURN_STR(Boot_Keyboard_Input_Report)
+ CASE_RETURN_STR(System_Id)
+ CASE_RETURN_STR(Model_Number_String)
+ CASE_RETURN_STR(Serial_Number_String)
+ CASE_RETURN_STR(Firmware_Revision_String)
+ CASE_RETURN_STR(Hardware_Revision_String)
+ CASE_RETURN_STR(Software_Revision_String)
+ CASE_RETURN_STR(Manufacturer_Name_String)
+ CASE_RETURN_STR(Regulatory_Certification_Data_List)
+ CASE_RETURN_STR(Current_Time_Charac)
+ CASE_RETURN_STR(Magnetic_Declination)
+ CASE_RETURN_STR(Scan_Refresh)
+ CASE_RETURN_STR(Boot_Keyboard_Output_Report)
+ CASE_RETURN_STR(Boot_Mouse_Input_Report)
+ CASE_RETURN_STR(Glucose_Measurement_Context)
+ CASE_RETURN_STR(Blood_Pressure_Measurement)
+ CASE_RETURN_STR(Intermediate_Cuff_Pressure)
+ CASE_RETURN_STR(Heart_Rate_Measurement)
+ CASE_RETURN_STR(Body_Sensor_Location)
+ CASE_RETURN_STR(Heart_Rate_Control_Point)
+ CASE_RETURN_STR(Alert_Status)
+ CASE_RETURN_STR(Ringer_Control_Point)
+ CASE_RETURN_STR(Ringer_Setting)
+ CASE_RETURN_STR(Alert_Category_Id_Bit_Mask)
+ CASE_RETURN_STR(Alert_Category_Id)
+ CASE_RETURN_STR(Alert_Notification_Control_Point)
+ CASE_RETURN_STR(Unread_Alert_Status)
+ CASE_RETURN_STR(New_Alert)
+ CASE_RETURN_STR(Supported_New_Alert_Category)
+ CASE_RETURN_STR(Supported_Unread_Alert_Category)
+ CASE_RETURN_STR(Blood_Pressure_Feature)
+ CASE_RETURN_STR(Hid_Information)
+ CASE_RETURN_STR(Report_Map)
+ CASE_RETURN_STR(Hid_Control_Point)
+ CASE_RETURN_STR(Report)
+ CASE_RETURN_STR(Protocol_Mode)
+ CASE_RETURN_STR(Scan_Interval_Window)
+ CASE_RETURN_STR(Pnp_Id)
+ CASE_RETURN_STR(Glucose_Feature)
+ CASE_RETURN_STR(Record_Access_Control_Point)
+ CASE_RETURN_STR(Rsc_Measurement)
+ CASE_RETURN_STR(Rsc_Feature)
+ CASE_RETURN_STR(Sc_Control_Point)
+ CASE_RETURN_STR(Digital)
+ CASE_RETURN_STR(Analog)
+ CASE_RETURN_STR(Aggregate)
+ CASE_RETURN_STR(Csc_Measurement)
+ CASE_RETURN_STR(Csc_Feature)
+ CASE_RETURN_STR(Sensor_Location)
+ CASE_RETURN_STR(Plx_Spot_Check_Measurement)
+ CASE_RETURN_STR(Plx_Continuous_Measurement)
+ CASE_RETURN_STR(Plx_Features)
+ CASE_RETURN_STR(Cycling_Power_Measurement)
+ CASE_RETURN_STR(Cycling_Power_Vector)
+ CASE_RETURN_STR(Cycling_Power_Feature)
+ CASE_RETURN_STR(Cycling_Power_Control_Point)
+ CASE_RETURN_STR(Location_And_Speed)
+ CASE_RETURN_STR(Navigation)
+ CASE_RETURN_STR(Position_Quality)
+ CASE_RETURN_STR(Ln_Feature)
+ CASE_RETURN_STR(Ln_Control_Point)
+ CASE_RETURN_STR(Elevation)
+ CASE_RETURN_STR(Pressure)
+ CASE_RETURN_STR(Temperature)
+ CASE_RETURN_STR(Humidity)
+ CASE_RETURN_STR(True_Wind_Speed)
+ CASE_RETURN_STR(True_Wind_Direction)
+ CASE_RETURN_STR(Apparent_Wind_Speed)
+ CASE_RETURN_STR(Apparent_Wind_Direction)
+ CASE_RETURN_STR(Gust_Factor)
+ CASE_RETURN_STR(Pollen_Concentration)
+ CASE_RETURN_STR(Uv_Index)
+ CASE_RETURN_STR(Irradiance)
+ CASE_RETURN_STR(Rainfall)
+ CASE_RETURN_STR(Wind_Chill)
+ CASE_RETURN_STR(Heat_Index)
+ CASE_RETURN_STR(Dew_Point)
+ CASE_RETURN_STR(Descriptor_Value_Changed)
+ CASE_RETURN_STR(Aerobic_Threshold)
+ CASE_RETURN_STR(Age)
+ CASE_RETURN_STR(Anaerobic_Heart_Rate_Lower_Limit)
+ CASE_RETURN_STR(Anaerobic_Heart_Rate_Upper_Limit)
+ CASE_RETURN_STR(Anaerobic_Threshold)
+ CASE_RETURN_STR(Aerobic_Heart_Rate_Upper_Limit)
+ CASE_RETURN_STR(Date_Of_Birth)
+ CASE_RETURN_STR(Date_Of_Threshold_Assessment)
+ CASE_RETURN_STR(Email_Address)
+ CASE_RETURN_STR(Fat_Burn_Heart_Rate_Lower_Limit)
+ CASE_RETURN_STR(Fat_Burn_Heart_Rate_Upper_Limit)
+ CASE_RETURN_STR(First_Name)
+ CASE_RETURN_STR(Five_Zone_Heart_Rate_Limits)
+ CASE_RETURN_STR(Gender)
+ CASE_RETURN_STR(Heart_Rate_Max)
+ CASE_RETURN_STR(Height)
+ CASE_RETURN_STR(Hip_Circumference)
+ CASE_RETURN_STR(Last_Name)
+ CASE_RETURN_STR(Maximum_Recommended_Heart_Rate)
+ CASE_RETURN_STR(Resting_Heart_Rate)
+ CASE_RETURN_STR(Sport_Type_For_Aerobic_And_Anaerobic_Thresholds)
+ CASE_RETURN_STR(Three_Zone_Heart_Rate_Limits)
+ CASE_RETURN_STR(Two_Zone_Heart_Rate_Limit)
+ CASE_RETURN_STR(Vo2_Max)
+ CASE_RETURN_STR(Waist_Circumference)
+ CASE_RETURN_STR(Weight)
+ CASE_RETURN_STR(Database_Change_Increment)
+ CASE_RETURN_STR(User_Index)
+ CASE_RETURN_STR(Body_Composition_Feature)
+ CASE_RETURN_STR(Body_Composition_Measurement)
+ CASE_RETURN_STR(Weight_Measurement)
+ CASE_RETURN_STR(Weight_Scale_Feature)
+ CASE_RETURN_STR(User_Control_Point)
+ CASE_RETURN_STR(Magnetic_Flux_Density_2D)
+ CASE_RETURN_STR(Magnetic_Flux_Density_3D)
+ CASE_RETURN_STR(Language)
+ CASE_RETURN_STR(Barometric_Pressure_Trend)
+ CASE_RETURN_STR(Bond_Management_Control_Point)
+ CASE_RETURN_STR(Bond_Management_Feature)
+ CASE_RETURN_STR(Gap_Central_Address_Resolution_Support)
+ CASE_RETURN_STR(Cgm_Measurement)
+ CASE_RETURN_STR(Cgm_Feature)
+ CASE_RETURN_STR(Cgm_Status)
+ CASE_RETURN_STR(Cgm_Session_Start_Time)
+ CASE_RETURN_STR(Cgm_Session_Run_Time)
+ CASE_RETURN_STR(Cgm_Specific_Ops_Control_Point)
+ CASE_RETURN_STR(Indoor_Positioning_Configuration)
+ CASE_RETURN_STR(Latitude)
+ CASE_RETURN_STR(Longitude)
+ CASE_RETURN_STR(Local_North_Coordinate)
+ CASE_RETURN_STR(Local_East_Coordinate)
+ CASE_RETURN_STR(Floor_Number)
+ CASE_RETURN_STR(Altitude)
+ CASE_RETURN_STR(Uncertainty)
+ CASE_RETURN_STR(Location_Name)
+ CASE_RETURN_STR(Uri)
+ CASE_RETURN_STR(Http_Headers)
+ CASE_RETURN_STR(Http_Status_Code)
+ CASE_RETURN_STR(Http_Entity_Body)
+ CASE_RETURN_STR(Http_Control_Point)
+ CASE_RETURN_STR(Https_Security)
+ CASE_RETURN_STR(Tds_Control_Point)
+ CASE_RETURN_STR(Ots_Feature)
+ CASE_RETURN_STR(Object_Name)
+ CASE_RETURN_STR(Object_Type)
+ CASE_RETURN_STR(Object_Size)
+ CASE_RETURN_STR(Object_First_Created)
+ CASE_RETURN_STR(Object_Last_Modified)
+ CASE_RETURN_STR(Object_Id)
+ CASE_RETURN_STR(Object_Properties)
+ CASE_RETURN_STR(Object_Action_Control_Point)
+ CASE_RETURN_STR(Object_List_Control_Point)
+ CASE_RETURN_STR(Object_List_Filter)
+ CASE_RETURN_STR(Object_Changed)
+ CASE_RETURN_STR(Fitness_Machine_Control_Point)
+ CASE_RETURN_STR(Gatt_Characteristic_Extended_Properties)
+ CASE_RETURN_STR(Gatt_Characteristic_User_Description)
+ CASE_RETURN_STR(Gatt_Client_Characteristic_Configuration)
+ CASE_RETURN_STR(Gatt_Server_Characteristic_Configuration)
+ CASE_RETURN_STR(Gatt_Characteristic_Presentation_Format)
+ CASE_RETURN_STR(Gatt_Characteristic_Aggregate_Format)
+ CASE_RETURN_STR(Valid_Range)
+ CASE_RETURN_STR(External_Report_Reference)
+ CASE_RETURN_STR(Report_Reference)
+ CASE_RETURN_STR(Number_Of_Digitals)
+ CASE_RETURN_STR(Value_Trigger_Setting)
+ CASE_RETURN_STR(Es_Configuration)
+ CASE_RETURN_STR(Es_Measurement)
+ CASE_RETURN_STR(Es_Trigger_Setting)
+ CASE_RETURN_STR(Time_Trigger_Setting)
+ CASE_RETURN_STR(Gatt_Primary_Service_Declaration)
+ CASE_RETURN_STR(Gatt_Secondary_Service_Declaration)
+ CASE_RETURN_STR(Gatt_Include_Declaration)
+ CASE_RETURN_STR(Gatt_Characteristic_Declaration)
+ default:
+ return "--";
+ }
}
const char *enum_defines(void *v, int i)
const char* bt_scan_mode_t2str(bt_scan_mode_t scan_mode)
{
- switch(scan_mode) {
+ switch (scan_mode) {
case BT_SCAN_MODE_NONE:
return "Non Scannable";
case BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE:
void send_event_bda_trace(oal_event_t event, gpointer event_data, gsize len, bt_address_t *address)
{
- if(event != OAL_EVENT_BLE_REMOTE_DEVICE_FOUND) {
- if(address) {
+ if (event != OAL_EVENT_BLE_REMOTE_DEVICE_FOUND) {
+ if (address) {
bdstr_t bdstr;
EVENT_TRACE("[%s] %s", bdt_bd2str(address, &bdstr), str_event[event]);
} else
/** Bluetooth Address */
typedef struct {
- uint8_t address[6];
+ uint8_t address[6];
} __attribute__((packed))bt_bdaddr_t;
/** Bluetooth Device Name */
typedef struct {
- uint8_t name[249];
+ uint8_t name[249];
} __attribute__((packed))bt_bdname_t;
/** Bluetooth Adapter Visibility Modes*/
typedef enum {
- BT_SCAN_MODE_NONE,
- BT_SCAN_MODE_CONNECTABLE,
- BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
+ BT_SCAN_MODE_NONE,
+ BT_SCAN_MODE_CONNECTABLE,
+ BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
} bt_scan_mode_t;
/** Bluetooth Adapter State */
typedef enum {
- BT_STATE_OFF,
- BT_STATE_ON
+ BT_STATE_OFF,
+ BT_STATE_ON
} bt_state_t;
/** Bluetooth Error Status */
/** We need to build on this */
typedef enum {
- BT_STATUS_SUCCESS,
- BT_STATUS_FAIL,
- BT_STATUS_NOT_READY,
- BT_STATUS_NOMEM,
- BT_STATUS_BUSY,
- BT_STATUS_DONE, /* request already completed */
- BT_STATUS_UNSUPPORTED,
- BT_STATUS_PARM_INVALID,
- BT_STATUS_UNHANDLED,
- BT_STATUS_AUTH_FAILURE,
- BT_STATUS_RMT_DEV_DOWN,
- BT_STATUS_AUTH_REJECTED
+ BT_STATUS_SUCCESS,
+ BT_STATUS_FAIL,
+ BT_STATUS_NOT_READY,
+ BT_STATUS_NOMEM,
+ BT_STATUS_BUSY,
+ BT_STATUS_DONE, /* request already completed */
+ BT_STATUS_UNSUPPORTED,
+ BT_STATUS_PARM_INVALID,
+ BT_STATUS_UNHANDLED,
+ BT_STATUS_AUTH_FAILURE,
+ BT_STATUS_RMT_DEV_DOWN,
+ BT_STATUS_AUTH_REJECTED
} bt_status_t;
/** Bluetooth PinKey Code */
typedef struct {
- uint8_t pin[16];
+ uint8_t pin[16];
} __attribute__((packed))bt_pin_code_t;
typedef struct {
- uint8_t status;
- uint8_t ctrl_state; /* stack reported state */
- uint64_t tx_time; /* in ms */
- uint64_t rx_time; /* in ms */
- uint64_t idle_time; /* in ms */
- uint64_t energy_used; /* a product of mA, V and ms */
+ uint8_t status;
+ uint8_t ctrl_state; /* stack reported state */
+ uint64_t tx_time; /* in ms */
+ uint64_t rx_time; /* in ms */
+ uint64_t idle_time; /* in ms */
+ uint64_t energy_used; /* a product of mA, V and ms */
} __attribute__((packed))bt_activity_energy_info;
/** Bluetooth Adapter Discovery state */
typedef enum {
- BT_DISCOVERY_STOPPED,
- BT_DISCOVERY_STARTED
+ BT_DISCOVERY_STOPPED,
+ BT_DISCOVERY_STARTED
} bt_discovery_state_t;
/** Bluetooth ACL connection state */
typedef enum {
- BT_ACL_STATE_CONNECTED,
- BT_ACL_STATE_DISCONNECTED
+ BT_ACL_STATE_CONNECTED,
+ BT_ACL_STATE_DISCONNECTED
} bt_acl_state_t;
/** Remote Device Trusted state */
typedef enum {
- BT_DEVICE_TRUSTED,
- BT_DEVICE_NOT_TRUSTED
+ BT_DEVICE_TRUSTED,
+ BT_DEVICE_NOT_TRUSTED
} bt_device_trust_state_t;
/** Bluetooth 128-bit UUID */
typedef struct {
- uint8_t uu[16];
+ uint8_t uu[16];
} bt_uuid_t;
/** Bluetooth SDP service record */
-typedef struct
-{
- bt_uuid_t uuid;
- uint16_t channel;
- char name[256]; // what's the maximum length
+typedef struct {
+ bt_uuid_t uuid;
+ uint16_t channel;
+ char name[256]; // what's the maximum length
} bt_service_record_t;
/** Bluetooth Remote Version info */
-typedef struct
-{
- int version;
- int sub_ver;
- int manufacturer;
+typedef struct {
+ int version;
+ int sub_ver;
+ int manufacturer;
} bt_remote_version_t;
-typedef struct
-{
- uint8_t local_privacy_enabled;
- uint8_t max_adv_instance;
- uint8_t rpa_offload_supported;
- uint8_t max_irk_list_size;
- uint8_t max_adv_filter_supported;
- uint8_t scan_result_storage_size_lobyte;
- uint8_t scan_result_storage_size_hibyte;
- uint8_t activity_energy_info_supported;
-}bt_local_le_features_t;
+typedef struct {
+ uint8_t local_privacy_enabled;
+ uint8_t max_adv_instance;
+ uint8_t rpa_offload_supported;
+ uint8_t max_irk_list_size;
+ uint8_t max_adv_filter_supported;
+ uint8_t scan_result_storage_size_lobyte;
+ uint8_t scan_result_storage_size_hibyte;
+ uint8_t activity_energy_info_supported;
+} bt_local_le_features_t;
/* Bluetooth Adapter and Remote Device property types */
typedef enum {
BT_PROPERTY_MODALIAS,
/**
- * Description - BLE Device manufacturer data length
- * Access mode - GET
- * Data type - uint32_t
- */
- BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN,
+ * Description - BLE Device manufacturer data length
+ * Access mode - GET
+ * Data type - uint32_t
+ */
+ BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN,
- /**
- * Description - BLE Device manufacturer data
- * Access mode - GET
- * Data type - Array of character string
- */
- BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA,
+ /**
+ * Description - BLE Device manufacturer data
+ * Access mode - GET
+ * Data type - Array of character string
+ */
+ BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA,
/**
- * Description - Remote BLE advertising data
- * Access mode - Only received during device found callback.
- * Data type - Array of uint8_t of remote BLE adv data.
- * (Array size inferred from property length).
- */
- BT_PROPERTY_REMOTE_BLE_ADV_DATA,
+ * Description - Remote BLE advertising data
+ * Access mode - Only received during device found callback.
+ * Data type - Array of uint8_t of remote BLE adv data.
+ * (Array size inferred from property length).
+ */
+ BT_PROPERTY_REMOTE_BLE_ADV_DATA,
/**
* Description - Local LE features
} bt_property_type_t;
/** Bluetooth Adapter Property data structure */
-typedef struct
-{
- bt_property_type_t type;
- int len;
- void *val;
+typedef struct {
+ bt_property_type_t type;
+ int len;
+ void *val;
} bt_property_t;
/** Bluetooth Device Type */
typedef enum {
- BT_DEVICE_DEVTYPE_BREDR = 0x1,
- BT_DEVICE_DEVTYPE_BLE,
- BT_DEVICE_DEVTYPE_DUAL
+ BT_DEVICE_DEVTYPE_BREDR = 0x1,
+ BT_DEVICE_DEVTYPE_BLE,
+ BT_DEVICE_DEVTYPE_DUAL
} bt_device_type_t;
/** Bluetooth Bond state */
typedef enum {
- BT_BOND_STATE_NONE,
- BT_BOND_STATE_BONDING,
- BT_BOND_STATE_BONDED
+ BT_BOND_STATE_NONE,
+ BT_BOND_STATE_BONDING,
+ BT_BOND_STATE_BONDED
} bt_bond_state_t;
/** Bluetooth SSP Bonding Variant */
typedef enum {
- BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
- BT_SSP_VARIANT_PASSKEY_ENTRY,
- BT_SSP_VARIANT_CONSENT,
- BT_SSP_VARIANT_PASSKEY_NOTIFICATION
+ BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+ BT_SSP_VARIANT_PASSKEY_ENTRY,
+ BT_SSP_VARIANT_CONSENT,
+ BT_SSP_VARIANT_PASSKEY_NOTIFICATION
} bt_ssp_variant_t;
/** Bluetooth Profile Service IDs */
typedef enum {
- BT_RES_SERVICE_ID, /* Reserved */
- BT_SPP_SERVICE_ID, /* Serial port profile. */
- BT_DUN_SERVICE_ID, /* Dial-up networking profile. */
- BT_A2DP_SRC_SERVICE_ID, /* A2DP Source profile. */
- BT_LAP_SERVICE_ID, /* LAN access profile. */
- BT_HSP_SERVICE_ID, /* Headset profile. */
- BT_HFP_SERVICE_ID, /* Hands-free profile. */
- BT_OPP_SERVICE_ID, /* Object push */
- BT_FTP_SERVICE_ID, /* File transfer */
- BT_AVRCP_CT_SERVICE_ID, /* AVRC Controller Terminal */
- BT_ICP_SERVICE_ID, /* Intercom Terminal */
- BT_SYNC_SERVICE_ID, /* Synchronization */
- BT_BPP_SERVICE_ID, /* Basic printing profile */
- BT_BIP_SERVICE_ID, /* Basic Imaging profile */
- BT_PANU_SERVICE_ID, /* PAN User */
- BT_NAP_SERVICE_ID, /* PAN Network access point */
- BT_GN_SERVICE_ID, /* PAN Group Ad-hoc networks */
- BT_SAP_SERVICE_ID, /* SIM Access profile */
- BT_A2DP_SERVICE_ID, /* A2DP Sink */
- BT_AVRCP_SERVICE_ID, /* A/V remote control */
- BT_HID_SERVICE_ID, /* HID */
- BT_VDP_SERVICE_ID, /* Video distribution */
- BT_PBAP_SERVICE_ID, /* PhoneBook Access Server*/
- BT_HSP_HS_SERVICE_ID, /* HFP HS role */
- BT_HFP_HS_SERVICE_ID, /* HSP HS role */
- BT_MAP_SERVICE_ID, /* Message Access Profile */
- BT_MN_SERVICE_ID, /* Message Notification Service */
- BT_HDP_SERVICE_ID, /* Health Device Profile */
- BT_PCE_SERVICE_ID, /* PhoneBook Access Client*/
+ BT_RES_SERVICE_ID, /* Reserved */
+ BT_SPP_SERVICE_ID, /* Serial port profile. */
+ BT_DUN_SERVICE_ID, /* Dial-up networking profile. */
+ BT_A2DP_SRC_SERVICE_ID, /* A2DP Source profile. */
+ BT_LAP_SERVICE_ID, /* LAN access profile. */
+ BT_HSP_SERVICE_ID, /* Headset profile. */
+ BT_HFP_SERVICE_ID, /* Hands-free profile. */
+ BT_OPP_SERVICE_ID, /* Object push */
+ BT_FTP_SERVICE_ID, /* File transfer */
+ BT_AVRCP_CT_SERVICE_ID, /* AVRC Controller Terminal */
+ BT_ICP_SERVICE_ID, /* Intercom Terminal */
+ BT_SYNC_SERVICE_ID, /* Synchronization */
+ BT_BPP_SERVICE_ID, /* Basic printing profile */
+ BT_BIP_SERVICE_ID, /* Basic Imaging profile */
+ BT_PANU_SERVICE_ID, /* PAN User */
+ BT_NAP_SERVICE_ID, /* PAN Network access point */
+ BT_GN_SERVICE_ID, /* PAN Group Ad-hoc networks */
+ BT_SAP_SERVICE_ID, /* SIM Access profile */
+ BT_A2DP_SERVICE_ID, /* A2DP Sink */
+ BT_AVRCP_SERVICE_ID, /* A/V remote control */
+ BT_HID_SERVICE_ID, /* HID */
+ BT_VDP_SERVICE_ID, /* Video distribution */
+ BT_PBAP_SERVICE_ID, /* PhoneBook Access Server*/
+ BT_HSP_HS_SERVICE_ID, /* HFP HS role */
+ BT_HFP_HS_SERVICE_ID, /* HSP HS role */
+ BT_MAP_SERVICE_ID, /* Message Access Profile */
+ BT_MN_SERVICE_ID, /* Message Notification Service */
+ BT_HDP_SERVICE_ID, /* Health Device Profile */
+ BT_PCE_SERVICE_ID, /* PhoneBook Access Client*/
#ifdef TIZEN_BT_HAL
- BT_IOTIVITY_SERVICE_ID, /* Custom IOTIVITY UUID */
+ BT_IOTIVITY_SERVICE_ID, /* Custom IOTIVITY UUID */
#endif
} bt_service_id_t;
/* Tizen BT discovery Types */
typedef enum {
- BT_DISC_ROLE_BREDR = 0x01,
- BT_DISC_ROLE_LE,
- BT_DISC_ROLE_DUAL
+ BT_DISC_ROLE_BREDR = 0x01,
+ BT_DISC_ROLE_LE,
+ BT_DISC_ROLE_DUAL
} bt_disc_role_type_t;
/** Bluetooth Trusted Profiles */
/** Bluetooth Bonding Authentication Notifications */
typedef enum {
- BT_PASSKEY_CONFIRMATION = 1,
- BT_PASSKEY_DISPLAY,
- BT_PASSKEY_ENTRY,
- BT_PINCODE_ENTRY,
+ BT_PASSKEY_CONFIRMATION = 1,
+ BT_PASSKEY_DISPLAY,
+ BT_PASSKEY_ENTRY,
+ BT_PINCODE_ENTRY,
} bt_gap_auth_variant_t;
#endif
* to manage sessions here.
*/
typedef void (*adapter_properties_callback)(bt_status_t status,
- int num_properties,
- bt_property_t *properties);
+ int num_properties,
+ bt_property_t *properties);
/** GET/SET Remote Device Properties callback */
/** TODO: For remote device properties, do not see a need to get/set
* multiple properties - num_properties shall be 1
*/
typedef void (*remote_device_properties_callback)(bt_status_t status,
- bt_bdaddr_t *bd_addr,
- int num_properties,
- bt_property_t *properties);
+ bt_bdaddr_t *bd_addr,
+ int num_properties,
+ bt_property_t *properties);
/** New device discovered callback */
/** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1
* respectively */
typedef void (*device_found_callback)(int num_properties,
- bt_property_t *properties);
+ bt_property_t *properties);
/** Discovery state changed callback */
typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state);
/** Bluetooth Legacy PinKey Request callback */
typedef void (*pin_request_callback)(bt_bdaddr_t *remote_bd_addr,
- bt_bdname_t *bd_name, uint32_t cod);
+ bt_bdname_t *bd_name, uint32_t cod);
/** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/
/** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT &
/* TODO: Passkey request callback shall not be needed for devices with display
* capability. We still need support this in the stack for completeness */
typedef void (*ssp_request_callback)(bt_bdaddr_t *remote_bd_addr,
- bt_bdname_t *bd_name,
- uint32_t cod,
- bt_ssp_variant_t pairing_variant,
- uint32_t pass_key);
+ bt_bdname_t *bd_name,
+ uint32_t cod,
+ bt_ssp_variant_t pairing_variant,
+ uint32_t pass_key);
/** Bluetooth Bond state changed callback */
/* Invoked in response to create_bond, cancel_bond or remove_bond */
typedef void (*bond_state_changed_callback)(bt_status_t status,
- bt_bdaddr_t *remote_bd_addr,
- bt_bond_state_t state);
+ bt_bdaddr_t *remote_bd_addr,
+ bt_bond_state_t state);
/** Bluetooth ACL connection state changed callback */
typedef void (*acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
- bt_acl_state_t state);
+ bt_acl_state_t state);
typedef enum {
- ASSOCIATE_JVM,
- DISASSOCIATE_JVM
+ ASSOCIATE_JVM,
+ DISASSOCIATE_JVM
} bt_cb_thread_evt;
/** Thread Associate/Disassociate JVM Callback */
typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len);
/* LE Test mode callbacks
-* This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
-* The num_packets is valid only for le_test_end command */
+ * This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
+ * The num_packets is valid only for le_test_end command */
typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets);
/** Callback invoked when energy details are obtained */
/** Bluetooth ACL connection state */
typedef enum {
- BT_LE_CONN_STATE_CONNECTED,
- BT_LE_CONN_STATE_DISCONNECTED
+ BT_LE_CONN_STATE_CONNECTED,
+ BT_LE_CONN_STATE_DISCONNECTED
} bt_le_conn_state_t;
/** Bluetooth ACL connection state changed callback */
#endif
/** TODO: Add callbacks for Link Up/Down and other generic
- * notifications/callbacks */
+ * notifications/callbacks */
/** Remote Device Trust state changed callback */
typedef void (*device_trust_state_changed_callback)(bt_bdaddr_t *remote_bd_addr,
- bt_device_trust_state_t trust);
+ bt_device_trust_state_t trust);
/** Bluetooth DM callback structure. */
typedef struct {
- /** set to sizeof(bt_callbacks_t) */
- size_t size;
- adapter_state_changed_callback adapter_state_changed_cb;
- adapter_properties_callback adapter_properties_cb;
- remote_device_properties_callback remote_device_properties_cb;
- device_found_callback device_found_cb;
- discovery_state_changed_callback discovery_state_changed_cb;
- pin_request_callback pin_request_cb;
- ssp_request_callback ssp_request_cb;
- bond_state_changed_callback bond_state_changed_cb;
- acl_state_changed_callback acl_state_changed_cb;
- callback_thread_event thread_evt_cb;
- dut_mode_recv_callback dut_mode_recv_cb;
- le_test_mode_callback le_test_mode_cb;
- energy_info_callback energy_info_cb;
- authorize_request_callback authorize_request_cb;
- device_trust_state_changed_callback device_trust_state_changed_cb;
+ /** set to sizeof(bt_callbacks_t) */
+ size_t size;
+ adapter_state_changed_callback adapter_state_changed_cb;
+ adapter_properties_callback adapter_properties_cb;
+ remote_device_properties_callback remote_device_properties_cb;
+ device_found_callback device_found_cb;
+ discovery_state_changed_callback discovery_state_changed_cb;
+ pin_request_callback pin_request_cb;
+ ssp_request_callback ssp_request_cb;
+ bond_state_changed_callback bond_state_changed_cb;
+ acl_state_changed_callback acl_state_changed_cb;
+ callback_thread_event thread_evt_cb;
+ dut_mode_recv_callback dut_mode_recv_cb;
+ le_test_mode_callback le_test_mode_cb;
+ energy_info_callback energy_info_cb;
+ authorize_request_callback authorize_request_cb;
+ device_trust_state_changed_callback device_trust_state_changed_cb;
#ifdef TIZEN_BT_HAL
- sock_authorize_request_callback socket_authorize_request_cb;
+ sock_authorize_request_callback socket_authorize_request_cb;
le_state_changed_callback le_state_changed_cb;
le_conn_state_changed_callback le_conn_state_changed_cb;
device_trusted_profiles_changed_callback device_trusted_profiles_changed_cb;
typedef int (*release_wake_lock_callout)(const char *lock_name);
/** The set of functions required by bluedroid to set wake alarms and
- * grab wake locks. This struct is passed into the stack through the
- * |set_os_callouts| function on |bt_interface_t|.
- */
+ * grab wake locks. This struct is passed into the stack through the
+ * |set_os_callouts| function on |bt_interface_t|.
+ */
typedef struct {
- /* set to sizeof(bt_os_callouts_t) */
- size_t size;
+ /* set to sizeof(bt_os_callouts_t) */
+ size_t size;
- set_wake_alarm_callout set_wake_alarm;
- acquire_wake_lock_callout acquire_wake_lock;
- release_wake_lock_callout release_wake_lock;
+ set_wake_alarm_callout set_wake_alarm;
+ acquire_wake_lock_callout acquire_wake_lock;
+ release_wake_lock_callout release_wake_lock;
} bt_os_callouts_t;
/** NOTE: By default, no profiles are initialized at the time of init/enable.
/** Represents the standard Bluetooth DM interface. */
typedef struct {
- /** set to sizeof(bt_interface_t) */
- size_t size;
- /**
- * Opens the interface and provides the callback routines
- * to the implemenation of this interface.
- */
- int (*init)(bt_callbacks_t* callbacks );
+ /** set to sizeof(bt_interface_t) */
+ size_t size;
+ /**
+ * Opens the interface and provides the callback routines
+ * to the implemenation of this interface.
+ */
+ int (*init)(bt_callbacks_t*callbacks);
- /** Enable Bluetooth. */
- int (*enable)(void);
+ /** Enable Bluetooth. */
+ int (*enable)(void);
- /** Disable Bluetooth. */
- int (*disable)(void);
+ /** Disable Bluetooth. */
+ int (*disable)(void);
#ifdef TIZEN_BT_HAL
- /** Reset Bluetooth. */
- int (*reset)(void);
+ /** Reset Bluetooth. */
+ int (*reset)(void);
#endif
#ifdef TIZEN_BT_HAL
- /** Enable LE Bluetooth. */
- int (*le_enable)(void);
+ /** Enable LE Bluetooth. */
+ int (*le_enable)(void);
- /** Disable LE Bluetooth. */
- int (*le_disable)(void);
+ /** Disable LE Bluetooth. */
+ int (*le_disable)(void);
- int (*le_init)(void);
+ int (*le_init)(void);
- void (*le_deinit)(void);
+ void (*le_deinit)(void);
#endif
- /** Closes the interface. */
- void (*cleanup)(void);
+ /** Closes the interface. */
+ void (*cleanup)(void);
#ifdef TIZEN_BT_HAL
- /** Get Bluetooth Adapter Powered status */
- int (*get_adapter_powered_status)(uint8_t *status);
+ /** Get Bluetooth Adapter Powered status */
+ int (*get_adapter_powered_status)(uint8_t *status);
#endif
- /** Get all Bluetooth Adapter properties at init */
- int (*get_adapter_properties)(void);
+ /** Get all Bluetooth Adapter properties at init */
+ int (*get_adapter_properties)(void);
- /** Get Bluetooth Adapter property of 'type' */
- int (*get_adapter_property)(bt_property_type_t type);
+ /** Get Bluetooth Adapter property of 'type' */
+ int (*get_adapter_property)(bt_property_type_t type);
- /** Set Bluetooth Adapter property of 'type' */
- /* Based on the type, val shall be one of
- * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc
- */
- int (*set_adapter_property)(const bt_property_t *property);
+ /** Set Bluetooth Adapter property of 'type' */
+ /* Based on the type, val shall be one of
+ * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc
+ */
+ int (*set_adapter_property)(const bt_property_t *property);
- /** Get all Remote Device properties */
- int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
+ /** Get all Remote Device properties */
+ int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
- /** Get Remote Device property of 'type' */
- int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
- bt_property_type_t type);
+ /** Get Remote Device property of 'type' */
+ int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
+ bt_property_type_t type);
- /** Set Remote Device property of 'type' */
- int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
- const bt_property_t *property);
+ /** Set Remote Device property of 'type' */
+ int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
+ const bt_property_t *property);
- /** Get Remote Device's service record for the given UUID */
- int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
- bt_uuid_t *uuid);
+ /** Get Remote Device's service record for the given UUID */
+ int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
+ bt_uuid_t *uuid);
- /** Start SDP to get remote services */
- int (*get_remote_services)(bt_bdaddr_t *remote_addr);
+ /** Start SDP to get remote services */
+ int (*get_remote_services)(bt_bdaddr_t *remote_addr);
- /** Start Discovery */
- int (*start_discovery)(void);
+ /** Start Discovery */
+ int (*start_discovery)(void);
#ifdef TIZEN_BT_HAL
- int (*start_custom_discovery)(bt_disc_role_type_t disc_type);
+ int (*start_custom_discovery)(bt_disc_role_type_t disc_type);
#endif
- /** Cancel Discovery */
- int (*cancel_discovery)(void);
-
- /** Create Bluetooth Bonding */
- int (*create_bond)(const bt_bdaddr_t *bd_addr, int transport);
-
- /** Remove Bond */
- int (*remove_bond)(const bt_bdaddr_t *bd_addr);
-
- /** Cancel Bond */
- int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
-
- /**
- * Get the connection status for a given remote device.
- * return value of 0 means the device is not connected,
- * non-zero return status indicates an active connection.
- */
- int (*get_connection_state)(const bt_bdaddr_t *bd_addr);
-
- /** BT Legacy PinKey Reply */
- /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */
- int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
- uint8_t pin_len, bt_pin_code_t *pin_code);
-
- /** BT SSP Reply - Just Works, Numeric Comparison and Passkey
- * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON &
- * BT_SSP_VARIANT_CONSENT
- * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey
- * shall be zero */
- int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
- uint8_t accept, uint32_t passkey);
-
- /** Get Bluetooth profile interface */
- const void* (*get_profile_interface) (const char *profile_id);
-
- /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */
- /* Configure DUT Mode - Use this mode to enter/exit DUT mode */
- int (*dut_mode_configure)(uint8_t enable);
-
- /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
- int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
- /** BLE Test Mode APIs */
- /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
- int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
-
- /* enable or disable bluetooth HCI snoop log */
- int (*config_hci_snoop_log)(uint8_t enable);
-
- /** Sets the OS call-out functions that bluedroid needs for alarms and wake locks.
- * This should be called immediately after a successful |init|.
- */
- int (*set_os_callouts)(bt_os_callouts_t *callouts);
-
- /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or BT_STATUS_NOT_READY
- * Success indicates that the VSC command was sent to controller
- */
- int (*read_energy_info)();
-
- /* Tizen Specific: Send service level Authorization response */
- int (*authorize_response)(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
- uint8_t authorize, uint8_t save_settings);
-
- /** Set auto authorization for peer device. Should be a paired device */
- int (*set_authorization)(bt_bdaddr_t *bd_addr, uint8_t auth);
+ /** Cancel Discovery */
+ int (*cancel_discovery)(void);
+
+ /** Create Bluetooth Bonding */
+ int (*create_bond)(const bt_bdaddr_t *bd_addr, int transport);
+
+ /** Remove Bond */
+ int (*remove_bond)(const bt_bdaddr_t *bd_addr);
+
+ /** Cancel Bond */
+ int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
+
+ /**
+ * Get the connection status for a given remote device.
+ * return value of 0 means the device is not connected,
+ * non-zero return status indicates an active connection.
+ */
+ int (*get_connection_state)(const bt_bdaddr_t *bd_addr);
+
+ /** BT Legacy PinKey Reply */
+ /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */
+ int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
+ uint8_t pin_len, bt_pin_code_t *pin_code);
+
+ /** BT SSP Reply - Just Works, Numeric Comparison and Passkey
+ * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON &
+ * BT_SSP_VARIANT_CONSENT
+ * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey
+ * shall be zero */
+ int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
+ uint8_t accept, uint32_t passkey);
+
+ /** Get Bluetooth profile interface */
+ const void* (*get_profile_interface) (const char *profile_id);
+
+ /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */
+ /* Configure DUT Mode - Use this mode to enter/exit DUT mode */
+ int (*dut_mode_configure)(uint8_t enable);
+
+ /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
+ int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
+ /** BLE Test Mode APIs */
+ /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
+ int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
+
+ /* enable or disable bluetooth HCI snoop log */
+ int (*config_hci_snoop_log)(uint8_t enable);
+
+ /** Sets the OS call-out functions that bluedroid needs for alarms and wake locks.
+ * This should be called immediately after a successful |init|.
+ */
+ int (*set_os_callouts)(bt_os_callouts_t *callouts);
+
+ /** Read Energy info details - return value indicates BT_STATUS_SUCCESS or BT_STATUS_NOT_READY
+ * Success indicates that the VSC command was sent to controller
+ */
+ int (*read_energy_info)();
+
+ /* Tizen Specific: Send service level Authorization response */
+ int (*authorize_response)(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
+ uint8_t authorize, uint8_t save_settings);
+
+ /** Set auto authorization for peer device. Should be a paired device */
+ int (*set_authorization)(bt_bdaddr_t *bd_addr, uint8_t auth);
#ifdef TIZEN_BT_HAL
- /**
- * get the service connection status for a given remote device.
- * return value of 0 means the device is not connected,
- * non-zero return status indicates an active connection.
- */
- int (*get_service_connection_state)(const bt_bdaddr_t *bd_addr, bt_service_id_t rem_svc_id);
-
- /*
- * Enable/Disable osp server in gap agent.
- * enable == 0/1 -> Register/Unregister osp server.
- */
- int (*set_agent_osp_server)(uint32_t type, uint8_t enable);
-
- /**
- * Set profile as trusted for remote device
- */
- int (*set_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint8_t trust);
-
- /**
- * Get profile trusted status for remote device
- */
- int (*get_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint32_t *trusted);
-
- /**
- * Get raw RSSI strength of remote device for connected link type
- * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
- */
- int (*get_connected_link_rssi_strength)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type);
-
- /**
- * Enable RSSI monitoring of remote device for connected link type
- * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
- * Threshold : (low_threshold, in_range_threshold, high_threshold)
- */
- int (*enable_rssi_monitoring)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type,
- int low_threshold, int in_range_threshold, int high_threshold);
- /*
- * Enable/Disable GAP authentication notification to application
- * enable == 0/1 -> Enable/Disable notification sending
- * type == value from bt_gap_auth_variant_t
- */
- int (*enable_gap_auth_notifications)(uint32_t type, uint8_t enable);
+ /**
+ * get the service connection status for a given remote device.
+ * return value of 0 means the device is not connected,
+ * non-zero return status indicates an active connection.
+ */
+ int (*get_service_connection_state)(const bt_bdaddr_t *bd_addr, bt_service_id_t rem_svc_id);
+
+ /*
+ * Enable/Disable osp server in gap agent.
+ * enable == 0/1 -> Register/Unregister osp server.
+ */
+ int (*set_agent_osp_server)(uint32_t type, uint8_t enable);
+
+ /**
+ * Set profile as trusted for remote device
+ */
+ int (*set_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint8_t trust);
+
+ /**
+ * Get profile trusted status for remote device
+ */
+ int (*get_trusted_profile)(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint32_t *trusted);
+
+ /**
+ * Get raw RSSI strength of remote device for connected link type
+ * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
+ */
+ int (*get_connected_link_rssi_strength)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type);
+
+ /**
+ * Enable RSSI monitoring of remote device for connected link type
+ * conn_link_type: (0 = BR/EDR link, 1 = LE link, 0xFF = Any (Default))
+ * Threshold : (low_threshold, in_range_threshold, high_threshold)
+ */
+ int (*enable_rssi_monitoring)(bt_bdaddr_t *bd_addr, uint32_t conn_link_type,
+ int low_threshold, int in_range_threshold, int high_threshold);
+ /*
+ * Enable/Disable GAP authentication notification to application
+ * enable == 0/1 -> Enable/Disable notification sending
+ * type == value from bt_gap_auth_variant_t
+ */
+ int (*enable_gap_auth_notifications)(uint32_t type, uint8_t enable);
#endif
} bt_interface_t;
/** TODO: Need to add APIs for Service Discovery, Service authorization and
- * connection management. Also need to add APIs for configuring
- * properties of remote bonded devices such as name, UUID etc. */
+ * connection management. Also need to add APIs for configuring
+ * properties of remote bonded devices such as name, UUID etc. */
typedef struct {
- struct hw_device_t common;
- const bt_interface_t* (*get_bluetooth_interface)();
+ struct hw_device_t common;
+ const bt_interface_t* (*get_bluetooth_interface)();
} bluetooth_device_t;
typedef bluetooth_device_t bluetooth_module_t;
/* Bluetooth AV connection states */
typedef enum {
- BTAV_CONNECTION_STATE_DISCONNECTED = 0,
- BTAV_CONNECTION_STATE_CONNECTING,
- BTAV_CONNECTION_STATE_CONNECTED,
- BTAV_CONNECTION_STATE_DISCONNECTING
+ BTAV_CONNECTION_STATE_DISCONNECTED = 0,
+ BTAV_CONNECTION_STATE_CONNECTING,
+ BTAV_CONNECTION_STATE_CONNECTED,
+ BTAV_CONNECTION_STATE_DISCONNECTING
} btav_connection_state_t;
/* Bluetooth AV datapath states */
typedef enum {
- BTAV_AUDIO_STATE_REMOTE_SUSPEND = 0,
- BTAV_AUDIO_STATE_STOPPED,
- BTAV_AUDIO_STATE_STARTED,
+ BTAV_AUDIO_STATE_REMOTE_SUSPEND = 0,
+ BTAV_AUDIO_STATE_STOPPED,
+ BTAV_AUDIO_STATE_STARTED,
} btav_audio_state_t;
/** Callback for connection state change.
* state will have one of the values from btav_connection_state_t
*/
-typedef void (* btav_connection_state_callback)(btav_connection_state_t state,
- bt_bdaddr_t *bd_addr);
+typedef void (*btav_connection_state_callback)(btav_connection_state_t state,
+ bt_bdaddr_t *bd_addr);
/** Callback for audiopath state change.
* state will have one of the values from btav_audio_state_t
*/
-typedef void (* btav_audio_state_callback)(btav_audio_state_t state,
- bt_bdaddr_t *bd_addr);
+typedef void (*btav_audio_state_callback)(btav_audio_state_t state,
+ bt_bdaddr_t *bd_addr);
/** Callback for audio configuration change.
* Used only for the A2DP sink interface.
* sample_rate: sample rate in Hz
* channel_count: number of channels (1 for mono, 2 for stereo)
*/
-typedef void (* btav_audio_config_callback)(bt_bdaddr_t *bd_addr,
- uint32_t sample_rate,
- uint8_t channel_count);
+typedef void (*btav_audio_config_callback)(bt_bdaddr_t *bd_addr,
+ uint32_t sample_rate,
+ uint8_t channel_count);
/** BT-AV callback structure. */
typedef struct {
- /** set to sizeof(btav_callbacks_t) */
- size_t size;
- btav_connection_state_callback connection_state_cb;
- btav_audio_state_callback audio_state_cb;
- btav_audio_config_callback audio_config_cb;
+ /** set to sizeof(btav_callbacks_t) */
+ size_t size;
+ btav_connection_state_callback connection_state_cb;
+ btav_audio_state_callback audio_state_cb;
+ btav_audio_config_callback audio_config_cb;
} btav_callbacks_t;
/**
*/
typedef struct {
- /** set to sizeof(btav_interface_t) */
- size_t size;
- /**
- * Register the BtAv callbacks
- */
- bt_status_t (*init)( btav_callbacks_t* callbacks );
+ /** set to sizeof(btav_interface_t) */
+ size_t size;
+ /**
+ * Register the BtAv callbacks
+ */
+ bt_status_t (*init)(btav_callbacks_t* callbacks);
- /** connect to headset */
- bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
+ /** connect to headset */
+ bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
- /** dis-connect from headset */
- bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
+ /** dis-connect from headset */
+ bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
- /** Closes the interface. */
- void (*cleanup)( void );
+ /** Closes the interface. */
+ void (*cleanup)(void);
} btav_interface_t;
__END_DECLS
/** BT-GATT callbacks */
typedef struct {
- /** Set to sizeof(btgatt_callbacks_t) */
- size_t size;
+ /** Set to sizeof(btgatt_callbacks_t) */
+ size_t size;
- /** GATT Client callbacks */
- const btgatt_client_callbacks_t* client;
+ /** GATT Client callbacks */
+ const btgatt_client_callbacks_t* client;
- /** GATT Server callbacks */
- const btgatt_server_callbacks_t* server;
+ /** GATT Server callbacks */
+ const btgatt_server_callbacks_t* server;
} btgatt_callbacks_t;
/** Represents the standard Bluetooth GATT interface. */
typedef struct {
- /** Set to sizeof(btgatt_interface_t) */
- size_t size;
+ /** Set to sizeof(btgatt_interface_t) */
+ size_t size;
- /**
- * Initializes the interface and provides callback routines
- */
- bt_status_t (*init)( const btgatt_callbacks_t* callbacks );
+ /**
+ * Initializes the interface and provides callback routines
+ */
+ bt_status_t (*init)(const btgatt_callbacks_t* callbacks);
- /** Closes the interface */
- void (*cleanup)( void );
+ /** Closes the interface */
+ void (*cleanup)(void);
- /** Pointer to the GATT client interface methods.*/
- const btgatt_client_interface_t* client;
+ /** Pointer to the GATT client interface methods.*/
+ const btgatt_client_interface_t* client;
- /** Pointer to the GATT server interface methods.*/
- const btgatt_server_interface_t* server;
+ /** Pointer to the GATT server interface methods.*/
+ const btgatt_server_interface_t* server;
} btgatt_interface_t;
__END_DECLS
#endif
/** Buffer type for unformatted reads/writes */
-typedef struct
-{
- uint8_t value[BTGATT_MAX_ATTR_LEN];
- uint16_t len;
+typedef struct {
+ uint8_t value[BTGATT_MAX_ATTR_LEN];
+ uint16_t len;
} btgatt_unformatted_value_t;
/** Parameters for GATT read operations */
-typedef struct
-{
- btgatt_srvc_id_t srvc_id;
- btgatt_gatt_id_t char_id;
- btgatt_gatt_id_t descr_id;
- btgatt_unformatted_value_t value;
- uint16_t value_type;
- uint8_t status;
+typedef struct {
+ btgatt_srvc_id_t srvc_id;
+ btgatt_gatt_id_t char_id;
+ btgatt_gatt_id_t descr_id;
+ btgatt_unformatted_value_t value;
+ uint16_t value_type;
+ uint8_t status;
} btgatt_read_params_t;
/** Parameters for GATT write operations */
-typedef struct
-{
- btgatt_srvc_id_t srvc_id;
- btgatt_gatt_id_t char_id;
- btgatt_gatt_id_t descr_id;
- uint8_t status;
+typedef struct {
+ btgatt_srvc_id_t srvc_id;
+ btgatt_gatt_id_t char_id;
+ btgatt_gatt_id_t descr_id;
+ uint8_t status;
} btgatt_write_params_t;
/** Attribute change notification parameters */
-typedef struct
-{
- uint8_t value[BTGATT_MAX_ATTR_LEN];
- bt_bdaddr_t bda;
- btgatt_srvc_id_t srvc_id;
- btgatt_gatt_id_t char_id;
- uint16_t len;
- uint8_t is_notify;
+typedef struct {
+ uint8_t value[BTGATT_MAX_ATTR_LEN];
+ bt_bdaddr_t bda;
+ btgatt_srvc_id_t srvc_id;
+ btgatt_gatt_id_t char_id;
+ uint16_t len;
+ uint8_t is_notify;
} btgatt_notify_params_t;
-typedef struct
-{
- bt_bdaddr_t *bda1;
- bt_uuid_t *uuid1;
- uint16_t u1;
- uint16_t u2;
- uint16_t u3;
- uint16_t u4;
- uint16_t u5;
+typedef struct {
+ bt_bdaddr_t *bda1;
+ bt_uuid_t *uuid1;
+ uint16_t u1;
+ uint16_t u2;
+ uint16_t u3;
+ uint16_t u4;
+ uint16_t u5;
} btgatt_test_params_t;
/** BT-GATT Client callback structure. */
/** Callback invoked in response to register_client */
typedef void (*register_client_callback)(int status, int client_if,
- bt_uuid_t *app_uuid);
+ bt_uuid_t *app_uuid);
/** Callback for scan results */
typedef void (*scan_result_callback)(bt_bdaddr_t* bda, int rssi, uint8_t* adv_data);
/** Callback invoked in response to close */
typedef void (*disconnect_callback)(int conn_id, int status,
- int client_if, bt_bdaddr_t* bda);
+ int client_if, bt_bdaddr_t* bda);
/**
* Invoked in response to search_service when the GATT service search
typedef void (*search_complete_callback)(int conn_id, int status);
/** Reports GATT services on a remote device */
-typedef void (*search_result_callback)( int conn_id, btgatt_srvc_id_t *srvc_id);
+typedef void (*search_result_callback)(int conn_id, btgatt_srvc_id_t *srvc_id);
/** GATT characteristic enumeration result callback */
typedef void (*get_characteristic_callback)(int conn_id, int status,
- btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
- int char_prop);
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ int char_prop);
/** GATT descriptor enumeration result callback */
typedef void (*get_descriptor_callback)(int conn_id, int status,
- btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
- btgatt_gatt_id_t *descr_id);
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ btgatt_gatt_id_t *descr_id);
/** GATT included service enumeration result callback */
typedef void (*get_included_service_callback)(int conn_id, int status,
- btgatt_srvc_id_t *srvc_id, btgatt_srvc_id_t *incl_srvc_id);
+ btgatt_srvc_id_t *srvc_id, btgatt_srvc_id_t *incl_srvc_id);
/** Callback invoked in response to [de]register_for_notification */
typedef void (*register_for_notification_callback)(int conn_id,
- int registered, int status, btgatt_srvc_id_t *srvc_id,
- btgatt_gatt_id_t *char_id);
+ int registered, int status, btgatt_srvc_id_t *srvc_id,
+ btgatt_gatt_id_t *char_id);
/**
* Remote device notification callback, invoked when a remote device sends
/** Reports result of a GATT read operation */
typedef void (*read_characteristic_callback)(int conn_id, int status,
- btgatt_read_params_t *p_data);
+ btgatt_read_params_t *p_data);
/** GATT write characteristic operation callback */
typedef void (*write_characteristic_callback)(int conn_id, int status,
- btgatt_write_params_t *p_data);
+ btgatt_write_params_t *p_data);
/** GATT execute prepared write callback */
typedef void (*execute_write_callback)(int conn_id, int status);
/** Callback invoked in response to read_descriptor */
typedef void (*read_descriptor_callback)(int conn_id, int status,
- btgatt_read_params_t *p_data);
+ btgatt_read_params_t *p_data);
/** Callback invoked in response to write_descriptor */
typedef void (*write_descriptor_callback)(int conn_id, int status,
- btgatt_write_params_t *p_data);
+ btgatt_write_params_t *p_data);
/** Callback triggered in response to read_remote_rssi */
typedef void (*read_remote_rssi_callback)(int client_if, bt_bdaddr_t* bda,
- int rssi, int status);
+ int rssi, int status);
/** Callback invoked when the MTU for a given connection changes */
typedef void (*configure_mtu_callback)(int conn_id, int status, int mtu);
/** Callback invoked when a scan filter configuration command has completed */
typedef void (*scan_filter_cfg_callback)(int action, int client_if, int status, int filt_type,
- int avbl_space);
+ int avbl_space);
/** Callback invoked when scan param has been added, cleared, or deleted */
typedef void (*scan_filter_param_callback)(int action, int client_if, int status,
- int avbl_space);
+ int avbl_space);
/** Callback invoked when a scan filter configuration command has completed */
typedef void (*scan_filter_status_callback)(int enable, int client_if, int status);
/** Callback invoked when batchscan reports are obtained */
typedef void (*batchscan_reports_callback)(int client_if, int status, int report_format,
- int num_records, int data_len, uint8_t* rep_data);
+ int num_records, int data_len, uint8_t* rep_data);
/** Callback invoked when batchscan storage threshold limit is crossed */
typedef void (*batchscan_threshold_callback)(int client_if);
/** Track ADV VSE callback invoked when tracked device is found or lost */
typedef void (*track_adv_event_callback)(int client_if, int filt_index, int addr_type,
- bt_bdaddr_t* bda, int adv_state);
+ bt_bdaddr_t* bda, int adv_state);
typedef struct {
register_client_callback register_client_cb;
scan_result_callback scan_result_cb;
/** Represents the standard BT-GATT client interface. */
typedef struct {
- /** Registers a GATT client application with the stack */
- bt_status_t (*register_client)( bt_uuid_t *uuid );
-
- /** Unregister a client application from the stack */
- bt_status_t (*unregister_client)(int client_if );
-
- /** Start or stop LE device scanning */
- bt_status_t (*scan)( int client_if, bool start );
-
- /** Create a connection to a remote LE or dual-mode device */
- bt_status_t (*connect)( int client_if, const bt_bdaddr_t *bd_addr,
- bool is_direct );
-
- /** Disconnect a remote device or cancel a pending connection */
- bt_status_t (*disconnect)( int client_if, const bt_bdaddr_t *bd_addr,
- int conn_id);
-
- /** Clear the attribute cache for a given device */
- bt_status_t (*refresh)( int client_if, const bt_bdaddr_t *bd_addr );
-
- /**
- * Enumerate all GATT services on a connected device.
- * Optionally, the results can be filtered for a given UUID.
- */
- bt_status_t (*search_service)(int conn_id, bt_uuid_t *filter_uuid );
-
- /**
- * Enumerate included services for a given service.
- * Set start_incl_srvc_id to NULL to get the first included service.
- */
- bt_status_t (*get_included_service)( int conn_id, btgatt_srvc_id_t *srvc_id,
- btgatt_srvc_id_t *start_incl_srvc_id);
-
- /**
- * Enumerate characteristics for a given service.
- * Set start_char_id to NULL to get the first characteristic.
- */
- bt_status_t (*get_characteristic)( int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *start_char_id);
-
- /**
- * Enumerate descriptors for a given characteristic.
- * Set start_descr_id to NULL to get the first descriptor.
- */
- bt_status_t (*get_descriptor)( int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
- btgatt_gatt_id_t *start_descr_id);
-
- /** Read a characteristic on a remote device */
- bt_status_t (*read_characteristic)( int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
- int auth_req );
-
- /** Write a remote characteristic */
- bt_status_t (*write_characteristic)(int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
- int write_type, int len, int auth_req,
- char* p_value);
-
- /** Read the descriptor for a given characteristic */
- bt_status_t (*read_descriptor)(int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
- btgatt_gatt_id_t *descr_id, int auth_req);
-
- /** Write a remote descriptor for a given characteristic */
- bt_status_t (*write_descriptor)( int conn_id,
- btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
- btgatt_gatt_id_t *descr_id, int write_type, int len,
- int auth_req, char* p_value);
-
- /** Execute a prepared write operation */
- bt_status_t (*execute_write)(int conn_id, int execute);
-
- /**
- * Register to receive notifications or indications for a given
- * characteristic
- */
- bt_status_t (*register_for_notification)( int client_if,
- const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id,
- btgatt_gatt_id_t *char_id);
-
- /** Deregister a previous request for notifications/indications */
- bt_status_t (*deregister_for_notification)( int client_if,
- const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id,
- btgatt_gatt_id_t *char_id);
-
- /** Request RSSI for a given remote device */
- bt_status_t (*read_remote_rssi)( int client_if, const bt_bdaddr_t *bd_addr);
-
- /** OTA firmware download */
- bt_status_t (*ota_fw_update)(int client_if, int conn_id, const bt_bdaddr_t *bd_addr, char* path);
-
- /** Determine the type of the remote device (LE, BR/EDR, Dual-mode) */
- int (*get_device_type)( const bt_bdaddr_t *bd_addr );
-
- /** Request a connection parameter update */
- bt_status_t (*conn_parameter_update)(bt_bdaddr_t *bd, int min_int, int max_int, int latency, int timeout);
-
- /** Test mode interface */
- bt_status_t (*test_command)( int command, btgatt_test_params_t* params);
-
- /** MTU Exchange request from client */
- bt_status_t (*configure_mtu)( int conn_id, int mtu);
+ /** Registers a GATT client application with the stack */
+ bt_status_t (*register_client)(bt_uuid_t *uuid);
+
+ /** Unregister a client application from the stack */
+ bt_status_t (*unregister_client)(int client_if);
+
+ /** Start or stop LE device scanning */
+ bt_status_t (*scan)(int client_if, bool start);
+
+ /** Create a connection to a remote LE or dual-mode device */
+ bt_status_t (*connect)(int client_if, const bt_bdaddr_t *bd_addr,
+ bool is_direct);
+
+ /** Disconnect a remote device or cancel a pending connection */
+ bt_status_t (*disconnect)(int client_if, const bt_bdaddr_t *bd_addr,
+ int conn_id);
+
+ /** Clear the attribute cache for a given device */
+ bt_status_t (*refresh)(int client_if, const bt_bdaddr_t *bd_addr);
+
+ /**
+ * Enumerate all GATT services on a connected device.
+ * Optionally, the results can be filtered for a given UUID.
+ */
+ bt_status_t (*search_service)(int conn_id, bt_uuid_t *filter_uuid);
+
+ /**
+ * Enumerate included services for a given service.
+ * Set start_incl_srvc_id to NULL to get the first included service.
+ */
+ bt_status_t (*get_included_service)(int conn_id, btgatt_srvc_id_t *srvc_id,
+ btgatt_srvc_id_t *start_incl_srvc_id);
+
+ /**
+ * Enumerate characteristics for a given service.
+ * Set start_char_id to NULL to get the first characteristic.
+ */
+ bt_status_t (*get_characteristic)(int conn_id,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *start_char_id);
+
+ /**
+ * Enumerate descriptors for a given characteristic.
+ * Set start_descr_id to NULL to get the first descriptor.
+ */
+ bt_status_t (*get_descriptor)(int conn_id,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ btgatt_gatt_id_t *start_descr_id);
+
+ /** Read a characteristic on a remote device */
+ bt_status_t (*read_characteristic)(int conn_id,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ int auth_req);
+
+ /** Write a remote characteristic */
+ bt_status_t (*write_characteristic)(int conn_id,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ int write_type, int len, int auth_req,
+ char* p_value);
+
+ /** Read the descriptor for a given characteristic */
+ bt_status_t (*read_descriptor)(int conn_id,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ btgatt_gatt_id_t *descr_id, int auth_req);
+
+ /** Write a remote descriptor for a given characteristic */
+ bt_status_t (*write_descriptor)(int conn_id,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ btgatt_gatt_id_t *descr_id, int write_type, int len,
+ int auth_req, char* p_value);
+
+ /** Execute a prepared write operation */
+ bt_status_t (*execute_write)(int conn_id, int execute);
+
+ /**
+ * Register to receive notifications or indications for a given
+ * characteristic
+ */
+ bt_status_t (*register_for_notification)(int client_if,
+ const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id,
+ btgatt_gatt_id_t *char_id);
+
+ /** Deregister a previous request for notifications/indications */
+ bt_status_t (*deregister_for_notification)(int client_if,
+ const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id,
+ btgatt_gatt_id_t *char_id);
+
+ /** Request RSSI for a given remote device */
+ bt_status_t (*read_remote_rssi)(int client_if, const bt_bdaddr_t *bd_addr);
+
+ /** OTA firmware download */
+ bt_status_t (*ota_fw_update)(int client_if, int conn_id, const bt_bdaddr_t *bd_addr, char* path);
+
+ /** Determine the type of the remote device (LE, BR/EDR, Dual-mode) */
+ int (*get_device_type)(const bt_bdaddr_t *bd_addr);
+
+ /** Request a connection parameter update */
+ bt_status_t (*conn_parameter_update)(bt_bdaddr_t *bd, int min_int, int max_int, int latency, int timeout);
+
+ /** Test mode interface */
+ bt_status_t (*test_command)(int command, btgatt_test_params_t* params);
+
+ /** MTU Exchange request from client */
+ bt_status_t (*configure_mtu)(int conn_id, int mtu);
/** Setup scan filter params */
- bt_status_t (*scan_filter_param_setup)(int client_if, int action, int filt_index, int feat_seln,
- int list_logic_type, int filt_logic_type, int rssi_high_thres,
- int rssi_low_thres, int dely_mode, int found_timeout,
- int lost_timeout, int found_timeout_cnt);
+ bt_status_t (*scan_filter_param_setup)(int client_if, int action, int filt_index, int feat_seln,
+ int list_logic_type, int filt_logic_type, int rssi_high_thres,
+ int rssi_low_thres, int dely_mode, int found_timeout,
+ int lost_timeout, int found_timeout_cnt);
- /** Configure a scan filter condition */
- bt_status_t (*scan_filter_add_remove)(int client_if, int action, int filt_type,
- int filt_index, int company_id,
- int company_id_mask, const bt_uuid_t *p_uuid,
- const bt_uuid_t *p_uuid_mask, const bt_bdaddr_t *bd_addr,
- char addr_type, int data_len, char* p_data, int mask_len,
- char* p_mask);
+ /** Configure a scan filter condition */
+ bt_status_t (*scan_filter_add_remove)(int client_if, int action, int filt_type,
+ int filt_index, int company_id,
+ int company_id_mask, const bt_uuid_t *p_uuid,
+ const bt_uuid_t *p_uuid_mask, const bt_bdaddr_t *bd_addr,
+ char addr_type, int data_len, char* p_data, int mask_len,
+ char* p_mask);
- /** Clear all scan filter conditions for specific filter index*/
- bt_status_t (*scan_filter_clear)(int client_if, int filt_index);
+ /** Clear all scan filter conditions for specific filter index*/
+ bt_status_t (*scan_filter_clear)(int client_if, int filt_index);
- /** Enable / disable scan filter feature*/
- bt_status_t (*scan_filter_enable)(int client_if, bool enable);
+ /** Enable / disable scan filter feature*/
+ bt_status_t (*scan_filter_enable)(int client_if, bool enable);
- /** Sets the LE scan interval and window in units of N*0.625 msec */
+ /** Sets the LE scan interval and window in units of N*0.625 msec */
#ifdef TIZEN_BT_HAL
- bt_status_t (*set_scan_parameters)(int scan_type, int scan_interval, int scan_window);
+ bt_status_t (*set_scan_parameters)(int scan_type, int scan_interval, int scan_window);
#else
- bt_status_t (*set_scan_parameters)(int scan_interval, int scan_window);
+ bt_status_t (*set_scan_parameters)(int scan_interval, int scan_window);
#endif
- /* Configure the batchscan storage */
- bt_status_t (*batchscan_cfg_storage)(int client_if, int batch_scan_full_max,
- int batch_scan_trunc_max, int batch_scan_notify_threshold);
+ /* Configure the batchscan storage */
+ bt_status_t (*batchscan_cfg_storage)(int client_if, int batch_scan_full_max,
+ int batch_scan_trunc_max, int batch_scan_notify_threshold);
- /* Enable batchscan */
- bt_status_t (*batchscan_enb_batch_scan)(int client_if, int scan_mode,
- int scan_interval, int scan_window, int addr_type, int discard_rule);
+ /* Enable batchscan */
+ bt_status_t (*batchscan_enb_batch_scan)(int client_if, int scan_mode,
+ int scan_interval, int scan_window, int addr_type, int discard_rule);
- /* Disable batchscan */
- bt_status_t (*batchscan_dis_batch_scan)(int client_if);
+ /* Disable batchscan */
+ bt_status_t (*batchscan_dis_batch_scan)(int client_if);
- /* Read out batchscan reports */
- bt_status_t (*batchscan_read_reports)(int client_if, int scan_mode);
+ /* Read out batchscan reports */
+ bt_status_t (*batchscan_read_reports)(int client_if, int scan_mode);
} btgatt_client_interface_t;
__BEGIN_DECLS
/** GATT value type used in response to remote read requests */
-typedef struct
-{
+typedef struct {
uint8_t value[BTGATT_MAX_ATTR_LEN];
uint16_t handle;
uint16_t offset;
} btgatt_value_t;
/** GATT remote read request response type */
-typedef union
-{
+typedef union {
btgatt_value_t attr_value;
uint16_t handle;
} btgatt_response_t;
/**
* Callback invoked when indication confirmation
*/
-typedef void (*indication_confirmation_callback) ( int conn_id, int trans_id, int attr_handle, bt_bdaddr_t *bda);
+typedef void (*indication_confirmation_callback) (int conn_id, int trans_id, int attr_handle, bt_bdaddr_t *bda);
#ifdef TIZEN_BT_HAL
/**
/** Represents the standard BT-GATT server interface. */
typedef struct {
/** Registers a GATT server application with the stack */
- bt_status_t (*register_server)( bt_uuid_t *uuid );
+ bt_status_t (*register_server)(bt_uuid_t *uuid);
/** Unregister a server application from the stack */
- bt_status_t (*unregister_server)(int server_if );
+ bt_status_t (*unregister_server)(int server_if);
/** Create a connection to a remote peripheral */
- bt_status_t (*connect)(int server_if, const bt_bdaddr_t *bd_addr, bool is_direct );
+ bt_status_t (*connect)(int server_if, const bt_bdaddr_t *bd_addr, bool is_direct);
/** Disconnect an established connection or cancel a pending one */
bt_status_t (*disconnect)(int server_if, const bt_bdaddr_t *bd_addr,
- int conn_id );
+ int conn_id);
/** Create a new service */
- bt_status_t (*add_service)( int server_if, btgatt_srvc_id_t *srvc_id, int num_handles);
+ bt_status_t (*add_service)(int server_if, btgatt_srvc_id_t *srvc_id, int num_handles);
/** Assign an included service to it's parent service */
- bt_status_t (*add_included_service)( int server_if, int service_handle, int included_handle);
+ bt_status_t (*add_included_service)(int server_if, int service_handle, int included_handle);
/** Add a characteristic to a service */
- bt_status_t (*add_characteristic)( int server_if,
+ bt_status_t (*add_characteristic)(int server_if,
int service_handle, bt_uuid_t *uuid,
int properties, int permissions);
/** Update GATT server attribute value */
bt_status_t (*update_att_value)(int server_if, int attribute_handle,
- int value_length, char* att_value);
+ int value_length, char* att_value);
/** Start or stop advertisements to listen for incoming connections */
bt_status_t (*listen)(int server_if, bool start);
bt_status_t (*multi_adv_enable)(int server_if);
/* Update the parameters as per spec, user manual specified values and restart multi ADV */
- bt_status_t (*multi_adv_update)(int server_if, int min_interval,int max_interval,int adv_type,
+ bt_status_t (*multi_adv_update)(int server_if, int min_interval, int max_interval, int adv_type,
int chnl_map, int tx_power, int timeout_s);
/* Setup the data for the specified instance */
#define BTGATT_SERVICE_TYPE_SECONDARY 1
/** GATT ID adding instance id tracking to the UUID */
-typedef struct
-{
- bt_uuid_t uuid;
- uint8_t inst_id;
+typedef struct {
+ bt_uuid_t uuid;
+ uint8_t inst_id;
} btgatt_gatt_id_t;
/** GATT Service ID also identifies the service type (primary/secondary) */
-typedef struct
-{
- btgatt_gatt_id_t id;
- uint8_t is_primary;
+typedef struct {
+ btgatt_gatt_id_t id;
+ uint8_t is_primary;
} btgatt_srvc_id_t;
/** Preferred physical Transport for GATT connection */
-typedef enum
-{
- GATT_TRANSPORT_AUTO,
- GATT_TRANSPORT_BREDR,
- GATT_TRANSPORT_LE
+typedef enum {
+ GATT_TRANSPORT_AUTO,
+ GATT_TRANSPORT_BREDR,
+ GATT_TRANSPORT_LE
} btgatt_transport_t;
__END_DECLS
/* AT response code - OK/Error */
typedef enum {
- BTHF_AT_RESPONSE_ERROR = 0,
- BTHF_AT_RESPONSE_OK
+ BTHF_AT_RESPONSE_ERROR = 0,
+ BTHF_AT_RESPONSE_OK
} bthf_at_response_t;
typedef enum {
- BTHF_CONNECTION_STATE_DISCONNECTED = 0,
- BTHF_CONNECTION_STATE_CONNECTING,
- BTHF_CONNECTION_STATE_CONNECTED,
- BTHF_CONNECTION_STATE_SLC_CONNECTED,
- BTHF_CONNECTION_STATE_DISCONNECTING
+ BTHF_CONNECTION_STATE_DISCONNECTED = 0,
+ BTHF_CONNECTION_STATE_CONNECTING,
+ BTHF_CONNECTION_STATE_CONNECTED,
+ BTHF_CONNECTION_STATE_SLC_CONNECTED,
+ BTHF_CONNECTION_STATE_DISCONNECTING
} bthf_connection_state_t;
typedef enum {
- BTHF_AUDIO_STATE_DISCONNECTED = 0,
- BTHF_AUDIO_STATE_CONNECTING,
- BTHF_AUDIO_STATE_CONNECTED,
- BTHF_AUDIO_STATE_DISCONNECTING
+ BTHF_AUDIO_STATE_DISCONNECTED = 0,
+ BTHF_AUDIO_STATE_CONNECTING,
+ BTHF_AUDIO_STATE_CONNECTED,
+ BTHF_AUDIO_STATE_DISCONNECTING
} bthf_audio_state_t;
typedef enum {
- BTHF_VR_STATE_STOPPED = 0,
- BTHF_VR_STATE_STARTED
+ BTHF_VR_STATE_STOPPED = 0,
+ BTHF_VR_STATE_STARTED
} bthf_vr_state_t;
typedef enum {
- BTHF_VOLUME_TYPE_SPK = 0,
- BTHF_VOLUME_TYPE_MIC
+ BTHF_VOLUME_TYPE_SPK = 0,
+ BTHF_VOLUME_TYPE_MIC
} bthf_volume_type_t;
/* Noise Reduction and Echo Cancellation */
-typedef enum
-{
- BTHF_NREC_STOP,
- BTHF_NREC_START
+typedef enum {
+ BTHF_NREC_STOP,
+ BTHF_NREC_START
} bthf_nrec_t;
/* WBS codec setting */
-typedef enum
-{
- BTHF_WBS_NONE,
- BTHF_WBS_NO,
- BTHF_WBS_YES
-}bthf_wbs_config_t;
+typedef enum {
+ BTHF_WBS_NONE,
+ BTHF_WBS_NO,
+ BTHF_WBS_YES
+} bthf_wbs_config_t;
/* CHLD - Call held handling */
-typedef enum
-{
- BTHF_CHLD_TYPE_RELEASEHELD, // Terminate all held or set UDUB("busy") to a waiting call
- BTHF_CHLD_TYPE_RELEASEACTIVE_ACCEPTHELD, // Terminate all active calls and accepts a waiting/held call
- BTHF_CHLD_TYPE_HOLDACTIVE_ACCEPTHELD, // Hold all active calls and accepts a waiting/held call
- BTHF_CHLD_TYPE_ADDHELDTOCONF, // Add all held calls to a conference
+typedef enum {
+ BTHF_CHLD_TYPE_RELEASEHELD, // Terminate all held or set UDUB("busy") to a waiting call
+ BTHF_CHLD_TYPE_RELEASEACTIVE_ACCEPTHELD, // Terminate all active calls and accepts a waiting/held call
+ BTHF_CHLD_TYPE_HOLDACTIVE_ACCEPTHELD, // Hold all active calls and accepts a waiting/held call
+ BTHF_CHLD_TYPE_ADDHELDTOCONF, // Add all held calls to a conference
} bthf_chld_type_t;
/** Callback for connection state change.
* state will have one of the values from BtHfConnectionState
*/
-typedef void (* bthf_connection_state_callback)(bthf_connection_state_t state, bt_bdaddr_t *bd_addr);
+typedef void (*bthf_connection_state_callback)(bthf_connection_state_t state, bt_bdaddr_t *bd_addr);
/** Callback for audio connection state change.
* state will have one of the values from BtHfAudioState
*/
-typedef void (* bthf_audio_state_callback)(bthf_audio_state_t state, bt_bdaddr_t *bd_addr);
+typedef void (*bthf_audio_state_callback)(bthf_audio_state_t state, bt_bdaddr_t *bd_addr);
/** Callback for VR connection state change.
* state will have one of the values from BtHfVRState
*/
-typedef void (* bthf_vr_cmd_callback)(bthf_vr_state_t state, bt_bdaddr_t *bd_addr);
+typedef void (*bthf_vr_cmd_callback)(bthf_vr_state_t state, bt_bdaddr_t *bd_addr);
/** Callback for answer incoming call (ATA)
*/
-typedef void (* bthf_answer_call_cmd_callback)(bt_bdaddr_t *bd_addr);
+typedef void (*bthf_answer_call_cmd_callback)(bt_bdaddr_t *bd_addr);
/** Callback for disconnect call (AT+CHUP)
*/
-typedef void (* bthf_hangup_call_cmd_callback)(bt_bdaddr_t *bd_addr);
+typedef void (*bthf_hangup_call_cmd_callback)(bt_bdaddr_t *bd_addr);
/** Callback for disconnect call (AT+CHUP)
* type will denote Speaker/Mic gain (BtHfVolumeControl).
*/
-typedef void (* bthf_volume_cmd_callback)(bthf_volume_type_t type, int volume, bt_bdaddr_t *bd_addr);
+typedef void (*bthf_volume_cmd_callback)(bthf_volume_type_t type, int volume, bt_bdaddr_t *bd_addr);
/** Callback for dialing an outgoing call
* If number is NULL, redial
*/
-typedef void (* bthf_dial_call_cmd_callback)(char *number, bt_bdaddr_t *bd_addr);
+typedef void (*bthf_dial_call_cmd_callback)(char *number, bt_bdaddr_t *bd_addr);
/** Callback for sending DTMF tones
* tone contains the dtmf character to be sent
*/
-typedef void (* bthf_dtmf_cmd_callback)(char tone, bt_bdaddr_t *bd_addr);
+typedef void (*bthf_dtmf_cmd_callback)(char tone, bt_bdaddr_t *bd_addr);
/** Callback for enabling/disabling noise reduction/echo cancellation
* value will be 1 to enable, 0 to disable
*/
-typedef void (* bthf_nrec_cmd_callback)(bthf_nrec_t nrec, bt_bdaddr_t *bd_addr);
+typedef void (*bthf_nrec_cmd_callback)(bthf_nrec_t nrec, bt_bdaddr_t *bd_addr);
/** Callback for AT+BCS and event from BAC
* WBS enable, WBS disable
*/
-typedef void (* bthf_wbs_callback)(bthf_wbs_config_t wbs, bt_bdaddr_t *bd_addr);
+typedef void (*bthf_wbs_callback)(bthf_wbs_config_t wbs, bt_bdaddr_t *bd_addr);
/** Callback for call hold handling (AT+CHLD)
* value will contain the call hold command (0, 1, 2, 3)
*/
-typedef void (* bthf_chld_cmd_callback)(bthf_chld_type_t chld, bt_bdaddr_t *bd_addr);
+typedef void (*bthf_chld_cmd_callback)(bthf_chld_type_t chld, bt_bdaddr_t *bd_addr);
/** Callback for CNUM (subscriber number)
*/
-typedef void (* bthf_cnum_cmd_callback)(bt_bdaddr_t *bd_addr);
+typedef void (*bthf_cnum_cmd_callback)(bt_bdaddr_t *bd_addr);
/** Callback for indicators (CIND)
*/
-typedef void (* bthf_cind_cmd_callback)(bt_bdaddr_t *bd_addr);
+typedef void (*bthf_cind_cmd_callback)(bt_bdaddr_t *bd_addr);
/** Callback for operator selection (COPS)
*/
-typedef void (* bthf_cops_cmd_callback)(bt_bdaddr_t *bd_addr);
+typedef void (*bthf_cops_cmd_callback)(bt_bdaddr_t *bd_addr);
/** Callback for call list (AT+CLCC)
*/
-typedef void (* bthf_clcc_cmd_callback) (bt_bdaddr_t *bd_addr);
+typedef void (*bthf_clcc_cmd_callback) (bt_bdaddr_t *bd_addr);
/** Callback for unknown AT command recd from HF
* at_string will contain the unparsed AT string
*/
-typedef void (* bthf_unknown_at_cmd_callback)(char *at_string, bt_bdaddr_t *bd_addr);
+typedef void (*bthf_unknown_at_cmd_callback)(char *at_string, bt_bdaddr_t *bd_addr);
/** Callback for keypressed (HSP) event.
*/
-typedef void (* bthf_key_pressed_cmd_callback)(bt_bdaddr_t *bd_addr);
+typedef void (*bthf_key_pressed_cmd_callback)(bt_bdaddr_t *bd_addr);
/** BT-HF callback structure. */
typedef struct {
- /** set to sizeof(BtHfCallbacks) */
- size_t size;
- bthf_connection_state_callback connection_state_cb;
- bthf_audio_state_callback audio_state_cb;
- bthf_vr_cmd_callback vr_cmd_cb;
- bthf_answer_call_cmd_callback answer_call_cmd_cb;
- bthf_hangup_call_cmd_callback hangup_call_cmd_cb;
- bthf_volume_cmd_callback volume_cmd_cb;
- bthf_dial_call_cmd_callback dial_call_cmd_cb;
- bthf_dtmf_cmd_callback dtmf_cmd_cb;
- bthf_nrec_cmd_callback nrec_cmd_cb;
- bthf_wbs_callback wbs_cb;
- bthf_chld_cmd_callback chld_cmd_cb;
- bthf_cnum_cmd_callback cnum_cmd_cb;
- bthf_cind_cmd_callback cind_cmd_cb;
- bthf_cops_cmd_callback cops_cmd_cb;
- bthf_clcc_cmd_callback clcc_cmd_cb;
- bthf_unknown_at_cmd_callback unknown_at_cmd_cb;
- bthf_key_pressed_cmd_callback key_pressed_cmd_cb;
+ /** set to sizeof(BtHfCallbacks) */
+ size_t size;
+ bthf_connection_state_callback connection_state_cb;
+ bthf_audio_state_callback audio_state_cb;
+ bthf_vr_cmd_callback vr_cmd_cb;
+ bthf_answer_call_cmd_callback answer_call_cmd_cb;
+ bthf_hangup_call_cmd_callback hangup_call_cmd_cb;
+ bthf_volume_cmd_callback volume_cmd_cb;
+ bthf_dial_call_cmd_callback dial_call_cmd_cb;
+ bthf_dtmf_cmd_callback dtmf_cmd_cb;
+ bthf_nrec_cmd_callback nrec_cmd_cb;
+ bthf_wbs_callback wbs_cb;
+ bthf_chld_cmd_callback chld_cmd_cb;
+ bthf_cnum_cmd_callback cnum_cmd_cb;
+ bthf_cind_cmd_callback cind_cmd_cb;
+ bthf_cops_cmd_callback cops_cmd_cb;
+ bthf_clcc_cmd_callback clcc_cmd_cb;
+ bthf_unknown_at_cmd_callback unknown_at_cmd_cb;
+ bthf_key_pressed_cmd_callback key_pressed_cmd_cb;
} bthf_callbacks_t;
/** Network Status */
-typedef enum
-{
- BTHF_NETWORK_STATE_NOT_AVAILABLE = 0,
- BTHF_NETWORK_STATE_AVAILABLE
+typedef enum {
+ BTHF_NETWORK_STATE_NOT_AVAILABLE = 0,
+ BTHF_NETWORK_STATE_AVAILABLE
} bthf_network_state_t;
/** Service type */
-typedef enum
-{
- BTHF_SERVICE_TYPE_HOME = 0,
- BTHF_SERVICE_TYPE_ROAMING
+typedef enum {
+ BTHF_SERVICE_TYPE_HOME = 0,
+ BTHF_SERVICE_TYPE_ROAMING
} bthf_service_type_t;
typedef enum {
- BTHF_CALL_STATE_ACTIVE = 0,
- BTHF_CALL_STATE_HELD,
- BTHF_CALL_STATE_DIALING,
- BTHF_CALL_STATE_ALERTING,
- BTHF_CALL_STATE_INCOMING,
- BTHF_CALL_STATE_WAITING,
- BTHF_CALL_STATE_IDLE
+ BTHF_CALL_STATE_ACTIVE = 0,
+ BTHF_CALL_STATE_HELD,
+ BTHF_CALL_STATE_DIALING,
+ BTHF_CALL_STATE_ALERTING,
+ BTHF_CALL_STATE_INCOMING,
+ BTHF_CALL_STATE_WAITING,
+ BTHF_CALL_STATE_IDLE
} bthf_call_state_t;
typedef enum {
- BTHF_CALL_DIRECTION_OUTGOING = 0,
- BTHF_CALL_DIRECTION_INCOMING
+ BTHF_CALL_DIRECTION_OUTGOING = 0,
+ BTHF_CALL_DIRECTION_INCOMING
} bthf_call_direction_t;
typedef enum {
- BTHF_CALL_TYPE_VOICE = 0,
- BTHF_CALL_TYPE_DATA,
- BTHF_CALL_TYPE_FAX
+ BTHF_CALL_TYPE_VOICE = 0,
+ BTHF_CALL_TYPE_DATA,
+ BTHF_CALL_TYPE_FAX
} bthf_call_mode_t;
typedef enum {
- BTHF_CALL_MPTY_TYPE_SINGLE = 0,
- BTHF_CALL_MPTY_TYPE_MULTI
+ BTHF_CALL_MPTY_TYPE_SINGLE = 0,
+ BTHF_CALL_MPTY_TYPE_MULTI
} bthf_call_mpty_type_t;
typedef enum {
- BTHF_CALL_ADDRTYPE_UNKNOWN = 0x81,
- BTHF_CALL_ADDRTYPE_INTERNATIONAL = 0x91
+ BTHF_CALL_ADDRTYPE_UNKNOWN = 0x81,
+ BTHF_CALL_ADDRTYPE_INTERNATIONAL = 0x91
} bthf_call_addrtype_t;
/** Represents the standard BT-HF interface. */
typedef struct {
- /** set to sizeof(BtHfInterface) */
- size_t size;
- /**
- * Register the BtHf callbacks
- */
- bt_status_t (*init)( bthf_callbacks_t* callbacks, int max_hf_clients);
-
- /** connect to headset */
- bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
-
- /** dis-connect from headset */
- bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
-
- /** create an audio connection */
- bt_status_t (*connect_audio)( bt_bdaddr_t *bd_addr );
-
- /** close the audio connection */
- bt_status_t (*disconnect_audio)( bt_bdaddr_t *bd_addr );
-
- /** start voice recognition */
- bt_status_t (*start_voice_recognition)( bt_bdaddr_t *bd_addr );
-
- /** stop voice recognition */
- bt_status_t (*stop_voice_recognition)( bt_bdaddr_t *bd_addr );
-
- /** volume control */
- bt_status_t (*volume_control) (bthf_volume_type_t type, int volume, bt_bdaddr_t *bd_addr );
-
- /** Combined device status change notification */
- bt_status_t (*device_status_notification)(bthf_network_state_t ntk_state, bthf_service_type_t svc_type, int signal,
- int batt_chg);
-
- /** Response for COPS command */
- bt_status_t (*cops_response)(const char *cops, bt_bdaddr_t *bd_addr );
-
- /** Response for CIND command */
- bt_status_t (*cind_response)(int svc, int num_active, int num_held, bthf_call_state_t call_setup_state,
- int signal, int roam, int batt_chg, bt_bdaddr_t *bd_addr );
-
- /** Pre-formatted AT response, typically in response to unknown AT cmd */
- bt_status_t (*formatted_at_response)(const char *rsp, bt_bdaddr_t *bd_addr );
-
- /** ok/error response
- * ERROR (0)
- * OK (1)
- */
- bt_status_t (*at_response) (bthf_at_response_t response_code, int error_code, bt_bdaddr_t *bd_addr );
-
- /** response for CLCC command
- * Can be iteratively called for each call index
- * Call index of 0 will be treated as NULL termination (Completes response)
- */
- bt_status_t (*clcc_response) (int index, bthf_call_direction_t dir,
- bthf_call_state_t state, bthf_call_mode_t mode,
- bthf_call_mpty_type_t mpty, const char *number,
- bthf_call_addrtype_t type, bt_bdaddr_t *bd_addr );
-
- /** notify of a call state change
- * Each update notifies
- * 1. Number of active/held/ringing calls
- * 2. call_state: This denotes the state change that triggered this msg
- * This will take one of the values from BtHfCallState
- * 3. number & type: valid only for incoming & waiting call
- */
- bt_status_t (*phone_state_change) (int num_active, int num_held, bthf_call_state_t call_setup_state,
- const char *number, bthf_call_addrtype_t type);
-
- /** Closes the interface. */
- void (*cleanup)( void );
-
- /** configureation for the SCO codec */
- bt_status_t (*configure_wbs)( bt_bdaddr_t *bd_addr ,bthf_wbs_config_t config );
+ /** set to sizeof(BtHfInterface) */
+ size_t size;
+ /**
+ * Register the BtHf callbacks
+ */
+ bt_status_t (*init)(bthf_callbacks_t* callbacks, int max_hf_clients);
+
+ /** connect to headset */
+ bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
+
+ /** dis-connect from headset */
+ bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
+
+ /** create an audio connection */
+ bt_status_t (*connect_audio)(bt_bdaddr_t *bd_addr);
+
+ /** close the audio connection */
+ bt_status_t (*disconnect_audio)(bt_bdaddr_t *bd_addr);
+
+ /** start voice recognition */
+ bt_status_t (*start_voice_recognition)(bt_bdaddr_t *bd_addr);
+
+ /** stop voice recognition */
+ bt_status_t (*stop_voice_recognition)(bt_bdaddr_t *bd_addr);
+
+ /** volume control */
+ bt_status_t (*volume_control) (bthf_volume_type_t type, int volume, bt_bdaddr_t *bd_addr);
+
+ /** Combined device status change notification */
+ bt_status_t (*device_status_notification)(bthf_network_state_t ntk_state, bthf_service_type_t svc_type, int signal,
+ int batt_chg);
+
+ /** Response for COPS command */
+ bt_status_t (*cops_response)(const char *cops, bt_bdaddr_t *bd_addr);
+
+ /** Response for CIND command */
+ bt_status_t (*cind_response)(int svc, int num_active, int num_held, bthf_call_state_t call_setup_state,
+ int signal, int roam, int batt_chg, bt_bdaddr_t *bd_addr);
+
+ /** Pre-formatted AT response, typically in response to unknown AT cmd */
+ bt_status_t (*formatted_at_response)(const char *rsp, bt_bdaddr_t *bd_addr);
+
+ /** ok/error response
+ * ERROR (0)
+ * OK (1)
+ */
+ bt_status_t (*at_response) (bthf_at_response_t response_code, int error_code, bt_bdaddr_t *bd_addr);
+
+ /** response for CLCC command
+ * Can be iteratively called for each call index
+ * Call index of 0 will be treated as NULL termination (Completes response)
+ */
+ bt_status_t (*clcc_response) (int index, bthf_call_direction_t dir,
+ bthf_call_state_t state, bthf_call_mode_t mode,
+ bthf_call_mpty_type_t mpty, const char *number,
+ bthf_call_addrtype_t type, bt_bdaddr_t *bd_addr);
+
+ /** notify of a call state change
+ * Each update notifies
+ * 1. Number of active/held/ringing calls
+ * 2. call_state: This denotes the state change that triggered this msg
+ * This will take one of the values from BtHfCallState
+ * 3. number & type: valid only for incoming & waiting call
+ */
+ bt_status_t (*phone_state_change) (int num_active, int num_held, bthf_call_state_t call_setup_state,
+ const char *number, bthf_call_addrtype_t type);
+
+ /** Closes the interface. */
+ void (*cleanup)(void);
+
+ /** configureation for the SCO codec */
+ bt_status_t (*configure_wbs)(bt_bdaddr_t *bd_addr , bthf_wbs_config_t config);
} bthf_interface_t;
__END_DECLS
#define BTHH_MAX_DSC_LEN 884
/* HH connection states */
-typedef enum
-{
- BTHH_CONN_STATE_CONNECTED = 0,
- BTHH_CONN_STATE_CONNECTING,
- BTHH_CONN_STATE_DISCONNECTED,
- BTHH_CONN_STATE_DISCONNECTING,
- BTHH_CONN_STATE_FAILED_MOUSE_FROM_HOST,
- BTHH_CONN_STATE_FAILED_KBD_FROM_HOST,
- BTHH_CONN_STATE_FAILED_TOO_MANY_DEVICES,
- BTHH_CONN_STATE_FAILED_NO_BTHID_DRIVER,
- BTHH_CONN_STATE_FAILED_GENERIC,
- BTHH_CONN_STATE_UNKNOWN
+typedef enum {
+ BTHH_CONN_STATE_CONNECTED = 0,
+ BTHH_CONN_STATE_CONNECTING,
+ BTHH_CONN_STATE_DISCONNECTED,
+ BTHH_CONN_STATE_DISCONNECTING,
+ BTHH_CONN_STATE_FAILED_MOUSE_FROM_HOST,
+ BTHH_CONN_STATE_FAILED_KBD_FROM_HOST,
+ BTHH_CONN_STATE_FAILED_TOO_MANY_DEVICES,
+ BTHH_CONN_STATE_FAILED_NO_BTHID_DRIVER,
+ BTHH_CONN_STATE_FAILED_GENERIC,
+ BTHH_CONN_STATE_UNKNOWN
} bthh_connection_state_t;
-typedef enum
-{
- BTHH_OK = 0,
- BTHH_HS_HID_NOT_READY, /* handshake error : device not ready */
- BTHH_HS_INVALID_RPT_ID, /* handshake error : invalid report ID */
- BTHH_HS_TRANS_NOT_SPT, /* handshake error : transaction not spt */
- BTHH_HS_INVALID_PARAM, /* handshake error : invalid paremter */
- BTHH_HS_ERROR, /* handshake error : unspecified HS error */
- BTHH_ERR, /* general BTA HH error */
- BTHH_ERR_SDP, /* SDP error */
- BTHH_ERR_PROTO, /* SET_Protocol error,
- only used in BTA_HH_OPEN_EVT callback */
- BTHH_ERR_DB_FULL, /* device database full error, used */
- BTHH_ERR_TOD_UNSPT, /* type of device not supported */
- BTHH_ERR_NO_RES, /* out of system resources */
- BTHH_ERR_AUTH_FAILED, /* authentication fail */
- BTHH_ERR_HDL
-}bthh_status_t;
+typedef enum {
+ BTHH_OK = 0,
+ BTHH_HS_HID_NOT_READY, /* handshake error : device not ready */
+ BTHH_HS_INVALID_RPT_ID, /* handshake error : invalid report ID */
+ BTHH_HS_TRANS_NOT_SPT, /* handshake error : transaction not spt */
+ BTHH_HS_INVALID_PARAM, /* handshake error : invalid paremter */
+ BTHH_HS_ERROR, /* handshake error : unspecified HS error */
+ BTHH_ERR, /* general BTA HH error */
+ BTHH_ERR_SDP, /* SDP error */
+ BTHH_ERR_PROTO, /* SET_Protocol error,
+ only used in BTA_HH_OPEN_EVT callback */
+ BTHH_ERR_DB_FULL, /* device database full error, used */
+ BTHH_ERR_TOD_UNSPT, /* type of device not supported */
+ BTHH_ERR_NO_RES, /* out of system resources */
+ BTHH_ERR_AUTH_FAILED, /* authentication fail */
+ BTHH_ERR_HDL
+} bthh_status_t;
/* Protocol modes */
typedef enum {
- BTHH_REPORT_MODE = 0x00,
- BTHH_BOOT_MODE = 0x01,
- BTHH_UNSUPPORTED_MODE = 0xff
-}bthh_protocol_mode_t;
+ BTHH_REPORT_MODE = 0x00,
+ BTHH_BOOT_MODE = 0x01,
+ BTHH_UNSUPPORTED_MODE = 0xff
+} bthh_protocol_mode_t;
/* Report types */
typedef enum {
- BTHH_INPUT_REPORT = 1,
- BTHH_OUTPUT_REPORT,
- BTHH_FEATURE_REPORT
-}bthh_report_type_t;
-
-typedef struct
-{
- int attr_mask;
- uint8_t sub_class;
- uint8_t app_id;
- int vendor_id;
- int product_id;
- int version;
- uint8_t ctry_code;
- int dl_len;
- uint8_t dsc_list[BTHH_MAX_DSC_LEN];
+ BTHH_INPUT_REPORT = 1,
+ BTHH_OUTPUT_REPORT,
+ BTHH_FEATURE_REPORT
+} bthh_report_type_t;
+
+typedef struct {
+ int attr_mask;
+ uint8_t sub_class;
+ uint8_t app_id;
+ int vendor_id;
+ int product_id;
+ int version;
+ uint8_t ctry_code;
+ int dl_len;
+ uint8_t dsc_list[BTHH_MAX_DSC_LEN];
} bthh_hid_info_t;
/** Callback for connection state change.
* state will have one of the values from bthh_connection_state_t
*/
-typedef void (* bthh_connection_state_callback)(bt_bdaddr_t *bd_addr, bthh_connection_state_t state);
+typedef void (*bthh_connection_state_callback)(bt_bdaddr_t *bd_addr, bthh_connection_state_t state);
/** Callback for vitual unplug api.
* the status of the vitual unplug
*/
-typedef void (* bthh_virtual_unplug_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status);
+typedef void (*bthh_virtual_unplug_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status);
/** Callback for get hid info
* hid_info will contain attr_mask, sub_class, app_id, vendor_id, product_id, version, ctry_code, len
*/
-typedef void (* bthh_hid_info_callback)(bt_bdaddr_t *bd_addr, bthh_hid_info_t *hid_info);
+typedef void (*bthh_hid_info_callback)(bt_bdaddr_t *bd_addr, bthh_hid_info_t *hid_info);
/** Callback for get protocol api.
* the protocol mode is one of the value from bthh_protocol_mode_t
*/
-typedef void (* bthh_protocol_mode_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, bthh_protocol_mode_t mode);
+typedef void (*bthh_protocol_mode_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, bthh_protocol_mode_t mode);
/** Callback for get/set_idle_time api.
*/
-typedef void (* bthh_idle_time_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, int idle_rate);
+typedef void (*bthh_idle_time_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, int idle_rate);
/** Callback for get report api.
* if staus is ok rpt_data contains the report data
*/
-typedef void (* bthh_get_report_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, uint8_t* rpt_data, int rpt_size);
+typedef void (*bthh_get_report_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, uint8_t* rpt_data, int rpt_size);
/** Callback for set_report/set_protocol api and if error
* occurs for get_report/get_protocol api.
*/
-typedef void (* bthh_handshake_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status);
+typedef void (*bthh_handshake_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status);
/** BT-HH callback structure. */
typedef struct {
- /** set to sizeof(BtHfCallbacks) */
- size_t size;
- bthh_connection_state_callback connection_state_cb;
- bthh_hid_info_callback hid_info_cb;
- bthh_protocol_mode_callback protocol_mode_cb;
- bthh_idle_time_callback idle_time_cb;
- bthh_get_report_callback get_report_cb;
- bthh_virtual_unplug_callback virtual_unplug_cb;
- bthh_handshake_callback handshake_cb;
+ /** set to sizeof(BtHfCallbacks) */
+ size_t size;
+ bthh_connection_state_callback connection_state_cb;
+ bthh_hid_info_callback hid_info_cb;
+ bthh_protocol_mode_callback protocol_mode_cb;
+ bthh_idle_time_callback idle_time_cb;
+ bthh_get_report_callback get_report_cb;
+ bthh_virtual_unplug_callback virtual_unplug_cb;
+ bthh_handshake_callback handshake_cb;
} bthh_callbacks_t;
/** Represents the standard BT-HH interface. */
typedef struct {
- /** set to sizeof(BtHhInterface) */
- size_t size;
+ /** set to sizeof(BtHhInterface) */
+ size_t size;
- /**
- * Register the BtHh callbacks
- */
- bt_status_t (*init)( bthh_callbacks_t* callbacks );
+ /**
+ * Register the BtHh callbacks
+ */
+ bt_status_t (*init)(bthh_callbacks_t* callbacks);
- /** connect to hid device */
- bt_status_t (*connect)( bt_bdaddr_t *bd_addr);
+ /** connect to hid device */
+ bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
- /** dis-connect from hid device */
- bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
+ /** dis-connect from hid device */
+ bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
- /** Virtual UnPlug (VUP) the specified HID device */
- bt_status_t (*virtual_unplug)(bt_bdaddr_t *bd_addr);
+ /** Virtual UnPlug (VUP) the specified HID device */
+ bt_status_t (*virtual_unplug)(bt_bdaddr_t *bd_addr);
- /** Set the HID device descriptor for the specified HID device. */
- bt_status_t (*set_info)(bt_bdaddr_t *bd_addr, bthh_hid_info_t *hid_info );
+ /** Set the HID device descriptor for the specified HID device. */
+ bt_status_t (*set_info)(bt_bdaddr_t *bd_addr, bthh_hid_info_t *hid_info);
- /** Get the HID proto mode. */
- bt_status_t (*get_protocol) (bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode);
+ /** Get the HID proto mode. */
+ bt_status_t (*get_protocol) (bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode);
- /** Set the HID proto mode. */
- bt_status_t (*set_protocol)(bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode);
+ /** Set the HID proto mode. */
+ bt_status_t (*set_protocol)(bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode);
- /** Send a GET_REPORT to HID device. */
- bt_status_t (*get_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, uint8_t reportId, int bufferSize);
+ /** Send a GET_REPORT to HID device. */
+ bt_status_t (*get_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, uint8_t reportId, int bufferSize);
- /** Send a SET_REPORT to HID device. */
- bt_status_t (*set_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, char* report);
+ /** Send a SET_REPORT to HID device. */
+ bt_status_t (*set_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, char* report);
- /** Send data to HID device. */
- bt_status_t (*send_data)(bt_bdaddr_t *bd_addr, char* data);
+ /** Send data to HID device. */
+ bt_status_t (*send_data)(bt_bdaddr_t *bd_addr, char* data);
/** Closes the interface. */
- void (*cleanup)( void );
+ void (*cleanup)(void);
} bthh_interface_t;
__END_DECLS
/* HL connection states */
-typedef enum
-{
- BTHL_MDEP_ROLE_SOURCE,
- BTHL_MDEP_ROLE_SINK
+typedef enum {
+ BTHL_MDEP_ROLE_SOURCE,
+ BTHL_MDEP_ROLE_SINK
} bthl_mdep_role_t;
typedef enum {
- BTHL_APP_REG_STATE_REG_SUCCESS,
- BTHL_APP_REG_STATE_REG_FAILED,
- BTHL_APP_REG_STATE_DEREG_SUCCESS,
- BTHL_APP_REG_STATE_DEREG_FAILED
+ BTHL_APP_REG_STATE_REG_SUCCESS,
+ BTHL_APP_REG_STATE_REG_FAILED,
+ BTHL_APP_REG_STATE_DEREG_SUCCESS,
+ BTHL_APP_REG_STATE_DEREG_FAILED
} bthl_app_reg_state_t;
-typedef enum
-{
- BTHL_CHANNEL_TYPE_RELIABLE,
- BTHL_CHANNEL_TYPE_STREAMING,
- BTHL_CHANNEL_TYPE_ANY
+typedef enum {
+ BTHL_CHANNEL_TYPE_RELIABLE,
+ BTHL_CHANNEL_TYPE_STREAMING,
+ BTHL_CHANNEL_TYPE_ANY
} bthl_channel_type_t;
/* HL connection states */
typedef enum {
- BTHL_CONN_STATE_CONNECTING,
- BTHL_CONN_STATE_CONNECTED,
- BTHL_CONN_STATE_DISCONNECTING,
- BTHL_CONN_STATE_DISCONNECTED,
- BTHL_CONN_STATE_DESTROYED
+ BTHL_CONN_STATE_CONNECTING,
+ BTHL_CONN_STATE_CONNECTED,
+ BTHL_CONN_STATE_DISCONNECTING,
+ BTHL_CONN_STATE_DISCONNECTED,
+ BTHL_CONN_STATE_DESTROYED
} bthl_channel_state_t;
-typedef struct
-{
- bthl_mdep_role_t mdep_role;
- int data_type;
- bthl_channel_type_t channel_type;
- const char *mdep_description; /* MDEP description to be used in the SDP (optional); null terminated */
+typedef struct {
+ bthl_mdep_role_t mdep_role;
+ int data_type;
+ bthl_channel_type_t channel_type;
+ const char *mdep_description; /* MDEP description to be used in the SDP (optional); null terminated */
} bthl_mdep_cfg_t;
-typedef struct
-{
- const char *application_name;
- const char *provider_name; /* provider name to be used in the SDP (optional); null terminated */
- const char *srv_name; /* service name to be used in the SDP (optional); null terminated*/
- const char *srv_desp; /* service description to be used in the SDP (optional); null terminated */
- int number_of_mdeps;
- bthl_mdep_cfg_t *mdep_cfg; /* Dynamic array */
+typedef struct {
+ const char *application_name;
+ const char *provider_name; /* provider name to be used in the SDP (optional); null terminated */
+ const char *srv_name; /* service name to be used in the SDP (optional); null terminated*/
+ const char *srv_desp; /* service description to be used in the SDP (optional); null terminated */
+ int number_of_mdeps;
+ bthl_mdep_cfg_t *mdep_cfg; /* Dynamic array */
} bthl_reg_param_t;
/** Callback for application registration status.
* state will have one of the values from bthl_app_reg_state_t
*/
-typedef void (* bthl_app_reg_state_callback)(int app_id, bthl_app_reg_state_t state);
+typedef void (*bthl_app_reg_state_callback)(int app_id, bthl_app_reg_state_t state);
/** Callback for channel connection state change.
* state will have one of the values from
* bthl_connection_state_t and fd (file descriptor)
*/
-typedef void (* bthl_channel_state_callback)(int app_id, bt_bdaddr_t *bd_addr, int mdep_cfg_index, int channel_id, bthl_channel_state_t state, int fd);
+typedef void (*bthl_channel_state_callback)(int app_id, bt_bdaddr_t *bd_addr, int mdep_cfg_index, int channel_id, bthl_channel_state_t state, int fd);
/** BT-HL callback structure. */
typedef struct {
- /** set to sizeof(bthl_callbacks_t) */
- size_t size;
- bthl_app_reg_state_callback app_reg_state_cb;
- bthl_channel_state_callback channel_state_cb;
+ /** set to sizeof(bthl_callbacks_t) */
+ size_t size;
+ bthl_app_reg_state_callback app_reg_state_cb;
+ bthl_channel_state_callback channel_state_cb;
} bthl_callbacks_t;
/** Represents the standard BT-HL interface. */
typedef struct {
- /** set to sizeof(bthl_interface_t) */
- size_t size;
+ /** set to sizeof(bthl_interface_t) */
+ size_t size;
- /**
- * Register the Bthl callbacks
- */
- bt_status_t (*init)( bthl_callbacks_t* callbacks );
+ /**
+ * Register the Bthl callbacks
+ */
+ bt_status_t (*init)(bthl_callbacks_t* callbacks);
- /** Register HL application */
- bt_status_t (*register_application) ( bthl_reg_param_t *p_reg_param, int *app_id);
+ /** Register HL application */
+ bt_status_t (*register_application) (bthl_reg_param_t *p_reg_param, int *app_id);
- /** Unregister HL application */
- bt_status_t (*unregister_application) (int app_id);
+ /** Unregister HL application */
+ bt_status_t (*unregister_application) (int app_id);
- /** connect channel */
- bt_status_t (*connect_channel)(int app_id, bt_bdaddr_t *bd_addr, int mdep_cfg_index, int *channel_id);
+ /** connect channel */
+ bt_status_t (*connect_channel)(int app_id, bt_bdaddr_t *bd_addr, int mdep_cfg_index, int *channel_id);
- /** destroy channel */
- bt_status_t (*destroy_channel)(int channel_id);
+ /** destroy channel */
+ bt_status_t (*destroy_channel)(int channel_id);
- /** Close the Bthl callback **/
- void (*cleanup)(void);
+ /** Close the Bthl callback **/
+ void (*cleanup)(void);
} bthl_interface_t;
__END_DECLS
typedef uint8_t btrc_uid_t[BTRC_UID_SIZE];
typedef enum {
- BTRC_CONNECTION_STATE_DISCONNECTED = 0,
- BTRC_CONNECTION_STATE_CONNECTED
+ BTRC_CONNECTION_STATE_DISCONNECTED = 0,
+ BTRC_CONNECTION_STATE_CONNECTED
} btrc_connection_state_t;
typedef enum {
- BTRC_FEAT_NONE = 0x00, /* AVRCP 1.0 */
- BTRC_FEAT_METADATA = 0x01, /* AVRCP 1.3 */
- BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */
- BTRC_FEAT_BROWSE = 0x04, /* AVRCP 1.4 and up, with Browsing support */
+ BTRC_FEAT_NONE = 0x00, /* AVRCP 1.0 */
+ BTRC_FEAT_METADATA = 0x01, /* AVRCP 1.3 */
+ BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */
+ BTRC_FEAT_BROWSE = 0x04, /* AVRCP 1.4 and up, with Browsing support */
} btrc_remote_features_t;
typedef enum {
- BTRC_PLAYSTATE_STOPPED = 0x00, /* Stopped */
- BTRC_PLAYSTATE_PLAYING = 0x01, /* Playing */
- BTRC_PLAYSTATE_PAUSED = 0x02, /* Paused */
- BTRC_PLAYSTATE_FWD_SEEK = 0x03, /* Fwd Seek*/
- BTRC_PLAYSTATE_REV_SEEK = 0x04, /* Rev Seek*/
- BTRC_PLAYSTATE_ERROR = 0xFF, /* Error */
+ BTRC_PLAYSTATE_STOPPED = 0x00, /* Stopped */
+ BTRC_PLAYSTATE_PLAYING = 0x01, /* Playing */
+ BTRC_PLAYSTATE_PAUSED = 0x02, /* Paused */
+ BTRC_PLAYSTATE_FWD_SEEK = 0x03, /* Fwd Seek*/
+ BTRC_PLAYSTATE_REV_SEEK = 0x04, /* Rev Seek*/
+ BTRC_PLAYSTATE_ERROR = 0xFF, /* Error */
} btrc_play_status_t;
typedef enum {
- BTRC_EVT_PLAY_STATUS_CHANGED = 0x01,
- BTRC_EVT_TRACK_CHANGE = 0x02,
- BTRC_EVT_TRACK_REACHED_END = 0x03,
- BTRC_EVT_TRACK_REACHED_START = 0x04,
- BTRC_EVT_PLAY_POS_CHANGED = 0x05,
- BTRC_EVT_APP_SETTINGS_CHANGED = 0x08,
- BTRC_EVT_NOW_PLAYING_CONTENT_CHANGED = 0x09,
- BTRC_EVT_AVAL_PLAYER_CHANGE = 0x0a,
- BTRC_EVT_ADDR_PLAYER_CHANGE = 0x0b,
- BTRC_EVT_UIDS_CHANGED = 0x0c,
- BTRC_EVT_VOL_CHANGED = 0x0d,
+ BTRC_EVT_PLAY_STATUS_CHANGED = 0x01,
+ BTRC_EVT_TRACK_CHANGE = 0x02,
+ BTRC_EVT_TRACK_REACHED_END = 0x03,
+ BTRC_EVT_TRACK_REACHED_START = 0x04,
+ BTRC_EVT_PLAY_POS_CHANGED = 0x05,
+ BTRC_EVT_APP_SETTINGS_CHANGED = 0x08,
+ BTRC_EVT_NOW_PLAYING_CONTENT_CHANGED = 0x09,
+ BTRC_EVT_AVAL_PLAYER_CHANGE = 0x0a,
+ BTRC_EVT_ADDR_PLAYER_CHANGE = 0x0b,
+ BTRC_EVT_UIDS_CHANGED = 0x0c,
+ BTRC_EVT_VOL_CHANGED = 0x0d,
} btrc_event_id_t;
typedef enum {
- BTRC_NOTIFICATION_TYPE_INTERIM = 0,
- BTRC_NOTIFICATION_TYPE_CHANGED = 1,
+ BTRC_NOTIFICATION_TYPE_INTERIM = 0,
+ BTRC_NOTIFICATION_TYPE_CHANGED = 1,
} btrc_notification_type_t;
typedef enum {
- BTRC_PLAYER_ATTR_EQUALIZER = 0x01,
- BTRC_PLAYER_ATTR_REPEAT = 0x02,
- BTRC_PLAYER_ATTR_SHUFFLE = 0x03,
- BTRC_PLAYER_ATTR_SCAN = 0x04,
+ BTRC_PLAYER_ATTR_EQUALIZER = 0x01,
+ BTRC_PLAYER_ATTR_REPEAT = 0x02,
+ BTRC_PLAYER_ATTR_SHUFFLE = 0x03,
+ BTRC_PLAYER_ATTR_SCAN = 0x04,
} btrc_player_attr_t;
typedef enum {
- BTRC_MEDIA_ATTR_TITLE = 0x01,
- BTRC_MEDIA_ATTR_ARTIST = 0x02,
- BTRC_MEDIA_ATTR_ALBUM = 0x03,
- BTRC_MEDIA_ATTR_TRACK_NUM = 0x04,
- BTRC_MEDIA_ATTR_NUM_TRACKS = 0x05,
- BTRC_MEDIA_ATTR_GENRE = 0x06,
- BTRC_MEDIA_ATTR_PLAYING_TIME = 0x07,
+ BTRC_MEDIA_ATTR_TITLE = 0x01,
+ BTRC_MEDIA_ATTR_ARTIST = 0x02,
+ BTRC_MEDIA_ATTR_ALBUM = 0x03,
+ BTRC_MEDIA_ATTR_TRACK_NUM = 0x04,
+ BTRC_MEDIA_ATTR_NUM_TRACKS = 0x05,
+ BTRC_MEDIA_ATTR_GENRE = 0x06,
+ BTRC_MEDIA_ATTR_PLAYING_TIME = 0x07,
} btrc_media_attr_t;
typedef enum {
- BTRC_PLAYER_VAL_OFF_REPEAT = 0x01,
- BTRC_PLAYER_VAL_SINGLE_REPEAT = 0x02,
- BTRC_PLAYER_VAL_ALL_REPEAT = 0x03,
- BTRC_PLAYER_VAL_GROUP_REPEAT = 0x04
+ BTRC_PLAYER_VAL_OFF_REPEAT = 0x01,
+ BTRC_PLAYER_VAL_SINGLE_REPEAT = 0x02,
+ BTRC_PLAYER_VAL_ALL_REPEAT = 0x03,
+ BTRC_PLAYER_VAL_GROUP_REPEAT = 0x04
} btrc_player_repeat_val_t;
typedef enum {
- BTRC_PLAYER_VAL_OFF_SHUFFLE = 0x01,
- BTRC_PLAYER_VAL_ALL_SHUFFLE = 0x02,
- BTRC_PLAYER_VAL_GROUP_SHUFFLE = 0x03
+ BTRC_PLAYER_VAL_OFF_SHUFFLE = 0x01,
+ BTRC_PLAYER_VAL_ALL_SHUFFLE = 0x02,
+ BTRC_PLAYER_VAL_GROUP_SHUFFLE = 0x03
} btrc_player_shuffle_val_t;
typedef enum {
- BTRC_STS_BAD_CMD = 0x00, /* Invalid command */
- BTRC_STS_BAD_PARAM = 0x01, /* Invalid parameter */
- BTRC_STS_NOT_FOUND = 0x02, /* Specified parameter is wrong or not found */
- BTRC_STS_INTERNAL_ERR = 0x03, /* Internal Error */
- BTRC_STS_NO_ERROR = 0x04, /* Operation Success */
- BTRC_STS_UID_CHANGED = 0x05, /* UIDs changed */
- BTRC_STS_RESERVED = 0x06, /* Reserved */
- BTRC_STS_INV_DIRN = 0x07, /* Invalid direction */
- BTRC_STS_INV_DIRECTORY = 0x08, /* Invalid directory */
- BTRC_STS_INV_ITEM = 0x09, /* Invalid Item */
- BTRC_STS_INV_SCOPE = 0x0a, /* Invalid scope */
- BTRC_STS_INV_RANGE = 0x0b, /* Invalid range */
- BTRC_STS_DIRECTORY = 0x0c, /* UID is a directory */
- BTRC_STS_MEDIA_IN_USE = 0x0d, /* Media in use */
- BTRC_STS_PLAY_LIST_FULL = 0x0e, /* Playing list full */
- BTRC_STS_SRCH_NOT_SPRTD = 0x0f, /* Search not supported */
- BTRC_STS_SRCH_IN_PROG = 0x10, /* Search in progress */
- BTRC_STS_INV_PLAYER = 0x11, /* Invalid player */
- BTRC_STS_PLAY_NOT_BROW = 0x12, /* Player not browsable */
- BTRC_STS_PLAY_NOT_ADDR = 0x13, /* Player not addressed */
- BTRC_STS_INV_RESULTS = 0x14, /* Invalid results */
- BTRC_STS_NO_AVBL_PLAY = 0x15, /* No available players */
- BTRC_STS_ADDR_PLAY_CHGD = 0x16, /* Addressed player changed */
+ BTRC_STS_BAD_CMD = 0x00, /* Invalid command */
+ BTRC_STS_BAD_PARAM = 0x01, /* Invalid parameter */
+ BTRC_STS_NOT_FOUND = 0x02, /* Specified parameter is wrong or not found */
+ BTRC_STS_INTERNAL_ERR = 0x03, /* Internal Error */
+ BTRC_STS_NO_ERROR = 0x04, /* Operation Success */
+ BTRC_STS_UID_CHANGED = 0x05, /* UIDs changed */
+ BTRC_STS_RESERVED = 0x06, /* Reserved */
+ BTRC_STS_INV_DIRN = 0x07, /* Invalid direction */
+ BTRC_STS_INV_DIRECTORY = 0x08, /* Invalid directory */
+ BTRC_STS_INV_ITEM = 0x09, /* Invalid Item */
+ BTRC_STS_INV_SCOPE = 0x0a, /* Invalid scope */
+ BTRC_STS_INV_RANGE = 0x0b, /* Invalid range */
+ BTRC_STS_DIRECTORY = 0x0c, /* UID is a directory */
+ BTRC_STS_MEDIA_IN_USE = 0x0d, /* Media in use */
+ BTRC_STS_PLAY_LIST_FULL = 0x0e, /* Playing list full */
+ BTRC_STS_SRCH_NOT_SPRTD = 0x0f, /* Search not supported */
+ BTRC_STS_SRCH_IN_PROG = 0x10, /* Search in progress */
+ BTRC_STS_INV_PLAYER = 0x11, /* Invalid player */
+ BTRC_STS_PLAY_NOT_BROW = 0x12, /* Player not browsable */
+ BTRC_STS_PLAY_NOT_ADDR = 0x13, /* Player not addressed */
+ BTRC_STS_INV_RESULTS = 0x14, /* Invalid results */
+ BTRC_STS_NO_AVBL_PLAY = 0x15, /* No available players */
+ BTRC_STS_ADDR_PLAY_CHGD = 0x16, /* Addressed player changed */
} btrc_status_t;
typedef struct {
- uint16_t player_id;
- uint16_t uid_counter;
+ uint16_t player_id;
+ uint16_t uid_counter;
} btrc_addr_player_changed_t;
typedef struct {
- uint8_t num_attr;
- uint8_t attr_ids[BTRC_MAX_APP_SETTINGS];
- uint8_t attr_values[BTRC_MAX_APP_SETTINGS];
+ uint8_t num_attr;
+ uint8_t attr_ids[BTRC_MAX_APP_SETTINGS];
+ uint8_t attr_values[BTRC_MAX_APP_SETTINGS];
} btrc_player_settings_t;
typedef struct {
- uint8_t val;
- uint16_t charset_id;
- uint16_t str_len;
- uint8_t *p_str;
+ uint8_t val;
+ uint16_t charset_id;
+ uint16_t str_len;
+ uint8_t *p_str;
} btrc_player_app_ext_attr_val_t;
typedef struct {
- uint8_t attr_id;
- uint16_t charset_id;
- uint16_t str_len;
- uint8_t *p_str;
- uint8_t num_val;
- btrc_player_app_ext_attr_val_t ext_attr_val[BTRC_MAX_APP_ATTR_SIZE];
+ uint8_t attr_id;
+ uint16_t charset_id;
+ uint16_t str_len;
+ uint8_t *p_str;
+ uint8_t num_val;
+ btrc_player_app_ext_attr_val_t ext_attr_val[BTRC_MAX_APP_ATTR_SIZE];
} btrc_player_app_ext_attr_t;
typedef struct {
- uint8_t attr_id;
- uint8_t num_val;
- uint8_t attr_val[BTRC_MAX_APP_ATTR_SIZE];
+ uint8_t attr_id;
+ uint8_t num_val;
+ uint8_t attr_val[BTRC_MAX_APP_ATTR_SIZE];
} btrc_player_app_attr_t;
typedef struct {
- uint32_t start_item;
- uint32_t end_item;
- uint32_t size;
- uint32_t attrs[BTRC_MAX_ELEM_ATTR_SIZE];
- uint8_t attr_count;
+ uint32_t start_item;
+ uint32_t end_item;
+ uint32_t size;
+ uint32_t attrs[BTRC_MAX_ELEM_ATTR_SIZE];
+ uint8_t attr_count;
} btrc_getfolderitem_t;
typedef struct {
- uint16_t type;
- uint16_t uid_counter;
+ uint16_t type;
+ uint16_t uid_counter;
} btrc_uids_changed_t;
typedef struct {
- uint16_t type;
+ uint16_t type;
} btrc_now_playing_changed_t;
-typedef union
-{
- btrc_play_status_t play_status;
- btrc_uid_t track; /* queue position in NowPlaying */
- uint32_t song_pos;
- uint16_t uid_counter;
- btrc_player_settings_t player_setting;
- btrc_addr_player_changed_t addr_player_changed;
- btrc_uids_changed_t uids_changed;
- btrc_now_playing_changed_t now_playing_changed;
+typedef union {
+ btrc_play_status_t play_status;
+ btrc_uid_t track; /* queue position in NowPlaying */
+ uint32_t song_pos;
+ uint16_t uid_counter;
+ btrc_player_settings_t player_setting;
+ btrc_addr_player_changed_t addr_player_changed;
+ btrc_uids_changed_t uids_changed;
+ btrc_now_playing_changed_t now_playing_changed;
} btrc_register_notification_t;
typedef struct {
- uint8_t id; /* can be attr_id or value_id */
- uint8_t text[BTRC_MAX_ATTR_STR_LEN];
+ uint8_t id; /* can be attr_id or value_id */
+ uint8_t text[BTRC_MAX_ATTR_STR_LEN];
} btrc_player_setting_text_t;
typedef struct {
- uint32_t attr_id;
- uint8_t text[BTRC_MAX_ATTR_STR_LEN];
+ uint32_t attr_id;
+ uint8_t text[BTRC_MAX_ATTR_STR_LEN];
} btrc_element_attr_val_t;
typedef struct {
- uint16_t player_id;
- uint8_t major_type;
- uint32_t sub_type;
- uint8_t play_status;
- uint8_t features[BTRC_FEATURE_BIT_MASK_SIZE];
- uint16_t charset_id;
- uint8_t name[BTRC_MAX_ATTR_STR_LEN];
+ uint16_t player_id;
+ uint8_t major_type;
+ uint32_t sub_type;
+ uint8_t play_status;
+ uint8_t features[BTRC_FEATURE_BIT_MASK_SIZE];
+ uint16_t charset_id;
+ uint8_t name[BTRC_MAX_ATTR_STR_LEN];
} btrc_item_player_t;
typedef struct {
- uint8_t uid[BTRC_UID_SIZE];
- uint8_t type;
- uint8_t playable;
- uint16_t charset_id;
- uint8_t name[BTRC_MAX_ATTR_STR_LEN];
+ uint8_t uid[BTRC_UID_SIZE];
+ uint8_t type;
+ uint8_t playable;
+ uint16_t charset_id;
+ uint8_t name[BTRC_MAX_ATTR_STR_LEN];
} btrc_item_folder_t;
typedef struct {
- uint8_t uid[BTRC_UID_SIZE];
- uint8_t type;
- uint16_t charset_id;
- uint8_t name[BTRC_MAX_ATTR_STR_LEN];
- int num_attrs;
- btrc_element_attr_val_t* p_attrs;
+ uint8_t uid[BTRC_UID_SIZE];
+ uint8_t type;
+ uint16_t charset_id;
+ uint8_t name[BTRC_MAX_ATTR_STR_LEN];
+ int num_attrs;
+ btrc_element_attr_val_t* p_attrs;
} btrc_item_media_t;
typedef struct {
- uint8_t item_type;
- union
- {
- btrc_item_player_t player;
- btrc_item_folder_t folder;
- btrc_item_media_t media;
- };
+ uint8_t item_type;
+ union {
+ btrc_item_player_t player;
+ btrc_item_folder_t folder;
+ btrc_item_media_t media;
+ };
} btrc_folder_items_t;
typedef struct {
- uint16_t str_len;
- uint8_t p_str[BTRC_MAX_ATTR_STR_LEN];
+ uint16_t str_len;
+ uint8_t p_str[BTRC_MAX_ATTR_STR_LEN];
} btrc_br_folder_name_t;
#ifdef TIZEN_BT_HAL
/** Callback for the target connection state */
-typedef void (* btrc_tg_connection_state_callback) (bt_bdaddr_t *bd_addr, btrc_connection_state_t state);
+typedef void (*btrc_tg_connection_state_callback) (bt_bdaddr_t *bd_addr, btrc_connection_state_t state);
#endif
/** Callback for the controller's supported feautres */
-typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
- btrc_remote_features_t features);
+typedef void (*btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
+ btrc_remote_features_t features);
/** Callback for play status request */
-typedef void (* btrc_get_play_status_callback)(bt_bdaddr_t *bd_addr);
+typedef void (*btrc_get_play_status_callback)(bt_bdaddr_t *bd_addr);
/** Callback for list player application attributes (Shuffle, Repeat,...) */
-typedef void (* btrc_list_player_app_attr_callback)(bt_bdaddr_t *bd_addr);
+typedef void (*btrc_list_player_app_attr_callback)(bt_bdaddr_t *bd_addr);
/** Callback for list player application attributes (Shuffle, Repeat,...) */
-typedef void (* btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id,
- bt_bdaddr_t *bd_addr);
+typedef void (*btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id,
+ bt_bdaddr_t *bd_addr);
/** Callback for getting the current player application settings value
-** num_attr: specifies the number of attribute ids contained in p_attrs
-*/
-typedef void (* btrc_get_player_app_value_callback) (uint8_t num_attr,
- btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
+ ** num_attr: specifies the number of attribute ids contained in p_attrs
+ */
+typedef void (*btrc_get_player_app_value_callback) (uint8_t num_attr,
+ btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
/** Callback for getting the player application settings attributes' text
-** num_attr: specifies the number of attribute ids contained in p_attrs
-*/
-typedef void (* btrc_get_player_app_attrs_text_callback) (uint8_t num_attr,
- btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
+ ** num_attr: specifies the number of attribute ids contained in p_attrs
+ */
+typedef void (*btrc_get_player_app_attrs_text_callback) (uint8_t num_attr,
+ btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
/** Callback for getting the player application settings values' text
-** num_attr: specifies the number of value ids contained in p_vals
-*/
-typedef void (* btrc_get_player_app_values_text_callback) (uint8_t attr_id, uint8_t num_val,
- uint8_t *p_vals, bt_bdaddr_t *bd_addr);
+ ** num_attr: specifies the number of value ids contained in p_vals
+ */
+typedef void (*btrc_get_player_app_values_text_callback) (uint8_t attr_id, uint8_t num_val,
+ uint8_t *p_vals, bt_bdaddr_t *bd_addr);
/** Callback for setting the player application settings values */
-typedef void (* btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals,
- bt_bdaddr_t *bd_addr);
+typedef void (*btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals,
+ bt_bdaddr_t *bd_addr);
/** Callback to fetch the get element attributes of the current song
-** num_attr: specifies the number of attributes requested in p_attrs
-*/
-typedef void (* btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs,
- bt_bdaddr_t *bd_addr);
+ ** num_attr: specifies the number of attributes requested in p_attrs
+ */
+typedef void (*btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs,
+ bt_bdaddr_t *bd_addr);
/** Callback for register notification (Play state change/track change/...)
-** param: Is only valid if event_id is BTRC_EVT_PLAY_POS_CHANGED
-*/
-typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param,
- bt_bdaddr_t *bd_addr);
+ ** param: Is only valid if event_id is BTRC_EVT_PLAY_POS_CHANGED
+ */
+typedef void (*btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param,
+ bt_bdaddr_t *bd_addr);
/* AVRCP 1.4 Enhancements */
/** Callback for volume change on CT
-** volume: Current volume setting on the CT (0-127)
-*/
-typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr);
+ ** volume: Current volume setting on the CT (0-127)
+ */
+typedef void (*btrc_volume_change_callback) (uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr);
/** Callback for passthrough commands */
-typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state, bt_bdaddr_t *bd_addr);
+typedef void (*btrc_passthrough_cmd_callback) (int id, int key_state, bt_bdaddr_t *bd_addr);
/** Callback for set addressed player response on TG **/
-typedef void (* btrc_set_addressed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
+typedef void (*btrc_set_addressed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
/** Callback for set browsed player response on TG **/
-typedef void (* btrc_set_browsed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
+typedef void (*btrc_set_browsed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
/** Callback for get folder items on TG
-** num_attr: specifies the number of attributes requested in p_attr_ids
-*/
-typedef void (* btrc_get_folder_items_callback) (uint8_t scope, uint32_t start_item,
- uint32_t end_item, uint8_t num_attr, uint32_t *p_attr_ids, bt_bdaddr_t *bd_addr);
+ ** num_attr: specifies the number of attributes requested in p_attr_ids
+ */
+typedef void (*btrc_get_folder_items_callback) (uint8_t scope, uint32_t start_item,
+ uint32_t end_item, uint8_t num_attr, uint32_t *p_attr_ids, bt_bdaddr_t *bd_addr);
/** Callback for changing browsed path on TG **/
-typedef void (* btrc_change_path_callback) (uint8_t direction,
- uint8_t* folder_uid, bt_bdaddr_t *bd_addr);
+typedef void (*btrc_change_path_callback) (uint8_t direction,
+ uint8_t* folder_uid, bt_bdaddr_t *bd_addr);
/** Callback to fetch the get item attributes of the media item
-** num_attr: specifies the number of attributes requested in p_attrs
-*/
-typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint8_t* uid, uint16_t uid_counter,
- uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
+ ** num_attr: specifies the number of attributes requested in p_attrs
+ */
+typedef void (*btrc_get_item_attr_callback) (uint8_t scope, uint8_t* uid, uint16_t uid_counter,
+ uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
/** Callback for play request for the media item indicated by an identifier */
-typedef void (* btrc_play_item_callback) (uint8_t scope,
- uint16_t uid_counter, uint8_t* uid, bt_bdaddr_t *bd_addr);
+typedef void (*btrc_play_item_callback) (uint8_t scope,
+ uint16_t uid_counter, uint8_t* uid, bt_bdaddr_t *bd_addr);
/** Callback to fetch total number of items from a folder **/
-typedef void (* btrc_get_total_num_of_items_callback) (uint8_t scope, bt_bdaddr_t *bd_addr);
+typedef void (*btrc_get_total_num_of_items_callback) (uint8_t scope, bt_bdaddr_t *bd_addr);
/** Callback for conducting recursive search on a current browsed path for a specified string */
-typedef void (* btrc_search_callback) (uint16_t charset_id,
- uint16_t str_len, uint8_t* p_str, bt_bdaddr_t *bd_addr);
+typedef void (*btrc_search_callback) (uint16_t charset_id,
+ uint16_t str_len, uint8_t* p_str, bt_bdaddr_t *bd_addr);
/** Callback to add a specified media item indicated by an identifier to now playing queue. */
-typedef void (* btrc_add_to_now_playing_callback) (uint8_t scope,
- uint8_t* uid, uint16_t uid_counter, bt_bdaddr_t *bd_addr);
+typedef void (*btrc_add_to_now_playing_callback) (uint8_t scope,
+ uint8_t* uid, uint16_t uid_counter, bt_bdaddr_t *bd_addr);
/** BT-RC Target callback structure. */
typedef struct {
- /** set to sizeof(BtRcCallbacks) */
- size_t size;
+ /** set to sizeof(BtRcCallbacks) */
+ size_t size;
#ifdef TIZEN_BT_HAL
- btrc_tg_connection_state_callback connection_state_cb;
+ btrc_tg_connection_state_callback connection_state_cb;
#endif
- btrc_remote_features_callback remote_features_cb;
- btrc_get_play_status_callback get_play_status_cb;
- btrc_list_player_app_attr_callback list_player_app_attr_cb;
- btrc_list_player_app_values_callback list_player_app_values_cb;
- btrc_get_player_app_value_callback get_player_app_value_cb;
- btrc_get_player_app_attrs_text_callback get_player_app_attrs_text_cb;
- btrc_get_player_app_values_text_callback get_player_app_values_text_cb;
- btrc_set_player_app_value_callback set_player_app_value_cb;
- btrc_get_element_attr_callback get_element_attr_cb;
- btrc_register_notification_callback register_notification_cb;
- btrc_volume_change_callback volume_change_cb;
- btrc_passthrough_cmd_callback passthrough_cmd_cb;
- btrc_set_addressed_player_callback set_addressed_player_cb;
- btrc_set_browsed_player_callback set_browsed_player_cb;
- btrc_get_folder_items_callback get_folder_items_cb;
- btrc_change_path_callback change_path_cb;
- btrc_get_item_attr_callback get_item_attr_cb;
- btrc_play_item_callback play_item_cb;
- btrc_get_total_num_of_items_callback get_total_num_of_items_cb;
- btrc_search_callback search_cb;
- btrc_add_to_now_playing_callback add_to_now_playing_cb;
+ btrc_remote_features_callback remote_features_cb;
+ btrc_get_play_status_callback get_play_status_cb;
+ btrc_list_player_app_attr_callback list_player_app_attr_cb;
+ btrc_list_player_app_values_callback list_player_app_values_cb;
+ btrc_get_player_app_value_callback get_player_app_value_cb;
+ btrc_get_player_app_attrs_text_callback get_player_app_attrs_text_cb;
+ btrc_get_player_app_values_text_callback get_player_app_values_text_cb;
+ btrc_set_player_app_value_callback set_player_app_value_cb;
+ btrc_get_element_attr_callback get_element_attr_cb;
+ btrc_register_notification_callback register_notification_cb;
+ btrc_volume_change_callback volume_change_cb;
+ btrc_passthrough_cmd_callback passthrough_cmd_cb;
+ btrc_set_addressed_player_callback set_addressed_player_cb;
+ btrc_set_browsed_player_callback set_browsed_player_cb;
+ btrc_get_folder_items_callback get_folder_items_cb;
+ btrc_change_path_callback change_path_cb;
+ btrc_get_item_attr_callback get_item_attr_cb;
+ btrc_play_item_callback play_item_cb;
+ btrc_get_total_num_of_items_callback get_total_num_of_items_cb;
+ btrc_search_callback search_cb;
+ btrc_add_to_now_playing_callback add_to_now_playing_cb;
} btrc_callbacks_t;
/** Represents the standard BT-RC AVRCP Target interface. */
typedef struct {
- /** set to sizeof(BtRcInterface) */
- size_t size;
- /**
- * Register the BtRc callbacks
- */
- bt_status_t (*init)( btrc_callbacks_t* callbacks );
+ /** set to sizeof(BtRcInterface) */
+ size_t size;
+ /**
+ * Register the BtRc callbacks
+ */
+ bt_status_t (*init)(btrc_callbacks_t* callbacks);
#ifdef TIZEN_BT_HAL
- /** connect to AVRCP controller device */
- bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
+ /** connect to AVRCP controller device */
+ bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
- /** dis-connect from AVRCP controller device */
- bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
+ /** dis-connect from AVRCP controller device */
+ bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
#endif
- /** Respose to GetPlayStatus request. Contains the current
- ** 1. Play status
- ** 2. Song duration/length
- ** 3. Song position
- */
- bt_status_t (*get_play_status_rsp)( bt_bdaddr_t *bd_addr, btrc_play_status_t play_status,
- uint32_t song_len, uint32_t song_pos);
-
- /** Lists the support player application attributes (Shuffle/Repeat/...)
- ** num_attr: Specifies the number of attributes contained in the pointer p_attrs
- */
- bt_status_t (*list_player_app_attr_rsp)( bt_bdaddr_t *bd_addr, int num_attr,
- btrc_player_attr_t *p_attrs);
-
- /** Lists the support player application attributes (Shuffle Off/On/Group)
- ** num_val: Specifies the number of values contained in the pointer p_vals
- */
- bt_status_t (*list_player_app_value_rsp)( bt_bdaddr_t *bd_addr, int num_val, uint8_t *p_vals);
-
- /** Returns the current application attribute values for each of the specified attr_id */
- bt_status_t (*get_player_app_value_rsp)( bt_bdaddr_t *bd_addr, btrc_player_settings_t *p_vals);
-
- /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
- ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
- */
- bt_status_t (*get_player_app_attr_text_rsp)( bt_bdaddr_t *bd_addr, int num_attr,
- btrc_player_setting_text_t *p_attrs);
-
- /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
- ** num_attr: Specifies the number of attribute values' text contained in the pointer p_vals
- */
- bt_status_t (*get_player_app_value_text_rsp)( bt_bdaddr_t *bd_addr, int num_val,
- btrc_player_setting_text_t *p_vals);
-
- /** Returns the current songs' element attributes text ("Title"/"Album"/"Artist")
- ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
- */
- bt_status_t (*get_element_attr_rsp)( bt_bdaddr_t *bd_addr, uint8_t num_attr,
- btrc_element_attr_val_t *p_attrs);
-
- /** Response to set player attribute request ("Shuffle"/"Repeat")
- ** rsp_status: Status of setting the player attributes for the current media player
- */
- bt_status_t (*set_player_app_value_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
-
- /* Response to the register notification request (Play state change/track change/...).
- ** event_id: Refers to the event_id this notification change corresponds too
- ** type: Response type - interim/changed
- ** p_params: Based on the event_id, this parameter should be populated
- */
- bt_status_t (*register_notification_rsp)(btrc_event_id_t event_id,
- btrc_notification_type_t type,
- btrc_register_notification_t *p_param);
-
- /* AVRCP 1.4 enhancements */
-
- /**Send current volume setting to remote side. Support limited to SetAbsoluteVolume
- ** This can be enhanced to support Relative Volume (AVRCP 1.0).
- ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level
- ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
- */
- bt_status_t (*set_volume)(uint8_t volume);
-
- /* Set addressed player response from TG to CT */
- bt_status_t (*set_addressed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
-
- /* Set browsed player response from TG to CT */
- bt_status_t (*set_browsed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
- uint32_t num_items, uint16_t charset_id, uint8_t folder_depth,
- btrc_br_folder_name_t *p_folders);
-
- /* Get folder item list response from TG to CT */
- bt_status_t (*get_folder_items_list_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
- uint16_t uid_counter, uint8_t num_items, btrc_folder_items_t *p_items);
-
- /* Change path response from TG to CT */
- bt_status_t (*change_path_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
- uint32_t num_items);
-
- /** Returns the element's attributes num_attr: Specifies the number of attributes' text
- * contained in the pointer p_attrs
- */
- bt_status_t (*get_item_attr_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
- uint8_t num_attr, btrc_element_attr_val_t *p_attrs);
-
- /* play media item response from TG to CT */
- bt_status_t (*play_item_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
-
- /* get total number of items response from TG to CT*/
- bt_status_t (*get_total_num_of_items_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
- uint32_t uid_counter, uint32_t num_items);
-
- /* Search VFS response from TG to CT */
- bt_status_t (*search_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status, uint32_t uid_counter,
- uint32_t num_items);
-
- /* add_to_now playing list response from TG to CT */
- bt_status_t (*add_to_now_playing_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
-
- /** Closes the interface. */
- void (*cleanup)( void );
+ /** Respose to GetPlayStatus request. Contains the current
+ ** 1. Play status
+ ** 2. Song duration/length
+ ** 3. Song position
+ */
+ bt_status_t (*get_play_status_rsp)(bt_bdaddr_t *bd_addr, btrc_play_status_t play_status,
+ uint32_t song_len, uint32_t song_pos);
+
+ /** Lists the support player application attributes (Shuffle/Repeat/...)
+ ** num_attr: Specifies the number of attributes contained in the pointer p_attrs
+ */
+ bt_status_t (*list_player_app_attr_rsp)(bt_bdaddr_t *bd_addr, int num_attr,
+ btrc_player_attr_t *p_attrs);
+
+ /** Lists the support player application attributes (Shuffle Off/On/Group)
+ ** num_val: Specifies the number of values contained in the pointer p_vals
+ */
+ bt_status_t (*list_player_app_value_rsp)(bt_bdaddr_t *bd_addr, int num_val, uint8_t *p_vals);
+
+ /** Returns the current application attribute values for each of the specified attr_id */
+ bt_status_t (*get_player_app_value_rsp)(bt_bdaddr_t *bd_addr, btrc_player_settings_t *p_vals);
+
+ /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
+ ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
+ */
+ bt_status_t (*get_player_app_attr_text_rsp)(bt_bdaddr_t *bd_addr, int num_attr,
+ btrc_player_setting_text_t *p_attrs);
+
+ /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
+ ** num_attr: Specifies the number of attribute values' text contained in the pointer p_vals
+ */
+ bt_status_t (*get_player_app_value_text_rsp)(bt_bdaddr_t *bd_addr, int num_val,
+ btrc_player_setting_text_t *p_vals);
+
+ /** Returns the current songs' element attributes text ("Title"/"Album"/"Artist")
+ ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
+ */
+ bt_status_t (*get_element_attr_rsp)(bt_bdaddr_t *bd_addr, uint8_t num_attr,
+ btrc_element_attr_val_t *p_attrs);
+
+ /** Response to set player attribute request ("Shuffle"/"Repeat")
+ ** rsp_status: Status of setting the player attributes for the current media player
+ */
+ bt_status_t (*set_player_app_value_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
+
+ /* Response to the register notification request (Play state change/track change/...).
+ ** event_id: Refers to the event_id this notification change corresponds too
+ ** type: Response type - interim/changed
+ ** p_params: Based on the event_id, this parameter should be populated
+ */
+ bt_status_t (*register_notification_rsp)(btrc_event_id_t event_id,
+ btrc_notification_type_t type,
+ btrc_register_notification_t *p_param);
+
+ /* AVRCP 1.4 enhancements */
+
+ /**Send current volume setting to remote side. Support limited to SetAbsoluteVolume
+ ** This can be enhanced to support Relative Volume (AVRCP 1.0).
+ ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level
+ ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
+ */
+ bt_status_t (*set_volume)(uint8_t volume);
+
+ /* Set addressed player response from TG to CT */
+ bt_status_t (*set_addressed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
+
+ /* Set browsed player response from TG to CT */
+ bt_status_t (*set_browsed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
+ uint32_t num_items, uint16_t charset_id, uint8_t folder_depth,
+ btrc_br_folder_name_t *p_folders);
+
+ /* Get folder item list response from TG to CT */
+ bt_status_t (*get_folder_items_list_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
+ uint16_t uid_counter, uint8_t num_items, btrc_folder_items_t *p_items);
+
+ /* Change path response from TG to CT */
+ bt_status_t (*change_path_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
+ uint32_t num_items);
+
+ /** Returns the element's attributes num_attr: Specifies the number of attributes' text
+ * contained in the pointer p_attrs
+ */
+ bt_status_t (*get_item_attr_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
+ uint8_t num_attr, btrc_element_attr_val_t *p_attrs);
+
+ /* play media item response from TG to CT */
+ bt_status_t (*play_item_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
+
+ /* get total number of items response from TG to CT*/
+ bt_status_t (*get_total_num_of_items_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
+ uint32_t uid_counter, uint32_t num_items);
+
+ /* Search VFS response from TG to CT */
+ bt_status_t (*search_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status, uint32_t uid_counter,
+ uint32_t num_items);
+
+ /* add_to_now playing list response from TG to CT */
+ bt_status_t (*add_to_now_playing_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
+
+ /** Closes the interface. */
+ void (*cleanup)(void);
} btrc_interface_t;
-typedef void (* btrc_passthrough_rsp_callback) (bt_bdaddr_t *bd_addr, int id, int key_state);
+typedef void (*btrc_passthrough_rsp_callback) (bt_bdaddr_t *bd_addr, int id, int key_state);
-typedef void (* btrc_groupnavigation_rsp_callback) (int id, int key_state);
+typedef void (*btrc_groupnavigation_rsp_callback) (int id, int key_state);
-typedef void (* btrc_connection_state_callback) (
- bool rc_connect, bool bt_connect, bt_bdaddr_t *bd_addr);
+typedef void (*btrc_connection_state_callback) (
+ bool rc_connect, bool bt_connect, bt_bdaddr_t *bd_addr);
-typedef void (* btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features);
+typedef void (*btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features);
-typedef void (* btrc_ctrl_setabsvol_cmd_callback) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
+typedef void (*btrc_ctrl_setabsvol_cmd_callback) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
-typedef void (* btrc_ctrl_registernotification_abs_vol_callback) (bt_bdaddr_t *bd_addr, uint8_t label);
+typedef void (*btrc_ctrl_registernotification_abs_vol_callback) (bt_bdaddr_t *bd_addr, uint8_t label);
-typedef void (* btrc_ctrl_setplayerapplicationsetting_rsp_callback) (bt_bdaddr_t *bd_addr,
- uint8_t accepted);
+typedef void (*btrc_ctrl_setplayerapplicationsetting_rsp_callback) (bt_bdaddr_t *bd_addr,
+ uint8_t accepted);
-typedef void (* btrc_ctrl_playerapplicationsetting_callback)(bt_bdaddr_t *bd_addr,
- uint8_t num_attr,
- btrc_player_app_attr_t *app_attrs,
- uint8_t num_ext_attr,
- btrc_player_app_ext_attr_t *ext_attrs);
+typedef void (*btrc_ctrl_playerapplicationsetting_callback)(bt_bdaddr_t *bd_addr,
+ uint8_t num_attr,
+ btrc_player_app_attr_t *app_attrs,
+ uint8_t num_ext_attr,
+ btrc_player_app_ext_attr_t *ext_attrs);
-typedef void (* btrc_ctrl_playerapplicationsetting_changed_callback)(bt_bdaddr_t *bd_addr,
- btrc_player_settings_t *p_vals);
+typedef void (*btrc_ctrl_playerapplicationsetting_changed_callback)(bt_bdaddr_t *bd_addr,
+ btrc_player_settings_t *p_vals);
-typedef void (* btrc_ctrl_track_changed_callback)(bt_bdaddr_t *bd_addr, uint8_t num_attr,
- btrc_element_attr_val_t *p_attrs);
+typedef void (*btrc_ctrl_track_changed_callback)(bt_bdaddr_t *bd_addr, uint8_t num_attr,
+ btrc_element_attr_val_t *p_attrs);
-typedef void (* btrc_ctrl_play_position_changed_callback)(bt_bdaddr_t *bd_addr,
- uint32_t song_len, uint32_t song_pos);
+typedef void (*btrc_ctrl_play_position_changed_callback)(bt_bdaddr_t *bd_addr,
+ uint32_t song_len, uint32_t song_pos);
-typedef void (* btrc_ctrl_play_status_changed_callback)(bt_bdaddr_t *bd_addr,
- btrc_play_status_t play_status);
+typedef void (*btrc_ctrl_play_status_changed_callback)(bt_bdaddr_t *bd_addr,
+ btrc_play_status_t play_status);
-typedef void (* btrc_ctrl_get_folder_items_callback )(bt_bdaddr_t *bd_addr,
- btrc_status_t status,
- const btrc_folder_items_t *folder_items,
- uint8_t count);
+typedef void (*btrc_ctrl_get_folder_items_callback)(bt_bdaddr_t *bd_addr,
+ btrc_status_t status,
+ const btrc_folder_items_t *folder_items,
+ uint8_t count);
-typedef void (* btrc_ctrl_change_path_callback)(bt_bdaddr_t *bd_addr, uint8_t count);
+typedef void (*btrc_ctrl_change_path_callback)(bt_bdaddr_t *bd_addr, uint8_t count);
-typedef void (* btrc_ctrl_set_browsed_player_callback )(
- bt_bdaddr_t *bd_addr, uint8_t num_items, uint8_t depth);
-typedef void (* btrc_ctrl_set_addressed_player_callback)(bt_bdaddr_t *bd_addr, uint8_t status);
+typedef void (*btrc_ctrl_set_browsed_player_callback)(
+ bt_bdaddr_t *bd_addr, uint8_t num_items, uint8_t depth);
+typedef void (*btrc_ctrl_set_addressed_player_callback)(bt_bdaddr_t *bd_addr, uint8_t status);
/** BT-RC Controller callback structure. */
typedef struct {
- /** set to sizeof(BtRcCallbacks) */
- size_t size;
- btrc_passthrough_rsp_callback passthrough_rsp_cb;
- btrc_groupnavigation_rsp_callback groupnavigation_rsp_cb;
- btrc_connection_state_callback connection_state_cb;
- btrc_ctrl_getrcfeatures_callback getrcfeatures_cb;
- btrc_ctrl_setplayerapplicationsetting_rsp_callback setplayerappsetting_rsp_cb;
- btrc_ctrl_playerapplicationsetting_callback playerapplicationsetting_cb;
- btrc_ctrl_playerapplicationsetting_changed_callback playerapplicationsetting_changed_cb;
- btrc_ctrl_setabsvol_cmd_callback setabsvol_cmd_cb;
- btrc_ctrl_registernotification_abs_vol_callback registernotification_absvol_cb;
- btrc_ctrl_track_changed_callback track_changed_cb;
- btrc_ctrl_play_position_changed_callback play_position_changed_cb;
- btrc_ctrl_play_status_changed_callback play_status_changed_cb;
- btrc_ctrl_get_folder_items_callback get_folder_items_cb;
- btrc_ctrl_change_path_callback change_folder_path_cb;
- btrc_ctrl_set_browsed_player_callback set_browsed_player_cb;
- btrc_ctrl_set_addressed_player_callback set_addressed_player_cb;
+ /** set to sizeof(BtRcCallbacks) */
+ size_t size;
+ btrc_passthrough_rsp_callback passthrough_rsp_cb;
+ btrc_groupnavigation_rsp_callback groupnavigation_rsp_cb;
+ btrc_connection_state_callback connection_state_cb;
+ btrc_ctrl_getrcfeatures_callback getrcfeatures_cb;
+ btrc_ctrl_setplayerapplicationsetting_rsp_callback setplayerappsetting_rsp_cb;
+ btrc_ctrl_playerapplicationsetting_callback playerapplicationsetting_cb;
+ btrc_ctrl_playerapplicationsetting_changed_callback playerapplicationsetting_changed_cb;
+ btrc_ctrl_setabsvol_cmd_callback setabsvol_cmd_cb;
+ btrc_ctrl_registernotification_abs_vol_callback registernotification_absvol_cb;
+ btrc_ctrl_track_changed_callback track_changed_cb;
+ btrc_ctrl_play_position_changed_callback play_position_changed_cb;
+ btrc_ctrl_play_status_changed_callback play_status_changed_cb;
+ btrc_ctrl_get_folder_items_callback get_folder_items_cb;
+ btrc_ctrl_change_path_callback change_folder_path_cb;
+ btrc_ctrl_set_browsed_player_callback set_browsed_player_cb;
+ btrc_ctrl_set_addressed_player_callback set_addressed_player_cb;
} btrc_ctrl_callbacks_t;
/** Represents the standard BT-RC AVRCP Controller interface. */
/**
* Register the BtRc callbacks
*/
- bt_status_t (*init)( btrc_ctrl_callbacks_t* callbacks );
+ bt_status_t (*init)(btrc_ctrl_callbacks_t* callbacks);
#ifdef TIZEN_BT_HAL
/** connect to headset */
- bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
+ bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
/** dis-connect from headset */
- bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
+ bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
#endif
/** send pass through command to target */
bt_status_t (*send_pass_through_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
- uint8_t key_state );
+ uint8_t key_state);
/** send group navigation command to target */
bt_status_t (*send_group_navigation_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
- uint8_t key_state );
+ uint8_t key_state);
/** send command to set player applicaiton setting attributes to target */
bt_status_t (*set_player_app_setting_cmd) (bt_bdaddr_t *bd_addr, uint8_t num_attrib,
uint8_t abs_vol, uint8_t label);
/** Closes the interface. */
- void (*cleanup)( void );
+ void (*cleanup)(void);
} btrc_ctrl_interface_t;
__END_DECLS
#define BTSOCK_FLAG_AUTH (1 << 1)
typedef enum {
- BTSOCK_RFCOMM = 1,
- BTSOCK_SCO = 2,
- BTSOCK_L2CAP = 3
+ BTSOCK_RFCOMM = 1,
+ BTSOCK_SCO = 2,
+ BTSOCK_L2CAP = 3
} btsock_type_t;
/** Represents the standard BT SOCKET interface. */
typedef struct {
- short size;
- bt_bdaddr_t bd_addr;
- int channel;
- int status;
+ short size;
+ bt_bdaddr_t bd_addr;
+ int channel;
+ int status;
} __attribute__((packed)) sock_connect_signal_t;
typedef struct {
- /** set to size of this struct*/
- size_t size;
- /**
- * listen to a rfcomm uuid or channel. It returns the socket fd from which
- * btsock_connect_signal can be read out when a remote device connected
- */
- bt_status_t (*listen)(btsock_type_t type, const char* service_name, const uint8_t* service_uuid, int channel, int* sock_fd, int flags);
- /*
- * connect to a rfcomm uuid channel of remote device, It returns the socket fd from which
- * the btsock_connect_signal and a new socket fd to be accepted can be read out when connected
- */
- bt_status_t (*connect)(const bt_bdaddr_t *bd_addr, btsock_type_t type, const uint8_t* uuid, int channel, int* sock_fd, int flags);
+ /** set to size of this struct*/
+ size_t size;
+ /**
+ * listen to a rfcomm uuid or channel. It returns the socket fd from which
+ * btsock_connect_signal can be read out when a remote device connected
+ */
+ bt_status_t (*listen)(btsock_type_t type, const char* service_name, const uint8_t* service_uuid, int channel, int* sock_fd, int flags);
+ /*
+ * connect to a rfcomm uuid channel of remote device, It returns the socket fd from which
+ * the btsock_connect_signal and a new socket fd to be accepted can be read out when connected
+ */
+ bt_status_t (*connect)(const bt_bdaddr_t *bd_addr, btsock_type_t type, const uint8_t* uuid, int channel, int* sock_fd, int flags);
} btsock_interface_t;
handle = dlopen(path, RTLD_NOW);
if (handle == NULL) {
char const *err_str = dlerror();
- error("load: module=%s\n%s", path, err_str?err_str:"unknown");
+ error("load: module=%s\n%s", path, err_str ? err_str : "unknown");
status = -EINVAL;
goto done;
}
* Value for the hw_module_t.tag field
*/
-#define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
+#define MAKE_TAG_CONSTANT(A, B, C, D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
#define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
#define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
-#define HARDWARE_MAKE_API_VERSION(maj,min) \
- ((((maj) & 0xff) << 8) | ((min) & 0xff))
+#define HARDWARE_MAKE_API_VERSION(maj, min) \
+ ((((maj) & 0xff) << 8) | ((min) & 0xff))
-#define HARDWARE_MAKE_API_VERSION_2(maj,min,hdr) \
- ((((maj) & 0xff) << 24) | (((min) & 0xff) << 16) | ((hdr) & 0xffff))
+#define HARDWARE_MAKE_API_VERSION_2(maj, min, hdr) \
+ ((((maj) & 0xff) << 24) | (((min) & 0xff) << 16) | ((hdr) & 0xffff))
#define HARDWARE_API_VERSION_2_MAJ_MIN_MASK 0xffff0000
#define HARDWARE_API_VERSION_2_HEADER_MASK 0x0000ffff
*
* Use this macro to set the hw_module_t.module_api_version field.
*/
-#define HARDWARE_MODULE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min)
-#define HARDWARE_MODULE_API_VERSION_2(maj,min,hdr) HARDWARE_MAKE_API_VERSION_2(maj,min,hdr)
+#define HARDWARE_MODULE_API_VERSION(maj, min) HARDWARE_MAKE_API_VERSION(maj, min)
+#define HARDWARE_MODULE_API_VERSION_2(maj, min, hdr) HARDWARE_MAKE_API_VERSION_2(maj, min, hdr)
/*
* Use this macro to set the hw_device_t.version field
*/
-#define HARDWARE_DEVICE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min)
-#define HARDWARE_DEVICE_API_VERSION_2(maj,min,hdr) HARDWARE_MAKE_API_VERSION_2(maj,min,hdr)
+#define HARDWARE_DEVICE_API_VERSION(maj, min) HARDWARE_MAKE_API_VERSION(maj, min)
+#define HARDWARE_DEVICE_API_VERSION_2(maj, min, hdr) HARDWARE_MAKE_API_VERSION_2(maj, min, hdr)
struct hw_module_t;
struct hw_module_methods_t;
* followed by module specific information.
*/
typedef struct hw_module_t {
- /** tag must be initialized to HARDWARE_MODULE_TAG */
- uint32_t tag;
-
- /**
- * The API version of the implemented module. The module owner is
- * responsible for updating the version when a module interface has
- * changed.
- *
- * The derived modules such as gralloc and audio own and manage this field.
- * The module user must interpret the version field to decide whether or
- * not to inter-operate with the supplied module implementation.
- * For example, SurfaceFlinger is responsible for making sure that
- * it knows how to manage different versions of the gralloc-module API,
- * and AudioFlinger must know how to do the same for audio-module API.
- *
- * The module API version should include a major and a minor component.
- * For example, version 1.0 could be represented as 0x0100. This format
- * implies that versions 0x0100-0x01ff are all API-compatible.
- *
- * In the future, libhardware will expose a hw_get_module_version()
- * (or equivalent) function that will take minimum/maximum supported
- * versions as arguments and would be able to reject modules with
- * versions outside of the supplied range.
- */
- uint16_t module_api_version;
+ /** tag must be initialized to HARDWARE_MODULE_TAG */
+ uint32_t tag;
+
+ /**
+ * The API version of the implemented module. The module owner is
+ * responsible for updating the version when a module interface has
+ * changed.
+ *
+ * The derived modules such as gralloc and audio own and manage this field.
+ * The module user must interpret the version field to decide whether or
+ * not to inter-operate with the supplied module implementation.
+ * For example, SurfaceFlinger is responsible for making sure that
+ * it knows how to manage different versions of the gralloc-module API,
+ * and AudioFlinger must know how to do the same for audio-module API.
+ *
+ * The module API version should include a major and a minor component.
+ * For example, version 1.0 could be represented as 0x0100. This format
+ * implies that versions 0x0100-0x01ff are all API-compatible.
+ *
+ * In the future, libhardware will expose a hw_get_module_version()
+ * (or equivalent) function that will take minimum/maximum supported
+ * versions as arguments and would be able to reject modules with
+ * versions outside of the supplied range.
+ */
+ uint16_t module_api_version;
#define version_major module_api_version
- /**
- * version_major/version_minor defines are supplied here for temporary
- * source code compatibility. They will be removed in the next version.
- * ALL clients must convert to the new version format.
- */
-
- /**
- * The API version of the HAL module interface. This is meant to
- * version the hw_module_t, hw_module_methods_t, and hw_device_t
- * structures and definitions.
- *
- * The HAL interface owns this field. Module users/implementations
- * must NOT rely on this value for version information.
- *
- * Presently, 0 is the only valid value.
- */
- uint16_t hal_api_version;
+ /**
+ * version_major/version_minor defines are supplied here for temporary
+ * source code compatibility. They will be removed in the next version.
+ * ALL clients must convert to the new version format.
+ */
+
+ /**
+ * The API version of the HAL module interface. This is meant to
+ * version the hw_module_t, hw_module_methods_t, and hw_device_t
+ * structures and definitions.
+ *
+ * The HAL interface owns this field. Module users/implementations
+ * must NOT rely on this value for version information.
+ *
+ * Presently, 0 is the only valid value.
+ */
+ uint16_t hal_api_version;
#define version_minor hal_api_version
- /** Identifier of module */
- const char *id;
+ /** Identifier of module */
+ const char *id;
- /** Name of this module */
- const char *name;
+ /** Name of this module */
+ const char *name;
- /** Author/owner/implementor of the module */
- const char *author;
+ /** Author/owner/implementor of the module */
+ const char *author;
- /** Modules methods */
- struct hw_module_methods_t* methods;
+ /** Modules methods */
+ struct hw_module_methods_t* methods;
- /** module's dso */
- void* dso;
+ /** module's dso */
+ void* dso;
- /** padding to 128 bytes, reserved for future use */
- uint32_t reserved[32-7];
+ /** padding to 128 bytes, reserved for future use */
+ uint32_t reserved[32-7];
} hw_module_t;
typedef struct hw_module_methods_t {
- /** Open a specific device */
- int (*open)(const struct hw_module_t* module, const char* id,
- struct hw_device_t** device);
+ /** Open a specific device */
+ int (*open)(const struct hw_module_t* module, const char* id,
+ struct hw_device_t** device);
} hw_module_methods_t;
* followed by module specific public methods and attributes.
*/
typedef struct hw_device_t {
- /** tag must be initialized to HARDWARE_DEVICE_TAG */
- uint32_t tag;
-
- /**
- * Version of the module-specific device API. This value is used by
- * the derived-module user to manage different device implementations.
- *
- * The module user is responsible for checking the module_api_version
- * and device version fields to ensure that the user is capable of
- * communicating with the specific module implementation.
- *
- * One module can support multiple devices with different versions. This
- * can be useful when a device interface changes in an incompatible way
- * but it is still necessary to support older implementations at the same
- * time. One such example is the Camera 2.0 API.
- *
- * This field is interpreted by the module user and is ignored by the
- * HAL interface itself.
- */
- uint32_t version;
-
- /** reference to the module this device belongs to */
- struct hw_module_t* module;
-
- /** padding reserved for future use */
- uint32_t reserved[12];
-
- /** Close this device */
- int (*close)(struct hw_device_t* device);
+ /** tag must be initialized to HARDWARE_DEVICE_TAG */
+ uint32_t tag;
+
+ /**
+ * Version of the module-specific device API. This value is used by
+ * the derived-module user to manage different device implementations.
+ *
+ * The module user is responsible for checking the module_api_version
+ * and device version fields to ensure that the user is capable of
+ * communicating with the specific module implementation.
+ *
+ * One module can support multiple devices with different versions. This
+ * can be useful when a device interface changes in an incompatible way
+ * but it is still necessary to support older implementations at the same
+ * time. One such example is the Camera 2.0 API.
+ *
+ * This field is interpreted by the module user and is ignored by the
+ * HAL interface itself.
+ */
+ uint32_t version;
+
+ /** reference to the module this device belongs to */
+ struct hw_module_t* module;
+
+ /** padding reserved for future use */
+ uint32_t reserved[12];
+
+ /** Close this device */
+ int (*close)(struct hw_device_t* device);
} hw_device_t;
* @return: 0 == success, <0 == error and *module == NULL
*/
int hw_get_module_by_class(const char *class_id, const char *inst,
- const struct hw_module_t **module);
+ const struct hw_module_t **module);
__END_DECLS
BT_WARN("Server ID:%d recevied server Id:%d\n", gatt_servers[instance_id - 1].server_id, server_if);
}
}
- if ((event->server_inst > 0)&&(event->server_inst <= 10)) {
+ if ((event->server_inst > 0) && (event->server_inst <= 10)) {
prev_state[event->server_inst - 1] = cur_adv_state[event->server_inst - 1];
new_state = (status == BT_STATUS_SUCCESS) ? !(prev_state[event->server_inst - 1]) : (prev_state[event->server_inst - 1]);
cur_adv_state[event->server_inst - 1] = new_state;
if (bd_addr == NULL) {
BT_ERR("Address is NULL");
- if(event_data) {
+ if (event_data)
g_free(event_data);
- }
return;
}
}
default: {
BT_INFO("Invalid state");
- if(event_data) {
+ if (event_data)
g_free(event_data);
- }
return;
}
}
if (bd_addr == NULL) {
BT_ERR("Address is NULL");
- if(event_data) {
+ if (event_data)
g_free(event_data);
- }
return;
}
BT_INFO("HFP Audio state = [%d], BT Address = [%s]", state, bdt_bd2str((bt_address_t*)bd_addr, &bdstr));
}
default: {
BT_INFO("Invalid state");
- if(event_data) {
+ if (event_data)
g_free(event_data);
- }
return;
}
}
break;
case BTHH_CONN_STATE_CONNECTING:
case BTHH_CONN_STATE_DISCONNECTING:
- if(event) {
+ if (event)
g_free(event);
- }
return;
case BTHH_CONN_STATE_FAILED_MOUSE_FROM_HOST:
event_type = OAL_EVENT_HID_DISCONNECTED;
case BTHH_CONN_STATE_UNKNOWN:
default:
BT_ERR("Unhandled Connection state %d", state);
- if(event) {
+ if (event)
g_free(event);
- }
return;
}
}
#endif
#ifdef TIZEN_FEATURE_BT_IPSP
- if(_bt_init_ipsp_receiver() !=BLUETOOTH_ERROR_NONE) {
+ if (_bt_init_ipsp_receiver() != BLUETOOTH_ERROR_NONE) {
BT_ERR("Fail to init ipsp reciever");
return 0;
}
BT_INFO("Set passkey notification(sender:%s, %s)",
sender, enable ? "Enable" : "Disable");
- result = device_enable_gap_auth_notifications(OAL_PASSKEY_DISPLAY,enable);
+ result = device_enable_gap_auth_notifications(OAL_PASSKEY_DISPLAY, enable);
if (OAL_STATUS_SUCCESS != result) {
BT_ERR("device_enable_gap_auth_notifications error: [%d]", result);
return BLUETOOTH_ERROR_INTERNAL;
GVariant *param = NULL;
ret_if(path == NULL);
- if (strcasecmp(member, "IpspStateChanged") == 0) {
+ if (strcasecmp(member, "IpspStateChanged") == 0) {
gboolean connected = FALSE;
char *ifname = NULL;
GVariant *ipsp_param = NULL;
if (signal_name == NULL)
return;
- BT_DBG("IPSP __bt_manager_event_filter Interface Name [%s]",interface_name);
+ BT_DBG("IPSP __bt_manager_event_filter Interface Name [%s]", interface_name);
g_variant_get(parameters, "(&s@a{sv}@as)", &inf_name, &val, NULL);
- BT_DBG("Interface Name [%s] Signal Name : [%s] ",inf_name,signal_name);
+ BT_DBG("Interface Name [%s] Signal Name : [%s] ", inf_name, signal_name);
if (g_strcmp0(interface_name, BT_PROPERTIES_INTERFACE) == 0) {
if (strncmp(path, BT_MEDIA_OBJECT_PATH,
strlen(BT_MEDIA_OBJECT_PATH)) == 0)
return;
- if (strcasecmp(inf_name, BT_ADAPTER_INTERFACE) == 0) {
- __bt_ipsp_property_changed_event(val,object_path);
- } else if (strcasecmp(inf_name, BT_DEVICE_INTERFACE) == 0) {
+ if (strcasecmp(inf_name, BT_ADAPTER_INTERFACE) == 0)
+ __bt_ipsp_property_changed_event(val, object_path);
+ else if (strcasecmp(inf_name, BT_DEVICE_INTERFACE) == 0)
__bt_device_property_changed_event(val, object_path);
- }
} else if (g_strcmp0(interface_name, BT_DEVICE_INTERFACE) == 0) {
_bt_handle_ipsp_device_event(parameters, signal_name, object_path);
g_variant_unref(val);
static int subs_interface_added_id = -1;
static int subs_interface_removed_id = -1;
static int subs_property_id = -1;
- static int subs_ipsp_state_id =-1;
+ static int subs_ipsp_state_id = -1;
if (subscribe) {
retv_if(manager_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
}
- if (_bt_register_ipsp_subscribe_signal(manager_conn, TRUE)!= BLUETOOTH_ERROR_NONE)
+ if (_bt_register_ipsp_subscribe_signal(manager_conn, TRUE) != BLUETOOTH_ERROR_NONE)
goto fail;
return BLUETOOTH_ERROR_NONE;
bt_cache_info_t *cache_info;
bt_remote_dev_info_t *dev_info;
- if(_bt_is_discovering() == FALSE) {
+ if (_bt_is_discovering() == FALSE) {
g_variant_unref(value);
return;
}
} bt_proximity_alert_property_t;
typedef enum {
- BT_PXP_REPORTER_ROLE = 0x00,
- BT_PXP_MONITOR_ROLE = 0x01,
+ BT_PXP_REPORTER_ROLE = 0x00,
+ BT_PXP_MONITOR_ROLE = 0x01,
} bt_proximity_role_t;
int bt_set_proximity_property(bluetooth_device_address_t *device_address,
* GATT Server Request type
*/
typedef enum {
- BLUETOOTH_GATT_REQUEST_TYPE_READ = 0x00, /* Read Requested */
- BLUETOOTH_GATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested */
- BLUETOOTH_GATT_REQUEST_TYPE_EXEC_WRITE = 0x02, /* Exec Write Requested */
+ BLUETOOTH_GATT_REQUEST_TYPE_READ = 0x00, /* Read Requested */
+ BLUETOOTH_GATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested */
+ BLUETOOTH_GATT_REQUEST_TYPE_EXEC_WRITE = 0x02, /* Exec Write Requested */
} bluetooth_gatt_att_request_type_e;
/**
* GATT Server Response/Indication data
*/
typedef struct {
- guint8 data[BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX];
- int length;
- int offset;
+ guint8 data[BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX];
+ int length;
+ int offset;
} bluetooth_gatt_att_data_t;
/**
* GATT Server service add data
*/
typedef struct {
- int service_type;
- int num_handles;
- int instance_id;
+ int service_type;
+ int num_handles;
+ int instance_id;
} bluetooth_gatt_server_service_params_t;
/**
* GATT Server attributes(characteristic/descriptors) add data
*/
typedef struct {
- bt_gatt_permission_t permissions;
- bt_gatt_characteristic_property_t properties;
- int service_handle;
- int instance_id;
+ bt_gatt_permission_t permissions;
+ bt_gatt_characteristic_property_t properties;
+ int service_handle;
+ int instance_id;
} bluetooth_gatt_server_attribute_params_t;
/**
* GATT Server Indication data
*/
typedef struct {
- int atrribute_handle;
+ int atrribute_handle;
bluetooth_device_address_t device_address; /**< device address */
- gboolean need_confirmation;
- int instance_id;
+ gboolean need_confirmation;
+ int instance_id;
} bluetooth_gatt_server_indication_params_t;
/**
* GATT Server connection/disconnection info
*/
typedef struct {
- bluetooth_device_address_t device_address; /** < Device address */
- int server_instance; /** < GATT Server Instance Id */
+ bluetooth_device_address_t device_address; /** < Device address */
+ int server_instance; /** < GATT Server Instance Id */
} bluetooth_gatt_server_connection_info_t;
/**
* GATT Server Service Added info
*/
typedef struct {
- int server_instance; /** < GATT Server Instance Id */
- int service_handle; /** < GATT Server Service handle */
- int is_primary; /** < GATT Server Is Primary Service */
- char uuid[BLUETOOTH_UUID_STRING_MAX];
+ int server_instance; /** < GATT Server Instance Id */
+ int service_handle; /** < GATT Server Service handle */
+ int is_primary; /** < GATT Server Is Primary Service */
+ char uuid[BLUETOOTH_UUID_STRING_MAX];
} bluetooth_gatt_server_service_added_info_t;
/**
* GATT Server Included Service Added info
*/
typedef struct {
- int server_instance; /** < GATT Server Instance Id */
- int service_handle; /** < GATT Server Service handle */
- int included_service_handle; /** < GATT Server Included service handle */
+ int server_instance; /** < GATT Server Instance Id */
+ int service_handle; /** < GATT Server Service handle */
+ int included_service_handle; /** < GATT Server Included service handle */
} bluetooth_gatt_server_included_service_added_info_t;
* GATT Server write attribute data received from Remote GATT client: Max Size is 600 bytes
*/
typedef struct {
- char data[BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX + 1];
+ char data[BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX + 1];
} bluetooth_gatt_server_write_data_t;
* GATT Server Attribute Added Info
*/
typedef struct {
- int server_instance; /** < GATT Server Instance Id */
- int service_handle; /** < GATT Server Service handle */
- int attr_handle; /** < GATT Server Attribute Handle (Characteristic or Descriptor) */
- char uuid[BLUETOOTH_UUID_STRING_MAX]; /** < GATT Server Atribute UUID */
+ int server_instance; /** < GATT Server Instance Id */
+ int service_handle; /** < GATT Server Service handle */
+ int attr_handle; /** < GATT Server Attribute Handle (Characteristic or Descriptor) */
+ char uuid[BLUETOOTH_UUID_STRING_MAX]; /** < GATT Server Atribute UUID */
} bluetooth_gatt_server_attribute_added_info_t;
/**
* GATT Server Service Info
*/
typedef struct {
- int server_instance; /** < GATT Server Instance Id */
- int service_handle; /** < GATT Server Service handle */
+ int server_instance; /** < GATT Server Instance Id */
+ int service_handle; /** < GATT Server Service handle */
} bluetooth_gatt_server_service_status_t;
/**
* GATT Server Read Requested Info
*/
typedef struct {
- int connection_id; /** < GATT Server Connection ID */
- int request_id; /** < GATT Server Read Request ID */
- int attribute_handle; /** < GATT Server att handle */
- int offset; /** < GATT Server attribute offset */
- gboolean is_long; /** < GATT Server Is Long attribute */
- bluetooth_device_address_t device_address; /**< Remote GATT client device address */
+ int connection_id; /** < GATT Server Connection ID */
+ int request_id; /** < GATT Server Read Request ID */
+ int attribute_handle; /** < GATT Server att handle */
+ int offset; /** < GATT Server attribute offset */
+ gboolean is_long; /** < GATT Server Is Long attribute */
+ bluetooth_device_address_t device_address; /**< Remote GATT client device address */
} bluetooth_gatt_server_read_requested_info_t;
/**
* GATT Server Write Requested Info
*/
typedef struct {
- int connection_id; /** < GATT Server Connection ID */
- int request_id; /** < GATT Server Write Request ID */
- int attribute_handle; /** < GATT Server Write att handle */
- int offset; /** < GATT Server attribute offset */
- gboolean need_resp; /** < GATT Server Write req needs response */
- gboolean is_prep_write; /** < GATT Server Is Prepared write */
- int length; /** < GATT Server Write attribute length */
+ int connection_id; /** < GATT Server Connection ID */
+ int request_id; /** < GATT Server Write Request ID */
+ int attribute_handle; /** < GATT Server Write att handle */
+ int offset; /** < GATT Server attribute offset */
+ gboolean need_resp; /** < GATT Server Write req needs response */
+ gboolean is_prep_write; /** < GATT Server Is Prepared write */
+ int length; /** < GATT Server Write attribute length */
bluetooth_gatt_server_write_data_t data; /** < Write attribute data */
- bluetooth_device_address_t device_address; /** < Remote GATT client device address */
+ bluetooth_device_address_t device_address; /** < Remote GATT client device address */
} bluetooth_gatt_server_write_requested_info_t;
/**
-* GATT Server Update Characteristic Value
-*/
+ * GATT Server Update Characteristic Value
+ */
typedef struct {
- int attribute_handle; /** < GATT Server Write att handle */
- int length; /** < GATT Server Write attribute length */
+ int attribute_handle; /** < GATT Server Write att handle */
+ int length; /** < GATT Server Write attribute length */
bluetooth_gatt_server_write_data_t data; /** < Write attribute data */
} bluetooth_gatt_server_update_value_t;
/**
-* GATT Server Exec write Requested Info
-*/
+ * GATT Server Exec write Requested Info
+ */
typedef struct {
- int connection_id; /** < GATT Server Connection ID */
- int request_id; /** < GATT Server Exec Write Request ID */
- int exec_write; /** < GATT Server Exec Write */
- bluetooth_device_address_t device_address; /** < Remote GATT client device address */
+ int connection_id; /** < GATT Server Connection ID */
+ int request_id; /** < GATT Server Exec Write Request ID */
+ int exec_write; /** < GATT Server Exec Write */
+ bluetooth_device_address_t device_address; /** < Remote GATT client device address */
} bluetooth_gatt_server_exec_write_requested_info_t;
/**
-* GATT Server Indicate confirmed Info
-*/
+ * GATT Server Indicate confirmed Info
+ */
typedef struct {
- int handle; /** < GATT Attribute handle */
- gboolean completed; /** < GATT Server Exec Write Request ID */
- bluetooth_device_address_t device_address; /** < Remote GATT client device address */
+ int handle; /** < GATT Attribute handle */
+ gboolean completed; /** < GATT Server Exec Write Request ID */
+ bluetooth_device_address_t device_address; /** < Remote GATT client device address */
} bluetooth_gatt_server_indicate_confirmed_info_t;
/**
-* GATT Server Indicate confirmed Info
-*/
+ * GATT Server Indicate confirmed Info
+ */
typedef struct {
- int handle; /** < GATT Attribute handle */
- gboolean notification; /** < GATT CCCD Notification changed */
- bluetooth_device_address_t device_address; /** < Remote GATT client device address */
+ int handle; /** < GATT Attribute handle */
+ gboolean notification; /** < GATT CCCD Notification changed */
+ bluetooth_device_address_t device_address; /** < Remote GATT client device address */
} bluetooth_gatt_server_notification_changed_t;
/**
*/
typedef struct {
bluetooth_gatt_att_request_type_e req_type;
- int request_id;
- int response_status;
- gboolean auth_req;
+ int request_id;
+ int response_status;
+ gboolean auth_req;
} bluetooth_gatt_server_response_params_t;
/**
* GATT Server Bluedroid Specific Permission Mask
*/
typedef enum {
- BLUETOOTH_PRODUCT_GATT_PERMISSION_READ = 0x01,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_READ = 0x02,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_READ_MITM = 0x04,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE = 0x10,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_WRITE = 0x20,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_WRITE_MITM = 0x40,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE_SIGNED = 0x80,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE_SIGNED_MITM = 0x100,
- BLUETOOTH_PRODUCT_GATT_PERMISSION_INVALID = 0xffff,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_READ = 0x01,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_READ = 0x02,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_READ_MITM = 0x04,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE = 0x10,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_WRITE = 0x20,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_ENCRYPT_WRITE_MITM = 0x40,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE_SIGNED = 0x80,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_WRITE_SIGNED_MITM = 0x100,
+ BLUETOOTH_PRODUCT_GATT_PERMISSION_INVALID = 0xffff,
} bt_product_gatt_permission_t;
typedef struct {
*
*/
int bluetooth_gatt_server_init(int *instance_id, gatt_server_cb_func_ptr callback_ptr,
- void *user_data);
+ void *user_data);
//int bluetooth_gatt_register_application(int instance_id);
//int bluetooth_gatt_server_init(gatt_server_cb_func_ptr callback_ptr, void *user_data);
int bluetooth_gatt_server_add_descriptor(const char *desc_uuid, bt_gatt_permission_t permissions, int service_handle,
- int instance_id, int *descriptor_handle);
+ int instance_id, int *descriptor_handle);
int bluetooth_gatt_server_start_service(int service_handle, int instance_id);
int bluetooth_gatt_server_delete_service(int service_handle, int instance_id);
int bluetooth_gatt_server_send_indication(bluetooth_device_address_t *addr_hex,
- const bluetooth_gatt_server_indication_params_t *param,
- const bluetooth_gatt_att_data_t *att_value);
+ const bluetooth_gatt_server_indication_params_t *param,
+ const bluetooth_gatt_att_data_t *att_value);
int bluetooth_gatt_server_send_response(const bluetooth_gatt_server_response_params_t *param,
- const bluetooth_gatt_att_data_t *value);
+ const bluetooth_gatt_att_data_t *value);
int bluetooth_gatt_server_update_multi_adv_instance(const gchar *unique_name, int instance_id);
return;
}
- headed_plugin_info->plugin_headed_enabled = TRUE;
+ headed_plugin_info->plugin_headed_enabled = TRUE;
}
void bluetooth_plugin_deinit()
//#ifndef GATT_DIRECT
BT_GATT_SERVER_REGISTER,
BT_GATT_SERVER_ADD_SERVICE,
- BT_GATT_SERVER_ADD_CHARACTERISTIC,
+ 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_DELETE_SERVICE,
BT_GATT_SERVER_SEND_RESPONSE,
BT_GATT_SERVER_SEND_INDICATION,
BT_GATT_SERVER_UPDATE_VALUE,