aboutsummaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorTim Baverstock <weasel@google.com>2010-12-15 17:31:13 +0000
committerTim Baverstock <weasel@google.com>2010-12-15 17:38:20 +0000
commit4c6b10a4f385c04dbd7226e10a86a1f5cbd34f2a (patch)
treee73efe5f81db32825b318da31cb211926ee95a7c /telephony
parent09425494d2b9cce6a6c5725bbc320ca1a1440ad3 (diff)
downloadexternal_qemu-4c6b10a4f385c04dbd7226e10a86a1f5cbd34f2a.zip
external_qemu-4c6b10a4f385c04dbd7226e10a86a1f5cbd34f2a.tar.gz
external_qemu-4c6b10a4f385c04dbd7226e10a86a1f5cbd34f2a.tar.bz2
Add 'gsm signal' command, to set rssi and ber
Change-Id: I24d4738f6e5135437af25d22e2fa68617f5632fa
Diffstat (limited to 'telephony')
-rw-r--r--telephony/android_modem.c20
-rw-r--r--telephony/android_modem.h3
2 files changed, 21 insertions, 2 deletions
diff --git a/telephony/android_modem.c b/telephony/android_modem.c
index 009b5af..dd9f78d 100644
--- a/telephony/android_modem.c
+++ b/telephony/android_modem.c
@@ -235,6 +235,9 @@ typedef struct AModemRec_
int cell_id;
int base_port;
+ int rssi;
+ int ber;
+
/* SMS */
int wait_sms;
@@ -465,6 +468,9 @@ amodem_reset( AModem modem )
modem->radio_state = A_RADIO_STATE_OFF;
modem->wait_sms = 0;
+ modem->rssi= 7; // Two signal strength bars
+ modem->ber = 99; // Means 'unknown'
+
modem->oper_name_index = amodem_nvram_get_int(modem, NV_OPER_NAME_INDEX, 2);
modem->oper_selection_mode = amodem_nvram_get_int(modem, NV_SELECTION_MODE, A_SELECTION_AUTOMATIC);
modem->oper_index = amodem_nvram_get_int(modem, NV_OPER_INDEX, 0);
@@ -877,6 +883,12 @@ amodem_find_call_by_number( AModem modem, const char* number )
return NULL;
}
+void
+amodem_set_signal_strength( AModem modem, int rssi, int ber )
+{
+ modem->rssi = rssi;
+ modem->ber = ber;
+}
static void
acall_set_state( AVoiceCall call, ACallState state )
@@ -2135,7 +2147,6 @@ int android_snapshot_update_time_request = 0;
static const char*
handleSignalStrength( const char* cmd, AModem modem )
{
- /* XXX: TODO: implement variable signal strength and error rates */
amodem_begin_line( modem );
#if CONFIG_ANDROID_SNAPSHOTS
/* Sneak time updates into the SignalStrength request, because it's periodic.
@@ -2149,7 +2160,12 @@ handleSignalStrength( const char* cmd, AModem modem )
#endif
// rssi = 0 (<-113dBm) 1 (<-111) 2-30 (<-109--53) 31 (>=-51) 99 (?!)
// ber (bit error rate) - always 99 (unknown), apparently.
- amodem_add_line( modem, "+CSQ: %i,99\r\n", 27 );
+ // TODO: return 99 if modem->radio_state==A_RADIO_STATE_OFF, once radio_state is in snapshot.
+ int rssi = modem->rssi;
+ int ber = modem->ber;
+ rssi = (0 > rssi && rssi > 31) ? 99 : rssi ;
+ ber = (0 > ber && ber > 7 ) ? 99 : ber;
+ amodem_add_line( modem, "+CSQ: %i,%i\r\n", rssi, ber );
return amodem_end_line( modem );
}
diff --git a/telephony/android_modem.h b/telephony/android_modem.h
index 4409a7d..cbe8f46 100644
--- a/telephony/android_modem.h
+++ b/telephony/android_modem.h
@@ -42,6 +42,9 @@ typedef enum {
extern ARadioState amodem_get_radio_state( AModem modem );
extern void amodem_set_radio_state( AModem modem, ARadioState state );
+/* Set the received signal strength indicator and bit error rate */
+extern void amodem_set_signal_strength( AModem modem, int rssi, int ber );
+
/** SIM CARD STATUS
**/
extern ASimCard amodem_get_sim( AModem modem );