* [PATCH_v3 1/4] dbus: Add new D-Bus error message NotRegistered
2011-11-04 15:28 [PATCH_v3 0/4] CDMA Network registration Guillaume Zajac
@ 2011-11-04 15:28 ` Guillaume Zajac
2011-11-04 15:28 ` [PATCH_v3 2/4] cdma-connman: Check cdma-netreg status to enable data call Guillaume Zajac
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Guillaume Zajac @ 2011-11-04 15:28 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1315 bytes --]
---
src/dbus.c | 7 +++++++
src/ofono.h | 1 +
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/dbus.c b/src/dbus.c
index a96b595..be2833d 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -349,6 +349,13 @@ DBusMessage *__ofono_error_attach_in_progress(DBusMessage *msg)
"GPRS Attach is in progress");
}
+DBusMessage *__ofono_error_not_registered(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg,
+ OFONO_ERROR_INTERFACE ".NotRegistered",
+ "CDMA modem is not registered to the network");
+}
+
DBusMessage *__ofono_error_canceled(DBusMessage *msg)
{
return g_dbus_create_error(msg, OFONO_ERROR_INTERFACE ".Canceled",
diff --git a/src/ofono.h b/src/ofono.h
index bd45560..bfb534d 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -59,6 +59,7 @@ DBusMessage *__ofono_error_sim_not_ready(DBusMessage *msg);
DBusMessage *__ofono_error_in_use(DBusMessage *msg);
DBusMessage *__ofono_error_not_attached(DBusMessage *msg);
DBusMessage *__ofono_error_attach_in_progress(DBusMessage *msg);
+DBusMessage *__ofono_error_not_registered(DBusMessage *msg);
DBusMessage *__ofono_error_canceled(DBusMessage *msg);
DBusMessage *__ofono_error_access_denied(DBusMessage *msg);
DBusMessage *__ofono_error_emergency_active(DBusMessage *msg);
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH_v3 2/4] cdma-connman: Check cdma-netreg status to enable data call
2011-11-04 15:28 [PATCH_v3 0/4] CDMA Network registration Guillaume Zajac
2011-11-04 15:28 ` [PATCH_v3 1/4] dbus: Add new D-Bus error message NotRegistered Guillaume Zajac
@ 2011-11-04 15:28 ` Guillaume Zajac
2011-11-04 15:28 ` [PATCH_v3 3/4] cdma-connman: Add public api definition Guillaume Zajac
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Guillaume Zajac @ 2011-11-04 15:28 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1907 bytes --]
---
src/cdma-connman.c | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/cdma-connman.c b/src/cdma-connman.c
index db8f6c5..518fcb5 100644
--- a/src/cdma-connman.c
+++ b/src/cdma-connman.c
@@ -338,6 +338,26 @@ static void cdma_connman_settings_append_properties(
dbus_message_iter_close_container(dict, &entry);
}
+static ofono_bool_t cdma_connman_netreg_is_registered(struct ofono_cdma_connman *cm)
+{
+ int status;
+ ofono_bool_t registered;
+ struct ofono_modem *modem = __ofono_atom_get_modem(cm->atom);
+ struct ofono_atom *atom = __ofono_modem_find_atom(modem,
+ OFONO_ATOM_TYPE_CDMA_NETREG);
+ struct ofono_cdma_netreg *cdma_netreg;
+
+ if (atom == NULL)
+ return FALSE;
+
+ cdma_netreg = __ofono_atom_get_data(atom);
+ status = ofono_cdma_netreg_get_status(cdma_netreg);
+
+ registered = status == NETWORK_REGISTRATION_STATUS_REGISTERED;
+
+ return registered;
+}
+
static DBusMessage *cdma_connman_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -463,9 +483,11 @@ static DBusMessage *cdma_connman_set_property(DBusConnection *conn,
cm->driver->deactivate == NULL)
return __ofono_error_not_implemented(msg);
+ if (cdma_connman_netreg_is_registered(cm) == FALSE)
+ return __ofono_error_not_registered(msg);
+
cm->pending = dbus_message_ref(msg);
- /* TODO: add logic to support CDMA Network Registration */
if (value)
cm->driver->activate(cm, cm->username, cm->password,
activate_callback, cm);
@@ -613,8 +635,6 @@ void ofono_cdma_connman_register(struct ofono_cdma_connman *cm)
ofono_modem_add_interface(modem,
OFONO_CDMA_CONNECTION_MANAGER_INTERFACE);
- /* TODO: add watch to support CDMA Network Registration atom */
-
__ofono_atom_register(cm->atom, cdma_connman_unregister);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH_v3 3/4] cdma-connman: Add public api definition
2011-11-04 15:28 [PATCH_v3 0/4] CDMA Network registration Guillaume Zajac
2011-11-04 15:28 ` [PATCH_v3 1/4] dbus: Add new D-Bus error message NotRegistered Guillaume Zajac
2011-11-04 15:28 ` [PATCH_v3 2/4] cdma-connman: Check cdma-netreg status to enable data call Guillaume Zajac
@ 2011-11-04 15:28 ` Guillaume Zajac
2011-11-04 15:28 ` [PATCH_v3 4/4] cdmamodem: Notify when connection is lost Guillaume Zajac
2011-11-04 20:20 ` [PATCH_v3 0/4] CDMA Network registration Denis Kenzior
4 siblings, 0 replies; 6+ messages in thread
From: Guillaume Zajac @ 2011-11-04 15:28 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 994 bytes --]
---
src/cdma-connman.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/cdma-connman.c b/src/cdma-connman.c
index 518fcb5..ba71c6e 100644
--- a/src/cdma-connman.c
+++ b/src/cdma-connman.c
@@ -548,6 +548,25 @@ void ofono_cdma_connman_driver_unregister(
g_drivers = g_slist_remove(g_drivers, (void *) d);
}
+void ofono_cdma_connman_deactivated(struct ofono_cdma_connman *cm)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ ofono_bool_t value;
+ const char *path;
+
+ if (cm == NULL)
+ return;
+
+ cdma_connman_settings_reset(cm);
+ cm->powered = FALSE;
+ value = cm->powered;
+ path = __ofono_atom_get_path(cm->atom);
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_CDMA_CONNECTION_MANAGER_INTERFACE,
+ "Powered", DBUS_TYPE_BOOLEAN, &value);
+}
+
static void cdma_connman_unregister(struct ofono_atom *atom)
{
DBusConnection *conn = ofono_dbus_get_connection();
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH_v3 4/4] cdmamodem: Notify when connection is lost
2011-11-04 15:28 [PATCH_v3 0/4] CDMA Network registration Guillaume Zajac
` (2 preceding siblings ...)
2011-11-04 15:28 ` [PATCH_v3 3/4] cdma-connman: Add public api definition Guillaume Zajac
@ 2011-11-04 15:28 ` Guillaume Zajac
2011-11-04 20:20 ` [PATCH_v3 0/4] CDMA Network registration Denis Kenzior
4 siblings, 0 replies; 6+ messages in thread
From: Guillaume Zajac @ 2011-11-04 15:28 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 574 bytes --]
---
drivers/cdmamodem/connman.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/cdmamodem/connman.c b/drivers/cdmamodem/connman.c
index 49f60ac..ec17e96 100644
--- a/drivers/cdmamodem/connman.c
+++ b/drivers/cdmamodem/connman.c
@@ -116,7 +116,7 @@ static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
CALLBACK_WITH_SUCCESS(cd->down_cb, cd->cb_data);
break;
default:
- /* TODO: Handle network initiated disconnection */
+ ofono_cdma_connman_deactivated(cm);
break;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH_v3 0/4] CDMA Network registration
2011-11-04 15:28 [PATCH_v3 0/4] CDMA Network registration Guillaume Zajac
` (3 preceding siblings ...)
2011-11-04 15:28 ` [PATCH_v3 4/4] cdmamodem: Notify when connection is lost Guillaume Zajac
@ 2011-11-04 20:20 ` Denis Kenzior
4 siblings, 0 replies; 6+ messages in thread
From: Denis Kenzior @ 2011-11-04 20:20 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 340 bytes --]
Hi Guillaume,
On 11/04/2011 10:28 AM, Guillaume Zajac wrote:
> Hi,
>
> Change log from v2:
> - remove roaming, will be sent separately.
> - remove atom watch, only find_atom when network status is needed.
> - fix issue in ofono_cdma_connman_deactivated()
>
All four patches have been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 6+ messages in thread