Example #1
0
const char*
asimcard_io( ASimCard  sim, const char*  cmd )
{
    int  command, id, p1, p2, p3;
    char data[128] = {'\0'};
    SimFile ef;

    assert( memcmp( cmd, "+CRSM=", 6 ) == 0 );

    if ( sscanf(cmd, "+CRSM=%d,%d,%d,%d,%d,%s", &command, &id, &p1, &p2, &p3, data) >= 5 ) {
        switch (command) {
            case A_SIM_CMD_GET_RESPONSE:
                return asimcard_io_get_response(sim, id, p1, p2, p3);

            case A_SIM_CMD_READ_BINARY:
                return asimcard_io_read_binary(sim, id, p1, p2, p3);

            case A_SIM_CMD_READ_RECORD:
                return asimcard_io_read_record(sim, id, p1, p2, p3);

            case A_SIM_CMD_UPDATE_RECORD:
                return asimcard_io_update_record(sim, id, p1, p2, p3, data);

            case A_SIM_CMD_UPDATE_BINARY:
                ef = asimcard_ef_find(sim, id);
                return asimcard_ef_update_dedicated(ef, data);

            default:
                return SIM_RESPONSE_FUNCTION_NOT_SUPPORT;
        }
    }

    return SIM_RESPONSE_INCORRECT_PARAMETERS;
}
Example #2
0
static int
asimcard_ef_init( ASimCard card )
{
    char buff[128] = {'\0'};
    SimFile ef;

    // CPHS Network Operator Name(6F14):
    //   File size: 0x14
    //   PLMN Name: "Android"
    // @see Common PCN Handset Specification (Version 4.2) B.4.1.2 Network Operator Name
    ef = asimcard_ef_new_dedicated(0x6f14, SIM_FILE_READ_ONLY | SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "416e64726f6964ffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // CPHS Voice message waiting flag(6F11):
    //   File size: 0x01
    //   Voice Message Waiting Indicator flags:
    //     Line 1: no messages waiting.
    //     Line 2: no messages waiting.
    // @see Common PCN Handset Specification (Version 4.2) B.4.2.3 Voice Message Waiting Flags in the SIM
    ef = asimcard_ef_new_dedicated(0x6f11, SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "55");
    asimcard_ef_add(card, ef);

    // ICC Identification(2FE2):
    //   File size: 0x0a
    //   Identification number: "8901410321111851072" + (sim->instance_id)
    //                          e.g. "89014103211118510720" for first sim.
    // @see 3GPP TS 11.011 section 10.1.1 EFiccid (ICC Identification)
    ef = asimcard_ef_new_dedicated(0x2fe2, SIM_FILE_READ_ONLY);
    snprintf(buff, sizeof(buff), "981014301211811570%d2", card->instance_id);
    asimcard_ef_update_dedicated(ef, buff);
    asimcard_ef_add(card, ef);

    // CPHS Call forwarding flags(6F13):
    //   File size: 0x01
    //   Voice Call forward unconditional flags:
    //     Line 1: no call forwarding message waiting.
    //     Line 2: no call forwarding message waiting.
    // @see Common PCN Handset Specification (Version 4.2) B.4.5 Diverted Call Status Indicator
    ef = asimcard_ef_new_dedicated(0x6f13, SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "55");
    asimcard_ef_add(card, ef);

    // SIM Service Table(6F38):
    //   File size: 0x0f
    //   Enabled: 1..4, 7, 9..19, 25..27, 29, 30, 38, 51..56
    // @see 3GPP TS 51.011 section 10.3.7 EFsst (SIM Service Table)
    ef = asimcard_ef_new_dedicated(0x6f38, SIM_FILE_READ_ONLY | SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "ff30ffff3f003f0f000c0000f0ff00");
    asimcard_ef_add(card, ef);

    // Mailbox Identifier(6FC9):
    //   Record size: 0x04
    //   Record count: 0x02
    //   Mailbox Dialing Number Identifier - Voicemail:      1
    //   Mailbox Dialing Number Identifier - Fax:            no mailbox dialing number associated
    //   Mailbox Dialing Number Identifier - Eletronic Mail: no mailbox dialing number associated
    //   Mailbox Dialing Number Identifier - Other:          no mailbox dialing number associated
    //   Mailbox Dialing Number Identifier - Videomail:      no mailbox dialing number associated
    // @see 3GPP TS 31.102 section 4.2.62 EFmbi (Mailbox Identifier)
    ef = asimcard_ef_new_linear(0x6fc9, SIM_FILE_NEED_PIN, 0x04);
    asimcard_ef_update_linear(ef, 0x01, "01000000");
    asimcard_ef_update_linear(ef, 0x02, "ffffffff");
    asimcard_ef_add(card, ef);

    // Message Waiting Indication Status(6FCA):
    //   Record size: 0x05
    //   Record count: 0x02
    //   Message Waiting Indicator Status: all inactive
    //   Number of Voicemail Messages Waiting:       0
    //   Number of Fax Messages Waiting:             0
    //   Number of Electronic Mail Messages Waiting: 0
    //   Number of Other Messages Waiting:           0
    //   Number of Videomail Messages Waiting:       0
    // @see 3GPP TS 31.102 section 4.2.63 EFmwis (Message Waiting Indication Status)
    ef = asimcard_ef_new_linear(0x6fca, SIM_FILE_NEED_PIN, 0x05);
    asimcard_ef_update_linear(ef, 0x01, "0000000000");
    asimcard_ef_update_linear(ef, 0x02, "ffffffffff");
    asimcard_ef_add(card, ef);

    // Administrative Data(6FAD):
    //   File size: 0x04
    //   UE Operation mode: normal
    //   Additional information: none
    //   Length of MNC in the IMSI: 3
    // @see 3GPP TS 31.102 section 4.2.18 EFad (Administrative Data)
    ef = asimcard_ef_new_dedicated(0x6fad, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "00000003");
    asimcard_ef_add(card, ef);

    // EF-IMG (4F20) : Each record of this EF identifies instances of one particular graphical image,
    //                 which graphical image is identified by this EF's record number.
    //   Record size: 0x14
    //   Record count: 0x05
    //   Number of image instance specified by this record:               01
    //   Image instance width 8 points (raster image points):             08
    //   Image instance heigh 8 points  (raster image points):            08
    //   Color image coding scheme:                                       21
    //   Image identifier id of the EF where is store the image instance: 4F02
    //   Offset of the image instance in the 4F02 EF:                     0000
    //   Length of image instance data:                                   0016
    // @see 3GPP TS 51.011 section 10.6.1.1, EF-img
    ef = asimcard_ef_new_linear(0x4f20, 0x00, 0x14);
    asimcard_ef_update_linear(ef, 0x01, "010808214f0200000016ffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x05, "ffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // CPHS Information(6F16):
    //   File size: 0x02
    //   CPHS Phase: 2
    //   CPHS Service Table:
    //     CSP(Customer Service Profile): allocated and activated
    //     Information Numbers:           allocated and activated
    // @see Common PCN Handset Specification (Version 4.2) B.3.1.1 CPHS Information
    ef = asimcard_ef_new_dedicated(0x6f16, SIM_FILE_READ_ONLY | SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "0233");
    asimcard_ef_add(card, ef);

    // Service Provider Name(6F46):
    //   File size: 0x11
    //   Display Condition: 0x1, display network name in HPLMN; display SPN if not in HPLMN.
    //   Service Provider Name: "Android"
    // @see 3GPP TS 31.102 section 4.2.12 EFspn (Service Provider Name)
    // @see 3GPP TS 51.011 section 9.4.4 Referencing Management
    ef = asimcard_ef_new_dedicated(0x6f46, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "01416e64726f6964ffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Service Provider Display Information(6FCD):
    //   File size: 0x0d
    //   SPDI TLV (tag = 'a3')
    //     SPDI TLV (tag = '80')
    //       PLMN: 234136
    //       PLMN: 46692
    // @see 3GPP TS 31.102 section 4.2.66 EFspdi (Service Provider Display Information)
    // @see 3GPP TS 51.011 section 9.4.4 Referencing Management
    ef = asimcard_ef_new_dedicated(0x6fcd, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "a30b800932643164269fffffff");
    asimcard_ef_add(card, ef);

    // PLMN Network Name(6FC5):
    //   Record size: 0x18
    //   Record count: 0x0a
    //   Record:
    //     PNN 1: Fullname: "AT&T"
    // @see 3GPP TS 31.102 section 4.2.58 EFpnn (PLMN Network Name)
    // @see 3GPP TS 24.008
    ef = asimcard_ef_new_linear(0x6fc5, SIM_FILE_READ_ONLY, 0x18);
    asimcard_ef_update_linear(ef, 0x01, "43058441aa890affffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x0a, "ffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Operator PLMN List (6FC6):
    //   Record size: 0x18
    //   Record count: 0x0a
    //   Record:
    //     MCC = 310, MNC = 070, PNN = 01
    // @see 3GPP TS 31.102 section 4.2.59 EFopl (Operator PLMN List)
    // @see 3GPP TS 24.008
    ef = asimcard_ef_new_linear(0x6fc6, SIM_FILE_READ_ONLY, 0x18);
    asimcard_ef_update_linear(ef, 0x01, "1300700000fffe01ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x0a, "ffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // MSISDN(6F40):
    //   Record size: 0x20
    //   Record count: 0x04
    //   Alpha Identifier: (empty)
    //   Length of BCD number/SSC contents: 7
    //   TON and NPI: 0x81
    //   Dialing Number/SSC String: 15555218135, actual number is "155552"
    //                              + (sim->instance_id + 1) + emulator port,
    //                              e.g. "15555215554" for first sim of first emulator.
    //   Capacity/Configuration 2 Record Identifier: not used
    //   Extension 5 Record Identifier: not used
    // @see 3GPP TS 31.102 section 4.2.26 EFmsisdn (MSISDN)
    ef = asimcard_ef_new_linear(0x6f40, SIM_FILE_NEED_PIN, 0x20);
    snprintf(buff, sizeof(buff), "ffffffffffffffffffffffffffffffffffff0781515525%d%d%d%df%dffffffffffff",
        (card->port / 1000) % 10,
        (card->instance_id + 1),
        (card->port / 10) % 10,
        (card->port / 100) % 10,
        card->port % 10);
    asimcard_ef_update_linear(ef, 0x01, buff);
    asimcard_ef_update_linear(ef, 0x04, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Mailbox Dialing Numbers(6FC7):
    //   Record size: 0x20
    //   Record count: 0x02
    //   Alpha Identifier: "Voicemail"
    //   Length of BCD number/SSC contents: 7
    //   TON and NPI: 0x91
    //   Dialing Number/SSC String: 15552175049
    //   Capacity/Configuration 2 Record Identifier: not used
    //   Extension 6 Record Identifier: not used
    // @see 3GPP TS 31.102 section 4.2.60 EFmbdn (Mailbox Dialing Numbers)
    ef = asimcard_ef_new_linear(0x6fc7, SIM_FILE_NEED_PIN, 0x20);
    asimcard_ef_update_linear(ef, 0x01, "566f6963656d61696cffffffffffffffffff07915155125740f9ffffffffffff");
    asimcard_ef_update_linear(ef, 0x02, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Abbreviated Dialling Numbers(6F3A)
    //   Record size: 0x20
    //   Record count: 0xff
    //   Length of BCD number/SSC contents: 7
    //   TON and NPI: 0x81
    // @see 3GPP TS 51.011 section 10.5.1 EFadn
    ef = asimcard_ef_new_linear(0x6f3a, SIM_FILE_NEED_PIN, 0x20);
    // Alpha Id(Encoded with GSM 8 bit): "Mozilla", Dialling Number: 15555218201
    asimcard_ef_update_linear(ef, 0x01, "4d6f7a696c6c61ffffffffffffffffffffff07815155258102f1ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x80: "Saßê黃", Dialling Number: 15555218202
    asimcard_ef_update_linear(ef, 0x02, "800053006100df00ea9ec3ffffffffffffff07815155258102f2ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x81): "Fire 火", Dialling Number: 15555218203
    asimcard_ef_update_linear(ef, 0x03, "8106e04669726520ebffffffffffffffffff07815155258102f3ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x82): "Huang 黃", Dialling Number: 15555218204
    asimcard_ef_update_linear(ef, 0x04, "82079e804875616e6720c3ffffffffffffff07815155258102f4ffffffffffff");
    asimcard_ef_update_linear(ef, 0xff, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Fixed Dialling Numbers(6F3B)
    //   Record size: 0x20
    //   Record count: 0xff
    //   Length of BCD number/SSC contents: 7
    //   TON and NPI: 0x81
    // @see 3GPP TS 51.011 section 10.5.2 EFfdn
    ef = asimcard_ef_new_linear(0x6f3b, SIM_FILE_NEED_PIN, 0x20);
    // Alpha Id(Encoded with GSM 8 bit): "Mozilla", Dialling Number: 15555218201
    asimcard_ef_update_linear(ef, 0x01, "4d6f7a696c6c61ffffffffffffffffffffff07815155258102f1ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x80: "Saßê黃", Dialling Number: 15555218202
    asimcard_ef_update_linear(ef, 0x02, "800053006100df00ea9ec3ffffffffffffff07815155258102f2ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x81): "Fire 火", Dialling Number: 15555218203
    asimcard_ef_update_linear(ef, 0x03, "8106e04669726520ebffffffffffffffffff07815155258102f3ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x82): "Huang 黃", Dialling Number: 15555218204
    asimcard_ef_update_linear(ef, 0x04, "82079e804875616e6720c3ffffffffffffff07815155258102f4ffffffffffff");
    asimcard_ef_update_linear(ef, 0xff, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Cell Broadcast Message Identifier selection(6F45):
    //   File size: 0x06
    //   CB Message Identifier 1: 45056(B000)
    //   CB Message Identifier 2: 65535(FFFF, not used)
    //   CB Message Identifier 3: 61440(F000, not settable by MMI)
    // @see 3GPP TS 31.102 section 4.2.14 EFcbmi (Cell Broadcast Message Identifier selection)
    ef = asimcard_ef_new_dedicated(0x6f45, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "b000fffff000");
    asimcard_ef_add(card, ef);

    // Cell Broadcast Message Identifier for Data Download(6F48):
    //   File size: 0x06
    //   CB Message Identifier 1: 45056(C001)
    //   CB Message Identifier 2: 65535(FFFF, not used)
    //   CB Message Identifier 3: 61440(F001, not settable by MMI)
    // @see 3GPP TS 31.102 v110.02.0 section 4.2.20 EFcbmid (Cell Broadcast Message Identifier for Data Download)
    ef = asimcard_ef_new_dedicated(0x6f48, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "c001fffff001");
    asimcard_ef_add(card, ef);

    // Cell Broadcast Message Identifier Range selection(6F50):
    //   File size: 0x10
    //   CB Message Identifier Range 1: 45058..49152(B002..C000)
    //   CB Message Identifier Range 2: 65535..49153(FFFF..C001, should be ignored)
    //   CB Message Identifier Range 3: 49153..65535(C001..FFFF, should be ignored)
    //   CB Message Identifier Range 4: 61442..65280(F002..FF00, not settable by MMI)
    // @see 3GPP TS 31.102 section 4.2.14 EFcbmir (Cell Broadcast Message Identifier Range selection)
    ef = asimcard_ef_new_dedicated(0x6f50, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "b002c000ffffc001c001fffff002ff00");
    asimcard_ef_add(card, ef);

    return 0;
}
static int
asimcard_ef_init( ASimCard card )
{
    char buff[128] = {'\0'};
    SimFile ef;

    // CPHS Network Operator Name(6F14):
    //   File size: 0x14
    //   PLMN Name: "Android"
    // @see Common PCN Handset Specification (Version 4.2) B.4.1.2 Network Operator Name
    ef = asimcard_ef_new_dedicated(0x6f14, SIM_FILE_READ_ONLY | SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "416e64726f6964ffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // CPHS Voice message waiting flag(6F11):
    //   File size: 0x01
    //   Voice Message Waiting Indicator flags:
    //     Line 1: no messages waiting.
    //     Line 2: no messages waiting.
    // @see Common PCN Handset Specification (Version 4.2) B.4.2.3 Voice Message Waiting Flags in the SIM
    ef = asimcard_ef_new_dedicated(0x6f11, SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "55");
    asimcard_ef_add(card, ef);

    // ICC Identification(2FE2):
    //   File size: 0x0a
    //   Identification number: "8901410321111851072" + (sim->instance_id)
    //                          e.g. "89014103211118510720" for first sim.
    // @see 3GPP TS 11.011 section 10.1.1 EFiccid (ICC Identification)
    ef = asimcard_ef_new_dedicated(0x2fe2, SIM_FILE_READ_ONLY);
    snprintf(buff, sizeof(buff), "981014301211811570%d2", card->instance_id);
    asimcard_ef_update_dedicated(ef, buff);
    asimcard_ef_add(card, ef);

    // CPHS Call forwarding flags(6F13):
    //   File size: 0x01
    //   Voice Call forward unconditional flags:
    //     Line 1: no call forwarding message waiting.
    //     Line 2: no call forwarding message waiting.
    // @see Common PCN Handset Specification (Version 4.2) B.4.5 Diverted Call Status Indicator
    ef = asimcard_ef_new_dedicated(0x6f13, SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "55");
    asimcard_ef_add(card, ef);

    // SIM Service Table(6F38):
    //   File size: 0x0f
    //   Enabled: 1..4, 7, 9..19, 25..27, 29, 30, 38, 39, 51..56
    // @see 3GPP TS 51.011 section 10.3.7 EFsst (SIM Service Table)
    ef = asimcard_ef_new_dedicated(0x6f38, SIM_FILE_READ_ONLY | SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "ff30ffff3f003f0f003c0000f0ff00");
    asimcard_ef_add(card, ef);

    // Mailbox Identifier(6FC9):
    //   Record size: 0x04
    //   Record count: 0x02
    //   Mailbox Dialing Number Identifier - Voicemail:      1
    //   Mailbox Dialing Number Identifier - Fax:            no mailbox dialing number associated
    //   Mailbox Dialing Number Identifier - Eletronic Mail: no mailbox dialing number associated
    //   Mailbox Dialing Number Identifier - Other:          no mailbox dialing number associated
    //   Mailbox Dialing Number Identifier - Videomail:      no mailbox dialing number associated
    // @see 3GPP TS 31.102 section 4.2.62 EFmbi (Mailbox Identifier)
    ef = asimcard_ef_new_linear(0x6fc9, SIM_FILE_NEED_PIN, 0x04);
    asimcard_ef_update_linear(ef, 0x01, "01000000");
    asimcard_ef_update_linear(ef, 0x02, "ffffffff");
    asimcard_ef_add(card, ef);

    // Message Waiting Indication Status(6FCA):
    //   Record size: 0x05
    //   Record count: 0x02
    //   Message Waiting Indicator Status: all inactive
    //   Number of Voicemail Messages Waiting:       0
    //   Number of Fax Messages Waiting:             0
    //   Number of Electronic Mail Messages Waiting: 0
    //   Number of Other Messages Waiting:           0
    //   Number of Videomail Messages Waiting:       0
    // @see 3GPP TS 31.102 section 4.2.63 EFmwis (Message Waiting Indication Status)
    ef = asimcard_ef_new_linear(0x6fca, SIM_FILE_NEED_PIN, 0x05);
    asimcard_ef_update_linear(ef, 0x01, "0000000000");
    asimcard_ef_update_linear(ef, 0x02, "ffffffffff");
    asimcard_ef_add(card, ef);

    // Administrative Data(6FAD):
    //   File size: 0x04
    //   UE Operation mode: normal
    //   Additional information: none
    //   Length of MNC in the IMSI: 3
    // @see 3GPP TS 31.102 section 4.2.18 EFad (Administrative Data)
    ef = asimcard_ef_new_dedicated(0x6fad, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "00000003");
    asimcard_ef_add(card, ef);

    // Image Instance Data Files(4FXX):
    // @see 3GPP TS 51.011 section 10.6.1.2, Image Instance Data Files
    // @see 3GPP TS 31.102 section 4.6.1.2, EFiidf (Image Instance Data Files)
    //   File size: 0x1f
    //   Image Instance Data (4f02):
    //     Image width:                 08
    //     Image length:                08
    //     Bits per raster image point: 02
    //     Number of CLUT entries:      03
    //     Location of CLUT:            0016
    //     Image body:                  see below
    ef = asimcard_ef_new_dedicated(0x4f02, SIM_FILE_READ_ONLY | SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "080802030016AAAA800285428142814281528002AAAAFF000000FF000000FF");
    asimcard_ef_add(card, ef);
    //   File size: 0x0a
    //   Image Instance Data (4f04):
    //     Image width:                 08
    //     Image length:                08
    //     Image body:                  see below
    ef = asimcard_ef_new_dedicated(0x4f04, SIM_FILE_READ_ONLY | SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "0808FF03A59999A5C3FF");
    asimcard_ef_add(card, ef);

    // EF-IMG (4F20) : Each record of this EF identifies instances of one particular graphical image,
    //                 which graphical image is identified by this EF's record number.
    //   Record size: 0x14
    // @see 3GPP TS 51.011 section 10.6.1.1, EF-img
    ef = asimcard_ef_new_linear(0x4f20, SIM_FILE_READ_ONLY | SIM_FILE_NEED_PIN, 0x14);
    //   Record number: 0x01
    //   Number of image instance specified by this record:                 01
    //   Image instance width (raster image points):                        08
    //   Image instance heigh (raster image points):                        08
    //   Color image coding scheme:                                         11
    //   Image identifier id of the EF where is store the image instance:   4F04
    //   Offset of the image instance in the 4F04 EF:                       0000
    //   Length of image instance data:                                     000A
    asimcard_ef_update_linear(ef, 0x01, "010808114f040000000Affffffffffffffffffff");
    //   Record number: 0x03
    //   Number of image instance specified by this record:                 01
    //   Image instance width (raster image points):                        08
    //   Image instance heigh (raster image points):                        08
    //   Color image coding scheme:                                         21
    //   Image identifier id of the EF where is store the image instance:   4F02
    //   Offset of the image instance in the 4F02 EF:                       0000
    //   Length of image instance data:                                     0016
    asimcard_ef_update_linear(ef, 0x03, "010808214f0200000016ffffffffffffffffffff");
    //   Record number: 0x05
    //   Number of image instance specified by this record:                 01
    //   Image instance width (raster image points):                        08
    //   Image instance heigh (raster image points):                        08
    //   Color image coding scheme:                                         22
    //   Image identifier id of the EF where is store the image instance:   4F02
    //   Offset of the image instance in the 4F02 EF:                       0000
    //   Length of image instance data:                                     0016
    asimcard_ef_update_linear(ef, 0x05, "010808224f0200000016ffffffffffffffffffff");
    //   Record number: 0x07
    //   Number of image instance specified by this record:                 02
    //   Descriptor of image instace 1:
    //     Image instance width (raster image points):                      08
    //     Image instance heigh (raster image points):                      08
    //     Color image coding scheme:                                       21
    //     Image identifier id of the EF where is store the image instance: 4F02
    //     Offset of the image instance in the 4F02 EF:                     0000
    //     Length of image instance data:                                   0016
    //   Descriptor of image instace 2:
    //     Image instance width (raster image points):                      08
    //     Image instance heigh (raster image points):                      08
    //     Color image coding scheme:                                       22
    //     Image identifier id of the EF where is store the image instance: 4F02
    //     Offset of the image instance in the 4F02 EF:                     0000
    //     Length of image instance data:                                   0016
    asimcard_ef_update_linear(ef, 0x07, "020808214f02000000160808224f0200000016ff");
    asimcard_ef_add(card, ef);

    // CPHS Information(6F16):
    //   File size: 0x02
    //   CPHS Phase: 2
    //   CPHS Service Table:
    //     CSP(Customer Service Profile): allocated and activated
    //     Information Numbers:           allocated and activated
    // @see Common PCN Handset Specification (Version 4.2) B.3.1.1 CPHS Information
    ef = asimcard_ef_new_dedicated(0x6f16, SIM_FILE_READ_ONLY | SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "0233");
    asimcard_ef_add(card, ef);

    // Service Provider Name(6F46):
    //   File size: 0x11
    //   Display Condition: 0x1, display network name in HPLMN; display SPN if not in HPLMN.
    //   Service Provider Name: "Android"
    // @see 3GPP TS 31.102 section 4.2.12 EFspn (Service Provider Name)
    // @see 3GPP TS 51.011 section 9.4.4 Referencing Management
    ef = asimcard_ef_new_dedicated(0x6f46, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "01416e64726f6964ffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Service Provider Display Information(6FCD):
    //   File size: 0x0d
    //   SPDI TLV (tag = 'a3')
    //     SPDI TLV (tag = '80')
    //       PLMN: 234136
    //       PLMN: 46692
    // @see 3GPP TS 31.102 section 4.2.66 EFspdi (Service Provider Display Information)
    // @see 3GPP TS 51.011 section 9.4.4 Referencing Management
    ef = asimcard_ef_new_dedicated(0x6fcd, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "a30b800932643164269fffffff");
    asimcard_ef_add(card, ef);

    // PLMN Network Name(6FC5):
    //   Record size: 0x18
    //   Record count: 0x0a
    //   Record:
    //     PNN 1: Full name: "Test1", Short name: "Test1"
    //     PNN 2: Full name: "Test2", Short name: (none)
    //     PNN 3: Full name: "Test3", Short name: (none)
    //     PNN 4: Full name: "Test4", Short name: (none)
    //     PNN 5: Full name: "Test5", Short name: (none)
    //     PNN 6: Full name: "Test6", Short name: (none)
    //     PNN 7: Full name: "Test7", Short name: (none)
    // @see 3GPP TS 31.102 section 4.2.58 EFpnn (PLMN Network Name)
    // @see 3GPP TS 24.008
    ef = asimcard_ef_new_linear(0x6fc5, SIM_FILE_READ_ONLY, 0x18);
    // Long name: 43mn8x..., where <mn> is tlvLen, x is trailing spare bits.
    // Short name: 45mn8x..., where <mn> is tlvLen, x is trailing spare bits.
    // 'T'=b1010100, 'e'=b1100101, 's'=b1110011, 't'=b1110100, '1'=b0110001,
    // "Test1"=11010100, 11110010, 10011100, 00011110, 00000011=0xd4f29c1e03 with 5 trailing bits.
    asimcard_ef_update_linear(ef, 0x01, "430685d4f29c1e03450685d4f29c1e03ffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x02, "430685d4f29c2e03ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x03, "430685d4f29c3e03ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x04, "430685d4f29c4e03ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x05, "430685d4f29c5e03ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x06, "430685d4f29c6e03ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x07, "430685d4f29c7e03ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x0a, "ffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Operator PLMN List (6FC6):
    //   Record size: 0x18
    //   Record count: 0x0a
    //   Record:
    //     MCC = 001, MNC =  01, START=0000, END=FFFE, PNN = 01,
    //     MCC = 001, MNC =  02, START=0001, END=0010, PNN = 02,
    //     MCC = 001, MNC =  03, START=0011, END=0011, PNN = 03,
    //     MCC = 001, MNC = 001, START=0012, END=0012, PNN = 04,
    //     MCC = 001, MNC =  1D, START=0000, END=FFFE, PNN = 05,
    //     MCC = 001, MNC = 2DD, START=0000, END=FFFE, PNN = 06,
    //     MCC = 001, MNC = DDD, START=0000, END=FFFE, PNN = 07,
    // @see 3GPP TS 31.102 section 4.2.59 EFopl (Operator PLMN List)
    // @see 3GPP TS 24.008
    // @see http://en.wikipedia.org/wiki/Mobile_country_code
    ef = asimcard_ef_new_linear(0x6fc6, SIM_FILE_READ_ONLY, 0x18);
    // If mnc=012, mcc=345, lac/tac start=abcd, end=wxyz, PLMN record id=mn, then:
    //                                  "105243abcdwxyzmnffffffffffffffffffffffffffffffff"
    asimcard_ef_update_linear(ef, 0x01, "00110f0000fffe01ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x02, "00210f0001001002ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x03, "00310f0011001103ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x04, "0011000012001204ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x05, "00d11f0000fffe05ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x06, "00d1d20000fffe06ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x07, "00d1dd0000fffe07ffffffffffffffffffffffffffffffff");
    asimcard_ef_update_linear(ef, 0x0a, "ffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // MSISDN(6F40):
    //   Record size: 0x20
    //   Record count: 0x04
    //   Alpha Identifier: (empty)
    //   Length of BCD number/SSC contents: 7
    //   TON and NPI: 0x81
    //   Dialing Number/SSC String: 15555218135, actual number is "155552"
    //                              + (sim->instance_id + 1) + emulator port,
    //                              e.g. "15555215554" for first sim of first emulator.
    //   Capacity/Configuration 2 Record Identifier: not used
    //   Extension 5 Record Identifier: not used
    // @see 3GPP TS 31.102 section 4.2.26 EFmsisdn (MSISDN)
    ef = asimcard_ef_new_linear(0x6f40, SIM_FILE_NEED_PIN, 0x20);
    snprintf(buff, sizeof(buff), "ffffffffffffffffffffffffffffffffffff0781515525%d%d%d%df%dffffffffffff",
        (card->port / 1000) % 10,
        (card->instance_id + 1),
        (card->port / 10) % 10,
        (card->port / 100) % 10,
        card->port % 10);
    asimcard_ef_update_linear(ef, 0x01, buff);
    asimcard_ef_update_linear(ef, 0x04, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Mailbox Dialing Numbers(6FC7):
    //   Record size: 0x20
    //   Record count: 0x02
    //   Alpha Identifier: "Voicemail"
    //   Length of BCD number/SSC contents: 7
    //   TON and NPI: 0x91
    //   Dialing Number/SSC String: 15552175049
    //   Capacity/Configuration 2 Record Identifier: not used
    //   Extension 6 Record Identifier: not used
    // @see 3GPP TS 31.102 section 4.2.60 EFmbdn (Mailbox Dialing Numbers)
    ef = asimcard_ef_new_linear(0x6fc7, SIM_FILE_NEED_PIN, 0x20);
    asimcard_ef_update_linear(ef, 0x01, "566f6963656d61696cffffffffffffffffff07915155125740f9ffffffffffff");
    asimcard_ef_update_linear(ef, 0x02, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Abbreviated Dialling Numbers(6F3A)
    //   Record size: 0x20
    //   Record count: 0xff
    //   Length of BCD number/SSC contents: 7
    //   TON and NPI: 0x81
    // @see 3GPP TS 51.011 section 10.5.1 EFadn
    ef = asimcard_ef_new_linear(0x6f3a, SIM_FILE_NEED_PIN, 0x20);
    // Alpha Id(Encoded with GSM 8 bit): "Mozilla", Dialling Number: 15555218201
    asimcard_ef_update_linear(ef, 0x01, "4d6f7a696c6c61ffffffffffffffffffffff07815155258102f1ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x80: "Saßê\u9ec3", Dialling Number: 15555218202
    asimcard_ef_update_linear(ef, 0x02, "800053006100df00ea9ec3ffffffffffffff07815155258102f2ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x81): "Fire \u706b", Dialling Number: 15555218203
    asimcard_ef_update_linear(ef, 0x03, "8106e04669726520ebffffffffffffffffff07815155258102f3ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x82): "Huang \u9ec3", Dialling Number: 15555218204
    asimcard_ef_update_linear(ef, 0x04, "82079e804875616e6720c3ffffffffffffff07815155258102f4ffffffffffff");
    asimcard_ef_update_linear(ef, 0xff, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Fixed Dialling Numbers(6F3B)
    //   Record size: 0x20
    //   Record count: 0xff
    //   Length of BCD number/SSC contents: 7
    //   TON and NPI: 0x81
    // @see 3GPP TS 51.011 section 10.5.2 EFfdn
    ef = asimcard_ef_new_linear(0x6f3b, SIM_FILE_NEED_PIN, 0x20);
    // Alpha Id(Encoded with GSM 8 bit): "Mozilla", Dialling Number: 15555218201
    asimcard_ef_update_linear(ef, 0x01, "4d6f7a696c6c61ffffffffffffffffffffff07815155258102f1ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x80: "Saßê\u9ec3", Dialling Number: 15555218202
    asimcard_ef_update_linear(ef, 0x02, "800053006100df00ea9ec3ffffffffffffff07815155258102f2ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x81): "Fire \u706b", Dialling Number: 15555218203
    asimcard_ef_update_linear(ef, 0x03, "8106e04669726520ebffffffffffffffffff07815155258102f3ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x82): "Huang \u9ec3", Dialling Number: 15555218204
    asimcard_ef_update_linear(ef, 0x04, "82079e804875616e6720c3ffffffffffffff07815155258102f4ffffffffffff");
    asimcard_ef_update_linear(ef, 0xff, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Group Identifier Level 1(6F3E):
    //   File size: 0x02
    //   GID1: 5a4d
    // @see 3GPP TS 51.011 section 10.3.9 EFgid1 (Group Identifier Level 1)
    // @see 3GPP TS 31.102 section 4.2.10 EFgid1 (Group Identifier Level 1)
    ef = asimcard_ef_new_dedicated(0x6f3e, SIM_FILE_READ_ONLY | SIM_FILE_NEED_PIN);
    asimcard_ef_update_dedicated(ef, "5a4d");
    asimcard_ef_add(card, ef);

    // Service Dialling Numbers(6F49)
    //   Record size: 0x20
    //   Record count: 0xff
    //   Length of BCD number/SSC contents: 7
    //   TON and NPI: 0x81
    // @see 3GPP TS 51.011 section 10.5.9 EFsdn
    ef = asimcard_ef_new_linear(0x6f49, SIM_FILE_NEED_PIN, 0x20);
    // Alpha Id(Encoded with GSM 8 bit): "Mozilla", Dialling Number: 15555218201
    asimcard_ef_update_linear(ef, 0x01, "4d6f7a696c6c61ffffffffffffffffffffff07815155258102f1ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x80: "Saßê\u9ec3", Dialling Number: 15555218202
    asimcard_ef_update_linear(ef, 0x02, "800053006100df00ea9ec3ffffffffffffff07815155258102f2ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x81): "Fire \u706b", Dialling Number: 15555218203
    asimcard_ef_update_linear(ef, 0x03, "8106e04669726520ebffffffffffffffffff07815155258102f3ffffffffffff");
    // Alpha Id(Encoded with UCS2 0x82): "Huang \u9ec3", Dialling Number: 15555218204
    asimcard_ef_update_linear(ef, 0x04, "82079e804875616e6720c3ffffffffffffff07815155258102f4ffffffffffff");
    asimcard_ef_update_linear(ef, 0xff, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
    asimcard_ef_add(card, ef);

    // Cell Broadcast Message Identifier selection(6F45):
    //   File size: 0x06
    //   CB Message Identifier 1: 45056(B000)
    //   CB Message Identifier 2: 65535(FFFF, not used)
    //   CB Message Identifier 3: 61440(F000, not settable by MMI)
    // @see 3GPP TS 31.102 section 4.2.14 EFcbmi (Cell Broadcast Message Identifier selection)
    ef = asimcard_ef_new_dedicated(0x6f45, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "b000fffff000");
    asimcard_ef_add(card, ef);

    // Cell Broadcast Message Identifier for Data Download(6F48):
    //   File size: 0x06
    //   CB Message Identifier 1: 45056(C001)
    //   CB Message Identifier 2: 65535(FFFF, not used)
    //   CB Message Identifier 3: 61440(F001, not settable by MMI)
    // @see 3GPP TS 31.102 v110.02.0 section 4.2.20 EFcbmid (Cell Broadcast Message Identifier for Data Download)
    ef = asimcard_ef_new_dedicated(0x6f48, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "c001fffff001");
    asimcard_ef_add(card, ef);

    // Cell Broadcast Message Identifier Range selection(6F50):
    //   File size: 0x10
    //   CB Message Identifier Range 1: 45058..49152(B002..C000)
    //   CB Message Identifier Range 2: 65535..49153(FFFF..C001, should be ignored)
    //   CB Message Identifier Range 3: 49153..65535(C001..FFFF, should be ignored)
    //   CB Message Identifier Range 4: 61442..65280(F002..FF00, not settable by MMI)
    // @see 3GPP TS 31.102 section 4.2.14 EFcbmir (Cell Broadcast Message Identifier Range selection)
    ef = asimcard_ef_new_dedicated(0x6f50, SIM_FILE_READ_ONLY);
    asimcard_ef_update_dedicated(ef, "b002c000ffffc001c001fffff002ff00");
    asimcard_ef_add(card, ef);

    return 0;
}