test: dbus: passive read interface
Added basic unit-tests and added a factory for creating the
DbusPassive read interface so that it can be nicely error checked. This
is handled via a valid type check where the only valid types are 'fan'
and 'temp'.
Change-Id: I558ed09bf509d26f20c6e431bb0789074e9aa841
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/sensors/builder.cpp b/sensors/builder.cpp
index 9ab6a8c..01b0a64 100644
--- a/sensors/builder.cpp
+++ b/sensors/builder.cpp
@@ -66,11 +66,11 @@
switch (rtype)
{
case IOInterfaceType::DBUSPASSIVE:
- ri = std::make_unique<DbusPassive>(
- PassiveListeningBus,
- info->type,
- name,
- &helper);
+ ri = DbusPassive::CreateDbusPassive(PassiveListeningBus,
+ info->type,
+ name,
+ &helper);
+ /* TODO(venture): if this returns nullptr */
break;
case IOInterfaceType::EXTERNAL:
// These are a special case for read-only.