iface-modem-cdma: load NID if available in the CDMA status QCDM response
This commit is contained in:
@@ -2979,6 +2979,7 @@ get_call_manager_state (MMIfaceModemCdma *self,
|
||||
|
||||
typedef struct {
|
||||
guint sid;
|
||||
guint nid;
|
||||
guint class;
|
||||
guint band;
|
||||
} Cdma1xServingSystemResults;
|
||||
@@ -3016,6 +3017,7 @@ get_cdma1x_serving_system_finish (MMIfaceModemCdma *self,
|
||||
guint *class,
|
||||
guint *band,
|
||||
guint *sid,
|
||||
guint *nid,
|
||||
GError **error)
|
||||
{
|
||||
Cdma1xServingSystemResults *results;
|
||||
@@ -3025,6 +3027,7 @@ get_cdma1x_serving_system_finish (MMIfaceModemCdma *self,
|
||||
|
||||
results = (Cdma1xServingSystemResults *)g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
|
||||
*sid = results->sid;
|
||||
*nid = results->nid;
|
||||
*class = results->class;
|
||||
*band = results->band;
|
||||
return TRUE;
|
||||
@@ -3149,6 +3152,8 @@ get_cdma1x_serving_system_at_ready (MMIfaceModemCdma *self,
|
||||
results->sid = sid;
|
||||
results->band = band;
|
||||
results->class = class;
|
||||
/* No means to get NID with AT commands right now */
|
||||
results->nid = MM_MODEM_CDMA_NID_UNKNOWN;
|
||||
|
||||
g_simple_async_result_set_op_res_gpointer (ctx->result, results, (GDestroyNotify)g_free);
|
||||
cdma1x_serving_system_context_complete_and_free (ctx);
|
||||
@@ -3162,7 +3167,8 @@ get_cdma1x_serving_system_qcdm_ready (MMQcdmSerialPort *port,
|
||||
{
|
||||
Cdma1xServingSystemResults *results;
|
||||
QcdmResult *result;
|
||||
guint32 sid = 0;
|
||||
guint32 sid = MM_MODEM_CDMA_SID_UNKNOWN;
|
||||
guint32 nid = MM_MODEM_CDMA_NID_UNKNOWN;
|
||||
guint32 rxstate = 0;
|
||||
gint err = QCDM_SUCCESS;
|
||||
|
||||
@@ -3185,14 +3191,18 @@ get_cdma1x_serving_system_qcdm_ready (MMQcdmSerialPort *port,
|
||||
|
||||
qcdm_result_get_u32 (result, QCDM_CMD_CDMA_STATUS_ITEM_RX_STATE, &rxstate);
|
||||
qcdm_result_get_u32 (result, QCDM_CMD_CDMA_STATUS_ITEM_SID, &sid);
|
||||
qcdm_result_get_u32 (result, QCDM_CMD_CDMA_STATUS_ITEM_NID, &nid);
|
||||
qcdm_result_unref (result);
|
||||
|
||||
/* 99999 means unknown/no service */
|
||||
if (rxstate == QCDM_CMD_CDMA_STATUS_RX_STATE_ENTERING_CDMA)
|
||||
if (rxstate == QCDM_CMD_CDMA_STATUS_RX_STATE_ENTERING_CDMA) {
|
||||
sid = MM_MODEM_CDMA_SID_UNKNOWN;
|
||||
nid = MM_MODEM_CDMA_NID_UNKNOWN;
|
||||
}
|
||||
|
||||
results = g_new0 (Cdma1xServingSystemResults, 1);
|
||||
results->sid = sid;
|
||||
results->nid = nid;
|
||||
if (sid != MM_MODEM_CDMA_SID_UNKNOWN) {
|
||||
results->band = 'Z';
|
||||
results->class = 0;
|
||||
|
||||
@@ -415,6 +415,7 @@ struct _RunAllRegistrationChecksContext {
|
||||
guint cdma1x_class;
|
||||
guint cdma1x_band;
|
||||
guint cdma1x_sid;
|
||||
guint cdma1x_nid;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -597,6 +598,7 @@ get_cdma1x_serving_system_ready (MMIfaceModemCdma *self,
|
||||
&ctx->cdma1x_class,
|
||||
&ctx->cdma1x_band,
|
||||
&ctx->cdma1x_sid,
|
||||
&ctx->cdma1x_nid,
|
||||
&error)) {
|
||||
/* Treat as fatal all errors except for no-network */
|
||||
if (!g_error_matches (error,
|
||||
@@ -609,6 +611,7 @@ get_cdma1x_serving_system_ready (MMIfaceModemCdma *self,
|
||||
}
|
||||
|
||||
ctx->cdma1x_sid = MM_MODEM_CDMA_SID_UNKNOWN;
|
||||
ctx->cdma1x_nid = MM_MODEM_CDMA_NID_UNKNOWN;
|
||||
}
|
||||
|
||||
/* TODO: not sure why we also take class/band here */
|
||||
@@ -622,7 +625,8 @@ static void
|
||||
parse_at_results (RunAllRegistrationChecksContext *ctx)
|
||||
{
|
||||
/* 99999 means unknown/no service */
|
||||
if (ctx->cdma1x_sid == MM_MODEM_CDMA_SID_UNKNOWN) {
|
||||
if (ctx->cdma1x_sid == MM_MODEM_CDMA_SID_UNKNOWN &&
|
||||
ctx->cdma1x_nid == MM_MODEM_CDMA_NID_UNKNOWN) {
|
||||
/* Not registered in CDMA network, end registration checks */
|
||||
mm_dbg ("Not registered in any CDMA network");
|
||||
ctx->step = REGISTRATION_CHECK_STEP_LAST;
|
||||
@@ -802,7 +806,8 @@ registration_check_step (RunAllRegistrationChecksContext *ctx)
|
||||
mm_dbg ("All CDMA registration state checks done");
|
||||
mm_iface_modem_cdma_update_cdma1x_registration_state (ctx->self,
|
||||
ctx->cdma1x_state,
|
||||
ctx->cdma1x_sid);
|
||||
ctx->cdma1x_sid,
|
||||
ctx->cdma1x_nid);
|
||||
mm_iface_modem_cdma_update_evdo_registration_state (ctx->self,
|
||||
ctx->evdo_state);
|
||||
|
||||
@@ -910,7 +915,8 @@ mm_iface_modem_cdma_update_evdo_registration_state (MMIfaceModemCdma *self,
|
||||
void
|
||||
mm_iface_modem_cdma_update_cdma1x_registration_state (MMIfaceModemCdma *self,
|
||||
MMModemCdmaRegistrationState state,
|
||||
guint sid)
|
||||
guint sid,
|
||||
guint nid)
|
||||
{
|
||||
MmGdbusModemCdma *skeleton = NULL;
|
||||
gboolean supported = FALSE;
|
||||
@@ -932,6 +938,7 @@ mm_iface_modem_cdma_update_cdma1x_registration_state (MMIfaceModemCdma *self,
|
||||
case MM_MODEM_CDMA_REGISTRATION_STATE_HOME:
|
||||
case MM_MODEM_CDMA_REGISTRATION_STATE_ROAMING:
|
||||
mm_gdbus_modem_cdma_set_sid (skeleton, sid);
|
||||
mm_gdbus_modem_cdma_set_nid (skeleton, nid);
|
||||
mm_iface_modem_update_subsystem_state (MM_IFACE_MODEM (self),
|
||||
SUBSYSTEM_CDMA1X,
|
||||
MM_MODEM_STATE_REGISTERED,
|
||||
@@ -943,6 +950,9 @@ mm_iface_modem_cdma_update_cdma1x_registration_state (MMIfaceModemCdma *self,
|
||||
case MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN:
|
||||
if (mm_gdbus_modem_cdma_get_sid (skeleton) != MM_MODEM_CDMA_SID_UNKNOWN)
|
||||
mm_gdbus_modem_cdma_set_sid (skeleton, MM_MODEM_CDMA_SID_UNKNOWN);
|
||||
if (mm_gdbus_modem_cdma_get_nid (skeleton) != MM_MODEM_CDMA_NID_UNKNOWN)
|
||||
mm_gdbus_modem_cdma_set_nid (skeleton, MM_MODEM_CDMA_NID_UNKNOWN);
|
||||
|
||||
mm_iface_modem_update_subsystem_state (MM_IFACE_MODEM (self),
|
||||
SUBSYSTEM_CDMA1X,
|
||||
MM_MODEM_STATE_ENABLED,
|
||||
|
||||
@@ -125,6 +125,7 @@ struct _MMIfaceModemCdma {
|
||||
guint *class,
|
||||
guint *band,
|
||||
guint *sid,
|
||||
guint *nid,
|
||||
GError **error);
|
||||
|
||||
/* Get detailed registration state */
|
||||
@@ -191,7 +192,8 @@ void mm_iface_modem_cdma_activate_manual (MMIfaceModemCdma *self,
|
||||
/* Objects implementing this interface can report new registration states. */
|
||||
void mm_iface_modem_cdma_update_cdma1x_registration_state (MMIfaceModemCdma *self,
|
||||
MMModemCdmaRegistrationState state,
|
||||
guint sid);
|
||||
guint sid,
|
||||
guint nid);
|
||||
void mm_iface_modem_cdma_update_evdo_registration_state (MMIfaceModemCdma *self,
|
||||
MMModemCdmaRegistrationState state);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user