Reunified sources, as there seemed to be only disadvantages in compilation time
[gregoa/zavai.git] / test / test-gsm-receive.vala
index 2d8a9632afadfe07ae24856d0a6515367a0b7636..79539627662e906a00d162c704a2e03a47920657 100644 (file)
@@ -49,13 +49,12 @@ public class GSMReceive: Object //, zavai.Resource
                 "/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());
+       GLib.HashTable<string, GLib.Value?> status = network.GetStatus();
+       stderr.printf("Network status:\n");
+       dump_table(status);
 
         network.Status += on_network_Status;
         network.SignalStrength += on_network_SignalStrength;
@@ -67,21 +66,32 @@ public class GSMReceive: Object //, zavai.Resource
         //zavai.gsm.gsm.release("GSMReceive");
     }
 
-    public void on_network_SignalStrength(int strength)
+    protected void dump_table(HashTable<string, Value?> vals)
+    {
+       vals.for_each((pk, pv) => {
+               string k = (string)pk;
+               Value? v = (Value?)pv;
+               stderr.printf("K: %s V: %s\n", k, v == null ? "(null)" : v.strdup_contents());
+       });
+    }
+
+    public void on_network_SignalStrength(DBus.Object sender, int strength)
     {
         stderr.printf("SIGNAL STRENGTH %d\n", strength);
     }
 
-    public void on_network_Status(GLib.HashTable<string, GLib.Value?> status)
+    public void on_network_Status(DBus.Object sender, HashTable<string, Value?> status)
     {
         stderr.printf("NETWORK STATUS\n");
+       dump_table(status);
 
         // dbg("cbNetworkStatus %s" % formatDict(status))
     }
 
-    public void on_call_Status(int index, string status, GLib.HashTable<string, GLib.Value?> properties)
+    public void on_call_Status(DBus.Object sender, int index, string status, HashTable<string, Value?> properties)
     {
         stderr.printf("CALL STATUS %d %s\n", index, status);
+       dump_table(properties);
         /*
         dbg("cbCallStatus %d, %s, %s" % (id, status, formatDict(properties)))
         self.status = status