#include <bt-hal-adapter-dbus-handler.h>
#include <bt-hal-device-dbus-handler.h>
#include <bt-hal-hidhost.h>
+#include <bt-hal-hiddevice.h>
#include <bt-hal-socket.h>
#include <bt-hal-av.h>
#include <bt-hal-hf.h>
#include <bt-hal-adapter-le.h>
#include <bt-hal-agent.h>
#endif
+#include <bt-hal-hf-client.h>
#define enum_prop_to_hal(prop, hal_prop, type) do { \
static type e; \
}
#ifdef TIZEN_BT_HAL
+/* Tizen Specific Recover Adapter */
+static int recover(void)
+{
+ return _bt_hal_dbus_recover_adapter();
+}
+#endif
+
+#ifdef TIZEN_BT_HAL
/* Tizen Specific Reset Adapter */
static int reset(void)
{
static int create_bond(const bt_bdaddr_t *bd_addr, int transport)
{
- DBG("+");
return _bt_hal_device_create_bond(bd_addr, transport);
}
static int remove_bond(const bt_bdaddr_t *bd_addr)
{
- DBG("+");
return _bt_hal_device_remove_bond(bd_addr);
}
if (!strncmp(profile_id, BT_PROFILE_HIDHOST_ID, strlen(profile_id)))
return bt_get_hidhost_interface();
+ if (!strcmp(profile_id, BT_PROFILE_HIDDEVICE_ID))
+ return bt_get_hiddevice_interface();
+
if (!strcmp(profile_id, BT_PROFILE_SOCKETS_ID))
return bt_get_socket_interface();
if (!strcmp(profile_id, BT_PROFILE_HANDSFREE_ID))
return bt_get_hf_interface();
+ if (!strcmp(profile_id, BT_PROFILE_HANDSFREE_CLIENT_ID))
+ return bt_get_hf_client_interface();
+
if (!strcmp(profile_id, BT_PROFILE_GATT_ID))
return bt_get_gatt_interface();
static int authorize_response(const bt_bdaddr_t *bd_addr, bt_service_id_t service_id,
uint8_t authorize, uint8_t save_settings)
{
- DBG("+");
return _bt_hal_device_authorize_response(bd_addr, service_id, authorize, save_settings);
}
int set_authorization(bt_bdaddr_t *bd_addr, uint8_t auth)
{
- DBG("+");
return _bt_hal_device_set_trust(bd_addr, auth);
}
return _bt_hal_device_get_service_connection_state(bd_addr, rem_svc_id);
}
-static int set_agent_osp_server(uint32_t type, uint8_t enable)
+static int register_agent_osp_server(uint32_t type, char *uuid, char *path, int fd)
{
DBG("");
- return _bt_hal_device_set_osp_server(type, enable);
+ return _bt_hal_device_register_osp_server(type, uuid, path, fd);
+}
+
+static int unregister_agent_osp_server(uint32_t type, char *uuid)
+{
+ DBG("");
+ return _bt_hal_device_unregister_osp_server(type, uuid);
}
static int set_trusted_profile(bt_bdaddr_t *bd_addr, bt_trusted_profile_t profile, uint8_t trust)
_bt_hal_enable_gap_auth_notifications(type, ((enable == 0) ? FALSE : TRUE));
return BT_STATUS_SUCCESS;
}
+
+static int set_hal_adapter_request_state(int enable)
+{
+ DBG("");
+ _bt_hal_set_adapter_request_state(enable);
+ return BT_STATUS_SUCCESS;
+}
+
+static int set_hal_le_request_state(int enable)
+{
+ DBG("");
+ _bt_hal_set_le_request_state(enable);
+ return BT_STATUS_SUCCESS;
+}
+
+static int dev_disconnect(const bt_bdaddr_t *bd_addr)
+{
+ return _bt_hal_device_disconnect(bd_addr);
+}
#endif
static const bt_interface_t bluetooth_if = {
.init = init,
.enable = enable,
.disable = disable,
+
#ifdef TIZEN_BT_HAL
+ .recover = recover,
.reset = reset,
#endif
.set_authorization = set_authorization,
#ifdef TIZEN_BT_HAL
.get_service_connection_state = get_service_connection_state,
- .set_agent_osp_server = set_agent_osp_server,
+ .register_agent_osp_server = register_agent_osp_server,
+ .unregister_agent_osp_server = unregister_agent_osp_server,
.set_trusted_profile = set_trusted_profile,
.get_trusted_profile = get_trusted_profile,
.enable_rssi_monitoring = enable_rssi_monitoring,
.get_connected_link_rssi_strength = get_connected_link_rssi_strength,
.enable_gap_auth_notifications = enable_gap_auth_notifications,
+ .set_le_static_random_address = _bt_hal_set_le_static_random_address,
+ .set_hal_adapter_request_state = set_hal_adapter_request_state,
+ .set_hal_le_request_state = set_hal_le_request_state,
+ .adapter_le_set_manufacturer_data = _bt_hal_adapter_le_set_manufacturer_data,
+ .adapter_le_set_white_list = _bt_hal_adapter_le_set_white_list,
+ .adapter_le_set_privacy = _bt_hal_adapter_le_set_privacy,
+ .device_disconnect = dev_disconnect,
#endif
};
.version_major = 1,
.version_minor = 0,
.id = BT_HARDWARE_MODULE_ID,
- .name = "Bluetooth stack",
+ .name = "bluez",
.author = "Intel Corporation",
.methods = &bluetooth_module_methods
};
void *buf = prop;
uint8_t i;
- DBG("+");
-
for (i = 0; i < num_props; i++) {
-
if (sizeof(*prop) + prop->len > len) {
ERR("invalid device properties (%zu > %u), cant process further properties!!!",
sizeof(*prop) + prop->len, len);
send_props[i].type = prop->type;
- DBG("HAL prop Type [%d]", prop->type);
-
switch (prop->type) {
case HAL_PROP_DEVICE_TYPE:
{
}
if (!len) {
- DBG("-");
return;
}
{
struct hal_ev_adapter_props_changed *ev = (struct hal_ev_adapter_props_changed *)buf;
bt_property_t props[ev->num_props];
- DBG("+");
if (!bt_hal_cbacks->adapter_properties_cb)
return;
{
struct hal_ev_discovery_state_changed *ev = (struct hal_ev_discovery_state_changed *)buf;
- DBG("+");
-
if (bt_hal_cbacks->discovery_state_changed_cb)
bt_hal_cbacks->discovery_state_changed_cb(ev->state);
}
{
struct hal_ev_device_found *ev = (struct hal_ev_device_found *) buf;
bt_property_t props[ev->num_props];
- DBG("+");
if (!bt_hal_cbacks->device_found_cb)
return;
bt_bdaddr_t bd_addr;
bt_property_t props[ev->num_props];
- DBG("+");
-
if (!bt_hal_cbacks->remote_device_properties_cb)
return;
memcpy(bd_addr.address, ev->bdaddr, 6);
bt_hal_cbacks->remote_device_properties_cb(
ev->status, &bd_addr, ev->num_props, props);
- DBG("-");
}
static void __bt_hal_handle_bond_state_changed_event(void *buf, uint16_t len)
struct hal_ev_bond_state_changed *ev = (struct hal_ev_bond_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]);
DBG("Bonding State changed Status [0x%x]", ev->status);
DBG("Bonding State [0x%x]", ev->state);
}
bt_hal_cbacks->bond_state_changed_cb(ev->status, &bd_addr, ev->state);
- DBG("-");
}
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("+");
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);
+ INFO("ACL status[0x%x], state[0x%x]: XX:XX:XX:XX:XX:%02X", ev->status, ev->state, bd_addr.address[5]);
if (!bt_hal_cbacks->acl_state_changed_cb) {
ERR("HAL User acl_state_changed_cb is not set!!");
}
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("+");
memcpy(bd_addr.address, ev->bdaddr, 6);
/* BD address */
bt_hal_cbacks->le_conn_state_changed_cb(ev->status, &bd_addr, ev->state);
#endif
- DBG("-");
}
static void __bt_hal_handle_authorize_request_event(void *buf, uint16_t len)
struct hal_ev_authorize_request *ev = (struct hal_ev_authorize_request *)buf;
bt_bdaddr_t bd_addr;
- DBG("+");
-
memcpy(bd_addr.address, ev->bdaddr, 6);
/* BD address*/
}
bt_hal_cbacks->authorize_request_cb(&bd_addr, ev->service_id);
- DBG("-");
}
#ifdef TIZEN_BT_HAL
struct hal_ev_sock_conn_auth *ev = buf;
bt_bdaddr_t bd_addr;
bt_uuid_t uuid;
-
- DBG("+");
+ uint8_t name[249] = {0, };
+ uint8_t path[249] = {0, };
+ uint32_t fd;
memcpy(bd_addr.address, ev->bdaddr, 6);
memcpy(uuid.uu, ev->uuid, 16);
+ memcpy(name, ev->name, sizeof(name) - 1);
+ memcpy(path, ev->path, sizeof(name) - 1);
+ fd = ev->fd;
if (!bt_hal_cbacks->socket_authorize_request_cb) {
ERR("HAL User socket_authorize_request_cb is not set!!");
return;
}
- bt_hal_cbacks->socket_authorize_request_cb(&bd_addr, &uuid);
- DBG("-");
+ bt_hal_cbacks->socket_authorize_request_cb(&bd_addr, &uuid, name, path, fd);
}
#endif
struct hal_ev_ssp_request *ev = (struct hal_ev_ssp_request *)buf;
bt_bdaddr_t bd_addr;
bt_bdname_t bd_name;
- DBG("+");
memcpy(bd_addr.address, ev->bdaddr, 6);
memcpy(bd_name.name, ev->name, 248);
bt_hal_cbacks->ssp_request_cb(&bd_addr, &bd_name,
ev->class_of_dev,
ev->pairing_variant, ev->passkey);
- DBG("-");
}
static void __bt_hal_handle_pin_request_event(void *buf, uint16_t len)
struct hal_ev_pin_request *ev = (struct hal_ev_pin_request *)buf;
bt_bdaddr_t bd_addr;
bt_bdname_t bd_name;
- DBG("+");
memcpy(bd_addr.address, ev->bdaddr, 6);
memcpy(bd_name.name, ev->name, 248);
bt_hal_cbacks->pin_request_cb(&bd_addr, &bd_name,
ev->class_of_dev);
- DBG("-");
}
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("+");
memcpy(bd_addr.address, ev->bdaddr, 6);
/* BD address*/
}
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)
struct hal_ev_device_trusted_profiles_changed *ev = buf;
bt_bdaddr_t bd_addr;
- DBG("+");
#ifdef TIZEN_BT_HAL
memcpy(bd_addr.address, ev->bdaddr, 6);
DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]",
bt_hal_cbacks->device_trusted_profiles_changed_cb(&bd_addr, ev->trust_val);
#endif
- DBG("-");
}
static void __bt_handle_rssi_monitor_state_changed(void *buf, uint16_t len)
struct hal_ev_rssi_monitor_state_changed *ev = buf;
bt_bdaddr_t bd_addr;
- DBG("+");
#ifdef TIZEN_BT_HAL
memcpy(bd_addr.address, ev->bdaddr, 6);
DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]",
bt_hal_cbacks->rssi_monitor_state_changed_cb(
&bd_addr, ev->link_type, ev->state);
#endif
- DBG("-");
}
static void __bt_handle_rssi_alert_recieved(void *buf, uint16_t len)
struct hal_ev_rssi_alert_recieved *ev = buf;
bt_bdaddr_t bd_addr;
- DBG("+");
#ifdef TIZEN_BT_HAL
memcpy(bd_addr.address, ev->bdaddr, 6);
DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]",
bt_hal_cbacks->rssi_alert_cb(
&bd_addr, ev->link_type, ev->alert_type, ev->rssi);
#endif
- DBG("-");
}
static void __bt_handle_raw_rssi_recieved(void *buf, uint16_t len)
struct hal_ev_raw_rssi_recieved *ev = buf;
bt_bdaddr_t bd_addr;
- DBG("+");
#ifdef TIZEN_BT_HAL
memcpy(bd_addr.address, ev->bdaddr, 6);
DBG("[0x%02X:%02X:%02X:%02X:%02X:%02X]",
bt_hal_cbacks->raw_rssi_received_cb(
&bd_addr, ev->link_type, ev->rssi);
#endif
- DBG("-");
+}
+
+static void __bt_handle_dbfw_plus_info_recieved(void *buf, uint16_t len)
+{
+ struct hal_ev_dbfw_plus_info_recieved *info = buf;
+
+#ifdef TIZEN_BT_HAL
+ if (bt_hal_cbacks->dbfw_plus_info_received_cb)
+ bt_hal_cbacks->dbfw_plus_info_received_cb(
+ info->data, info->data_len, info->event_code);
+#endif
}
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");
DBG("Event: HAL_EV_RAW_RSSI_RECIEVED");
__bt_handle_raw_rssi_recieved(buf, len);
break;
+ case HAL_EV_DBFW_PLUS_INFO_RECIEVED:
+ DBG("Event: HAL_EV_DBFW_PLUS_INFO_RECIEVED");
+ __bt_handle_dbfw_plus_info_recieved(buf, len);
+ break;
default:
DBG("Event Currently not handled!!");
break;
}
- DBG("-");
}