aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSverre Vegge <sverre.vegge@stericsson.com>2010-11-09 14:04:16 +0100
committerSverre Vegge <sverre.vegge@stericsson.com>2010-11-28 22:03:57 +0100
commit84cb659a15f5d8101e5dc4b73b6671ee2fcf03ec (patch)
tree147aadefbfb3a1e2b69c79264869d56c3cd0cb19
parent426309fc996d4b3b3560b6fca8fe4b5accf60ce7 (diff)
downloadu300-84cb659a15f5d8101e5dc4b73b6671ee2fcf03ec.tar.gz
Call handling: Report FDN check failure to Android.
Messaging: Report FDN check failure to Android. Signed-off-by: Sverre Vegge <sverre.vegge@stericsson.com>
-rw-r--r--atchannel.h2
-rw-r--r--u300-ril-callhandling.c58
-rw-r--r--u300-ril-messaging.c39
3 files changed, 96 insertions, 3 deletions
diff --git a/atchannel.h b/atchannel.h
index 49fa40f..b13c948 100644
--- a/atchannel.h
+++ b/atchannel.h
@@ -104,6 +104,7 @@ typedef enum {
CME_PDP_AUTHENTICATION_FAILURE = 149,
CME_INVALID_MOBILE_CLASS = 150,
CME_PH_SIMLOCK_PIN_REQUIRED_NOTE = 200,
+ CME_PRE_DIAL_CHECK_ERROR = 350,
} ATCmeError;
typedef enum {
@@ -173,6 +174,7 @@ typedef enum {
CMS_NO_NETWORK_SERVICE = 331,
CMS_NETWORK_TIMEOUT = 332,
CMS_NO_CNMA_ACKNOWLEDGEMENT_EXPECTED = 340,
+ CMS_PRE_DIAL_CHECK_ERROR = 350,
CMS_UNKNOWN_ERROR = 500,
CMS_CMS_OK = 999,
} ATCmsError;
diff --git a/u300-ril-callhandling.c b/u300-ril-callhandling.c
index e03c0b9..797751f 100644
--- a/u300-ril-callhandling.c
+++ b/u300-ril-callhandling.c
@@ -754,6 +754,53 @@ void requestGetCurrentCalls(void *data, size_t datalen, RIL_Token t)
return;
}
+/*
+ * Returns: 0 if pre-dial check did not fail or FDN is not enabled
+ * 1 if pre-dial check failed and FDN is enabled
+ */
+static int checkForFdnFailure(void)
+{
+ int err = -1;
+ int status = 0;
+ char *line = NULL;
+ ATResponse *atresponse = NULL;
+ ATCmeError cme_error_code;
+
+ /*
+ * If pre-dial check has failed and FDN is enabled we conclude that the
+ * reason for failed pre-dial check is that the number is not in the
+ * FDN list.
+ */
+ err = at_send_command_multiline("AT+CLCK=\"FD\",2", "+CLCK:", &atresponse);
+ if (err < 0 || atresponse->success == 0)
+ goto error;
+
+ line = atresponse->p_intermediates->line;
+
+ err = at_tok_start(&line);
+ if (err < 0)
+ goto error;
+
+ /* status = 1 means that FDN facility is active */
+ err = at_tok_nextint(&line, &status);
+ if (err < 0 )
+ goto error;
+
+ if (!at_get_cme_error(atresponse, &cme_error_code))
+ goto error;
+
+ if ((cme_error_code != CME_PRE_DIAL_CHECK_ERROR) || (status != 1))
+ status = 0;
+
+finally:
+ at_response_free(atresponse);
+ return status;
+
+error:
+ status = 0;
+ goto finally;
+}
+
/**
* RIL_REQUEST_DIAL
*
@@ -791,8 +838,10 @@ void requestDial(void *data, size_t datalen, RIL_Token t)
if (err < 0 || atresponse->success == 0)
goto error;
- /* Success or failure is ignored by the upper layer here,
- it will call GET_CURRENT_CALLS and determine success that way. */
+ /*
+ * Success or failure is ignored by the upper layer here,
+ * it will call GET_CURRENT_CALLS and determine success that way.
+ */
RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
finally:
@@ -804,7 +853,10 @@ error:
* Android will ask for last call fail cause even if RIL_REQUEST_DIAL
* returns GENERIC_FAILURE.
*/
- s_lastCallFailCause = CALL_FAIL_ERROR_UNSPECIFIED;
+ if (checkForFdnFailure())
+ s_lastCallFailCause = CALL_FAIL_FDN_BLOCKED;
+ else
+ s_lastCallFailCause = CALL_FAIL_ERROR_UNSPECIFIED;
RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
goto finally;
diff --git a/u300-ril-messaging.c b/u300-ril-messaging.c
index dfba6ac..5f27249 100644
--- a/u300-ril-messaging.c
+++ b/u300-ril-messaging.c
@@ -377,6 +377,40 @@ error:
goto finally;
}
+/*
+ * Returns: 0 if FDN is not enabled
+ * 1 if FDN is enabled
+ */
+static int isFdnEnabled(void)
+{
+ int err = -1;
+ int status = 0;
+ char *line = NULL;
+ ATResponse *atresponse = NULL;
+
+ err = at_send_command_multiline("AT+CLCK=\"FD\",2", "+CLCK:", &atresponse);
+ if (err < 0 || atresponse->success == 0)
+ goto finally;
+
+ line = atresponse->p_intermediates->line;
+
+ err = at_tok_start(&line);
+ if (err < 0)
+ goto finally;
+
+ err = at_tok_nextint(&line, &status);
+ if (err < 0 )
+ goto finally;
+
+ /* status = 1 means that FDN facility is active */
+ if (status != 1)
+ status = 0;
+
+finally:
+ at_response_free(atresponse);
+ return status;
+}
+
/**
* RIL_REQUEST_SEND_SMS
*
@@ -421,6 +455,11 @@ void requestSendSMS(void *data, size_t datalen, RIL_Token t)
case CMS_NO_NETWORK_SERVICE:
ret = RIL_E_SMS_SEND_FAIL_RETRY;
break;
+ case CMS_PRE_DIAL_CHECK_ERROR:
+ /* failing pre-dial check may indicate FDN check failure */
+ if (isFdnEnabled())
+ ret = RIL_E_FDN_CHECK_FAILURE;
+ break;
default:
break;
}