aboutsummaryrefslogtreecommitdiff
path: root/u300-ril-stk.c
blob: ea58aa3d4877a3212daac64a797a8a5aaa56789d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
/* ST-Ericsson U300 RIL
**
** Copyright (C) ST-Ericsson AB 2008-2010
** 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.
**
** Based on reference-ril by The Android Open Source Project.
**
** Heavily modified for ST-Ericsson U300 modems.
** Author: Christian Bejram <christian.bejram@stericsson.com>
** Author: Sverre Vegge <sverre.vegge@stericsson.com>
*/

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#include <telephony/ril.h>
#include "atchannel.h"
#include "at_tok.h"
#include "misc.h"
#include "u300-ril.h"

#define LOG_TAG "RILV"
#include <utils/Log.h>

enum SimResetMode {
    SAT_SIM_INITIALIZATION_AND_FULL_FILE_CHANGE_NOTIFICATION = 0,
    SAT_FILE_CHANGE_NOTIFICATION = 1,
    SAT_SIM_INITIALIZATION_AND_FILE_CHANGE_NOTIFICATION = 2,
    SAT_SIM_INITIALIZATION = 3,
    SAT_SIM_RESET = 4,
    SAT_NAA_APPLICATION_RESET = 5,
    SAT_NAA_SESSION_RESET = 6,
    SAT_STEERING_OF_ROAMING = 7
};

typedef struct {
    int cmdNumber;
    int cmdQualifier;
    int Result;
} REFRESH_Status;

/*****************************************************/
/* Controlled static state variables - section start */
/*****************************************************/
#define __s_refeshStatus -1
static REFRESH_Status s_refeshStatus = {__s_refeshStatus,
                                        __s_refeshStatus,
                                        __s_refeshStatus};

#define __s_StkIsRunning 0
static bool s_StkIsRunning = __s_StkIsRunning;
/*****************************************************/
/* Controlled static state variables - section end   */
/*****************************************************/

/**
 * RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE
 *
 * Requests to send a terminal response to SIM for a received
 * proactive command.
 */
void requestStkSendTerminalResponse(void *data, size_t datalen,
                                    RIL_Token t)
{
    char *cmd = NULL;
    int err;
    ATResponse *atresponse = NULL;
    const char *stkResponse = (const char *) data;
#ifndef USE_LEGACY_SAT_AT_CMDS
    asprintf(&cmd, "AT+CUSATT=\"%s\"", stkResponse);
#else
    asprintf(&cmd, "AT*STKR=\"%s\"", stkResponse);
#endif
    err = at_send_command(cmd, &atresponse);
    free(cmd);
    if (err < 0 || atresponse->success == 0)
        goto error;

    RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
    goto exit;

error:
    RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

exit:
    at_response_free(atresponse);
    return;
}

/**
 * RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND
 *
 * Requests to send a SAT/USAT envelope command to SIM.
 * The SAT/USAT envelope command refers to 3GPP TS 11.14 and 3GPP TS 31.111.
 */
void requestStkSendEnvelopeCommand(void *data, size_t datalen, RIL_Token t)
{
    char *cmd = NULL;
    char *line = NULL;
    char *stkResponse = NULL;
    int err;
    ATResponse *atresponse = NULL;
    const char *ec = (const char *) data;

#ifndef USE_LEGACY_SAT_AT_CMDS
    asprintf(&cmd, "AT+CUSATE=\"%s\"", ec);
    err = at_send_command_multiline(cmd, "+CUSATER:", &atresponse);
#else
    asprintf(&cmd, "AT*STKE=\"%s\"", ec);
    err = at_send_command_multiline(cmd, "*STKE:", &atresponse);
#endif
    free(cmd);

    if (err < 0 || atresponse->success == 0)
        goto error;

    if (atresponse->p_intermediates) {
        line = atresponse->p_intermediates->line;

        err = at_tok_start(&line);
        if (err < 0)
            goto error;

        err = at_tok_nextstr(&line, &stkResponse);
        if (err < 0)
            goto error;

        RIL_onRequestComplete(t, RIL_E_SUCCESS, stkResponse,
                              sizeof(char *));
    } else
        RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);

    goto exit;

error:
    RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

exit:
    at_response_free(atresponse);
    return;
}

