歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

Android RIL源碼研究筆記 の ril (二)

這篇文章介紹ril.cpp中實現部分代碼中的四個字符串輸出函數及其相應的枚舉類型。首先看requestToString()函數的代碼,它的功能是將將ril_command.h和ril_unsol_commands.h中的命令轉換成字符串描述:

相關閱讀:

http://www.linuxidc.com/Linux/2011-12/48994.htm

http://www.linuxidc.com/Linux/2011-12/48953.htm

http://www.linuxidc.com/Linux/2011-12/48954.htm

[cpp]
  1. const char * requestToString(int request) {  
  2.     switch(request) {  
  3.         case RIL_REQUEST_GET_SIM_STATUS: return "GET_SIM_STATUS";  
  4.         case RIL_REQUEST_ENTER_SIM_PIN: return "ENTER_SIM_PIN";  
  5.         case RIL_REQUEST_ENTER_SIM_PUK: return "ENTER_SIM_PUK";  
  6.         case RIL_REQUEST_ENTER_SIM_PIN2: return "ENTER_SIM_PIN2";  
  7.         case RIL_REQUEST_ENTER_SIM_PUK2: return "ENTER_SIM_PUK2";  
  8.         case RIL_REQUEST_CHANGE_SIM_PIN: return "CHANGE_SIM_PIN";  
  9.         case RIL_REQUEST_CHANGE_SIM_PIN2: return "CHANGE_SIM_PIN2";  
  10.         case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: return "ENTER_NETWORK_DEPERSONALIZATION";  
  11.         case RIL_REQUEST_GET_CURRENT_CALLS: return "GET_CURRENT_CALLS";  
  12.         case RIL_REQUEST_DIAL: return "DIAL";  
  13.         case RIL_REQUEST_GET_IMSI: return "GET_IMSI";  
  14.         case RIL_REQUEST_HANGUP: return "HANGUP";  
  15.         case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: return "HANGUP_WAITING_OR_BACKGROUND";  
  16.         case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: return "HANGUP_FOREGROUND_RESUME_BACKGROUND";  
  17.         case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: return "SWITCH_WAITING_OR_HOLDING_AND_ACTIVE";  
  18.         case RIL_REQUEST_CONFERENCE: return "CONFERENCE";  
  19.         case RIL_REQUEST_UDUB: return "UDUB";  
  20.         case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: return "LAST_CALL_FAIL_CAUSE";  
  21.         case RIL_REQUEST_SIGNAL_STRENGTH: return "SIGNAL_STRENGTH";  
  22.         case RIL_REQUEST_REGISTRATION_STATE: return "REGISTRATION_STATE";  
  23.         case RIL_REQUEST_GPRS_REGISTRATION_STATE: return "GPRS_REGISTRATION_STATE";  
  24.         case RIL_REQUEST_OPERATOR: return "OPERATOR";  
  25.         case RIL_REQUEST_RADIO_POWER: return "RADIO_POWER";  
  26.         case RIL_REQUEST_DTMF: return "DTMF";  
  27.         case RIL_REQUEST_SEND_SMS: return "SEND_SMS";  
  28.         case RIL_REQUEST_SEND_SMS_EXPECT_MORE: return "SEND_SMS_EXPECT_MORE";  
  29.         case RIL_REQUEST_SETUP_DATA_CALL: return "SETUP_DATA_CALL";  
  30.         case RIL_REQUEST_SIM_IO: return "SIM_IO";  
  31.         case RIL_REQUEST_SEND_USSD: return "SEND_USSD";  
  32.         case RIL_REQUEST_CANCEL_USSD: return "CANCEL_USSD";  
  33.         case RIL_REQUEST_GET_CLIR: return "GET_CLIR";  
  34.         case RIL_REQUEST_SET_CLIR: return "SET_CLIR";  
  35.         case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: return "QUERY_CALL_FORWARD_STATUS";  
  36.         case RIL_REQUEST_SET_CALL_FORWARD: return "SET_CALL_FORWARD";  
  37.         case RIL_REQUEST_QUERY_CALL_WAITING: return "QUERY_CALL_WAITING";  
  38.         case RIL_REQUEST_SET_CALL_WAITING: return "SET_CALL_WAITING";  
  39.         case RIL_REQUEST_SMS_ACKNOWLEDGE: return "SMS_ACKNOWLEDGE";  
  40.         case RIL_REQUEST_GET_IMEI: return "GET_IMEI";  
  41.         case RIL_REQUEST_GET_IMEISV: return "GET_IMEISV";  
  42.         case RIL_REQUEST_ANSWER: return "ANSWER";  
  43.         case RIL_REQUEST_DEACTIVATE_DATA_CALL: return "DEACTIVATE_DATA_CALL";  
  44.         case RIL_REQUEST_QUERY_FACILITY_LOCK: return "QUERY_FACILITY_LOCK";  
  45.         case RIL_REQUEST_SET_FACILITY_LOCK: return "SET_FACILITY_LOCK";  
  46.         case RIL_REQUEST_CHANGE_BARRING_PASSWORD: return "CHANGE_BARRING_PASSWORD";  
  47.         case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: return "QUERY_NETWORK_SELECTION_MODE";  
  48.         case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: return "SET_NETWORK_SELECTION_AUTOMATIC";  
  49.         case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: return "SET_NETWORK_SELECTION_MANUAL";  
  50.         case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS : return "QUERY_AVAILABLE_NETWORKS ";  
  51.         case RIL_REQUEST_DTMF_START: return "DTMF_START";  
  52.         case RIL_REQUEST_DTMF_STOP: return "DTMF_STOP";  
  53.         case RIL_REQUEST_BASEBAND_VERSION: return "BASEBAND_VERSION";  
  54.         case RIL_REQUEST_SEPARATE_CONNECTION: return "SEPARATE_CONNECTION";  
  55.         case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: return "SET_PREFERRED_NETWORK_TYPE";  
  56.         case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: return "GET_PREFERRED_NETWORK_TYPE";  
  57.         case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: return "GET_NEIGHBORING_CELL_IDS";  
  58.         case RIL_REQUEST_SET_MUTE: return "SET_MUTE";  
  59.         case RIL_REQUEST_GET_MUTE: return "GET_MUTE";  
  60.         case RIL_REQUEST_QUERY_CLIP: return "QUERY_CLIP";  
  61.         case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: return "LAST_DATA_CALL_FAIL_CAUSE";  
  62.         case RIL_REQUEST_DATA_CALL_LIST: return "DATA_CALL_LIST";  
  63.         case RIL_REQUEST_RESET_RADIO: return "RESET_RADIO";  
  64.         case RIL_REQUEST_OEM_HOOK_RAW: return "OEM_HOOK_RAW";  
  65.         case RIL_REQUEST_OEM_HOOK_STRINGS: return "OEM_HOOK_STRINGS";  
  66.         case RIL_REQUEST_SET_BAND_MODE: return "SET_BAND_MODE";  
  67.         case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE: return "QUERY_AVAILABLE_BAND_MODE";  
  68.         case RIL_REQUEST_STK_GET_PROFILE: return "STK_GET_PROFILE";  
  69.         case RIL_REQUEST_STK_SET_PROFILE: return "STK_SET_PROFILE";  
  70.         case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND: return "STK_SEND_ENVELOPE_COMMAND";  
  71.         case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE: return "STK_SEND_TERMINAL_RESPONSE";  
  72.         case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: return "STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM";  
  73.         case RIL_REQUEST_SCREEN_STATE: return "SCREEN_STATE";  
  74.         case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: return "EXPLICIT_CALL_TRANSFER";  
  75.         case RIL_REQUEST_SET_LOCATION_UPDATES: return "SET_LOCATION_UPDATES";  
  76.         case RIL_REQUEST_CDMA_SET_SUBSCRIPTION:return"CDMA_SET_SUBSCRIPTION";  
  77.         case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE:return"CDMA_SET_ROAMING_PREFERENCE";  
  78.         case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE:return"CDMA_QUERY_ROAMING_PREFERENCE";  
  79.         case RIL_REQUEST_SET_TTY_MODE:return"SET_TTY_MODE";  
  80.         case RIL_REQUEST_QUERY_TTY_MODE:return"QUERY_TTY_MODE";  
  81.         case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE:return"CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE";  
  82.         case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE:return"CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE";  
  83.         case RIL_REQUEST_CDMA_FLASH:return"CDMA_FLASH";  
  84.         case RIL_REQUEST_CDMA_BURST_DTMF:return"CDMA_BURST_DTMF";  
  85.         case RIL_REQUEST_CDMA_SEND_SMS:return"CDMA_SEND_SMS";  
  86.         case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE:return"CDMA_SMS_ACKNOWLEDGE";  
  87.         case RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG:return"GSM_GET_BROADCAST_SMS_CONFIG";  
  88.         case RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG:return"GSM_SET_BROADCAST_SMS_CONFIG";  
  89.         case RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG:return "CDMA_GET_BROADCAST_SMS_CONFIG";  
  90.         case RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG:return "CDMA_SET_BROADCAST_SMS_CONFIG";  
  91.         case RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION:return "CDMA_SMS_BROADCAST_ACTIVATION";  
  92.         case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY: return"CDMA_VALIDATE_AND_WRITE_AKEY";  
  93.         case RIL_REQUEST_CDMA_SUBSCRIPTION: return"CDMA_SUBSCRIPTION";  
  94.         case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM: return "CDMA_WRITE_SMS_TO_RUIM";  
  95.         case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM: return "CDMA_DELETE_SMS_ON_RUIM";  
  96.         case RIL_REQUEST_DEVICE_IDENTITY: return "DEVICE_IDENTITY";  
  97.         case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: return "EXIT_EMERGENCY_CALLBACK_MODE";  
  98.         case RIL_REQUEST_GET_SMSC_ADDRESS: return "GET_SMSC_ADDRESS";  
  99.         case RIL_REQUEST_SET_SMSC_ADDRESS: return "SET_SMSC_ADDRESS";  
  100.         case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: return "REPORT_SMS_MEMORY_STATUS";  
  101.         case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: return "REPORT_STK_SERVICE_IS_RUNNING";  
  102.         case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED";  
  103.         case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED";  
  104.         case RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_NETWORK_STATE_CHANGED";  
  105.         case RIL_UNSOL_RESPONSE_NEW_SMS: return "UNSOL_RESPONSE_NEW_SMS";  
  106.         case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT: return "UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT";  
  107.         case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: return "UNSOL_RESPONSE_NEW_SMS_ON_SIM";  
  108.         case RIL_UNSOL_ON_USSD: return "UNSOL_ON_USSD";  
  109.         case RIL_UNSOL_ON_USSD_REQUEST: return "UNSOL_ON_USSD_REQUEST(obsolete)";  
  110.         case RIL_UNSOL_NITZ_TIME_RECEIVED: return "UNSOL_NITZ_TIME_RECEIVED";  
  111.         case RIL_UNSOL_SIGNAL_STRENGTH: return "UNSOL_SIGNAL_STRENGTH";  
  112.         case RIL_UNSOL_STK_SESSION_END: return "UNSOL_STK_SESSION_END";  
  113.         case RIL_UNSOL_STK_PROACTIVE_COMMAND: return "UNSOL_STK_PROACTIVE_COMMAND";  
  114.         case RIL_UNSOL_STK_EVENT_NOTIFY: return "UNSOL_STK_EVENT_NOTIFY";  
  115.         case RIL_UNSOL_STK_CALL_SETUP: return "UNSOL_STK_CALL_SETUP";  
  116.         case RIL_UNSOL_SIM_SMS_STORAGE_FULL: return "UNSOL_SIM_SMS_STORAGE_FUL";  
  117.         case RIL_UNSOL_SIM_REFRESH: return "UNSOL_SIM_REFRESH";  
  118.         case RIL_UNSOL_DATA_CALL_LIST_CHANGED: return "UNSOL_DATA_CALL_LIST_CHANGED";  
  119.         case RIL_UNSOL_CALL_RING: return "UNSOL_CALL_RING";  
  120.         case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: return "UNSOL_RESPONSE_SIM_STATUS_CHANGED";  
  121.         case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS: return "UNSOL_NEW_CDMA_SMS";  
  122.         case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS: return "UNSOL_NEW_BROADCAST_SMS";  
  123.         case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL: return "UNSOL_CDMA_RUIM_SMS_STORAGE_FULL";  
  124.         case RIL_UNSOL_RESTRICTED_STATE_CHANGED: return "UNSOL_RESTRICTED_STATE_CHANGED";  
  125.         case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: return "UNSOL_ENTER_EMERGENCY_CALLBACK_MODE";  
  126.         case RIL_UNSOL_CDMA_CALL_WAITING: return "UNSOL_CDMA_CALL_WAITING";  
  127.         case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: return "UNSOL_CDMA_OTA_PROVISION_STATUS";  
  128.         case RIL_UNSOL_CDMA_INFO_REC: return "UNSOL_CDMA_INFO_REC";  
  129.         case RIL_UNSOL_OEM_HOOK_RAW: return "UNSOL_OEM_HOOK_RAW";  
  130.         case RIL_UNSOL_RINGBACK_TONE: return "UNSOL_RINGBACK_TONE";  
  131.         case RIL_UNSOL_RESEND_INCALL_MUTE: return "UNSOL_RESEND_INCALL_MUTE";  
  132.         defaultreturn "<unknown request>";  
  133.     }  
  134. }  
Copyright © Linux教程網 All Rights Reserved