lots of changes
diff --git a/objects/sensor_host_status_obj.c b/objects/sensor_host_status_obj.c
index a085220..bd16935 100644
--- a/objects/sensor_host_status_obj.c
+++ b/objects/sensor_host_status_obj.c
@@ -1,48 +1,45 @@
#include "interfaces/sensor.h"
#include "openbmc.h"
-
+#define BOOTED 100
/* ---------------------------------------------------------------------------------------------------- */
static const gchar* dbus_object_path = "/org/openbmc/sensors/HostStatus";
static const gchar* dbus_name = "org.openbmc.sensors.HostStatus";
-static const guint poll_interval = 3000;
static guint heartbeat = 0;
static GDBusObjectManagerServer *manager = NULL;
-/*
-static gboolean
-on_get_units (SensorValue *sen,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- const gchar* val = sensor_value_get_units(sen);
- sensor_value_complete_get_units(sen,invocation,val);
- return TRUE;
-}
static gboolean
-on_get (SensorValue *sen,
+on_set_value (SensorValue *sen,
GDBusMethodInvocation *invocation,
+ GVariant* value,
gpointer user_data)
{
- guint reading = sensor_value_get_value(sen);
- sensor_value_complete_get_value(sen,invocation,reading);
- return TRUE;
-}
-static gboolean
-on_set (SensorValue *sen,
- GDBusMethodInvocation *invocation,
- guint value,
- gpointer user_data)
-{
- GVariant* v = NEW_VARIANT_U(value);
- sensor_value_set_value(sen,v);
- sensor_value_emit_changed(sen,v,sensor_value_get_units(sen));
+ SensorMatch *match = object_get_sensor_match((Object*)user_data);
+ sensor_value_set_value(sen,value);
+ sensor_value_emit_changed(sen,value,"");
+ // Important host status values
+ guchar host_status = g_variant_get_byte(g_variant_get_variant(value));
+
+ if (host_status == BOOTED)
+ {
+ sensor_match_set_state(match,host_status);
+ sensor_match_emit_sensor_match(match,host_status);
+ }
sensor_value_complete_set_value(sen,invocation);
return TRUE;
}
-*/
+
+static gboolean
+on_init (SensorValue *sen,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ sensor_value_complete_init(sen,invocation);
+ return TRUE;
+}
+
static void
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
@@ -68,26 +65,28 @@
SensorValue *sensor = sensor_value_skeleton_new ();
object_skeleton_set_sensor_value (object, sensor);
g_object_unref (sensor);
+
+ SensorMatch *match = sensor_match_skeleton_new ();
+ object_skeleton_set_sensor_match (object, match);
+ g_object_unref (match);
//must init variant
- GVariant* v = NEW_VARIANT_U(0);
+ GVariant* v = NEW_VARIANT_B(0);
sensor_value_set_value(sensor,v);
- // set units
+ // set units
sensor_value_set_units(sensor,"");
+ sensor_value_set_settable(sensor,TRUE);
+
//define method callbacks here
- //g_signal_connect (sensor,
- // "handle-get-value",
- // G_CALLBACK (on_get),
- // NULL); /* user_data */
- //g_signal_connect (sensor,
- // "handle-get-units",
- // G_CALLBACK (on_get_units),
- // NULL); /* user_data */
- //g_signal_connect (sensor,
- // "handle-set-value",
- // G_CALLBACK (on_set),
- // NULL); /* user_data */
+ g_signal_connect (sensor,
+ "handle-init",
+ G_CALLBACK (on_init),
+ NULL); /* user_data */
+ g_signal_connect (sensor,
+ "handle-set-value",
+ G_CALLBACK (on_set_value),
+ object); /* user_data */
/* Export the object (@manager takes its own reference to @object) */
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));