diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
commit | 55f4e4a5ec657a017e3bf75299ad71fd1c968dd3 (patch) | |
tree | 550ce922ea0e125ac6a9738210ce2939bf2fe901 /telephony/android_modem.h | |
parent | 413f05aaf54fa08c0ae7e997327a4f4a473c0a8d (diff) | |
download | external_qemu-55f4e4a5ec657a017e3bf75299ad71fd1c968dd3.zip external_qemu-55f4e4a5ec657a017e3bf75299ad71fd1c968dd3.tar.gz external_qemu-55f4e4a5ec657a017e3bf75299ad71fd1c968dd3.tar.bz2 |
Initial Contribution
Diffstat (limited to 'telephony/android_modem.h')
-rw-r--r-- | telephony/android_modem.h | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/telephony/android_modem.h b/telephony/android_modem.h new file mode 100644 index 0000000..80d22c5 --- /dev/null +++ b/telephony/android_modem.h @@ -0,0 +1,137 @@ +/* Copyright (C) 2007-2008 The Android Open Source Project +** +** This software is licensed under the terms of the GNU General Public +** License version 2, as published by the Free Software Foundation, and +** may be copied, distributed, and modified under those terms. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +*/ +#ifndef _android_modem_h_ +#define _android_modem_h_ + +#include "sim_card.h" +#include "sms.h" + +/** MODEM OBJECT + **/ +typedef struct AModemRec_* AModem; + +/* a function used by the modem to send unsolicited messages to the channel controller */ +typedef void (*AModemUnsolFunc)( void* opaque, const char* message ); + +extern AModem amodem_create( int base_port, AModemUnsolFunc unsol_func, void* unsol_opaque ); +extern void amodem_destroy( AModem modem ); + +/* send a command to the modem */ +extern const char* amodem_send( AModem modem, const char* cmd ); + +/* simulate the receipt on an incoming SMS message */ +extern void amodem_receive_sms( AModem modem, SmsPDU pdu ); + +/** RADIO STATE + **/ +typedef enum { + A_RADIO_STATE_OFF = 0, /* Radio explictly powered off (eg CFUN=0) */ + A_RADIO_STATE_ON, /* Radio on */ +} ARadioState; + +extern ARadioState amodem_get_radio_state( AModem modem ); +extern void amodem_set_radio_state( AModem modem, ARadioState state ); + +/** SIM CARD STATUS + **/ +extern ASimCard amodem_get_sim( AModem modem ); + +/** VOICE AND DATA NETWORK REGISTRATION + **/ + +/* 'stat' for +CREG/+CGREG commands */ +typedef enum { + A_REGISTRATION_UNREGISTERED = 0, + A_REGISTRATION_HOME = 1, + A_REGISTRATION_SEARCHING, + A_REGISTRATION_DENIED, + A_REGISTRATION_UNKNOWN, + A_REGISTRATION_ROAMING +} ARegistrationState; + +typedef enum { + A_GPRS_NETWORK_UNKNOWN = 0, + A_GPRS_NETWORK_GPRS, + A_GPRS_NETWORK_EDGE, + A_GPRS_NETWORK_UMTS +} AGprsNetworkType; + +extern ARegistrationState amodem_get_voice_registration( AModem modem ); +extern void amodem_set_voice_registration( AModem modem, ARegistrationState state ); + +extern ARegistrationState amodem_get_data_registration( AModem modem ); +extern void amodem_set_data_registration( AModem modem, ARegistrationState state ); +extern void amodem_set_data_network_type( AModem modem, AGprsNetworkType type ); + +extern AGprsNetworkType android_parse_network_type( const char* speed ); + + +/** OPERATOR NAMES + **/ +typedef enum { + A_NAME_LONG = 0, + A_NAME_SHORT, + A_NAME_NUMERIC, + A_NAME_MAX /* don't remove */ +} ANameIndex; + +/* retrieve operator name into user-provided buffer. returns number of writes written, including terminating zero */ +extern int amodem_get_operator_name ( AModem modem, ANameIndex index, char* buffer, int buffer_size ); + +/* reset one operator name from a user-provided buffer, set buffer_size to -1 for zero-terminated strings */ +extern void amodem_set_operator_name( AModem modem, ANameIndex index, const char* buffer, int buffer_size ); + +/** CALL STATES + **/ + +typedef enum { + A_CALL_OUTBOUND = 0, + A_CALL_INBOUND = 1, +} ACallDir; + +typedef enum { + A_CALL_ACTIVE = 0, + A_CALL_HELD, + A_CALL_DIALING, + A_CALL_ALERTING, + A_CALL_INCOMING, + A_CALL_WAITING +} ACallState; + +typedef enum { + A_CALL_VOICE = 0, + A_CALL_DATA, + A_CALL_FAX, + A_CALL_UNKNOWN = 9 +} ACallMode; + +#define A_CALL_NUMBER_MAX_SIZE 16 + +typedef struct { + int id; + ACallDir dir; + ACallState state; + ACallMode mode; + int multi; + char number[ A_CALL_NUMBER_MAX_SIZE+1 ]; +} ACallRec, *ACall; + +extern int amodem_get_call_count( AModem modem ); +extern ACall amodem_get_call( AModem modem, int index ); +extern ACall amodem_find_call_by_number( AModem modem, const char* number ); +extern int amodem_add_inbound_call( AModem modem, const char* number ); +extern int amodem_update_call( AModem modem, const char* number, ACallState state ); +extern int amodem_disconnect_call( AModem modem, const char* number ); + +/**/ + +#endif /* _android_modem_h_ */ |