Added introspection data and methods
authorjaviplx <javiplx@gmail.com>
Fri, 8 Oct 2010 14:09:54 +0000 (14:09 +0000)
committerjaviplx <javiplx@gmail.com>
Fri, 8 Oct 2010 14:09:54 +0000 (14:09 +0000)
git-svn-id: file:///svnroot/wifihood/trunk@21 c51dfc6a-5949-4919-9c8e-f207a149c383

wifiscand/org.javiplx.wifiscan.xml [new file with mode: 0644]
wifiscand/wifiscand.c

diff --git a/wifiscand/org.javiplx.wifiscan.xml b/wifiscand/org.javiplx.wifiscan.xml
new file mode 100644 (file)
index 0000000..d524f76
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+         "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/org/javiplx/wifiscan">
+  <interface name="org.javiplx.wifiscan">
+    <method name="wakeup">
+      <arg name="result" type="s" direction="out" />
+    </method>
+    <method name="start">
+      <arg name="result" type="s" direction="out" />
+    </method>
+    <method name="scan">
+      <arg name="result" type="s" direction="out" />
+    </method>
+    <method name="stop">
+      <arg name="result" type="s" direction="out" />
+    </method>
+  </interface>
+</node>
index 7351306..f94bee5 100644 (file)
@@ -7,6 +7,25 @@
 #include <glib.h>
 #include <dbus/dbus.h>
 
+#define WIFISCAN_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"
+
 #define OSSO_OK 0
 #define OSSO_ERROR 1
 
@@ -246,6 +265,12 @@ gint dbus_req_handler(const gchar * interface, const gchar * method,
     retval->value.s = (gchar*) malloc( sizeof(gchar *) );
     retval->value.s[0] = '\0';
 
+    if ( strcmp(method,"Introspect")==0 ) {
+        retval->value.s = (gchar *) realloc(retval->value.s,630*sizeof(gchar *));
+        snprintf(retval->value.s,strlen(WIFISCAN_INTROSPECTION),WIFISCAN_INTROSPECTION);
+        return OSSO_OK;
+    }
+
     if ( strcmp(method,"wakeup")==0 ) {
         retval->value.s = (gchar *) realloc(retval->value.s,16*sizeof(gchar *));
         snprintf(retval->value.s,16,"WifiScand ready");