* [PATCH] Cleanup of device class update signal
@ 2011-05-19 14:17 Sheldon Demario
2011-05-19 23:35 ` Johan Hedberg
0 siblings, 1 reply; 3+ messages in thread
From: Sheldon Demario @ 2011-05-19 14:17 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sheldon Demario
Adds a new device function to address the PropertyChanged
signal when the device's class changes. event.c file should
avoid sending signals that belongs to device objects.
---
src/device.c | 8 ++++++++
src/device.h | 1 +
src/event.c | 9 ++-------
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/device.c b/src/device.c
index 141ccf8..4181ac4 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2445,3 +2445,11 @@ void btd_device_unref(struct btd_device *device)
g_free(path);
}
+
+void device_set_class(struct btd_device *device, uint32_t value)
+{
+ DBusConnection *conn = get_dbus_connection();
+
+ emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Class",
+ DBUS_TYPE_UINT32, &value);
+}
diff --git a/src/device.h b/src/device.h
index d59b8eb..ad7350a 100644
--- a/src/device.h
+++ b/src/device.h
@@ -99,6 +99,7 @@ guint device_add_disconnect_watch(struct btd_device *device,
disconnect_watch watch, void *user_data,
GDestroyNotify destroy);
void device_remove_disconnect_watch(struct btd_device *device, guint id);
+void device_set_class(struct btd_device *device, uint32_t value);
#define BTD_UUIDS(args...) ((const char *[]) { args, NULL } )
diff --git a/src/event.c b/src/event.c
index 2643a87..6be7ea2 100644
--- a/src/event.c
+++ b/src/event.c
@@ -346,11 +346,9 @@ void btd_event_set_legacy_pairing(bdaddr_t *local, bdaddr_t *peer,
void btd_event_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t class)
{
- uint32_t old_class = 0;
struct btd_adapter *adapter;
struct btd_device *device;
- const gchar *dev_path;
- DBusConnection *conn = get_dbus_connection();
+ uint32_t old_class = 0;
read_remote_class(local, peer, &old_class);
@@ -365,10 +363,7 @@ void btd_event_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t class)
if (!device)
return;
- dev_path = device_get_path(device);
-
- emit_property_changed(conn, dev_path, DEVICE_INTERFACE, "Class",
- DBUS_TYPE_UINT32, &class);
+ device_set_class(device, class);
}
void btd_event_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Cleanup of device class update signal
2011-05-19 14:17 [PATCH] Cleanup of device class update signal Sheldon Demario
@ 2011-05-19 23:35 ` Johan Hedberg
0 siblings, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2011-05-19 23:35 UTC (permalink / raw)
To: Sheldon Demario; +Cc: linux-bluetooth
Hi Sheldon,
On Thu, May 19, 2011, Sheldon Demario wrote:
> Adds a new device function to address the PropertyChanged
> signal when the device's class changes. event.c file should
> avoid sending signals that belongs to device objects.
> ---
> src/device.c | 8 ++++++++
> src/device.h | 1 +
> src/event.c | 9 ++-------
> 3 files changed, 11 insertions(+), 7 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Cleanup of device class update signal
@ 2011-04-20 21:42 Sheldon Demario
0 siblings, 0 replies; 3+ messages in thread
From: Sheldon Demario @ 2011-04-20 21:42 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sheldon Demario
Adds a new device function to address the PropertyChanged
signal when the device's class changes. event.c file should
avoid sending signals that belongs to device objects.
---
src/device.c | 8 ++++++++
src/device.h | 1 +
src/event.c | 9 ++-------
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/device.c b/src/device.c
index e5451e8..bacd2c0 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2445,3 +2445,11 @@ void btd_device_unref(struct btd_device *device)
g_free(path);
}
+
+void device_set_class(struct btd_device *device, uint32_t value)
+{
+ DBusConnection *conn = get_dbus_connection();
+
+ emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Class",
+ DBUS_TYPE_UINT32, &value);
+}
diff --git a/src/device.h b/src/device.h
index d59b8eb..ad7350a 100644
--- a/src/device.h
+++ b/src/device.h
@@ -99,6 +99,7 @@ guint device_add_disconnect_watch(struct btd_device *device,
disconnect_watch watch, void *user_data,
GDestroyNotify destroy);
void device_remove_disconnect_watch(struct btd_device *device, guint id);
+void device_set_class(struct btd_device *device, uint32_t value);
#define BTD_UUIDS(args...) ((const char *[]) { args, NULL } )
diff --git a/src/event.c b/src/event.c
index d52edf3..587f16f 100644
--- a/src/event.c
+++ b/src/event.c
@@ -540,11 +540,9 @@ void btd_event_set_legacy_pairing(bdaddr_t *local, bdaddr_t *peer,
void btd_event_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t class)
{
- uint32_t old_class = 0;
struct btd_adapter *adapter;
struct btd_device *device;
- const gchar *dev_path;
- DBusConnection *conn = get_dbus_connection();
+ uint32_t old_class = 0;
read_remote_class(local, peer, &old_class);
@@ -559,10 +557,7 @@ void btd_event_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t class)
if (!device)
return;
- dev_path = device_get_path(device);
-
- emit_property_changed(conn, dev_path, DEVICE_INTERFACE, "Class",
- DBUS_TYPE_UINT32, &class);
+ device_set_class(device, class);
}
void btd_event_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status,
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-19 23:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 14:17 [PATCH] Cleanup of device class update signal Sheldon Demario
2011-05-19 23:35 ` Johan Hedberg
-- strict thread matches above, loose matches on Subject: below --
2011-04-20 21:42 Sheldon Demario
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.