Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
CellularSIM.h
00001 /* 00002 * Copyright (c) 2017, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef CELLULAR_SIM_H_ 00019 #define CELLULAR_SIM_H_ 00020 00021 #include "nsapi_types.h" 00022 00023 namespace mbed { 00024 00025 const int MAX_SIM_READY_WAITING_TIME = 30; 00026 const int MAX_IMSI_LENGTH = 15; 00027 /** 00028 * Class CellularSIM 00029 * 00030 * An abstract interface for SIM card handling. 00031 */ 00032 class CellularSIM 00033 { 00034 protected: 00035 // friend of CellularDevice so that it's the only way to close/delete this class. 00036 friend class CellularDevice; 00037 00038 /** 00039 * virtual Destructor 00040 */ 00041 virtual ~CellularSIM() {}; 00042 00043 public: 00044 /* enumeration for possible SIM states */ 00045 enum SimState { 00046 SimStateReady = 0, 00047 SimStatePinNeeded, 00048 SimStatePukNeeded, 00049 SimStateUnknown 00050 }; 00051 00052 /** Open the SIM card by setting the pin code for SIM. 00053 * 00054 * @param sim_pin PIN for the SIM card 00055 * @return zero on success 00056 */ 00057 virtual nsapi_error_t set_pin(const char *sim_pin) = 0; 00058 00059 /**Change sim pin code. 00060 * 00061 * @param sim_pin Current PIN for sim 00062 * @param new_pin New PIN for sim 00063 * @return zero on success 00064 */ 00065 virtual nsapi_error_t change_pin(const char *sim_pin, const char *new_pin) = 0; 00066 00067 /** Change is pin query needed after boot 00068 * 00069 * @param sim_pin Valid PIN for SIM card 00070 * @param query_pin False is PIN query not needed, True if PIN query needed after boot. 00071 * @return zero on success 00072 */ 00073 virtual nsapi_error_t set_pin_query(const char *sim_pin, bool query_pin) = 0; 00074 00075 /** Get sim card's state 00076 * 00077 * @param state current state of SIM 00078 * @return zero on success 00079 */ 00080 virtual nsapi_error_t get_sim_state(SimState &state) = 0; 00081 00082 /** Get IMSI from the sim card 00083 * 00084 * @param imsi preallocated char* which after successful request contains imsi 00085 * @return zero on success 00086 */ 00087 virtual nsapi_error_t get_imsi(char* imsi) = 0; 00088 }; 00089 00090 } // namespace mbed 00091 00092 #endif // CELLULAR_SIM_H_
Generated on Tue Jul 12 2022 14:23:30 by
