Added fake service for x86 scratchbox
authorjaviplx <javiplx@gmail.com>
Fri, 3 Dec 2010 22:34:49 +0000 (22:34 +0000)
committerjaviplx <javiplx@gmail.com>
Fri, 3 Dec 2010 22:34:49 +0000 (22:34 +0000)
git-svn-id: file:///svnroot/wifihood/trunk@74 c51dfc6a-5949-4919-9c8e-f207a149c383

wifiscand/wifiscand.py [new file with mode: 0755]

diff --git a/wifiscand/wifiscand.py b/wifiscand/wifiscand.py
new file mode 100755 (executable)
index 0000000..fe754e5
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/python2.5
+
+import osso
+import gtk
+
+introspection = """<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\
+         \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n\
+<node name=\"/org/javiplx/wifiscan\">\n\
+  <interface name=\"org.javiplx.wifiscan\">\n\
+    <method name=\"wakeup\">\n\
+      <arg name=\"result\" type=\"s\" direction=\"out\" />\n\
+    </method>\n\
+    <method name=\"start\">\n\
+      <arg name=\"result\" type=\"s\" direction=\"out\" />\n\
+    </method>\n\
+    <method name=\"scan\">\n\
+      <arg name=\"result\" type=\"s\" direction=\"out\" />\n\
+    </method>\n\
+    <method name=\"stop\">\n\
+      <arg name=\"result\" type=\"s\" direction=\"out\" />\n\
+    </method>\n\
+  </interface>\n\
+</node>\n"""
+
+__version__ = "1.1"
+
+name = "wifiscan"
+service = "org.javiplx." + name
+object = "/org/javiplx/" + name
+iface = "org.javiplx." + name
+
+def dbus_req_handler(interface, method, arguments, user_data):
+    if method == "Introspect" :
+        return introspection
+    if method == "wakeup" :
+        return "WifiScand ready"
+    if method == "start" :
+        return "Interface initialized"
+    if method == "stop" :
+        gtk.main_quit()
+        return
+    if method == "scan" :
+        print "return 00:1C:C0:CB:1A:72:-80"
+        return "00:1C:C0:CB:1A:72:-80"
+    return "Unknown method"
+
+osso_c = osso.Context(name, __version__, False)
+
+osso_rpc = osso.Rpc(osso_c)
+osso_rpc.set_rpc_callback(service, object, iface, dbus_req_handler, ( "wlan0" , osso_c ) )
+gtk.main()
+