summaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorArman Uguray <armansito@chromium.org>2014-12-16 18:07:12 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-12-17 11:11:38 -0200
commit297330b93e61c1263b087ad0f105a2cfae02ac61 (patch)
tree9be81c647b8fbf827fe7027fec0ab276d56b1906 /src/service.c
parent9eaab34af829cef3c8a1557a45c93c22f9110ec1 (diff)
downloadbluez-297330b93e61c1263b087ad0f105a2cfae02ac61.tar.gz
core: profile: Add accept function
This patch introduces the "accept" function to btd_profile. The purpose of this function is to notify a profile when a btd_service is ready to interact with and will be called by btd_device when a bt_gatt_client becomes ready (MTU exchange and discovery has been completed). This is initially meant to be optional for non-GATT based profiles but could be generalized for them in the future.
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c
index afe592b66..2ea2b7af3 100644
--- a/src/service.c
+++ b/src/service.c
@@ -199,6 +199,24 @@ void service_remove(struct btd_service *service)
btd_service_unref(service);
}
+int service_accept(struct btd_service *service)
+{
+ char addr[18];
+ int err;
+
+ if (!service->profile->accept)
+ return 0;
+
+ err = service->profile->accept(service);
+ if (!err)
+ return 0;
+
+ ba2str(device_get_address(service->device), addr);
+ error("%s profile accept failed for %s", service->profile->name, addr);
+
+ return err;
+}
+
int btd_service_connect(struct btd_service *service)
{
struct btd_profile *profile = service->profile;