2 * gsm - gsm resource for zavai
4 * Copyright (C) 2009 Enrico Zini <enrico@enricozini.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 public class GSM: zavai.Service
28 public dynamic DBus.Object device;
32 Object(name: "gsm.gsm");
34 device = zavai.registry.sbus.get_object(
35 "org.freesmartphone.ogpsd",
36 "/org/freesmartphone/GSM/Device",
37 "org.freesmartphone.Resource");
40 /// Request GPS resource
41 public override void start()
46 zavai.log.info("Started GSM");
48 } catch (GLib.Error e) {
49 zavai.log.error(e.message);
54 // Release usage of GPS
55 public override void stop()
60 zavai.log.info("Stopped GSM");
62 } catch (GLib.Error e) {
63 zavai.log.error(e.message);
69 public class GPRS: zavai.Service
71 public dynamic DBus.Object device;
75 Object(name: "gsm.gprs");
77 device = zavai.registry.sbus.get_object(
78 "org.freesmartphone.ogsmd",
79 "/org/freesmartphone/GSM/Device",
80 "org.freesmartphone.GSM.PDP");
83 /// Request GPS resource
84 public override void start()
89 device.ActivateContext(
90 zavai.config.gprs_apn,
91 zavai.config.gprs_user,
92 zavai.config.gprs_pass);
93 zavai.log.info("Started GPRS");
95 } catch (GLib.Error e) {
96 zavai.log.error(e.message);
101 // Release usage of GPS
102 public override void stop()
104 if (!started) return;
107 device.DeactivateContext();
108 zavai.log.info("Stopped GPRS");
110 } catch (GLib.Error e) {
111 zavai.log.error(e.message);
117 public zavai.gsm.GSM gsm = null;
118 public zavai.gsm.GPRS gprs = null;
125 zavai.registry.register_service(gsm);
126 zavai.registry.register_service(gprs);