aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRGIB <gibellini.roberto@gmail.com>2015-03-14 21:02:10 +0100
committerRGIB <gibellini.roberto@gmail.com>2015-03-14 21:03:20 +0100
commit4fbefae1a4692cd107f13ad84f9540ddc9fc0cdc (patch)
tree90e7d72eabe6a3409dc9232fba57f0c15d5a0944
parent2091c6a1512ce12502c2ad3d5029be21f3fd9a76 (diff)
downloaddevice_samsung_n5100-4fbefae1a4692cd107f13ad84f9540ddc9fc0cdc.zip
device_samsung_n5100-4fbefae1a4692cd107f13ad84f9540ddc9fc0cdc.tar.gz
device_samsung_n5100-4fbefae1a4692cd107f13ad84f9540ddc9fc0cdc.tar.bz2
n5100: fix ril and gps
Change-Id: Ib73dbb04c9fd3d778ef094e354bb4ce871e30a4a
-rwxr-xr-xBoardConfig.mk1
-rw-r--r--cm.mk3
-rw-r--r--include/hardware/gps.h1097
-rw-r--r--include/telephony/ril.h858
-rw-r--r--ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java437
5 files changed, 2213 insertions, 183 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 874f972..f920e50 100755
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -23,6 +23,7 @@ LOCAL_PATH := device/samsung/n5100
# Inline kernel building
TARGET_KERNEL_SOURCE := kernel/samsung/smdk4412
TARGET_KERNEL_CONFIG := cyanogenmod_n5100_defconfig
+BOARD_RIL_CLASS := ../../../device/samsung/n5100/ril
TARGET_SPECIFIC_HEADER_PATH := $(LOCAL_PATH)/include
diff --git a/cm.mk b/cm.mk
index bebf11b..0c6da4b 100644
--- a/cm.mk
+++ b/cm.mk
@@ -1,6 +1,3 @@
-# Specify phone tech before including full_phone
-$(call inherit-product, vendor/cm/config/gsm.mk)
-
# Release name
PRODUCT_RELEASE_NAME := n5100
diff --git a/include/hardware/gps.h b/include/hardware/gps.h
index f149e98..59da5dd 100644
--- a/include/hardware/gps.h
+++ b/include/hardware/gps.h
@@ -21,6 +21,8 @@
#include <sys/cdefs.h>
#include <sys/types.h>
#include <pthread.h>
+#include <sys/socket.h>
+#include <stdbool.h>
#include <hardware/hardware.h>
@@ -38,6 +40,9 @@ typedef int64_t GpsUtcTime;
/** Maximum number of SVs for gps_sv_status_callback(). */
#define GPS_MAX_SVS 32
+/** Maximum number of Measurements in gps_measurement_callback(). */
+#define GPS_MAX_MEASUREMENT 32
+
/** Requested operational mode for GPS operation. */
typedef uint32_t GpsPositionMode;
// IMPORTANT: Note that the following values must match
@@ -103,25 +108,47 @@ typedef uint16_t GpsLocationFlags;
#define GPS_CAPABILITY_SINGLE_SHOT 0x0000008
/** GPS supports on demand time injection */
#define GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010
+/** GPS supports Geofencing */
+#define GPS_CAPABILITY_GEOFENCING 0x0000020
+/** GPS supports Measurements */
+#define GPS_CAPABILITY_MEASUREMENTS 0x0000040
+/** GPS supports Navigation Messages */
+#define GPS_CAPABILITY_NAV_MESSAGES 0x0000080
/** Flags used to specify which aiding data to delete
when calling delete_aiding_data(). */
-typedef uint16_t GpsAidingData;
+typedef uint32_t GpsAidingData;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
-#define GPS_DELETE_EPHEMERIS 0x0001
-#define GPS_DELETE_ALMANAC 0x0002
-#define GPS_DELETE_POSITION 0x0004
-#define GPS_DELETE_TIME 0x0008
-#define GPS_DELETE_IONO 0x0010
-#define GPS_DELETE_UTC 0x0020
-#define GPS_DELETE_HEALTH 0x0040
-#define GPS_DELETE_SVDIR 0x0080
-#define GPS_DELETE_SVSTEER 0x0100
-#define GPS_DELETE_SADATA 0x0200
-#define GPS_DELETE_RTI 0x0400
-#define GPS_DELETE_CELLDB_INFO 0x8000
-#define GPS_DELETE_ALL 0xFFFF
+#define GPS_DELETE_EPHEMERIS 0x00000001
+#define GPS_DELETE_ALMANAC 0x00000002
+#define GPS_DELETE_POSITION 0x00000004
+#define GPS_DELETE_TIME 0x00000008
+#define GPS_DELETE_IONO 0x00000010
+#define GPS_DELETE_UTC 0x00000020
+#define GPS_DELETE_HEALTH 0x00000040
+#define GPS_DELETE_SVDIR 0x00000080
+#define GPS_DELETE_SVSTEER 0x00000100
+#define GPS_DELETE_SADATA 0x00000200
+#define GPS_DELETE_RTI 0x00000400
+#define GPS_DELETE_CELLDB_INFO 0x00000800
+#define GPS_DELETE_ALMANAC_CORR 0x00001000
+#define GPS_DELETE_FREQ_BIAS_EST 0x00002000
+#define GLO_DELETE_EPHEMERIS 0x00004000
+#define GLO_DELETE_ALMANAC 0x00008000
+#define GLO_DELETE_SVDIR 0x00010000
+#define GLO_DELETE_SVSTEER 0x00020000
+#define GLO_DELETE_ALMANAC_CORR 0x00040000
+#define GPS_DELETE_TIME_GPS 0x00080000
+#define GLO_DELETE_TIME 0x00100000
+#define BDS_DELETE_SVDIR 0X00200000
+#define BDS_DELETE_SVSTEER 0X00400000
+#define BDS_DELETE_TIME 0X00800000
+#define BDS_DELETE_ALMANAC_CORR 0X01000000
+#define BDS_DELETE_EPHEMERIS 0X02000000
+#define BDS_DELETE_ALMANAC 0X04000000
+
+#define GPS_DELETE_ALL 0xFFFFFFFF
/** AGPS type */
typedef uint16_t AGpsType;
@@ -133,6 +160,12 @@ typedef uint16_t AGpsSetIDType;
#define AGPS_SETID_TYPE_IMSI 1
#define AGPS_SETID_TYPE_MSISDN 2
+typedef uint16_t ApnIpType;
+#define APN_IP_INVALID 0
+#define APN_IP_IPV4 1
+#define APN_IP_IPV6 2
+#define APN_IP_IPV4V6 3
+
/**
* String length constants
*/
@@ -204,6 +237,137 @@ typedef uint16_t AGpsStatusValue;
#define AGPS_RIL_NETWORK_TTYPE_WIMAX 6
/**
+ * Flags to indicate what fields in GpsClock are valid.
+ */
+typedef uint16_t GpsClockFlags;
+/** A valid 'leap second' is stored in the data structure. */
+#define GPS_CLOCK_HAS_LEAP_SECOND (1<<0)
+/** A valid 'time uncertainty' is stored in the data structure. */
+#define GPS_CLOCK_HAS_TIME_UNCERTAINTY (1<<1)
+/** A valid 'full bias' is stored in the data structure. */
+#define GPS_CLOCK_HAS_FULL_BIAS (1<<2)
+/** A valid 'bias' is stored in the data structure. */
+#define GPS_CLOCK_HAS_BIAS (1<<3)
+/** A valid 'bias uncertainty' is stored in the data structure. */
+#define GPS_CLOCK_HAS_BIAS_UNCERTAINTY (1<<4)
+/** A valid 'drift' is stored in the data structure. */
+#define GPS_CLOCK_HAS_DRIFT (1<<5)
+/** A valid 'drift uncertainty' is stored in the data structure. */
+#define GPS_CLOCK_HAS_DRIFT_UNCERTAINTY (1<<6)
+
+/**
+ * Enumeration of the available values for the GPS Clock type.
+ */
+typedef uint8_t GpsClockType;
+/** The type is not available ot it is unknown. */
+#define GPS_CLOCK_TYPE_UNKNOWN 0
+/** The source of the time value reported by GPS clock is the local hardware clock. */
+#define GPS_CLOCK_TYPE_LOCAL_HW_TIME 1
+/**
+ * The source of the time value reported by GPS clock is the GPS time derived from satellites
+ * (epoch = Jan 6, 1980)
+ */
+#define GPS_CLOCK_TYPE_GPS_TIME 2
+
+/**
+ * Flags to indicate what fields in GpsMeasurement are valid.
+ */
+typedef uint32_t GpsMeasurementFlags;
+/** A valid 'snr' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_SNR (1<<0)
+/** A valid 'elevation' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_ELEVATION (1<<1)
+/** A valid 'elevation uncertainty' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY (1<<2)
+/** A valid 'azimuth' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_AZIMUTH (1<<3)
+/** A valid 'azimuth uncertainty' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY (1<<4)
+/** A valid 'pseudorange' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_PSEUDORANGE (1<<5)
+/** A valid 'pseudorange uncertainty' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY (1<<6)
+/** A valid 'code phase' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_CODE_PHASE (1<<7)
+/** A valid 'code phase uncertainty' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY (1<<8)
+/** A valid 'carrier frequency' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY (1<<9)
+/** A valid 'carrier cycles' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_CARRIER_CYCLES (1<<10)
+/** A valid 'carrier phase' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_CARRIER_PHASE (1<<11)
+/** A valid 'carrier phase uncertainty' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY (1<<12)
+/** A valid 'bit number' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_BIT_NUMBER (1<<13)
+/** A valid 'time from last bit' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT (1<<14)
+/** A valid 'doppler shift' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT (1<<15)
+/** A valid 'doppler shift uncertainty' is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY (1<<16)
+/** A valid 'used in fix' flag is stored in the data structure. */
+#define GPS_MEASUREMENT_HAS_USED_IN_FIX (1<<17)
+
+/**
+ * Enumeration of the available values for the GPS Measurement's loss of lock.
+ */
+typedef uint8_t GpsLossOfLock;
+/** The indicator is not available or it is unknown. */
+#define GPS_LOSS_OF_LOCK_UNKNOWN 0
+/** The measurement does not present any indication of loss of lock. */
+#define GPS_LOSS_OF_LOCK_OK 1
+/** Loss of lock between previous and current observation: cycle slip possible. */
+#define GPS_LOSS_OF_LOCK_CYCLE_SLIP 2
+
+/**
+ * Enumeration of available values for the GPS Measurement's multipath indicator.
+ */
+typedef uint8_t GpsMultipathIndicator;
+/** The indicator is not available or unknown. */
+#define GPS_MULTIPATH_INDICATOR_UNKNOWN 0
+/** The measurement has been indicated to use multipath. */
+#define GPS_MULTIPATH_INDICATOR_DETECTED 1
+/** The measurement has been indicated Not to use multipath. */
+#define GPS_MULTIPATH_INDICATOR_NOT_USED 2
+
+/**
+ * Flags indicating the GPS measurement state.
+ */
+typedef uint16_t GpsMeasurementState;
+#define GPS_MEASUREMENT_STATE_UNKNOWN 0
+#define GPS_MEASUREMENT_STATE_CODE_LOCK (1<<0)
+#define GPS_MEASUREMENT_STATE_BIT_SYNC (1<<1)
+#define GPS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2)
+#define GPS_MEASUREMENT_STATE_TOW_DECODED (1<<3)
+
+/**
+ * Flags indicating the Accumulated Delta Range's states.
+ */
+typedef uint16_t GpsAccumulatedDeltaRangeState;
+#define GPS_ADR_STATE_UNKNOWN 0
+#define GPS_ADR_STATE_VALID (1<<0)
+#define GPS_ADR_STATE_RESET (1<<1)
+#define GPS_ADR_STATE_CYCLE_SLIP (1<<2)
+
+/**
+ * Enumeration of available values to indicate the available GPS Natigation message types.
+ */
+typedef uint8_t GpsNavigationMessageType;
+/** The message type is unknown. */
+#define GPS_NAVIGATION_MESSAGE_TYPE_UNKNOWN 0
+/** L1 C/A message contained in the structure. */
+#define GPS_NAVIGATION_MESSAGE_TYPE_L1CA 1
+/** L2-CNAV message contained in the structure. */
+#define GPS_NAVIGATION_MESSAGE_TYPE_L2CNAV 2
+/** L5-CNAV message contained in the structure. */
+#define GPS_NAVIGATION_MESSAGE_TYPE_L5CNAV 3
+/** CNAV-2 message contained in the structure. */
+#define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2 4
+
+
+/**
* Name for the GPS XTRA interface.
*/
#define GPS_XTRA_INTERFACE "gps-xtra"
@@ -219,6 +383,11 @@ typedef uint16_t AGpsStatusValue;
#define AGPS_INTERFACE "agps"
/**
+ * Name of the Supl Certificate interface.
+ */
+#define SUPL_CERTIFICATE_INTERFACE "supl-certificate"
+
+/**
* Name for NI interface
*/
#define GPS_NI_INTERFACE "gps-ni"
@@ -229,15 +398,26 @@ typedef uint16_t AGpsStatusValue;
#define AGPS_RIL_INTERFACE "agps_ril"
/**
- * The GPS chipset can use Psc for AGPS.
- */
-#define AGPS_USE_PSC
-
-/*
* Name for the GPS_Geofencing interface.
*/
#define GPS_GEOFENCING_INTERFACE "gps_geofencing"
+/**
+ * Name of the GPS Measurements interface.
+ */
+#define GPS_MEASUREMENT_INTERFACE "gps_measurement"
+
+/**
+ * Name of the GPS navigation message interface.
+ */
+#define GPS_NAVIGATION_MESSAGE_INTERFACE "gps_navigation_message"
+
+/**
+ * Name of the GNSS/GPS configuration interface.
+ */
+#define GNSS_CONFIGURATION_INTERFACE "gnss_configuration"
+
+
/** Represents a location. */
typedef struct {
/** set to sizeof(GpsLocation) */
@@ -280,13 +460,6 @@ typedef struct {
float elevation;
/** Azimuth of SV in degrees. */
float azimuth;
- /** Unknown field in Samsung I9100 libgps
- May be an indicator for constellation type
- (GPS, GLONASS, Galileo)?
- Used on GT-I9100, likely also present on GT-N7000,
- SGH-I717, SGH-I727 but this needs confirmation.
- */
- int unknown_samsung_field;
} GpsSvInfo;
/** Represents SV status. */
@@ -317,6 +490,7 @@ typedef struct {
uint32_t used_in_fix_mask;
} GpsSvStatus;
+
/* 2G and 3G */
/* In 3G lac is discarded */
typedef struct {
@@ -324,9 +498,6 @@ typedef struct {
uint16_t mcc;
uint16_t mnc;
uint16_t lac;
-#ifdef AGPS_USE_PSC
- uint16_t psc;
-#endif
uint32_t cid;
} AGpsRefLocationCellID;
@@ -353,8 +524,9 @@ typedef void (* gps_location_callback)(GpsLocation* location);
*/
typedef void (* gps_status_callback)(GpsStatus* status);
-/** Callback with SV status information.
- * Can only be called from a thread created by create_thread_cb.
+/**
+ * Callback with SV status information.
+ * Can only be called from a thread created by create_thread_cb.
*/
typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info);
@@ -406,7 +578,7 @@ typedef struct {
size_t size;
/**
* Opens the interface and provides the callback routines
- * to the implemenation of this interface.
+ * to the implementation of this interface.
*/
int (*init)( GpsCallbacks* callbacks );
@@ -467,7 +639,7 @@ typedef struct {
size_t size;
/**
* Opens the XTRA interface and provides the callback routines
- * to the implemenation of this interface.
+ * to the implementation of this interface.
*/
int (*init)( GpsXtraCallbacks* callbacks );
/** Injects XTRA data into the GPS. */
@@ -488,13 +660,45 @@ typedef struct {
/** Represents the status of AGPS. */
typedef struct {
- /** set to sizeof(AGpsStatus) */
+ /** set to sizeof(AGpsStatus_v1) */
+ size_t size;
+
+ AGpsType type;
+ AGpsStatusValue status;
+} AGpsStatus_v1;
+
+/** Represents the status of AGPS augmented with a IPv4 address field. */
+typedef struct {
+ /** set to sizeof(AGpsStatus_v2) */
size_t size;
AGpsType type;
AGpsStatusValue status;
uint32_t ipaddr;
-} AGpsStatus;
+} AGpsStatus_v2;
+
+/* Represents the status of AGPS augmented to support IPv4 and IPv6. */
+typedef struct {
+ /** set to sizeof(AGpsStatus_v3) */
+ size_t size;
+
+ AGpsType type;
+ AGpsStatusValue status;
+
+ /**
+ * Must be set to a valid IPv4 address if the field 'addr' contains an IPv4
+ * address, or set to INADDR_NONE otherwise.
+ */
+ uint32_t ipaddr;
+
+ /**
+ * Must contain the IPv4 (AF_INET) or IPv6 (AF_INET6) address to report.
+ * Any other value of addr.ss_family will be rejected.
+ * */
+ struct sockaddr_storage addr;
+} AGpsStatus_v3;
+
+typedef AGpsStatus_v3 AGpsStatus;
/** Callback with AGPS status information.
* Can only be called from a thread created by create_thread_cb.
@@ -510,16 +714,16 @@ typedef struct {
/** Extended interface for AGPS support. */
typedef struct {
- /** set to sizeof(AGpsInterface) */
+ /** set to sizeof(AGpsInterface_v1) */
size_t size;
/**
* Opens the AGPS interface and provides the callback routines
- * to the implemenation of this interface.
+ * to the implementation of this interface.
*/
void (*init)( AGpsCallbacks* callbacks );
/**
- * Notifies that a data connection is available and sets
+ * Notifies that a data connection is available and sets
* the name of the APN to be used for SUPL.
*/
int (*data_conn_open)( const char* apn );
@@ -528,15 +732,124 @@ typedef struct {
*/
int (*data_conn_closed)();
/**
- * Notifies that a data connection is not available for AGPS.
+ * Notifies that a data connection is not available for AGPS.
*/
int (*data_conn_failed)();
/**
* Sets the hostname and port for the AGPS server.
*/
int (*set_server)( AGpsType type, const char* hostname, int port );
-} AGpsInterface;
+} AGpsInterface_v1;
+
+/**
+ * Extended interface for AGPS support, it is augmented to enable to pass
+ * extra APN data.
+ */
+typedef struct {
+ /** set to sizeof(AGpsInterface_v2) */
+ size_t size;
+
+ /**
+ * Opens the AGPS interface and provides the callback routines to the
+ * implementation of this interface.
+ */
+ void (*init)(AGpsCallbacks* callbacks);
+ /**
+ * Deprecated.
+ * If the HAL supports AGpsInterface_v2 this API will not be used, see
+ * data_conn_open_with_apn_ip_type for more information.
+ */
+ int (*data_conn_open)(const char* apn);
+ /**
+ * Notifies that the AGPS data connection has been closed.
+ */
+ int (*data_conn_closed)();
+ /**
+ * Notifies that a data connection is not available for AGPS.
+ */
+ int (*data_conn_failed)();
+ /**
+ * Sets the hostname and port for the AGPS server.
+ */
+ int (*set_server)(AGpsType type, const char* hostname, int port);
+
+ /**
+ * Notifies that a data connection is available and sets the name of the
+ * APN, and its IP type, to be used for SUPL connections.
+ */
+ int (*data_conn_open_with_apn_ip_type)(
+ const char* apn,
+ ApnIpType apnIpType);
+} AGpsInterface_v2;
+
+typedef AGpsInterface_v2 AGpsInterface;
+
+/** Error codes associated with certificate operations */
+#define AGPS_CERTIFICATE_OPERATION_SUCCESS 0
+#define AGPS_CERTIFICATE_ERROR_GENERIC -100
+#define AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES -101
+
+/** A data structure that represents an X.509 certificate using DER encoding */
+typedef struct {
+ size_t length;
+ u_char* data;
+} DerEncodedCertificate;
+
+/**
+ * A type definition for SHA1 Fingerprints used to identify X.509 Certificates
+ * The Fingerprint is a digest of the DER Certificate that uniquely identifies it.
+ */
+typedef struct {
+ u_char data[20];
+} Sha1CertificateFingerprint;
+/** AGPS Interface to handle SUPL certificate operations */
+typedef struct {
+ /** set to sizeof(SuplCertificateInterface) */
+ size_t size;
+
+ /**
+ * Installs a set of Certificates used for SUPL connections to the AGPS server.
+ * If needed the HAL should find out internally any certificates that need to be removed to
+ * accommodate the certificates to install.
+ * The certificates installed represent a full set of valid certificates needed to connect to
+ * AGPS SUPL servers.
+ * The list of certificates is required, and all must be available at the same time, when trying
+ * to establish a connection with the AGPS Server.
+ *
+ * Parameters:
+ * certificates - A pointer to an array of DER encoded certificates that are need to be
+ * installed in the HAL.
+ * length - The number of certificates to install.
+ * Returns:
+ * AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully
+ * AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES if the HAL cannot store the number of
+ * certificates attempted to be installed, the state of the certificates stored should
+ * remain the same as before on this error case.
+ *
+ * IMPORTANT:
+ * If needed the HAL should find out internally the set of certificates that need to be
+ * removed to accommodate the certificates to install.
+ */
+ int (*install_certificates) ( const DerEncodedCertificate* certificates, size_t length );
+
+ /**
+ * Notifies the HAL that a list of certificates used for SUPL connections are revoked. It is
+ * expected that the given set of certificates is removed from the internal store of the HAL.
+ *
+ * Parameters:
+ * fingerprints - A pointer to an array of SHA1 Fingerprints to identify the set of
+ * certificates to revoke.
+ * length - The number of fingerprints provided.
+ * Returns:
+ * AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully.
+ *
+ * IMPORTANT:
+ * If any of the certificates provided (through its fingerprint) is not known by the HAL,
+ * it should be ignored and continue revoking/deleting the rest of them.
+ */
+ int (*revoke_certificates) ( const Sha1CertificateFingerprint* fingerprints, size_t length );
+} SuplCertificateInterface;
/** Represents an NI request */
typedef struct {
@@ -662,7 +975,7 @@ typedef struct {
size_t size;
/**
* Opens the AGPS interface and provides the callback routines
- * to the implemenation of this interface.
+ * to the implementation of this interface.
*/
void (*init)( AGpsRilCallbacks* callbacks );
@@ -692,6 +1005,7 @@ typedef struct {
*/
void (*update_network_availability) (int avaiable, const char* apn);
} AGpsRilInterface;
+
/**
* GPS Geofence.
* There are 3 states associated with a Geofence: Inside, Outside, Unknown.
@@ -778,28 +1092,29 @@ typedef struct {
#define GPS_GEOFENCE_ERROR_ID_UNKNOWN -102
#define GPS_GEOFENCE_ERROR_INVALID_TRANSITION -103
#define GPS_GEOFENCE_ERROR_GENERIC -149
+
/**
-* The callback associated with the geofence.
-* Parameters:
-* geofence_id - The id associated with the add_geofence_area.
-* location - The current GPS location.
-* transition - Can be one of GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED,
-* GPS_GEOFENCE_UNCERTAIN.
-* timestamp - Timestamp when the transition was detected.
-*
-* The callback should only be called when the caller is interested in that
-* particular transition. For instance, if the caller is interested only in
-* ENTERED transition, then the callback should NOT be called with the EXITED
-* transition.
-*
-* IMPORTANT: If a transition is triggered resulting in this callback, the GPS
-* subsystem will wake up the application processor, if its in suspend state.
-*/
+ * The callback associated with the geofence.
+ * Parameters:
+ * geofence_id - The id associated with the add_geofence_area.
+ * location - The current GPS location.
+ * transition - Can be one of GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED,
+ * GPS_GEOFENCE_UNCERTAIN.
+ * timestamp - Timestamp when the transition was detected.
+ *
+ * The callback should only be called when the caller is interested in that
+ * particular transition. For instance, if the caller is interested only in
+ * ENTERED transition, then the callback should NOT be called with the EXITED
+ * transition.
+ *
+ * IMPORTANT: If a transition is triggered resulting in this callback, the GPS
+ * subsystem will wake up the application processor, if its in suspend state.
+ */
typedef void (*gps_geofence_transition_callback) (int32_t geofence_id, GpsLocation* location,
-int32_t transition, GpsUtcTime timestamp);
+ int32_t transition, GpsUtcTime timestamp);
/**
- * The callback associated with the availablity of the GPS system for geofencing
+ * The callback associated with the availability of the GPS system for geofencing
* monitoring. If the GPS system determines that it cannot monitor geofences
* because of lack of reliability or unavailability of the GPS signals, it will
* call this callback with GPS_GEOFENCE_UNAVAILABLE parameter.
@@ -872,77 +1187,623 @@ typedef struct {
/** Extended interface for GPS_Geofencing support */
typedef struct {
- /** set to sizeof(GpsGeofencingInterface) */
- size_t size;
+ /** set to sizeof(GpsGeofencingInterface) */
+ size_t size;
+
+ /**
+ * Opens the geofence interface and provides the callback routines
+ * to the implementation of this interface.
+ */
+ void (*init)( GpsGeofenceCallbacks* callbacks );
+
+ /**
+ * Add a geofence area. This api currently supports circular geofences.
+ * Parameters:
+ * geofence_id - The id for the geofence. If a geofence with this id
+ * already exists, an error value (GPS_GEOFENCE_ERROR_ID_EXISTS)
+ * should be returned.
+ * latitude, longtitude, radius_meters - The lat, long and radius
+ * (in meters) for the geofence
+ * last_transition - The current state of the geofence. For example, if
+ * the system already knows that the user is inside the geofence,
+ * this will be set to GPS_GEOFENCE_ENTERED. In most cases, it
+ * will be GPS_GEOFENCE_UNCERTAIN.
+ * monitor_transition - Which transitions to monitor. Bitwise OR of
+ * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and
+ * GPS_GEOFENCE_UNCERTAIN.
+ * notification_responsiveness_ms - Defines the best-effort description
+ * of how soon should the callback be called when the transition
+ * associated with the Geofence is triggered. For instance, if set
+ * to 1000 millseconds with GPS_GEOFENCE_ENTERED, the callback
+ * should be called 1000 milliseconds within entering the geofence.
+ * This parameter is defined in milliseconds.
+ * NOTE: This is not to be confused with the rate that the GPS is
+ * polled at. It is acceptable to dynamically vary the rate of
+ * sampling the GPS for power-saving reasons; thus the rate of
+ * sampling may be faster or slower than this.
+ * unknown_timer_ms - The time limit after which the UNCERTAIN transition
+ * should be triggered. This parameter is defined in milliseconds.
+ * See above for a detailed explanation.
+ */
+ void (*add_geofence_area) (int32_t geofence_id, double latitude, double longitude,
+ double radius_meters, int last_transition, int monitor_transitions,
+ int notification_responsiveness_ms, int unknown_timer_ms);
+
+ /**
+ * Pause monitoring a particular geofence.
+ * Parameters:
+ * geofence_id - The id for the geofence.
+ */
+ void (*pause_geofence) (int32_t geofence_id);
+
+ /**
+ * Resume monitoring a particular geofence.
+ * Parameters:
+ * geofence_id - The id for the geofence.
+ * monitor_transitions - Which transitions to monitor. Bitwise OR of
+ * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and
+ * GPS_GEOFENCE_UNCERTAIN.
+ * This supersedes the value associated provided in the
+ * add_geofence_area call.
+ */
+ void (*resume_geofence) (int32_t geofence_id, int monitor_transitions);
+
+ /**
+ * Remove a geofence area. After the function returns, no notifications
+ * should be sent.
+ * Parameter:
+ * geofence_id - The id for the geofence.
+ */
+ void (*remove_geofence_area) (int32_t geofence_id);
+} GpsGeofencingInterface;
+
+
+/**
+ * Represents an estimate of the GPS clock time.
+ */
+typedef struct {
+ /** set to sizeof(GpsClock) */
+ size_t size;
+
+ /** A set of flags indicating the validity of the fields in this data structure. */
+ GpsClockFlags flags;
/**
- * Opens the geofence interface and provides the callback routines
- * to the implemenation of this interface.
+ * Leap second data.
+ * The sign of the value is defined by the following equation:
+ * utc_time_ns = time_ns + (full_bias_ns + bias_ns) - leap_second * 1,000,000,000
+ *
+ * If the data is available 'flags' must contain GPS_CLOCK_HAS_LEAP_SECOND.
*/
- void (*init)( GpsGeofenceCallbacks* callbacks );
+ int16_t leap_second;
/**
- * Add a geofence area. This api currently supports circular geofences.
- * Parameters:
- * geofence_id - The id for the geofence. If a geofence with this id
- * already exists, an error value (GPS_GEOFENCE_ERROR_ID_EXISTS)
- * should be returned.
- * latitude, longtitude, radius_meters - The lat, long and radius
- * (in meters) for the geofence
- * last_transition - The current state of the geofence. For example, if
- * the system already knows that the user is inside the geofence,
- * this will be set to GPS_GEOFENCE_ENTERED. In most cases, it
- * will be GPS_GEOFENCE_UNCERTAIN.
- * monitor_transition - Which transitions to monitor. Bitwise OR of
- * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and
- * GPS_GEOFENCE_UNCERTAIN.
- * notification_responsiveness_ms - Defines the best-effort description
- * of how soon should the callback be called when the transition
- * associated with the Geofence is triggered. For instance, if set
- * to 1000 millseconds with GPS_GEOFENCE_ENTERED, the callback
- * should be called 1000 milliseconds within entering the geofence.
- * This parameter is defined in milliseconds.
- * NOTE: This is not to be confused with the rate that the GPS is
- * polled at. It is acceptable to dynamically vary the rate of
- * sampling the GPS for power-saving reasons; thus the rate of
- * sampling may be faster or slower than this.
- * unknown_timer_ms - The time limit after which the UNCERTAIN transition
- * should be triggered. This paramter is defined in milliseconds.
- * See above for a detailed explanation.
- */
- void (*add_geofence_area) (int32_t geofence_id, double latitude,
- double longitude, double radius_meters,
- int last_transition, int monitor_transitions,
- int notification_responsiveness_ms,
- int unknown_timer_ms);
-
- /**
- * Pause monitoring a particular geofence.
- * Parameters:
- * geofence_id - The id for the geofence.
+ * Indicates the type of time reported by the 'time_ns' field.
+ * This is a Mandatory field.
*/
- void (*pause_geofence) (int32_t geofence_id);
+ GpsClockType type;
/**
- * Resume monitoring a particular geofence.
- * Parameters:
- * geofence_id - The id for the geofence.
- * monitor_transitions - Which transitions to monitor. Bitwise OR of
- * GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and
- * GPS_GEOFENCE_UNCERTAIN.
- * This supersedes the value associated provided in the
- * add_geofence_area call.
+ * The GPS receiver internal clock value. This can be either the local hardware clock value
+ * (GPS_CLOCK_TYPE_LOCAL_HW_TIME), or the current GPS time derived inside GPS receiver
+ * (GPS_CLOCK_TYPE_GPS_TIME). The field 'type' defines the time reported.
+ *
+ * For local hardware clock, this value is expected to be monotonically increasing during
+ * the reporting session. The real GPS time can be derived by compensating the 'full bias'
+ * (when it is available) from this value.
+ *
+ * For GPS time, this value is expected to be the best estimation of current GPS time that GPS
+ * receiver can achieve. Set the 'time uncertainty' appropriately when GPS time is specified.
+ *
+ * Sub-nanosecond accuracy can be provided by means of the 'bias' field.
+ * The value contains the 'time uncertainty' in it.
+ *
+ * This is a Mandatory field.
*/
- void (*resume_geofence) (int32_t geofence_id, int monitor_transitions);
+ int64_t time_ns;
/**
- * Remove a geofence area. After the function returns, no notifications
- * should be sent.
- * Parameter:
- * geofence_id - The id for the geofence.
+ * 1-Sigma uncertainty associated with the clock's time in nanoseconds.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * This value should be set if GPS_CLOCK_TYPE_GPS_TIME is set.
+ * If the data is available 'flags' must contain GPS_CLOCK_HAS_TIME_UNCERTAINTY.
*/
- void (*remove_geofence_area) (int32_t geofence_id);
-} GpsGeofencingInterface;
+ double time_uncertainty_ns;
+
+ /**
+ * The difference between hardware clock ('time' field) inside GPS receiver and the true GPS
+ * time since 0000Z, January 6, 1980, in nanoseconds.
+ * This value is used if and only if GPS_CLOCK_TYPE_LOCAL_HW_TIME is set, and GPS receiver
+ * has solved the clock for GPS time.
+ * The caller is responsible for using the 'bias uncertainty' field for quality check.
+ *
+ * The sign of the value is defined by the following equation:
+ * true time (GPS time) = time_ns + (full_bias_ns + bias_ns)
+ *
+ * This value contains the 'bias uncertainty' in it.
+ * If the data is available 'flags' must contain GPS_CLOCK_HAS_FULL_BIAS.
+
+ */
+ int64_t full_bias_ns;
+
+ /**
+ * Sub-nanosecond bias.
+ * The value contains the 'bias uncertainty' in it.
+ *
+ * If the data is available 'flags' must contain GPS_CLOCK_HAS_BIAS.
+ */
+ double bias_ns;
+
+ /**
+ * 1-Sigma uncertainty associated with the clock's bias in nanoseconds.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available 'flags' must contain GPS_CLOCK_HAS_BIAS_UNCERTAINTY.
+ */
+ double bias_uncertainty_ns;
+
+ /**
+ * The clock's drift in nanoseconds (per second).
+ * A positive value means that the frequency is higher than the nominal frequency.
+ *
+ * The value contains the 'drift uncertainty' in it.
+ * If the data is available 'flags' must contain GPS_CLOCK_HAS_DRIFT.
+ */
+ double drift_nsps;
+
+ /**
+ * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per second).
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available 'flags' must contain GPS_CLOCK_HAS_DRIFT_UNCERTAINTY.
+ */
+ double drift_uncertainty_nsps;
+} GpsClock;
+
+/**
+ * Represents a GPS Measurement, it contains raw and computed information.
+ */
+typedef struct {
+ /** set to sizeof(GpsMeasurement) */
+ size_t size;
+
+ /** A set of flags indicating the validity of the fields in this data structure. */
+ GpsMeasurementFlags flags;
+
+ /**
+ * Pseudo-random number in the range of [1, 32]
+ * This is a Mandatory value.
+ */
+ int8_t prn;
+
+ /**
+ * Time offset at which the measurement was taken in nanoseconds.
+ * The reference receiver's time is specified by GpsData::clock::time_ns and should be
+ * interpreted in the same way as indicated by GpsClock::type.
+ *
+ * The sign of time_offset_ns is given by the following equation:
+ * measurement time = GpsClock::time_ns + time_offset_ns
+ *
+ * It provides an individual time-stamp for the measurement, and allows sub-nanosecond accuracy.
+ * This is a Mandatory value.
+ */
+ double time_offset_ns;
+
+ /**
+ * Per satellite sync state. It represents the current sync state for the associated satellite.
+ * Based on the sync state, the 'received GPS tow' field should be interpreted accordingly.
+ *
+ * This is a Mandatory value.
+ */
+ GpsMeasurementState state;
+
+ /**
+ * Received GPS Time-of-Week at the measurement time, in nanoseconds.
+ * The value is relative to the beginning of the current GPS week.
+ *
+ * Given the sync state of GPS receiver, per each satellite, valid range for this field can be:
+ * Searching : [ 0 ] : GPS_MEASUREMENT_STATE_UNKNOWN
+ * Ranging code lock : [ 0 1ms ] : GPS_MEASUREMENT_STATE_CODE_LOCK is set
+ * Bit sync : [ 0 20ms ] : GPS_MEASUREMENT_STATE_BIT_SYNC is set
+ * Subframe sync : [ 0 6ms ] : GPS_MEASUREMENT_STATE_SUBFRAME_SYNC is set
+ * TOW decoded : [ 0 1week ] : GPS_MEASUREMENT_STATE_TOW_DECODED is set
+ */
+ int64_t received_gps_tow_ns;
+
+ /**
+ * 1-Sigma uncertainty of the Received GPS Time-of-Week in nanoseconds.
+ */
+ int64_t received_gps_tow_uncertainty_ns;
+
+ /**
+ * Carrier-to-noise density in dB-Hz, in the range [0, 63].
+ * It contains the measured C/N0 value for the signal at the antenna input.
+ *
+ * This is a Mandatory value.
+ */
+ double c_n0_dbhz;
+
+ /**
+ * Pseudorange rate at the timestamp in m/s.
+ * The value also includes the effects of the receiver clock frequency and satellite clock
+ * frequency errors.
+ *
+ * The value includes the 'pseudorange rate uncertainty' in it.
+ * A positive value indicates that the pseudorange is getting larger.
+ *
+ * This is a Mandatory value.
+ */
+ double pseudorange_rate_mps;
+
+ /**
+ * 1-Sigma uncertainty of the pseudurange rate in m/s.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * This is a Mandatory value.
+ */
+ double pseudorange_rate_uncertainty_mps;
+
+ /**
+ * Accumulated delta range's state. It indicates whether ADR is reset or there is a cycle slip
+ * (indicating loss of lock).
+ *
+ * This is a Mandatory value.
+ */
+ GpsAccumulatedDeltaRangeState accumulated_delta_range_state;
+
+ /**
+ * Accumulated delta range since the last channel reset in meters.
+ * The data is available if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN.
+ */
+ double accumulated_delta_range_m;
+
+ /**
+ * 1-Sigma uncertainty of the accumulated delta range in meters.
+ * The data is available if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN.
+ */
+ double accumulated_delta_range_uncertainty_m;
+
+ /**
+ * Best derived Pseudorange by the chip-set, in meters.
+ * The value contains the 'pseudorange uncertainty' in it.
+ *
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_PSEUDORANGE.
+ */
+ double pseudorange_m;
+
+ /**
+ * 1-Sigma uncertainty of the pseudorange in meters.
+ * The value contains the 'pseudorange' and 'clock' uncertainty in it.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY.
+ */
+ double pseudorange_uncertainty_m;
+
+ /**
+ * A fraction of the current C/A code cycle, in the range [0.0, 1023.0]
+ * This value contains the time (in Chip units) since the last C/A code cycle (GPS Msec epoch).
+ *
+ * The reference frequency is given by the field 'carrier_frequency_hz'.
+ * The value contains the 'code-phase uncertainty' in it.
+ *
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CODE_PHASE.
+ */
+ double code_phase_chips;
+
+ /**
+ * 1-Sigma uncertainty of the code-phase, in a fraction of chips.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY.
+ */
+ double code_phase_uncertainty_chips;
+
+ /**
+ * Carrier frequency at which codes and messages are modulated, it can be L1 or L2.
+ * If the field is not set, the carrier frequency is assumed to be L1.
+ *
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY.
+ */
+ float carrier_frequency_hz;
+
+ /**
+ * The number of full carrier cycles between the satellite and the receiver.
+ * The reference frequency is given by the field 'carrier_frequency_hz'.
+ *
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_CYCLES.
+ */
+ int64_t carrier_cycles;
+
+ /**
+ * The RF phase detected by the receiver, in the range [0.0, 1.0].
+ * This is usually the fractional part of the complete carrier phase measurement.
+ *
+ * The reference frequency is given by the field 'carrier_frequency_hz'.
+ * The value contains the 'carrier-phase uncertainty' in it.
+ *
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_PHASE.
+ */
+ double carrier_phase;
+
+ /**
+ * 1-Sigma uncertainty of the carrier-phase.
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY.
+ */
+ double carrier_phase_uncertainty;
+
+ /**
+ * An enumeration that indicates the 'loss of lock' state of the event.
+ */
+ GpsLossOfLock loss_of_lock;
+
+ /**
+ * The number of GPS bits transmitted since Sat-Sun midnight (GPS week).
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_BIT_NUMBER.
+ */
+ int32_t bit_number;
+
+ /**
+ * The elapsed time since the last received bit in milliseconds, in the range [0, 20]
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT.
+ */
+ int16_t time_from_last_bit_ms;
+
+ /**
+ * Doppler shift in Hz.
+ * A positive value indicates that the SV is moving toward the receiver.
+ *
+ * The reference frequency is given by the field 'carrier_frequency_hz'.
+ * The value contains the 'doppler shift uncertainty' in it.
+ *
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_DOPPLER_SHIFT.
+ */
+ double doppler_shift_hz;
+
+ /**
+ * 1-Sigma uncertainty of the doppler shift in Hz.
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY.
+ */
+ double doppler_shift_uncertainty_hz;
+
+ /**
+ * An enumeration that indicates the 'multipath' state of the event.
+ */
+ GpsMultipathIndicator multipath_indicator;
+
+ /**
+ * Signal-to-noise ratio in dB.
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_SNR.
+ */
+ double snr_db;
+
+ /**
+ * Elevation in degrees, the valid range is [-90, 90].
+ * The value contains the 'elevation uncertainty' in it.
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_ELEVATION.
+ */
+ double elevation_deg;
+
+ /**
+ * 1-Sigma uncertainty of the elevation in degrees, the valid range is [0, 90].
+ * The uncertainty is represented as the absolute (single sided) value.
+ *
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY.
+ */
+ double elevation_uncertainty_deg;
+
+ /**
+ * Azimuth in degrees, in the range [0, 360).
+ * The value contains the 'azimuth uncertainty' in it.
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_AZIMUTH.
+ * */
+ double azimuth_deg;
+
+ /**
+ * 1-Sigma uncertainty of the azimuth in degrees, the valid range is [0, 180].
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY.
+ */
+ double azimuth_uncertainty_deg;
+
+ /**
+ * Whether the GPS represented by the measurement was used for computing the most recent fix.
+ * If the data is available, 'flags' must contain GPS_MEASUREMENT_HAS_USED_IN_FIX.
+ */
+ bool used_in_fix;
+} GpsMeasurement;
+
+/** Represents a reading of GPS measurements. */
+typedef struct {
+ /** set to sizeof(GpsData) */
+ size_t size;
+
+ /** Number of measurements. */
+ size_t measurement_count;
+
+ /** The array of measurements. */
+ GpsMeasurement measurements[GPS_MAX_MEASUREMENT];
+
+ /** The GPS clock time reading. */
+ GpsClock clock;
+} GpsData;
+
+/**
+ * The callback for to report measurements from the HAL.
+ *
+ * Parameters:
+ * data - A data structure containing the measurements.
+ */
+typedef void (*gps_measurement_callback) (GpsData* data);
+
+typedef struct {
+ /** set to sizeof(GpsMeasurementCallbacks) */
+ size_t size;
+ gps_measurement_callback measurement_callback;
+} GpsMeasurementCallbacks;
+
+#define GPS_MEASUREMENT_OPERATION_SUCCESS 0
+#define GPS_MEASUREMENT_ERROR_ALREADY_INIT -100
+#define GPS_MEASUREMENT_ERROR_GENERIC -101
+
+/**
+ * Extended interface for GPS Measurements support.
+ */
+typedef struct {
+ /** Set to sizeof(GpsMeasurementInterface) */
+ size_t size;
+
+ /**
+ * Initializes the interface and registers the callback routines with the HAL.
+ * After a successful call to 'init' the HAL must begin to provide updates at its own phase.
+ *
+ * Status:
+ * GPS_MEASUREMENT_OPERATION_SUCCESS
+ * GPS_MEASUREMENT_ERROR_ALREADY_INIT - if a callback has already been registered without a
+ * corresponding call to 'close'
+ * GPS_MEASUREMENT_ERROR_GENERIC - if any other error occurred, it is expected that the HAL
+ * will not generate any updates upon returning this error code.
+ */
+ int (*init) (GpsMeasurementCallbacks* callbacks);
+
+ /**
+ * Stops updates from the HAL, and unregisters the callback routines.
+ * After a call to stop, the previously registered callbacks must be considered invalid by the
+ * HAL.
+ * If stop is invoked without a previous 'init', this function should perform no work.
+ */
+ void (*close) ();
+
+} GpsMeasurementInterface;
+
+
+/** Represents a GPS navigation message (or a fragment of it). */
+typedef struct {
+ /** set to sizeof(GpsNavigationMessage) */
+ size_t size;
+
+ /**
+ * Pseudo-random number in the range of [1, 32]
+ * This is a Mandatory value.
+ */
+ int8_t prn;
+
+ /**
+ * The type of message contained in the structure.
+ * This is a Mandatory value.
+ */
+ GpsNavigationMessageType type;
+
+ /**
+ * Message identifier.
+ * It provides an index so the complete Navigation Message can be assembled. i.e. fo L1 C/A
+ * subframe 4 and 5, this value corresponds to the 'frame id' of the navigation message.
+ * Subframe 1, 2, 3 does not contain a 'frame id' and this value can be set to -1.
+ */
+ int16_t message_id;
+
+ /**
+ * Sub-message identifier.
+ * If required by the message 'type', this value contains a sub-index within the current
+ * message (or frame) that is being transmitted.
+ * i.e. for L1 C/A the submessage id corresponds to the sub-frame id of the navigation message.
+ */
+ int16_t submessage_id;
+
+ /**
+ * The length of the data (in bytes) contained in the current message.
+ * If this value is different from zero, 'data' must point to an array of the same size.
+ * e.g. for L1 C/A the size of the sub-frame will be 40 bytes (10 words, 30 bits/word).
+ *
+ * This is a Mandatory value.
+ */
+ size_t data_length;
+
+ /**
+ * The data of the reported GPS message.
+ * The bytes (or words) specified using big endian format (MSB first).
+ *
+ * For L1 C/A, each subframe contains 10 30-bit GPS words. Each GPS word (30 bits) should be
+ * fitted into the last 30 bits in a 4-byte word (skip B31 and B32), with MSB first.
+ */
+ uint8_t* data;
+
+} GpsNavigationMessage;
+
+/**
+ * The callback to report an available fragment of a GPS navigation messages from the HAL.
+ *
+ * Parameters:
+ * message - The GPS navigation submessage/subframe representation.
+ */
+typedef void (*gps_navigation_message_callback) (GpsNavigationMessage* message);
+
+typedef struct {
+ /** set to sizeof(GpsNavigationMessageCallbacks) */
+ size_t size;
+ gps_navigation_message_callback navigation_message_callback;
+} GpsNavigationMessageCallbacks;
+
+#define GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS 0
+#define GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT -100
+#define GPS_NAVIGATION_MESSAGE_ERROR_GENERIC -101
+
+/**
+ * Extended interface for GPS navigation message reporting support.
+ */
+typedef struct {
+ /** Set to sizeof(GpsNavigationMessageInterface) */
+ size_t size;
+
+ /**
+ * Initializes the interface and registers the callback routines with the HAL.
+ * After a successful call to 'init' the HAL must begin to provide updates as they become
+ * available.
+ *
+ * Status:
+ * GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS
+ * GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT - if a callback has already been registered
+ * without a corresponding call to 'close'.
+ * GPS_NAVIGATION_MESSAGE_ERROR_GENERIC - if any other error occurred, it is expected that
+ * the HAL will not generate any updates upon returning this error code.
+ */
+ int (*init) (GpsNavigationMessageCallbacks* callbacks);
+
+ /**
+ * Stops updates from the HAL, and unregisters the callback routines.
+ * After a call to stop, the previously registered callbacks must be considered invalid by the
+ * HAL.
+ * If stop is invoked without a previous 'init', this function should perform no work.
+ */
+ void (*close) ();
+
+} GpsNavigationMessageInterface;
+
+/**
+ * Interface for passing GNSS configuration contents from platform to HAL.
+ */
+typedef struct {
+ /** Set to sizeof(GnssConfigurationInterface) */
+ size_t size;
+
+ /**
+ * Deliver GNSS configuration contents to HAL.
+ * Parameters:
+ * config_data - a pointer to a char array which holds what usually is expected from
+ file(/etc/gps.conf), i.e., a sequence of UTF8 strings separated by '\n'.
+ * length - total number of UTF8 characters in configuraiton data.
+ *
+ * IMPORTANT:
+ * GPS HAL should expect this function can be called multiple times. And it may be
+ * called even when GpsLocationProvider is already constructed and enabled. GPS HAL
+ * should maintain the existing requests for various callback regardless the change
+ * in configuration data.
+ */
+ void (*configuration_update) (const char* config_data, int32_t length);
+} GnssConfigurationInterface;
+
__END_DECLS
#endif /* ANDROID_INCLUDE_HARDWARE_GPS_H */
diff --git a/include/telephony/ril.h b/include/telephony/ril.h
index fefc563..18cdb5f 100644
--- a/include/telephony/ril.h
+++ b/include/telephony/ril.h
@@ -19,6 +19,10 @@
#include <stdlib.h>
#include <stdint.h>
+#include <telephony/ril_cdma_sms.h>
+#include <telephony/ril_nv_items.h>
+#include <telephony/ril_msim.h>
+
#ifndef FEATURE_UNIT_TEST
#include <sys/time.h>
#endif /* !FEATURE_UNIT_TEST */
@@ -27,7 +31,22 @@
extern "C" {
#endif
-#define RIL_VERSION 8 /* Current version */
+
+#if defined(ANDROID_SIM_COUNT_2)
+#define SIM_COUNT 2
+#elif defined(ANDROID_SIM_COUNT_3)
+#define SIM_COUNT 3
+#elif defined(ANDROID_SIM_COUNT_4)
+#define SIM_COUNT 4
+#else
+#define SIM_COUNT 1
+#endif
+
+#ifndef ANDROID_MULTI_SIM
+#define SIM_COUNT 1
+#endif
+
+#define RIL_VERSION 10 /* Current version */
#ifdef LEGACY_RIL
#define RIL_VERSION_MIN 2 /* Minimum RIL_VERSION supported */
#else
@@ -37,9 +56,30 @@ extern "C" {
#define CDMA_ALPHA_INFO_BUFFER_LENGTH 64
#define CDMA_NUMBER_INFO_BUFFER_LENGTH 81
+#define MAX_RILDS 3
+#define MAX_SOCKET_NAME_LENGTH 6
+#define MAX_CLIENT_ID_LENGTH 2
+#define MAX_DEBUG_SOCKET_NAME_LENGTH 12
+#define MAX_QEMU_PIPE_NAME_LENGTH 11
+
typedef void * RIL_Token;
typedef enum {
+ RIL_SOCKET_1,
+#if (SIM_COUNT >= 2)
+ RIL_SOCKET_2,
+#if (SIM_COUNT >= 3)
+ RIL_SOCKET_3,
+#endif
+#if (SIM_COUNT >= 4)
+ RIL_SOCKET_4,
+#endif
+#endif
+ RIL_SOCKET_NUM
+} RIL_SOCKET_ID;
+
+
+typedef enum {
RIL_E_SUCCESS = 0,
RIL_E_RADIO_NOT_AVAILABLE = 1, /* If radio did not start or is resetting */
RIL_E_GENERIC_FAILURE = 2,
@@ -60,8 +100,10 @@ typedef enum {
location */
RIL_E_MODE_NOT_SUPPORTED = 13, /* HW does not support preferred network type */
RIL_E_FDN_CHECK_FAILURE = 14, /* command failed because recipient is not on FDN list */
- RIL_E_ILLEGAL_SIM_OR_ME = 15 /* network selection failed due to
+ RIL_E_ILLEGAL_SIM_OR_ME = 15, /* network selection failed due to
illegal SIM or ME */
+ RIL_E_MISSING_RESOURCE = 16, /* no logical channel available */
+ RIL_E_NO_SUCH_ELEMENT = 17, /* application not found on SIM */
} RIL_Errno;
typedef enum {
@@ -108,7 +150,7 @@ typedef enum {
RADIO_TECH_LTE = 14,
RADIO_TECH_HSPAP = 15, // HSPA+
RADIO_TECH_GSM = 16, // Only supports voice
- RADIO_TECH_DCHSPAP = 30
+ RADIO_TECH_TD_SCDMA = 17
} RIL_RadioTechnology;
// Do we want to split Data from Voice and the use
@@ -125,7 +167,8 @@ typedef enum {
PREF_NET_TYPE_LTE_CDMA_EVDO = 8, /* LTE, CDMA and EvDo */
PREF_NET_TYPE_LTE_GSM_WCDMA = 9, /* LTE, GSM/WCDMA */
PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA = 10, /* LTE, CDMA, EvDo, GSM/WCDMA */
- PREF_NET_TYPE_LTE_ONLY = 11 /* LTE only */
+ PREF_NET_TYPE_LTE_ONLY = 11, /* LTE only */
+ PREF_NET_TYPE_LTE_WCDMA = 12 /* LTE/WCDMA */
} RIL_PreferredNetworkType;
/* Source for cdma subscription */
@@ -208,7 +251,6 @@ typedef struct {
*/
typedef struct {
int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
-#ifndef HCRADIO
int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
back-off timer value RIL wants to override the one
pre-configured in FW.
@@ -216,7 +258,6 @@ typedef struct {
The value < 0 means no value is suggested.
The value 0 means retry should be done ASAP.
The value of INT_MAX(0x7fffffff) means no retry. */
-#endif
int cid; /* Context ID, uniquely identifies this call */
int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1.
@@ -240,6 +281,61 @@ typedef struct {
} RIL_Data_Call_Response_v6;
typedef struct {
+ int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
+ int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
+ back-off timer value RIL wants to override the one
+ pre-configured in FW.
+ The unit is miliseconds.
+ The value < 0 means no value is suggested.
+ The value 0 means retry should be done ASAP.
+ The value of INT_MAX(0x7fffffff) means no retry. */
+ int cid; /* Context ID, uniquely identifies this call */
+ int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
+ char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1.
+ For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
+ PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
+ such as "IP" or "IPV6" */
+ char * ifname; /* The network interface name */
+ char * addresses; /* A space-delimited list of addresses with optional "/" prefix length,
+ e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
+ May not be empty, typically 1 IPv4 or 1 IPv6 or
+ one of each. If the prefix length is absent the addresses
+ are assumed to be point to point with IPv4 having a prefix
+ length of 32 and IPv6 128. */
+ char * dnses; /* A space-delimited list of DNS server addresses,
+ e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
+ May be empty. */
+ char * gateways; /* A space-delimited list of default gateway addresses,
+ e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
+ May be empty in which case the addresses represent point
+ to point connections. */
+ char * pcscf; /* the Proxy Call State Control Function address
+ via PCO(Protocol Configuration Option) for IMS client. */
+} RIL_Data_Call_Response_v9; // FIXME: Change to v10
+
+typedef enum {
+ RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */
+ RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */
+} RIL_RadioTechnologyFamily;
+
+typedef struct {
+ RIL_RadioTechnologyFamily tech;
+ unsigned char retry; /* 0 == not retry, nonzero == retry */
+ int messageRef; /* Valid field if retry is set to nonzero.
+ Contains messageRef from RIL_SMS_Response
+ corresponding to failed MO SMS.
+ */
+
+ union {
+ /* Valid field if tech is RADIO_TECH_3GPP2. See RIL_REQUEST_CDMA_SEND_SMS */
+ RIL_CDMA_SMS_Message* cdmaMessage;
+
+ /* Valid field if tech is RADIO_TECH_3GPP. See RIL_REQUEST_SEND_SMS */
+ char** gsmMessage;
+ } message;
+} RIL_IMS_SMS_Message;
+
+typedef struct {
int messageRef; /* TP-Message-Reference for GSM,
and BearerData MessageId for CDMA
(See 3GPP2 C.S0015-B, v2.0, table 4.5-1). */
@@ -303,10 +399,27 @@ typedef struct {
char *aidPtr; /* AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value. */
} RIL_SIM_IO_v6;
+/* Used by RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL and
+ * RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC. */
+typedef struct {
+ int sessionid; /* "sessionid" from TS 27.007 +CGLA command. Should be
+ ignored for +CSIM command. */
+
+ /* Following fields are used to derive the APDU ("command" and "length"
+ values in TS 27.007 +CSIM and +CGLA commands). */
+ int cla;
+ int instruction;
+ int p1;
+ int p2;
+ int p3; /* A negative P3 implies a 4 byte APDU. */
+ char *data; /* May be NULL. In hex string format. */
+} RIL_SIM_APDU;
+
typedef struct {
int sw1;
int sw2;
- char *simResponse; /* In hex string format ([a-fA-F0-9]*). */
+ char *simResponse; /* In hex string format ([a-fA-F0-9]*), except for SIM_AUTHENTICATION
+ response for which it is in Base64 format, see 3GPP TS 31.102 7.1.2 */
} RIL_SIM_IO_Response;
/* See also com.android.internal.telephony.gsm.CallForwardInfo */
@@ -394,6 +507,8 @@ typedef enum {
PDP_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED = 0x21, /* no retry */
PDP_FAIL_SERVICE_OPTION_OUT_OF_ORDER = 0x22,
PDP_FAIL_NSAPI_IN_USE = 0x23, /* no retry */
+ PDP_FAIL_REGULAR_DEACTIVATION = 0x24, /* possibly restart radio,
+ based on framework config */
PDP_FAIL_ONLY_IPV4_ALLOWED = 0x32, /* no retry */
PDP_FAIL_ONLY_IPV6_ALLOWED = 0x33, /* no retry */
PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED = 0x34,
@@ -404,7 +519,7 @@ typedef enum {
PDP_FAIL_DATA_REGISTRATION_FAIL = -2,
/* reasons for data call drop - network/modem disconnect */
- PDP_FAIL_SIGNAL_LOST = -3, /* no retry */
+ PDP_FAIL_SIGNAL_LOST = -3,
PDP_FAIL_PREF_RADIO_TECH_CHANGED = -4,/* preferred technology has changed, should retry
with parameters appropriate for new technology */
PDP_FAIL_RADIO_POWER_OFF = -5, /* data call was disconnected because radio was resetting,
@@ -724,6 +839,13 @@ typedef struct {
* also: http://www.cellular-planningoptimization.com/2010/02/timing-advance-with-calculation.html */
} RIL_LTE_SignalStrength_v8;
+typedef struct {
+ int rscp; /* The Received Signal Code Power in dBm multipled by -1.
+ * Range : 25 to 120
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 25.123, section 9.1.1.1 */
+} RIL_TD_SCDMA_SignalStrength;
+
/* Deprecated, use RIL_SignalStrength_v6 */
typedef struct {
RIL_GW_SignalStrength GW_SignalStrength;
@@ -745,6 +867,14 @@ typedef struct {
RIL_LTE_SignalStrength_v8 LTE_SignalStrength;
} RIL_SignalStrength_v8;
+typedef struct {
+ RIL_GW_SignalStrength GW_SignalStrength;
+ RIL_CDMA_SignalStrength CDMA_SignalStrength;
+ RIL_EVDO_SignalStrength EVDO_SignalStrength;
+ RIL_LTE_SignalStrength_v8 LTE_SignalStrength;
+ RIL_TD_SCDMA_SignalStrength TD_SCDMA_SignalStrength;
+} RIL_SignalStrength_v10;
+
/** RIL_CellIdentityGsm */
typedef struct {
int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */
@@ -787,6 +917,15 @@ typedef struct {
int tac; /* 16-bit tracking area code, INT_MAX if unknown */
} RIL_CellIdentityLte;
+/** RIL_CellIdentityTdscdma */
+typedef struct {
+ int mcc; /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */
+ int mnc; /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */
+ int lac; /* 16-bit Location Area Code, 0..65535, INT_MAX if unknown */
+ int cid; /* 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown */
+ int cpid; /* 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown */
+} RIL_CellIdentityTdscdma;
+
/** RIL_CellInfoGsm */
typedef struct {
RIL_CellIdentityGsm cellIdentityGsm;
@@ -812,12 +951,19 @@ typedef struct {
RIL_LTE_SignalStrength_v8 signalStrengthLte;
} RIL_CellInfoLte;
+/** RIL_CellInfoTdscdma */
+typedef struct {
+ RIL_CellIdentityTdscdma cellIdentityTdscdma;
+ RIL_TD_SCDMA_SignalStrength signalStrengthTdscdma;
+} RIL_CellInfoTdscdma;
+
// Must be the same as CellInfo.TYPE_XXX
typedef enum {
RIL_CELL_INFO_TYPE_GSM = 1,
RIL_CELL_INFO_TYPE_CDMA = 2,
RIL_CELL_INFO_TYPE_LTE = 3,
RIL_CELL_INFO_TYPE_WCDMA = 4,
+ RIL_CELL_INFO_TYPE_TD_SCDMA = 5
} RIL_CellInfoType;
// Must be the same as CellInfo.TIMESTAMP_TYPE_XXX
@@ -839,6 +985,7 @@ typedef struct {
RIL_CellInfoCdma cdma;
RIL_CellInfoLte lte;
RIL_CellInfoWcdma wcdma;
+ RIL_CellInfoTdscdma tdscdma;
} CellInfo;
} RIL_CellInfo;
@@ -951,11 +1098,118 @@ typedef struct {
#define RIL_CDMA_MAX_NUMBER_OF_INFO_RECS 10
+#define RIL_HARDWARE_CONFIG_UUID_LENGTH 64
+
typedef struct {
char numberOfInfoRecs;
RIL_CDMA_InformationRecord infoRec[RIL_CDMA_MAX_NUMBER_OF_INFO_RECS];
} RIL_CDMA_InformationRecords;
+/* See RIL_REQUEST_NV_READ_ITEM */
+typedef struct {
+ RIL_NV_Item itemID;
+} RIL_NV_ReadItem;
+
+/* See RIL_REQUEST_NV_WRITE_ITEM */
+typedef struct {
+ RIL_NV_Item itemID;
+ char * value;
+} RIL_NV_WriteItem;
+
+typedef enum {
+ HANDOVER_STARTED = 0,
+ HANDOVER_COMPLETED = 1,
+ HANDOVER_FAILED = 2,
+ HANDOVER_CANCELED = 3
+} RIL_SrvccState;
+
+/* hardware configuration reported to RILJ. */
+typedef enum {
+ RIL_HARDWARE_CONFIG_MODEM = 0,
+ RIL_HARDWARE_CONFIG_SIM = 1,
+} RIL_HardwareConfig_Type;
+
+typedef enum {
+ RIL_HARDWARE_CONFIG_STATE_ENABLED = 0,
+ RIL_HARDWARE_CONFIG_STATE_STANDBY = 1,
+ RIL_HARDWARE_CONFIG_STATE_DISABLED = 2,
+} RIL_HardwareConfig_State;
+
+typedef struct {
+ int rilModel;
+ uint32_t rat; /* bitset - ref. RIL_RadioTechnology. */
+ int maxVoice;
+ int maxData;
+ int maxStandby;
+} RIL_HardwareConfig_Modem;
+
+typedef struct {
+ char modemUuid[RIL_HARDWARE_CONFIG_UUID_LENGTH];
+} RIL_HardwareConfig_Sim;
+
+typedef struct {
+ RIL_HardwareConfig_Type type;
+ char uuid[RIL_HARDWARE_CONFIG_UUID_LENGTH];
+ RIL_HardwareConfig_State state;
+ union {
+ RIL_HardwareConfig_Modem modem;
+ RIL_HardwareConfig_Sim sim;
+ } cfg;
+} RIL_HardwareConfig;
+
+/**
+ * Data connection power state
+ */
+typedef enum {
+ RIL_DC_POWER_STATE_LOW = 1, // Low power state
+ RIL_DC_POWER_STATE_MEDIUM = 2, // Medium power state
+ RIL_DC_POWER_STATE_HIGH = 3, // High power state
+ RIL_DC_POWER_STATE_UNKNOWN = INT32_MAX // Unknown state
+} RIL_DcPowerStates;
+
+/**
+ * Data connection real time info
+ */
+typedef struct {
+ uint64_t time; // Time in nanos as returned by ril_nano_time
+ RIL_DcPowerStates powerState; // Current power state
+} RIL_DcRtInfo;
+
+/**
+ * Data profile to modem
+ */
+typedef struct {
+ /* id of the data profile */
+ int profileId;
+ /* the APN to connect to */
+ char* apn;
+ /** one of the PDP_type values in TS 27.007 section 10.1.1.
+ * For example, "IP", "IPV6", "IPV4V6", or "PPP".
+ */
+ char* protocol;
+ /** authentication protocol used for this PDP context
+ * (None: 0, PAP: 1, CHAP: 2, PAP&CHAP: 3)
+ */
+ int authType;
+ /* the username for APN, or NULL */
+ char* user;
+ /* the password for APN, or NULL */
+ char* password;
+ /* the profile type, TYPE_COMMON-0, TYPE_3GPP-1, TYPE_3GPP2-2 */
+ int type;
+ /* the period in seconds to limit the maximum connections */
+ int maxConnsTime;
+ /* the maximum connections during maxConnsTime */
+ int maxConns;
+ /** the required wait time in seconds after a successful UE initiated
+ * disconnect of a given PDN connection before the device can send
+ * a new PDN connection request for that given PDN
+ */
+ int waitTime;
+ /* true to enable the profile, 0 to disable, 1 to enable */
+ int enabled;
+} RIL_DataProfileInfo;
+
/**
* RIL_REQUEST_GET_SIM_STATUS
*
@@ -3494,57 +3748,355 @@ typedef struct {
*/
#define RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE 110
-/* SAMSUNG REQUESTS */
-#define RIL_REQUEST_GET_CELL_BROADCAST_CONFIG 10002
+/**
+ * RIL_REQUEST_SET_INITIAL_ATTACH_APN
+ *
+ * Set an apn to initial attach network
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE (radio resetting)
+ * GENERIC_FAILURE
+ * SUBSCRIPTION_NOT_AVAILABLE
+ */
+#define RIL_REQUEST_SET_INITIAL_ATTACH_APN 111
-#define RIL_REQUEST_SEND_ENCODED_USSD 10005
-#define RIL_REQUEST_SET_PDA_MEMORY_STATUS 10006
-#define RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO 10007
-#define RIL_REQUEST_GET_PHONEBOOK_ENTRY 10008
-#define RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY 10009
-#define RIL_REQUEST_DIAL_VIDEO_CALL 10010
-#define RIL_REQUEST_CALL_DEFLECTION 10011
-#define RIL_REQUEST_READ_SMS_FROM_SIM 10012
-#define RIL_REQUEST_USIM_PB_CAPA 10013
-#define RIL_REQUEST_LOCK_INFO 10014
+/**
+ * RIL_REQUEST_IMS_REGISTRATION_STATE
+ *
+ * Request current IMS registration state
+ *
+ * "data" is NULL
+ *
+ * "response" is int *
+ * ((int *)response)[0] is registration state:
+ * 0 - Not registered
+ * 1 - Registered
+ *
+ * If ((int*)response)[0] is = 1, then ((int *) response)[1]
+ * must follow with IMS SMS format:
+ *
+ * ((int *) response)[1] is of type RIL_RadioTechnologyFamily
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ */
+#define RIL_REQUEST_IMS_REGISTRATION_STATE 112
-#define RIL_REQUEST_DIAL_EMERGENCY 10016
-#define RIL_REQUEST_GET_STOREAD_MSG_COUNT 10017
-#define RIL_REQUEST_STK_SIM_INIT_EVENT 10018
-#define RIL_REQUEST_GET_LINE_ID 10019
-#define RIL_REQUEST_SET_LINE_ID 10020
-#define RIL_REQUEST_GET_SERIAL_NUMBER 10021
-#define RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER 10022
-#define RIL_REQUEST_GET_BARCODE_NUMBER 10023
-#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP 10024
-#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF 10025
-#define RIL_REQUEST_SIM_TRANSMIT_BASIC 10026
-#define RIL_REQUEST_SIM_OPEN_CHANNEL 10027
-#define RIL_REQUEST_SIM_CLOSE_CHANNEL 10028
-#define RIL_REQUEST_SIM_TRANSMIT_CHANNEL 10029
-#define RIL_REQUEST_SIM_AUTH 10030
-#define RIL_REQUEST_PS_ATTACH 10031
-#define RIL_REQUEST_PS_DETACH 10032
-#define RIL_REQUEST_ACTIVATE_DATA_CALL 10033
-#define RIL_REQUEST_CHANGE_SIM_PERSO 10034
-#define RIL_REQUEST_ENTER_SIM_PERSO 10035
-#define RIL_REQUEST_GET_TIME_INFO 10036
-#define RIL_REQUEST_OMADM_SETUP_SESSION 10037
-#define RIL_REQUEST_OMADM_SERVER_START_SESSION 10038
-#define RIL_REQUEST_OMADM_CLIENT_START_SESSION 10039
-#define RIL_REQUEST_OMADM_SEND_DATA 10040
-#define RIL_REQUEST_CDMA_GET_DATAPROFILE 10041
-#define RIL_REQUEST_CDMA_SET_DATAPROFILE 10042
-#define RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES 10043
-#define RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES 10044
-#define RIL_REQUEST_SEND_SMS_COUNT 10045
-#define RIL_REQUEST_SEND_SMS_MSG 10046
-#define RIL_REQUEST_SEND_SMS_MSG_READ_STATUS 10047
-#define RIL_REQUEST_MODEM_HANGUP 10048
-#define RIL_REQUEST_SET_SIM_POWER 10049
-#define RIL_REQUEST_SET_PREFERRED_NETWORK_LIST 10050
-#define RIL_REQUEST_GET_PREFERRED_NETWORK_LIST 10051
-#define RIL_REQUEST_HANGUP_VT 10052
+/**
+ * RIL_REQUEST_IMS_SEND_SMS
+ *
+ * Send a SMS message over IMS
+ *
+ * "data" is const RIL_IMS_SMS_Message *
+ *
+ * "response" is a const RIL_SMS_Response *
+ *
+ * Based on the return error, caller decides to resend if sending sms
+ * fails. SMS_SEND_FAIL_RETRY means retry, and other errors means no retry.
+ * In case of retry, data is encoded based on Voice Technology available.
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * SMS_SEND_FAIL_RETRY
+ * FDN_CHECK_FAILURE
+ * GENERIC_FAILURE
+ *
+ */
+#define RIL_REQUEST_IMS_SEND_SMS 113
+
+/**
+ * RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC
+ *
+ * Request APDU exchange on the basic channel. This command reflects TS 27.007
+ * "generic SIM access" operation (+CSIM). The modem must ensure proper function
+ * of GSM/CDMA, and filter commands appropriately. It should filter
+ * channel management and SELECT by DF name commands.
+ *
+ * "data" is a const RIL_SIM_APDU *
+ * "sessionid" field should be ignored.
+ *
+ * "response" is a const RIL_SIM_IO_Response *
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ */
+#define RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC 114
+
+/**
+ * RIL_REQUEST_SIM_OPEN_CHANNEL
+ *
+ * Open a new logical channel and select the given application. This command
+ * reflects TS 27.007 "open logical channel" operation (+CCHO).
+ *
+ * "data" is const char * and set to AID value, See ETSI 102.221 and 101.220.
+ *
+ * "response" is int *
+ * ((int *)data)[0] contains the session id of the logical channel.
+ * ((int *)data)[1] onwards may optionally contain the select response for the
+ * open channel command with one byte per integer.
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ * MISSING_RESOURCE
+ * NO_SUCH_ELEMENT
+ */
+#define RIL_REQUEST_SIM_OPEN_CHANNEL 115
+
+/**
+ * RIL_REQUEST_SIM_CLOSE_CHANNEL
+ *
+ * Close a previously opened logical channel. This command reflects TS 27.007
+ * "close logical channel" operation (+CCHC).
+ *
+ * "data" is int *
+ * ((int *)data)[0] is the session id of logical the channel to close.
+ *
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ */
+#define RIL_REQUEST_SIM_CLOSE_CHANNEL 116
+
+/**
+ * RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL
+ *
+ * Exchange APDUs with a UICC over a previously opened logical channel. This
+ * command reflects TS 27.007 "generic logical channel access" operation
+ * (+CGLA). The modem should filter channel management and SELECT by DF name
+ * commands.
+ *
+ * "data" is a const RIL_SIM_APDU*
+ *
+ * "response" is a const RIL_SIM_IO_Response *
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ */
+#define RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL 117
+
+/**
+ * RIL_REQUEST_NV_READ_ITEM
+ *
+ * Read one of the radio NV items defined in RadioNVItems.java / ril_nv_items.h.
+ * This is used for device configuration by some CDMA operators.
+ *
+ * "data" is a const RIL_NV_ReadItem *
+ *
+ * "response" is const char * containing the contents of the NV item
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ */
+#define RIL_REQUEST_NV_READ_ITEM 118
+
+/**
+ * RIL_REQUEST_NV_WRITE_ITEM
+ *
+ * Write one of the radio NV items defined in RadioNVItems.java / ril_nv_items.h.
+ * This is used for device configuration by some CDMA operators.
+ *
+ * "data" is a const RIL_NV_WriteItem *
+ *
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ */
+#define RIL_REQUEST_NV_WRITE_ITEM 119
+
+/**
+ * RIL_REQUEST_NV_WRITE_CDMA_PRL
+ *
+ * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
+ * This is used for device configuration by some CDMA operators.
+ *
+ * "data" is a const char * containing the PRL as a byte array
+ *
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ */
+#define RIL_REQUEST_NV_WRITE_CDMA_PRL 120
+
+/**
+ * RIL_REQUEST_NV_RESET_CONFIG
+ *
+ * Reset the radio NV configuration to the factory state.
+ * This is used for device configuration by some CDMA operators.
+ *
+ * "data" is int *
+ * ((int *)data)[0] is 1 to reload all NV items
+ * ((int *)data)[0] is 2 for erase NV reset (SCRTN)
+ * ((int *)data)[0] is 3 for factory reset (RTN)
+ *
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ */
+#define RIL_REQUEST_NV_RESET_CONFIG 121
+
+ /** RIL_REQUEST_SET_UICC_SUBSCRIPTION
+ * FIXME This API needs to have more documentation.
+ *
+ * Selection/de-selection of a subscription from a SIM card
+ * "data" is const RIL_SelectUiccSub*
+
+ *
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE (radio resetting)
+ * GENERIC_FAILURE
+ * SUBSCRIPTION_NOT_SUPPORTED
+ *
+ */
+#define RIL_REQUEST_SET_UICC_SUBSCRIPTION 122
+
+/**
+ * RIL_REQUEST_ALLOW_DATA
+ *
+ * Tells the modem whether data calls are allowed or not
+ *
+ * "data" is int *
+ * FIXME slotId and aid will be added.
+ * ((int *)data)[0] is == 0 to allow data calls
+ * ((int *)data)[0] is == 1 to disallow data calls
+ *
+ * "response" is NULL
+ *
+ * Valid errors:
+ *
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE (radio resetting)
+ * GENERIC_FAILURE
+ *
+ */
+#define RIL_REQUEST_ALLOW_DATA 123
+
+/**
+ * RIL_REQUEST_GET_HARDWARE_CONFIG
+ *
+ * Request all of the current hardware (modem and sim) associated
+ * with the RIL.
+ *
+ * "data" is NULL
+ *
+ * "response" is an array of RIL_HardwareConfig.
+ */
+#define RIL_REQUEST_GET_HARDWARE_CONFIG 124
+
+/**
+ * RIL_REQUEST_SIM_AUTHENTICATION
+ *
+ * Returns the response of SIM Authentication through RIL to a
+ * challenge request.
+ *
+ * "data" Base64 encoded string containing challenge:
+ * int authContext; P2 value of authentication command, see P2 parameter in
+ * 3GPP TS 31.102 7.1.2
+ * char *authData; the challenge string in Base64 format, see 3GPP
+ * TS 31.102 7.1.2
+ * char *aid; AID value, See ETSI 102.221 8.1 and 101.220 4,
+ * NULL if no value
+ *
+ * "response" Base64 encoded strings containing response:
+ * int sw1; Status bytes per 3GPP TS 31.102 section 7.3
+ * int sw2;
+ * char *simResponse; Response in Base64 format, see 3GPP TS 31.102 7.1.2
+ */
+#define RIL_REQUEST_SIM_AUTHENTICATION 125
+
+/**
+ * RIL_REQUEST_GET_DC_RT_INFO
+ *
+ * Requests the Data Connection Real Time Info
+ *
+ * "data" is NULL
+ *
+ * "response" is the most recent RIL_DcRtInfo
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ *
+ * See also: RIL_UNSOL_DC_RT_INFO_CHANGED
+ */
+#define RIL_REQUEST_GET_DC_RT_INFO 126
+
+/**
+ * RIL_REQUEST_SET_DC_RT_INFO_RATE
+ *
+ * This is the minimum number of milliseconds between successive
+ * RIL_UNSOL_DC_RT_INFO_CHANGED messages and defines the highest rate
+ * at which RIL_UNSOL_DC_RT_INFO_CHANGED's will be sent. A value of
+ * 0 means send as fast as possible.
+ *
+ * "data" The number of milliseconds as an int
+ *
+ * "response" is null
+ *
+ * Valid errors:
+ * SUCCESS must not fail
+ */
+#define RIL_REQUEST_SET_DC_RT_INFO_RATE 127
+
+/**
+ * RIL_REQUEST_SET_DATA_PROFILE
+ *
+ * Set data profile in modem
+ * "data" is an const RIL_DataProfileInfo **
+ * "datalen" is count * sizeof(const RIL_DataProfileInfo *)
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE (radio resetting)
+ * GENERIC_FAILURE
+ * SUBSCRIPTION_NOT_AVAILABLE
+ */
+#define RIL_REQUEST_SET_DATA_PROFILE 128
+
+/**
+ * RIL_REQUEST_SHUTDOWN
+ *
+ * Device is shutting down. All further commands are ignored
+ * and RADIO_NOT_AVAILABLE must be returned.
+ *
+ * "data" is null
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * GENERIC_FAILURE
+ */
+#define RIL_REQUEST_SHUTDOWN 129
/***********************************************************************/
@@ -4037,6 +4589,128 @@ typedef struct {
*/
#define RIL_UNSOL_CELL_INFO_LIST 1036
+/**
+ * RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED
+ *
+ * Called when IMS registration state has changed
+ *
+ * To get IMS registration state and IMS SMS format, callee needs to invoke the
+ * following request on main thread:
+ *
+ * RIL_REQUEST_IMS_REGISTRATION_STATE
+ *
+ * "data" is NULL
+ *
+ */
+#define RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED 1037
+
+/**
+ * RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED
+ *
+ * Indicated when there is a change in subscription status.
+ * This event will be sent in the following scenarios
+ * - subscription readiness at modem, which was selected by telephony layer
+ * - when subscription is deactivated by modem due to UICC card removal
+ * - When network invalidates the subscription i.e. attach reject due to authentication reject
+ *
+ * "data" is const int *
+ * ((const int *)data)[0] == 0 for Subscription Deactivated
+ * ((const int *)data)[0] == 1 for Subscription Activated
+ *
+ */
+#define RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED 1038
+
+/**
+ * RIL_UNSOL_SRVCC_STATE_NOTIFY
+ *
+ * Called when Single Radio Voice Call Continuity(SRVCC)
+ * progress state has changed
+ *
+ * "data" is int *
+ * ((int *)data)[0] is of type const RIL_SrvccState
+ *
+ */
+
+#define RIL_UNSOL_SRVCC_STATE_NOTIFY 1039
+
+/**
+ * RIL_UNSOL_HARDWARE_CONFIG_CHANGED
+ *
+ * Called when the hardware configuration associated with the RILd changes
+ *
+ * "data" is an array of RIL_HardwareConfig
+ *
+ */
+#define RIL_UNSOL_HARDWARE_CONFIG_CHANGED 1040
+
+/**
+ * RIL_UNSOL_DC_RT_INFO_CHANGED
+ *
+ * Sent when the DC_RT_STATE changes but the time
+ * between these messages must not be less than the
+ * value set by RIL_REQUEST_SET_DC_RT_RATE.
+ *
+ * "data" is the most recent RIL_DcRtInfo
+ *
+ */
+#define RIL_UNSOL_DC_RT_INFO_CHANGED 1041
+
+/***********************************************************************/
+
+/* SAMSUNG REQUESTS */
+#define RIL_REQUEST_GET_CELL_BROADCAST_CONFIG 10002
+
+#define RIL_REQUEST_SEND_ENCODED_USSD 10005
+#define RIL_REQUEST_SET_PDA_MEMORY_STATUS 10006
+#define RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO 10007
+#define RIL_REQUEST_GET_PHONEBOOK_ENTRY 10008
+#define RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY 10009
+#define RIL_REQUEST_DIAL_VIDEO_CALL 10010
+#define RIL_REQUEST_CALL_DEFLECTION 10011
+#define RIL_REQUEST_READ_SMS_FROM_SIM 10012
+#define RIL_REQUEST_USIM_PB_CAPA 10013
+#define RIL_REQUEST_LOCK_INFO 10014
+
+#define RIL_REQUEST_DIAL_EMERGENCY 10016
+#define RIL_REQUEST_GET_STOREAD_MSG_COUNT 10017
+#define RIL_REQUEST_STK_SIM_INIT_EVENT 10018
+#define RIL_REQUEST_GET_LINE_ID 10019
+#define RIL_REQUEST_SET_LINE_ID 10020
+#define RIL_REQUEST_GET_SERIAL_NUMBER 10021
+#define RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER 10022
+#define RIL_REQUEST_GET_BARCODE_NUMBER 10023
+#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP 10024
+#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF 10025
+#define RIL_REQUEST_SIM_TRANSMIT_BASIC 10026
+#define RIL_REQUEST_SIM_OPEN_CHANNEL 10027
+#define RIL_REQUEST_SIM_CLOSE_CHANNEL 10028
+#define RIL_REQUEST_SIM_TRANSMIT_CHANNEL 10029
+#define RIL_REQUEST_SIM_AUTH 10030
+#define RIL_REQUEST_PS_ATTACH 10031
+#define RIL_REQUEST_PS_DETACH 10032
+#define RIL_REQUEST_ACTIVATE_DATA_CALL 10033
+#define RIL_REQUEST_CHANGE_SIM_PERSO 10034
+#define RIL_REQUEST_ENTER_SIM_PERSO 10035
+#define RIL_REQUEST_GET_TIME_INFO 10036
+#define RIL_REQUEST_OMADM_SETUP_SESSION 10037
+#define RIL_REQUEST_OMADM_SERVER_START_SESSION 10038
+#define RIL_REQUEST_OMADM_CLIENT_START_SESSION 10039
+#define RIL_REQUEST_OMADM_SEND_DATA 10040
+#define RIL_REQUEST_CDMA_GET_DATAPROFILE 10041
+#define RIL_REQUEST_CDMA_SET_DATAPROFILE 10042
+#define RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES 10043
+#define RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES 10044
+#define RIL_REQUEST_SEND_SMS_COUNT 10045
+#define RIL_REQUEST_SEND_SMS_MSG 10046
+#define RIL_REQUEST_SEND_SMS_MSG_READ_STATUS 10047
+#define RIL_REQUEST_MODEM_HANGUP 10048
+#define RIL_REQUEST_SET_SIM_POWER 10049
+#define RIL_REQUEST_SET_PREFERRED_NETWORK_LIST 10050
+#define RIL_REQUEST_GET_PREFERRED_NETWORK_LIST 10051
+#define RIL_REQUEST_HANGUP_VT 10052
+
+/***********************************************************************/
+
/* SAMSUNG RESPONSE */
#define SAMSUNG_UNSOL_RESPONSE_BASE 11000
@@ -4074,6 +4748,27 @@ typedef struct {
/***********************************************************************/
+#if defined(ANDROID_MULTI_SIM)
+/**
+ * RIL_Request Function pointer
+ *
+ * @param request is one of RIL_REQUEST_*
+ * @param data is pointer to data defined for that RIL_REQUEST_*
+ * data is owned by caller, and should not be modified or freed by callee
+ * @param t should be used in subsequent call to RIL_onResponse
+ * @param datalen the length of data
+ *
+ */
+typedef void (*RIL_RequestFunc) (int request, void *data,
+ size_t datalen, RIL_Token t, RIL_SOCKET_ID socket_id);
+
+/**
+ * This function should return the current radio state synchronously
+ */
+typedef RIL_RadioState (*RIL_RadioStateRequest)(RIL_SOCKET_ID socket_id);
+
+#else
+/* Backward compatible */
/**
* RIL_Request Function pointer
@@ -4093,6 +4788,9 @@ typedef void (*RIL_RequestFunc) (int request, void *data,
*/
typedef RIL_RadioState (*RIL_RadioStateRequest)();
+#endif
+
+
/**
* This function returns "1" if the specified RIL_REQUEST code is
* supported and 0 if it is not
@@ -4140,6 +4838,23 @@ typedef struct {
RIL_GetVersion getVersion;
} RIL_RadioFunctions;
+typedef struct {
+ char *apn;
+ char *protocol;
+ int authtype;
+ char *username;
+ char *password;
+} RIL_InitialAttachApn;
+
+typedef struct {
+ int authContext; /* P2 value of authentication command, see P2 parameter in
+ 3GPP TS 31.102 7.1.2 */
+ char *authData; /* the challenge string in Base64 format, see 3GPP
+ TS 31.102 7.1.2 */
+ char *aid; /* AID value, See ETSI 102.221 8.1 and 101.220 4,
+ NULL if no value. */
+} RIL_SimAuthentication;
+
#ifdef RIL_SHLIB
struct RIL_Env {
/**
@@ -4156,16 +4871,23 @@ struct RIL_Env {
void (*OnRequestComplete)(RIL_Token t, RIL_Errno e,
void *response, size_t responselen);
+#if defined(ANDROID_MULTI_SIM)
/**
* "unsolResponse" is one of RIL_UNSOL_RESPONSE_*
* "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_*
*
* "data" is owned by caller, and should not be modified or freed by callee
*/
-
- void (*OnUnsolicitedResponse)(int unsolResponse, const void *data,
- size_t datalen);
-
+ void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t datalen, RIL_SOCKET_ID socket_id);
+#else
+ /**
+ * "unsolResponse" is one of RIL_UNSOL_RESPONSE_*
+ * "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_*
+ *
+ * "data" is owned by caller, and should not be modified or freed by callee
+ */
+ void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t datalen);
+#endif
/**
* Call user-specifed "callback" function on on the same thread that
* RIL_RequestFunc is called. If "relativeTime" is specified, then it specifies
@@ -4216,6 +4938,7 @@ void RIL_register (const RIL_RadioFunctions *callbacks);
void RIL_onRequestComplete(RIL_Token t, RIL_Errno e,
void *response, size_t responselen);
+#if defined(ANDROID_MULTI_SIM)
/**
* @param unsolResponse is one of RIL_UNSOL_RESPONSE_*
* @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_*
@@ -4224,8 +4947,18 @@ void RIL_onRequestComplete(RIL_Token t, RIL_Errno e,
*/
void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
- size_t datalen);
+ size_t datalen, RIL_SOCKET_ID socket_id);
+#else
+/**
+ * @param unsolResponse is one of RIL_UNSOL_RESPONSE_*
+ * @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_*
+ * "data" is owned by caller, and should not be modified or freed by callee
+ * @param datalen the length of data in byte
+ */
+void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
+ size_t datalen);
+#endif
/**
* Call user-specifed "callback" function on on the same thread that
@@ -4250,3 +4983,4 @@ void RIL_requestTimedCallback (RIL_TimedCallback callback,
#endif
#endif /*ANDROID_RIL_H*/
+
diff --git a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java
new file mode 100644
index 0000000..0189a7e
--- /dev/null
+++ b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java
@@ -0,0 +1,437 @@
+/*
+ * Copyright (C) 2011 The CyanogenMod Project <http://www.cyanogenmod.org>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony;
+
+import static com.android.internal.telephony.RILConstants.*;
+
+import android.content.Context;
+import android.os.AsyncResult;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Looper;
+import android.os.Message;
+import android.os.Parcel;
+import android.os.Registrant;
+import android.text.TextUtils;
+import android.telephony.Rlog;
+
+import android.telephony.PhoneNumberUtils;
+
+import java.util.ArrayList;
+
+public class SamsungExynos4RIL extends RIL implements CommandsInterface {
+
+ //SAMSUNG STATES
+ static final int RIL_REQUEST_GET_CELL_BROADCAST_CONFIG = 10002;
+
+ static final int RIL_REQUEST_SEND_ENCODED_USSD = 10005;
+ static final int RIL_REQUEST_SET_PDA_MEMORY_STATUS = 10006;
+ static final int RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO = 10007;
+ static final int RIL_REQUEST_GET_PHONEBOOK_ENTRY = 10008;
+ static final int RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY = 10009;
+ static final int RIL_REQUEST_DIAL_VIDEO_CALL = 10010;
+ static final int RIL_REQUEST_CALL_DEFLECTION = 10011;
+ static final int RIL_REQUEST_READ_SMS_FROM_SIM = 10012;
+ static final int RIL_REQUEST_USIM_PB_CAPA = 10013;
+ static final int RIL_REQUEST_LOCK_INFO = 10014;
+
+ static final int RIL_REQUEST_DIAL_EMERGENCY = 10016;
+ static final int RIL_REQUEST_GET_STOREAD_MSG_COUNT = 10017;
+ static final int RIL_REQUEST_STK_SIM_INIT_EVENT = 10018;
+ static final int RIL_REQUEST_GET_LINE_ID = 10019;
+ static final int RIL_REQUEST_SET_LINE_ID = 10020;
+ static final int RIL_REQUEST_GET_SERIAL_NUMBER = 10021;
+ static final int RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER = 10022;
+ static final int RIL_REQUEST_GET_BARCODE_NUMBER = 10023;
+ static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP = 10024;
+ static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF = 10025;
+ static final int RIL_REQUEST_SIM_TRANSMIT_BASIC = 10026;
+ static final int RIL_REQUEST_SIM_OPEN_CHANNEL = 10027;
+ static final int RIL_REQUEST_SIM_CLOSE_CHANNEL = 10028;
+ static final int RIL_REQUEST_SIM_TRANSMIT_CHANNEL = 10029;
+ static final int RIL_REQUEST_SIM_AUTH = 10030;
+ static final int RIL_REQUEST_PS_ATTACH = 10031;
+ static final int RIL_REQUEST_PS_DETACH = 10032;
+ static final int RIL_REQUEST_ACTIVATE_DATA_CALL = 10033;
+ static final int RIL_REQUEST_CHANGE_SIM_PERSO = 10034;
+ static final int RIL_REQUEST_ENTER_SIM_PERSO = 10035;
+ static final int RIL_REQUEST_GET_TIME_INFO = 10036;
+ static final int RIL_REQUEST_OMADM_SETUP_SESSION = 10037;
+ static final int RIL_REQUEST_OMADM_SERVER_START_SESSION = 10038;
+ static final int RIL_REQUEST_OMADM_CLIENT_START_SESSION = 10039;
+ static final int RIL_REQUEST_OMADM_SEND_DATA = 10040;
+ static final int RIL_REQUEST_CDMA_GET_DATAPROFILE = 10041;
+ static final int RIL_REQUEST_CDMA_SET_DATAPROFILE = 10042;
+ static final int RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES = 10043;
+ static final int RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES = 10044;
+ static final int RIL_REQUEST_SEND_SMS_COUNT = 10045;
+ static final int RIL_REQUEST_SEND_SMS_MSG = 10046;
+ static final int RIL_REQUEST_SEND_SMS_MSG_READ_STATUS = 10047;
+ static final int RIL_REQUEST_MODEM_HANGUP = 10048;
+ static final int RIL_REQUEST_SET_SIM_POWER = 10049;
+ static final int RIL_REQUEST_SET_PREFERRED_NETWORK_LIST = 10050;
+ static final int RIL_REQUEST_GET_PREFERRED_NETWORK_LIST = 10051;
+ static final int RIL_REQUEST_HANGUP_VT = 10052;
+
+ static final int RIL_UNSOL_RELEASE_COMPLETE_MESSAGE = 11001;
+ static final int RIL_UNSOL_STK_SEND_SMS_RESULT = 11002;
+ static final int RIL_UNSOL_STK_CALL_CONTROL_RESULT = 11003;
+ static final int RIL_UNSOL_DUN_CALL_STATUS = 11004;
+
+ static final int RIL_UNSOL_O2_HOME_ZONE_INFO = 11007;
+ static final int RIL_UNSOL_DEVICE_READY_NOTI = 11008;
+ static final int RIL_UNSOL_GPS_NOTI = 11009;
+ static final int RIL_UNSOL_AM = 11010;
+ static final int RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL = 11011;
+ static final int RIL_UNSOL_DATA_SUSPEND_RESUME = 11012;
+ static final int RIL_UNSOL_SAP = 11013;
+
+ static final int RIL_UNSOL_SIM_SMS_STORAGE_AVAILALE = 11015;
+ static final int RIL_UNSOL_HSDPA_STATE_CHANGED = 11016;
+ static final int RIL_UNSOL_WB_AMR_STATE = 11017;
+ static final int RIL_UNSOL_TWO_MIC_STATE = 11018;
+ static final int RIL_UNSOL_DHA_STATE = 11019;
+ static final int RIL_UNSOL_UART = 11020;
+ static final int RIL_UNSOL_RESPONSE_HANDOVER = 11021;
+ static final int RIL_UNSOL_IPV6_ADDR = 11022;
+ static final int RIL_UNSOL_NWK_INIT_DISC_REQUEST = 11023;
+ static final int RIL_UNSOL_RTS_INDICATION = 11024;
+ static final int RIL_UNSOL_OMADM_SEND_DATA = 11025;
+ static final int RIL_UNSOL_DUN = 11026;
+ static final int RIL_UNSOL_SYSTEM_REBOOT = 11027;
+ static final int RIL_UNSOL_VOICE_PRIVACY_CHANGED = 11028;
+ static final int RIL_UNSOL_UTS_GETSMSCOUNT = 11029;
+ static final int RIL_UNSOL_UTS_GETSMSMSG = 11030;
+ static final int RIL_UNSOL_UTS_GET_UNREAD_SMS_STATUS = 11031;
+ static final int RIL_UNSOL_MIP_CONNECT_STATUS = 11032;
+
+ private Object mCatProCmdBuffer;
+
+ public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription) {
+ super(context, networkMode, cdmaSubscription);
+ }
+
+ public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceID) {
+ super(context, networkMode, cdmaSubscription, instanceID);
+ }
+
+ static String
+ requestToString(int request) {
+ switch (request) {
+ case RIL_REQUEST_DIAL_EMERGENCY: return "DIAL_EMERGENCY";
+ default: return RIL.requestToString(request);
+ }
+ }
+
+ @Override
+ protected RILRequest processSolicited (Parcel p) {
+ int serial, error;
+ boolean found = false;
+
+ serial = p.readInt();
+ error = p.readInt();
+
+ RILRequest rr;
+
+ rr = findAndRemoveRequestFromList(serial);
+
+ if (rr == null) {
+ Rlog.w(RILJ_LOG_TAG, "Unexpected solicited response! sn: "
+ + serial + " error: " + error);
+ return null;
+ }
+
+ Object ret = null;
+
+ if (error == 0 || p.dataAvail() > 0) {
+ // either command succeeds or command fails but with data payload
+ try {switch (rr.mRequest) {
+ /*
+ cat libs/telephony/ril_commands.h \
+ | egrep "^ *{RIL_" \
+ | sed -re 's/\{([^,]+),[^,]+,([^}]+).+/case \1: ret = \2(p); break;/'
+ */
+ case RIL_REQUEST_GET_SIM_STATUS: ret = responseIccCardStatus(p); break;
+ case RIL_REQUEST_ENTER_SIM_PIN: ret = responseInts(p); break;
+ case RIL_REQUEST_ENTER_SIM_PUK: ret = responseInts(p); break;
+ case RIL_REQUEST_ENTER_SIM_PIN2: ret = responseInts(p); break;
+ case RIL_REQUEST_ENTER_SIM_PUK2: ret = responseInts(p); break;
+ case RIL_REQUEST_CHANGE_SIM_PIN: ret = responseInts(p); break;
+ case RIL_REQUEST_CHANGE_SIM_PIN2: ret = responseInts(p); break;
+ case RIL_REQUEST_ENTER_DEPERSONALIZATION_CODE: ret = responseInts(p); break;
+ case RIL_REQUEST_GET_CURRENT_CALLS: ret = responseCallList(p); break;
+ case RIL_REQUEST_DIAL: ret = responseVoid(p); break;
+ case RIL_REQUEST_DIAL_EMERGENCY: ret = responseVoid(p); break;
+ case RIL_REQUEST_GET_IMSI: ret = responseString(p); break;
+ case RIL_REQUEST_HANGUP: ret = responseVoid(p); break;
+ case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: ret = responseVoid(p); break;
+ case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: {
+ if (mTestingEmergencyCall.getAndSet(false)) {
+ if (mEmergencyCallbackModeRegistrant != null) {
+ riljLog("testing emergency call, notify ECM Registrants");
+ mEmergencyCallbackModeRegistrant.notifyRegistrant();
+ }
+ }
+ ret = responseVoid(p);
+ break;
+ }
+ case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: ret = responseVoid(p); break;
+ case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break;
+ case RIL_REQUEST_UDUB: ret = responseVoid(p); break;
+ case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break;
+ case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break;
+ case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseStrings(p); break;
+ case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseStrings(p); break;
+ case RIL_REQUEST_OPERATOR: ret = responseStrings(p); break;
+ case RIL_REQUEST_RADIO_POWER: ret = responseVoid(p); break;
+ case RIL_REQUEST_DTMF: ret = responseVoid(p); break;
+ case RIL_REQUEST_SEND_SMS: ret = responseSMS(p); break;
+ case RIL_REQUEST_SEND_SMS_EXPECT_MORE: ret = responseSMS(p); break;
+ case RIL_REQUEST_SETUP_DATA_CALL: ret = responseSetupDataCall(p); break;
+ case RIL_REQUEST_SIM_IO: ret = responseICC_IO(p); break;
+ case RIL_REQUEST_SEND_USSD: ret = responseVoid(p); break;
+ case RIL_REQUEST_CANCEL_USSD: ret = responseVoid(p); break;
+ case RIL_REQUEST_GET_CLIR: ret = responseInts(p); break;
+ case RIL_REQUEST_SET_CLIR: ret = responseVoid(p); break;
+ case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: ret = responseCallForward(p); break;
+ case RIL_REQUEST_SET_CALL_FORWARD: ret = responseVoid(p); break;
+ case RIL_REQUEST_QUERY_CALL_WAITING: ret = responseInts(p); break;
+ case RIL_REQUEST_SET_CALL_WAITING: ret = responseVoid(p); break;
+ case RIL_REQUEST_SMS_ACKNOWLEDGE: ret = responseVoid(p); break;
+ case RIL_REQUEST_GET_IMEI: ret = responseString(p); break;
+ case RIL_REQUEST_GET_IMEISV: ret = responseString(p); break;
+ case RIL_REQUEST_ANSWER: ret = responseVoid(p); break;
+ case RIL_REQUEST_DEACTIVATE_DATA_CALL: ret = responseVoid(p); break;
+ case RIL_REQUEST_QUERY_FACILITY_LOCK: ret = responseInts(p); break;
+ case RIL_REQUEST_SET_FACILITY_LOCK: ret = responseInts(p); break;
+ case RIL_REQUEST_CHANGE_BARRING_PASSWORD: ret = responseVoid(p); break;
+ case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: ret = responseInts(p); break;
+ case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: ret = responseVoid(p); break;
+ case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: ret = responseVoid(p); break;
+ case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS : ret = responseOperatorInfos(p); break;
+ case RIL_REQUEST_DTMF_START: ret = responseVoid(p); break;
+ case RIL_REQUEST_DTMF_STOP: ret = responseVoid(p); break;
+ case RIL_REQUEST_BASEBAND_VERSION: ret = responseString(p); break;
+ case RIL_REQUEST_SEPARATE_CONNECTION: ret = responseVoid(p); break;
+ case RIL_REQUEST_SET_MUTE: ret = responseVoid(p); break;
+ case RIL_REQUEST_GET_MUTE: ret = responseInts(p); break;
+ case RIL_REQUEST_QUERY_CLIP: ret = responseInts(p); break;
+ case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: ret = responseInts(p); break;
+ case RIL_REQUEST_DATA_CALL_LIST: ret = responseDataCallList(p); break;
+ case RIL_REQUEST_RESET_RADIO: ret = responseVoid(p); break;
+ case RIL_REQUEST_OEM_HOOK_RAW: ret = responseRaw(p); break;
+ case RIL_REQUEST_OEM_HOOK_STRINGS: ret = responseStrings(p); break;
+ case RIL_REQUEST_SCREEN_STATE: ret = responseVoid(p); break;
+ case RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION: ret = responseVoid(p); break;
+ case RIL_REQUEST_WRITE_SMS_TO_SIM: ret = responseInts(p); break;
+ case RIL_REQUEST_DELETE_SMS_ON_SIM: ret = responseVoid(p); break;
+ case RIL_REQUEST_SET_BAND_MODE: ret = responseVoid(p); break;
+ case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE: ret = responseInts(p); break;
+ case RIL_REQUEST_STK_GET_PROFILE: ret = responseString(p); break;
+ case RIL_REQUEST_STK_SET_PROFILE: ret = responseVoid(p); break;
+ case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND: ret = responseString(p); break;
+ case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE: ret = responseVoid(p); break;
+ case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: ret = responseInts(p); break;
+ case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: ret = responseVoid(p); break;
+ case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: ret = responseVoid(p); break;
+ case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: ret = responseGetPreferredNetworkType(p); break;
+ case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: ret = responseCellList(p); break;
+ case RIL_REQUEST_SET_LOCATION_UPDATES: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: ret = responseInts(p); break;
+ case RIL_REQUEST_SET_TTY_MODE: ret = responseVoid(p); break;
+ case RIL_REQUEST_QUERY_TTY_MODE: ret = responseInts(p); break;
+ case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE: ret = responseInts(p); break;
+ case RIL_REQUEST_CDMA_FLASH: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_BURST_DTMF: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_SEND_SMS: ret = responseSMS(p); break;
+ case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE: ret = responseVoid(p); break;
+ case RIL_REQUEST_GSM_GET_BROADCAST_CONFIG: ret = responseGmsBroadcastConfig(p); break;
+ case RIL_REQUEST_GSM_SET_BROADCAST_CONFIG: ret = responseVoid(p); break;
+ case RIL_REQUEST_GSM_BROADCAST_ACTIVATION: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG: ret = responseCdmaBroadcastConfig(p); break;
+ case RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_BROADCAST_ACTIVATION: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_SUBSCRIPTION: ret = responseStrings(p); break;
+ case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM: ret = responseInts(p); break;
+ case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM: ret = responseVoid(p); break;
+ case RIL_REQUEST_DEVICE_IDENTITY: ret = responseStrings(p); break;
+ case RIL_REQUEST_GET_SMSC_ADDRESS: ret = responseString(p); break;
+ case RIL_REQUEST_SET_SMSC_ADDRESS: ret = responseVoid(p); break;
+ case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break;
+ case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break;
+ case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: ret = responseVoid(p); break;
+ case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE: ret = responseInts(p); break;
+ case RIL_REQUEST_ISIM_AUTHENTICATION: ret = responseString(p); break;
+ case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU: ret = responseVoid(p); break;
+ case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS: ret = responseICC_IO(p); break;
+ case RIL_REQUEST_VOICE_RADIO_TECH: ret = responseInts(p); break;
+ default:
+ throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest);
+ //break;
+ }} catch (Throwable tr) {
+ // Exceptions here usually mean invalid RIL responses
+
+ Rlog.w(RILJ_LOG_TAG, rr.serialString() + "< "
+ + requestToString(rr.mRequest)
+ + " exception, possible invalid RIL response", tr);
+
+ if (rr.mResult != null) {
+ AsyncResult.forMessage(rr.mResult, null, tr);
+ rr.mResult.sendToTarget();
+ }
+ return rr;
+ }
+ }
+
+ // Here and below fake RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, see b/7255789.
+ // This is needed otherwise we don't automatically transition to the main lock
+ // screen when the pin or puk is entered incorrectly.
+ switch (rr.mRequest) {
+ case RIL_REQUEST_ENTER_SIM_PUK:
+ case RIL_REQUEST_ENTER_SIM_PUK2:
+ if (mIccStatusChangedRegistrants != null) {
+ if (RILJ_LOGD) {
+ riljLog("ON enter sim puk fakeSimStatusChanged: reg count="
+ + mIccStatusChangedRegistrants.size());
+ }
+ mIccStatusChangedRegistrants.notifyRegistrants();
+ }
+ break;
+ }
+
+ if (error != 0) {
+ switch (rr.mRequest) {
+ case RIL_REQUEST_ENTER_SIM_PIN:
+ case RIL_REQUEST_ENTER_SIM_PIN2:
+ case RIL_REQUEST_CHANGE_SIM_PIN:
+ case RIL_REQUEST_CHANGE_SIM_PIN2:
+ case RIL_REQUEST_SET_FACILITY_LOCK:
+ if (mIccStatusChangedRegistrants != null) {
+ if (RILJ_LOGD) {
+ riljLog("ON some errors fakeSimStatusChanged: reg count="
+ + mIccStatusChangedRegistrants.size());
+ }
+ mIccStatusChangedRegistrants.notifyRegistrants();
+ }
+ break;
+ }
+
+ rr.onError(error, ret);
+ return rr;
+ }
+
+ if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest)
+ + " " + retToString(rr.mRequest, ret));
+
+ if (rr.mResult != null) {
+ AsyncResult.forMessage(rr.mResult, ret, null);
+ rr.mResult.sendToTarget();
+ }
+
+ return rr;
+ }
+
+ @Override
+ public void
+ dial(String address, int clirMode, UUSInfo uusInfo, Message result) {
+ RILRequest rr;
+ if (PhoneNumberUtils.isEmergencyNumber(address)) {
+ dialEmergencyCall(address, clirMode, result);
+ return;
+ }
+
+ rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);
+ rr.mParcel.writeString(address);
+ rr.mParcel.writeInt(clirMode);
+
+ if (uusInfo == null) {
+ rr.mParcel.writeInt(0); // UUS information is absent
+ } else {
+ rr.mParcel.writeInt(1); // UUS information is present
+ rr.mParcel.writeInt(uusInfo.getType());
+ rr.mParcel.writeInt(uusInfo.getDcs());
+ rr.mParcel.writeByteArray(uusInfo.getUserData());
+ }
+
+ if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+
+ send(rr);
+ }
+
+ public void
+ dialEmergencyCall(String address, int clirMode, Message result) {
+ RILRequest rr;
+ Rlog.v(RILJ_LOG_TAG, "Emergency dial: " + address);
+
+ rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result);
+ rr.mParcel.writeString(address + "/");
+ rr.mParcel.writeInt(clirMode);
+ rr.mParcel.writeInt(0); // UUS information is absent
+
+ if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+
+ send(rr);
+ }
+
+ @Override
+ protected void
+ processUnsolicited (Parcel p) {
+ int dataPosition = p.dataPosition();
+ int response = p.readInt();
+
+ switch(response) {
+ case RIL_UNSOL_STK_PROACTIVE_COMMAND:
+ Object ret = responseString(p);
+ if (RILJ_LOGD) unsljLogRet(response, ret);
+
+ if (mCatProCmdRegistrant != null) {
+ mCatProCmdRegistrant.notifyRegistrant(
+ new AsyncResult (null, ret, null));
+ } else {
+ // The RIL will send a CAT proactive command before the
+ // registrant is registered. Buffer it to make sure it
+ // does not get ignored (and breaks CatService).
+ mCatProCmdBuffer = ret;
+ }
+ break;
+
+ default:
+ // Rewind the Parcel
+ p.setDataPosition(dataPosition);
+
+ // Forward responses that we are not overriding to the super class
+ super.processUnsolicited(p);
+ return;
+ }
+
+ }
+
+ @Override
+ public void setOnCatProactiveCmd(Handler h, int what, Object obj) {
+ mCatProCmdRegistrant = new Registrant (h, what, obj);
+ if (mCatProCmdBuffer != null) {
+ mCatProCmdRegistrant.notifyRegistrant(
+ new AsyncResult (null, mCatProCmdBuffer, null));
+ mCatProCmdBuffer = null;
+ }
+ }
+
+}