parent
e4a1c59a0b
commit
0d4bbaf7f1
@ -1,177 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
extern "C" |
||||
void *ril_socket_process_requests_loop(void *arg); |
||||
|
||||
#include "RilSocket.h" |
||||
#include <cutils/sockets.h> |
||||
#include <utils/Log.h> |
||||
#include <assert.h> |
||||
#define SOCKET_LISTEN_BACKLOG 0 |
||||
|
||||
int RilSocket::socketInit(void) { |
||||
int ret; |
||||
|
||||
listenCb = &RilSocket::sSocketListener; |
||||
commandCb = &RilSocket::sSocketRequestsHandler; |
||||
listenFd = android_get_control_socket(name); |
||||
|
||||
//Start listening
|
||||
ret = listen(listenFd, SOCKET_LISTEN_BACKLOG); |
||||
|
||||
if (ret < 0) { |
||||
RLOGE("Failed to listen on %s socket '%d': %s", |
||||
name, listenFd, strerror(errno)); |
||||
return ret; |
||||
} |
||||
//Add listen event to the event loop
|
||||
ril_event_set(&listenEvent, listenFd, false, listenCb, this); |
||||
rilEventAddWakeup_helper(&listenEvent); |
||||
return ret; |
||||
} |
||||
|
||||
void RilSocket::sSocketListener(int fd, short flags, void *param) { |
||||
RilSocket *theSocket = (RilSocket *) param; |
||||
MySocketListenParam listenParam; |
||||
listenParam.socket = theSocket; |
||||
listenParam.sListenParam.type = RIL_SAP_SOCKET; |
||||
|
||||
listenCallback_helper(fd, flags, (void*)&listenParam); |
||||
} |
||||
|
||||
void RilSocket::onNewCommandConnect() { |
||||
pthread_attr_t attr; |
||||
PthreadPtr pptr = ril_socket_process_requests_loop; |
||||
int result; |
||||
|
||||
pthread_attr_init(&attr); |
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
||||
|
||||
//Start socket request processing loop thread
|
||||
result = pthread_create(&socketThreadId, &attr, pptr, this); |
||||
if(result < 0) { |
||||
RLOGE("pthread_create failed with result:%d",result); |
||||
} |
||||
|
||||
RLOGE("New socket command connected and socket request thread started"); |
||||
} |
||||
|
||||
void RilSocket::sSocketRequestsHandler(int fd, short flags, void *param) { |
||||
socketClient *sc = (socketClient *) param; |
||||
RilSocket *theSocket = sc->socketPtr; |
||||
RecordStream *rs = sc->rs; |
||||
|
||||
theSocket->socketRequestsHandler(fd, flags, rs); |
||||
} |
||||
|
||||
void RilSocket::socketRequestsHandler(int fd, short flags, RecordStream *p_rs) { |
||||
int ret; |
||||
assert(fd == commandFd); |
||||
void *p_record; |
||||
size_t recordlen; |
||||
|
||||
for (;;) { |
||||
/* loop until EAGAIN/EINTR, end of stream, or other error */ |
||||
ret = record_stream_get_next(p_rs, &p_record, &recordlen); |
||||
|
||||
if (ret == 0 && p_record == NULL) { |
||||
/* end-of-stream */ |
||||
break; |
||||
} else if (ret < 0) { |
||||
break; |
||||
} else if (ret == 0) { |
||||
pushRecord(p_record, recordlen); |
||||
} |
||||
} |
||||
|
||||
if (ret == 0 || !(errno == EAGAIN || errno == EINTR)) { |
||||
/* fatal error or end-of-stream */ |
||||
if (ret != 0) { |
||||
RLOGE("error on reading command socket errno:%d\n", errno); |
||||
} else { |
||||
RLOGW("EOS. Closing command socket."); |
||||
} |
||||
|
||||
close(commandFd); |
||||
commandFd = -1; |
||||
|
||||
ril_event_del(&callbackEvent); |
||||
|
||||
record_stream_free(p_rs); |
||||
|
||||
/* start listening for new connections again */ |
||||
|
||||
rilEventAddWakeup_helper(&listenEvent); |
||||
|
||||
onCommandsSocketClosed(); |
||||
} |
||||
} |
||||
|
||||
void RilSocket::setListenFd(int fd) { |
||||
listenFd = fd; |
||||
} |
||||
|
||||
void RilSocket::setCommandFd(int fd) { |
||||
commandFd = fd; |
||||
} |
||||
|
||||
int RilSocket::getListenFd(void) { |
||||
return listenFd; |
||||
} |
||||
|
||||
int RilSocket::getCommandFd(void) { |
||||
return commandFd; |
||||
} |
||||
|
||||
void RilSocket::setListenCb(ril_event_cb cb) { |
||||
listenCb = cb; |
||||
} |
||||
|
||||
void RilSocket::setCommandCb(ril_event_cb cb) { |
||||
commandCb = cb; |
||||
} |
||||
|
||||
ril_event_cb RilSocket::getListenCb(void) { |
||||
return listenCb; |
||||
} |
||||
|
||||
ril_event_cb RilSocket::getCommandCb(void) { |
||||
return commandCb; |
||||
} |
||||
|
||||
void RilSocket::setListenEvent(ril_event event) { |
||||
listenEvent = event; |
||||
} |
||||
|
||||
void RilSocket::setCallbackEvent(ril_event event) { |
||||
callbackEvent = event; |
||||
} |
||||
|
||||
ril_event* RilSocket::getListenEvent(void) { |
||||
return &listenEvent; |
||||
} |
||||
|
||||
ril_event* RilSocket::getCallbackEvent(void) { |
||||
return &callbackEvent; |
||||
} |
||||
|
||||
extern "C" |
||||
void *ril_socket_process_requests_loop(void *arg) { |
||||
RilSocket *socket = (RilSocket *)arg; |
||||
socket->processRequestsLoop(); |
||||
return NULL; |
||||
} |
@ -1,69 +0,0 @@ |
||||
/* //device/libs/telephony/ril_commands.h
|
||||
** |
||||
** Copyright 2006, The Android Open Source Project |
||||
** |
||||
** Licensed under the Apache License, Version 2.0 (the "License"); |
||||
** you may not use this file except in compliance with the License. |
||||
** You may obtain a copy of the License at |
||||
** |
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** |
||||
** Unless required by applicable law or agreed to in writing, software |
||||
** distributed under the License is distributed on an "AS IS" BASIS, |
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
** See the License for the specific language governing permissions and |
||||
** limitations under the License. |
||||
*/ |
||||
{10000, NULL, NULL}, |
||||
{10001, NULL, NULL}, |
||||
{RIL_REQUEST_GET_CELL_BROADCAST_CONFIG, dispatchVoid, responseVoid}, |
||||
{10003, NULL, NULL}, |
||||
{10004, NULL, NULL}, |
||||
{RIL_REQUEST_SEND_ENCODED_USSD, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SET_PDA_MEMORY_STATUS, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_GET_PHONEBOOK_ENTRY, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_DIAL_VIDEO_CALL, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_CALL_DEFLECTION, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_READ_SMS_FROM_SIM, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_USIM_PB_CAPA, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_LOCK_INFO, dispatchVoid, responseVoid}, |
||||
{10015, NULL, NULL}, |
||||
{RIL_REQUEST_DIAL_EMERGENCY, dispatchDial, responseVoid}, |
||||
{RIL_REQUEST_GET_STOREAD_MSG_COUNT, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_STK_SIM_INIT_EVENT, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_GET_LINE_ID, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SET_LINE_ID, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_GET_SERIAL_NUMBER, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_GET_BARCODE_NUMBER, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SIM_TRANSMIT_BASIC, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SIM_OPEN_CHANNEL, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SIM_CLOSE_CHANNEL, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SIM_TRANSMIT_CHANNEL, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SIM_AUTH, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_PS_ATTACH, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_PS_DETACH, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_ACTIVATE_DATA_CALL, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_CHANGE_SIM_PERSO, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_ENTER_SIM_PERSO, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_GET_TIME_INFO, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_OMADM_SETUP_SESSION, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_OMADM_SERVER_START_SESSION, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_OMADM_CLIENT_START_SESSION, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_OMADM_SEND_DATA, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_CDMA_GET_DATAPROFILE, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_CDMA_SET_DATAPROFILE, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SEND_SMS_COUNT, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SEND_SMS_MSG, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SEND_SMS_MSG_READ_STATUS, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_MODEM_HANGUP, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SET_SIM_POWER, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_SET_PREFERRED_NETWORK_LIST, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_GET_PREFERRED_NETWORK_LIST, dispatchVoid, responseVoid}, |
||||
{RIL_REQUEST_HANGUP_VT, dispatchVoid, responseVoid}, |
@ -1,55 +0,0 @@ |
||||
/* //device/libs/telephony/ril_unsol_commands.h
|
||||
** |
||||
** Copyright 2006, The Android Open Source Project |
||||
** |
||||
** Licensed under the Apache License, Version 2.0 (the "License"); |
||||
** you may not use this file except in compliance with the License. |
||||
** You may obtain a copy of the License at |
||||
** |
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** |
||||
** Unless required by applicable law or agreed to in writing, software |
||||
** distributed under the License is distributed on an "AS IS" BASIS, |
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
** See the License for the specific language governing permissions and |
||||
** limitations under the License. |
||||
*/ |
||||
{SAMSUNG_UNSOL_RESPONSE_BASE, NULL, WAKE_PARTIAL}, |
||||
{RIL_UNSOL_RELEASE_COMPLETE_MESSAGE, responseVoid, WAKE_PARTIAL}, // 11001
|
||||
{RIL_UNSOL_STK_SEND_SMS_RESULT, responseInts, WAKE_PARTIAL}, // 11002
|
||||
{RIL_UNSOL_STK_CALL_CONTROL_RESULT, responseVoid, WAKE_PARTIAL}, // 11003
|
||||
{RIL_UNSOL_DUN_CALL_STATUS, responseVoid, WAKE_PARTIAL}, // 11004
|
||||
{11005, NULL, WAKE_PARTIAL}, |
||||
{11006, NULL, WAKE_PARTIAL}, |
||||
{RIL_UNSOL_O2_HOME_ZONE_INFO, responseVoid, WAKE_PARTIAL}, // 11007
|
||||
{RIL_UNSOL_DEVICE_READY_NOTI, responseVoid, WAKE_PARTIAL}, // 11008
|
||||
{RIL_UNSOL_GPS_NOTI, responseVoid, WAKE_PARTIAL}, // 11009
|
||||
{RIL_UNSOL_AM, responseString, WAKE_PARTIAL}, // 11010
|
||||
{RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL, responseVoid, WAKE_PARTIAL}, // 11011
|
||||
{RIL_UNSOL_DATA_SUSPEND_RESUME, responseInts, WAKE_PARTIAL}, // 11012
|
||||
{RIL_UNSOL_SAP, responseVoid, WAKE_PARTIAL}, // 11013
|
||||
{11014, NULL, WAKE_PARTIAL}, |
||||
{RIL_UNSOL_SIM_SMS_STORAGE_AVAILALE, responseVoid, WAKE_PARTIAL}, // 11015
|
||||
{RIL_UNSOL_HSDPA_STATE_CHANGED, responseVoid, WAKE_PARTIAL}, // 11016
|
||||
{RIL_UNSOL_WB_AMR_STATE, responseInts, WAKE_PARTIAL}, // 11017
|
||||
{RIL_UNSOL_TWO_MIC_STATE, responseInts, WAKE_PARTIAL}, // 11018
|
||||
{RIL_UNSOL_DHA_STATE, responseVoid, WAKE_PARTIAL}, // 11019
|
||||
{RIL_UNSOL_UART, responseVoid, WAKE_PARTIAL}, // 11020
|
||||
{RIL_UNSOL_RESPONSE_HANDOVER, responseVoid, WAKE_PARTIAL}, // 11021
|
||||
{RIL_UNSOL_IPV6_ADDR, responseVoid, WAKE_PARTIAL}, // 11022
|
||||
{RIL_UNSOL_NWK_INIT_DISC_REQUEST, responseVoid, WAKE_PARTIAL}, // 11023
|
||||
{RIL_UNSOL_RTS_INDICATION, responseVoid, WAKE_PARTIAL}, // 11024
|
||||
{RIL_UNSOL_OMADM_SEND_DATA, responseVoid, WAKE_PARTIAL}, // 11025
|
||||
{RIL_UNSOL_DUN, responseVoid, WAKE_PARTIAL}, // 11026
|
||||
{RIL_UNSOL_SYSTEM_REBOOT, responseVoid, WAKE_PARTIAL}, // 11027
|
||||
{RIL_UNSOL_VOICE_PRIVACY_CHANGED, responseVoid, WAKE_PARTIAL}, // 11028
|
||||
{RIL_UNSOL_UTS_GETSMSCOUNT, responseVoid, WAKE_PARTIAL}, // 11029
|
||||
{RIL_UNSOL_UTS_GETSMSMSG, responseVoid, WAKE_PARTIAL}, // 11030
|
||||
{RIL_UNSOL_UTS_GET_UNREAD_SMS_STATUS, responseVoid, WAKE_PARTIAL}, // 11031
|
||||
{RIL_UNSOL_MIP_CONNECT_STATUS, responseVoid, WAKE_PARTIAL}, // 11032
|
||||
#ifdef RIL_UNSOL_SNDMGR_WB_AMR_REPORT |
||||
{RIL_UNSOL_SNDMGR_WB_AMR_REPORT, responseInts, WAKE_PARTIAL}, // 20017
|
||||
#endif |
||||
#ifdef RIL_UNSOL_SNDMGR_CLOCK_CTRL |
||||
{RIL_UNSOL_SNDMGR_CLOCK_CTRL, responseInts, WAKE_PARTIAL}, // 20022
|
||||
#endif |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,98 @@ |
||||
/*
|
||||
* Copyright (c) 2016 The Android Open Source Project |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#ifndef ANDROID_RIL_INTERNAL_H |
||||
#define ANDROID_RIL_INTERNAL_H |
||||
|
||||
namespace android { |
||||
|
||||
#define RIL_SERVICE_NAME_BASE "slot" |
||||
#define RIL1_SERVICE_NAME "slot1" |
||||
#define RIL2_SERVICE_NAME "slot2" |
||||
#define RIL3_SERVICE_NAME "slot3" |
||||
#define RIL4_SERVICE_NAME "slot4" |
||||
|
||||
/* Constants for response types */ |
||||
#define RESPONSE_SOLICITED 0 |
||||
#define RESPONSE_UNSOLICITED 1 |
||||
#define RESPONSE_SOLICITED_ACK 2 |
||||
#define RESPONSE_SOLICITED_ACK_EXP 3 |
||||
#define RESPONSE_UNSOLICITED_ACK_EXP 4 |
||||
|
||||
// Enable verbose logging
|
||||
#define VDBG 0 |
||||
|
||||
#define MIN(a,b) ((a)<(b) ? (a) : (b)) |
||||
|
||||
// Enable RILC log
|
||||
#define RILC_LOG 0 |
||||
|
||||
#if RILC_LOG |
||||
#define startRequest sprintf(printBuf, "(") |
||||
#define closeRequest sprintf(printBuf, "%s)", printBuf) |
||||
#define printRequest(token, req) \ |
||||
RLOGD("[%04d]> %s %s", token, requestToString(req), printBuf) |
||||
|
||||
#define startResponse sprintf(printBuf, "%s {", printBuf) |
||||
#define closeResponse sprintf(printBuf, "%s}", printBuf) |
||||
#define printResponse RLOGD("%s", printBuf) |
||||
|
||||
#define clearPrintBuf printBuf[0] = 0 |
||||
#define removeLastChar printBuf[strlen(printBuf)-1] = 0 |
||||
#define appendPrintBuf(x...) snprintf(printBuf, PRINTBUF_SIZE, x) |
||||
#else |
||||
#define startRequest |
||||
#define closeRequest |
||||
#define printRequest(token, req) |
||||
#define startResponse |
||||
#define closeResponse |
||||
#define printResponse |
||||
#define clearPrintBuf |
||||
#define removeLastChar |
||||
#define appendPrintBuf(x...) |
||||
#endif |
||||
|
||||
typedef struct CommandInfo CommandInfo; |
||||
|
||||
extern "C" const char * requestToString(int request); |
||||
|
||||
typedef struct RequestInfo { |
||||
int32_t token; //this is not RIL_Token
|
||||
CommandInfo *pCI; |
||||
struct RequestInfo *p_next; |
||||
char cancelled; |
||||
char local; // responses to local commands do not go back to command process
|
||||
RIL_SOCKET_ID socket_id; |
||||
int wasAckSent; // Indicates whether an ack was sent earlier
|
||||
} RequestInfo; |
||||
|
||||
typedef struct CommandInfo { |
||||
int requestNumber; |
||||
int(*responseFunction) (int slotId, int responseType, int token, |
||||
RIL_Errno e, void *response, size_t responselen); |
||||
} CommandInfo; |
||||
|
||||
RequestInfo * addRequestToList(int serial, int slotId, int request); |
||||
|
||||
char * RIL_getServiceName(); |
||||
|
||||
void releaseWakeLock(); |
||||
|
||||
void onNewCommandConnect(RIL_SOCKET_ID socket_id); |
||||
|
||||
} // namespace android
|
||||
|
||||
#endif //ANDROID_RIL_INTERNAL_H
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,716 @@ |
||||
/*
|
||||
* Copyright (c) 2016 The Android Open Source Project |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#ifndef RIL_SERVICE_H |
||||
#define RIL_SERVICE_H |
||||
|
||||
#include <telephony/ril.h> |
||||
#include <ril_internal.h> |
||||
|
||||
namespace radio { |
||||
void registerService(RIL_RadioFunctions *callbacks, android::CommandInfo *commands); |
||||
|
||||
int getIccCardStatusResponse(int slotId, int responseType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int supplyIccPinForAppResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int supplyIccPukForAppResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int supplyIccPin2ForAppResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int supplyIccPuk2ForAppResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int changeIccPinForAppResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int changeIccPin2ForAppResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int supplyNetworkDepersonalizationResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int getCurrentCallsResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int dialResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int getIMSIForAppResponse(int slotId, int responseType, |
||||
int serial, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int hangupConnectionResponse(int slotId, int responseType, |
||||
int serial, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int hangupWaitingOrBackgroundResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int hangupForegroundResumeBackgroundResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int switchWaitingOrHoldingAndActiveResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int conferenceResponse(int slotId, int responseType, |
||||
int serial, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int rejectCallResponse(int slotId, int responseType, |
||||
int serial, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int getLastCallFailCauseResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getSignalStrengthResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responseLen); |
||||
|
||||
int getVoiceRegistrationStateResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getDataRegistrationStateResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getOperatorResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setRadioPowerResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int sendDtmfResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int sendSmsResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int sendSMSExpectMoreResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setupDataCallResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responseLen); |
||||
|
||||
int iccIOForAppResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int sendUssdResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int cancelPendingUssdResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getClirResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int setClirResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int getCallForwardStatusResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setCallForwardResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getCallWaitingResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setCallWaitingResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int acknowledgeLastIncomingGsmSmsResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int acceptCallResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int deactivateDataCallResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getFacilityLockForAppResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setFacilityLockForAppResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setBarringPasswordResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getNetworkSelectionModeResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setNetworkSelectionModeAutomaticResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int setNetworkSelectionModeManualResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getAvailableNetworksResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int startDtmfResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int stopDtmfResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getBasebandVersionResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int separateConnectionResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setMuteResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getMuteResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getClipResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getDataCallListResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responseLen); |
||||
|
||||
int setSuppServiceNotificationsResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int writeSmsToSimResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int deleteSmsOnSimResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setBandModeResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getAvailableBandModesResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int sendEnvelopeResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int sendTerminalResponseToSimResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int handleStkCallSetupRequestFromSimResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int explicitCallTransferResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setPreferredNetworkTypeResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getPreferredNetworkTypeResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getNeighboringCidsResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setLocationUpdatesResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setCdmaSubscriptionSourceResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setCdmaRoamingPreferenceResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getCdmaRoamingPreferenceResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setTTYModeResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getTTYModeResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setPreferredVoicePrivacyResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getPreferredVoicePrivacyResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int sendCDMAFeatureCodeResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int sendBurstDtmfResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int sendCdmaSmsResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int acknowledgeLastIncomingCdmaSmsResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getGsmBroadcastConfigResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setGsmBroadcastConfigResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setGsmBroadcastActivationResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getCdmaBroadcastConfigResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setCdmaBroadcastConfigResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setCdmaBroadcastActivationResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int getCDMASubscriptionResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int writeSmsToRuimResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int deleteSmsOnRuimResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getDeviceIdentityResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int exitEmergencyCallbackModeResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getSmscAddressResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int setCdmaBroadcastActivationResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int setSmscAddressResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int reportSmsMemoryStatusResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int reportStkServiceIsRunningResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responseLen); |
||||
|
||||
int getCdmaSubscriptionSourceResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int requestIsimAuthenticationResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int acknowledgeIncomingGsmSmsWithPduResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int sendEnvelopeWithStatusResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int getVoiceRadioTechnologyResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int getCellInfoListResponse(int slotId, |
||||
int responseType, |
||||
int serial, RIL_Errno e, void *response, |
||||
size_t responseLen); |
||||
|
||||
int setCellInfoListRateResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int setInitialAttachApnResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int getImsRegistrationStateResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int sendImsSmsResponse(int slotId, int responseType, |
||||
int serial, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int iccTransmitApduBasicChannelResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int iccOpenLogicalChannelResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
|
||||
int iccCloseLogicalChannelResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int iccTransmitApduLogicalChannelResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int nvReadItemResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
|
||||
int nvWriteItemResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int nvWriteCdmaPrlResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int nvResetConfigResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int setUiccSubscriptionResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int setDataAllowedResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int getHardwareConfigResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responseLen); |
||||
|
||||
int requestIccSimAuthenticationResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int setDataProfileResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int requestShutdownResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int getRadioCapabilityResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responseLen); |
||||
|
||||
int setRadioCapabilityResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responseLen); |
||||
|
||||
int startLceServiceResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int stopLceServiceResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int pullLceDataResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responseLen); |
||||
|
||||
int getModemActivityInfoResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int setAllowedCarriersResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int getAllowedCarriersResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int sendDeviceStateResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int setIndicationFilterResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int setSimCardPowerResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
void acknowledgeRequest(int slotId, int serial); |
||||
|
||||
int radioStateChangedInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responseLen); |
||||
|
||||
int callStateChangedInd(int slotId, int indType, int token, |
||||
RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int networkStateChangedInd(int slotId, int indType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int newSmsInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int newSmsStatusReportInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int newSmsOnSimInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int onUssdInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int nitzTimeReceivedInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int currentSignalStrengthInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int dataCallListChangedInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int suppSvcNotifyInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int stkSessionEndInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int stkProactiveCommandInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int stkEventNotifyInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int stkCallSetupInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int simSmsStorageFullInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int simRefreshInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int callRingInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int simStatusChangedInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int cdmaNewSmsInd(int slotId, int indicationType, |
||||
int token, RIL_Errno e, void *response, size_t responselen); |
||||
|
||||
int newBroadcastSmsInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int cdmaRuimSmsStorageFullInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int restrictedStateChangedInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int enterEmergencyCallbackModeInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int cdmaCallWaitingInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int cdmaOtaProvisionStatusInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int cdmaInfoRecInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int oemHookRawInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int indicateRingbackToneInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int resendIncallMuteInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int cdmaSubscriptionSourceChangedInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int cdmaPrlChangedInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int exitEmergencyCallbackModeInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int rilConnectedInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int voiceRadioTechChangedInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int cellInfoListInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int imsNetworkStateChangedInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int subscriptionStatusChangedInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int srvccStateNotifyInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int hardwareConfigChangedInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int radioCapabilityIndicationInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int onSupplementaryServiceIndicationInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, |
||||
void *response, size_t responselen); |
||||
|
||||
int stkCallControlAlphaNotifyInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int lceDataInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int pcoDataInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int modemResetInd(int slotId, |
||||
int indicationType, int token, RIL_Errno e, void *response, |
||||
size_t responselen); |
||||
|
||||
int sendRequestRawResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responseLen); |
||||
|
||||
int sendRequestStringsResponse(int slotId, |
||||
int responseType, int serial, RIL_Errno e, |
||||
void *response, size_t responseLen); |
||||
|
||||
pthread_rwlock_t * getRadioServiceRwlock(int slotId); |
||||
|
||||
} // namespace radio
|
||||
|
||||
#endif // RIL_SERVICE_H
|
@ -0,0 +1,958 @@ |
||||
/*
|
||||
* Copyright (c) 2016 The Android Open Source Project |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#define LOG_TAG "RIL_SAP" |
||||
|
||||
#include <android/hardware/radio/1.0/ISap.h> |
||||
|
||||
#include <hwbinder/IPCThreadState.h> |
||||
#include <hwbinder/ProcessState.h> |
||||
#include <sap_service.h> |
||||
#include "pb_decode.h" |
||||
#include "pb_encode.h" |
||||
|
||||
using namespace android::hardware::radio::V1_0; |
||||
using ::android::hardware::Return; |
||||
using ::android::hardware::hidl_vec; |
||||
using ::android::hardware::hidl_array; |
||||
using ::android::hardware::Void; |
||||
using android::CommandInfo; |
||||
using android::RequestInfo; |
||||
using android::requestToString; |
||||
using android::sp; |
||||
|
||||
struct SapImpl; |
||||
|
||||
#if (SIM_COUNT >= 2) |
||||
sp<SapImpl> sapService[SIM_COUNT]; |
||||
#else |
||||
sp<SapImpl> sapService[1]; |
||||
#endif |
||||
|
||||
struct SapImpl : public ISap { |
||||
int32_t slotId; |
||||
sp<ISapCallback> sapCallback; |
||||
RIL_SOCKET_ID rilSocketId; |
||||
|
||||
Return<void> setCallback(const ::android::sp<ISapCallback>& sapCallbackParam); |
||||
|
||||
Return<void> connectReq(int32_t token, int32_t maxMsgSize); |
||||
|
||||
Return<void> disconnectReq(int32_t token); |
||||
|
||||
Return<void> apduReq(int32_t token, SapApduType type, const hidl_vec<uint8_t>& command); |
||||
|
||||
Return<void> transferAtrReq(int32_t token); |
||||
|
||||
Return<void> powerReq(int32_t token, bool state); |
||||
|
||||
Return<void> resetSimReq(int32_t token); |
||||
|
||||
Return<void> transferCardReaderStatusReq(int32_t token); |
||||
|
||||
Return<void> setTransferProtocolReq(int32_t token, SapTransferProtocol transferProtocol); |
||||
|
||||
MsgHeader* createMsgHeader(MsgId msgId, int32_t token); |
||||
|
||||
Return<void> addPayloadAndDispatchRequest(MsgHeader *msg, uint16_t reqLen, uint8_t *reqPtr); |
||||
|
||||
void sendFailedResponse(MsgId msgId, int32_t token, int numPointers, ...); |
||||
|
||||
void checkReturnStatus(Return<void>& ret); |
||||
}; |
||||
|
||||
void SapImpl::checkReturnStatus(Return<void>& ret) { |
||||
if (ret.isOk() == false) { |
||||
RLOGE("checkReturnStatus: unable to call response/indication callback: %s", |
||||
ret.description().c_str()); |
||||
// Remote process (SapRilReceiver.java) hosting the callback must be dead. Reset the
|
||||
// callback object; there's no other recovery to be done here. When the client process is
|
||||
// back up, it will call setCallback()
|
||||
sapCallback = NULL; |
||||
} |
||||
} |
||||
|
||||
Return<void> SapImpl::setCallback(const ::android::sp<ISapCallback>& sapCallbackParam) { |
||||
RLOGD("SapImpl::setCallback for slotId %d", slotId); |
||||
sapCallback = sapCallbackParam; |
||||
return Void(); |
||||
} |
||||
|
||||
MsgHeader* SapImpl::createMsgHeader(MsgId msgId, int32_t token) { |
||||
// Memory for msg will be freed by RilSapSocket::onRequestComplete()
|
||||
MsgHeader *msg = (MsgHeader *)calloc(1, sizeof(MsgHeader)); |
||||
if (msg == NULL) { |
||||
return NULL; |
||||
} |
||||
msg->token = token; |
||||
msg->type = MsgType_REQUEST; |
||||
msg->id = msgId; |
||||
msg->error = Error_RIL_E_SUCCESS; |
||||
return msg; |
||||
} |
||||
|
||||
Return<void> SapImpl::addPayloadAndDispatchRequest(MsgHeader *msg, uint16_t reqLen, |
||||
uint8_t *reqPtr) { |
||||
msg->payload = (pb_bytes_array_t *)malloc(sizeof(pb_bytes_array_t) - 1 + reqLen); |
||||
if (msg->payload == NULL) { |
||||
sendFailedResponse(msg->id, msg->token, 2, reqPtr, msg); |
||||
return Void(); |
||||
} |
||||
msg->payload->size = reqLen; |
||||
memcpy(msg->payload->bytes, reqPtr, reqLen); |
||||
|
||||
RilSapSocket *sapSocket = RilSapSocket::getSocketById(rilSocketId); |
||||
if (sapSocket) { |
||||
RLOGD("SapImpl::addPayloadAndDispatchRequest: calling dispatchRequest"); |
||||
sapSocket->dispatchRequest(msg); |
||||
} else { |
||||
RLOGE("SapImpl::addPayloadAndDispatchRequest: sapSocket is null"); |
||||
sendFailedResponse(msg->id, msg->token, 3, msg->payload, reqPtr, msg); |
||||
return Void(); |
||||
} |
||||
free(msg->payload); |
||||
free(reqPtr); |
||||
return Void(); |
||||
} |
||||
|
||||
void SapImpl::sendFailedResponse(MsgId msgId, int32_t token, int numPointers, ...) { |
||||
va_list ap; |
||||
va_start(ap, numPointers); |
||||
for (int i = 0; i < numPointers; i++) { |
||||
void *ptr = va_arg(ap, void *); |
||||
if (ptr) free(ptr); |
||||
} |
||||
va_end(ap); |
||||
Return<void> retStatus; |
||||
switch(msgId) { |
||||
case MsgId_RIL_SIM_SAP_CONNECT: |
||||
retStatus = sapCallback->connectResponse(token, SapConnectRsp::CONNECT_FAILURE, 0); |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_DISCONNECT: |
||||
retStatus = sapCallback->disconnectResponse(token); |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_APDU: { |
||||
hidl_vec<uint8_t> apduRsp; |
||||
retStatus = sapCallback->apduResponse(token, SapResultCode::GENERIC_FAILURE, apduRsp); |
||||
break; |
||||
} |
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_ATR: { |
||||
hidl_vec<uint8_t> atr; |
||||
retStatus = sapCallback->transferAtrResponse(token, SapResultCode::GENERIC_FAILURE, |
||||
atr); |
||||
break; |
||||
} |
||||
|
||||
case MsgId_RIL_SIM_SAP_POWER: |
||||
retStatus = sapCallback->powerResponse(token, SapResultCode::GENERIC_FAILURE); |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_RESET_SIM: |
||||
retStatus = sapCallback->resetSimResponse(token, SapResultCode::GENERIC_FAILURE); |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS: |
||||
retStatus = sapCallback->transferCardReaderStatusResponse(token, |
||||
SapResultCode::GENERIC_FAILURE, 0); |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL: |
||||
retStatus = sapCallback->transferProtocolResponse(token, SapResultCode::NOT_SUPPORTED); |
||||
break; |
||||
|
||||
default: |
||||
return; |
||||
} |
||||
sapService[slotId]->checkReturnStatus(retStatus); |
||||
} |
||||
|
||||
Return<void> SapImpl::connectReq(int32_t token, int32_t maxMsgSize) { |
||||
RLOGD("SapImpl::connectReq"); |
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_CONNECT, token); |
||||
if (msg == NULL) { |
||||
RLOGE("SapImpl::connectReq: Error allocating memory for msg"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 0); |
||||
return Void(); |
||||
} |
||||
|
||||
/***** Encode RIL_SIM_SAP_CONNECT_REQ *****/ |
||||
RIL_SIM_SAP_CONNECT_REQ req; |
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_CONNECT_REQ)); |
||||
req.max_message_size = maxMsgSize; |
||||
|
||||
size_t encodedSize = 0; |
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_CONNECT_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::connectReq: Error getting encoded size for RIL_SIM_SAP_CONNECT_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); |
||||
if (buffer == NULL) { |
||||
RLOGE("SapImpl::connectReq: Error allocating memory for buffer"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); |
||||
|
||||
RLOGD("SapImpl::connectReq calling pb_encode"); |
||||
if (!pb_encode(&stream, RIL_SIM_SAP_CONNECT_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::connectReq: Error encoding RIL_SIM_SAP_CONNECT_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 2, buffer, msg); |
||||
return Void(); |
||||
} |
||||
/***** Encode RIL_SIM_SAP_CONNECT_REQ done *****/ |
||||
|
||||
/* encoded req is payload */ |
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); |
||||
} |
||||
|
||||
Return<void> SapImpl::disconnectReq(int32_t token) { |
||||
RLOGD("SapImpl::disconnectReq"); |
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_DISCONNECT, token); |
||||
if (msg == NULL) { |
||||
RLOGE("SapImpl::disconnectReq: Error allocating memory for msg"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 0); |
||||
return Void(); |
||||
} |
||||
|
||||
/***** Encode RIL_SIM_SAP_DISCONNECT_REQ *****/ |
||||
RIL_SIM_SAP_DISCONNECT_REQ req; |
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_DISCONNECT_REQ)); |
||||
|
||||
size_t encodedSize = 0; |
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_DISCONNECT_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::disconnectReq: Error getting encoded size for RIL_SIM_SAP_DISCONNECT_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); |
||||
if (buffer == NULL) { |
||||
RLOGE("SapImpl::disconnectReq: Error allocating memory for buffer"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); |
||||
|
||||
RLOGD("SapImpl::disconnectReq calling pb_encode"); |
||||
if (!pb_encode(&stream, RIL_SIM_SAP_DISCONNECT_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::disconnectReq: Error encoding RIL_SIM_SAP_DISCONNECT_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 2, buffer, msg); |
||||
return Void(); |
||||
} |
||||
/***** Encode RIL_SIM_SAP_DISCONNECT_REQ done *****/ |
||||
|
||||
/* encoded req is payload */ |
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); |
||||
} |
||||
|
||||
Return<void> SapImpl::apduReq(int32_t token, SapApduType type, const hidl_vec<uint8_t>& command) { |
||||
RLOGD("SapImpl::apduReq"); |
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_APDU, token); |
||||
if (msg == NULL) { |
||||
RLOGE("SapImpl::apduReq: Error allocating memory for msg"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 0); |
||||
return Void(); |
||||
} |
||||
|
||||
/***** Encode RIL_SIM_SAP_APDU_REQ *****/ |
||||
RIL_SIM_SAP_APDU_REQ req; |
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_APDU_REQ)); |
||||
req.type = (RIL_SIM_SAP_APDU_REQ_Type)type; |
||||
|
||||
if (command.size() > 0) { |
||||
req.command = (pb_bytes_array_t *)malloc(sizeof(pb_bytes_array_t) - 1 + command.size()); |
||||
if (req.command == NULL) { |
||||
RLOGE("SapImpl::apduReq: Error allocating memory for req.command"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
req.command->size = command.size(); |
||||
memcpy(req.command->bytes, command.data(), command.size()); |
||||
} |
||||
|
||||
size_t encodedSize = 0; |
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_APDU_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::apduReq: Error getting encoded size for RIL_SIM_SAP_APDU_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 2, req.command, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); |
||||
if (buffer == NULL) { |
||||
RLOGE("SapImpl::apduReq: Error allocating memory for buffer"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 2, req.command, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); |
||||
|
||||
RLOGD("SapImpl::apduReq calling pb_encode"); |
||||
if (!pb_encode(&stream, RIL_SIM_SAP_APDU_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::apduReq: Error encoding RIL_SIM_SAP_APDU_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 3, req.command, buffer, msg); |
||||
return Void(); |
||||
} |
||||
/***** Encode RIL_SIM_SAP_APDU_REQ done *****/ |
||||
|
||||
/* encoded req is payload */ |
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); |
||||
} |
||||
|
||||
Return<void> SapImpl::transferAtrReq(int32_t token) { |
||||
RLOGD("SapImpl::transferAtrReq"); |
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token); |
||||
if (msg == NULL) { |
||||
RLOGE("SapImpl::transferAtrReq: Error allocating memory for msg"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 0); |
||||
return Void(); |
||||
} |
||||
|
||||
/***** Encode RIL_SIM_SAP_TRANSFER_ATR_REQ *****/ |
||||
RIL_SIM_SAP_TRANSFER_ATR_REQ req; |
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_TRANSFER_ATR_REQ)); |
||||
|
||||
size_t encodedSize = 0; |
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_TRANSFER_ATR_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::transferAtrReq: Error getting encoded size for " |
||||
"RIL_SIM_SAP_TRANSFER_ATR_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); |
||||
if (buffer == NULL) { |
||||
RLOGE("SapImpl::transferAtrReq: Error allocating memory for buffer"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); |
||||
|
||||
RLOGD("SapImpl::transferAtrReq calling pb_encode"); |
||||
if (!pb_encode(&stream, RIL_SIM_SAP_TRANSFER_ATR_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::transferAtrReq: Error encoding RIL_SIM_SAP_TRANSFER_ATR_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 2, buffer, msg); |
||||
return Void(); |
||||
} |
||||
/***** Encode RIL_SIM_SAP_TRANSFER_ATR_REQ done *****/ |
||||
|
||||
/* encoded req is payload */ |
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); |
||||
} |
||||
|
||||
Return<void> SapImpl::powerReq(int32_t token, bool state) { |
||||
RLOGD("SapImpl::powerReq"); |
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_POWER, token); |
||||
if (msg == NULL) { |
||||
RLOGE("SapImpl::powerReq: Error allocating memory for msg"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 0); |
||||
return Void(); |
||||
} |
||||
|
||||
/***** Encode RIL_SIM_SAP_POWER_REQ *****/ |
||||
RIL_SIM_SAP_POWER_REQ req; |
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_POWER_REQ)); |
||||
req.state = state; |
||||
|
||||
size_t encodedSize = 0; |
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_POWER_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::powerReq: Error getting encoded size for RIL_SIM_SAP_POWER_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); |
||||
if (buffer == NULL) { |
||||
RLOGE("SapImpl::powerReq: Error allocating memory for buffer"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); |
||||
|
||||
RLOGD("SapImpl::powerReq calling pb_encode"); |
||||
if (!pb_encode(&stream, RIL_SIM_SAP_POWER_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::powerReq: Error encoding RIL_SIM_SAP_POWER_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 2, buffer, msg); |
||||
return Void(); |
||||
} |
||||
/***** Encode RIL_SIM_SAP_POWER_REQ done *****/ |
||||
|
||||
/* encoded req is payload */ |
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); |
||||
} |
||||
|
||||
Return<void> SapImpl::resetSimReq(int32_t token) { |
||||
RLOGD("SapImpl::resetSimReq"); |
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_RESET_SIM, token); |
||||
if (msg == NULL) { |
||||
RLOGE("SapImpl::resetSimReq: Error allocating memory for msg"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 0); |
||||
return Void(); |
||||
} |
||||
|
||||
/***** Encode RIL_SIM_SAP_RESET_SIM_REQ *****/ |
||||
RIL_SIM_SAP_RESET_SIM_REQ req; |
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_RESET_SIM_REQ)); |
||||
|
||||
size_t encodedSize = 0; |
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_RESET_SIM_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::resetSimReq: Error getting encoded size for RIL_SIM_SAP_RESET_SIM_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); |
||||
if (buffer == NULL) { |
||||
RLOGE("SapImpl::resetSimReq: Error allocating memory for buffer"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); |
||||
|
||||
RLOGD("SapImpl::resetSimReq calling pb_encode"); |
||||
if (!pb_encode(&stream, RIL_SIM_SAP_RESET_SIM_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::resetSimReq: Error encoding RIL_SIM_SAP_RESET_SIM_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 2, buffer, msg); |
||||
return Void(); |
||||
} |
||||
/***** Encode RIL_SIM_SAP_RESET_SIM_REQ done *****/ |
||||
|
||||
/* encoded req is payload */ |
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); |
||||
} |
||||
|
||||
Return<void> SapImpl::transferCardReaderStatusReq(int32_t token) { |
||||
RLOGD("SapImpl::transferCardReaderStatusReq"); |
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token); |
||||
if (msg == NULL) { |
||||
RLOGE("SapImpl::transferCardReaderStatusReq: Error allocating memory for msg"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 0); |
||||
return Void(); |
||||
} |
||||
|
||||
/***** Encode RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ *****/ |
||||
RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ req; |
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ)); |
||||
|
||||
size_t encodedSize = 0; |
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ_fields, |
||||
&req)) { |
||||
RLOGE("SapImpl::transferCardReaderStatusReq: Error getting encoded size for " |
||||
"RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); |
||||
if (buffer == NULL) { |
||||
RLOGE("SapImpl::transferCardReaderStatusReq: Error allocating memory for buffer"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); |
||||
|
||||
RLOGD("SapImpl::transferCardReaderStatusReq calling pb_encode"); |
||||
if (!pb_encode(&stream, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::transferCardReaderStatusReq: Error encoding " |
||||
"RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 2, buffer, msg); |
||||
return Void(); |
||||
} |
||||
/***** Encode RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ done *****/ |
||||
|
||||
/* encoded req is payload */ |
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); |
||||
} |
||||
|
||||
Return<void> SapImpl::setTransferProtocolReq(int32_t token, SapTransferProtocol transferProtocol) { |
||||
RLOGD("SapImpl::setTransferProtocolReq"); |
||||
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token); |
||||
if (msg == NULL) { |
||||
RLOGE("SapImpl::setTransferProtocolReq: Error allocating memory for msg"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 0); |
||||
return Void(); |
||||
} |
||||
|
||||
/***** Encode RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ *****/ |
||||
RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ req; |
||||
memset(&req, 0, sizeof(RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ)); |
||||
req.protocol = (RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_Protocol)transferProtocol; |
||||
|
||||
size_t encodedSize = 0; |
||||
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::setTransferProtocolReq: Error getting encoded size for " |
||||
"RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); |
||||
if (buffer == NULL) { |
||||
RLOGE("SapImpl::setTransferProtocolReq: Error allocating memory for buffer"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 1, msg); |
||||
return Void(); |
||||
} |
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); |
||||
|
||||
RLOGD("SapImpl::setTransferProtocolReq calling pb_encode"); |
||||
if (!pb_encode(&stream, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_fields, &req)) { |
||||
RLOGE("SapImpl::setTransferProtocolReq: Error encoding " |
||||
"RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ"); |
||||
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 2, buffer, msg); |
||||
return Void(); |
||||
} |
||||
/***** Encode RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ done *****/ |
||||
|
||||
/* encoded req is payload */ |
||||
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); |
||||
} |
||||
|
||||
void *sapDecodeMessage(MsgId msgId, MsgType msgType, uint8_t *payloadPtr, size_t payloadLen) { |
||||
void *responsePtr = NULL; |
||||
bool decodeStatus = false; |
||||
pb_istream_t stream; |
||||
|
||||
/* Create the stream */ |
||||
stream = pb_istream_from_buffer((uint8_t *)payloadPtr, payloadLen); |
||||
|
||||
/* Decode based on the message id */ |
||||
switch (msgId) |
||||
{ |
||||
case MsgId_RIL_SIM_SAP_CONNECT: |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_CONNECT_RSP)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_CONNECT_RSP_fields, responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_CONNECT_RSP"); |
||||
return NULL; |
||||
} |
||||
} |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_DISCONNECT: |
||||
if (msgType == MsgType_RESPONSE) { |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_DISCONNECT_RSP)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_DISCONNECT_RSP_fields, responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_DISCONNECT_RSP"); |
||||
return NULL; |
||||
} |
||||
} |
||||
} else { |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_DISCONNECT_IND)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_DISCONNECT_IND_fields, responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_DISCONNECT_IND"); |
||||
return NULL; |
||||
} |
||||
} |
||||
} |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_APDU: |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_APDU_RSP)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_APDU_RSP_fields, responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_APDU_RSP"); |
||||
return NULL; |
||||
} |
||||
} |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_ATR: |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_TRANSFER_ATR_RSP)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_TRANSFER_ATR_RSP_fields, responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_TRANSFER_ATR_RSP"); |
||||
return NULL; |
||||
} |
||||
} |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_POWER: |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_POWER_RSP)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_POWER_RSP_fields, responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_POWER_RSP"); |
||||
return NULL; |
||||
} |
||||
} |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_RESET_SIM: |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_RESET_SIM_RSP)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_RESET_SIM_RSP_fields, responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_RESET_SIM_RSP"); |
||||
return NULL; |
||||
} |
||||
} |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_STATUS: |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_STATUS_IND)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_STATUS_IND_fields, responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_STATUS_IND"); |
||||
return NULL; |
||||
} |
||||
} |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS: |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_fields, |
||||
responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP"); |
||||
return NULL; |
||||
} |
||||
} |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_ERROR_RESP: |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_ERROR_RSP)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_ERROR_RSP_fields, responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_ERROR_RSP"); |
||||
return NULL; |
||||
} |
||||
} |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL: |
||||
responsePtr = malloc(sizeof(RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP)); |
||||
if (responsePtr) { |
||||
if (!pb_decode(&stream, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP_fields, |
||||
responsePtr)) { |
||||
RLOGE("Error decoding RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP"); |
||||
return NULL; |
||||
} |
||||
} |
||||
break; |
||||
|
||||
default: |
||||
break; |
||||
} |
||||
return responsePtr; |
||||
} /* sapDecodeMessage */ |
||||
|
||||
sp<SapImpl> getSapImpl(RilSapSocket *sapSocket) { |
||||
switch (sapSocket->getSocketId()) { |
||||
case RIL_SOCKET_1: |
||||
RLOGD("getSapImpl: returning sapService[0]"); |
||||
return sapService[0]; |
||||
#if (SIM_COUNT >= 2) |
||||
case RIL_SOCKET_2: |
||||
return sapService[1]; |
||||
#if (SIM_COUNT >= 3) |
||||
case RIL_SOCKET_3: |
||||
return sapService[2]; |
||||
#if (SIM_COUNT >= 4) |
||||
case RIL_SOCKET_4: |
||||
return sapService[3]; |
||||
#endif |
||||
#endif |
||||
#endif |
||||
default: |
||||
return NULL; |
||||
} |
||||
} |
||||
|
||||
SapResultCode convertApduResponseProtoToHal(RIL_SIM_SAP_APDU_RSP_Response responseProto) { |
||||
switch(responseProto) { |
||||
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SUCCESS: |
||||
return SapResultCode::SUCCESS; |
||||
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_GENERIC_FAILURE: |
||||
return SapResultCode::GENERIC_FAILURE; |
||||
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_NOT_READY: |
||||
return SapResultCode::CARD_NOT_ACCESSSIBLE; |
||||
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF: |
||||
return SapResultCode::CARD_ALREADY_POWERED_OFF; |
||||
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_ABSENT: |
||||
return SapResultCode::CARD_REMOVED; |
||||
default: |
||||
return SapResultCode::GENERIC_FAILURE; |
||||
} |
||||
} |
||||
|
||||
SapResultCode convertTransferAtrResponseProtoToHal( |
||||
RIL_SIM_SAP_TRANSFER_ATR_RSP_Response responseProto) { |
||||
switch(responseProto) { |
||||
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SUCCESS: |
||||
return SapResultCode::SUCCESS; |
||||
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_GENERIC_FAILURE: |
||||
return SapResultCode::GENERIC_FAILURE; |
||||
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF: |
||||
return SapResultCode::CARD_ALREADY_POWERED_OFF; |
||||
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_ABSENT: |
||||
return SapResultCode::CARD_REMOVED; |
||||
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_DATA_NOT_AVAILABLE: |
||||
return SapResultCode::DATA_NOT_AVAILABLE; |
||||
default: |
||||
return SapResultCode::GENERIC_FAILURE; |
||||
} |
||||
} |
||||
|
||||
SapResultCode convertPowerResponseProtoToHal(RIL_SIM_SAP_POWER_RSP_Response responseProto) { |
||||
switch(responseProto) { |
||||
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SUCCESS: |
||||
return SapResultCode::SUCCESS; |
||||
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_GENERIC_FAILURE: |
||||
return SapResultCode::GENERIC_FAILURE; |
||||
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ABSENT: |
||||
return SapResultCode::CARD_REMOVED; |
||||
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF: |
||||
return SapResultCode::CARD_ALREADY_POWERED_OFF; |
||||
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ALREADY_POWERED_ON: |
||||
return SapResultCode::CARD_ALREADY_POWERED_ON; |
||||
default: |
||||
return SapResultCode::GENERIC_FAILURE; |
||||
} |
||||
} |
||||
|
||||
SapResultCode convertResetSimResponseProtoToHal(RIL_SIM_SAP_RESET_SIM_RSP_Response responseProto) { |
||||
switch(responseProto) { |
||||
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SUCCESS: |
||||
return SapResultCode::SUCCESS; |
||||
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_GENERIC_FAILURE: |
||||
return SapResultCode::GENERIC_FAILURE; |
||||
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_ABSENT: |
||||
return SapResultCode::CARD_REMOVED; |
||||
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_NOT_READY: |
||||
return SapResultCode::CARD_NOT_ACCESSSIBLE; |
||||
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF: |
||||
return SapResultCode::CARD_ALREADY_POWERED_OFF; |
||||
} |
||||
return SapResultCode::GENERIC_FAILURE; |
||||
} |
||||
|
||||
SapResultCode convertTransferCardReaderStatusResponseProtoToHal( |
||||
RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response responseProto) { |
||||
switch(responseProto) { |
||||
case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_SUCCESS: |
||||
return SapResultCode::SUCCESS; |
||||
case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_GENERIC_FAILURE: |
||||
return SapResultCode::GENERIC_FAILURE; |
||||
case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_SIM_DATA_NOT_AVAILABLE: |
||||
return SapResultCode::DATA_NOT_AVAILABLE; |
||||
} |
||||
return SapResultCode::GENERIC_FAILURE; |
||||
} |
||||
|
||||
void processResponse(MsgHeader *rsp, RilSapSocket *sapSocket, MsgType msgType) { |
||||
MsgId msgId = rsp->id; |
||||
uint8_t *data = rsp->payload->bytes; |
||||
size_t dataLen = rsp->payload->size; |
||||
|
||||
void *messagePtr = sapDecodeMessage(msgId, msgType, data, dataLen); |
||||
|
||||
sp<SapImpl> sapImpl = getSapImpl(sapSocket); |
||||
if (sapImpl->sapCallback == NULL) { |
||||
RLOGE("processResponse: sapCallback == NULL; msgId = %d; msgType = %d", |
||||
msgId, msgType); |
||||
return; |
||||
} |
||||
|
||||
RLOGD("processResponse: sapCallback != NULL; msgId = %d; msgType = %d", |
||||
msgId, msgType); |
||||
|
||||
Return<void> retStatus; |
||||
switch (msgId) { |
||||
case MsgId_RIL_SIM_SAP_CONNECT: { |
||||
RIL_SIM_SAP_CONNECT_RSP *connectRsp = (RIL_SIM_SAP_CONNECT_RSP *)messagePtr; |
||||
RLOGD("processResponse: calling sapCallback->connectResponse %d %d %d", |
||||
rsp->token, |
||||
connectRsp->response, |
||||
connectRsp->max_message_size); |
||||
retStatus = sapImpl->sapCallback->connectResponse(rsp->token, |
||||
(SapConnectRsp)connectRsp->response, |
||||
connectRsp->max_message_size); |
||||
break; |
||||
} |
||||
|
||||
case MsgId_RIL_SIM_SAP_DISCONNECT: |
||||
if (msgType == MsgType_RESPONSE) { |
||||
RLOGD("processResponse: calling sapCallback->disconnectResponse %d", rsp->token); |
||||
retStatus = sapImpl->sapCallback->disconnectResponse(rsp->token); |
||||
} else { |
||||
RIL_SIM_SAP_DISCONNECT_IND *disconnectInd = |
||||
(RIL_SIM_SAP_DISCONNECT_IND *)messagePtr; |
||||
RLOGD("processResponse: calling sapCallback->disconnectIndication %d %d", |
||||
rsp->token, disconnectInd->disconnectType); |
||||
retStatus = sapImpl->sapCallback->disconnectIndication(rsp->token, |
||||
(SapDisconnectType)disconnectInd->disconnectType); |
||||
} |
||||
break; |
||||
|
||||
case MsgId_RIL_SIM_SAP_APDU: { |
||||
RIL_SIM_SAP_APDU_RSP *apduRsp = (RIL_SIM_SAP_APDU_RSP *)messagePtr; |
||||
SapResultCode apduResponse = convertApduResponseProtoToHal(apduRsp->response); |
||||
RLOGD("processResponse: calling sapCallback->apduResponse %d %d", |
||||
rsp->token, apduResponse); |
||||
hidl_vec<uint8_t> apduRspVec; |
||||
if (apduRsp->apduResponse != NULL && apduRsp->apduResponse->size > 0) { |
||||
apduRspVec.setToExternal(apduRsp->apduResponse->bytes, apduRsp->apduResponse->size); |
||||
} |
||||
retStatus = sapImpl->sapCallback->apduResponse(rsp->token, apduResponse, apduRspVec); |
||||
break; |
||||
} |
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_ATR: { |
||||
RIL_SIM_SAP_TRANSFER_ATR_RSP *transferAtrRsp = |
||||
(RIL_SIM_SAP_TRANSFER_ATR_RSP *)messagePtr; |
||||
SapResultCode transferAtrResponse = |
||||
convertTransferAtrResponseProtoToHal(transferAtrRsp->response); |
||||
RLOGD("processResponse: calling sapCallback->transferAtrResponse %d %d", |
||||
rsp->token, transferAtrResponse); |
||||
hidl_vec<uint8_t> transferAtrRspVec; |
||||
if (transferAtrRsp->atr != NULL && transferAtrRsp->atr->size > 0) { |
||||
transferAtrRspVec.setToExternal(transferAtrRsp->atr->bytes, |
||||
transferAtrRsp->atr->size); |
||||
} |
||||
retStatus = sapImpl->sapCallback->transferAtrResponse(rsp->token, transferAtrResponse, |
||||
transferAtrRspVec); |
||||
break; |
||||
} |
||||
|
||||
case MsgId_RIL_SIM_SAP_POWER: { |
||||
SapResultCode powerResponse = convertPowerResponseProtoToHal( |
||||
((RIL_SIM_SAP_POWER_RSP *)messagePtr)->response); |
||||
RLOGD("processResponse: calling sapCallback->powerResponse %d %d", |
||||
rsp->token, powerResponse); |
||||
retStatus = sapImpl->sapCallback->powerResponse(rsp->token, powerResponse); |
||||
break; |
||||
} |
||||
|
||||
case MsgId_RIL_SIM_SAP_RESET_SIM: { |
||||
SapResultCode resetSimResponse = convertResetSimResponseProtoToHal( |
||||
((RIL_SIM_SAP_RESET_SIM_RSP *)messagePtr)->response); |
||||
RLOGD("processResponse: calling sapCallback->resetSimResponse %d %d", |
||||
rsp->token, resetSimResponse); |
||||
retStatus = sapImpl->sapCallback->resetSimResponse(rsp->token, resetSimResponse); |
||||
break; |
||||
} |
||||
|
||||
case MsgId_RIL_SIM_SAP_STATUS: { |
||||
RIL_SIM_SAP_STATUS_IND *statusInd = (RIL_SIM_SAP_STATUS_IND *)messagePtr; |
||||
RLOGD("processResponse: calling sapCallback->statusIndication %d %d", |
||||
rsp->token, statusInd->statusChange); |
||||
retStatus = sapImpl->sapCallback->statusIndication(rsp->token, |
||||
(SapStatus)statusInd->statusChange); |
||||
break; |
||||
} |
||||
|
||||
case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS: { |
||||
RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP *transferStatusRsp = |
||||
(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP *)messagePtr; |
||||
SapResultCode transferCardReaderStatusResponse = |
||||
convertTransferCardReaderStatusResponseProtoToHal( |
||||
transferStatusRsp->response); |
||||
RLOGD("processResponse: calling sapCallback->transferCardReaderStatusResponse %d %d %d", |
||||
rsp->token, |
||||
transferCardReaderStatusResponse, |
||||
transferStatusRsp->CardReaderStatus); |
||||
retStatus = sapImpl->sapCallback->transferCardReaderStatusResponse(rsp->token, |
||||
transferCardReaderStatusResponse, |
||||
transferStatusRsp->CardReaderStatus); |
||||
break; |
||||
} |
||||
|
||||
case MsgId_RIL_SIM_SAP_ERROR_RESP: { |
||||
RLOGD("processResponse: calling sapCallback->errorResponse %d", rsp->token); |
||||
retStatus = sapImpl->sapCallback->errorResponse(rsp->token); |
||||
break; |
||||
} |
||||
|
||||
case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL: { |
||||
SapResultCode setTransferProtocolResponse; |
||||
if (((RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP *)messagePtr)->response == |
||||
RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP_Response_RIL_E_SUCCESS) { |
||||
setTransferProtocolResponse = SapResultCode::SUCCESS; |
||||
} else { |
||||
setTransferProtocolResponse = SapResultCode::NOT_SUPPORTED; |
||||
} |
||||
RLOGD("processResponse: calling sapCallback->transferProtocolResponse %d %d", |
||||
rsp->token, setTransferProtocolResponse); |
||||
retStatus = sapImpl->sapCallback->transferProtocolResponse(rsp->token, |
||||
setTransferProtocolResponse); |
||||
break; |
||||
} |
||||
|
||||
default: |
||||
return; |
||||
} |
||||
sapImpl->checkReturnStatus(retStatus); |
||||
} |
||||
|
||||
void sap::processResponse(MsgHeader *rsp, RilSapSocket *sapSocket) { |
||||
processResponse(rsp, sapSocket, MsgType_RESPONSE); |
||||
} |
||||
|
||||
void sap::processUnsolResponse(MsgHeader *rsp, RilSapSocket *sapSocket) { |
||||
processResponse(rsp, sapSocket, MsgType_UNSOL_RESPONSE); |
||||
} |
||||
|
||||
void sap::registerService(RIL_RadioFunctions *callbacks) { |
||||
using namespace android::hardware; |
||||
int simCount = 1; |
||||
const char *serviceNames[] = { |
||||
android::RIL_getServiceName() |
||||
#if (SIM_COUNT >= 2) |
||||
, RIL2_SERVICE_NAME |
||||
#if (SIM_COUNT >= 3) |
||||
, RIL3_SERVICE_NAME |
||||
#if (SIM_COUNT >= 4) |
||||
, RIL4_SERVICE_NAME |
||||
#endif |
||||
#endif |
||||
#endif |
||||
}; |
||||
|
||||
RIL_SOCKET_ID socketIds[] = { |
||||
RIL_SOCKET_1 |
||||
#if (SIM_COUNT >= 2) |
||||
, RIL_SOCKET_2 |
||||
#if (SIM_COUNT >= 3) |
||||
, RIL_SOCKET_3 |
||||
#if (SIM_COUNT >= 4) |
||||
, RIL_SOCKET_4 |
||||
#endif |
||||
#endif |
||||
#endif |
||||
}; |
||||
#if (SIM_COUNT >= 2) |
||||
simCount = SIM_COUNT; |
||||
#endif |
||||
|
||||
for (int i = 0; i < simCount; i++) { |
||||
sapService[i] = new SapImpl; |
||||
sapService[i]->slotId = i; |
||||
sapService[i]->rilSocketId = socketIds[i]; |
||||
RLOGD("registerService: starting ISap %s for slotId %d", serviceNames[i], i); |
||||
android::status_t status = sapService[i]->registerAsService(serviceNames[i]); |
||||
RLOGD("registerService: started ISap %s status %d", serviceNames[i], status); |
||||
} |
||||
} |
@ -0,0 +1,33 @@ |
||||
/*
|
||||
* Copyright (c) 2016 The Android Open Source Project |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#ifndef SAP_SERVICE_H |
||||
#define SAP_SERVICE_H |
||||
|
||||
#include <telephony/ril.h> |
||||
#include <ril_internal.h> |
||||
#include <RilSapSocket.h> |
||||
#include <hardware/ril/librilutils/proto/sap-api.pb.h> |
||||
|
||||
namespace sap { |
||||
|
||||
void registerService(RIL_RadioFunctions *callbacks); |
||||
void processResponse(MsgHeader *rsp, RilSapSocket *sapSocket); |
||||
void processUnsolResponse(MsgHeader *rsp, RilSapSocket *sapSocket); |
||||
|
||||
} // namespace android
|
||||
|
||||
#endif // RIL_SERVICE_H
|
Loading…
Reference in new issue