cleaned up ipmi handling
diff --git a/objects/sensor_host_status_obj.c b/objects/sensor_host_status_obj.c
index 57357d9..05e02b2 100644
--- a/objects/sensor_host_status_obj.c
+++ b/objects/sensor_host_status_obj.c
@@ -11,30 +11,6 @@
 static GDBusObjectManagerServer *manager = NULL;

 

 static gboolean

-on_set_value    (SensorValue  *sen,

-                GDBusMethodInvocation  *invocation,

-		GVariant*    value,

-                gpointer                user_data)

-{

-	SensorMatch *match = object_get_sensor_match((Object*)user_data);

-	Control* control = object_get_control((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);

-		control_emit_goto_system_state(control,"BOOTED");

-	}

-	sensor_value_complete_set_value(sen,invocation);

-	return TRUE;

-}

-

-static gboolean

 on_init         (SensorValue  *sen,

                 GDBusMethodInvocation  *invocation,

                 gpointer                user_data)

@@ -44,7 +20,7 @@
 }

 

 static gboolean

-on_init_control         (Control  *control,

+on_init_control         (Control *control,

                 GDBusMethodInvocation  *invocation,

                 gpointer                user_data)

 {

@@ -52,6 +28,42 @@
 	return TRUE;

 }

 

+static void

+on_set_ipmi (GDBusConnection* connection,

+               const gchar* sender_name,

+               const gchar* object_path,

+               const gchar* interface_name,

+               const gchar* signal_name,

+               GVariant* parameters,

+               gpointer user_data) 

+{

+	SensorMatch *match = object_get_sensor_match((Object*)user_data);

+	SensorValue *sen = object_get_sensor_value((Object*)user_data);

+	SensorIpmi *ipmi = object_get_sensor_ipmi((Object*)user_data);

+	Control* control = object_get_control((Object*)user_data);

+	

+	guchar sensor_id;

+	guchar host_status;

+	g_variant_get (parameters, "(yy)", &sensor_id,&host_status);

+	guchar my_sensor_id = sensor_ipmi_get_sensor_id(ipmi);

+	if (my_sensor_id == sensor_id)

+	{

+		GVariant *old_value = sensor_value_get_value(sen);

+		GVariant *value = NEW_VARIANT_B(host_status);

+		if (VARIANT_COMPARE(old_value,value) != 0)

+		{

+			sensor_value_set_value(sen, value);

+			sensor_value_emit_changed(sen, value, "");

+			if (host_status == BOOTED)

+			{

+				sensor_match_set_state(match,host_status);

+				sensor_match_emit_sensor_match(match,host_status);

+				control_emit_goto_system_state(control,"BOOTED");

+			}

+		}

+	}

+}

+

 static void 

 on_bus_acquired (GDBusConnection *connection,

                  const gchar     *name,

@@ -82,10 +94,14 @@
   		object_skeleton_set_sensor_match (object, match);

   		g_object_unref (match);

 

-		Control* control = control_skeleton_new ();

-		object_skeleton_set_control (object, control);

-		g_object_unref (control);

-	

+		SensorIpmi *ipmi = sensor_ipmi_skeleton_new ();

+  		object_skeleton_set_sensor_ipmi (object, ipmi);

+  		g_object_unref (ipmi);

+

+		Control *control = control_skeleton_new ();

+  		object_skeleton_set_control (object, control);

+  		g_object_unref (control);

+

 		//must init variant

 		GVariant* v = NEW_VARIANT_B(0);

 		sensor_value_set_value(sensor,v);

@@ -96,6 +112,17 @@
 		//must emit change so sensor manager sees initial value

 		sensor_value_emit_changed(sensor,v,"");

 

+		//signal handlers

+		g_dbus_connection_signal_subscribe(connection,

+                                   "org.openbmc.sensors.IpmiBt",

+                                   "org.openbmc.sensors.IpmiBt",

+                                   "SetSensor",

+                                   "/org/openbmc/sensors/IpmiBt",

+                                   NULL,

+                                   G_DBUS_SIGNAL_FLAGS_NONE,

+                                   (GDBusSignalCallback) on_set_ipmi,

+                                   object,

+                                   NULL );

   		//define method callbacks here

   		g_signal_connect (sensor,

                     "handle-init",

@@ -107,10 +134,11 @@
                     G_CALLBACK (on_init_control),

                     NULL); /* user_data */

 

-		g_signal_connect (sensor,

-                    "handle-set-value",

-                    G_CALLBACK (on_set_value),

-                    object); /* 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));