diff options
Diffstat (limited to 'telephony/sim_card.c')
-rw-r--r-- | telephony/sim_card.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/telephony/sim_card.c b/telephony/sim_card.c index a5a3249..b172deb 100644 --- a/telephony/sim_card.c +++ b/telephony/sim_card.c @@ -12,6 +12,7 @@ #include "sim_card.h" #include <string.h> #include <assert.h> +#include <stdio.h> /* set ENABLE_DYNAMIC_RECORDS to 1 to enable dynamic records * for now, this is an experimental feature that needs more testing @@ -26,6 +27,7 @@ typedef struct ASimCardRec_ { char pin[ A_SIM_PIN_SIZE+1 ]; char puk[ A_SIM_PUK_SIZE+1 ]; int pin_retries; + int port; char out_buff[ 256 ]; int out_size; @@ -35,13 +37,14 @@ typedef struct ASimCardRec_ { static ASimCardRec _s_card[1]; ASimCard -asimcard_create( void ) +asimcard_create(int port) { ASimCard card = _s_card; card->status = A_SIM_STATUS_READY; card->pin_retries = 0; strncpy( card->pin, "0000", sizeof(card->pin) ); strncpy( card->puk, "12345678", sizeof(card->puk) ); + card->port = port; return card; } @@ -429,6 +432,11 @@ asimcard_io( ASimCard sim, const char* cmd ) } #endif + if (!strcmp("+CRSM=178,28480,1,4,32", cmd)) { + snprintf( sim->out_buff, sizeof(sim->out_buff), "+CRSM: 144,0,ffffffffffffffffffffffffffffffffffff0781515525%d1%d%df%dffffffffffff", (sim->port / 1000) % 10, (sim->port / 10) % 10, (sim->port / 100) % 10, sim->port % 10); + return sim->out_buff; + } + for (nn = 0; answers[nn].cmd != NULL; nn++) { if ( !strcmp( answers[nn].cmd, cmd ) ) { return answers[nn].answer; |