1 /* Copyright (C) 2007-2008 The Android Open Source Project 2 ** 3 ** This software is licensed under the terms of the GNU General Public 4 ** License version 2, as published by the Free Software Foundation, and 5 ** may be copied, distributed, and modified under those terms. 6 ** 7 ** This program is distributed in the hope that it will be useful, 8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 ** GNU General Public License for more details. 11 */ 12 #ifndef _android_sim_card_h 13 #define _android_sim_card_h 14 15 #include "gsm.h" 16 17 typedef struct ASimCardRec_* ASimCard; 18 19 extern ASimCard asimcard_create( void ); 20 extern void asimcard_destroy( ASimCard sim ); 21 22 typedef enum { 23 A_SIM_STATUS_ABSENT = 0, 24 A_SIM_STATUS_NOT_READY, 25 A_SIM_STATUS_READY, 26 A_SIM_STATUS_PIN, 27 A_SIM_STATUS_PUK, 28 A_SIM_STATUS_NETWORK_PERSONALIZATION 29 } ASimStatus; 30 31 extern ASimStatus asimcard_get_status( ASimCard sim ); 32 extern void asimcard_set_status( ASimCard sim, ASimStatus status ); 33 34 extern const char* asimcard_get_pin( ASimCard sim ); 35 extern const char* asimcard_get_puk( ASimCard sim ); 36 extern void asimcard_set_pin( ASimCard sim, const char* pin ); 37 extern void asimcard_set_puk( ASimCard sim, const char* puk ); 38 39 extern int asimcard_check_pin( ASimCard sim, const char* pin ); 40 extern int asimcard_check_puk( ASimCard sim, const char* puk, const char* pin ); 41 42 /* Restricted SIM Access command, as defined by 8.18 of 3GPP 27.007 */ 43 typedef enum { 44 A_SIM_CMD_READ_BINARY = 176, 45 A_SIM_CMD_READ_RECORD = 178, 46 A_SIM_CMD_GET_RESPONSE = 192, 47 A_SIM_CMD_UPDATE_BINARY = 214, 48 A_SIM_CMD_UPDATE_RECORD = 220, 49 A_SIM_CMD_STATUS = 242 50 } ASimCommand; 51 52 extern const char* asimcard_io( ASimCard sim, const char* cmd ); 53 54 #endif /* _android_sim_card_h */ 55