• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <map>
18 
19 #include <v8.h>
20 #include "ril.h"
21 
22 #include "hardware/ril/mock-ril/src/proto/ril.pb.h"
23 
24 #include "logging.h"
25 #include "mock_ril.h"
26 #include "node_buffer.h"
27 #include "node_object_wrap.h"
28 #include "protobuf_v8.h"
29 #include "status.h"
30 #include "util.h"
31 #include "worker.h"
32 
33 #include "responses.h"
34 
35 //#define RESPONSES_DEBUG
36 #ifdef  RESPONSES_DEBUG
37 
38 #define DBG(...) ALOGD(__VA_ARGS__)
39 
40 #else
41 
42 #define DBG(...)
43 
44 #endif
45 
46 
47 /**
48  * The Buffer is assumed to be empty so nothing to convert
49  * @return STATUS_OK and *data = NULL *datalen = 0;
50  */
RspWithNoData(int cmd,RIL_Token token,RIL_Errno rilErrno,Buffer * buffer)51 RIL_Errno RspWithNoData(
52         int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) {
53     DBG("RspWithNoData E");
54 
55     // Complete the request
56     s_rilenv->OnRequestComplete(token, rilErrno, NULL, 0);
57 
58     DBG("RspWithNoData X");
59     return rilErrno;
60 }
61 
62 /**
63  * Handle response for an array of strings
64  *
65  * If a string value is "*magic-null*" then that value
66  * will be returned as null.
67  */
RspStrings(int cmd,RIL_Token token,RIL_Errno rilErrno,Buffer * buffer)68 RIL_Errno RspStrings(
69         int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) {
70     DBG("RspStrings E");
71 
72     ril_proto::RspStrings *rsp = new ril_proto::RspStrings();
73     rsp->ParseFromArray(buffer->data(), buffer->length());
74     int result_len = rsp->strings_size() * sizeof(const char *);
75     const char **result = (const char **)alloca(result_len);
76     for (int i = 0; i < rsp->strings_size();  i++) {
77         result[i] = rsp->strings(i).c_str();
78         DBG("result[%d]='%s'", i, result[i]);
79         if (strcmp("*magic-null*", result[i]) == 0) {
80             result[i] = NULL;
81         }
82     }
83 
84     // Complete the request
85     s_rilenv->OnRequestComplete(token, rilErrno, result, result_len);
86 
87     DBG("RspStrings X rilErrno=%d", rilErrno);
88     return rilErrno;
89 }
90 
91 /**
92  * Handle response for a string
93  */
RspString(int cmd,RIL_Token token,RIL_Errno rilErrno,Buffer * buffer)94 RIL_Errno RspString(
95         int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) {
96     DBG("RspString E");
97 
98     ril_proto::RspStrings *rsp = new ril_proto::RspStrings();
99     rsp->ParseFromArray(buffer->data(), buffer->length());
100     const char *result = rsp->strings(0).c_str();
101 
102     // Complete the request
103     s_rilenv->OnRequestComplete(token, rilErrno, (void *)result, strlen(result));
104 
105     DBG("RspString X rilErrno=%d", rilErrno);
106     return rilErrno;
107 }
108 
109 /**
110  * Handle response for an array of integers
111  */
RspIntegers(int cmd,RIL_Token token,RIL_Errno rilErrno,Buffer * buffer)112 RIL_Errno RspIntegers(
113         int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) {
114     DBG("RspIntegers E");
115 
116     ril_proto::RspIntegers *rsp = new ril_proto::RspIntegers();
117     rsp->ParseFromArray(buffer->data(), buffer->length());
118     int result_len = rsp->integers_size() * sizeof(const int32_t);
119     int32_t *result = (int32_t *)alloca(result_len);
120     for (int i = 0; i < rsp->integers_size();  i++) {
121         result[i] = rsp->integers(i);
122         DBG("result[%d]=%d", i, result[i]);
123     }
124 
125     // Complete the request
126     s_rilenv->OnRequestComplete(token, rilErrno, result, result_len);
127 
128     DBG("RspIntegers X rilErrno=%d", rilErrno);
129     return rilErrno;
130 }
131 
132 /**
133  * Handle RIL_REQUEST_GET_SIM_STATUS response
134  */
RspGetSimStatus(int cmd,RIL_Token token,RIL_Errno rilErrno,Buffer * buffer)135 RIL_Errno RspGetSimStatus(
136         int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) { // 1
137     DBG("RspGetSimStatus E");
138 
139     ril_proto::RspGetSimStatus *rsp = new ril_proto::RspGetSimStatus();
140     rsp->ParseFromArray(buffer->data(), buffer->length());
141     const ril_proto::RilCardStatus& r = rsp->card_status();
142     RIL_CardStatus_v6 cardStatus;
143     cardStatus.card_state = RIL_CardState(r.card_state());
144     cardStatus.universal_pin_state = RIL_PinState(r.universal_pin_state());
145     cardStatus.gsm_umts_subscription_app_index = r.gsm_umts_subscription_app_index();
146     cardStatus.ims_subscription_app_index = r.ims_subscription_app_index();
147     cardStatus.num_applications = r.num_applications();
148     for (int i = 0; i < cardStatus.num_applications; i++) {
149        cardStatus.applications[i].app_type = RIL_AppType(r.applications(i).app_type());
150        cardStatus.applications[i].app_state = RIL_AppState(r.applications(i).app_state());
151        cardStatus.applications[i].perso_substate =
152             RIL_PersoSubstate(r.applications(i).perso_substate());
153        cardStatus.applications[i].aid_ptr = const_cast<char *>(r.applications(i).aid().c_str());
154        cardStatus.applications[i].app_label_ptr =
155             const_cast<char *>(r.applications(i).app_label().c_str());
156        cardStatus.applications[i].pin1_replaced = r.applications(i).pin1_replaced();
157        cardStatus.applications[i].pin1 = RIL_PinState(r.applications(i).pin1());
158        cardStatus.applications[i].pin2 = RIL_PinState(r.applications(i).pin2());
159     }
160 
161     // Complete the request
162     s_rilenv->OnRequestComplete(token, rilErrno,
163             &cardStatus, sizeof(cardStatus));
164 
165     DBG("RspGetSimStatus X rilErrno=%d", rilErrno);
166     return rilErrno;
167 }
168 
169 /**
170  * Handle RIL_REQUEST_ENTER_SIM_PIN_DATA response
171  */
RspEnterSimPinData(int cmd,RIL_Token token,RIL_Errno rilErrno,Buffer * buffer)172 RIL_Errno RspEnterSimPinData(
173         int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) { // 2
174     DBG("RspEnterSimPinData E");
175 
176     ril_proto::RspEnterSimPin *rsp = new ril_proto::RspEnterSimPin();
177     rsp->ParseFromArray(buffer->data(), buffer->length());
178     DBG("retries_remaining=%d", rsp->retries_remaining());
179     int retries_remaining = rsp->retries_remaining();
180 
181     // Complete the request
182     s_rilenv->OnRequestComplete(token, rilErrno,
183             &retries_remaining, sizeof(retries_remaining));
184 
185     DBG("RspEnterSimPinData X rilErrno=%d", rilErrno);
186     return rilErrno;
187 }
188 
189 /**
190  * Handle RIL_REQUEST_GET_CURRENT_CALLS response  // 9
191  */
RspGetCurrentCalls(int cmd,RIL_Token token,RIL_Errno rilErrno,Buffer * buffer)192 RIL_Errno RspGetCurrentCalls (
193         int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) { // 9
194     DBG("RspGetCurrentCalls E");
195 
196     ril_proto::RspGetCurrentCalls *rsp = new ril_proto::RspGetCurrentCalls();
197     rsp->ParseFromArray(buffer->data(), buffer->length());
198     int result_len = rsp->calls_size() * sizeof(const RIL_Call *);
199     DBG("RspGetCurrentCalls rilErrno=%d result_len=%d", rilErrno, result_len);
200     RIL_Call **result = (RIL_Call **)alloca(result_len);
201     for (int i = 0; i < rsp->calls_size();  i++) {
202         const ril_proto::RilCall& srcCall = rsp->calls(i);
203         RIL_Call *dstCall = (RIL_Call *)alloca(sizeof(RIL_Call));
204 
205         result[i] = dstCall;
206         dstCall->state = (RIL_CallState)srcCall.state();
207         dstCall->index = srcCall.index();
208         dstCall->toa = srcCall.toa();
209         dstCall->isMpty = (char)srcCall.is_mpty();
210         dstCall->isMT = (char)srcCall.is_mt();
211         dstCall->als = srcCall.als();
212         dstCall->isVoice = (char)srcCall.is_voice();
213         dstCall->isVoicePrivacy = (char)srcCall.is_voice_privacy();
214         dstCall->number = (char *)srcCall.number().c_str();
215         dstCall->numberPresentation = srcCall.number_presentation();
216         dstCall->name = (char *)srcCall.name().c_str();
217         dstCall->namePresentation = srcCall.name_presentation();
218         if (srcCall.has_uus_info()) {
219             dstCall->uusInfo =
220                 (RIL_UUS_Info *)alloca(sizeof(RIL_UUS_Info));
221             dstCall->uusInfo->uusType =
222                 (RIL_UUS_Type)srcCall.uus_info().uus_type();
223             dstCall->uusInfo->uusDcs =
224                 (RIL_UUS_DCS)srcCall.uus_info().uus_dcs();
225             dstCall->uusInfo->uusLength =
226                 srcCall.uus_info().uus_length();
227             dstCall->uusInfo->uusData =
228                 (char *)srcCall.uus_info().uus_data().c_str();
229         } else {
230             dstCall->uusInfo = NULL;
231         }
232     }
233 
234     // Complete the request
235     s_rilenv->OnRequestComplete(token, rilErrno, result, result_len);
236 
237     DBG("RspGetCurrentCalls X rilErrno=%d", rilErrno);
238     return rilErrno;
239 }
240 
241 
unmarshallRilSignalStrength(Buffer * buffer,RIL_SignalStrength_v6 * pSignalStrength)242 void unmarshallRilSignalStrength(Buffer *buffer, RIL_SignalStrength_v6 *pSignalStrength) {
243     // Retrieve response from response message
244     ril_proto::RspSignalStrength *rsp = new ril_proto::RspSignalStrength();
245     rsp->ParseFromArray(buffer->data(), buffer->length());
246     const ril_proto::RILGWSignalStrength& gwST = rsp->gw_signalstrength();
247     const ril_proto::RILCDMASignalStrength& cdmaST = rsp->cdma_signalstrength();
248     const ril_proto::RILEVDOSignalStrength& evdoST = rsp->evdo_signalstrength();
249     const ril_proto::RILLTESignalStrength& lteST = rsp->lte_signalstrength();
250 
251     // Copy the response message from response to format defined in ril.h
252     RIL_SignalStrength_v6 curSignalStrength;
253 
254     curSignalStrength.GW_SignalStrength.signalStrength = gwST.signal_strength();
255     curSignalStrength.GW_SignalStrength.bitErrorRate = gwST.bit_error_rate();
256     curSignalStrength.CDMA_SignalStrength.dbm = cdmaST.dbm();
257     curSignalStrength.CDMA_SignalStrength.ecio = cdmaST.ecio();
258     curSignalStrength.EVDO_SignalStrength.dbm = evdoST.dbm();
259     curSignalStrength.EVDO_SignalStrength.ecio = evdoST.ecio();
260     curSignalStrength.EVDO_SignalStrength.signalNoiseRatio = evdoST.signal_noise_ratio();
261     curSignalStrength.LTE_SignalStrength.signalStrength = lteST.signal_strength();
262     curSignalStrength.LTE_SignalStrength.rsrp = lteST.rsrp();
263     curSignalStrength.LTE_SignalStrength.rsrq = lteST.rsrq();
264     curSignalStrength.LTE_SignalStrength.rssnr = lteST.rssnr();
265     curSignalStrength.LTE_SignalStrength.cqi = lteST.cqi();
266 
267     DBG("print response signal strength: ");
268     DBG("gw signalstrength = %d", curSignalStrength.GW_SignalStrength.signalStrength);
269     DBG("gw_bitErrorRate = %d", curSignalStrength.GW_SignalStrength.bitErrorRate);
270     DBG("cdma_dbm = %d", curSignalStrength.CDMA_SignalStrength.dbm);
271     DBG("cdma_ecio = %d", curSignalStrength.CDMA_SignalStrength.ecio);
272     DBG("evdo_dbm = %d", curSignalStrength.EVDO_SignalStrength.dbm);
273     DBG("evdo_ecio = %d", curSignalStrength.EVDO_SignalStrength.ecio);
274     DBG("evdo_signalNoiseRatio = %d", curSignalStrength.EVDO_SignalStrength.signalNoiseRatio);
275     DBG("lte_signalStrength = %d", curSignalStrength.LTE_SignalStrength.signalStrength);
276     DBG("lte_rsrp = %d", curSignalStrength.LTE_SignalStrength.rsrp);
277     DBG("lte_rsrq = %d", curSignalStrength.LTE_SignalStrength.rsrq);
278     DBG("lte_rssnr = %d", curSignalStrength.LTE_SignalStrength.rssnr);
279     DBG("lte_cqi = %d", curSignalStrength.LTE_SignalStrength.cqi);
280 }
281 
282 /**
283  * Handle RIL_REQUEST_SIGNAL_STRENGTH response
284  */
RspSignalStrength(int cmd,RIL_Token token,RIL_Errno rilErrno,Buffer * buffer)285 RIL_Errno RspSignalStrength(
286         int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) { // 19
287     DBG("RspSignalStrength E");
288 
289     DBG("cmd = %d, token=%p, rilErrno=%d", cmd, token, rilErrno);
290 
291     // Retrieve response from response message
292     ril_proto::RspSignalStrength *rsp = new ril_proto::RspSignalStrength();
293     rsp->ParseFromArray(buffer->data(), buffer->length());
294     const ril_proto::RILGWSignalStrength& gwST = rsp->gw_signalstrength();
295     const ril_proto::RILCDMASignalStrength& cdmaST = rsp->cdma_signalstrength();
296     const ril_proto::RILEVDOSignalStrength& evdoST = rsp->evdo_signalstrength();
297     const ril_proto::RILLTESignalStrength& lteST = rsp->lte_signalstrength();
298 
299     // Copy the response message from response to format defined in ril.h
300     RIL_SignalStrength_v6 curSignalStrength;
301     unmarshallRilSignalStrength(buffer, &curSignalStrength);
302 
303     // Complete the request
304     s_rilenv->OnRequestComplete(token, rilErrno, &curSignalStrength, sizeof(curSignalStrength));
305 
306     DBG("RspSignalStrength X rilErrno=%d", rilErrno);
307     return rilErrno;
308 }
309 
310 /**
311  * Handle RIL_REQUEST_OPERATOR response
312  */
RspOperator(int cmd,RIL_Token token,RIL_Errno rilErrno,Buffer * buffer)313 RIL_Errno RspOperator(
314         int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer *buffer) { // 22
315     int status;
316 
317     DBG("RspOperator E");
318 
319     ril_proto::RspOperator *rsp = new ril_proto::RspOperator();
320     rsp->ParseFromArray(buffer->data(), buffer->length());
321     const char *result[3] = { NULL, NULL, NULL };
322     if (rsp->has_long_alpha_ons()) {
323         DBG("long_alpha_ons=%s", rsp->long_alpha_ons().c_str());
324         result[0] = rsp->long_alpha_ons().c_str();
325     }
326     if (rsp->has_short_alpha_ons()) {
327         DBG("short_alpha_ons=%s", rsp->short_alpha_ons().c_str());
328         result[1] = rsp->short_alpha_ons().c_str();
329     }
330     if (rsp->has_mcc_mnc()) {
331         DBG("mcc_mnc=%s", rsp->mcc_mnc().c_str());
332         result[2] = rsp->mcc_mnc().c_str();
333     }
334 
335     // Complete the request
336     s_rilenv->OnRequestComplete(token, rilErrno, result, sizeof(result));
337 
338     DBG("RspOperator X rilErrno=%d", rilErrno);
339     return rilErrno;
340 }
341 
342 // ----------------- Handle unsolicited response ----------------------------------------
343  /**
344  * Handle RIL_UNSOL_SIGNAL_STRENGTH response
345  */
UnsolRspSignalStrength(int cmd,Buffer * buffer)346 void UnsolRspSignalStrength(int cmd, Buffer* buffer) {
347 
348     DBG("UnsolRspSignalStrength E");
349     ALOGE("unsolicited response command: %d", cmd);
350     // Retrieve response from response message
351     ril_proto::RspSignalStrength *rsp = new ril_proto::RspSignalStrength();
352     rsp->ParseFromArray(buffer->data(), buffer->length());
353     const ril_proto::RILGWSignalStrength& gwST = rsp->gw_signalstrength();
354     const ril_proto::RILCDMASignalStrength& cdmaST = rsp->cdma_signalstrength();
355     const ril_proto::RILEVDOSignalStrength& evdoST = rsp->evdo_signalstrength();
356 
357     // Copy the response message from response to format defined in ril.h
358     RIL_SignalStrength_v6 curSignalStrength;
359     unmarshallRilSignalStrength(buffer, &curSignalStrength);
360 
361     s_rilenv->OnUnsolicitedResponse(cmd, &curSignalStrength, sizeof(curSignalStrength));
362     DBG("UnsolRspSignalStrength X");
363 }
364 
365 /**
366  * Maps for converting request complete and unsoliciated response
367  * protobufs to ril data arrays.
368  */
369 typedef RIL_Errno (*RspConversion)(
370                 int cmd, RIL_Token token, RIL_Errno rilErrno, Buffer* buffer);
371 typedef std::map<int, RspConversion> RspConversionMap;
372 RspConversionMap rilRspConversionMap;
373 
374 typedef void (*UnsolRspConversion)(int cmd, Buffer* buffer);
375 typedef std::map<int, UnsolRspConversion> UnsolRspConversionMap;
376 UnsolRspConversionMap unsolRilRspConversionMap;
377 
378 /**
379  * Send a ril request complete response.
380  */
SendRilRequestComplete(const v8::Arguments & args)381 v8::Handle<v8::Value> SendRilRequestComplete(const v8::Arguments& args) {
382     DBG("SendRilRequestComplete E");
383     v8::HandleScope handle_scope;
384     v8::Handle<v8::Value> retValue;
385 
386     int cmd;
387     RIL_Errno rilErrno;
388     RIL_Token token;
389     Buffer* buffer;
390 
391     /**
392      * Get the arguments. There should be at least 3, cmd,
393      * ril error code and token. Optionally a Buffer containing
394      * the protobuf representation of the data to return.
395      */
396     if (args.Length() < REQUEST_COMPLETE_REQUIRED_CMDS) {
397         // Expecting a cmd, ERROR and token
398         ALOGE("SendRilRequestComplete X %d parameters"
399              " expecting at least %d: rilErrno, cmd, and token",
400                 args.Length(), REQUEST_COMPLETE_REQUIRED_CMDS);
401         return v8::Undefined();
402     }
403     v8::Handle<v8::Value> v8RilErrCode(
404                     args[REQUEST_COMPLETE_RIL_ERR_CODE_INDEX]->ToObject());
405     rilErrno = RIL_Errno(v8RilErrCode->NumberValue());
406 
407     v8::Handle<v8::Value> v8Cmd(
408                     args[REQUEST_COMPLETE_CMD_INDEX]->ToObject());
409     cmd = int(v8Cmd->NumberValue());
410 
411     v8::Handle<v8::Value> v8Token(
412                     args[REQUEST_COMPLETE_TOKEN_INDEX]->ToObject());
413     token = RIL_Token(int64_t(v8Token->NumberValue()));
414 
415     if (args.Length() >= (REQUEST_COMPLETE_DATA_INDEX+1)) {
416         buffer = ObjectWrap::Unwrap<Buffer>(
417                     args[REQUEST_COMPLETE_DATA_INDEX]->ToObject());
418     } else {
419         buffer = NULL;
420     }
421 
422     DBG("SendRilRequestComplete: rilErrno=%d, cmd=%d, token=%p", rilErrno, cmd, token);
423     RspConversionMap::iterator itr;
424     itr = rilRspConversionMap.find(cmd);
425     if (itr != rilRspConversionMap.end()) {
426         itr->second(cmd, token, rilErrno, buffer);
427     } else {
428         if ((buffer == NULL) || (buffer->length() <= 0)) {
429             // Nothing to convert
430             rilErrno = RIL_E_SUCCESS;
431         } else {
432             // There was a buffer but we don't support the resonse yet.
433             ALOGE("SendRilRequestComplete: No conversion routine for cmd %d,"
434                     " return RIL_E_REQUEST_NOT_SUPPORTED", cmd);
435             rilErrno = RIL_E_REQUEST_NOT_SUPPORTED;
436         }
437         // Complete the request
438         s_rilenv->OnRequestComplete(token, rilErrno, NULL, 0);
439     }
440 
441     DBG("SendRilRequestComplete X rillErrno=%d", rilErrno);
442     return v8::Undefined();
443 }
444 
445 /**
446  * Send an unsolicited response.
447  */
SendRilUnsolicitedResponse(const v8::Arguments & args)448 v8::Handle<v8::Value> SendRilUnsolicitedResponse(const v8::Arguments& args) {
449     DBG("SendRilUnsolicitedResponse E");
450     v8::HandleScope handle_scope;
451     v8::Handle<v8::Value> retValue;
452 
453     int status;
454     void *data;
455     size_t datalen;
456 
457     int cmd;
458     Buffer* buffer;
459 
460     /**
461      * Get the cmd number and data arguments
462      */
463     if (args.Length() < UNSOL_RESPONSE_REQUIRED_CMDS) {
464         // Expecting a cmd
465         ALOGE("SendRilUnsolicitedResponse X %d parameters"
466              " expecting at least a cmd",
467                 args.Length());
468         return v8::Undefined();
469     }
470     v8::Handle<v8::Value> v8RilErrCode(args[UNSOL_RESPONSE_CMD_INDEX]->ToObject());
471     cmd = int(v8RilErrCode->NumberValue());
472 
473     // data is optional
474     if (args.Length() >= (UNSOL_RESPONSE_DATA_INDEX+1)) {
475         buffer = ObjectWrap::Unwrap<Buffer>(args[UNSOL_RESPONSE_DATA_INDEX]->ToObject());
476     } else {
477         buffer = NULL;
478     }
479 
480     UnsolRspConversionMap::iterator itr;
481     itr = unsolRilRspConversionMap.find(cmd);
482     if (itr != unsolRilRspConversionMap.end()) {
483         itr->second(cmd, buffer);
484     } else {
485         if ((buffer == NULL) || (buffer->length() <= 0)) {
486             // Nothing to convert
487             data = NULL;
488             datalen = 0;
489         } else {
490             // There was a buffer but we don't support the response yet.
491             ALOGE("SendRilUnsolicitedResponse: No conversion routine for cmd %d,"
492                     " return RIL_E_REQUEST_NOT_SUPPORTED", cmd);
493             data = NULL;
494             datalen = 0;
495         }
496         s_rilenv->OnUnsolicitedResponse(cmd, NULL, 0);
497     }
498 
499     DBG("SendRilUnsolicitedResponse X");
500     return v8::Undefined();
501 }
502 
responsesInit(v8::Handle<v8::Context> context)503 int responsesInit(v8::Handle<v8::Context> context) {
504     ALOGD("responsesInit E");
505     int status = STATUS_OK;
506 
507     rilRspConversionMap[RIL_REQUEST_GET_SIM_STATUS] = RspGetSimStatus; // 1
508     rilRspConversionMap[RIL_REQUEST_ENTER_SIM_PIN] = RspEnterSimPinData; // 2
509     rilRspConversionMap[RIL_REQUEST_GET_CURRENT_CALLS] = RspGetCurrentCalls; // 9
510     rilRspConversionMap[RIL_REQUEST_GET_IMSI] = RspString; // 11
511     rilRspConversionMap[RIL_REQUEST_HANGUP] = RspWithNoData; // 12
512     rilRspConversionMap[RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND] = RspWithNoData; // 13
513     rilRspConversionMap[RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND] = RspWithNoData; // 14
514     rilRspConversionMap[RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE] = RspWithNoData; // 15
515     rilRspConversionMap[RIL_REQUEST_CONFERENCE] = RspWithNoData;  // 16
516     rilRspConversionMap[RIL_REQUEST_LAST_CALL_FAIL_CAUSE] = RspIntegers;  // 18
517     rilRspConversionMap[RIL_REQUEST_SIGNAL_STRENGTH] = RspSignalStrength; // 19
518     rilRspConversionMap[RIL_REQUEST_VOICE_REGISTRATION_STATE] = RspStrings; // 20
519     rilRspConversionMap[RIL_REQUEST_DATA_REGISTRATION_STATE] = RspStrings; // 21
520     rilRspConversionMap[RIL_REQUEST_OPERATOR] = RspOperator; // 22
521     rilRspConversionMap[RIL_REQUEST_GET_IMEI] = RspString; // 38
522     rilRspConversionMap[RIL_REQUEST_GET_IMEISV] = RspString; // 39
523     rilRspConversionMap[RIL_REQUEST_ANSWER] = RspWithNoData; // 39
524     rilRspConversionMap[RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE] = RspIntegers; // 45
525     rilRspConversionMap[RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC] = RspWithNoData; // 46
526     rilRspConversionMap[RIL_REQUEST_BASEBAND_VERSION] = RspString; // 51
527     rilRspConversionMap[RIL_REQUEST_SEPARATE_CONNECTION] = RspWithNoData;  // 52
528     rilRspConversionMap[RIL_REQUEST_SET_MUTE] = RspWithNoData;  // 53
529     rilRspConversionMap[RIL_REQUEST_SCREEN_STATE] = RspWithNoData; // 61
530 
531     unsolRilRspConversionMap[RIL_UNSOL_SIGNAL_STRENGTH] = UnsolRspSignalStrength;  // 1009
532 
533 
534     ALOGD("responsesInit X: status=%d", status);
535     return STATUS_OK;
536 }
537