aboutsummaryrefslogtreecommitdiffstats
path: root/telephony/remote_call.c
diff options
context:
space:
mode:
authorMarc Petit-Huguenin <petithug@gmail.com>2010-07-14 12:33:15 -0700
committerMarc Petit-Huguenin <petithug@gmail.com>2010-07-27 17:23:41 -0700
commita1b379c65f787fc85bd9c6f4a6d14d8a2bebc9d5 (patch)
tree7b3e7fb07704a507f0914e8e6290546b59045934 /telephony/remote_call.c
parent657a3521a1f4d354b57f0e524b1cd57bed177bb0 (diff)
downloadexternal_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/remote_call.c')
-rw-r--r--telephony/remote_call.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/telephony/remote_call.c b/telephony/remote_call.c
index 927e11d..43c9099 100644
--- a/telephony/remote_call.c
+++ b/telephony/remote_call.c
@@ -78,7 +78,16 @@ int
remote_number_string_to_port( const char* number )
{
char* end;
- long num = strtol( number, &end, 10 );
+ long num;
+ char* temp = number;
+ int len;
+
+ len = strlen(number);
+ if (len > 0 && number[len-1] == ';')
+ len--;
+ if (len == 11 && !memcmp(number, PHONE_PREFIX, 7))
+ temp += 7;
+ num = strtol( temp, &end, 10 );
if (end == NULL || *end || (int)num != num )
return -1;
@@ -167,23 +176,23 @@ remote_call_alloc( RemoteCallType type, int to_port, int from_port )
switch (type) {
case REMOTE_CALL_DIAL:
- p = bufprint(p, end, "gsm call %d\n", from_num );
+ p = bufprint(p, end, "gsm call " PHONE_PREFIX "%d\n", from_num );
break;
case REMOTE_CALL_BUSY:
- p = bufprint(p, end, "gsm busy %d\n", from_num);
+ p = bufprint(p, end, "gsm busy " PHONE_PREFIX "%d\n", from_num);
break;
case REMOTE_CALL_HOLD:
- p = bufprint(p, end, "gsm hold %d\n", from_num);
+ p = bufprint(p, end, "gsm hold " PHONE_PREFIX "%d\n", from_num);
break;
case REMOTE_CALL_ACCEPT:
- p = bufprint(p, end, "gsm accept %d\n", from_num);
+ p = bufprint(p, end, "gsm accept " PHONE_PREFIX "%d\n", from_num);
break;
case REMOTE_CALL_HANGUP:
- p = bufprint(p, end, "gsm cancel %d\n", from_num );
+ p = bufprint(p, end, "gsm cancel " PHONE_PREFIX "%d\n", from_num );
break;
default: