Simplified the test script
authorEnrico Zini <enrico@enricozini.org>
Fri, 26 Mar 2010 16:45:43 +0000 (16:45 +0000)
committerEnrico Zini <enrico@enricozini.org>
Fri, 26 Mar 2010 16:45:43 +0000 (16:45 +0000)
test/test-gsm-receive.vala

index af6ce6f7e123b1d552a59c41c1fb8d53c0d8f9ea..2d8a9632afadfe07ae24856d0a6515367a0b7636 100644 (file)
 
 using GLib;
 
 
 using GLib;
 
+public DBus.Connection sbus;
+
 //string VERSION = "0.1";
 
 //string VERSION = "0.1";
 
-public class GSMReceive: Object, zavai.Resource
+public class GSMReceive: Object //, zavai.Resource
 {
 {
+    public dynamic DBus.Object device;
     public dynamic DBus.Object network;
     public dynamic DBus.Object call;
 
     public dynamic DBus.Object network;
     public dynamic DBus.Object call;
 
@@ -31,16 +34,29 @@ public class GSMReceive: Object, zavai.Resource
     {
         //zavai.gsm.gsm.request("GSMReceive");
 
     {
         //zavai.gsm.gsm.request("GSMReceive");
 
-        network = zavai.registry.sbus.get_object(
+        device = sbus.get_object(
+                   "org.freesmartphone.ogsmd",
+                   "/org/freesmartphone/GSM/Device",
+                   "org.freesmartphone.GSM.Device");
+
+        network = sbus.get_object(
             "org.freesmartphone.ogsmd", 
             "/org/freesmartphone/GSM/Device",
             "org.freesmartphone.GSM.Network");
 
             "org.freesmartphone.ogsmd", 
             "/org/freesmartphone/GSM/Device",
             "org.freesmartphone.GSM.Network");
 
-        call = zavai.registry.sbus.get_object(
+        call = sbus.get_object(
                 "org.freesmartphone.ogsmd",
                 "/org/freesmartphone/GSM/Device",
                 "org.freesmartphone.GSM.Call");
 
                 "org.freesmartphone.ogsmd",
                 "/org/freesmartphone/GSM/Device",
                 "org.freesmartphone.GSM.Call");
 
+       stderr.printf("Registering\n");
+       network.Register();
+       stderr.printf("Registered\n");
+
+       stderr.printf("Antenna is %s\n", device.GetAntennaPower() ? "on" : "off");
+       stderr.printf("Signal strength: %d\n", network.GetSignalStrength());
+       stderr.printf("Calling identification: %s\n", network.GetCallingIdentification());
+
         network.Status += on_network_Status;
         network.SignalStrength += on_network_SignalStrength;
         call.CallStatus += on_call_Status;
         network.Status += on_network_Status;
         network.SignalStrength += on_network_SignalStrength;
         call.CallStatus += on_call_Status;
@@ -381,14 +397,15 @@ public class GSMReceive: Object, zavai.Resource
 
 static int main (string[] args) {
        Gtk.init (ref args);
 
 static int main (string[] args) {
        Gtk.init (ref args);
-    Gst.init (ref args);
+    // Gst.init (ref args);
 
        // Set up zavai
 
        // Set up zavai
+       sbus = DBus.Bus.get(DBus.BusType.SYSTEM);
 
     // Core infrastructure
 
     // Core infrastructure
-       zavai.config = new zavai.Config();
-       zavai.config.argv0 = args[0];
-       //zavai.registry = new zavai.Registry();
+//     zavai.config = new zavai.Config();
+//     zavai.config.argv0 = args[0];
+//     zavai.registry = new zavai.Registry();
 
     // Additional infrastructure
        //zavai.gsm.init();
 
     // Additional infrastructure
        //zavai.gsm.init();
@@ -400,7 +417,7 @@ static int main (string[] args) {
        Gtk.main();
 
        // zavai.info("Shutting down")
        Gtk.main();
 
        // zavai.info("Shutting down")
-       zavai.registry.shutdown();
+       // zavai.registry.shutdown();
 
        return 0;
 }
 
        return 0;
 }