summaryrefslogtreecommitdiffstats
path: root/sat.c
diff options
context:
space:
mode:
authorPaulK <contact@paulk.fr>2011-12-21 21:54:03 +0100
committerPaulK <contact@paulk.fr>2011-12-21 21:54:03 +0100
commit0091ceae5f7cbeeb42e3b43de3dcf8e500fe8752 (patch)
treedff5b107e7c51dcbb71d636fd6189d3570881a39 /sat.c
parentcb295e0a15c8bc5087a542f25bc369aecbecde80 (diff)
downloadhardware_replicant_libsamsung-ril-0091ceae5f7cbeeb42e3b43de3dcf8e500fe8752.tar.gz
hardware_replicant_libsamsung-ril-0091ceae5f7cbeeb42e3b43de3dcf8e500fe8752.tar.bz2
hardware_replicant_libsamsung-ril-0091ceae5f7cbeeb42e3b43de3dcf8e500fe8752.zip
RIL rework: multi-client, more stable, added GPLv3 copyright notice
Diffstat (limited to 'sat.c')
-rw-r--r--sat.c61
1 files changed, 39 insertions, 22 deletions
diff --git a/sat.c b/sat.c
index 7dce03a..8523004 100644
--- a/sat.c
+++ b/sat.c
@@ -1,27 +1,44 @@
+/**
+ * This file is part of samsung-ril.
+ *
+ * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
+ * Copyright (C) 2011 Paul Kocialkowski <contact@oaulk.fr>
+ *
+ * samsung-ril is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * samsung-ril is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with samsung-ril. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
#define LOG_TAG "RIL-SAT"
#include <utils/Log.h>
#include "samsung-ril.h"
#include "util.h"
-extern const struct RIL_Env *rilenv;
-extern struct radio_state radio;
-extern struct ipc_client *ipc_client;
-
/**
* In: IPC_SAT_PROACTIVE_CMD
* STK proactive command
*
* Out: RIL_UNSOL_STK_PROACTIVE_COMMAND
*/
-void respondSatProactiveCmdIndi(struct ipc_message_info *request)
+void respondSatProactiveCmdIndi(struct ipc_message_info *info)
{
- int data_len = (request->length-2);
+ int data_len = (info->length-2);
char *hexdata;
hexdata = (char*)malloc(data_len*2+1);
- bin2hex((unsigned char*)request->data+2, data_len, hexdata);
+ bin2hex((unsigned char*)info->data+2, data_len, hexdata);
RIL_onUnsolicitedResponse(RIL_UNSOL_STK_PROACTIVE_COMMAND, hexdata, sizeof(char*));
@@ -34,12 +51,12 @@ void respondSatProactiveCmdIndi(struct ipc_message_info *request)
*
* Out: RIL_UNSOL_STK_SESSION_END
*/
-void respondSatProactiveCmdResp(struct ipc_message_info *request)
+void respondSatProactiveCmdResp(struct ipc_message_info *info)
{
unsigned char sw1, sw2;
- sw1 = ((unsigned char*)request->data)[0];
- sw2 = ((unsigned char*)request->data)[1];
+ sw1 = ((unsigned char*)info->data)[0];
+ sw2 = ((unsigned char*)info->data)[1];
if(sw1 == 0x90 && sw2 == 0x00) {
RIL_onUnsolicitedResponse(RIL_UNSOL_STK_SESSION_END, NULL, 0);
@@ -51,14 +68,14 @@ void respondSatProactiveCmdResp(struct ipc_message_info *request)
/**
* Proactive command indi/resp helper function
*/
-void respondSatProactiveCmd(struct ipc_message_info *request)
+void respondSatProactiveCmd(struct ipc_message_info *info)
{
- if(request->type == IPC_TYPE_INDI) {
- respondSatProactiveCmdIndi(request);
- } else if(request->type == IPC_TYPE_RESP) {
- respondSatProactiveCmdResp(request);
+ if(info->type == IPC_TYPE_INDI) {
+ respondSatProactiveCmdIndi(info);
+ } else if(info->type == IPC_TYPE_RESP) {
+ respondSatProactiveCmdResp(info);
} else {
- LOGE("%s: unhandled proactive command response type %d", __FUNCTION__, request->type);
+ LOGE("%s: unhandled proactive command response type %d", __FUNCTION__, info->type);
}
}
@@ -84,7 +101,7 @@ void requestSatSendTerminalResponse(RIL_Token t, void *data, size_t datalen)
buf[0] = len;
hex2bin(data, strlen(data), &buf[1]);
- ipc_client_send(ipc_client, IPC_SAT_PROACTIVE_CMD, IPC_TYPE_GET, buf, sizeof(buf), getRequestId(t));
+ ipc_fmt_send(IPC_SAT_PROACTIVE_CMD, IPC_TYPE_GET, buf, sizeof(buf), reqGetId(t));
RIL_onRequestComplete(t, RIL_E_SUCCESS, buf, sizeof(char*));
}
@@ -111,7 +128,7 @@ void requestSatSendEnvelopeCommand(RIL_Token t, void *data, size_t datalen)
buf[0] = len;
hex2bin(data, strlen(data), &buf[1]);
- ipc_client_send(ipc_client, IPC_SAT_ENVELOPE_CMD, IPC_TYPE_EXEC, buf, sizeof(buf), getRequestId(t));
+ ipc_fmt_send(IPC_SAT_ENVELOPE_CMD, IPC_TYPE_EXEC, buf, sizeof(buf), reqGetId(t));
}
/**
@@ -121,16 +138,16 @@ void requestSatSendEnvelopeCommand(RIL_Token t, void *data, size_t datalen)
* Requests to send a SAT/USAT envelope command to SIM.
* The SAT/USAT envelope command refers to 3GPP TS 11.14 and 3GPP TS 31.111
*/
-void respondSatEnvelopeCmd(struct ipc_message_info *request)
+void respondSatEnvelopeCmd(struct ipc_message_info *info)
{
- int data_len = (request->length-2);
+ int data_len = (info->length-2);
char *hexdata;
hexdata = (char*)malloc(data_len*2+1);
- bin2hex((unsigned char*)request->data+2, data_len, hexdata);
+ bin2hex((unsigned char*)info->data+2, data_len, hexdata);
- RIL_onRequestComplete(getToken(request->aseq), RIL_E_SUCCESS, hexdata, sizeof(char*));
+ RIL_onRequestComplete(reqGetToken(info->aseq), RIL_E_SUCCESS, hexdata, sizeof(char*));
free(hexdata);
}