summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>2012-10-09 13:19:47 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-10-09 17:50:07 +0200
commit3c10778c4025639c0370f3026d0db997ef0d5022 (patch)
tree3988b6bc8f29dcb3430aa9b3017ed10b65c5c058 /profiles
parentf083aa524223c26911580d583982267d0ef1ae52 (diff)
thermometer: Include remote device information in MeasurementReceived
Since watchers are now registered per-adapter it's necessary to include remote device information in MeasurementReceived callback. This patch adds parameter to MeasurementReceived method which is an object path to remote device object.
Diffstat (limited to 'profiles')
-rw-r--r--profiles/thermometer/thermometer.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/profiles/thermometer/thermometer.c b/profiles/thermometer/thermometer.c
index 08503e5a..98735d8d 100644
--- a/profiles/thermometer/thermometer.c
+++ b/profiles/thermometer/thermometer.c
@@ -101,13 +101,14 @@ struct watcher {
};
struct measurement {
- int16_t exp;
- int32_t mant;
- uint64_t time;
- gboolean suptime;
- char *unit;
- char *type;
- char *value;
+ struct thermometer *t;
+ int16_t exp;
+ int32_t mant;
+ uint64_t time;
+ gboolean suptime;
+ char *unit;
+ char *type;
+ char *value;
};
struct tmp_interval_data {
@@ -1027,6 +1028,7 @@ static void update_watcher(gpointer data, gpointer user_data)
{
struct watcher *w = data;
struct measurement *m = user_data;
+ const gchar *path = device_get_path(m->t->dev);
DBusMessageIter iter;
DBusMessageIter dict;
DBusMessage *msg;
@@ -1039,6 +1041,8 @@ static void update_watcher(gpointer data, gpointer user_data)
dbus_message_iter_init_append(msg, &iter);
+ dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH , &path);
+
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
@@ -1064,6 +1068,8 @@ static void recv_measurement(struct thermometer *t, struct measurement *m)
{
GSList *wlist;
+ m->t = t;
+
if (g_strcmp0(m->value, "Intermediate") == 0)
wlist = t->tadapter->iwatchers;
else