📄 ril.h
字号:
/* * Copyright (C) 2006 The Android Open Source Project * * 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. *//* * ISSUES: * - SMS retransmit (specifying TP-Message-ID) * *//** * TODO * * Supp Service Notification (+CSSN) * GPRS PDP context deactivate notification * */#ifndef ANDROID_RIL_H #define ANDROID_RIL_H 1#include <stdlib.h>#include <sys/time.h>#ifdef __cplusplusextern "C" {#endif#define RIL_VERSION 2typedef void * RIL_Token;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, RIL_E_PASSWORD_INCORRECT = 3, /* for PIN/PIN2 methods only! */ RIL_E_SIM_PIN2 = 4, /* Operation requires SIM PIN2 to be entered */ RIL_E_SIM_PUK2 = 5, /* Operation requires SIM PIN2 to be entered */ RIL_E_REQUEST_NOT_SUPPORTED = 6, RIL_E_CANCELLED = 7, RIL_E_OP_NOT_ALLOWED_DURING_VOICE_CALL = 8, /* data ops are not allowed during voice call on a Class C GPRS device */ RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW = 9, /* data ops are not allowed before device registers in network */ RIL_E_SMS_SEND_FAIL_RETRY = 10 /* fail to send sms and need retry */ } RIL_Errno;typedef enum { RIL_CALL_ACTIVE = 0, RIL_CALL_HOLDING = 1, RIL_CALL_DIALING = 2, /* MO call only */ RIL_CALL_ALERTING = 3, /* MO call only */ RIL_CALL_INCOMING = 4, /* MT call only */ RIL_CALL_WAITING = 5 /* MT call only */} RIL_CallState;typedef enum { RADIO_STATE_OFF = 0, /* Radio explictly powered off (eg CFUN=0) */ RADIO_STATE_UNAVAILABLE = 1, /* Radio unavailable (eg, resetting or not booted) */ RADIO_STATE_SIM_NOT_READY = 2, /* Radio is on, but the SIM interface is not ready */ RADIO_STATE_SIM_LOCKED_OR_ABSENT = 3, /* SIM PIN locked, PUK required, network personalization locked, or SIM absent */ RADIO_STATE_SIM_READY = 4 /* Radio is on and SIM interface is available */} RIL_RadioState;typedef struct { RIL_CallState state; int index; /* GSM Index for use with, eg, AT+CHLD */ int toa; /* type of address, eg 145 = intl */ char isMpty; /* nonzero if is mpty call */ char isMT; /* nonzero if call is mobile terminated */ char als; /* ALS line indicator if available (0 = line 1) */ char isVoice; /* nonzero if this is is a voice call */ char * number; /* phone number */} RIL_Call;typedef struct { int cid; /* Context ID */ int active; /* nonzero if context is active */ char * type; /* X.25, IP, IPV6, etc. */ char * apn; char * address;} RIL_PDP_Context_Response;typedef struct { int messageRef; /*TP-Message-Reference*/ char *ackPDU; /* or NULL if n/a */} RIL_SMS_Response;/** Used by RIL_REQUEST_WRITE_SMS_TO_SIM */typedef struct { int status; /* Status of message. See TS 27.005 3.1, "<stat>": */ /* 0 = "REC UNREAD" */ /* 1 = "REC READ" */ /* 2 = "STO UNSENT" */ /* 3 = "STO SENT" */ char * pdu; /* PDU of message to write, as a hex string. */ char * smsc; /* SMSC address in GSM BCD format prefixed by a length byte (as expected by TS 27.005) or NULL for default SMSC */} RIL_SMS_WriteArgs;/** Used by RIL_REQUEST_DIAL */typedef struct { char * address; int clir; /* (same as 'n' paremeter in TS 27.007 7.7 "+CLIR" * clir == 0 on "use subscription default value" * clir == 1 on "CLIR invocation" (restrict CLI presentation) * clir == 2 on "CLIR suppression" (allow CLI presentation) */} RIL_Dial;typedef struct { int command; /* one of the commands listed for TS 27.007 +CRSM*/ int fileid; /* EF id */ char *path; /* "pathid" from TS 27.007 +CRSM command. Path is in hex asciii format eg "7f205f70" */ int p1; int p2; int p3; char *data; /* May be NULL*/ char *pin2; /* May be NULL*/} RIL_SIM_IO;typedef struct { int sw1; int sw2; char *simResponse; /* In hex string format ([a-fA-F0-9]*). */} RIL_SIM_IO_Response;/* See also com.android.internal.telephony.gsm.CallForwardInfo */typedef struct { int status; /* * For RIL_REQUEST_QUERY_CALL_FORWARD_STATUS * status 1 = active, 0 = not active * * For RIL_REQUEST_SET_CALL_FORWARD: * status is: * 0 = disable * 1 = enable * 2 = interrogate * 3 = registeration * 4 = erasure */ int reason; /* from TS 27.007 7.11 "reason" */ int serviceClass;/* From 27.007 +CCFC/+CLCK "class" See table for Android mapping from MMI service code 0 means user doesn't input class */ int toa; /* "type" from TS 27.007 7.11 */ char * number; /* "number" from TS 27.007 7.11. May be NULL */ int timeSeconds; /* for CF no reply only */}RIL_CallForwardInfo;/* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */typedef enum { CALL_FAIL_NORMAL = 16, CALL_FAIL_BUSY = 17, CALL_FAIL_CONGESTION = 34, CALL_FAIL_ACM_LIMIT_EXCEEDED = 68, CALL_FAIL_CALL_BARRED = 240, CALL_FAIL_FDN_BLOCKED = 241, CALL_FAIL_ERROR_UNSPECIFIED = 0xffff} RIL_LastCallFailCause;/* See RIL_REQUEST_LAST_PDP_FAIL_CAUSE */typedef enum { PDP_FAIL_BARRED = 8, /* no retry; prompt user */ PDP_FAIL_BAD_APN = 27, /* no retry; prompt user */ PDP_FAIL_USER_AUTHENTICATION = 29, /* no retry; prompt user */ PDP_FAIL_SERVICE_OPTION_NOT_SUPPORTED = 32, /*no retry; prompt user */ PDP_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED = 33, /*no retry; prompt user */ PDP_FAIL_ERROR_UNSPECIFIED = 0xffff /* This and all other cases: retry silently */} RIL_LastPDPActivateFailCause;/* Used by RIL_UNSOL_SUPP_SVC_NOTIFICATION */typedef struct { int notificationType; /* * 0 = MO intermediate result code * 1 = MT unsolicited result code */ int code; /* See 27.007 7.17 "code1" for MO "code2" for MT. */ int index; /* CUG index. See 27.007 7.17. */ int type; /* "type" from 27.007 7.17 (MT only). */ char * number; /* "number" from 27.007 7.17 (MT only, may be NULL). */} RIL_SuppSvcNotification;/* see RIL_REQUEST_GET_SIM_STATUS */#define RIL_SIM_ABSENT 0#define RIL_SIM_NOT_READY 1/* RIL_SIM_READY means that the radio state is RADIO_STATE_SIM_READY. * This is more * than "+CPIN: READY". It also means the radio is ready for SIM I/O */#define RIL_SIM_READY 2#define RIL_SIM_PIN 3#define RIL_SIM_PUK 4#define RIL_SIM_NETWORK_PERSONALIZATION 5/* The result of a SIM refresh, returned in data[0] of RIL_UNSOL_SIM_REFRESH */typedef enum { /* A file on SIM has been updated. data[1] contains the EFID. */ SIM_FILE_UPDATE = 0, /* SIM initialized. All files should be re-read. */ SIM_INIT = 1, /* SIM reset. SIM power required, SIM may be locked and all files should be re-read. */ SIM_RESET = 2} RIL_SimRefreshResult;/** * RIL_REQUEST_GET_SIM_STATUS * * Requests status of the SIM interface and the SIM card * * "data" is NULL * * "response" must be an int * pointing to RIL_SIM_* constant * This should always succeed (RIL_SUCCESS) * * If the radio is off or unavailable, return RIL_SIM_NOT_READY * * Please note: RIL_SIM_READY means that the radio state * is RADIO_STATE_SIM_READY. This is more than "+CPIN: READY". * It also means the radio is ready for SIM I/O * * Valid errors: * Must never fail */#define RIL_REQUEST_GET_SIM_STATUS 1/** * RIL_REQUEST_ENTER_SIM_PIN * * Supplies SIM PIN. Only called if SIM status is RIL_SIM_PIN * * "data" is const char ** * ((const char **)data)[0] is PIN value * * "response" must be NULL * * Valid errors: * * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * GENERIC_FAILURE * PASSWORD_INCORRECT */#define RIL_REQUEST_ENTER_SIM_PIN 2/** * RIL_REQUEST_ENTER_SIM_PUK * * Supplies SIM PUK and new PIN. * * "data" is const char ** * ((const char **)data)[0] is PUK value * ((const char **)data)[1] is new PIN value * * "response" must be NULL * * Valid errors: * * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * GENERIC_FAILURE * PASSWORD_INCORRECT * (PUK is invalid) */#define RIL_REQUEST_ENTER_SIM_PUK 3/** * RIL_REQUEST_ENTER_SIM_PIN2 * * Supplies SIM PIN2. Only called following operation where SIM_PIN2 was * returned as a a failure from a previous operation. * * "data" is const char ** * ((const char **)data)[0] is PIN2 value * * "response" must be NULL * * Valid errors: * * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * GENERIC_FAILURE * PASSWORD_INCORRECT */#define RIL_REQUEST_ENTER_SIM_PIN2 4/** * RIL_REQUEST_ENTER_SIM_PUK2 * * Supplies SIM PUK2 and new PIN2. * * "data" is const char ** * ((const char **)data)[0] is PUK2 value * ((const char **)data)[1] is new PIN2 value * * "response" must be NULL * * Valid errors: * * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * GENERIC_FAILURE * PASSWORD_INCORRECT * (PUK2 is invalid) */#define RIL_REQUEST_ENTER_SIM_PUK2 5/** * RIL_REQUEST_CHANGE_SIM_PIN * * Supplies old SIM PIN and new PIN. * * "data" is const char ** * ((const char **)data)[0] is old PIN value * ((const char **)data)[1] is new PIN value * * "response" must be NULL * * Valid errors: * * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * GENERIC_FAILURE * PASSWORD_INCORRECT * (old PIN is invalid) * */#define RIL_REQUEST_CHANGE_SIM_PIN 6/** * RIL_REQUEST_CHANGE_SIM_PIN2 * * Supplies old SIM PIN2 and new PIN2. * * "data" is const char ** * ((const char **)data)[0] is old PIN2 value * ((const char **)data)[1] is new PIN2 value * * "response" must be NULL * * Valid errors: * * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * GENERIC_FAILURE * PASSWORD_INCORRECT * (old PIN2 is invalid) * */#define RIL_REQUEST_CHANGE_SIM_PIN2 7/** * RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION * * Requests that network personlization be deactivated * * "data" is const char ** * ((const char **)(data))[0]] is network depersonlization code * * "response" must be NULL * * Valid errors: * * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * GENERIC_FAILURE * PASSWORD_INCORRECT * (code is invalid) */#define RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION 8/** * RIL_REQUEST_GET_CURRENT_CALLS * * Requests current call list * * "data" is NULL * * "response" must be a "const RIL_Call **" * * Valid errors: * * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * GENERIC_FAILURE * (request will be made again in a few hundred msec) */#define RIL_REQUEST_GET_CURRENT_CALLS 9/** * RIL_REQUEST_DIAL * * Initiate voice call * * "data" is const RIL_Dial * * "response" is NULL * * This method is never used for supplementary service codes * * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * GENERIC_FAILURE */#define RIL_REQUEST_DIAL 10/** * RIL_REQUEST_GET_IMSI * * Get the SIM IMSI * * Only valid when radio state is "RADIO_STATE_SIM_READY" * * "data" is NULL * "response" is a const char * containing the IMSI * * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * GENERIC_FAILURE */#define RIL_REQUEST_GET_IMSI 11/** * RIL_REQUEST_HANGUP *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -