aboutsummaryrefslogtreecommitdiffstats
path: root/sap
diff options
context:
space:
mode:
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>2011-11-07 15:56:43 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2011-11-10 10:24:13 +0200
commita5c10fdea5a4631ce4d9ac4c213b40dcc2ab01c0 (patch)
tree991ba50a96d5a74ab034a0f30382219142ce969f /sap
parent54e4ac2d6a91a862c774b0001870415ac424f839 (diff)
downloadbluez-a5c10fdea5a4631ce4d9ac4c213b40dcc2ab01c0.tar.gz
bluez-a5c10fdea5a4631ce4d9ac4c213b40dcc2ab01c0.tar.xz
bluez-a5c10fdea5a4631ce4d9ac4c213b40dcc2ab01c0.zip
SAP: Add support for handle ongoing call
With this patch support for handling connect request during ongoing call is added.
Diffstat (limited to 'sap')
-rw-r--r--sap/sap-u8500.c54
1 files changed, 45 insertions, 9 deletions
diff --git a/sap/sap-u8500.c b/sap/sap-u8500.c
index dadea298..e699fd76 100644
--- a/sap/sap-u8500.c
+++ b/sap/sap-u8500.c
@@ -78,7 +78,8 @@ enum ste_protocol {
STE_GET_ATR_RSP = 0x2E07,
STE_GET_STATUS_REQ = 0x2D08,
STE_GET_STATUS_RSP = 0x2E08,
- STE_STATUS_IND = 0x2F02
+ STE_STATUS_IND = 0x2F02,
+ STE_SIM_READY_IND = 0x2F03,
};
enum ste_msg {
@@ -94,6 +95,7 @@ enum ste_msg {
enum ste_status {
STE_STATUS_OK = 0x00000000,
STE_STATUS_FAILURE = 0x00000001,
+ STE_STATUS_BUSY_CALL = 0x00000002,
};
enum ste_card_status {
@@ -118,6 +120,7 @@ enum ste_state {
STE_POWERED_OFF, /* Card in the reader but powered off */
STE_NO_CARD, /* No card in the reader */
STE_ENABLED, /* Card in the reader and powered on */
+ STE_SIM_BUSY, /* Modem is busy with ongoing call.*/
STE_STATE_MAX
};
@@ -377,6 +380,42 @@ static void simd_close(void)
u8500.sap_data = NULL;
}
+static void recv_sim_ready()
+{
+ sap_info("sim is ready. Try to connect again");
+
+ if (send_request(u8500.io, STE_START_SAP_REQ, NULL) < 0) {
+ sap_connect_rsp(u8500.sap_data, SAP_STATUS_CONNECTION_FAILED,
+ SAP_BUF_SIZE);
+ simd_close();
+ }
+}
+
+static void recv_connect_rsp(uint32_t status)
+{
+ switch (status) {
+ case STE_STATUS_OK:
+ if (u8500.state != STE_SIM_BUSY)
+ sap_connect_rsp(u8500.sap_data,
+ SAP_STATUS_OK, 0);
+ break;
+ case STE_STATUS_BUSY_CALL:
+ if (u8500.state != STE_SIM_BUSY) {
+ sap_connect_rsp(u8500.sap_data,
+ SAP_STATUS_OK_ONGOING_CALL,
+ SAP_BUF_SIZE);
+
+ u8500.state = STE_SIM_BUSY;
+ }
+ break;
+ default:
+ sap_connect_rsp(u8500.sap_data,
+ SAP_STATUS_CONNECTION_FAILED, 0);
+ simd_close();
+ break;
+ }
+}
+
static void recv_response(struct ste_message *msg)
{
uint32_t status;
@@ -398,15 +437,8 @@ static void recv_response(struct ste_message *msg)
switch (msg->id) {
case STE_START_SAP_RSP:
- if (status == STE_STATUS_OK) {
- sap_connect_rsp(u8500.sap_data, SAP_STATUS_OK, 0);
- } else {
- sap_connect_rsp(u8500.sap_data,
- SAP_STATUS_CONNECTION_FAILED, 0);
- simd_close();
- }
+ recv_connect_rsp(status);
break;
-
case STE_SEND_APDU_RSP:
recv_pdu(STE_SEND_APDU_MSG, msg, status, param,
sap_transfer_apdu_rsp);
@@ -440,6 +472,10 @@ static void recv_response(struct ste_message *msg)
recv_status(status);
break;
+ case STE_SIM_READY_IND:
+ recv_sim_ready();
+ break;
+
default:
sap_error("unsupported message received (id 0x%x)", msg->id);
}