Merge pull request #3 from bradbishop/master

sd-bus example, pydbus example rework
diff --git a/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass b/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
index 9e757bc..4aacca4 100644
--- a/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-dbus-service.bbclass
@@ -3,9 +3,10 @@
 # Class users should define DBUS_SERVICES prior to including.
 
 python() {
-        services = d.getVar('DBUS_SERVICES', True).split()
-        uris = " ".join( [ 'file://' + s + '.conf' for s in services ] )
-        d.appendVar('SRC_URI', uris)
+        services = d.getVar('DBUS_SERVICES', True)
+        if services:
+                uris = " ".join( [ 'file://' + s + '.conf' for s in services.split() ] )
+                d.appendVar('SRC_URI', uris)
 }
 
 do_install_append() {
diff --git a/meta-phosphor/classes/obmc-phosphor-pydbus-service.bbclass b/meta-phosphor/classes/obmc-phosphor-pydbus-service.bbclass
new file mode 100644
index 0000000..dc6f9e5
--- /dev/null
+++ b/meta-phosphor/classes/obmc-phosphor-pydbus-service.bbclass
@@ -0,0 +1,6 @@
+# Common code for applications providing a D-Bus service using python-dbus bindings.
+
+# Class users should define DBUS_SERVICES prior to including.
+
+inherit obmc-phosphor-dbus-service
+inherit obmc-phosphor-py-daemon
diff --git a/meta-phosphor/classes/obmc-phosphor-sdbus-service.bbclass b/meta-phosphor/classes/obmc-phosphor-sdbus-service.bbclass
new file mode 100644
index 0000000..8a9853c
--- /dev/null
+++ b/meta-phosphor/classes/obmc-phosphor-sdbus-service.bbclass
@@ -0,0 +1,9 @@
+# Common code for applications providing a D-Bus service using sd-bus bindings.
+
+# Class users should define DBUS_SERVICES prior to including.
+
+DEPENDS += "systemd"
+RDEPENDS_${PN} += "libsystemd"
+
+inherit obmc-phosphor-dbus-service
+inherit obmc-phosphor-c-daemon
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-chassis/obmc-phosphor-chassisd.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-chassis/obmc-phosphor-chassisd.bb
index 2ff0dcf..ad642a3 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-chassis/obmc-phosphor-chassisd.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-chassis/obmc-phosphor-chassisd.bb
@@ -3,4 +3,4 @@
 PR = "r1"
 
 inherit obmc-phosphor-chassis-mgmt
-inherit obmc-phosphor-py-daemon
+inherit obmc-phosphor-pydbus-service
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-event/obmc-phosphor-eventd.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-event/obmc-phosphor-eventd.bb
index 92b0ded..998648c 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-event/obmc-phosphor-eventd.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-event/obmc-phosphor-eventd.bb
@@ -3,4 +3,4 @@
 PR = "r1"
 
 inherit obmc-phosphor-event-mgmt
-inherit obmc-phosphor-py-daemon
+inherit obmc-phosphor-pydbus-service
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/obmc-phosphor-example-pydbus.py b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/obmc-phosphor-example-pydbus.py
new file mode 100644
index 0000000..b0523b3
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/obmc-phosphor-example-pydbus.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+# Contributors Listed Below - COPYRIGHT 2015
+# [+] International Business Machines Corp.
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+
+import sys
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+import gobject
+
+SERVICE_PREFIX = 'org.openbmc.examples'
+IFACE_PREFIX = 'org.openbmc.examples'
+BASE_OBJ_PATH = '/org/openbmc/examples/'
+
+class SampleObjectOne(dbus.service.Object):
+	def __init__(self, bus, name):
+		super(SampleObjectOne, self).__init__(bus, name)
+
+	@dbus.service.method(IFACE_PREFIX + '.Echo', 's', 's')
+	def Echo(self, val):
+		self.MethodInvoked("Echo method was invoked", self._object_path)
+		return self._object_path + " says " + val
+	
+	@dbus.service.signal(IFACE_PREFIX + '.Echo', 'ss')
+	def MethodInvoked(self, message, path):
+		pass
+
+class SampleObjectTwo(SampleObjectOne):
+	def __init__(self, bus, name):
+		super(SampleObjectTwo, self).__init__(bus, name)
+		self.map = {}
+
+	@dbus.service.method(IFACE_PREFIX + '.Dict', 'ss', '')
+	def SetAValueInTheDict(self, key, value):
+		self.map[key] = value
+
+	@dbus.service.method(IFACE_PREFIX + '.Dict', 's', 's')
+	def GetAValueFromTheDict(self, key):
+		return self.map.get(key, "set a value first")
+
+	@dbus.service.method(IFACE_PREFIX + '.Dict', '', 's')
+	def GetAllValuesFromTheDict(self):
+		return " ".join( [ x+ ':' + self.map[x] for x in self.map.keys() ] )
+
+
+if __name__ == '__main__':
+	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+	bus = dbus.SystemBus()
+
+	services = []
+	services.append(dbus.service.BusName(SERVICE_PREFIX + '.PythonService0', bus))
+	services.append(dbus.service.BusName(SERVICE_PREFIX + '.PythonService1', bus))
+
+	objs = []
+	objs.append(SampleObjectOne(bus, BASE_OBJ_PATH + 'path0/PythonObj'))
+	objs.append(SampleObjectTwo(bus, BASE_OBJ_PATH + 'path1/PythonObj'))
+
+	mainloop = gobject.MainLoop()
+
+	print "obmc-phosphor-example-pydbus starting..."
+	mainloop.run()
+
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/obmc-phosphor-qemu.service b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/obmc-phosphor-example-pydbus.service
similarity index 68%
copy from meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/obmc-phosphor-qemu.service
copy to meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/obmc-phosphor-example-pydbus.service
index 0cf4e15..d39395f 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/obmc-phosphor-qemu.service
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/obmc-phosphor-example-pydbus.service
@@ -2,7 +2,7 @@
 Description=Phosphor OpenBMC QEMU application example
 
 [Service]
-ExecStart=/usr/sbin/obmc-phosphor-qemu
+ExecStart=/usr/sbin/obmc-phosphor-example-pydbus
 
 [Install]
 WantedBy=multi-user.target
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService0.conf
similarity index 61%
copy from meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf
copy to meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService0.conf
index cd488d5..fad0b81 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService0.conf
@@ -2,7 +2,7 @@
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
 <busconfig>
   <policy user="root">
-    <allow own="org.openbmc.examples.services.Service1"/>
-    <allow send_destination="org.openbmc.examples.services.Service1"/>
+    <allow own="org.openbmc.examples.PythonService0"/>
+    <allow send_destination="org.openbmc.examples.PythonService0"/>
   </policy>
 </busconfig>
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService1.conf
similarity index 61%
copy from meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf
copy to meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService1.conf
index cd488d5..0f7114e 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/org.openbmc.examples.PythonService1.conf
@@ -2,7 +2,7 @@
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
 <busconfig>
   <policy user="root">
-    <allow own="org.openbmc.examples.services.Service1"/>
-    <allow send_destination="org.openbmc.examples.services.Service1"/>
+    <allow own="org.openbmc.examples.PythonService1"/>
+    <allow send_destination="org.openbmc.examples.PythonService1"/>
   </policy>
 </busconfig>
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
new file mode 100644
index 0000000..7fee0b1
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/obmc-phosphor-example-pydbus.bb
@@ -0,0 +1,10 @@
+SUMMARY = "Phosphor OpenBMC BSP Example Application"
+DESCRIPTION = "Phosphor OpenBMC QEMU BSP example implementation."
+PR = "r1"
+
+DBUS_SERVICES = " \
+        org.openbmc.examples.PythonService0 \
+        org.openbmc.examples.PythonService1 \
+        "
+
+inherit obmc-phosphor-pydbus-service
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/Makefile b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/Makefile
new file mode 100644
index 0000000..5166fdf
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/Makefile
@@ -0,0 +1,17 @@
+EXE     = obmc-phosphor-example-sdbus
+OBJS    = $(EXE).o
+DEPPKGS = libsystemd
+CC      ?= $(CROSS_COMPILE)gcc
+INCLUDES += $(shell pkg-config --cflags $(DEPPKGS))
+LIBS += $(shell pkg-config --libs $(DEPPKGS))
+
+%.o : %.c
+	echo $(CFLAGS)
+	echo $(INCLUDES)
+	$(CC) -c $< $(CFLAGS) $(INCLUDES) -o $@
+$(EXE): $(OBJS)
+	$(CC) $^ $(LDFLAGS) $(LIBS) -o $@
+clean:
+	rm -f $(OBJS) $(EXE) *.o *.d
+distclean: clean
+	rm -f *.c~ *.h~ *.sh~ Makefile~ config.mk~
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/obmc-phosphor-example-sdbus.c b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/obmc-phosphor-example-sdbus.c
new file mode 100644
index 0000000..a66bb55
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/obmc-phosphor-example-sdbus.c
@@ -0,0 +1,117 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <systemd/sd-bus.h>
+
+static int method_echo(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
+	char *str;
+	const char *intf = sd_bus_message_get_interface(m),
+	      *path = sd_bus_message_get_path(m);
+	sd_bus *bus = sd_bus_message_get_bus(m);
+
+	char response[512] = {0};
+	int r;
+
+	/* Read the parameters */
+	r = sd_bus_message_read(m, "s", &str);
+	if (r < 0) {
+		fprintf(stderr, "Failed to parse parameters: %s\n", strerror(-r));
+		return r;
+	}
+
+	r = sd_bus_emit_signal(bus, path, intf, "MethodInvoked", "ss",
+			"Echo method was invoked", path);
+	if (r < 0) {
+		fprintf(stderr, "Failed to emit signal: %s\n", strerror(-r));
+		return r;
+	}
+
+	strncat(response, path, 128);
+	strcat(response, " says ");
+	strncat(response, str, 128);
+
+	/* Reply with the response */
+	return sd_bus_reply_method_return(m, "s", &response);
+}
+
+static const sd_bus_vtable echo_vtable[] = {
+	SD_BUS_VTABLE_START(0),
+	SD_BUS_METHOD("Echo", "s", "s", method_echo, SD_BUS_VTABLE_UNPRIVILEGED),
+	SD_BUS_SIGNAL("MethodInvoked", "s", 0),
+	SD_BUS_VTABLE_END
+};
+
+int main(int argc, char *argv[]) {
+	sd_bus_slot *slot = NULL;
+	sd_bus *bus = NULL;
+	int r;
+	char **acquired = NULL, **activatable = NULL, **i;
+
+	/* Connect to the user bus this time */
+	r = sd_bus_open_system(&bus);
+	if (r < 0) {
+		fprintf(stderr, "Failed to connect to system bus: %s\n", strerror(-r));
+		goto finish;
+	}
+
+	/* Install an object */
+	r = sd_bus_add_object_vtable(bus,
+			&slot,
+			"/org/openbmc/examples/path0/SDBusObj",  /* object path */
+			"org.openbmc.examples.Echo",   /* interface name */
+			echo_vtable,
+			NULL);
+	if (r < 0) {
+		fprintf(stderr, "Failed to issue method call: %s\n", strerror(-r));
+		goto finish;
+	}
+
+	/* Install an object */
+	r = sd_bus_add_object_vtable(bus,
+			&slot,
+			"/org/openbmc/examples/path1/SDBusObj",  /* object path */
+			"org.openbmc.examples.Echo",   /* interface name */
+			echo_vtable,
+			NULL);
+	if (r < 0) {
+		fprintf(stderr, "Failed to issue method call: %s\n", strerror(-r));
+		goto finish;
+	}
+
+	/* Take a well-known service name so that clients can find us */
+	r = sd_bus_request_name(bus, "org.openbmc.examples.SDBusService0", 0);
+	if (r < 0) {
+		fprintf(stderr, "Failed to acquire service name: %s\n", strerror(-r));
+		goto finish;
+	}
+
+	r = sd_bus_request_name(bus, "org.openbmc.examples.SDBusService1", 0);
+	if (r < 0) {
+		fprintf(stderr, "Failed to acquire service name: %s\n", strerror(-r));
+		goto finish;
+	}
+
+	for (;;) {
+		/* Process requests */
+		r = sd_bus_process(bus, NULL);
+		if (r < 0) {
+			fprintf(stderr, "Failed to process bus: %s\n", strerror(-r));
+			goto finish;
+		}
+		if (r > 0) /* we processed a request, try to process another one, right-away */
+			continue;
+
+		/* Wait for the next request to process */
+		r = sd_bus_wait(bus, (uint64_t) -1);
+		if (r < 0) {
+			fprintf(stderr, "Failed to wait on bus: %s\n", strerror(-r));
+			goto finish;
+		}
+	}
+
+finish:
+	sd_bus_slot_unref(slot);
+	sd_bus_unref(bus);
+
+	return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+}
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/obmc-phosphor-qemu.service b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/obmc-phosphor-example-sdbus.service
similarity index 69%
rename from meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/obmc-phosphor-qemu.service
rename to meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/obmc-phosphor-example-sdbus.service
index 0cf4e15..dcce732 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/obmc-phosphor-qemu.service
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/obmc-phosphor-example-sdbus.service
@@ -2,7 +2,7 @@
 Description=Phosphor OpenBMC QEMU application example
 
 [Service]
-ExecStart=/usr/sbin/obmc-phosphor-qemu
+ExecStart=/usr/sbin/obmc-phosphor-example-sdbus
 
 [Install]
 WantedBy=multi-user.target
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService0.conf
similarity index 61%
rename from meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf
rename to meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService0.conf
index cd488d5..45af4f4 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService0.conf
@@ -2,7 +2,7 @@
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
 <busconfig>
   <policy user="root">
-    <allow own="org.openbmc.examples.services.Service1"/>
-    <allow send_destination="org.openbmc.examples.services.Service1"/>
+    <allow own="org.openbmc.examples.SDBusService0"/>
+    <allow send_destination="org.openbmc.examples.SDBusService0"/>
   </policy>
 </busconfig>
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService1.conf
similarity index 61%
copy from meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf
copy to meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService1.conf
index cd488d5..5a7bfb8 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service1.conf
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/files/org.openbmc.examples.SDBusService1.conf
@@ -2,7 +2,7 @@
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
 <busconfig>
   <policy user="root">
-    <allow own="org.openbmc.examples.services.Service1"/>
-    <allow send_destination="org.openbmc.examples.services.Service1"/>
+    <allow own="org.openbmc.examples.SDBusService1"/>
+    <allow send_destination="org.openbmc.examples.SDBusService1"/>
   </policy>
 </busconfig>
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
new file mode 100644
index 0000000..3735007
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.bb
@@ -0,0 +1,10 @@
+SUMMARY = "Phosphor OpenBMC BSP Example Application"
+DESCRIPTION = "Phosphor OpenBMC QEMU BSP example implementation."
+PR = "r1"
+
+DBUS_SERVICES = " \
+        org.openbmc.examples.SDBusService0 \
+        org.openbmc.examples.SDBusService1 \
+        "
+
+inherit obmc-phosphor-sdbus-service
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-fan/files/Makefile b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-fan/files/Makefile
index 8ca27e4..10e3fa2 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-fan/files/Makefile
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-fan/files/Makefile
@@ -1,7 +1,7 @@
 EXE     = obmc-phosphor-fand
 OBJS    = $(EXE).o
 DEPPKGS = gio-unix-2.0 glib-2.0
-CC      = $(CROSS_COMPILE)gcc
+CC      ?= $(CROSS_COMPILE)gcc
 INCLUDES += $(shell pkg-config --cflags $(DEPPKGS))
 LIBS += $(shell pkg-config --libs $(DEPPKGS))
 
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-fan/obmc-phosphor-fand.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-fan/obmc-phosphor-fand.bb
index c83e825..13c4b70 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-fan/obmc-phosphor-fand.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-fan/obmc-phosphor-fand.bb
@@ -3,4 +3,4 @@
 PR = "r1"
 
 inherit obmc-phosphor-fan-mgmt
-inherit obmc-phosphor-c-daemon
+inherit obmc-phosphor-sdbus-service
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-flash/obmc-phosphor-flashd.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-flash/obmc-phosphor-flashd.bb
index 8221019..bd4b1af 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-flash/obmc-phosphor-flashd.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-flash/obmc-phosphor-flashd.bb
@@ -3,4 +3,4 @@
 PR = "r1"
 
 inherit obmc-phosphor-flash-mgmt
-inherit obmc-phosphor-py-daemon
+inherit obmc-phosphor-pydbus-service
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-policy/obmc-phosphor-policyd.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-policy/obmc-phosphor-policyd.bb
index 6c8d6fc..664760e 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-policy/obmc-phosphor-policyd.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-policy/obmc-phosphor-policyd.bb
@@ -3,4 +3,4 @@
 PR = "r1"
 
 inherit obmc-phosphor-policy-mgmt
-inherit obmc-phosphor-py-daemon
+inherit obmc-phosphor-pydbus-service
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/obmc-phosphor-qemu.py b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/obmc-phosphor-qemu.py
deleted file mode 100644
index 3ef8e85..0000000
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/obmc-phosphor-qemu.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-
-# Contributors Listed Below - COPYRIGHT 2015
-# [+] International Business Machines Corp.
-#
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# permissions and limitations under the License.
-
-import sys
-import dbus
-import dbus.service
-import dbus.mainloop.glib
-import gobject
-
-SERVICE_PREFIX = 'org.openbmc.examples.services'
-IFACE_PREFIX = 'org.openbmc.examples.interfaces'
-BASE_OBJ_PATH = '/org/openbmc/examples/'
-
-class SampleObjectOne(dbus.service.Object):
-	def __init__(self, bus, name):
-		super(SampleObjectOne, self).__init__(bus, name)
-
-	@dbus.service.method(IFACE_PREFIX + '.Interface0', 's', 's')
-	def echo(self, val):
-		return str(type(self).__name__) + ": " + val
-
-class SampleObjectTwo(SampleObjectOne):
-	def __init__(self, bus, name):
-		super(SampleObjectTwo, self).__init__(bus, name)
-		self.map = {}
-
-	@dbus.service.method(IFACE_PREFIX + '.Interface1', 'ss', '')
-	def set_a_value_in_the_dict(self, key, value):
-		self.map[key] = value
-
-	@dbus.service.method(IFACE_PREFIX + '.Interface1', 's', 's')
-	def get_a_value_from_the_dict(self, key):
-		return self.map.get(key, "set a value first")
-
-	@dbus.service.method(IFACE_PREFIX + '.Interface1', '', 's')
-	def get_all_values_from_the_dict(self):
-		return " ".join( [ x+ ':' + self.map[x] for x in self.map.keys() ] )
-
-if __name__ == '__main__':
-	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-
-	bus = dbus.SystemBus()
-
-	services = []
-	services.append(dbus.service.BusName(SERVICE_PREFIX + '.Service0', bus))
-	services.append(dbus.service.BusName(SERVICE_PREFIX + '.Service1', bus))
-
-	objs = []
-	objs.append(SampleObjectOne(bus, BASE_OBJ_PATH + 'path0/Obj'))
-	objs.append(SampleObjectTwo(bus, BASE_OBJ_PATH + 'path1/Obj'))
-
-	mainloop = gobject.MainLoop()
-
-	print "obmc-phosphor-qemu starting..."
-	mainloop.run()
-
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service0.conf b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service0.conf
deleted file mode 100644
index 1c6c505..0000000
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/files/org.openbmc.examples.services.Service0.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-  <policy user="root">
-    <allow own="org.openbmc.examples.services.Service0"/>
-    <allow send_destination="org.openbmc.examples.services.Service0"/>
-  </policy>
-</busconfig>
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/obmc-phosphor-qemu.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/obmc-phosphor-qemu.bb
deleted file mode 100644
index 0ea5355..0000000
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-qemu/obmc-phosphor-qemu.bb
+++ /dev/null
@@ -1,12 +0,0 @@
-SUMMARY = "Phosphor OpenBMC BSP Example Application"
-DESCRIPTION = "Phosphor OpenBMC QEMU BSP example implementation."
-PR = "r1"
-
-inherit obmc-phosphor-py-daemon
-
-DBUS_SERVICES = " \
-        org.openbmc.examples.services.Service0 \
-        org.openbmc.examples.services.Service1 \
-        "
-
-inherit obmc-phosphor-dbus-service
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-sensor/obmc-phosphor-sensord.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-sensor/obmc-phosphor-sensord.bb
index 382d055..fc646a5 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-sensor/obmc-phosphor-sensord.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-sensor/obmc-phosphor-sensord.bb
@@ -3,4 +3,4 @@
 PR = "r1"
 
 inherit obmc-phosphor-sensor-mgmt
-inherit obmc-phosphor-py-daemon
+inherit obmc-phosphor-pydbus-service
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-sys/obmc-phosphor-sysd.bb b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-sys/obmc-phosphor-sysd.bb
index 99927db..3dc9a64 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-sys/obmc-phosphor-sysd.bb
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-sys/obmc-phosphor-sysd.bb
@@ -3,4 +3,4 @@
 PR = "r1"
 
 inherit obmc-phosphor-system-mgmt
-inherit obmc-phosphor-py-daemon
+inherit obmc-phosphor-pydbus-service
diff --git a/meta-phosphor/conf/machine/include/sample.inc b/meta-phosphor/conf/machine/include/sample.inc
index 7db2883..89ad0ec 100644
--- a/meta-phosphor/conf/machine/include/sample.inc
+++ b/meta-phosphor/conf/machine/include/sample.inc
@@ -6,14 +6,14 @@
         "
 
 VIRTUAL-RUNTIME_obmc-phosphor-fan-ctl = " \
-       obmc-phosphor-qemu \
+       obmc-phosphor-example-sdbus \
        "
 VIRTUAL-RUNTIME_obmc-phosphor-sensor-ctl = " \
-       obmc-phosphor-qemu \
+       obmc-phosphor-example-sdbus \
        "
 VIRTUAL-RUNTIME_obmc-phosphor-chassis-ctl = " \
-       obmc-phosphor-qemu \
+       obmc-phosphor-example-pydbus \
        "
 VIRTUAL-RUNTIME_obmc-phosphor-flash-ctl = " \
-       obmc-phosphor-qemu \
+       obmc-phosphor-example-pydbus \
        "