Move the osso wrapper out of the wifimap module
[wifihood] / osso.py
diff --git a/osso.py b/osso.py
new file mode 100644 (file)
index 0000000..21bd5da
--- /dev/null
+++ b/osso.py
@@ -0,0 +1,36 @@
+
+import dbus
+
+class Context :
+
+    def __init__ ( self , name , version , flag ) :
+        self.connection = dbus.SessionBus()
+        self.name = name
+        self.version = version
+
+    def get_connection ( self ) :
+        return self.connection
+
+class Rpc :
+
+    def __init__ ( self , context ) :
+        self.context = context
+
+    def rpc_run ( self , object_name , object_path , object_iface , method , wait_reply=False ) :
+        connection = self.context.get_connection()
+        proxy = connection.get_object( object_name , object_path )
+        iface = dbus.Interface( proxy , object_iface )
+        iface = dbus.Interface( proxy , dbus_interface=object_iface )
+        callable = iface.get_dbus_method( method )
+        return callable()
+
+
+class Reporter :
+    def __init__ ( self , context ) :
+        self.context = context
+    def system_note_infoprint( self , message ) :
+        print "MESSAGE : %s" % message
+
+def SystemNote ( context ) :
+    return Reporter()
+