main: Always report new post codes
Right now, we rely on the signals sent via the property value of the
post code changing in order to alert DBus clients of new post codes.
Unfortunately, the underlying code checks to see if the value has
actually changed before sending out a PropertiesChanged signal. This is
undesirable for post codes as the process could actually write the same
code multiple times over LPC, and we want to capure each of those
writes.
Avoid this behavior by updating the value to a known different value,
then perform an update with signal sending to the correct value.
Change-Id: I40f419ba8e63b8431c84a108c48f47980206eaa4
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/main.cpp b/main.cpp
index f3815c1..daec6c4 100644
--- a/main.cpp
+++ b/main.cpp
@@ -62,7 +62,12 @@
}
if (readb > 0)
{
- reporter->value(le64toh(code));
+ code = le64toh(code);
+ // HACK: Always send property changed signal even for the same code
+ // since we are single threaded, external users will never see the
+ // first value.
+ reporter->value(~code, true);
+ reporter->value(code);
}
}