[PATCH phosphor-objmgr 7/8] Add ObjectMapper binding

OpenBMC Patches patches at stwcx.xyz
Thu Nov 5 03:33:33 AEDT 2015


From: Brad Bishop <bradleyb at us.ibm.com>

Wrapper that allows default parameters to be used with the Mapper
DBUS interface.
---
 OpenBMCMapper.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/OpenBMCMapper.py b/OpenBMCMapper.py
index fde385e..3e7a745 100644
--- a/OpenBMCMapper.py
+++ b/OpenBMCMapper.py
@@ -336,3 +336,19 @@ class PathTree:
 		if not self.root:
 			return {}.iteritems()
 		return PathTreeItemIterator(self, subtree, depth)
+
+class Mapper:
+	def __init__(self, bus):
+		self.bus = bus
+		obj = bus.get_object(MAPPER_NAME, MAPPER_PATH)
+		self.iface = dbus.Interface(
+				obj, dbus_interface = MAPPER_IFACE)
+
+	def get_object(self, path):
+		return self.iface.GetObject(path)
+
+	def get_subtree_paths(self, path = '/', depth = 0):
+		return self.iface.GetSubTreePaths(path, depth)
+
+	def get_subtree(self, path = '/', depth = 0):
+		return self.iface.GetSubTree(path, depth)
-- 
2.6.0




More information about the openbmc mailing list