/**
 * RIL_REQUEST_STK_GET_PROFILE
 *
 * Requests the profile of SIM tool kit.
 * The profile indicates the SAT/USAT features supported by ME.
 * The SAT/USAT features refer to 3GPP TS 11.14 and 3GPP TS 31.111.
 */
void requestStkGetProfile(void *data, size_t datalen, RIL_Token t)
{
    ATResponse *atresponse = NULL;
    char *line = NULL;
    char *response = NULL;
    int err = 0;
    int skip = 0;

#ifndef USE_LEGACY_SAT_AT_CMDS
    err = at_send_command_singleline("AT+CUSATR=3", "+CUSATR:", &atresponse);
#else
    err = at_send_command_singleline("AT*STKC?", "*STKC:", &atresponse);
#endif
    if (err < 0 || atresponse->success == 0)
        goto error;

    line = atresponse->p_intermediates->line;

    err = at_tok_start(&line);
    if (err < 0)
        goto error;

    err = at_tok_nextint(&line, &skip);

    if (err < 0)
        goto error;

    err = at_tok_nextstr(&line, &response);
    if (err < 0 || response == NULL)
        goto error;

    RIL_onRequestComplete(t, RIL_E_SUCCESS, response, sizeof(char *));
    goto exit;

error:
    RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

exit:
    at_response_free(atresponse);
    return;
}

static bool reportStkServiceIsRunning(void)
{
    char *cmd = NULL;
    int err;
    bool res = true;
    ATResponse *atresponse = NULL;

    /*
     * REFRESH proactive SAT command information
     *   onoff = 1 Enable REFRESH information reporting.
     * Android does not support handling of REFRESH as a proactive command.
     * *ESIMRF is a proprietary AT command to handle RIL_UNSOL_SIM_REFRESH.
     */
#ifndef USE_LEGACY_SAT_AT_CMDS
    err = at_send_command("AT*ESHLREF=1", &atresponse);
#else
    err = at_send_command("AT*ESIMRF=1", &atresponse);
#endif
    if (err < 0 || atresponse->success == 0)
        LOGE("%s(): Failed to enable REFRESH reporting!", __func__);
    at_response_free(atresponse);
    atresponse = NULL;

#ifndef USE_LEGACY_SAT_AT_CMDS
    /*
     * SET UP CALL proactive SAT command information
     *   n = 3 Enable SET UP CALL information reporting with
     *         <raw_proactice_cmd>.
     * Android does not support handling of SET UP CALL as a proactive command.
     * *ESHLVOC is a proprietary AT command for passing the raw proactive
     * command to Android using RIL_UNSOL_STK_EVENT_NOTIFY.
     */
    err = at_send_command("AT*ESHLVOC=3", &atresponse);
    if (err < 0 || atresponse->success == 0)
        LOGE("%s(): Failed to enable high level SETUP CALL reporting!",
             __func__);
    at_response_free(atresponse);
    atresponse = NULL;

    /*
     * SEND SS proactive SAT command information
     *   n = 1 Enable SEND SS information reporting with
     *         <raw_proactice_cmd>.
     * Android does not support handling of SEND SS as a proactive command.
     * *ESHLSS is a proprietary AT command for passing the raw proactive
     * command to Android using RIL_UNSOL_STK_EVENT_NOTIFY.
     */
    err = at_send_command("AT*ESHLSS=3", &atresponse);
    if (err < 0 || atresponse->success == 0)
        LOGE("%s(): Failed to enable high level SEND SS reporting!", __func__);
    at_response_free(atresponse);
    atresponse = NULL;

    /*
     * SEND USSD proactive SAT command information
     *   onoff = 3 Enable SEND UUSD reporting with
     *             <raw_proactice_cmd>.
     * Android does not support handling of SEND USSD as a proactive command.
     * *ESHLUSS is a proprietary AT command for passing the raw proactive
     * command to Android using RIL_UNSOL_STK_EVENT_NOTIFY.
     */
    err = at_send_command("AT*ESHLUSS=3", &atresponse);
    if (err < 0 || atresponse->success == 0)
        LOGE("%s(): Failed to enable high level SEND USSD reporting!",
             __func__);
    at_response_free(atresponse);
    atresponse = NULL;

    /*
     * SEND DTMF proactive SAT command information
     *   n = 3 Enable SEND DTMF information reporting
     *         with <raw_proactice_cmd>.
     * Android does not support handling of SEND DTMF as a proactive command.
     * *ESHLDTMF is a proprietary AT command for passing the raw proactive
     * command to Android using RIL_UNSOL_STK_EVENT_NOTIFY.
     */
    err = at_send_command("AT*ESHLDTMF=3", &atresponse);
    if (err < 0 || atresponse->success == 0)
        LOGE("%s(): Failed to enable high level SEND DTMF reporting!",
             __func__);
    at_response_free(atresponse);
    atresponse = NULL;

    /*
     * SEND SHORT MESSAGE proactive SAT command information
     *   onoff = 1 Enable SEND SHORT MESSAGE information reporting.
     * Android does not support handling of SEND SHORT MESSAGE as a
     * proactive command.
     * *ESHLSMS is a proprietary AT command for passing the raw proactive
     * command to Android using RIL_UNSOL_STK_EVENT_NOTIFY.
     */
    err = at_send_command("AT*ESHLSMS=3", &atresponse);
    if (err < 0 || atresponse->success == 0)
        LOGE("%s(): Failed to enable HIGH LEVEL SEND SHORT MESSAGE reporting!",
             __func__);
    at_response_free(atresponse);
    atresponse = NULL;
#endif

    /* Activate (U)SAT profile */
#ifndef USE_LEGACY_SAT_AT_CMDS
    asprintf(&cmd, "AT+CUSATA=1");
#else
    asprintf(&cmd, "AT*STKC=1,\"000000000000000000\"");
#endif
    err = at_send_command(cmd, &atresponse);
    free(cmd);
    if (err < 0 || atresponse->success == 0) {
        LOGE("%s(): Failed to activate (U)SAT profile", __func__);
        goto error;
    }
    goto exit;

error:
    LOGE("%s() failed initiating STK service", __func__);
    res = false;

exit:
    at_response_free(atresponse);
    return res;
}

