[PATCH BlueZ v5 1/3] service: Add error-code btd_service

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

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

The error-code represents the result of a connection/disconnection
procedure and can be useful when a state transition is detected.
---
 src/service.c | 7 +++++++
 src/service.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/src/service.c b/src/service.c
index e03a412..6228de1 100644
--- a/src/service.c
+++ b/src/service.c
@@ -52,6 +52,7 @@ struct btd_service {
 	struct btd_profile	*profile;
 	void			*user_data;
 	btd_service_state_t	state;
+	int			err;
 };
 
 static const char *state2str(btd_service_state_t state)
@@ -85,6 +86,7 @@ static void change_state(struct btd_service *service, btd_service_state_t state,
 	assert(service->profile != NULL);
 
 	service->state = state;
+	service->err = err;
 
 	ba2str(device_get_address(service->device), addr);
 	DBG("%p: device %s profile %s state changed: %s -> %s (%d)", service,
@@ -256,6 +258,11 @@ btd_service_state_t btd_service_get_state(const struct btd_service *service)
 	return service->state;
 }
 
+int btd_service_get_error(const struct btd_service *service)
+{
+	return service->err;
+}
+
 void btd_service_connecting_complete(struct btd_service *service, int err)
 {
 	if (service->state != BTD_SERVICE_STATE_DISCONNECTED &&
diff --git a/src/service.h b/src/service.h
index a89b524..e3bc6e5 100644
--- a/src/service.h
+++ b/src/service.h
@@ -51,6 +51,7 @@ int btd_service_disconnect(struct btd_service *service);
 struct btd_device *btd_service_get_device(const struct btd_service *service);
 struct btd_profile *btd_service_get_profile(const struct btd_service *service);
 btd_service_state_t btd_service_get_state(const struct btd_service *service);
+int btd_service_get_error(const struct btd_service *service);
 
 /* Functions used by profile implementation */
 void btd_service_connecting_complete(struct btd_service *service, int err);
-- 
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