示例#1
0
文件: sap.c 项目: AndriusA/ofono
/* power up hardware */
static int sap_enable(struct ofono_modem *modem)
{
	struct sap_data *data = ofono_modem_get_data(modem);
	DBusPendingCall *call;
	int status;
	const char *str = "sap";
	const char *server_path = ofono_modem_get_string(modem, "ServerPath");

	DBG("%p", modem);

	status = bluetooth_send_with_reply(server_path, BLUEZ_SERIAL_INTERFACE,
					"ConnectFD", &call, sap_connect_reply,
					modem, NULL, DBUS_TIMEOUT,
					DBUS_TYPE_STRING, &str,
					DBUS_TYPE_INVALID);

    DBG("bt send status %d", status);

	if (status < 0)
		return -EINVAL;

	data->call = call;

	return -EINPROGRESS;
}
示例#2
0
/* power up hardware */
static int hfp_enable(struct ofono_modem *modem)
{
	struct hfp_data *data = ofono_modem_get_data(modem);
	int status;

	DBG("%p", modem);

	status = bluetooth_send_with_reply(data->handsfree_path,
					BLUEZ_GATEWAY_INTERFACE, "Connect",
					&data->call, hfp_connect_reply,
					modem, NULL,
					DBUS_TIMEOUT, DBUS_TYPE_INVALID);

	if (status < 0)
		return -EINVAL;

	return -EINPROGRESS;
}
示例#3
0
static int hfp_disable(struct ofono_modem *modem)
{
	struct hfp_data *data = ofono_modem_get_data(modem);
	int status;

	DBG("%p", modem);

	g_at_chat_unref(data->info.chat);
	data->info.chat = NULL;

	if (data->agent_registered) {
		status = bluetooth_send_with_reply(data->handsfree_path,
					BLUEZ_GATEWAY_INTERFACE, "Disconnect",
					&data->call, hfp_power_down,
					modem, NULL,
					DBUS_TIMEOUT, DBUS_TYPE_INVALID);

		if (status < 0)
			return -EINVAL;
	}

	return -EINPROGRESS;
}
示例#4
0
static void bt_connect(struct dundee_device *device,
			dundee_device_connect_cb_t cb, void *data)
{
	struct bluetooth_device *bt = dundee_device_get_data(device);
	struct cb_data *cbd = cb_data_new(cb, data);
	char *profile = "dun";
	int status;

	DBG("%p", bt);

	cbd->user = bt;

	status = bluetooth_send_with_reply(bt->path,
					BLUEZ_SERIAL_INTERFACE, "ConnectFD",
					&bt->call, bt_connect_reply,
					cbd, NULL, DBUS_TIMEOUT,
					DBUS_TYPE_STRING, &profile,
					DBUS_TYPE_INVALID);
	if (status == 0)
		return;

	CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
	g_free(cbd);
}