1 /* 2 * Copyright (C) 2024 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 #pragma once 17 18 #include <string> 19 20 namespace android::hardware::radio::minimal::sim::constants { 21 22 // From frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/IccConstants.java 23 // 3GPP TS 51.011 Annex D 24 // ETSI TS 131 102 Annex A 25 constexpr int EF_ADN = 0x6F3A; 26 constexpr int EF_FDN = 0x6F3B; 27 constexpr int EF_GID1 = 0x6F3E; 28 constexpr int EF_GID2 = 0x6F3F; 29 constexpr int EF_SDN = 0x6F49; 30 constexpr int EF_EXT1 = 0x6F4A; 31 constexpr int EF_EXT2 = 0x6F4B; 32 constexpr int EF_EXT3 = 0x6F4C; 33 constexpr int EF_EXT5 = 0x6F4E; 34 constexpr int EF_EXT6 = 0x6FC8; 35 constexpr int EF_MWIS = 0x6FCA; 36 constexpr int EF_MBDN = 0x6FC7; 37 constexpr int EF_PNN = 0x6FC5; 38 constexpr int EF_OPL = 0x6FC6; 39 constexpr int EF_SPN = 0x6F46; 40 constexpr int EF_SMS = 0x6F3C; 41 constexpr int EF_ICCID = 0x2FE2; 42 constexpr int EF_AD = 0x6FAD; 43 constexpr int EF_MBI = 0x6FC9; 44 constexpr int EF_MSISDN = 0x6F40; 45 constexpr int EF_SPDI = 0x6FCD; 46 constexpr int EF_SST = 0x6F38; 47 constexpr int EF_CFIS = 0x6FCB; 48 constexpr int EF_IMG = 0x4F20; 49 constexpr int EF_PSISMSC = 0x6FE5; 50 constexpr int EF_SMSS = 0x6F43; 51 constexpr int EF_PBR = 0x4F30; 52 constexpr int EF_LI = 0x6F05; 53 constexpr int EF_MAILBOX_CPHS = 0x6F17; 54 constexpr int EF_VOICE_MAIL_INDICATOR_CPHS = 0x6F11; 55 constexpr int EF_CFF_CPHS = 0x6F13; 56 constexpr int EF_SPN_CPHS = 0x6F14; 57 constexpr int EF_SPN_SHORT_CPHS = 0x6F18; 58 constexpr int EF_INFO_CPHS = 0x6F16; 59 constexpr int EF_CSP_CPHS = 0x6F15; 60 constexpr int EF_CST = 0x6F32; 61 constexpr int EF_RUIM_SPN = 0x6F41; 62 constexpr int EF_PL = 0x2F05; 63 constexpr int EF_ARR = 0x2F06; 64 constexpr int EF_CSIM_LI = 0x6F3A; 65 constexpr int EF_CSIM_SPN = 0x6F41; 66 constexpr int EF_CSIM_MDN = 0x6F44; 67 constexpr int EF_CSIM_IMSIM = 0x6F22; 68 constexpr int EF_CSIM_CDMAHOME = 0x6F28; 69 constexpr int EF_CSIM_EPRL = 0x6F5A; 70 constexpr int EF_CSIM_PRL = 0x6F30; 71 constexpr int EF_CSIM_MLPL = 0x4F20; 72 constexpr int EF_CSIM_MSPL = 0x4F21; 73 constexpr int EF_CSIM_MIPUPP = 0x6F4D; 74 constexpr int EF_IMPU = 0x6F04; 75 constexpr int EF_IMPI = 0x6F02; 76 constexpr int EF_DOMAIN = 0x6F03; 77 constexpr int EF_IST = 0x6F07; 78 constexpr int EF_PCSCF = 0x6F09; 79 constexpr int EF_PLMN_W_ACT = 0x6F60; 80 constexpr int EF_OPLMN_W_ACT = 0x6F61; 81 constexpr int EF_HPLMN_W_ACT = 0x6F62; 82 constexpr int EF_EHPLMN = 0x6FD9; 83 constexpr int EF_FPLMN = 0x6F7B; 84 constexpr int EF_LRPLMNSI = 0x6FDC; 85 constexpr int EF_HPPLMN = 0x6F31; 86 // 3GPP TS 51.011 10.7 87 constexpr int MF_SIM_VAL = 0x3F00; 88 constexpr std::string MF_SIM = "3F00"; 89 constexpr std::string DF_TELECOM = "7F10"; 90 constexpr std::string DF_PHONEBOOK = "5F3A"; 91 constexpr std::string DF_GRAPHICS = "5F50"; 92 constexpr std::string DF_GSM = "7F20"; 93 constexpr std::string DF_CDMA = "7F25"; 94 constexpr std::string DF_MMSS = "5F3C"; 95 constexpr std::string DF_ADF = "7FFF"; 96 97 // From frameworks/base/telephony/java/com/android/internal/telephony/uicc/IccUtils.java 98 constexpr int FPLMN_BYTE_SIZE = 3; 99 100 // From frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/IccFileHandler.java 101 // 3GPP TS 11.11 9.2 102 constexpr int COMMAND_READ_BINARY = 0xB0; // 176 103 constexpr int COMMAND_UPDATE_BINARY = 0xD6; // 214 104 constexpr int COMMAND_READ_RECORD = 0xB2; // 178 105 constexpr int COMMAND_UPDATE_RECORD = 0xDC; // 220 106 constexpr int COMMAND_SEEK = 0xA2; // 162 (also: SEARCH RECORD) 107 constexpr int COMMAND_SELECT = 0xA4; // 164 108 constexpr int COMMAND_GET_RESPONSE = 0xC0; // 192 109 constexpr int COMMAND_STATUS = 0xF2; // 242 110 constexpr int COMMAND_GET_DATA = 0xCA; // 202 (ISO 7816 7.4.2) 111 constexpr int COMMAND_MANAGE_CHANNEL = 0x70; // 112 112 constexpr int EF_TYPE_TRANSPARENT = 0; 113 constexpr int EF_TYPE_LINEAR_FIXED = 1; 114 constexpr int EF_TYPE_CYCLIC = 3; 115 constexpr int TYPE_RFU = 0; 116 constexpr int TYPE_MF = 1; 117 constexpr int TYPE_DF = 2; 118 constexpr int TYPE_EF = 4; 119 constexpr int GET_RESPONSE_EF_SIZE_BYTES = 15; 120 constexpr int RESPONSE_DATA_RFU_1 = 0; 121 constexpr int RESPONSE_DATA_RFU_2 = 1; 122 constexpr int RESPONSE_DATA_FILE_SIZE_1 = 2; 123 constexpr int RESPONSE_DATA_FILE_SIZE_2 = 3; 124 constexpr int RESPONSE_DATA_FILE_ID_1 = 4; 125 constexpr int RESPONSE_DATA_FILE_ID_2 = 5; 126 constexpr int RESPONSE_DATA_FILE_TYPE = 6; 127 constexpr int RESPONSE_DATA_RFU_3 = 7; 128 constexpr int RESPONSE_DATA_ACCESS_CONDITION_1 = 8; 129 constexpr int RESPONSE_DATA_ACCESS_CONDITION_2 = 9; 130 constexpr int RESPONSE_DATA_ACCESS_CONDITION_3 = 10; 131 constexpr int RESPONSE_DATA_FILE_STATUS = 11; 132 constexpr int RESPONSE_DATA_LENGTH = 12; 133 constexpr int RESPONSE_DATA_STRUCTURE = 13; 134 constexpr int RESPONSE_DATA_RECORD_LENGTH = 14; 135 136 // From frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/IccIoResult.java 137 // ISO 7816 5.1.3 138 constexpr uint16_t IO_RESULT_SUCCESS = 0x9000; 139 constexpr uint16_t IO_RESULT_NOT_SUPPORTED = 0x6A81; 140 constexpr uint16_t IO_RESULT_FILE_NOT_FOUND = 0x6A82; // file or application 141 constexpr uint16_t IO_RESULT_INCORRECT_DATA = 0x6A80; 142 constexpr uint16_t IO_RESULT_INCORRECT_P1_P2 = 0x6A86; 143 constexpr uint16_t IO_RESULT_INCORRECT_LENGTH = 0x6C00; // low byte is suggested length 144 constexpr uint16_t IO_RESULT_CLASS_NOT_SUPPORTED = 0x6E00; 145 constexpr uint16_t IO_RESULT_CHANNEL_NOT_SUPPORTED = 0x6881; 146 constexpr uint16_t IO_RESULT_TECHNICAL_PROBLEM = 0x6F00; 147 148 } // namespace android::hardware::radio::minimal::sim::constants 149