|
Android-cuttlefish cvd tool
|
#include <sim_service.h>


Classes | |
| struct | FacilityLock |
| struct | LogicalChannel |
| struct | PinStatus |
| struct | SimFileSystem |
Public Types | |
| enum | SimStatus { SIM_STATUS_ABSENT = 0 , SIM_STATUS_NOT_READY , SIM_STATUS_READY , SIM_STATUS_PIN , SIM_STATUS_PUK } |
Public Member Functions | |
| SimService (int32_t service_id, ChannelMonitor *channel_monitor, ThreadLooper *thread_looper) | |
| ~SimService ()=default | |
| SimService (const SimService &)=delete | |
| SimService & | operator= (const SimService &)=delete |
| void | SetupDependency (NetworkService *net) |
| void | HandleSIMStatusReq (const Client &client) |
| void | HandleChangeOrEnterPIN (const Client &client, const std::string &command) |
| void | HandleSIM_IO (const Client &client, const std::string &command) |
| void | HandleCSIM_IO (const Client &client, const std::string &command) |
| void | HandleGetIMSI (const Client &client) |
| void | HandleGetIccId (const Client &client) |
| void | HandleGetEid (const Client &client) |
| void | HandleGetAtr (const Client &client) |
| void | HandleFacilityLock (const Client &client, const std::string &command) |
| void | HandleOpenLogicalChannel (const Client &client, const std::string &command) |
| void | HandleCloseLogicalChannel (const Client &client, const std::string &command) |
| void | HandleTransmitLogicalChannel (const Client &client, const std::string &command) |
| void | HandleChangePassword (const Client &client, const std::string &command) |
| void | HandleQueryRemainTimes (const Client &client, const std::string &command) |
| void | HandleCdmaSubscriptionSource (const Client &client, const std::string &command) |
| void | HandleCdmaRoamingPreference (const Client &client, const std::string &command) |
| void | HandleSimAuthentication (const Client &client, const std::string &command) |
| void | HandlePhoneNumberUpdate (const Client &client, const std::string &command) |
| void | SavePinStateToIccProfile () |
| void | SaveFacilityLockToIccProfile () |
| bool | IsFDNEnabled () |
| bool | IsFixedDialNumber (std::string_view number) |
| XMLElement * | GetIccProfile () |
| std::string | GetPhoneNumber () |
| bool | SetPhoneNumber (std::string_view number) |
| SimStatus | GetSimStatus () const |
| std::string | GetSimOperator () |
Public Member Functions inherited from cuttlefish::ModemService | |
| virtual | ~ModemService ()=default |
| ModemService (const ModemService &)=delete | |
| ModemService & | operator= (const ModemService &)=delete |
| bool | HandleModemCommand (const Client &client, std::string command) |
| void | CloseRemoteConnection (ClientId remote_client) |
Private Member Functions | |
| void | InitializeServiceState () |
| std::vector< CommandHandler > | InitializeCommandHandlers () |
| void | InitializeSimFileSystemAndSimState () |
| void | InitializeFacilityLock () |
| void | OnSimStatusChanged () |
| XMLElement * | GetPhoneNumberElement () |
| bool | checkPin1AndAdjustSimStatus (std::string_view password) |
| bool | ChangePin1AndAdjustSimStatus (PinStatus::ChangeMode mode, std::string_view pin, std::string_view new_pin) |
Private Attributes | |
| NetworkService * | network_service_ |
| SimStatus | sim_status_ |
| SimFileSystem | sim_file_system_ |
| PinStatus | pin1_status_ |
| PinStatus | pin2_status_ |
| std::map< std::string, FacilityLock > | facility_lock_ |
| std::vector< LogicalChannel > | logical_channels_ |
| std::string | last_file_id_ |
| int | cdma_subscription_source_ |
| int | cdma_roaming_preference_ |
Additional Inherited Members | |
Static Public Attributes inherited from cuttlefish::ModemService | |
| static constexpr char | kCmeErrorOperationNotAllowed [] = "+CME ERROR: 3" |
| static constexpr char | kCmeErrorOperationNotSupported [] = "+CME ERROR: 4" |
| static constexpr char | kCmeErrorSimNotInserted [] = "+CME ERROR: 10" |
| static constexpr char | kCmeErrorSimPinRequired [] = "+CME ERROR: 11" |
| static constexpr char | kCmeErrorSimPukRequired [] = "+CME ERROR: 12" |
| static constexpr char | kCmeErrorSimBusy [] = "+CME ERROR: 14" |
| static constexpr char | kCmeErrorIncorrectPassword [] = "+CME ERROR: 16" |
| static constexpr char | kCmeErrorMemoryFull [] = "+CME ERROR: 20" |
| static constexpr char | kCmeErrorInvalidIndex [] = "+CME ERROR: 21" |
| static constexpr char | kCmeErrorNotFound [] = "+CME ERROR: 22" |
| static constexpr char | kCmeErrorInvalidCharactersInTextString [] |
| static constexpr char | kCmeErrorNoNetworkService [] = "+CME ERROR: 30" |
| static constexpr char | kCmeErrorNetworkNotAllowedEmergencyCallsOnly [] |
| static constexpr char | kCmeErrorInCorrectParameters [] = "+CME ERROR: 50" |
| static constexpr char | kCmeErrorNetworkNotAttachedDueToMTFunctionalRestrictions [] |
| static constexpr char | kCmeErrorFixedDialNumberOnlyAllowed [] |
| static constexpr char | kCmsErrorOperationNotAllowed [] = "+CMS ERROR: 302" |
| static constexpr char | kCmsErrorOperationNotSupported [] = "+CMS ERROR: 303" |
| static constexpr char | kCmsErrorInvalidPDUModeParam [] = "+CMS ERROR: 304" |
| static constexpr char | kCmsErrorSCAddressUnknown [] = "+CMS ERROR: 304" |
| static constexpr std::pair< int, int > | kRemotePortRange {6520, 6527} |
Protected Member Functions inherited from cuttlefish::ModemService | |
| ModemService (int32_t service_id, std::vector< CommandHandler > command_handlers, ChannelMonitor *channel_monitor, ThreadLooper *thread_looper) | |
| void | HandleCommandDefaultSupported (const Client &client) |
| void | SendUnsolicitedCommand (std::string unsol_command) |
| cuttlefish::SharedFD | ConnectToRemoteCvd (std::string port) |
| void | SendCommandToRemote (ClientId remote_client, std::string response) |
Static Protected Member Functions inherited from cuttlefish::ModemService | |
| static std::string | GetHostId () |
Protected Attributes inherited from cuttlefish::ModemService | |
| int32_t | service_id_ |
| const std::vector< CommandHandler > | command_handlers_ |
| ThreadLooper * | thread_looper_ |
| ChannelMonitor * | channel_monitor_ |
| cuttlefish::SimService::SimService | ( | int32_t | service_id, |
| ChannelMonitor * | channel_monitor, | ||
| ThreadLooper * | thread_looper | ||
| ) |
|
default |
|
delete |
|
private |
|
private |
| XMLElement * cuttlefish::SimService::GetIccProfile | ( | ) |
| std::string cuttlefish::SimService::GetPhoneNumber | ( | ) |
|
private |
| std::string cuttlefish::SimService::GetSimOperator | ( | ) |
| SimService::SimStatus cuttlefish::SimService::GetSimStatus | ( | ) | const |
| void cuttlefish::SimService::HandleCdmaRoamingPreference | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
see RIL_REQUEST_CDMA_SET_ROAMNING_PREFERENCE or RIL_REQUEST_CDMA_GET_ROAMNING_PREFERENCE in RIL
| void cuttlefish::SimService::HandleCdmaSubscriptionSource | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
see RIL_REQUEST_CDMA_SET_SUBSCRIPTION or RIL_REQUEST_CDMA_GET_SUBSCRIPTION in RIL
| void cuttlefish::SimService::HandleChangeOrEnterPIN | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
| void cuttlefish::SimService::HandleChangePassword | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
AT+CPWD Action command sets a new password for the facility lock function defined by command Facility Lock +CLCK
Command Possible response(s) +CPWD=<fac>,<oldpwd>,<newpwd> +CME ERROR: <err>
<fac>: "P2" SIM PIN2 refer Facility Lock +CLCK for other values <oldpwd>, <newpwd>: string type; <oldpwd> shall be the same as password specified for the facility from the MT user interface or with command Change Password +CPWD and <newpwd> is the new password; maximum length of password can be determined with <pwdlength> <pwdlength>: integer type maximum length of the password for the facility
| void cuttlefish::SimService::HandleCloseLogicalChannel | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
AT+CCHC This command asks the ME to close a communication session with the active UICC.
Command Possible response(s) +CCHC=<sessionid> +CCHC +CME ERROR: <err> <sessionid>: see AT+CCHO
see RIL_REQUEST_SIM_CLOSE_CHANNEL in RIL
| void cuttlefish::SimService::HandleCSIM_IO | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
| void cuttlefish::SimService::HandleFacilityLock | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
| void cuttlefish::SimService::HandleGetAtr | ( | const Client & | client | ) |
| void cuttlefish::SimService::HandleGetEid | ( | const Client & | client | ) |
| void cuttlefish::SimService::HandleGetIccId | ( | const Client & | client | ) |
AT+CICCID Integrated Circuit Card IDentifier (ICCID) is Unique Identifier of the SIM CARD. File is located in the SIM card at EFiccid (0x2FE2).
see RIL_REQUEST_GET_SIM_STATUS in RIL
| void cuttlefish::SimService::HandleGetIMSI | ( | const Client & | client | ) |
AT+CIMI Execution command causes the TA to return <IMSI>, which is intended to permit the TE to identify the individual SIM card or active application in the UICC (GSM or USIM) which is attached to MT.
Command Possible response(s) +CIMI <IMSI> +CME ERROR: <err>
<IMSI>: International Mobile Subscriber Identity (string without double quotes)
see RIL_REQUEST_GET_IMSI in RIL
| void cuttlefish::SimService::HandleOpenLogicalChannel | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
AT+CCHO The currently selected UICC will open a new logical channel; select the application identified by the <dfname> received with this command and return a session Id as the response.
Command Possible response(s) +CCHO=<dfname> <sessionid> +CME ERROR: <err>
<dfname>: all selectable applications in the UICC are referenced by a DF name coded on 1 to 16 bytes. <sessionid>: integer type; a session Id to be used in order to target a specific application on the smart card (e.g. (U)SIM, WIM, ISIM) using logical channels mechanism.
see RIL_REQUEST_SIM_OPEN_CHANNEL in RIL
| void cuttlefish::SimService::HandlePhoneNumberUpdate | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
| void cuttlefish::SimService::HandleQueryRemainTimes | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
AT+CPINR Execution command cause the MT to return the number of remaining PIN retries for the MT passwords with intermediate result code
Command Possible response(s) +CPINR[=<sel_code>] +CPINR: ,<retries>[,<default_retries>]
<retries>: integer type. Number of remaining retries per PIN. <default_retries>: integer type. Number of default/initial retries per PIN. : Type of PIN. All values listed under the description of the AT+CPIN command <sel_code>: String type. Same values as for the and <ext_code> parameters. these values are strings and shall be indicated within double quotes.
| void cuttlefish::SimService::HandleSIM_IO | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
AT+CRSM By using this command instead of Generic SIM Access +CSIM TE application has easier but more limited access to the SIM database.
Command Possible response(s) +CRSM=<command>[,<fileid> +CRSM: <sw1>,<sw2>[,<response>] [,<P1>,<P2>,<P3>[,<data>[,<pathid>]]]] +CME ERROR: <err>
<command>: (command passed on by the MT to the SIM; refer 3GPP TS 51.011 [28]): 176 READ BINARY 178 READ RECORD 192 GET RESPONSE 214 UPDATE BINARY 220 UPDATE RECORD 242 STATUS 203 RETRIEVE DATA 219 SET DATA
<fileid>: integer type; this is the identifier of a elementary datafile on SIM. Mandatory for every command except STATUS.
<P1>, <P2>, <P3>: integer type; parameters passed on by the MT to the SIM. These parameters are mandatory for every command, except GET RESPONSE and STATUS.
<data>: information which shall be written to the SIM (hexadecimal character format).
<pathid>: string type; contains the path of an elementary file on the SIM/UICC in hexadecimal format.
<sw1>, <sw2>: integer type; information from the SIM about the execution of the actual command.
<response>: response of a successful completion of the command previously issued (hexadecimal character format; refer +CSCS).
| void cuttlefish::SimService::HandleSimAuthentication | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
| void cuttlefish::SimService::HandleSIMStatusReq | ( | const Client & | client | ) |
AT+CPIN Set command sends to the MT a password which is necessary before it can be operated. Read command returns an alphanumeric string indicating whether some password is required or not.
Command Possible response(s) +CPIN=<pin>[,<newpin>] +CME ERROR: <err> +CPIN? +CPIN: +CME ERROR: <err> <pin>, <newpin>: string type values. values reserved by the present document: READY MT is not pending for any password SIM PIN MT is waiting SIM PIN to be given SIM PUK MT is waiting SIM PUK to be given
see RIL_REQUEST_GET_SIM_STATUS in RIL
| void cuttlefish::SimService::HandleTransmitLogicalChannel | ( | const Client & | client, |
| const std::string & | command | ||
| ) |
AT+CGLA Set command transmits to the MT the <command> it then shall send as it is to the selected UICC. In the same manner the UICC <response> shall be sent back by the MT to the TA as it is.
Command Possible response(s) +CGLA=<sessionid>,<length>, +CGLA: <length>,<response> +CME ERROR: <err> <sessionid>: AT+CCHO <length>: integer type; length of the characters that are sent to TE in <command> or <response> . <command>: command passed on by the MT to the UICC in the format as described in 3GPP TS 31.101 [65] (hexadecimal character format; refer +CSCS). <response>: response to the command passed on by the UICC to the MT in the format as described in 3GPP TS 31.101 [65] (hexadecimal character format; refer +CSCS).
see RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL in RIL
|
private |
|
private |
|
private |
|
private |
| bool cuttlefish::SimService::IsFDNEnabled | ( | ) |
| bool cuttlefish::SimService::IsFixedDialNumber | ( | std::string_view | number | ) |
|
private |
|
delete |
| void cuttlefish::SimService::SaveFacilityLockToIccProfile | ( | ) |
| void cuttlefish::SimService::SavePinStateToIccProfile | ( | ) |
| bool cuttlefish::SimService::SetPhoneNumber | ( | std::string_view | number | ) |
| void cuttlefish::SimService::SetupDependency | ( | NetworkService * | net | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |