一种初始化结构体数组的方法
2016-10-13 09:46
369 查看
typedef struct { int requestNumber; void (*dispatchFunction) (Parcel &p, struct RequestInfo *pRI); int(*responseFunction) (Parcel &p, void *response, size_t responselen); } CommandInfo;
结构体数组声明、初始化
static CommandInfo s_commands[] = { #include "ril_commands.h" };
ril_commands.h内容:
{0, NULL, NULL}, //none {RIL_REQUEST_GET_SIM_STATUS, dispatchVoid, responseSimStatus}, {RIL_REQUEST_ENTER_SIM_PIN, dispatchStrings, responseInts}, {RIL_REQUEST_ENTER_SIM_PUK, dispatchStrings, responseInts}, {RIL_REQUEST_ENTER_SIM_PIN2, dispatchStrings, responseInts}, {RIL_REQUEST_ENTER_SIM_PUK2, dispatchStrings, responseInts}, {RIL_REQUEST_CHANGE_SIM_PIN, dispatchStrings, responseInts}, {RIL_REQUEST_CHANGE_SIM_PIN2, dispatchStrings, responseInts}, {RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, dispatchStrings, responseInts}, {RIL_REQUEST_GET_CURRENT_CALLS, dispatchVoid, responseCallList}, {RIL_REQUEST_DIAL, dispatchDial, responseVoid}, {RIL_REQUEST_GET_IMSI, dispatchVoid, responseString}, {RIL_REQUEST_HANGUP, dispatchInts, responseVoid}, {RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, dispatchVoid, responseVoid}, {RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, dispatchVoid, responseVoid}, {RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, dispatchVoid, responseVoid}, {RIL_REQUEST_CONFERENCE, dispatchVoid, responseVoid}, {RIL_REQUEST_UDUB, dispatchVoid, responseVoid}, {RIL_REQUEST_LAST_CALL_FAIL_CAUSE, dispatchVoid, responseInts}, {RIL_REQUEST_SIGNAL_STRENGTH, dispatchVoid, responseRilSignalStrength}, {RIL_REQUEST_VOICE_REGISTRATION_STATE, dispatchVoid, responseStrings}, {RIL_REQUEST_DATA_REGISTRATION_STATE, dispatchVoid, responseStrings}, {RIL_REQUEST_OPERATOR, dispatchVoid, responseStrings}, {RIL_REQUEST_RADIO_POWER, dispatchInts, responseVoid}, {RIL_REQUEST_DTMF, dispatchString, responseVoid}, {RIL_REQUEST_SEND_SMS, dispatchStrings, responseSMS}, {RIL_REQUEST_SEND_SMS_EXPECT_MORE, dispatchStrings, responseSMS}, {RIL_REQUEST_SETUP_DATA_CALL, dispatchDataCall, responseSetupDataCall}, {RIL_REQUEST_SIM_IO, dispatchSIM_IO, responseSIM_IO}, {RIL_REQUEST_SEND_USSD, dispatchString, responseVoid}, {RIL_REQUEST_CANCEL_USSD, dispatchVoid, responseVoid}, {RIL_REQUEST_GET_CLIR, dispatchVoid, responseInts}, {RIL_REQUEST_SET_CLIR, dispatchInts, responseVoid}, {RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, dispatchCallForward, responseCallForwards}, {RIL_REQUEST_SET_CALL_FORWARD, dispatchCallForward, responseVoid}, {RIL_REQUEST_QUERY_CALL_WAITING, dispatchInts, responseInts}, {RIL_REQUEST_SET_CALL_WAITING, dispatchInts, responseVoid}, {RIL_REQUEST_SMS_ACKNOWLEDGE, dispatchInts, responseVoid}, {RIL_REQUEST_GET_IMEI, dispatchVoid, responseString}, {RIL_REQUEST_GET_IMEISV, dispatchVoid, responseString}, {RIL_REQUEST_ANSWER,dispatchVoid, responseVoid}, {RIL_REQUEST_DEACTIVATE_DATA_CALL, dispatchStrings, responseVoid}, {RIL_REQUEST_QUERY_FACILITY_LOCK, dispatchStrings, responseInts}, {RIL_REQUEST_SET_FACILITY_LOCK, dispatchStrings, responseInts}, {RIL_REQUEST_CHANGE_BARRING_PASSWORD, dispatchStrings, responseVoid}, {RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, dispatchVoid, responseInts}, {RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, dispatchVoid, responseVoid}, {RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, dispatchString, responseVoid}, {RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , dispatchVoid, responseAvalibleNetworkList}, {RIL_REQUEST_DTMF_START, dispatchString, responseVoid}, {RIL_REQUEST_DTMF_STOP, dispatchVoid, responseVoid}, {RIL_REQUEST_BASEBAND_VERSION, dispatchVoid, responseString}, {RIL_REQUEST_SEPARATE_CONNECTION, dispatchInts, responseVoid}, {RIL_REQUEST_SET_MUTE, dispatchInts, responseVoid}, {RIL_REQUEST_GET_MUTE, dispatchVoid, responseInts}, {RIL_REQUEST_QUERY_CLIP, dispatchVoid, responseInts}, {RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE, dispatchVoid, responseInts}, {RIL_REQUEST_DATA_CALL_LIST, dispatchVoid, responseDataCallList}, {RIL_REQUEST_RESET_RADIO, dispatchVoid, responseVoid}, {RIL_REQUEST_OEM_HOOK_RAW, dispatchRaw, responseRaw}, {RIL_REQUEST_OEM_HOOK_STRINGS, dispatchStrings, responseStrings}, {RIL_REQUEST_SCREEN_STATE, dispatchInts, responseVoid}, {RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, dispatchInts, responseVoid}, {RIL_REQUEST_WRITE_SMS_TO_SIM, dispatchSmsWrite, responseInts}, {RIL_REQUEST_DELETE_SMS_ON_SIM, dispatchInts, responseVoid}, {RIL_REQUEST_SET_BAND_MODE, dispatchInts, responseVoid}, {RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, dispatchVoid, responseInts}, {RIL_REQUEST_STK_GET_PROFILE, dispatchVoid, responseString}, {RIL_REQUEST_STK_SET_PROFILE, dispatchString, responseVoid}, {RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, dispatchString, responseString}, {RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, dispatchString, responseVoid}, {RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, dispatchInts, responseVoid}, {RIL_REQUEST_EXPLICIT_CALL_TRANSFER, dispatchVoid, responseVoid}, {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, dispatchInts, responseVoid}, {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, dispatchVoid, responseInts}, {RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, dispatchVoid, responseCellList}, {RIL_REQUEST_SET_LOCATION_UPDATES, dispatchInts, responseVoid}, {RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, dispatchInts, responseVoid}, {RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, dispatchInts, responseVoid}, {RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, dispatchVoid, responseInts}, {RIL_REQUEST_SET_TTY_MODE, dispatchInts, responseVoid}, {RIL_REQUEST_QUERY_TTY_MODE, dispatchVoid, responseInts}, {RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, dispatchInts, responseVoid}, {RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE, dispatchVoid, responseInts}, {RIL_REQUEST_CDMA_FLASH, dispatchString, responseVoid}, {RIL_REQUEST_CDMA_BURST_DTMF, dispatchStrings, responseVoid}, {RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY, dispatchString, responseVoid}, {RIL_REQUEST_CDMA_SEND_SMS, dispatchCdmaSms, responseSMS}, {RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, dispatchCdmaSmsAck, responseVoid}, {RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG, dispatchVoid, responseGsmBrSmsCnf}, {RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG, dispatchGsmBrSmsCnf, responseVoid}, {RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION, dispatchInts, responseVoid}, {RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG, dispatchVoid, responseCdmaBrSmsCnf}, {RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG, dispatchCdmaBrSmsCnf, responseVoid}, {RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION, dispatchInts, responseVoid}, {RIL_REQUEST_CDMA_SUBSCRIPTION, dispatchVoid, responseStrings}, {RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, dispatchRilCdmaSmsWriteArgs, responseInts}, {RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, dispatchInts, responseVoid}, {RIL_REQUEST_DEVICE_IDENTITY, dispatchVoid, responseStrings}, {RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, dispatchVoid, responseVoid}, {RIL_REQUEST_GET_SMSC_ADDRESS, dispatchVoid, responseString}, {RIL_REQUEST_SET_SMSC_ADDRESS, dispatchString, responseVoid}, {RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, dispatchInts, responseVoid}, {RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, dispatchVoid, responseVoid}, {RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, dispatchVoid, responseInts}, {RIL_REQUEST_ISIM_AUTHENTICATION, dispatchString, responseString}, {RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, dispatchStrings, responseVoid}, {RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, dispatchString, responseSIM_IO}, {RIL_REQUEST_SET_DEATTACH,dispatchInts, responseVoid}, {RIL_REQUEST_SET_PIN_LOCK, dispatchStrings, responseVoid}, {RIL_REQUEST_PIN_PUK_NUM, dispatchVoid, responseInts}, {RIL_REQUEST_ACTIVATE_PDP_CONTEXT,dispatchVoid, responseStrings}, {RIL_SEND_ACTIVATE_PDP_CONTEXT,dispatchInts, responseVoid}, {RIL_SEND_MODODR,dispatchInts, responseVoid}, {RIL_SEND_CPWD, dispatchStrings, responseVoid}, {RIL_REQUEST_LCTCELLINFO, dispatchVoid, responseInts}, {RIL_REQUEST_QCSYSMODE,dispatchVoid, responseString}, {RIL_REQUEST_QCLTEVERSION,dispatchVoid, responseStrings}, {RIL_REQUEST_NETWORK_MODE,dispatchVoid, responseInts}, {RIL_REQUEST_BANDLOCK,dispatchInts, responseVoid}, {RIL_SEND_BANDPREF,dispatchInts, responseVoid}, {RIL_REQUEST_BANDSUPPORT,dispatchVoid, responseInts}, {RIL_SEND_CELLLOCK,dispatchStrings, responseVoid}
ril_commands.h中用到宏在ril.h中定义
#define RIL_REQUEST_PIN_PUK_NUM 110 #define RIL_REQUEST_ACTIVATE_PDP_CONTEXT 111 #define RIL_SEND_ACTIVATE_PDP_CONTEXT 112 #define RIL_SEND_MODODR 113 #define RIL_SEND_CPWD 114 #define RIL_REQUEST_LCTCELLINFO 115 #define RIL_REQUEST_QCSYSMODE 116 #define RIL_REQUEST_QCLTEVERSION 117 #define RIL_REQUEST_NETWORK_MODE 118 #define RIL_REQUEST_BANDLOCK 119 #define RIL_SEND_BANDPREF 120 #define RIL_REQUEST_BANDSUPPORT 121 #define RIL_SEND_CELLLOCK 122 ..............
相关文章推荐
- 从Linux的ext2文件系统源码学到一种初始化结构体的新方法
- designated initializer:一种特殊的结构体初始化方法
- 结构体数组初始化三种方法,转载
- VB中字符串数组快速复制的一种方法
- 初始化数组的方法
- 类对象数组初始化(三种方法)
- 一种快速为结构体赋值得方法
- 数组的初始化方法大全
- 一种快速可预制的随机数组产生方法
- 字符数组的几种初始化方法
- 一种少见的Java初始化方法
- 一种快速为结构体赋值得方法
- C++ 与“类”有关的注意事项总结(十):类对象数组初始化(三种方法)
- 怎样编写一个程序,把一个有序整数数组放到二叉树中? 编写实现链表排序的一种算法。说明为什么你会选择用这样的方法?
- JAVA中关于数组初始化的常用方法
- 【C语言】数组--字符串初始化数组的方法分析
- c语言struct的一种初始化方法
- struct成员的一种初始化方法
- JAVA对象数组的初始化方法
- Linux内核中结构体的特殊初始化方法