/**
 * RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING
 *
 * Turn on STK unsol commands.
 */
void requestReportStkServiceIsRunning(void *data, size_t datalen, RIL_Token t)
{
    if (s_StkIsRunning)
        goto finally;

    if (reportStkServiceIsRunning()) {
        /* store STK service state in case of later modem restart */
        s_StkIsRunning = true;
    } else {
        goto error;
    }

finally:
    RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
    goto exit;

error:
    RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

exit:
    return;
}

/**
 * RIL_REQUEST_STK_SET_PROFILE
 *
 * Download the STK terminal profile as part of SIM initialization
 * procedure.
 */
void requestStkSetProfile(void *data, size_t datalen, RIL_Token t)
{
    char *cmd = NULL;
    int err;
    ATResponse *atresponse = NULL;
    const char *profile = (const char *) data;
#ifndef USE_LEGACY_SAT_AT_CMDS
    asprintf(&cmd, "AT+CUSATW=0,\"%s\"", profile);
#else
    asprintf(&cmd, "AT*STKC=0,\"%s\"", profile);
#endif
    err = at_send_command(cmd, &atresponse);
    free(cmd);

    if (err < 0 || atresponse->success == 0)
        goto error;

    RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
    goto exit;

error:
    RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

exit:
    at_response_free(atresponse);
    return;

}

/**
 * RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM
 *
 * When STK application gets RIL_UNSOL_STK_CALL_SETUP, the call actually has
 * been initialized by ME already. (We could see the call has been in the 'call
 * list') So, STK application needs to accept/reject the call according as user
 * operations.
 */
void requestStkHandleCallSetupRequestedFromSIM(void *data,
                                               size_t datalen, RIL_Token t)
{
    char *cmd = NULL;
    int err;
    ATResponse *atresponse = NULL;
    int stkResponse = ((int *) data)[0];

    if (stkResponse < 0)
        goto error;

    /* Accept call for any value > 0, reject for 0 */
    asprintf(&cmd, "AT*ESHLVOCR=%d", (stkResponse ? 1 : 0));
    err = at_send_command(cmd, &atresponse);
    free(cmd);
    if (err < 0 || atresponse->success == 0)
        goto error;

    RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
    goto exit;

error:
    RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

exit:
    at_response_free(atresponse);
    return;
}

