[PATCH BlueZ v3 21/27] core: Add user_data to btd_service

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

Profile implementations can benefit from a user_data associated to a
service, which will typically be set during probe.
---
 src/service.c | 12 ++++++++++++
 src/service.h |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/src/service.c b/src/service.c
index a10138d..e03a412 100644
--- a/src/service.c
+++ b/src/service.c
@@ -50,6 +50,7 @@ struct btd_service {
 	gint			ref;
 	struct btd_device	*device;
 	struct btd_profile	*profile;
+	void			*user_data;
 	btd_service_state_t	state;
 };
 
@@ -239,6 +240,17 @@ struct btd_profile *btd_service_get_profile(const struct btd_service *service)
 	return service->profile;
 }
 
+void btd_service_set_user_data(struct btd_service *service, void *user_data)
+{
+	assert(service->state == BTD_SERVICE_STATE_UNAVAILABLE);
+	service->user_data = user_data;
+}
+
+void *btd_service_get_user_data(const struct btd_service *service)
+{
+	return service->user_data;
+}
+
 btd_service_state_t btd_service_get_state(const struct btd_service *service)
 {
 	return service->state;
diff --git a/src/service.h b/src/service.h
index 8fb1ed5..a89b524 100644
--- a/src/service.h
+++ b/src/service.h
@@ -55,3 +55,5 @@ btd_service_state_t btd_service_get_state(const struct btd_service *service);
 /* Functions used by profile implementation */
 void btd_service_connecting_complete(struct btd_service *service, int err);
 void btd_service_disconnecting_complete(struct btd_service *service, int err);
+void btd_service_set_user_data(struct btd_service *service, void *user_data);
+void *btd_service_get_user_data(const struct btd_service *service);
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux