#define HFP_REJECT_CALL "Reject"
#define HFP_RELEASE_CALL "Release"
#define HFP_THREEWAY_CALL "Threeway"
+#define HFP_HF_BATTERY_LEVEL_CHANGE "HfBatteryLevelChanged"
#define DEFAULT_ADAPTER_OBJECT_PATH "/org/bluez/hci0"
}
+static void __bluetooth_telephony_hf_battery_level_change(GVariant *var)
+{
+ telephony_event_hf_battery_level_t param;
+ char secure_address[BT_ADDRESS_STRING_SIZE] = { 0 };
+
+ g_variant_get(var, "(&su)", ¶m.remote_address, ¶m.battery_level);
+
+ _bt_convert_addr_string_to_secure_string(secure_address, param.remote_address);
+ BT_INFO("address(%s) battery level(%u)", secure_address, param.battery_level);
+
+ __bt_telephony_event_cb(BLUETOOTH_EVENT_TELEPHONY_HF_BATTERY_LEVEL_CHANGED,
+ BLUETOOTH_TELEPHONY_ERROR_NONE, (void *)¶m);
+}
+
static void __bluetooth_telephony_event_filter(GDBusConnection *connection,
const gchar *sender_name,
const gchar *object_path,
__bluetooth_telephony_release_call(parameters);
else if (strcasecmp(signal_name, HFP_THREEWAY_CALL) == 0)
__bluetooth_telephony_threeway_call(parameters);
+ else if (strcasecmp(signal_name, HFP_HF_BATTERY_LEVEL_CHANGE) == 0)
+ __bluetooth_telephony_hf_battery_level_change(parameters);
}
BT_DBG("-");
}
return BLUETOOTH_TELEPHONY_ERROR_INVALID_PARAM;
path = g_strdup(telephony_info.call_path);
- BT_DBG("path is [%s]", path);
bt_tel_id = g_dbus_connection_register_object(telephony_dbus_info.conn,
path, node_info->interfaces[0],
gchar *name;
name = g_strdup_printf("org.tizen.csd.Call.Instance.p%d", getpid());
- BT_DBG("well-known name: %s", name);
owner_id = g_bus_own_name_on_connection(telephony_dbus_info.conn,
name, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
- BT_DBG("owner_id: %d", owner_id);
+ BT_DBG("well-known name: %s, owner_id: %d", name, owner_id);
g_free(name);
node_info = __bt_telephony_create_method_node_info(
return BLUETOOTH_TELEPHONY_ERROR_NONE;
}
+BT_EXPORT_API int bluetooth_telephony_get_battery_level(
+ const char *remote_address, unsigned int *level)
+{
+ GVariant *reply;
+ GError *err = NULL;
+ GVariant *param = NULL;
+ int ret;
+
+ FN_START;
+
+ BT_TELEPHONY_CHECK_INITIALIZED();
+ BT_TELEPHONY_CHECK_ENABLED();
+
+ param = g_variant_new("(s)", remote_address);
+
+ reply = __bluetooth_telephony_dbus_method_send(
+ HFP_AGENT_PATH, HFP_AGENT_INTERFACE,
+ "GetHfBatteryLevel", &err, param);
+
+ if (!reply) {
+ BT_ERR("Error returned in method call\n");
+ if (err) {
+ g_dbus_error_strip_remote_error(err);
+ ret = __bt_telephony_get_error(err->message);
+ g_error_free(err);
+ return ret;
+ }
+ return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
+ }
+
+ g_variant_get(reply, "(u)", level);
+
+ g_variant_unref(reply);
+
+ FN_END;
+ return BLUETOOTH_TELEPHONY_ERROR_NONE;
+}
+
BT_EXPORT_API int bluetooth_telephony_is_connected(gboolean *ag_connected)
{
GVariant *reply;
return;
}
- BT_INFO("Adapter Path = [%s]", path);
if (strcasecmp(path, DEFAULT_ADAPTER_OBJECT_PATH) == 0) {
if (__bt_telephony_get_src_addr(optional_param))
BT_ERR("Fail to get the local adapter address");