/**
 * RIL_UNSOL_STK_PROACTIVE_COMMAND
 *
 * Indicate when SIM issue a STK proactive command to applications.
 *
 */
void onStkProactiveCommand(const char *s)
{
    char *str = NULL;
    char *line = NULL;
    char *tok = NULL;
    int err;

    tok = line = strdup(s);

    err = at_tok_start(&tok);
    if (err < 0)
        goto error;

    err = at_tok_nextstr(&tok, &str);
    if (err < 0)
        goto error;

    RIL_onUnsolicitedResponse(RIL_UNSOL_STK_PROACTIVE_COMMAND, str,
                              sizeof(char *));
    goto exit;

error:
    LOGE("%s failed to parse proactive command!", __func__);

exit:
    free(line);
    return;
}

/**
 * Any client using +CGLA must always use this function to
 * decide whether to obtain a new sessionid.
 */
int checkAndClear_SIM_NAA_SESSION_RESET(void)
{
    if (s_refeshStatus.cmdQualifier != SAT_NAA_SESSION_RESET)
        return 0;

    s_refeshStatus.cmdQualifier = __s_refeshStatus;
    return 1;
}

/**
 * Send TERMINAL RESPONSE after processing REFRESH proactive command
 */
static void sendRefreshTerminalResponse(void *param)
{
    ATResponse *atresponse = NULL;
    char *cmd = NULL;
    int err;

#ifndef USE_LEGACY_SAT_AT_CMDS
    asprintf(&cmd, "AT+CUSATT=\"8103%02x01%02x820282818301%02x\"",
             s_refeshStatus.cmdNumber, s_refeshStatus.cmdQualifier,
             s_refeshStatus.Result);
#else
    asprintf(&cmd, "AT*STKR=\"8103%02x01%02x820282818301%02x\"",
             s_refeshStatus.cmdNumber, s_refeshStatus.cmdQualifier,
             s_refeshStatus.Result);
#endif

    err = at_send_command(cmd, &atresponse);
    free(cmd);
    if (err < 0 || atresponse->success == 0)
        goto error;

   goto exit;

error:
    LOGE("%s failed!", __func__);

exit:
    at_response_free(atresponse);
    return;
}

/**
 * RIL_UNSOL_SIM_REFRESH
 *
 * Indicate when SIM issue a REFRESH proactive command to applications.
 */
