summaryrefslogtreecommitdiffstats
path: root/src/stk.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-09-15 12:03:02 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-09-15 12:03:02 -0500
commit41a55beef311182b58822061b14be5e478bcc932 (patch)
treea964b755b8cf87273b5616886546d16edd862352 /src/stk.c
parentd966b6593bf95aa059b65ced177632535568d810 (diff)
downloadofono-41a55beef311182b58822061b14be5e478bcc932.tar.bz2
stk: Refactor Send USSD error handling
Diffstat (limited to 'src/stk.c')
-rw-r--r--src/stk.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/stk.c b/src/stk.c
index 75da5d11..63b1fd3a 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1637,33 +1637,26 @@ static void send_ussd_callback(int error, int dcs, const unsigned char *msg,
rsp.result.type = STK_RESULT_TYPE_SUCCESS;
rsp.send_ussd.text.text = msg;
rsp.send_ussd.text.len = msg_len;
- } else {
+ rsp.send_ussd.text.has_text = TRUE;
+ } else
rsp.result.type = STK_RESULT_TYPE_USSD_RETURN_ERROR;
- rsp.result.additional = (unsigned char *) &error;
- rsp.result.additional_len = 1;
- rsp.send_ussd.text.dcs = -1;
- }
if (stk_respond(stk, &rsp, stk_command_cb))
stk_command_cb(&failure, stk);
break;
+
case -ECANCELED:
send_simple_response(stk,
STK_RESULT_TYPE_USSD_OR_SS_USER_TERMINATION);
break;
+
case -ETIMEDOUT:
send_simple_response(stk, STK_RESULT_TYPE_NETWORK_UNAVAILABLE);
break;
- default:
- rsp.result.type = STK_RESULT_TYPE_USSD_RETURN_ERROR;
- rsp.result.additional = (unsigned char *) &error;
- rsp.result.additional_len = 1;
- rsp.send_ussd.text.dcs = -1;
-
- if (stk_respond(stk, &rsp, stk_command_cb))
- stk_command_cb(&failure, stk);
+ default:
+ send_simple_response(stk, STK_RESULT_TYPE_USSD_RETURN_ERROR);
break;
}
}