/*
- * Bluetooth-frwk
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hocheol Seo <hocheol.seo@samsung.com>
- * Girishashok Joshi <girish.joshi@samsung.com>
- * Chanyeol Park <chanyeol.park@samsung.com>
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
static GDBusConnection *event_conn;
static GDBusConnection *hf_local_term_event_conn;
+#ifdef HPS_FEATURE
+int _bt_send_to_hps(void)
+{
+ gboolean ret = FALSE;
+ GError *error = NULL;
+
+ BT_DBG(" ");
+
+ retv_if(event_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ ret = g_dbus_connection_emit_signal(event_conn, NULL,
+ "/org/projectx/httpproxy",
+ "org.projectx.httpproxy_service",
+ BT_LE_ENABLED,
+ NULL, &error);
+ if (!ret) {
+ if (error != NULL) {
+ BT_ERR("D-Bus API failure: errCode[%x], \
+ message[%s]",
+ error->code, error->message);
+ g_clear_error(&error);
+ }
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ return BLUETOOTH_ERROR_NONE;
+}
+#endif
+
int _bt_send_event(int event_type, int event, GVariant *param)
{
- BT_DBG("+");
char *path;
char *signal;
GDBusMessage *msg1 = NULL;
case BT_HID_EVENT:
path = BT_HID_PATH;
break;
+ case BT_HID_DEVICE_EVENT:
+ path = BT_HID_DEVICE_PATH;
+ break;
case BT_HEADSET_EVENT:
path = BT_HEADSET_PATH;
break;
case BT_RFCOMM_SERVER_EVENT:
path = BT_RFCOMM_SERVER_PATH;
break;
- case BT_A2DP_SOURCE_EVENT:
- path = BT_A2DP_SOURCE_PATH;
- break;
+ case BT_A2DP_SOURCE_EVENT:
+ path = BT_A2DP_SOURCE_PATH;
+ break;
default:
BT_ERR("Unknown event");
return BLUETOOTH_ERROR_INTERNAL;
switch (event) {
case BLUETOOTH_EVENT_ENABLED:
signal = BT_ENABLED;
+ BT_INFO_C("### BT Enabled");
break;
case BLUETOOTH_EVENT_DISABLED:
signal = BT_DISABLED;
+ BT_INFO_C("### BT Disabled");
break;
case BLUETOOTH_EVENT_LE_ENABLED:
signal = BT_LE_ENABLED;
case BLUETOOTH_EVENT_RAW_RSSI:
signal = BT_RAW_RSSI_EVENT;
break;
+ case BLUETOOTH_EVENT_SUPPORTED_PROFILE_TRUSTED:
+ signal = BT_SUPPORTED_PROFILE_TRUSTED;
+ break;
+ case BLUETOOTH_EVENT_KEYBOARD_PASSKEY_DISPLAY:
+ signal = BT_KBD_PASSKEY_DISPLAY_REQ_RECEIVED;
+ break;
+ case BLUETOOTH_EVENT_PIN_REQUEST:
+ signal = BT_PIN_REQ_RECEIVED;
+ break;
+ case BLUETOOTH_EVENT_PASSKEY_REQUEST:
+ signal = BT_PASSKEY_REQ_RECEIVED;
+ break;
+ case BLUETOOTH_EVENT_PASSKEY_CONFIRM_REQUEST:
+ signal = BT_PASSKEY_CFM_REQ_RECEIVED;
+ break;
case BLUETOOTH_EVENT_SERVICE_SEARCHED:
signal = BT_SERVICE_SEARCHED;
break;
signal = BT_INPUT_DISCONNECTED;
BT_INFO_C("Disconnected [HID]");
break;
+ case BLUETOOTH_HID_DEVICE_CONNECTED:
+ signal = BT_INPUT_HID_DEVICE_CONNECTED;
+ BT_INFO_C("Connected [HIDDevice]");
+ break;
+ case BLUETOOTH_HID_DEVICE_DISCONNECTED:
+ signal = BT_INPUT_HID_DEVICE_DISCONNECTED;
+ BT_INFO_C("Disconnected [HIDDevice]");
+ break;
case BLUETOOTH_PBAP_CONNECTED:
signal = BT_PBAP_CONNECTED;
BT_INFO_C("Connected [PBAP Client]");
signal = BT_STEREO_HEADSET_DISCONNECTED;
BT_INFO_C("Disconnected [A2DP]");
break;
+ case BLUETOOTH_EVENT_AV_SOURCE_CONNECTED:
+ signal = BT_A2DP_SOURCE_CONNECTED;
+ BT_INFO_C("Connected [A2DP Source]");
+ break;
+ case BLUETOOTH_EVENT_AV_SOURCE_DISCONNECTED:
+ signal = BT_A2DP_SOURCE_DISCONNECTED;
+ BT_INFO_C("Disconnected [A2DP Source]");
+ break;
case BLUETOOTH_EVENT_AG_AUDIO_CONNECTED:
signal = BT_SCO_CONNECTED;
BT_INFO_C("Connected [SCO]");
case BLUETOOTH_EVENT_DEVICE_DISCONNECTED:
signal = BT_DEVICE_DISCONNECTED;
break;
- case BLUETOOTH_EVENT_AV_SOURCE_CONNECTED:
- signal = BT_A2DP_SOURCE_CONNECTED;
- BT_INFO_C("Connected [A2DP Source]");
- break;
- case BLUETOOTH_EVENT_AV_SOURCE_DISCONNECTED:
- signal = BT_A2DP_SOURCE_DISCONNECTED;
- BT_INFO_C("Disconnected [A2DP Source]");
- break;
case BLUETOOTH_EVENT_AVRCP_CONNECTED:
case BLUETOOTH_EVENT_AVRCP_CONTROL_CONNECTED:
signal = BT_AVRCP_CONNECTED;
break;
case BLUETOOTH_EVENT_GATT_CONNECTED:
signal = BT_GATT_CONNECTED;
+ BT_INFO_C("### Connected [GATT]");
break;
case BLUETOOTH_EVENT_GATT_DISCONNECTED:
signal = BT_GATT_DISCONNECTED;
+ BT_INFO_C("### Disconnected [GATT]");
+ break;
+ case BLUETOOTH_EVENT_GATT_ATT_MTU_CHANGED:
+ signal = BT_GATT_REQ_ATT_MTU_CHANGED;
+ break;
+ case BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED:
+ signal = BT_IPSP_INITIALIZED;
+ break;
+ case BLUETOOTH_EVENT_IPSP_CONNECTED:
+ signal = BT_IPSP_CONNECTED;
+ break;
+ case BLUETOOTH_EVENT_IPSP_DISCONNECTED:
+ signal = BT_IPSP_DISCONNECTED;
break;
case BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED:
signal = BT_GATT_CHAR_VAL_CHANGED;
break;
+ case BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED:
+ signal = BT_LE_DATA_LENGTH_CHANGED;
+ break;
+ case BLUETOOTH_EVENT_REMOTE_IBEACON_DEVICE_FOUND:
+ signal = BT_IBEACON_DEVICE_FOUND;
+ break;
+ case BLUETOOTH_EVENT_PXP_PROPERTY_CHANGED:
+ signal = BT_PXP_PROPERTY_CHANGED;
+ break;
default:
BT_ERR("Unknown event");
return BLUETOOTH_ERROR_INTERNAL;
msg1 = g_dbus_message_new_signal(path, BT_EVENT_SERVICE, signal);
g_dbus_message_set_body(msg1, param);
- if (!g_dbus_connection_send_message(event_conn, msg1,G_DBUS_SEND_MESSAGE_FLAGS_NONE, 0, NULL)) {
+ if (!g_dbus_connection_send_message(event_conn, msg1, G_DBUS_SEND_MESSAGE_FLAGS_NONE, 0, NULL))
BT_ERR("Error while sending");
- }
g_object_unref(msg1);
- BT_DBG("-");
+
+#ifdef HPS_FEATURE
+ if (g_strcmp0(signal, BT_LE_ENABLED) == 0)
+ _bt_send_to_hps();
+#endif
+
return BLUETOOTH_ERROR_NONE;
}
int _bt_send_event_to_dest(const char* dest, int event_type,
int event, GVariant *param)
{
- BT_DBG("+");
char *path;
char *signal;
GError *error = NULL;
case BT_LE_ADAPTER_EVENT:
path = BT_LE_ADAPTER_PATH;
break;
+ case BT_DEVICE_EVENT:
+ path = BT_DEVICE_PATH;
+ break;
default:
BT_ERR("Unknown event");
return BLUETOOTH_ERROR_INTERNAL;
case BLUETOOTH_EVENT_ADVERTISING_STOPPED:
signal = BT_ADVERTISING_STOPPED;
break;
+ case BLUETOOTH_EVENT_PASSKEY_NOTIFICATION:
+ signal = BT_PASSKEY_NOTIFICATION;
+ break;
case BLUETOOTH_EVENT_LE_DISCOVERY_STARTED:
signal = BT_LE_DISCOVERY_STARTED;
break;
case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
signal = BT_LE_DISCOVERY_FINISHED;
break;
+ case BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED:
+ signal = BT_GATT_CHAR_VAL_CHANGED;
+ break;
default:
BT_ERR("Unknown event");
return BLUETOOTH_ERROR_INTERNAL;
}
- BT_DBG("Path : %s", path);
BT_INFO_C("Signal : %s", signal);
if (!g_dbus_connection_emit_signal(event_conn, dest, path, BT_EVENT_SERVICE,
}
}
- BT_DBG("-");
return BLUETOOTH_ERROR_NONE;
}
}
conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
- retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
if (conn == NULL) {
BT_ERR("conn == NULL");
if (err) {
}
conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
- retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
if (conn == NULL) {
BT_ERR("conn == NULL");
if (err) {
hf_local_term_event_conn = NULL;
}
}
+
+int _bt_send_dump_signal(char *signal)
+{
+ GError *error = NULL;
+ int32_t pid = getpid();
+
+ retv_if(event_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ if (!g_dbus_connection_emit_signal(event_conn, NULL,
+ BT_DUMP_SERVICE_PATH,
+ BT_DUMP_SERVICE_INTERFACE,
+ signal, g_variant_new("(i)", pid),
+ &error)) {
+ BT_ERR("Error while sending Signal: %s", signal);
+ if (error) {
+ BT_ERR("Error Code [%d], Error Message [%s]",
+ error->code, error->message);
+ g_clear_error(&error);
+ }
+ }
+
+ return BLUETOOTH_ERROR_NONE;
+}