* Re: [PATCH_v4 1/6] cdmamodem: Define CDMA Network Registration atom.
2011-08-02 12:45 ` [PATCH_v4 1/6] cdmamodem: Define " Bertrand Aygon
@ 2011-07-31 10:12 ` Denis Kenzior
0 siblings, 0 replies; 12+ messages in thread
From: Denis Kenzior @ 2011-07-31 10:12 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 233 bytes --]
Hi Bertrand,
On 08/02/2011 07:45 AM, Bertrand Aygon wrote:
> ---
> include/dbus.h | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
Patch has been applied with a modified commit message.
Thanks,
-Denis
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH_v4 2/6] cdmamodem: Create org.ofono.cdma.NetworkRegistration interface.
2011-08-02 12:45 ` [PATCH_v4 2/6] cdmamodem: Create org.ofono.cdma.NetworkRegistration interface Bertrand Aygon
@ 2011-07-31 10:14 ` Denis Kenzior
0 siblings, 0 replies; 12+ messages in thread
From: Denis Kenzior @ 2011-07-31 10:14 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 414 bytes --]
Hi Bertrand,
On 08/02/2011 07:45 AM, Bertrand Aygon wrote:
> ---
> Makefile.am | 6 +-
> include/cdma-netreg.h | 58 +++++++++++++++
> src/cdma-netreg.c | 188 +++++++++++++++++++++++++++++++++++++++++++++++++
> src/ofono.h | 2 +
So we do actually want include and src changes to be in separate
patches, so please break this patch up accordingly.
Regards,
-Denis
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH_v4 4/6] speedupcdma: register to CDMA network registration atom.
2011-08-02 12:45 ` [PATCH_v4 4/6] speedupcdma: register to " Bertrand Aygon
@ 2011-07-31 10:15 ` Denis Kenzior
0 siblings, 0 replies; 12+ messages in thread
From: Denis Kenzior @ 2011-07-31 10:15 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
Hi Bertrand,
On 08/02/2011 07:45 AM, Bertrand Aygon wrote:
> ---
> plugins/speedupcdma.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
This patch is really out of order logically, it belongs as the last
patch in the series.
Regards,
-Denis
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH_v4 5/6] cdmamodem: add status info to cdma network atom.
2011-08-02 12:45 ` [PATCH_v4 5/6] cdmamodem: add status info to cdma network atom Bertrand Aygon
@ 2011-07-31 10:26 ` Denis Kenzior
0 siblings, 0 replies; 12+ messages in thread
From: Denis Kenzior @ 2011-07-31 10:26 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5590 bytes --]
Hi Bertrand,
On 08/02/2011 07:45 AM, Bertrand Aygon wrote:
> ---
> include/cdma-netreg.h | 11 +++++++++
> src/cdma-netreg.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
Two separate patches please, and the API changes should probably be
merged into the earlier include/cdma-netreg patch.
> 2 files changed, 67 insertions(+), 0 deletions(-)
>
> diff --git a/include/cdma-netreg.h b/include/cdma-netreg.h
> index 0da7cbb..b18d500 100644
> --- a/include/cdma-netreg.h
> +++ b/include/cdma-netreg.h
> @@ -28,6 +28,12 @@ extern "C" {
>
> #include <ofono/types.h>
>
> +enum cdma_network_registration_status {
> + CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED = 0,
> + CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED = 1,
> + CDMA_NETWORK_REGISTRATION_STATUS_UNKNOWN = 2,
Is the unknown status even used by the hardware? In general oFono tries
not to introduce such 'unknown' states whenever possible.
Regardless, please keep the API definition and API implementation
consistent. Right now doc/cdma-network-api.txt does not have a value
for 'unknown'. So you must either send an RFC to update the
cdma-network-api.txt first, or remove the reference to unknown. Using
not registered as the default seems just fine to me right now...
> +};
> +
> struct ofono_cdma_netreg;
>
> struct ofono_cdma_netreg_driver {
> @@ -37,6 +43,9 @@ struct ofono_cdma_netreg_driver {
> void (*remove)(struct ofono_cdma_netreg *cdma_netreg);
> };
>
> +void ofono_cdma_netreg_status_notify(struct ofono_cdma_netreg *netreg,
> + int status);
Since you went to the trouble of defining an enum for status
information, please use that here instead of 'int'.
> +
> int ofono_cdma_netreg_driver_register(const struct ofono_cdma_netreg_driver *d);
> void ofono_cdma_netreg_driver_unregister(const struct ofono_cdma_netreg_driver *d);
>
> @@ -51,6 +60,8 @@ void ofono_cdma_netreg_remove(struct ofono_cdma_netreg *cdma_netreg);
> void ofono_cdma_netreg_set_data(struct ofono_cdma_netreg *cdma_netreg, void *data);
> void *ofono_cdma_netreg_get_data(struct ofono_cdma_netreg *cdma_netreg);
>
> +int ofono_cdma_netreg_get_status(struct ofono_cdma_netreg *cdma_netreg);
> +
Do you actually have immediate need for this function? If not, then
please remove it. It is better to not to define an API than dealing
with the repercussions of changing it later on.
> #ifdef __cplusplus
> }
> #endif
> diff --git a/src/cdma-netreg.c b/src/cdma-netreg.c
> index b1cbd53..0d7dc03 100644
> --- a/src/cdma-netreg.c
> +++ b/src/cdma-netreg.c
> @@ -32,18 +32,36 @@
> static GSList *g_drivers;
>
> struct ofono_cdma_netreg {
> + int status;
Again, please use an enum here
> const struct ofono_cdma_netreg_driver *driver;
> void *driver_data;
> struct ofono_atom *atom;
> };
>
> +static const char *cdma_registration_status_to_string(int status)
> +{
> + switch (status) {
> + case CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED:
> + return "unregistered";
> + case CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED:
> + return "registered";
> + case CDMA_NETWORK_REGISTRATION_STATUS_UNKNOWN:
> + return "unknown";
> + }
> +
> + return "";
> +}
> +
> static DBusMessage *network_get_properties(DBusConnection *conn,
> DBusMessage *msg, void *data)
> {
> + struct ofono_cdma_netreg *cdma_netreg = data;
> DBusMessage *reply;
> DBusMessageIter iter;
> DBusMessageIter dict;
>
> + const char *status = cdma_registration_status_to_string(cdma_netreg->status);
> +
> reply = dbus_message_new_method_return(msg);
> if (reply == NULL)
> return NULL;
> @@ -54,6 +72,8 @@ static DBusMessage *network_get_properties(DBusConnection *conn,
> OFONO_PROPERTIES_ARRAY_SIGNATURE,
> &dict);
>
> + ofono_dbus_dict_append(&dict, "Status", DBUS_TYPE_STRING, &status);
> +
> dbus_message_iter_close_container(&iter, &dict);
>
> return reply;
> @@ -68,6 +88,40 @@ static GDBusSignalTable cdma_netreg_manager_signals[] = {
> { }
> };
>
> +
> +static void set_registration_status(struct ofono_cdma_netreg *cdma_netreg,
> + int status)
> +{
> + const char *str_status = cdma_registration_status_to_string(status);
> + const char *path = __ofono_atom_get_path(cdma_netreg->atom);
> + DBusConnection *conn = ofono_dbus_get_connection();
> +
> + cdma_netreg->status = status;
> +
> + ofono_dbus_signal_property_changed(conn, path,
> + OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
> + "Status", DBUS_TYPE_STRING,
> + &str_status);
> +}
> +
> +void ofono_cdma_netreg_status_notify(struct ofono_cdma_netreg *cdma_netreg,
> + int status)
> +{
> + if (cdma_netreg == NULL)
> + return;
> +
> + if (cdma_netreg->status != status)
> + set_registration_status(cdma_netreg, status);
> +}
> +
> +int ofono_cdma_netreg_get_status(struct ofono_cdma_netreg *cdma_netreg)
> +{
> + if (cdma_netreg == NULL)
> + return -1;
> +
> + return cdma_netreg->status;
> +}
> +
> int ofono_cdma_netreg_driver_register(const struct ofono_cdma_netreg_driver *d)
> {
> DBG("driver: %p, name: %s", d, d->name);
> @@ -130,6 +184,8 @@ struct ofono_cdma_netreg *ofono_cdma_netreg_create(struct ofono_modem *modem,
> if (cdma_netreg == NULL)
> return NULL;
>
> + cdma_netreg->status = CDMA_NETWORK_REGISTRATION_STATUS_UNKNOWN;
> +
> cdma_netreg->atom = __ofono_modem_add_atom(modem,
> OFONO_ATOM_TYPE_CDMA_NETREG,
> cdma_netreg_remove, cdma_netreg);
Regards,
-Denis
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH_v4 6/6] cdmamodem: register for network status notification.
2011-08-02 12:45 ` [PATCH_v4 6/6] cdmamodem: register for network status notification Bertrand Aygon
@ 2011-07-31 10:34 ` Denis Kenzior
0 siblings, 0 replies; 12+ messages in thread
From: Denis Kenzior @ 2011-07-31 10:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3249 bytes --]
Hi Bertrand,
On 08/02/2011 07:45 AM, Bertrand Aygon wrote:
> ---
> drivers/cdmamodem/network-registration.c | 75 ++++++++++++++++++++++++++++++
> 1 files changed, 75 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/cdmamodem/network-registration.c b/drivers/cdmamodem/network-registration.c
> index 92dad56..665f940 100644
> --- a/drivers/cdmamodem/network-registration.c
> +++ b/drivers/cdmamodem/network-registration.c
> @@ -34,10 +34,79 @@
>
> #include "cdmamodem.h"
>
> +static const char *sysinfo_prefix[] = { "^SYSINFO:", NULL };
> +
> struct netreg_data {
> GAtChat *chat;
> };
>
> +static void sysinfo_cb(gboolean ok, GAtResult *result, gpointer user_data)
> +{
> + struct ofono_cdma_netreg *netreg = user_data;
> + gint srv_status;
> + gint srv_domain;
> + gint roaming_status;
> + int status;
> + GAtResultIter iter;
> +
> + if (!ok)
> + return;
> +
> + g_at_result_iter_init(&iter, result);
> +
> + if (!g_at_result_iter_next(&iter, "^SYSINFO:"))
> + return;
> +
> + if (!g_at_result_iter_next_number(&iter, &srv_status))
> + return;
> +
> + if (!g_at_result_iter_next_number(&iter, &srv_domain))
> + return;
> +
> + if (!g_at_result_iter_next_number(&iter, &roaming_status))
> + return;
> +
> + DBG("%d, %d, %d", srv_status, srv_domain, roaming_status);
> +
> + switch (srv_status) {
> + case 0: /* No service */
> + case 4: /* Not registered */
> + status = CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
> + break;
> + case 1: /* Restricted service */
> + case 2: /* Service valid */
> + case 3: /* Restricted region service */
> + status = CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED;
> + break;
> + default:
> + status = CDMA_NETWORK_REGISTRATION_STATUS_UNKNOWN;
> + break;
> + }
> +
> + switch (srv_domain) {
> + case 0: /* No service */
> + status = CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
> + break;
> + case 1: /* Only CS */
> + case 2: /* Only PS */
> + case 3: /* CS + PS */
> + case 4: /* CS registered, PS in searching state */
> + break;
> + }
> +
> + ofono_cdma_netreg_status_notify(netreg, status);
> +}
> +
> +
Why the double empty line?
> +static void mode_notify(GAtResult *result, gpointer user_data)
> +{
> + struct ofono_cdma_netreg *netreg = user_data;
> + struct netreg_data *nd = ofono_cdma_netreg_get_data(netreg);
> +
> + g_at_chat_send(nd->chat, "AT^SYSINFO", sysinfo_prefix, sysinfo_cb,
> + netreg, NULL);
> +}
> +
> static int cdma_netreg_probe(struct ofono_cdma_netreg *netreg,
> unsigned int vendor, void *data)
> {
> @@ -49,8 +118,14 @@ static int cdma_netreg_probe(struct ofono_cdma_netreg *netreg,
> nd->chat = g_at_chat_clone(chat);
> ofono_cdma_netreg_set_data(netreg, nd);
>
> + g_at_chat_register(nd->chat, "^MODE:",
> + mode_notify, FALSE, netreg, NULL);
> +
I don't see how Huawei specific commands belong inside the cdmamodem
driver without at least a vendor quirk. Personally I would put these
inside huaweicdmamodem driver.
> ofono_cdma_netreg_register(netreg);
>
> + g_at_chat_send(nd->chat, "AT^SYSINFO", sysinfo_prefix, sysinfo_cb,
> + netreg, NULL);
> +
> return 0;
> }
>
Regards,
-Denis
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH_v4 0/6] Create CDMA Network Registration atom
@ 2011-08-02 12:45 Bertrand Aygon
2011-08-02 12:45 ` [PATCH_v4 1/6] cdmamodem: Define " Bertrand Aygon
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: Bertrand Aygon @ 2011-08-02 12:45 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2005 bytes --]
Create an org.ofono.cdma.NetworkRegistration interface.
Create the skeleton for the new interface.
Modify SpeedUpCDMA driver to register this atom.
Add status information to the CDMA Network registration atom.
Register to ^MODE notification to be informed when network change.
Send ^SYSINFO to get network status information.
Bertrand Aygon (6):
cdmamodem: Define CDMA Network Registration atom.
cdmamodem: Create org.ofono.cdma.NetworkRegistration interface.
cdmamodem: Create CDMA network registration atom.
speedupcdma: register to CDMA network registration atom.
cdmamodem: add status info to cdma network atom.
cdmamodem: register for network status notification.
Makefile.am | 9 +-
drivers/cdmamodem/cdmamodem.c | 2 +
drivers/cdmamodem/cdmamodem.h | 2 +
drivers/cdmamodem/network-registration.c | 156 +++++++++++++++++++
include/cdma-netreg.h | 69 +++++++++
include/dbus.h | 2 +
plugins/speedupcdma.c | 3 +
src/cdma-netreg.c | 244 ++++++++++++++++++++++++++++++
src/ofono.h | 2 +
9 files changed, 485 insertions(+), 4 deletions(-)
create mode 100644 drivers/cdmamodem/network-registration.c
create mode 100644 include/cdma-netreg.h
create mode 100644 src/cdma-netreg.c
--
1.7.4.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH_v4 1/6] cdmamodem: Define CDMA Network Registration atom.
2011-08-02 12:45 [PATCH_v4 0/6] Create CDMA Network Registration atom Bertrand Aygon
@ 2011-08-02 12:45 ` Bertrand Aygon
2011-07-31 10:12 ` Denis Kenzior
2011-08-02 12:45 ` [PATCH_v4 2/6] cdmamodem: Create org.ofono.cdma.NetworkRegistration interface Bertrand Aygon
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Bertrand Aygon @ 2011-08-02 12:45 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]
---
include/dbus.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/dbus.h b/include/dbus.h
index 4dd9db5..65bda72 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -63,6 +63,8 @@ extern "C" {
#define OFONO_CDMA_VOICECALL_MANAGER_INTERFACE "org.ofono.cdma.VoiceCallManager"
#define OFONO_CDMA_MESSAGE_MANAGER_INTERFACE "org.ofono.cdma.MessageManager"
#define OFONO_CDMA_CONNECTION_MANAGER_INTERFACE "org.ofono.cdma.ConnectionManager"
+#define OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE \
+ "org.ofono.cdma.NetworkRegistration"
/* Essentially a{sv} */
#define OFONO_PROPERTIES_ARRAY_SIGNATURE DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING \
--
1.7.4.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH_v4 2/6] cdmamodem: Create org.ofono.cdma.NetworkRegistration interface.
2011-08-02 12:45 [PATCH_v4 0/6] Create CDMA Network Registration atom Bertrand Aygon
2011-08-02 12:45 ` [PATCH_v4 1/6] cdmamodem: Define " Bertrand Aygon
@ 2011-08-02 12:45 ` Bertrand Aygon
2011-07-31 10:14 ` Denis Kenzior
2011-08-02 12:45 ` [PATCH_v4 3/6] cdmamodem: Create CDMA network registration atom Bertrand Aygon
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Bertrand Aygon @ 2011-08-02 12:45 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 9764 bytes --]
---
Makefile.am | 6 +-
include/cdma-netreg.h | 58 +++++++++++++++
src/cdma-netreg.c | 188 +++++++++++++++++++++++++++++++++++++++++++++++++
src/ofono.h | 2 +
4 files changed, 251 insertions(+), 3 deletions(-)
create mode 100644 include/cdma-netreg.h
create mode 100644 src/cdma-netreg.c
diff --git a/Makefile.am b/Makefile.am
index cef9892..4a4b1d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,8 +16,8 @@ pkginclude_HEADERS = include/log.h include/plugin.h include/history.h \
include/cdma-sms.h include/sim-auth.h \
include/gprs-provision.h include/emulator.h \
include/location-reporting.h \
- include/cdma-connman.h include/gnss.h \
- include/private-network.h
+ include/cdma-connman.h include/cdma-netreg.h \
+ include/gnss.h include/private-network.h
nodist_pkginclude_HEADERS = include/version.h
@@ -416,7 +416,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \
src/cdma-connman.c src/gnss.c \
src/gnssagent.c src/gnssagent.h \
src/cdma-smsutil.h src/cdma-smsutil.c \
- src/cdma-sms.c src/private-network.c
+ src/cdma-sms.c src/cdma-netreg.c src/private-network.c
src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
diff --git a/include/cdma-netreg.h b/include/cdma-netreg.h
new file mode 100644
index 0000000..0da7cbb
--- /dev/null
+++ b/include/cdma-netreg.h
@@ -0,0 +1,58 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __OFONO_CDMA_NETREG_H
+#define __OFONO_CDMA_NETREG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <ofono/types.h>
+
+struct ofono_cdma_netreg;
+
+struct ofono_cdma_netreg_driver {
+ const char *name;
+ int (*probe)(struct ofono_cdma_netreg *cdma_netreg, unsigned int vendor,
+ void *data);
+ void (*remove)(struct ofono_cdma_netreg *cdma_netreg);
+};
+
+int ofono_cdma_netreg_driver_register(const struct ofono_cdma_netreg_driver *d);
+void ofono_cdma_netreg_driver_unregister(const struct ofono_cdma_netreg_driver *d);
+
+struct ofono_cdma_netreg *ofono_cdma_netreg_create(struct ofono_modem *modem,
+ unsigned int vendor,
+ const char *driver,
+ void *data);
+
+void ofono_cdma_netreg_register(struct ofono_cdma_netreg *cdma_netreg);
+void ofono_cdma_netreg_remove(struct ofono_cdma_netreg *cdma_netreg);
+
+void ofono_cdma_netreg_set_data(struct ofono_cdma_netreg *cdma_netreg, void *data);
+void *ofono_cdma_netreg_get_data(struct ofono_cdma_netreg *cdma_netreg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OFONO_CDMA_NETREG_H */
diff --git a/src/cdma-netreg.c b/src/cdma-netreg.c
new file mode 100644
index 0000000..b1cbd53
--- /dev/null
+++ b/src/cdma-netreg.c
@@ -0,0 +1,188 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+
+#include <gdbus.h>
+
+#include "ofono.h"
+
+static GSList *g_drivers;
+
+struct ofono_cdma_netreg {
+ const struct ofono_cdma_netreg_driver *driver;
+ void *driver_data;
+ struct ofono_atom *atom;
+};
+
+static DBusMessage *network_get_properties(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+
+ reply = dbus_message_new_method_return(msg);
+ if (reply == NULL)
+ return NULL;
+
+ dbus_message_iter_init_append(reply, &iter);
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
+ return reply;
+}
+
+static GDBusMethodTable cdma_netreg_manager_methods[] = {
+ { "GetProperties", "", "a{sv}", network_get_properties },
+ { }
+};
+
+static GDBusSignalTable cdma_netreg_manager_signals[] = {
+ { }
+};
+
+int ofono_cdma_netreg_driver_register(const struct ofono_cdma_netreg_driver *d)
+{
+ DBG("driver: %p, name: %s", d, d->name);
+
+ if (d->probe == NULL)
+ return -EINVAL;
+
+ g_drivers = g_slist_prepend(g_drivers, (void *)d);
+
+ return 0;
+}
+
+void ofono_cdma_netreg_driver_unregister(const struct ofono_cdma_netreg_driver *d)
+{
+ DBG("driver: %p, name: %s", d, d->name);
+
+ g_drivers = g_slist_remove(g_drivers, (void *)d);
+}
+
+static void cdma_netreg_unregister(struct ofono_atom *atom)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ struct ofono_modem *modem = __ofono_atom_get_modem(atom);
+ const char *path = __ofono_atom_get_path(atom);
+
+ g_dbus_unregister_interface(conn, path,
+ OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE);
+
+ ofono_modem_remove_interface(modem,
+ OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE);
+}
+
+static void cdma_netreg_remove(struct ofono_atom *atom)
+{
+ struct ofono_cdma_netreg *cdma_netreg = __ofono_atom_get_data(atom);
+
+ DBG("atom: %p", atom);
+
+ if (cdma_netreg == NULL)
+ return;
+
+ if (cdma_netreg->driver && cdma_netreg->driver->remove)
+ cdma_netreg->driver->remove(cdma_netreg);
+
+ g_free(cdma_netreg);
+}
+
+struct ofono_cdma_netreg *ofono_cdma_netreg_create(struct ofono_modem *modem,
+ unsigned int vendor,
+ const char *driver,
+ void *data)
+{
+ struct ofono_cdma_netreg *cdma_netreg;
+ GSList *l;
+
+ if (driver == NULL)
+ return NULL;
+
+ cdma_netreg = g_try_new0(struct ofono_cdma_netreg, 1);
+ if (cdma_netreg == NULL)
+ return NULL;
+
+ cdma_netreg->atom = __ofono_modem_add_atom(modem,
+ OFONO_ATOM_TYPE_CDMA_NETREG,
+ cdma_netreg_remove, cdma_netreg);
+
+ for (l = g_drivers; l; l = l->next) {
+ const struct ofono_cdma_netreg_driver *drv = l->data;
+
+ if (g_strcmp0(drv->name, driver))
+ continue;
+
+ if (drv->probe(cdma_netreg, vendor, data) < 0)
+ continue;
+
+ cdma_netreg->driver = drv;
+ break;
+ }
+
+ return cdma_netreg;
+}
+
+void ofono_cdma_netreg_register(struct ofono_cdma_netreg *cdma_netreg)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ struct ofono_modem *modem = __ofono_atom_get_modem(cdma_netreg->atom);
+ const char *path = __ofono_atom_get_path(cdma_netreg->atom);
+
+ if (!g_dbus_register_interface(conn, path,
+ OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
+ cdma_netreg_manager_methods,
+ cdma_netreg_manager_signals,
+ NULL, cdma_netreg, NULL)) {
+ ofono_error("Could not create %s interface",
+ OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE);
+ return;
+ }
+
+ ofono_modem_add_interface(modem,
+ OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE);
+
+ __ofono_atom_register(cdma_netreg->atom, cdma_netreg_unregister);
+}
+
+void ofono_cdma_netreg_remove(struct ofono_cdma_netreg *cdma_netreg)
+{
+ __ofono_atom_free(cdma_netreg->atom);
+}
+
+void ofono_cdma_netreg_set_data(struct ofono_cdma_netreg *cdma_netreg, void *data)
+{
+ cdma_netreg->driver_data = data;
+}
+
+void *ofono_cdma_netreg_get_data(struct ofono_cdma_netreg *cdma_netreg)
+{
+ return cdma_netreg->driver_data;
+}
diff --git a/src/ofono.h b/src/ofono.h
index 808a8f1..5e3a6b5 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -135,6 +135,7 @@ enum ofono_atom_type {
OFONO_ATOM_TYPE_LOCATION_REPORTING,
OFONO_ATOM_TYPE_GNSS,
OFONO_ATOM_TYPE_CDMA_SMS,
+ OFONO_ATOM_TYPE_CDMA_NETREG,
};
enum ofono_atom_watch_condition {
@@ -480,6 +481,7 @@ void __ofono_gprs_provision_free_settings(
#include <ofono/emulator.h>
#include <ofono/gnss.h>
#include <ofono/cdma-sms.h>
+#include <ofono/cdma-netreg.h>
#include <ofono/private-network.h>
void __ofono_private_network_release(int id);
--
1.7.4.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH_v4 3/6] cdmamodem: Create CDMA network registration atom.
2011-08-02 12:45 [PATCH_v4 0/6] Create CDMA Network Registration atom Bertrand Aygon
2011-08-02 12:45 ` [PATCH_v4 1/6] cdmamodem: Define " Bertrand Aygon
2011-08-02 12:45 ` [PATCH_v4 2/6] cdmamodem: Create org.ofono.cdma.NetworkRegistration interface Bertrand Aygon
@ 2011-08-02 12:45 ` Bertrand Aygon
2011-08-02 12:45 ` [PATCH_v4 4/6] speedupcdma: register to " Bertrand Aygon
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Bertrand Aygon @ 2011-08-02 12:45 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4640 bytes --]
---
Makefile.am | 3 +-
drivers/cdmamodem/cdmamodem.c | 2 +
drivers/cdmamodem/cdmamodem.h | 2 +
drivers/cdmamodem/network-registration.c | 81 ++++++++++++++++++++++++++++++
4 files changed, 87 insertions(+), 1 deletions(-)
create mode 100644 drivers/cdmamodem/network-registration.c
diff --git a/Makefile.am b/Makefile.am
index 4a4b1d2..7e048f5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -275,7 +275,8 @@ builtin_sources += drivers/cdmamodem/cdmamodem.h \
drivers/cdmamodem/cdmamodem.c \
drivers/cdmamodem/voicecall.c \
drivers/cdmamodem/devinfo.c \
- drivers/cdmamodem/connman.c
+ drivers/cdmamodem/connman.c \
+ drivers/cdmamodem/network-registration.c
endif
builtin_modules += g1
diff --git a/drivers/cdmamodem/cdmamodem.c b/drivers/cdmamodem/cdmamodem.c
index 1b19a4a..60d5315 100644
--- a/drivers/cdmamodem/cdmamodem.c
+++ b/drivers/cdmamodem/cdmamodem.c
@@ -37,6 +37,7 @@ static int cdmamodem_init(void)
cdma_voicecall_init();
cdma_devinfo_init();
cdma_connman_init();
+ cdma_netreg_init();
return 0;
}
@@ -46,6 +47,7 @@ static void cdmamodem_exit(void)
cdma_voicecall_exit();
cdma_devinfo_exit();
cdma_connman_exit();
+ cdma_netreg_exit();
}
OFONO_PLUGIN_DEFINE(cdmamodem, "CDMA AT modem driver", VERSION,
diff --git a/drivers/cdmamodem/cdmamodem.h b/drivers/cdmamodem/cdmamodem.h
index 90e2848..f2d229b 100644
--- a/drivers/cdmamodem/cdmamodem.h
+++ b/drivers/cdmamodem/cdmamodem.h
@@ -27,3 +27,5 @@ extern void cdma_devinfo_init(void);
extern void cdma_devinfo_exit(void);
extern void cdma_connman_init(void);
extern void cdma_connman_exit(void);
+extern void cdma_netreg_init(void);
+extern void cdma_netreg_exit(void);
diff --git a/drivers/cdmamodem/network-registration.c b/drivers/cdmamodem/network-registration.c
new file mode 100644
index 0000000..92dad56
--- /dev/null
+++ b/drivers/cdmamodem/network-registration.c
@@ -0,0 +1,81 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define _GNU_SOURCE
+#include <glib.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/cdma-netreg.h>
+
+#include "gatchat.h"
+
+#include "cdmamodem.h"
+
+struct netreg_data {
+ GAtChat *chat;
+};
+
+static int cdma_netreg_probe(struct ofono_cdma_netreg *netreg,
+ unsigned int vendor, void *data)
+{
+ GAtChat *chat = data;
+ struct netreg_data *nd;
+
+ nd = g_try_new0(struct netreg_data, 1);
+
+ nd->chat = g_at_chat_clone(chat);
+ ofono_cdma_netreg_set_data(netreg, nd);
+
+ ofono_cdma_netreg_register(netreg);
+
+ return 0;
+}
+
+static void cdma_netreg_remove(struct ofono_cdma_netreg *netreg)
+{
+ struct netreg_data *nd = ofono_cdma_netreg_get_data(netreg);
+
+ ofono_cdma_netreg_set_data(netreg, NULL);
+
+ g_at_chat_unref(nd->chat);
+ g_free(nd);
+}
+
+static struct ofono_cdma_netreg_driver driver = {
+ .name = "cdmamodem",
+ .probe = cdma_netreg_probe,
+ .remove = cdma_netreg_remove,
+};
+
+void cdma_netreg_init(void)
+{
+ ofono_cdma_netreg_driver_register(&driver);
+}
+
+void cdma_netreg_exit(void)
+{
+ ofono_cdma_netreg_driver_unregister(&driver);
+}
--
1.7.4.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH_v4 4/6] speedupcdma: register to CDMA network registration atom.
2011-08-02 12:45 [PATCH_v4 0/6] Create CDMA Network Registration atom Bertrand Aygon
` (2 preceding siblings ...)
2011-08-02 12:45 ` [PATCH_v4 3/6] cdmamodem: Create CDMA network registration atom Bertrand Aygon
@ 2011-08-02 12:45 ` Bertrand Aygon
2011-07-31 10:15 ` Denis Kenzior
2011-08-02 12:45 ` [PATCH_v4 5/6] cdmamodem: add status info to cdma network atom Bertrand Aygon
2011-08-02 12:45 ` [PATCH_v4 6/6] cdmamodem: register for network status notification Bertrand Aygon
5 siblings, 1 reply; 12+ messages in thread
From: Bertrand Aygon @ 2011-08-02 12:45 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]
---
plugins/speedupcdma.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/plugins/speedupcdma.c b/plugins/speedupcdma.c
index 3b398aa..0533f8f 100644
--- a/plugins/speedupcdma.c
+++ b/plugins/speedupcdma.c
@@ -35,6 +35,7 @@
#include <ofono/modem.h>
#include <ofono/devinfo.h>
#include <ofono/cdma-connman.h>
+#include <ofono/cdma-netreg.h>
#include <ofono/log.h>
struct speedupcdma_data {
@@ -210,6 +211,8 @@ static void speedupcdma_post_online(struct ofono_modem *modem)
DBG("%p", modem);
+ ofono_cdma_netreg_create(modem, 0, "cdmamodem", data->aux);
+
ofono_cdma_connman_create(modem, 0, "cdmamodem", data->modem);
}
--
1.7.4.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH_v4 5/6] cdmamodem: add status info to cdma network atom.
2011-08-02 12:45 [PATCH_v4 0/6] Create CDMA Network Registration atom Bertrand Aygon
` (3 preceding siblings ...)
2011-08-02 12:45 ` [PATCH_v4 4/6] speedupcdma: register to " Bertrand Aygon
@ 2011-08-02 12:45 ` Bertrand Aygon
2011-07-31 10:26 ` Denis Kenzior
2011-08-02 12:45 ` [PATCH_v4 6/6] cdmamodem: register for network status notification Bertrand Aygon
5 siblings, 1 reply; 12+ messages in thread
From: Bertrand Aygon @ 2011-08-02 12:45 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4860 bytes --]
---
include/cdma-netreg.h | 11 +++++++++
src/cdma-netreg.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/include/cdma-netreg.h b/include/cdma-netreg.h
index 0da7cbb..b18d500 100644
--- a/include/cdma-netreg.h
+++ b/include/cdma-netreg.h
@@ -28,6 +28,12 @@ extern "C" {
#include <ofono/types.h>
+enum cdma_network_registration_status {
+ CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED = 0,
+ CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED = 1,
+ CDMA_NETWORK_REGISTRATION_STATUS_UNKNOWN = 2,
+};
+
struct ofono_cdma_netreg;
struct ofono_cdma_netreg_driver {
@@ -37,6 +43,9 @@ struct ofono_cdma_netreg_driver {
void (*remove)(struct ofono_cdma_netreg *cdma_netreg);
};
+void ofono_cdma_netreg_status_notify(struct ofono_cdma_netreg *netreg,
+ int status);
+
int ofono_cdma_netreg_driver_register(const struct ofono_cdma_netreg_driver *d);
void ofono_cdma_netreg_driver_unregister(const struct ofono_cdma_netreg_driver *d);
@@ -51,6 +60,8 @@ void ofono_cdma_netreg_remove(struct ofono_cdma_netreg *cdma_netreg);
void ofono_cdma_netreg_set_data(struct ofono_cdma_netreg *cdma_netreg, void *data);
void *ofono_cdma_netreg_get_data(struct ofono_cdma_netreg *cdma_netreg);
+int ofono_cdma_netreg_get_status(struct ofono_cdma_netreg *cdma_netreg);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/cdma-netreg.c b/src/cdma-netreg.c
index b1cbd53..0d7dc03 100644
--- a/src/cdma-netreg.c
+++ b/src/cdma-netreg.c
@@ -32,18 +32,36 @@
static GSList *g_drivers;
struct ofono_cdma_netreg {
+ int status;
const struct ofono_cdma_netreg_driver *driver;
void *driver_data;
struct ofono_atom *atom;
};
+static const char *cdma_registration_status_to_string(int status)
+{
+ switch (status) {
+ case CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED:
+ return "unregistered";
+ case CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED:
+ return "registered";
+ case CDMA_NETWORK_REGISTRATION_STATUS_UNKNOWN:
+ return "unknown";
+ }
+
+ return "";
+}
+
static DBusMessage *network_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
+ struct ofono_cdma_netreg *cdma_netreg = data;
DBusMessage *reply;
DBusMessageIter iter;
DBusMessageIter dict;
+ const char *status = cdma_registration_status_to_string(cdma_netreg->status);
+
reply = dbus_message_new_method_return(msg);
if (reply == NULL)
return NULL;
@@ -54,6 +72,8 @@ static DBusMessage *network_get_properties(DBusConnection *conn,
OFONO_PROPERTIES_ARRAY_SIGNATURE,
&dict);
+ ofono_dbus_dict_append(&dict, "Status", DBUS_TYPE_STRING, &status);
+
dbus_message_iter_close_container(&iter, &dict);
return reply;
@@ -68,6 +88,40 @@ static GDBusSignalTable cdma_netreg_manager_signals[] = {
{ }
};
+
+static void set_registration_status(struct ofono_cdma_netreg *cdma_netreg,
+ int status)
+{
+ const char *str_status = cdma_registration_status_to_string(status);
+ const char *path = __ofono_atom_get_path(cdma_netreg->atom);
+ DBusConnection *conn = ofono_dbus_get_connection();
+
+ cdma_netreg->status = status;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
+ "Status", DBUS_TYPE_STRING,
+ &str_status);
+}
+
+void ofono_cdma_netreg_status_notify(struct ofono_cdma_netreg *cdma_netreg,
+ int status)
+{
+ if (cdma_netreg == NULL)
+ return;
+
+ if (cdma_netreg->status != status)
+ set_registration_status(cdma_netreg, status);
+}
+
+int ofono_cdma_netreg_get_status(struct ofono_cdma_netreg *cdma_netreg)
+{
+ if (cdma_netreg == NULL)
+ return -1;
+
+ return cdma_netreg->status;
+}
+
int ofono_cdma_netreg_driver_register(const struct ofono_cdma_netreg_driver *d)
{
DBG("driver: %p, name: %s", d, d->name);
@@ -130,6 +184,8 @@ struct ofono_cdma_netreg *ofono_cdma_netreg_create(struct ofono_modem *modem,
if (cdma_netreg == NULL)
return NULL;
+ cdma_netreg->status = CDMA_NETWORK_REGISTRATION_STATUS_UNKNOWN;
+
cdma_netreg->atom = __ofono_modem_add_atom(modem,
OFONO_ATOM_TYPE_CDMA_NETREG,
cdma_netreg_remove, cdma_netreg);
--
1.7.4.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH_v4 6/6] cdmamodem: register for network status notification.
2011-08-02 12:45 [PATCH_v4 0/6] Create CDMA Network Registration atom Bertrand Aygon
` (4 preceding siblings ...)
2011-08-02 12:45 ` [PATCH_v4 5/6] cdmamodem: add status info to cdma network atom Bertrand Aygon
@ 2011-08-02 12:45 ` Bertrand Aygon
2011-07-31 10:34 ` Denis Kenzior
5 siblings, 1 reply; 12+ messages in thread
From: Bertrand Aygon @ 2011-08-02 12:45 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3335 bytes --]
---
drivers/cdmamodem/network-registration.c | 75 ++++++++++++++++++++++++++++++
1 files changed, 75 insertions(+), 0 deletions(-)
diff --git a/drivers/cdmamodem/network-registration.c b/drivers/cdmamodem/network-registration.c
index 92dad56..665f940 100644
--- a/drivers/cdmamodem/network-registration.c
+++ b/drivers/cdmamodem/network-registration.c
@@ -34,10 +34,79 @@
#include "cdmamodem.h"
+static const char *sysinfo_prefix[] = { "^SYSINFO:", NULL };
+
struct netreg_data {
GAtChat *chat;
};
+static void sysinfo_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_cdma_netreg *netreg = user_data;
+ gint srv_status;
+ gint srv_domain;
+ gint roaming_status;
+ int status;
+ GAtResultIter iter;
+
+ if (!ok)
+ return;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "^SYSINFO:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &srv_status))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &srv_domain))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &roaming_status))
+ return;
+
+ DBG("%d, %d, %d", srv_status, srv_domain, roaming_status);
+
+ switch (srv_status) {
+ case 0: /* No service */
+ case 4: /* Not registered */
+ status = CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
+ break;
+ case 1: /* Restricted service */
+ case 2: /* Service valid */
+ case 3: /* Restricted region service */
+ status = CDMA_NETWORK_REGISTRATION_STATUS_REGISTERED;
+ break;
+ default:
+ status = CDMA_NETWORK_REGISTRATION_STATUS_UNKNOWN;
+ break;
+ }
+
+ switch (srv_domain) {
+ case 0: /* No service */
+ status = CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
+ break;
+ case 1: /* Only CS */
+ case 2: /* Only PS */
+ case 3: /* CS + PS */
+ case 4: /* CS registered, PS in searching state */
+ break;
+ }
+
+ ofono_cdma_netreg_status_notify(netreg, status);
+}
+
+
+static void mode_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_cdma_netreg *netreg = user_data;
+ struct netreg_data *nd = ofono_cdma_netreg_get_data(netreg);
+
+ g_at_chat_send(nd->chat, "AT^SYSINFO", sysinfo_prefix, sysinfo_cb,
+ netreg, NULL);
+}
+
static int cdma_netreg_probe(struct ofono_cdma_netreg *netreg,
unsigned int vendor, void *data)
{
@@ -49,8 +118,14 @@ static int cdma_netreg_probe(struct ofono_cdma_netreg *netreg,
nd->chat = g_at_chat_clone(chat);
ofono_cdma_netreg_set_data(netreg, nd);
+ g_at_chat_register(nd->chat, "^MODE:",
+ mode_notify, FALSE, netreg, NULL);
+
ofono_cdma_netreg_register(netreg);
+ g_at_chat_send(nd->chat, "AT^SYSINFO", sysinfo_prefix, sysinfo_cb,
+ netreg, NULL);
+
return 0;
}
--
1.7.4.1
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-08-02 12:45 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-02 12:45 [PATCH_v4 0/6] Create CDMA Network Registration atom Bertrand Aygon
2011-08-02 12:45 ` [PATCH_v4 1/6] cdmamodem: Define " Bertrand Aygon
2011-07-31 10:12 ` Denis Kenzior
2011-08-02 12:45 ` [PATCH_v4 2/6] cdmamodem: Create org.ofono.cdma.NetworkRegistration interface Bertrand Aygon
2011-07-31 10:14 ` Denis Kenzior
2011-08-02 12:45 ` [PATCH_v4 3/6] cdmamodem: Create CDMA network registration atom Bertrand Aygon
2011-08-02 12:45 ` [PATCH_v4 4/6] speedupcdma: register to " Bertrand Aygon
2011-07-31 10:15 ` Denis Kenzior
2011-08-02 12:45 ` [PATCH_v4 5/6] cdmamodem: add status info to cdma network atom Bertrand Aygon
2011-07-31 10:26 ` Denis Kenzior
2011-08-02 12:45 ` [PATCH_v4 6/6] cdmamodem: register for network status notification Bertrand Aygon
2011-07-31 10:34 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.