void onStkSimRefresh(const char *s)
{
    int commas = 0;
    char *line = NULL;
    char *tok = NULL;
    char *skip;
    int n = 0;
    int err = -1;
    int response[2];

    /*
     * Legacy: *ESIMRF: <cmdnumber>,<type>, [,<fileid>,<pathid>][,<fileid>…]
     * New:    *ESHLREF: <cmdnumber>,<mode>, [,<fileid>,<pathid>][,<fileid>…]
     */

    tok = line = strdup(s);

    err = at_tok_charcounter(tok, ',', &commas);
    if (err < 0)
        commas = 0;
    else
        commas -= 1;

    err = at_tok_start(&tok);
    if (err < 0)
        goto error;

    err = at_tok_nextint(&tok, &(s_refeshStatus.cmdNumber));
    if (err < 0)
        goto error;

    err = at_tok_nextint(&tok, &(s_refeshStatus.cmdQualifier));
    if (err < 0)
        goto error;

    switch(s_refeshStatus.cmdQualifier) {
    case SAT_SIM_INITIALIZATION_AND_FULL_FILE_CHANGE_NOTIFICATION:
    case SAT_SIM_INITIALIZATION_AND_FILE_CHANGE_NOTIFICATION:
    case SAT_SIM_INITIALIZATION:
    case SAT_NAA_APPLICATION_RESET:
        /* SIM initialized.  All files should be re-read. */
        response[0] = SIM_INIT;
        s_refeshStatus.Result = 3; /* success, EFs read */
        break;
    case SAT_FILE_CHANGE_NOTIFICATION:
        /* one or more files on SIM has been updated */
        response[0] = SIM_FILE_UPDATE;
        s_refeshStatus.Result = 3; /* success, EFs read */
        break;
    case SAT_SIM_RESET:
        /* SIM reset. All files should be re-read. */
        response[0] = SIM_RESET;
        break;
    case SAT_NAA_SESSION_RESET:
        /* one or more files on SIM has been updated */
        response[0] = SIM_FILE_UPDATE;
        s_refeshStatus.Result = 3; /* success, EFs read */
        break;
    case SAT_STEERING_OF_ROAMING:
       /* Pass through. Not supported by Android, should never happen */
    default:
        goto error;
    }

    if (response[0] != SIM_FILE_UPDATE) {
        response[1] = 0;
        RIL_onUnsolicitedResponse(RIL_UNSOL_SIM_REFRESH,
                                  response, sizeof(response));
        goto exit;
    }

    /* Loop for each fileid and pathid included */
    while (at_tok_hasmore(&tok)) {
        err = at_tok_nextint(&tok, &(response[1]));
        if (err < 0)
            break;
        /* <pathid> is not used by Android */
        err = at_tok_nextstr(&tok, &skip);
        if (err < 0)
            break;
        RIL_onUnsolicitedResponse(RIL_UNSOL_SIM_REFRESH,
                                  response, sizeof(response));
        n++;
    }

    /*
     * At least one set of fileid and pathid is expected when sending
     * SIM_FILE_UPDATE to Android
     */
    if (n > 0)
        goto exit;

error:
    LOGE("%s: failed to parse %s, default to SIM_INITIALIZATION", __func__, s);
    if (s_refeshStatus.cmdNumber < 0)
        s_refeshStatus.cmdNumber = 1;
    if (s_refeshStatus.cmdQualifier < 0)
        s_refeshStatus.cmdQualifier = SAT_SIM_INITIALIZATION;
    if (s_refeshStatus.Result < 0)
        s_refeshStatus.Result = 2; /* command performed with missing info */
    response[0] = SIM_INIT;
    response[1] = 0;
    RIL_onUnsolicitedResponse(RIL_UNSOL_SIM_REFRESH,
                              response, sizeof(response));

exit:
    if (response[0] != SIM_RESET) {
        /* AT commands cannot be sent from the at reader thread */
        enqueueRILEvent(CMD_QUEUE_DEFAULT,
                        sendRefreshTerminalResponse, NULL, NULL);
    }
    free(line);
    return;
}

void onStkEventNotify(const char *s)
{
    char *str = NULL;
    char *line = NULL;
    char *tok = NULL;
    int err;

    tok = line = strdup(s);

    err = at_tok_start(&tok);
    if (err < 0)
        goto error;

    err = at_tok_nextstr(&tok, &str);
    if (err < 0)
        goto error;

    goto exit;

error:
    LOGW("%s() Failed to parse response, %s. "
         "EVENT NOTIFY sent without parameter!", __func__, s);
    str = "";

exit:
    LOGI("%s() %s: EVENT NOTIFY sent with parameter: %s", __func__, s, str);
    RIL_onUnsolicitedResponse(RIL_UNSOL_STK_EVENT_NOTIFY, str,
                              sizeof(char *));
    free(line);
    return;
}

void onResetModemStateStk(int resetState)
{
    /* NOTE: Function is called in DEFAULT queueRunner context! */

    switch (resetState) {
    case RESET_START:
        /*
         * Issued prior to AT channels are recreated and shall therefore NOT
         * initiate modem communication!
         * -> Reset any internal static state variables and report to Android if
         *    nessasary.
         */
        /** s_refeshStatus */
        memset(&s_refeshStatus, __s_refeshStatus, sizeof(s_refeshStatus));

        /** s_StkIsRunning */
        /* No impact */
        break;
    case RESET_AT_INITIALIZED:
        /*
         * Issued when AT channels are available and before SIM is booted and
         * unlocked.
         * -> Re-setup modem and Android with internal static state variables
         *    which cannot be reset after modem restart.
         */
        /** s_refeshStatus */
        /* TODO */

        /** s_StkIsRunning */
        /* if received initiate modem again immediatly */
        if (s_StkIsRunning)
            (void)reportStkServiceIsRunning();
        break;
    case RESET_SIM_READY:
        /*
         * Issued after SIM is unlocked.
         * -> Re-setup modem with internal static state variables which
         *    cannot be reset before SIM is unlocked.
         */
        /** s_refeshStatus */
        /* TODO */

        /** s_StkIsRunning */
        /* No impact */
        break;
    default:
        LOGE("%s() received unknown resetState. Fatal error!", __func__);
        assert(0);
    }
}