public abstract async void get_country_code(out string param0, out string param1) throws DBus.Error;
}
+[DBus (name = "org.freesmartphone.GSM.Call")]
+public interface FSO_GSM_Call : GLib.Object {
+ public abstract async void activate(int index) throws DBus.Error;
+ public abstract async void emergency(string number) throws DBus.Error;
+ public abstract async void hold_active() throws DBus.Error;
+ public abstract async void release_held() throws DBus.Error;
+ public abstract async void send_dtmf(string tones) throws DBus.Error;
+ public abstract async void release_all() throws DBus.Error;
+ public abstract async int initiate(string number, string type_) throws DBus.Error;
+ // public abstract async CallParam0Struct[] list_calls() throws DBus.Error;
+ public abstract async void transfer(string number) throws DBus.Error;
+ public abstract async void release(int index) throws DBus.Error;
+ public signal void call_status(int index, string status, GLib.HashTable<string, GLib.Value?> properties);
+ public abstract async void activate_conference(int index) throws DBus.Error;
+}
+
public class GSM: zavai.ScriptMonitorService
{
protected dynamic DBus.Object dbus;
public FSO_GSM_Device device;
public FSO_GSM_Network network;
public FSO_GSM_SIM sim;
- public dynamic DBus.Object call;
+ public FSO_GSM_Call call;
+
+ protected class CallInfo
+ {
+ public int gsm_id;
+ public uint log_id;
+ }
+ protected List<CallInfo> calls;
public string info_provider;
public int info_signal_strength;
{
Object(name: "gsm");
+ calls = new List<CallInfo>();
+
device = (FSO_GSM_Device)zavai.registry.sbus.get_object(
"org.freesmartphone.ogsmd",
"/org/freesmartphone/GSM/Device",
"org.freesmartphone.ogsmd",
"/org/freesmartphone/GSM/Device",
"org.freesmartphone.GSM.SIM");
- call = zavai.registry.sbus.get_object(
+ call = (FSO_GSM_Call)zavai.registry.sbus.get_object(
"org.freesmartphone.ogsmd",
"/org/freesmartphone/GSM/Device",
"org.freesmartphone.GSM.Call");
stderr.printf("SIGNAL STRENGTH %d\n", strength);
acquire_new_signal_strength(strength);
};
+
+ call.call_status += on_call_status;
}
/// Request GPS resource
acquire_new_status(yield network.get_status());
acquire_new_signal_strength(yield network.get_signal_strength());
}
+
+ protected CallInfo? lookup_call(int gsm_id)
+ {
+ for (weak List<CallInfo> i = calls; i != null; i = i.next)
+ if (i.data.gsm_id == gsm_id)
+ return i.data;
+ return null;
+ }
+
+ public void on_call_status(int index, string status, HashTable<string, Value?> properties)
+ {
+ stderr.printf("CALL STATUS %d %s\n", index, status);
+ dump_table(properties);
+
+ CallInfo? info = lookup_call(index);
+ if (info == null)
+ {
+ Value? v = properties.lookup("peer");
+ string title;
+ if (v != null)
+ title = "%s call from %s".printf(status, v.get_string());
+ else
+ title = "%s call".printf(status);
+
+ info = new CallInfo();
+ info.gsm_id = index;
+ info.log_id = zavai.log.log.start("call", title);
+ calls.append(info);
+ }
+
+ // Log a summary of all info
+ string call_info = "status: %s\n".printf(status);
+ properties.for_each((pk, pv) => {
+ string k = (string)pk;
+ Value? v = (Value?)pv;
+ call_info = call_info + "%s: %s\n".printf(k, v == null ? "(null)" : v.strdup_contents());
+ });
+ zavai.log.log.add(info.log_id, call_info);
+
+ // TODO: remove entry when it's the last possible status
+
+ /*
+ dbg("cbCallStatus %d, %s, %s" % (id, status, formatDict(properties)))
+ self.status = status
+ if status == "incoming":
+ if "peer" in properties and properties["peer"] == "+358942832031":
+ self.gsm_call_iface.ReleaseAll()
+ os.system("kapula-debug-call-handler &")
+ else:
+ os.system("alsactl restore -f /etc/alsa-scenarios/stereoout-maxvolume.state")
+ os.system("vibrator-start")
+ os.system("ringtone-start")
+ os.system("ledctrl --on-time 400 --off-time 200 gta02-aux:red");
+ if status == "release":
+ os.system("ringtone-stop")
+ os.system("vibrator-stop")
+ os.system("ledctrl --off gta02-aux:red");
+ */
+ }
}
public class GPRS: zavai.Service