sensors: host: add comment
Adds a comment for future clean-up where the code needs to
have a parameter removed to prevent an early call to emit_object_added
before the properties are properly configured.
Change-Id: I18f15e933a19793597e2cd3da183f33a94e7511c
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/sensors/host.cpp b/sensors/host.cpp
index 44e83d8..b38d651 100644
--- a/sensors/host.cpp
+++ b/sensors/host.cpp
@@ -31,11 +31,18 @@
auto sensor = std::make_unique<HostSensor>(name, timeout, bus, objPath, defer);
sensor->value(0);
+ // DegreesC and value of 0 are the defaults at present, therefore testing
+ // this code only sees scale get updated as a property.
+
// TODO(venture): Need to not hard-code that this is DegreesC and scale
// 10x-3 unless it is! :D
sensor->unit(ValueInterface::Unit::DegreesC);
sensor->scale(-3);
sensor->emit_object_added();
+ // emit_object_added() can be called twice, harmlessly, the second time it
+ // doesn't actually happen, but we don't want to call it before we set up
+ // the initial values, so we should not let someone call this with
+ // defer=false.
/* TODO(venture): Need to set that _updated is set to epoch or something
* else. what is the default value?