Add python-dbus client example: pyclient-sample
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/pyclient-sample.py b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/pyclient-sample.py
new file mode 100644
index 0000000..e1010a5
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-example-pydbus/files/pyclient-sample.py
@@ -0,0 +1,60 @@
+#!/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 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/'
+
+def signal_callback(*a, **kw):
+ print "Got signal:"
+ print "intf: " + kw.get('intf', 'none')
+ print "path: " + kw.get('path', 'none')
+ print "member: " + kw.get('member', 'none')
+
+if __name__ == '__main__':
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+ bus = dbus.SystemBus()
+
+ obj0 = bus.get_object(SERVICE_PREFIX + '.PythonService0',
+ BASE_OBJ_PATH + 'path0/PythonObj')
+ obj1 = bus.get_object(SERVICE_PREFIX + '.PythonService1',
+ BASE_OBJ_PATH + 'path1/PythonObj')
+ echo0= dbus.Interface(obj0,
+ dbus_interface=IFACE_PREFIX + '.Echo')
+ echo1= dbus.Interface(obj0,
+ dbus_interface=IFACE_PREFIX + '.Echo')
+
+ print "Invoking Echo methods...."
+ print(echo0.Echo("hello"))
+ print(echo1.Echo("there"))
+
+ bus.add_signal_receiver(signal_callback, interface_keyword = 'intf',
+ path_keyword = 'path',
+ member_keyword = 'member')
+
+ print "Waiting for signals... (call a sample method to see something here)"
+ print "Press Ctrl^C to quit"
+ mainloop = gobject.MainLoop()
+
+ mainloop.run()
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
index 7fee0b1..c140c9b 100644
--- 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
@@ -8,3 +8,11 @@
"
inherit obmc-phosphor-pydbus-service
+
+client = "pyclient-sample"
+SRC_URI += "file://${client}.py"
+
+do_install_append() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/${client}.py ${D}${bindir}/${client}
+}