diff options
author | Kim Tommy Humborstad <kim.tommy.humborstad@stericsson.com> | 2011-05-22 21:46:30 +0200 |
---|---|---|
committer | Sverre Vegge <sverre.vegge@stericsson.com> | 2011-07-25 09:53:27 +0200 |
commit | 38413851b977bcd4a798dfc1afb3740cdcb5393c (patch) | |
tree | 84fb0a2280d7289fd44f3284a2dcb3736cca2ec2 | |
parent | 85d772b28efe23ea78af14e53e4c11329a8497d2 (diff) | |
download | u300-38413851b977bcd4a798dfc1afb3740cdcb5393c.tar.gz |
Generic: Improved static variable handling during modem independent restart
Grouped static variables and implemented a way to keep control of
resetting variables upon modem independent restart.
Some variables also needs to be re-reported to Android upon reset and
some need to be re-set in the modem.
Signed-off-by: Sverre Vegge <sverre.vegge@stericsson.com>
-rw-r--r-- | u300-ril-audio.c | 56 | ||||
-rw-r--r-- | u300-ril-audio.h | 2 | ||||
-rw-r--r-- | u300-ril-callhandling.c | 52 | ||||
-rw-r--r-- | u300-ril-callhandling.h | 2 | ||||
-rw-r--r-- | u300-ril-information.c | 94 | ||||
-rw-r--r-- | u300-ril-information.h | 2 | ||||
-rw-r--r-- | u300-ril-messaging.c | 42 | ||||
-rw-r--r-- | u300-ril-messaging.h | 1 | ||||
-rw-r--r-- | u300-ril-network.c | 51 | ||||
-rw-r--r-- | u300-ril-network.h | 1 | ||||
-rw-r--r-- | u300-ril-pdp.c | 161 | ||||
-rw-r--r-- | u300-ril-pdp.h | 2 | ||||
-rw-r--r-- | u300-ril-services.c | 44 | ||||
-rw-r--r-- | u300-ril-services.h | 1 | ||||
-rw-r--r-- | u300-ril-sim.c | 139 | ||||
-rw-r--r-- | u300-ril-sim.h | 1 | ||||
-rw-r--r-- | u300-ril-stk.c | 103 | ||||
-rw-r--r-- | u300-ril-stk.h | 2 | ||||
-rw-r--r-- | u300-ril.c | 119 | ||||
-rw-r--r-- | u300-ril.h | 16 |
20 files changed, 772 insertions, 119 deletions
diff --git a/u300-ril-audio.c b/u300-ril-audio.c index e8fe4eb..08e131d 100644 --- a/u300-ril-audio.c +++ b/u300-ril-audio.c @@ -20,9 +20,9 @@ * Heavily modified for ST-Ericsson U300 modems. * Author: Christian Bejram <christian.bejram@stericsson.com> */ -#include <telephony/ril.h> #include <string.h> - +#include <assert.h> +#include <telephony/ril.h> #include "atchannel.h" #include "at_tok.h" #include "u300-ril.h" @@ -31,11 +31,18 @@ #define LOG_TAG "RILV" #include <utils/Log.h> +/*****************************************************/ +/* Controlled static state variables - section start */ +/*****************************************************/ /* * Current code does not require a mutex on this static as no potential * multithread problem have be found. */ -static int s_ttyMode = 0; +#define __s_ttyMode 0 +static int s_ttyMode = __s_ttyMode; +/*****************************************************/ +/* Controlled static state variables - section end */ +/*****************************************************/ #ifdef ENABLE_REPORTING_ALERTING_UPON_MISSING_CALL_STATE_FROM_NETWORK #include <stdbool.h> @@ -144,3 +151,46 @@ exit: free(line); return; } + +void onResetModemStateAudio(int resetState) +{ + /* NOTE: Function is called in DEFAULT queueRunner context! */ + + LOGI("%s() starting", __func__); + + switch (resetState) { + case RESET_START: + /* + * Issued prior to AT channels are recreated and shall therefore NOT + * initiate modem communication! + * -> Reset any internal static state variables and report to Android if + * nessasary. + */ + /** s_ttyMode */ + /* Survive reset */ + break; + case RESET_AT_INITIALIZED: + /* + * Issued when AT channels are available and before SIM is booted and + * unlocked. + * -> Re-setup modem and Android with internal static state variables + * which cannot be reset after modem restart. + */ + /** s_ttyMode */ + /* No impact */ + break; + case RESET_SIM_READY: + /* + * Issued after SIM is unlocked. + * -> Re-setup modem with internal static state variables which + * cannot be reset before SIM is unlocked. + */ + /** s_ttyMode */ + /* Setup modem to earlier state */ + (void) at_send_command(s_ttyMode?"AT*ETTY=1":"AT*ETTY=0", NULL); + break; + default: + LOGE("%s() received unknown resetState. Fatal error!", __func__); + assert(0); + } +} diff --git a/u300-ril-audio.h b/u300-ril-audio.h index 246967a..f610c45 100644 --- a/u300-ril-audio.h +++ b/u300-ril-audio.h @@ -34,4 +34,6 @@ void requestSetTtyMode(void *data, size_t datalen, RIL_Token t); void requestQueryTtyMode(void *data, size_t datalen, RIL_Token t); void onAudioCallEventNotify(const char *s); + +void onResetModemStateAudio(int resetState); #endif diff --git a/u300-ril-callhandling.c b/u300-ril-callhandling.c index c477915..ad2afef 100644 --- a/u300-ril-callhandling.c +++ b/u300-ril-callhandling.c @@ -68,8 +68,15 @@ enum clccState { CLCC_STATE_WAITING = 5 }; +/*****************************************************/ +/* Controlled static state variables - section start */ +/*****************************************************/ /* Last call fail cause, obtained by *ECAV. */ -static int s_lastCallFailCause = CALL_FAIL_ERROR_UNSPECIFIED; +#define __s_lastCallFailCause CALL_FAIL_ERROR_UNSPECIFIED +static int s_lastCallFailCause = __s_lastCallFailCause; +/*****************************************************/ +/* Controlled static state variables - section end */ +/*****************************************************/ static int clccStateToRILState(int state, RIL_CallState *p_state) { @@ -1119,3 +1126,46 @@ error: RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); goto finally; } + +void onResetModemStateCallHandling(int resetState) +{ + /* NOTE: Function is called in DEFAULT queueRunner context! */ + + LOGI("%s() starting", __func__); + + switch (resetState) { + case RESET_START: + /* + * Issued prior to AT channels are recreated and shall therefore NOT + * initiate modem communication! + * -> Reset any internal static state variables and report to Android if + * nessasary. + */ + /** s_lastCallFailCause */ + /* If a call was ongoing the state is now lost... reset */ + s_lastCallFailCause = __s_lastCallFailCause; + break; + case RESET_AT_INITIALIZED: + /* + * Issued when AT channels are available and before SIM is booted and + * unlocked. + * -> Re-setup modem and Android with internal static state variables + * which cannot be reset after modem restart. + */ + /** s_lastCallFailCause */ + /* No impact */ + break; + case RESET_SIM_READY: + /* + * Issued after SIM is unlocked. + * -> Re-setup modem with internal static state variables which + * cannot be reset before SIM is unlocked. + */ + /** s_lastCallFailCause */ + /* No impact */ + break; + default: + LOGE("%s() received unknown resetState. Fatal error!", __func__); + assert(0); + } +} diff --git a/u300-ril-callhandling.h b/u300-ril-callhandling.h index aec52ff..621ddf1 100644 --- a/u300-ril-callhandling.h +++ b/u300-ril-callhandling.h @@ -46,4 +46,6 @@ void requestDTMFStart(void *data, size_t datalen, RIL_Token t); void requestDTMFStop(void *data, size_t datalen, RIL_Token t); void onECAVReceived(const char *s); + +void onResetModemStateCallHandling(int resetState); #endif diff --git a/u300-ril-information.c b/u300-ril-information.c index 5ecd214..691c61e 100644 --- a/u300-ril-information.c +++ b/u300-ril-information.c @@ -35,7 +35,16 @@ #define LOG_TAG "RILV" #include <utils/Log.h> -bool g_shutdownCompleted; +bool g_shutdownCompleted; /* Static allowed - uncontrolled */ + +/*****************************************************/ +/* Controlled static state variables - section start */ +/*****************************************************/ + +/*****************************************************/ +/* Controlled static state variables - section end */ +/*****************************************************/ + /** * RIL_REQUEST_GET_IMSI */ @@ -266,17 +275,13 @@ void pollAndDispatchSignalStrength(void *param) &signalStrength, sizeof(RIL_SignalStrength)); } -void requestScreenState(void *data, size_t datalen, RIL_Token t) +bool changeScreenState(int screenState) { - int screenState = 0; - - if(datalen < sizeof(int)) - goto error; + bool res = true; getScreenStateLock(); - screenState = ((int *) data)[0]; - setScreenState(screenState); + setScreenState(screenState); if (screenState == 1) { /* Screen is on - be sure to enable all unsolicited notifications. */ #ifdef LTE_COMMAND_SET_ENABLED @@ -299,10 +304,14 @@ void requestScreenState(void *data, size_t datalen, RIL_Token t) */ enqueueRILEvent(CMD_QUEUE_AUXILIARY, pollAndDispatchSignalStrength, NULL, NULL); + /* Trigger a rehash of network values, just to be sure. */ + RIL_onUnsolicitedResponse(RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED, + NULL, 0); } else if (screenState == 0) { /* Screen is off - disable all unsolicited notifications. */ #ifdef LTE_COMMAND_SET_ENABLED if (at_send_command("AT+CEREG=0", NULL) < 0) +#include <stdlib.h> LOGI("Failed to disable CEREG notifications"); if (at_send_command("AT+CREG=0", NULL) < 0) LOGI("Failed to disable CREG notifications"); @@ -316,27 +325,43 @@ void requestScreenState(void *data, size_t datalen, RIL_Token t) LOGI("Failed to disable EPSB notifications"); if (at_send_command("AT+CMER=3,0,0,0", NULL) < 0) LOGI("Failed to disable CMER notifications"); - } else + } else { /* Not a defined value - error. */ goto error; + } + goto exit; + +error: + LOGE("%s failed to change screen state subscriptions", __func__); + res = false; + +exit: releaseScreenStateLock(); + return res; +} - RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); +void requestScreenState(void *data, size_t datalen, RIL_Token t) +{ + int screenState; -finally: - /* Trigger a rehash of network values, just to be sure. */ - if (screenState == 1) - RIL_onUnsolicitedResponse(RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED, NULL, 0); + if (datalen < sizeof(int)) + goto error; - return; + screenState = ((int *) data)[0]; + + if(!changeScreenState(screenState)) + goto error; + + RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); + goto exit; error: LOGE("ERROR: requestScreenState failed"); RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); - releaseScreenStateLock(); - goto finally; +exit: + return; } /** @@ -390,3 +415,38 @@ error: goto finally; } +void onResetModemStateInformation(int resetState) +{ + /* NOTE: Function is called in DEFAULT queueRunner context! */ + + LOGI("%s() starting", __func__); + + switch (resetState) { + case RESET_START: + /* + * Issued prior to AT channels are recreated and shall therefore NOT + * initiate modem communication! + * -> Reset any internal static state variables and report to Android if + * nessasary. + */ + break; + case RESET_AT_INITIALIZED: + /* + * Issued when AT channels are available and before SIM is booted and + * unlocked. + * -> Re-setup modem and Android with internal static state variables + * which cannot be reset after modem restart. + */ + break; + case RESET_SIM_READY: + /* + * Issued after SIM is unlocked. + * -> Re-setup modem with internal static state variables which + * cannot be reset before SIM is unlocked. + */ + break; + default: + LOGE("%s() received unknown resetState. Fatal error!", __func__); + assert(0); + } +} diff --git a/u300-ril-information.h b/u300-ril-information.h index 2b25aeb..3587852 100644 --- a/u300-ril-information.h +++ b/u300-ril-information.h @@ -34,7 +34,9 @@ void requestRadioPower(void *data, size_t datalen, RIL_Token t); void requestScreenState(void *data, size_t datalen, RIL_Token t); void requestBasebandVersion(void *data, size_t datalen, RIL_Token t); +bool changeScreenState(int screenState); void pollAndDispatchSignalStrength(void *param); +void onResetModemStateInformation(int resetState); extern bool g_shutdownCompleted; #endif diff --git a/u300-ril-messaging.c b/u300-ril-messaging.c index 989c2a1..be68dfc 100644 --- a/u300-ril-messaging.c +++ b/u300-ril-messaging.c @@ -35,6 +35,14 @@ #define LOG_TAG "RILV" #include <utils/Log.h> +/*****************************************************/ +/* Controlled static state variables - section start */ +/*****************************************************/ + +/*****************************************************/ +/* Controlled static state variables - section end */ +/*****************************************************/ + void onNewStatusReport(const char *sms_pdu) { char *response = NULL; @@ -672,3 +680,37 @@ error: RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); goto finally; } + +void onResetModemStateMessaging(int resetState) +{ + LOGI("%s() starting", __func__); + + switch (resetState) { + case RESET_START: + /* + * Issued prior to AT channels are recreated and shall therefore NOT + * initiate modem communication! + * -> Reset any internal static state variables and report to Android if + * nessasary. + */ + break; + case RESET_AT_INITIALIZED: + /* + * Issued when AT channels are available and before SIM is booted and + * unlocked. + * -> Re-setup modem and Android with internal static state variables + * which cannot be reset after modem restart. + */ + break; + case RESET_SIM_READY: + /* + * Issued after SIM is unlocked. + * -> Re-setup modem with internal static state variables which + * cannot be reset before SIM is unlocked. + */ + break; + default: + LOGE("%s() received unknown resetState. Fatal error!", __func__); + assert(0); + } +}
\ No newline at end of file diff --git a/u300-ril-messaging.h b/u300-ril-messaging.h index 572aaf4..409cc69 100644 --- a/u300-ril-messaging.h +++ b/u300-ril-messaging.h @@ -43,4 +43,5 @@ void requestGSMSetBroadcastSMSConfig(void *data, size_t datalen, void requestGSMSMSBroadcastActivation(void *data, size_t datalen, RIL_Token t); +void onResetModemStateMessaging(int resetState); #endif diff --git a/u300-ril-network.c b/u300-ril-network.c index 5788ac7..f8062af 100644 --- a/u300-ril-network.c +++ b/u300-ril-network.c @@ -43,6 +43,9 @@ static const struct timeval TIMEVAL_OPERATOR_SELECT_POLL = { 2, 0 }; static void pollOperatorSelected(void *params); +/*****************************************************/ +/* Controlled static state variables - section start */ +/*****************************************************/ /* * s_registrationDenyReason is used to keep track of registration deny * reason for which is called by pollOperatorSelected from @@ -53,7 +56,13 @@ static void pollOperatorSelected(void *params); * and detail reason from "at*ereg?" command, and is reset to * DEFAULT_VALUE otherwise. */ -static Reg_Deny_DetailReason s_registrationDenyReason = DEFAULT_VALUE; +#define __s_registrationDenyReason DEFAULT_VALUE; +static Reg_Deny_DetailReason s_registrationDenyReason = + __s_registrationDenyReason; + +/*****************************************************/ +/* Controlled static state variables - section end */ +/*****************************************************/ struct operatorPollParams { RIL_Token t; @@ -2320,3 +2329,43 @@ error: RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); goto finally; } + +void onResetModemStateNetwork(int resetState) +{ + /* NOTE: Function is called in DEFAULT queueRunner context! */ + + LOGI("%s() starting", __func__); + + switch (resetState) { + case RESET_START: + /* + * Issued prior to AT channels are recreated and shall therefore NOT + * initiate modem communication! + * -> Reset any internal static state variables and report to Android if + * nessasary. + */ + /** s_registrationDenyReason */ + s_registrationDenyReason = __s_registrationDenyReason; + break; + case RESET_AT_INITIALIZED: + /* + * Issued when AT channels are available and before SIM is booted and + * unlocked. + * -> Re-setup modem and Android with internal static state variables + * which cannot be reset after modem restart. + */ + /** s_registrationDenyReason */ + break; + case RESET_SIM_READY: + /* + * Issued after SIM is unlocked. + * -> Re-setup modem with internal static state variables which + * cannot be reset before SIM is unlocked. + */ + /** s_registrationDenyReason */ + break; + default: + LOGE("%s() received unknown resetState. Fatal error!", __func__); + assert(0); + } +}
\ No newline at end of file diff --git a/u300-ril-network.h b/u300-ril-network.h index 8389b80..42e14c0 100644 --- a/u300-ril-network.h +++ b/u300-ril-network.h @@ -58,4 +58,5 @@ void requestOperator(void *data, size_t datalen, RIL_Token t); void requestSetLocationUpdates(void *data, size_t datalen, RIL_Token t); void requestNeighboringCellIDs(void *data, size_t datalen, RIL_Token t); +void onResetModemStateNetwork(int resetState); #endif diff --git a/u300-ril-pdp.c b/u300-ril-pdp.c index a0b03ad..97ca21a 100644 --- a/u300-ril-pdp.c +++ b/u300-ril-pdp.c @@ -53,10 +53,6 @@ /* This should have been exported by ifc_utils.h */ void ifc_close(void); -/* Last data call fail cause, obtained by *CEER. */ -static RIL_LastDataCallActivateFailCause s_lastDataCallFailCause = - PDP_FAIL_ERROR_UNSPECIFIED; - /* OEM callback issued when a OEM activated context is deactivated */ static void (*pdpOemDeativatedCB)(int profileId) = NULL; @@ -69,12 +65,30 @@ typedef struct pdpContextEntry { int OEM; /* locally created or external (OEM use) */ } pdpContextEntry; +static pthread_mutex_t contextListMutex = PTHREAD_MUTEX_INITIALIZER; + +/*****************************************************/ +/* Controlled static state variables - section start */ +/*****************************************************/ +/* Last data call fail cause, obtained by *CEER. */ +#define __s_lastDataCallFailCause PDP_FAIL_ERROR_UNSPECIFIED +static RIL_LastDataCallActivateFailCause s_lastDataCallFailCause = + __s_lastDataCallFailCause; + /* Maintained list of PDP contexts */ -static pdpContextEntry pdpContextList[RIL_MAX_NUMBER_OF_PDP_CONTEXTS] = - {{0,0,-1,NULL,-1},{0,0,-1,NULL,-1},{0,0,-1,NULL,-1}, - {0,0,-1,NULL,-1},{0,0,-1,NULL,-1},{0,0,-1,NULL,-1}}; +#define __s_pdpContextList {0,0,-1,NULL,-1} +static pdpContextEntry s_pdpContextList[RIL_MAX_NUMBER_OF_PDP_CONTEXTS] = + {__s_pdpContextList,__s_pdpContextList, + __s_pdpContextList,__s_pdpContextList, + __s_pdpContextList,__s_pdpContextList}; + +#define __s_lastBearer -1 +static int s_lastBearer = __s_lastBearer; + +/*****************************************************/ +/* Controlled static state variables - section end */ +/*****************************************************/ -static pthread_mutex_t contextListMutex = PTHREAD_MUTEX_INITIALIZER; /* convertAuthenticationMethod */ static char* convertAuthenticationMethod(const char *authentication) @@ -431,17 +445,17 @@ bool pdpListExist(const char *cidToFind, const char *profileToFind, if ((cidToFind != NULL && strtol(cidToFind, &end, 10) == i + RIL_FIRST_CID_INDEX) || (profileToFind != NULL && - strtol(profileToFind, &end, 10) == pdpContextList[i].pid)) { + strtol(profileToFind, &end, 10) == s_pdpContextList[i].pid)) { found = true; if (cid != NULL) *cid = i + RIL_FIRST_CID_INDEX; if (profile != NULL) - *profile = pdpContextList[i].pid; + *profile = s_pdpContextList[i].pid; if (active != NULL) - *active = pdpContextList[i].active; + *active = s_pdpContextList[i].active; if (oem != NULL) - *oem = pdpContextList[i].OEM; + *oem = s_pdpContextList[i].OEM; if (ifName != NULL) { (void)snprintf(ifName, MAX_IFNAME_LEN, "%s%d", ril_iface, i); ifName[MAX_IFNAME_LEN - 1] = '\0'; @@ -493,34 +507,34 @@ int pdpListGet(const char *cidToFind, const char *profileIdToFind, for (i = 0; i < RIL_MAX_NUMBER_OF_PDP_CONTEXTS; i++) { - if (pdpContextList[i].state == 0) + if (s_pdpContextList[i].state == 0) continue; if ((cidToFind != NULL && strtol(cidToFind, &end, 10) == i + RIL_FIRST_CID_INDEX) || (profileIdToFind != NULL && - strtol(profileIdToFind, &end, 10) == pdpContextList[i].pid)) { + strtol(profileIdToFind, &end, 10) == s_pdpContextList[i].pid)) { - if (pdpContextList[i].state != 1) { + if (s_pdpContextList[i].state != 1) { LOGD("%s() attempted on already reserved index", __func__); pdpListHandle = -2; break; } /* Entry found */ - pdpContextList[i].state = 2; /* Reserved */ + s_pdpContextList[i].state = 2; /* Reserved */ pdpListHandle = i; if (cid != NULL) *cid = i + RIL_FIRST_CID_INDEX; if (profile != NULL) - *profile = pdpContextList[i].pid; + *profile = s_pdpContextList[i].pid; if (apn != NULL) - *apn = pdpContextList[i].APN; + *apn = s_pdpContextList[i].APN; if (active != NULL) - *active = pdpContextList[i].active; + *active = s_pdpContextList[i].active; if (oem != NULL) - *oem = pdpContextList[i].OEM; + *oem = s_pdpContextList[i].OEM; if (ifName != NULL) { (void)snprintf(ifName, MAX_IFNAME_LEN, "%s%d", ril_iface, i); ifName[MAX_IFNAME_LEN - 1] = '\0'; @@ -563,7 +577,7 @@ int pdpListGetFree(int *cid, char ifName[]) } for (i = 0; i < RIL_MAX_NUMBER_OF_PDP_CONTEXTS; i++) { - if (pdpContextList[i].state == 0) { + if (s_pdpContextList[i].state == 0) { found = true; break; } @@ -580,7 +594,7 @@ int pdpListGetFree(int *cid, char ifName[]) (void) snprintf(ifName, MAX_IFNAME_LEN, "%s%d", ril_iface, i); ifName[MAX_IFNAME_LEN -1] = '\0'; } - pdpContextList[i].state = 2; /* reserved */ + s_pdpContextList[i].state = 2; /* reserved */ } else { i = -1; } @@ -613,18 +627,18 @@ bool pdpListPut(int pdpListHandle, int profile, const char *apn, int activated, } if (pdpListHandle < 0 || pdpListHandle >= RIL_MAX_NUMBER_OF_PDP_CONTEXTS || - pdpContextList[pdpListHandle].state != 2) { + s_pdpContextList[pdpListHandle].state != 2) { LOGD("%s() attempted on a non-reserved list entry, error!", __func__); success = false; } if (success) { - pdpContextList[pdpListHandle].pid = profile; + s_pdpContextList[pdpListHandle].pid = profile; if (apn != NULL) - pdpContextList[pdpListHandle].APN = strdup(apn); - pdpContextList[pdpListHandle].OEM = oem; - pdpContextList[pdpListHandle].active = activated; - pdpContextList[pdpListHandle].state = 1; /* in use */ + s_pdpContextList[pdpListHandle].APN = strdup(apn); + s_pdpContextList[pdpListHandle].OEM = oem; + s_pdpContextList[pdpListHandle].active = activated; + s_pdpContextList[pdpListHandle].state = 1; /* in use */ } if ((err = pthread_mutex_unlock(&contextListMutex)) != 0) { @@ -653,18 +667,18 @@ bool pdpListFree(int pdpListHandle) } if (pdpListHandle < 0 || pdpListHandle >= RIL_MAX_NUMBER_OF_PDP_CONTEXTS || - pdpContextList[pdpListHandle].state != 2) { + s_pdpContextList[pdpListHandle].state != 2) { LOGD("%s() attempted on a non-reserved list entry, error!", __func__); success = false; } if (success) { - pdpContextList[pdpListHandle].state = 0; /* free */ - pdpContextList[pdpListHandle].active = -1; - pdpContextList[pdpListHandle].pid = -1; - free(pdpContextList[pdpListHandle].APN); - pdpContextList[pdpListHandle].APN = NULL; - pdpContextList[pdpListHandle].OEM = -1; + s_pdpContextList[pdpListHandle].state = 0; /* free */ + s_pdpContextList[pdpListHandle].active = -1; + s_pdpContextList[pdpListHandle].pid = -1; + free(s_pdpContextList[pdpListHandle].APN); + s_pdpContextList[pdpListHandle].APN = NULL; + s_pdpContextList[pdpListHandle].OEM = -1; } if ((err = pthread_mutex_unlock(&contextListMutex)) != 0) { @@ -694,18 +708,18 @@ bool pdpListUndo(int pdpListHandle) } if (pdpListHandle < 0 || pdpListHandle >= RIL_MAX_NUMBER_OF_PDP_CONTEXTS || - pdpContextList[pdpListHandle].state != 2) { + s_pdpContextList[pdpListHandle].state != 2) { LOGD("%s() attempted on a non-reserved list entry, error!", __func__); success = false; } if (success) { /* if just created... set free */ - if (pdpContextList[pdpListHandle].APN == NULL && - pdpContextList[pdpListHandle].pid == -1) - pdpContextList[pdpListHandle].state = 0; /* free */ + if (s_pdpContextList[pdpListHandle].APN == NULL && + s_pdpContextList[pdpListHandle].pid == -1) + s_pdpContextList[pdpListHandle].state = 0; /* free */ else - pdpContextList[pdpListHandle].state = 1; /* in use */ + s_pdpContextList[pdpListHandle].state = 1; /* in use */ } if ((err = pthread_mutex_unlock(&contextListMutex)) != 0) { @@ -723,8 +737,6 @@ bool pdpListUndo(int pdpListHandle) */ void onEPSBReceived(const char *s) { - static int lastBearer = -1; - char *line; char *tok; int err; @@ -756,8 +768,8 @@ void onEPSBReceived(const char *s) * 1 ^ 0 = send event * 1 ^ 1 = - */ - if (lastBearer^currBearer) { - lastBearer = currBearer; + if (s_lastBearer^currBearer) { + s_lastBearer = currBearer; /* * Note: There is a small chance that the bearer change again before * we get to send the changelist. In this case we might end up sending @@ -1347,3 +1359,64 @@ void pdpSetOnOemDeactivated(void (*onOemDeactivated)(int profileId)) { pdpOemDeativatedCB = onOemDeactivated; } + +void onResetModemStatePdp(int resetState) +{ + /* NOTE: Function is called in DEFAULT queueRunner context! */ + + LOGI("%s() starting", __func__); + + switch (resetState) { + case RESET_START: + /* + * Issued prior to AT channels are recreated and shall therefore NOT + * initiate modem communication! + * -> Reset any internal static state variables and report to Android if + * nessasary. + */ + /** s_lastDataCallFailCause */ + s_lastDataCallFailCause = __s_lastDataCallFailCause; + + /** s_pdpContextList */ + /* Keep list for cleanup at modem initialization */ + + /** s_lastBearer */ + s_lastBearer = __s_lastBearer; + break; + case RESET_AT_INITIALIZED: + /* + * Issued when AT channels are available and before SIM is booted and + * unlocked. + * -> Re-setup modem and Android with internal static state variables + * which cannot be reset after modem restart. + */ + /** s_lastDataCallFailCause */ + /* No impact */ + + /** s_pdpContextList */ + /* run delete on all account belonging to RIL */ + requestOrSendPDPContextList(NULL); + + /** s_lastBearer */ + /* No impact */ + break; + case RESET_SIM_READY: + /* + * Issued after SIM is unlocked. + * -> Re-setup modem with internal static state variables which + * cannot be reset before SIM is unlocked. + */ + /** s_lastDataCallFailCause */ + /* No impact */ + + /** s_pdpContextList */ + /* No impact */ + + /** s_lastBearer */ + /* No impact */ + break; + default: + LOGE("%s() received unknown resetState. Fatal error!", __func__); + assert(0); + } +} diff --git a/u300-ril-pdp.h b/u300-ril-pdp.h index daf6f79..87404a6 100644 --- a/u300-ril-pdp.h +++ b/u300-ril-pdp.h @@ -64,6 +64,8 @@ bool pdpListPut(int pdpListHandle, int profile, const char *apn, int activated, bool pdpListFree(int pdpListHandle); bool pdpListUndo(int pdpListHandle); +void onResetModemStatePdp(int resetState); + #ifdef __cplusplus } #endif diff --git a/u300-ril-services.c b/u300-ril-services.c index 8fd620a..6eefd2f 100644 --- a/u300-ril-services.c +++ b/u300-ril-services.c @@ -31,6 +31,14 @@ #define LOG_TAG "RILV" #include <utils/Log.h> +/*****************************************************/ +/* Controlled static state variables - section start */ +/*****************************************************/ + +/*****************************************************/ +/* Controlled static state variables - section end */ +/*****************************************************/ + /** * RIL_REQUEST_QUERY_CLIP * @@ -698,3 +706,39 @@ error: exit: at_response_free(atresponse); } + +void onResetModemStateServices(int resetState) +{ + /* NOTE: Function is called in DEFAULT queueRunner context! */ + + LOGI("%s() starting", __func__); + + switch (resetState) { + case RESET_START: + /* + * Issued prior to AT channels are recreated and shall therefore NOT + * initiate modem communication! + * -> Reset any internal static state variables and report to Android if + * nessasary. + */ + break; + case RESET_AT_INITIALIZED: + /* + * Issued when AT channels are available and before SIM is booted and + * unlocked. + * -> Re-setup modem and Android with internal static state variables + * which cannot be reset after modem restart. + */ + break; + case RESET_SIM_READY: + /* + * Issued after SIM is unlocked. + * -> Re-setup modem with internal static state variables which + * cannot be reset before SIM is unlocked. + */ + break; + default: + LOGE("%s() received unknown resetState. Fatal error!", __func__); + assert(0); + } +} diff --git a/u300-ril-services.h b/u300-ril-services.h index de89bc7..924bca7 100644 --- a/u300-ril-services.h +++ b/u300-ril-services.h @@ -40,4 +40,5 @@ void requestSetSuppSvcNotification(void *data, size_t datalen, void onSuppServiceNotification(const char *s, int type); void onUSSDReceived(const char *s); +void onResetModemStateServices(int resetState); #endif diff --git a/u300-ril-sim.c b/u300-ril-sim.c index 1d74a91..b1fca5b 100644 --- a/u300-ril-sim.c +++ b/u300-ril-sim.c @@ -71,6 +71,37 @@ typedef enum { SIM_PUK2_PERM_BLOCKED = 20 /* PUK2 is permanently blocked */ } SIM_Status; +enum PIN_PUK_Verification { + SIM_PIN_VERIFICATION = 1, + SIM_PIN2_VERIFICATION = 2, + SIM_PUK_VERIFICATION = 3, + SIM_PUK2_VERIFICATION = 4 +}; + +typedef enum { + UICC_TYPE_UNKNOWN, + UICC_TYPE_SIM, + UICC_TYPE_USIM, +} UICC_Type; + +/*****************************************************/ +/* Controlled static state variables - section start */ +/*****************************************************/ +#define __s_UiccType UICC_TYPE_UNKNOWN +static UICC_Type s_UiccType = __s_UiccType; + +#define __s_logicalChannel 0 +static int s_logicalChannel = __s_logicalChannel; + +#define __s_cachedPath '\0' +static char s_cachedPath[4 * 10 + 1] = {__s_cachedPath}; + +#define __s_cachedFileid -1 +static unsigned short s_cachedFileid = __s_cachedFileid; +/*****************************************************/ +/* Controlled static state variables - section end */ +/*****************************************************/ + /* * The following list contains values for the structure "RIL_AppStatus" to be * sent to Android on a given SIM state. It is indexed by the SIM_Status above. @@ -253,19 +284,6 @@ static const RIL_AppStatus app_status_array[] = { } }; -enum PIN_PUK_Verification { - SIM_PIN_VERIFICATION = 1, - SIM_PIN2_VERIFICATION = 2, - SIM_PUK_VERIFICATION = 3, - SIM_PUK2_VERIFICATION = 4 -}; - -typedef enum { - UICC_TYPE_UNKNOWN, - UICC_TYPE_SIM, - UICC_TYPE_USIM, -} UICC_Type; - static const struct timeval TIMEVAL_SIMPOLL = { 1, 0 }; static const struct timeval TIMEVAL_SIMRESET = { 60, 0 }; @@ -590,19 +608,18 @@ exit: static UICC_Type getUICCType() { ATResponse *atresponse = NULL; - static UICC_Type UiccType = UICC_TYPE_UNKNOWN; /* FIXME: Static variable */ int err; char *line = NULL; char *dir = NULL; if (getCurrentState() == RADIO_STATE_OFF || getCurrentState() == RADIO_STATE_UNAVAILABLE) { - UiccType = UICC_TYPE_UNKNOWN; + s_UiccType = UICC_TYPE_UNKNOWN; goto exit; } /* No need to get type again, it is stored */ - if (UiccType != UICC_TYPE_UNKNOWN) + if (s_UiccType != UICC_TYPE_UNKNOWN) goto exit; /* AT+CUAD will respond with the contents of the EF_DIR file on the SIM */ @@ -627,25 +644,25 @@ static UICC_Type getUICCType() goto error; if (strstr(dir, "A000000087") != NULL) { - UiccType = UICC_TYPE_USIM; + s_UiccType = UICC_TYPE_USIM; LOGI("Detected card type USIM - stored"); goto finally; } } - UiccType = UICC_TYPE_SIM; + s_UiccType = UICC_TYPE_SIM; LOGI("Detected card type SIM - stored"); goto finally; error: - UiccType = UICC_TYPE_UNKNOWN; + s_UiccType = UICC_TYPE_UNKNOWN; LOGW("%s(): Failed to detect card type - Retry at next request", __func__); finally: at_response_free(atresponse); exit: - return UiccType; + return s_UiccType; } /** @@ -770,11 +787,10 @@ void requestGetSimStatus(void *data, size_t datalen, RIL_Token t) static int simIOGetLogicalChannel() { ATResponse *atresponse = NULL; - static int g_lc = 0; char *cmd = NULL; int err = 0; - if (g_lc == 0) { + if (s_logicalChannel == 0) { struct tlv tlvApp, tlvAppId; char *line; char *resp; @@ -834,7 +850,7 @@ static int simIOGetLogicalChannel() if (err < 0) goto error; - err = at_tok_nextint(&line, &g_lc); + err = at_tok_nextint(&line, &s_logicalChannel); if (err < 0) goto error; } @@ -842,7 +858,7 @@ static int simIOGetLogicalChannel() finally: at_response_free(atresponse); free(cmd); - return g_lc; + return s_logicalChannel; error: goto finally; @@ -911,8 +927,6 @@ static int simIOSelectPath(const char *path, unsigned short fileid) int err = 0; size_t path_len = 0; size_t pos; - static char cashed_path[4 * 10 + 1] = {0}; - static unsigned short cashed_fileid = 0; if (path == NULL) { path = "3F00"; @@ -924,7 +938,7 @@ static int simIOSelectPath(const char *path, unsigned short fileid) goto error; } - if ((fileid != cashed_fileid) || (strcmp(path, cashed_path) != 0)) { + if ((fileid != s_cachedFileid) || (strcmp(path, s_cachedPath) != 0)) { for (pos = 0; pos < path_len; pos += 4) { unsigned val; if (sscanf(&path[pos], "%4X", &val) != 1) { @@ -937,12 +951,12 @@ static int simIOSelectPath(const char *path, unsigned short fileid) } err = simIOSelectFile(fileid); } - if (path_len < sizeof(cashed_path)) { - strcpy(cashed_path, path); - cashed_fileid = fileid; + if (path_len < sizeof(s_cachedPath)) { + strcpy(s_cachedPath, path); + s_cachedFileid = fileid; } else { - cashed_path[0] = 0; - cashed_fileid = 0; + s_cachedPath[0] = __s_cachedPath; + s_cachedFileid = __s_cachedFileid; } finally: @@ -2253,3 +2267,64 @@ void setupECCList(int check_attached_network) } } } + +void onResetModemStateSim(int resetState) +{ + /* NOTE: Function is called in DEFAULT queueRunner context! */ + + LOGI("%s() starting", __func__); + + switch (resetState) { + case RESET_START: + /* + * Issued prior to AT channels are recreated and shall therefore NOT + * initiate modem communication! + * -> Reset any internal static state variables and report to Android if + * nessasary. + */ + /** s_UiccType */ + s_UiccType = __s_UiccType; + /** s_logicalChannel */ + s_logicalChannel = __s_logicalChannel; + /** s_cachedPath */ + s_cachedPath[0] = __s_cachedPath; + /** s_cachedFileid */ + s_cachedFileid = __s_cachedFileid; + break; + case RESET_AT_INITIALIZED: + /* + * Issued when AT channels are available and before SIM is booted and + * unlocked. + * -> Re-setup modem and Android with internal static state variables + * which cannot be reset after modem restart. + */ + /** s_UiccType */ + /* TODO: update sim status to android? */ + /* No impact */ + /** s_logicalChannel */ + /* No impact */ + /** s_cachedPath */ + /* No impact */ + /** s_cachedFileid */ + /* No impact */ + break; + case RESET_SIM_READY: + /* + * Issued after SIM is unlocked. + * -> Re-setup modem with internal static state variables which + * cannot be reset before SIM is unlocked. + */ + /** s_UiccType */ + /* No impact */ + /** s_logicalChannel */ + /* No impact */ + /** s_cachedPath */ + /* No impact */ + /** s_cachedFileid */ + /* No impact */ + break; + default: + LOGE("%s() received unknown resetState. Fatal error!", __func__); + assert(0); + } +} diff --git a/u300-ril-sim.h b/u300-ril-sim.h index 907a01a..69fea53 100644 --- a/u300-ril-sim.h +++ b/u300-ril-sim.h @@ -43,4 +43,5 @@ void pollSIMState(void *param); void setupECCList(int check_attached_network); +void onResetModemStateSim(int resetState); #endif diff --git a/u300-ril-stk.c b/u300-ril-stk.c index 3e3414d..366d94a 100644 --- a/u300-ril-stk.c +++ b/u300-ril-stk.c @@ -24,10 +24,12 @@ #include <stdio.h> #include <string.h> +#include <stdbool.h> +#include <assert.h> +#include <telephony/ril.h> #include "atchannel.h" #include "at_tok.h" #include "misc.h" -#include <telephony/ril.h> #include "u300-ril.h" #define LOG_TAG "RILV" @@ -50,7 +52,20 @@ typedef struct { int Result; } REFRESH_Status; -static REFRESH_Status s_refeshStatus = {-1,-1,-1}; +/*****************************************************/ +/* Controlled static state variables - section start */ +/*****************************************************/ +#define __s_refeshStatus -1 +static REFRESH_Status s_refeshStatus = {__s_refeshStatus, + __s_refeshStatus, + __s_refeshStatus}; + +#define __s_StkIsRunning 0 +static bool s_StkIsRunning = __s_StkIsRunning; + +/*****************************************************/ +/* Controlled static state variables - section end */ +/*****************************************************/ /** * RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE @@ -188,15 +203,11 @@ exit: return; } -/** - * RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING - * - * Turn on STK unsol commands. - */ -void requestReportStkServiceIsRunning(void *data, size_t datalen, RIL_Token t) +static bool reportStkServiceIsRunning(void) { char *cmd = NULL; int err; + bool res = true; ATResponse *atresponse = NULL; /* @@ -299,16 +310,31 @@ void requestReportStkServiceIsRunning(void *data, size_t datalen, RIL_Token t) LOGE("%s(): Failed to activate (U)SAT profile", __func__); goto error; } - - RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); goto exit; error: - RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); + LOGE("%s() failed initiating STK service", __func__); + res = false; exit: at_response_free(atresponse); - return; + return res; +} + +/** + * RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING + * + * Turn on STK unsol commands. + */ +void requestReportStkServiceIsRunning(void *data, size_t datalen, RIL_Token t) +{ + if (reportStkServiceIsRunning()) { + /* store STK service state in case of later modem restart */ + s_StkIsRunning = true; + RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); + } else { + RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); + } } /** @@ -608,3 +634,56 @@ exit: free(line); return; } + +void onResetModemStateStk(int resetState) +{ + /* NOTE: Function is called in DEFAULT queueRunner context! */ + + LOGI("%s() starting", __func__); + + switch (resetState) { + case RESET_START: + /* + * Issued prior to AT channels are recreated and shall therefore NOT + * initiate modem communication! + * -> Reset any internal static state variables and report to Android if + * nessasary. + */ + /** s_refeshStatus */ + memset(&s_refeshStatus, __s_refeshStatus, sizeof(s_refeshStatus)); + + /** s_StkIsRunning */ + /* No impact */ + break; + case RESET_AT_INITIALIZED: + /* + * Issued when AT channels are available and before SIM is booted and + * unlocked. + * -> Re-setup modem and Android with internal static state variables + * which cannot be reset after modem restart. + */ + /** s_refeshStatus */ + /* TODO */ + + /** s_StkIsRunning */ + /* if received initiate modem again immediatly */ + if (s_StkIsRunning) + reportStkServiceIsRunning(); + break; + case RESET_SIM_READY: + /* + * Issued after SIM is unlocked. + * -> Re-setup modem with internal static state variables which + * cannot be reset before SIM is unlocked. + */ + /** s_refeshStatus */ + /* TODO */ + + /** s_StkIsRunning */ + /* No impact */ + break; + default: + LOGE("%s() received unknown resetState. Fatal error!", __func__); + assert(0); + } +} diff --git a/u300-ril-stk.h b/u300-ril-stk.h index 82b16e3..31a3d7f 100644 --- a/u300-ril-stk.h +++ b/u300-ril-stk.h @@ -39,5 +39,5 @@ void onStkProactiveCommand(const char *s); void onStkSimRefresh(const char *s); void onStkEventNotify(const char *s); - +void onResetModemStateStk(int resetState); #endif @@ -107,13 +107,23 @@ char ril_iface[MAX_IFNAME_LEN] = ""; const struct RIL_Env *s_rilenv; static RIL_RadioState s_state = RADIO_STATE_UNAVAILABLE; -static int s_restrictedState = RIL_RESTRICTED_STATE_NONE; +static int s_queueRuns = 0; + +/*****************************************************/ +/* Controlled static state variables - section start */ +/*****************************************************/ +#define __s_restrictedState RIL_RESTRICTED_STATE_NONE +static int s_restrictedState = __s_restrictedState; + +#define __s_screenState true +static bool s_screenState = __s_screenState; +/*****************************************************/ +/* Controlled static state variables - section end */ +/*****************************************************/ static pthread_mutex_t s_state_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t s_screen_state_mutex = PTHREAD_MUTEX_INITIALIZER; -static bool s_screenState = true; - static RequestQueue s_requestQueueDefault = { .queueMutex = PTHREAD_MUTEX_INITIALIZER, .cond = PTHREAD_COND_INITIALIZER, @@ -156,6 +166,81 @@ static RILRequestGroup RILRequestGroups[] = { {CMD_QUEUE_AUXILIARY, "AUXILIARY", NULL, &s_requestQueueAuxiliary} }; +/** + * This is a reference implementation of reset of modem state information. + * All files/categories must implement a version of this to handle reset + * notificaitons. + */ +static void onResetModemStateRil(int resetState) +{ + /* NOTE: Function is called in DEFAULT queueRunner context! */ + + LOGI("%s() starting", __func__); + + switch (resetState) { + case RESET_START: + /* + * Issued prior to AT channels are recreated and shall therefore NOT + * initiate modem communication! + * -> Reset any internal static state variables and report to Android if + * nessasary. + */ + /** s_restrictedState */ + /* Reset and reported to Android */ + s_restrictedState = __s_restrictedState; + RIL_onUnsolicitedResponse(RIL_UNSOL_RESTRICTED_STATE_CHANGED, + &s_restrictedState, sizeof(int *)); + + /** s_screenState */ + /* Survive modem restart - Not reported to Android */ + break; + case RESET_AT_INITIALIZED: + /* + * Issued when AT channels are available and before SIM is booted and + * available. + * -> Re-setup modem and Android with internal static state variables + * which cannot be reset after modem restart. + */ + /** s_restrictedState */ + /* No impact */ + + /** s_screenState */ + /* Update modem based on state */ + if(!changeScreenState(s_screenState)) + LOGW("%s() failed to issue screenstate change", __func__); + break; + case RESET_SIM_READY: + /* + * Issued after SIM is unlocked. + * -> Re-setup modem with internal static state variables which + * cannot be reset before SIM is unlocked. + */ + /** s_restrictedState */ + /* No impact */ + + /** s_screenState */ + /* No impact */ + break; + default: + LOGE("%s() received unknown resetState. Fatal error!", __func__); + assert(0); + } +} + +static void resetModemState(int resetState) +{ + onResetModemStateRil(resetState); + onResetModemStateAudio(resetState); + onResetModemStateCallHandling(resetState); + onResetModemStateInformation(resetState); + onResetModemStateMessaging(resetState); + onResetModemStateNetwork(resetState); + onResetModemStatePdp(resetState); + onResetModemStateServices(resetState); + onResetModemStateSim(resetState); + onResetModemStateStk(resetState); +} + void enqueueRILEventOnList(RequestQueue* q, RILEvent* e) { int err; @@ -442,6 +527,11 @@ static void onSIMReady() if (at_send_command("AT*EMIBRR=2,2", NULL) < 0) LOGW("%s(): Failed to send AT*EMIBRR", __func__); + /* In case of modem restart do a reset on internal RIL state */ + /* TODO: more protection for not running mulitple times if reenter? */ + if (s_queueRuns > 1) + resetModemState(RESET_SIM_READY); + /* * To prevent Gsm/Cdma-ServiceStateTracker.java from polling RIL * with numerous RIL_REQUEST_SIGNAL_STRENGTH after power on @@ -526,7 +616,7 @@ static const RIL_CardStatus staticSimStatus = { .num_applications = 0 }; -static bool requestStateFilter(int request, RIL_Token t) +static bool requestStateFilter(int request, void *data, RIL_Token t) { /* * These commands will not accept RADIO_NOT_AVAILABLE and cannot be executed @@ -556,7 +646,9 @@ static bool requestStateFilter(int request, RIL_Token t) * command while in RADIO_STATE_UNAVAILABLE. */ else if (request == RIL_REQUEST_SCREEN_STATE) { - RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); + if (data != NULL) + setScreenState(((bool *) data)[0]); + RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); } /* Ignore all other requests when RADIO_STATE_UNAVAILABLE */ else { @@ -646,7 +738,7 @@ static void processRequest(int request, void *data, size_t datalen, { LOGI("processRequest: %s", requestToString(request)); - if (requestStateFilter(request, t)) + if (requestStateFilter(request, data, t)) goto finally; switch (request) { @@ -950,7 +1042,7 @@ static void onRequest(int request, void *data, size_t datalen, RIL_Token t) /* In radio state unavailable no requests are to enter the queues */ if (s_state == RADIO_STATE_UNAVAILABLE) { - (void)requestStateFilter(request, t); + (void)requestStateFilter(request, data, t); goto finally; } @@ -1276,6 +1368,13 @@ static bool initializeDefault() LOGI("%s()", __func__); + /* Record how many times queueRunners have been started */ + s_queueRuns++; + + /* TODO: should be executed from Manager before queueRunner starts */ + if (s_queueRuns > 1) + resetModemState(RESET_START); + /* * Set phone functionality. * 4 = Disable the phone's transmit and receive RF circuits. @@ -1389,6 +1488,10 @@ static bool initializeDefault() else LOGI("[ECC]: SIM is absent, keeping default ECCs"); + /* In case of modem restart do a reset on internal RIL state */ + if (s_queueRuns > 1) + resetModemState(RESET_AT_INITIALIZED); + return true; error: @@ -1856,7 +1959,7 @@ void *queueRunner(void *param) while (q != NULL && q->requestList != NULL) { r = q->requestList; q->requestList = r->next; - if(!requestStateFilter(r->request, r->token)) { + if(!requestStateFilter(r->request, r->data, r->token)) { LOGE("%s() tried to send immidiate response to request but it was " "not stopped by filter. Undefined behavior expected! Error!", __func__); @@ -116,4 +116,20 @@ enum RequestGroups { CMD_QUEUE_AUXILIARY = 1 }; +enum ResetModemStates { + RESET_START, /* Issued prior to AT channels are recreated and shall + * therefore NOT initiate modem communication! + * -> Reset any internal static state variables and + * report to Android if nessasary. */ + RESET_AT_INITIALIZED, /* Issued when AT channels are available and before + * SIM is booted and unlocked. + * -> Re-setup modem and Android with internal static + * state variables which cannot be reset after + * modem restart. */ + RESET_SIM_READY /* Issued after SIM is unlocked. + * -> Re-setup modem with internal static state + * variables which cannot be reset before SIM is + * unlocked. */ +}; + #endif |