added ObjectAdded signal
diff --git a/bin/Openbmc.py b/bin/Openbmc.py
index da4ecff..b370d8b 100755
--- a/bin/Openbmc.py
+++ b/bin/Openbmc.py
@@ -1,5 +1,4 @@
import dbus
-import xml.etree.ElementTree as ET
BUS_PREFIX = 'org.openbmc'
OBJ_PREFIX = "/org/openbmc"
@@ -11,24 +10,6 @@
['NOT_SET','NORMAL','LOWER_CRITICAL','LOWER_WARNING','UPPER_WARNING','UPPER_CRITICAL'],
}
-DBUS_TO_BASE_TYPES = {
- 'dbus.Byte' : 'int',
- 'dbus.Double' : 'float',
- 'dbus.Int32' : 'int',
- 'dbus.UInt32' : 'long',
- 'dbus.String' : 'str',
- 'dbus.UInt64' : 'long',
- 'dbus.Boolean' : 'bool',
-}
-
-BASE_TO_DBUS_TYPES = {
- 'int' : 'dbus.Int32',
- 'float' : 'dbus.Double',
- 'str' : 'dbus.String',
- 'long' : 'dbus.Int64',
- 'bool' : 'dbus.Boolean'
-}
-
def getSystemName():
#use filename as system name, strip off path and ext
parts = __file__.replace('.pyc','').replace('.py','').split('/')
@@ -51,39 +32,6 @@
return dbus.Interface(obj,bus_name)
-def get_objs(bus,bus_name,path,objects):
- tmp_path = path
- if (path == ""):
- tmp_path="/"
-
- obj = bus.get_object(bus_name,tmp_path)
- introspect_iface = dbus.Interface(obj,"org.freedesktop.DBus.Introspectable")
- tree = ET.ElementTree(ET.fromstring(introspect_iface.Introspect()))
- root = tree.getroot()
- parent = True
- for node in root.iter('node'):
- for intf in node.iter('interface'):
- intf_name = intf.attrib['name']
- parts=path.split('/')
- instance = parts[len(parts)-1]
- if (objects.has_key(instance) == False):
- objects[instance] = {}
- objects[instance]['PATH'] = path
- objects[instance]['INIT'] = []
- for method in intf.iter('method'):
- if (method.attrib['name'] == "init"):
- objects[instance]['INIT'].append(intf_name)
-
- if (node.attrib.has_key('name') == True):
- node_name = node.attrib['name']
- if (parent == False):
- get_objs(bus,bus_name,path+"/"+node_name,objects)
- else:
- if (node_name != "" and node_name != path):
- get_objs(bus,bus_name,node_name,objects)
-
- parent = False
-
class DbusProperties(dbus.service.Object):
def __init__(self):
dbus.service.Object.__init__(self)
@@ -153,42 +101,10 @@
invalidated_properties):
pass
+ @dbus.service.signal("org.openbmc.Object.ObjectMapper",
+ signature='ss')
+ def ObjectAdded(self,object_path,interface_name):
+ pass
-class DbusVariable:
- def __init__(self,name,value):
- self.name = str(name)
- self.dbusType = str(type(value)).split("'")[1]
- self.variant_level = 2
- self.value = None
- if (BASE_TO_DBUS_TYPES.has_key(self.dbusType) == False):
- self.variant_level = value.variant_level
- try:
- self.value = eval(DBUS_TO_BASE_TYPES[self.dbusType]+"(value)")
- except:
- raise Exception("Unknown dbus type: "+self.dbusType)
- else:
- self.dbusType = BASE_TO_DBUS_TYPES[self.dbusType]
- self.value = value
- def setValue(self,value):
- try:
- self.value = eval(DBUS_TO_BASE_TYPES[self.dbusType]+"(value)")
- except:
- raise Exception("Unknown dbus type: "+self.dbusType)
-
- def setVariant(self,variant_level):
- self.variant_level = variant_level
-
- def getName(self):
- return self.name
-
- def getValue(self):
- e = self.dbusType+"(self.value, variant_level="+str(self.variant_level)+")"
- return eval(e)
-
- def getBaseValue(self):
- return self.value
-
- def __str__(self):
- return self.dbusType+":"+str(self.value)