3 * oFono - Open Source Telephony
5 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #define OFONO_API_SUBJECT_TO_CHANGE
33 #include <ofono/modem.h>
34 #include <ofono/gprs-provision.h>
35 #include <ofono/types.h>
36 #include <ofono/plugin.h>
37 #include <ofono/log.h>
39 static int example_provision_get_settings(const char *mcc, const char *mnc,
41 struct ofono_gprs_provision_data **settings,
44 ofono_debug("Provisioning...");
48 ofono_debug("Finding settings for MCC %s, MNC %s, SPN '%s'",
51 if (strcmp(mcc, "246") != 0 || strcmp(mnc, "81") != 0 ||
52 g_strcmp0(spn, "oFono") != 0)
55 ofono_debug("Creating example settings for phonesim");
57 *settings = g_try_new0(struct ofono_gprs_provision_data, 2);
58 if (*settings == NULL)
63 /* Internet context settings */
64 (*settings)[0].proto = OFONO_GPRS_PROTO_IP;
65 (*settings)[0].type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
66 (*settings)[0].name = g_strdup("Phonesim Internet");
67 (*settings)[0].apn = g_strdup("internetapn");
69 /* MMS context settings */
70 (*settings)[1].proto = OFONO_GPRS_PROTO_IP;
71 (*settings)[1].type = OFONO_GPRS_CONTEXT_TYPE_MMS;
72 (*settings)[1].name = g_strdup("Phonesim MMS");
73 (*settings)[1].apn = g_strdup("mmsapn");
74 (*settings)[1].username = g_strdup("mmsuser");
75 (*settings)[1].password = g_strdup("mmspass");
76 (*settings)[1].message_proxy = g_strdup("10.11.12.13:8080");
77 (*settings)[1].message_center = g_strdup("http://mms.example.com:8000");
82 static struct ofono_gprs_provision_driver example_driver = {
83 .name = "Example GPRS context provisioning",
84 .priority = OFONO_PLUGIN_PRIORITY_LOW,
85 .get_settings = example_provision_get_settings,
88 static int example_provision_init(void)
90 return ofono_gprs_provision_driver_register(&example_driver);
93 static void example_provision_exit(void)
95 ofono_gprs_provision_driver_unregister(&example_driver);
98 OFONO_PLUGIN_DEFINE(example_provision, "Example Provisioning Plugin",
99 VERSION, OFONO_PLUGIN_PRIORITY_DEFAULT,
100 example_provision_init,
101 example_provision_exit)