diff options
author | Marc Petit-Huguenin <petithug@gmail.com> | 2010-07-14 12:33:15 -0700 |
---|---|---|
committer | Marc Petit-Huguenin <petithug@gmail.com> | 2010-07-27 17:23:41 -0700 |
commit | a1b379c65f787fc85bd9c6f4a6d14d8a2bebc9d5 (patch) | |
tree | 7b3e7fb07704a507f0914e8e6290546b59045934 /telephony/sim_card.c | |
parent | 657a3521a1f4d354b57f0e524b1cd57bed177bb0 (diff) | |
download | external_qemu-a1b379c65f787fc85bd9c6f4a6d14d8a2bebc9d5.zip external_qemu-a1b379c65f787fc85bd9c6f4a6d14d8a2bebc9d5.tar.gz external_qemu-a1b379c65f787fc85bd9c6f4a6d14d8a2bebc9d5.tar.bz2 |
Make the GSM simulator more realistic
- The phone number of the phone is now built by concatenating "1555521"
to the console port.
- Convert number in remote call by concatenating "1555521" to the port
number.
- Convert called number to a number starting with "1555521".
- Fixed a bug in sms_address_to_str where the length returned is
incorrect is the length of the phone number to convert is odd.
Change-Id: Iefbdd866b6e41f6086c6e0cc33026551e3d5ae8f
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; |