Beispiel #1
0
int agent_request_pairing_consent(struct agent *agent, struct btd_device *device,
				agent_cb cb, void *user_data,
				GDestroyNotify destroy)
{
	struct agent_request *req;
	const gchar *dev_path = device_get_path(device);
	int err;

	if (agent->request)
		return -EBUSY;

	DBG("Calling Agent.RequestPairingConsent: name=%s, path=%s",
			agent->name, agent->path);

	req = agent_request_new(agent, AGENT_REQUEST_PAIRING_CONSENT, cb,
				user_data, destroy);

	err = pairing_consent_request_new(req, dev_path);
	if (err < 0)
		goto failed;

	agent->request = req;

	return 0;

failed:
	agent_request_free(req, FALSE);
	return err;
}
Beispiel #2
0
int agent_confirm_mode_change(struct agent *agent, const char *new_mode,
				agent_cb cb, void *user_data,
				GDestroyNotify destroy)
{
	struct agent_request *req;
	int err;

	if (agent->request)
		return -EBUSY;

	DBG("Calling Agent.ConfirmModeChange: name=%s, path=%s, mode=%s",
			agent->name, agent->path, new_mode);

	req = agent_request_new(agent, AGENT_REQUEST_CONFIRM_MODE,
				cb, user_data, destroy);

	err = confirm_mode_change_request_new(req, new_mode);
	if (err < 0)
		goto failed;

	agent->request = req;

	return 0;

failed:
	agent_request_free(req, FALSE);
	return err;
}
Beispiel #3
0
int agent_request_confirmation(struct agent *agent, struct btd_device *device,
				uint32_t passkey, agent_cb cb,
				void *user_data, GDestroyNotify destroy)
{
	struct agent_request *req;
	const gchar *dev_path = device_get_path(device);
	int err;

	if (agent->request)
		return -EBUSY;

	DBG("Calling Agent.RequestConfirmation: name=%s, path=%s, passkey=%06u",
			agent->name, agent->path, passkey);

	req = agent_request_new(agent, AGENT_REQUEST_CONFIRMATION, cb,
				user_data, destroy);

	err = confirmation_request_new(req, dev_path, passkey);
	if (err < 0)
		goto failed;

	agent->request = req;

	return 0;

failed:
	agent_request_free(req, FALSE);
	return err;
}
Beispiel #4
0
int agent_authorize(struct agent *agent,
			const char *path,
			const char *uuid,
			agent_cb cb,
			void *user_data,
			GDestroyNotify destroy)
{
	struct agent_request *req;
	int err;

	if (agent->request)
		return -EBUSY;

	req = agent_request_new(agent, AGENT_REQUEST_AUTHORIZE, cb,
							user_data, destroy);

	err = agent_call_authorize(req, path, uuid);
	if (err < 0) {
		agent_request_free(req, FALSE);
		return -ENOMEM;
	}

	agent->request = req;

	DBG("authorize request was sent for %s", path);

	return 0;
}
Beispiel #5
0
int agent_request_pincode(struct agent *agent, struct btd_device *device,
				agent_pincode_cb cb, gboolean secure,
				void *user_data, GDestroyNotify destroy)
{
	struct agent_request *req;
	const gchar *dev_path = device_get_path(device);
	int err;

	if (agent->request)
		return -EBUSY;

	req = agent_request_new(agent, AGENT_REQUEST_PINCODE, cb,
							user_data, destroy);

	err = pincode_request_new(req, dev_path, secure);
	if (err < 0)
		goto failed;

	agent->request = req;

	return 0;

failed:
	g_free(req);
	return err;
}
Beispiel #6
0
int agent_display_pincode(struct agent *agent, struct btd_device *device,
				const char *pincode, agent_cb cb,
				void *user_data, GDestroyNotify destroy)
{
	struct agent_request *req;
	const char *dev_path = device_get_path(device);
	int err;

	if (agent->request)
		return -EBUSY;

	DBG("Calling Agent.DisplayPinCode: name=%s, path=%s, pincode=%s",
					agent->owner, agent->path, pincode);

	req = agent_request_new(agent, AGENT_REQUEST_DISPLAY_PINCODE, cb,
							user_data, destroy);

	err = display_pincode_request_new(req, dev_path, pincode);
	if (err < 0)
		goto failed;

	agent->request = req;

	return 0;

failed:
	agent_request_free(req, FALSE);
	return err;
}
Beispiel #7
0
int agent_request_authorization(struct agent *agent, struct btd_device *device,
						agent_cb cb, void *user_data,
						GDestroyNotify destroy)
{
	struct agent_request *req;
	const char *dev_path = device_get_path(device);
	int err;

	if (agent->request)
		return -EBUSY;

	DBG("Calling Agent.RequestAuthorization: name=%s, path=%s",
						agent->owner, agent->path);

	req = agent_request_new(agent, AGENT_REQUEST_AUTHORIZATION, cb,
				user_data, destroy);

	err = authorization_request_new(req, dev_path);
	if (err < 0)
		goto failed;

	agent->request = req;

	return 0;

failed:
	agent_request_free(req, FALSE);
	return err;
}
Beispiel #8
0
int agent_request_oob_data(struct agent *agent, struct btd_device *device,
				agent_oob_data_cb cb, void *user_data,
				GDestroyNotify destroy)
{
	struct agent_request *req;
	const gchar *dev_path = device_get_path(device);
	int err;

	if (agent->request)
		return -EBUSY;

	DBG("Calling Agent.RequestOobData: name=%s, path=%s",
			agent->name, agent->path);

	req = agent_request_new(agent, AGENT_REQUEST_OOB_DATA, cb,
							user_data, destroy);

	err = oob_data_request_new(req, dev_path);
	if (err < 0)
		goto failed;

	agent->request = req;

	return 0;

failed:
	agent_request_free(req, FALSE);
	return err;
}
Beispiel #9
0
int agent_request_oob_availability(struct agent *agent,
					const char *path,
					agent_cb cb,
					void *user_data,
					GDestroyNotify destroy)
{
	struct agent_request *req;
	int err;

	if (agent->request)
		return -EBUSY;

	req = agent_request_new(agent, AGENT_REQUEST_OOB_AVAILABILITY, cb,
							user_data, destroy);

	err = agent_call_oob_availability(req, path);
	if (err < 0) {
		agent_request_free(req, FALSE);
		return -ENOMEM;
	}

	agent->request = req;

	DBG("oob availability request was sent for %s", path);

	return 0;
}
Beispiel #10
0
int agent_authorize(struct agent *agent,
//			const char *path,
			const struct btd_device *device, //CTS VERI
			const char *uuid,
			agent_cb cb,
			void *user_data,
			GDestroyNotify destroy)
{
	struct agent_request *req;
	int err;

	if (agent->request)
		return -EBUSY;

	req = agent_request_new(agent, AGENT_REQUEST_AUTHORIZE, cb,
							user_data, destroy);

//	err = agent_call_authorize(req, path, uuid);
	err = agent_call_authorize(req, device, uuid); //Broadocm Bluetooth feature - CTS VERI
	if (err < 0) {
		agent_request_free(req, FALSE);
		return -ENOMEM;
	}

	agent->request = req;

//	DBG("authorize request was sent for %s", path);
	DBG("authorize request was sent for %s", device_get_path(device)); //Broadocm Bluetooth feature - CTS VERI

	return 0;
}