diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-09-15 12:03:02 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-09-15 12:03:02 -0500 |
commit | 41a55beef311182b58822061b14be5e478bcc932 (patch) | |
tree | a964b755b8cf87273b5616886546d16edd862352 /src/stk.c | |
parent | d966b6593bf95aa059b65ced177632535568d810 (diff) | |
download | ofono-41a55beef311182b58822061b14be5e478bcc932.tar.bz2 |
stk: Refactor Send USSD error handling
Diffstat (limited to 'src/stk.c')
-rw-r--r-- | src/stk.c | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -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; } } |