1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_RIL_CALLBACK_TEST_H 17 #define OHOS_RIL_CALLBACK_TEST_H 18 19 #include "condition_variable" 20 #include "map" 21 #include "mutex" 22 #include "v1_1/iril.h" 23 24 namespace OHOS { 25 namespace Telephony { 26 constexpr static int32_t SLOTID_1 = 0; 27 constexpr static int32_t SLOTID_2 = 1; 28 constexpr static int32_t SUCCESS = 0; 29 constexpr static int32_t WAIT_TIME_SECOND = 20; 30 constexpr static int32_t WAIT_TIME_SECOND_LONG = 40; 31 constexpr static int32_t CID = 1; 32 constexpr static int32_t REASON = 2; 33 constexpr int32_t TEST_TOSCA = 0; 34 const std::string TEST_STORAGE_PDU = "1234"; 35 const std::string TEST_SEND_PDU = "A10305810180F6000004F4F29C0E"; 36 const std::string TEST_SMSC_PDU = "00"; 37 const std::string TEST_CDMA_PDU = "pdu"; 38 const std::string TEST_ID_LIST = "0,1,5,320-478,922"; 39 const std::string TEST_DCS_LIST = "0-3,5"; 40 const int32_t TEST_MODE = 0; 41 const bool TEST_RESULT = true; 42 43 enum class HdiId { 44 HREQ_NONE = -1, 45 HREQ_CALL_BASE = 0, 46 HREQ_CALL_GET_CALL_LIST, 47 HREQ_CALL_DIAL, 48 HREQ_CALL_HANGUP, 49 HREQ_CALL_REJECT, 50 HREQ_CALL_ANSWER, 51 HREQ_CALL_HOLD_CALL, // call hold value 6 52 HREQ_CALL_UNHOLD_CALL, // call active value 6 53 HREQ_CALL_SWITCH_CALL, 54 HREQ_CALL_COMBINE_CONFERENCE, 55 HREQ_CALL_SEPARATE_CONFERENCE, // Keep all other calls except the xth call 56 HREQ_CALL_CALL_SUPPLEMENT, 57 HREQ_CALL_SEND_DTMF, 58 HREQ_CALL_START_DTMF, 59 HREQ_CALL_STOP_DTMF, 60 HREQ_CALL_SET_CLIP, 61 HREQ_CALL_GET_CLIP, 62 HREQ_CALL_GET_CALL_WAITING, 63 HREQ_CALL_SET_CALL_WAITING, 64 HREQ_CALL_GET_CALL_RESTRICTION, 65 HREQ_CALL_SET_CALL_RESTRICTION, 66 HREQ_CALL_GET_CALL_TRANSFER_INFO, 67 HREQ_CALL_SET_CALL_TRANSFER_INFO, 68 HREQ_CALL_GET_CLIR, 69 HREQ_CALL_SET_CLIR, 70 HREQ_CALL_GET_CALL_PREFERENCE, 71 HREQ_CALL_SET_CALL_PREFERENCE, 72 HREQ_CALL_SET_USSD, 73 HREQ_CALL_GET_USSD, 74 HREQ_CALL_SET_MUTE, 75 HREQ_CALL_GET_MUTE, 76 HREQ_CALL_GET_EMERGENCY_LIST, 77 HREQ_CALL_SET_EMERGENCY_LIST, 78 HREQ_CALL_GET_FAIL_REASON, 79 HREQ_CALL_SET_BARRING_PASSWORD, 80 HREQ_CALL_CLOSE_UNFINISHED_USSD, 81 HREQ_SET_VONR_SWITCH, 82 83 HREQ_SMS_BASE = 100, 84 HREQ_SMS_SEND_GSM_SMS, 85 HREQ_SMS_SEND_CDMA_SMS, 86 HREQ_SMS_ADD_SIM_MESSAGE, 87 HREQ_SMS_DEL_SIM_MESSAGE, 88 HREQ_SMS_UPDATE_SIM_MESSAGE, 89 HREQ_SMS_SEND_SMS_MORE_MODE, 90 HREQ_SMS_SEND_SMS_ACK, 91 HREQ_SMS_SET_SMSC_ADDR, 92 HREQ_SMS_GET_SMSC_ADDR, 93 HREQ_SMS_SET_CB_CONFIG, 94 HREQ_SMS_GET_CB_CONFIG, 95 HREQ_SMS_GET_CDMA_CB_CONFIG, 96 HREQ_SMS_SET_CDMA_CB_CONFIG, 97 HREQ_SMS_ADD_CDMA_SIM_MESSAGE, 98 HREQ_SMS_DEL_CDMA_SIM_MESSAGE, 99 HREQ_SMS_UPDATE_CDMA_SIM_MESSAGE, 100 101 HREQ_SIM_BASE = 200, 102 HREQ_SIM_GET_SIM_STATUS, 103 HREQ_SIM_GET_IMSI, 104 HREQ_SIM_GET_SIM_IO, 105 HREQ_SIM_GET_SIM_LOCK_STATUS, 106 HREQ_SIM_SET_SIM_LOCK, 107 HREQ_SIM_CHANGE_SIM_PASSWORD, 108 HREQ_SIM_UNLOCK_PIN, 109 HREQ_SIM_UNLOCK_PUK, 110 HREQ_SIM_GET_SIM_PIN_INPUT_TIMES, 111 HREQ_SIM_UNLOCK_PIN2, 112 HREQ_SIM_UNLOCK_PUK2, 113 HREQ_SIM_GET_SIM_PIN2_INPUT_TIMES, 114 HREQ_SIM_SET_ACTIVE_SIM, 115 HREQ_SIM_RADIO_PROTOCOL, 116 HREQ_SIM_STK_SEND_TERMINAL_RESPONSE, 117 HREQ_SIM_STK_SEND_ENVELOPE, 118 HREQ_SIM_STK_SEND_CALL_SETUP_REQUEST_RESULT, 119 HREQ_SIM_STK_IS_READY, 120 HREQ_SIM_OPEN_LOGICAL_CHANNEL, 121 HREQ_SIM_CLOSE_LOGICAL_CHANNEL, 122 HREQ_SIM_TRANSMIT_APDU_LOGICAL_CHANNEL, 123 HREQ_SIM_TRANSMIT_APDU_BASIC_CHANNEL, 124 HREQ_SIM_AUTHENTICATION, 125 HREQ_SIM_UNLOCK_SIM_LOCK, 126 127 HREQ_DATA_BASE = 300, 128 HREQ_DATA_SET_INIT_APN_INFO, 129 HREQ_DATA_DEACTIVATE_PDP_CONTEXT, 130 HREQ_DATA_ACTIVATE_PDP_CONTEXT, 131 HREQ_DATA_GET_PDP_CONTEXT_LIST, 132 HREQ_DATA_GET_LINK_BANDWIDTH_INFO, 133 HREQ_DATA_SET_LINK_BANDWIDTH_REPORTING_RULE, 134 HREQ_DATA_SET_DATA_PROFILE_INFO, 135 HREQ_DATA_SET_DATA_PERMITTED, 136 HREQ_DATA_GET_LINK_CAPABILITY, 137 138 HREQ_NETWORK_BASE = 400, 139 HREQ_NETWORK_GET_SIGNAL_STRENGTH, 140 HREQ_NETWORK_GET_CS_REG_STATUS, 141 HREQ_NETWORK_GET_PS_REG_STATUS, 142 HREQ_NETWORK_GET_OPERATOR_INFO, 143 HREQ_NETWORK_GET_NETWORK_SEARCH_INFORMATION, 144 HREQ_NETWORK_GET_NETWORK_SELECTION_MODE, 145 HREQ_NETWORK_SET_NETWORK_SELECTION_MODE, 146 HREQ_NETWORK_GET_NEIGHBORING_CELLINFO_LIST, 147 HREQ_NETWORK_GET_CURRENT_CELL_INFO, 148 HREQ_NETWORK_SET_PREFERRED_NETWORK, 149 HREQ_NETWORK_GET_PREFERRED_NETWORK, 150 HREQ_NETWORK_GET_RADIO_CAPABILITY, 151 HREQ_NETWORK_GET_PHYSICAL_CHANNEL_CONFIG, 152 HREQ_NETWORK_SET_LOCATE_UPDATES, 153 HREQ_NETWORK_SET_NOTIFICATION_FILTER, 154 HREQ_NETWORK_SET_DEVICE_STATE, 155 HREQ_NETWORK_SET_NR_OPTION_MODE, 156 HREQ_NETWORK_GET_NR_OPTION_MODE, 157 HREQ_NETWORK_GET_RRC_CONNECTION_STATE, 158 159 HREQ_COMMON_BASE = 500, 160 HREQ_MODEM_SHUT_DOWN, 161 HREQ_MODEM_SET_RADIO_STATUS, 162 HREQ_MODEM_GET_RADIO_STATUS, 163 HREQ_MODEM_GET_IMEI, 164 HREQ_MODEM_GET_MEID, 165 HREQ_MODEM_GET_BASEBAND_VERSION, 166 HREQ_MODEM_GET_VOICE_RADIO, 167 HREQ_MODEM_EXIT = 1000 168 }; 169 170 enum class DeviceStateType { POWER_SAVE_MODE, CHARGING_STATE, LOW_DATA_STATE }; 171 172 enum class NotificationFilter { 173 NOTIFICATION_FILTER_ALL = -1, 174 NOTIFICATION_FILTER_NONE = 0, 175 NOTIFICATION_FILTER_SIGNAL_STRENGTH = 1, 176 NOTIFICATION_FILTER_NETWORK_STATE = 2, 177 NOTIFICATION_FILTER_DATA_CALL = 4, 178 NOTIFICATION_FILTER_LINK_CAPACITY = 8, 179 NOTIFICATION_FILTER_PHYSICAL_CHANNEL_CONFIG = 16 180 }; 181 182 enum class RatType { 183 NETWORK_TYPE_UNKNOWN = 0, 184 NETWORK_TYPE_GSM, 185 NETWORK_TYPE_CDMA, 186 NETWORK_TYPE_WCDMA, 187 NETWORK_TYPE_TDSCDMA, 188 NETWORK_TYPE_LTE, 189 NETWORK_TYPE_NR 190 }; 191 192 enum class SelectionMode { MODE_TYPE_UNKNOWN = -1, MODE_TYPE_AUTO = 0, MODE_TYPE_MANUAL = 1 }; 193 194 enum class PreferredNetworkMode { 195 CORE_NETWORK_MODE_AUTO = 0, 196 CORE_NETWORK_MODE_GSM = 1, 197 CORE_NETWORK_MODE_WCDMA = 2, 198 CORE_NETWORK_MODE_LTE = 3, 199 CORE_NETWORK_MODE_LTE_WCDMA = 4, 200 CORE_NETWORK_MODE_LTE_WCDMA_GSM = 5, 201 CORE_NETWORK_MODE_WCDMA_GSM = 6, 202 CORE_NETWORK_MODE_CDMA = 7, 203 CORE_NETWORK_MODE_EVDO = 8, 204 CORE_NETWORK_MODE_EVDO_CDMA = 9, 205 CORE_NETWORK_MODE_WCDMA_GSM_EVDO_CDMA = 10, 206 CORE_NETWORK_MODE_LTE_EVDO_CDMA = 11, 207 CORE_NETWORK_MODE_LTE_WCDMA_GSM_EVDO_CDMA = 12, 208 CORE_NETWORK_MODE_TDSCDMA = 13, 209 CORE_NETWORK_MODE_TDSCDMA_GSM = 14, 210 CORE_NETWORK_MODE_TDSCDMA_WCDMA = 15, 211 CORE_NETWORK_MODE_TDSCDMA_WCDMA_GSM = 16, 212 CORE_NETWORK_MODE_LTE_TDSCDMA = 17, 213 CORE_NETWORK_MODE_LTE_TDSCDMA_GSM = 18, 214 CORE_NETWORK_MODE_LTE_TDSCDMA_WCDMA = 19, 215 CORE_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM = 20, 216 CORE_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA = 21, 217 CORE_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA = 22, 218 CORE_NETWORK_MODE_NR = 31, 219 CORE_NETWORK_MODE_NR_LTE = 32, 220 CORE_NETWORK_MODE_NR_LTE_WCDMA = 33, 221 CORE_NETWORK_MODE_NR_LTE_WCDMA_GSM = 34, 222 CORE_NETWORK_MODE_NR_LTE_EVDO_CDMA = 35, 223 CORE_NETWORK_MODE_NR_LTE_WCDMA_GSM_EVDO_CDMA = 36, 224 CORE_NETWORK_MODE_NR_LTE_TDSCDMA = 37, 225 CORE_NETWORK_MODE_NR_LTE_TDSCDMA_GSM = 38, 226 CORE_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA = 39, 227 CORE_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM = 40, 228 CORE_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA = 41, 229 CORE_NETWORK_MODE_MAX_VALUE = 99, 230 }; 231 232 enum class SimMessageStatus { 233 SIM_MESSAGE_STATUS_UNREAD = 0, 234 SIM_MESSAGE_STATUS_READ = 1, 235 SIM_MESSAGE_STATUS_UNSENT = 2, 236 SIM_MESSAGE_STATUS_SENT = 3, 237 }; 238 239 class RilCallbackTest : public HDI::Ril::V1_1::IRilCallback { 240 public: 241 void NotifyAll(); 242 void WaitFor(int32_t timeoutSecond); 243 bool GetBoolResult(HdiId hdiId_); 244 void Clean(); 245 246 // Call 247 int32_t CallStateUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 248 int32_t CallRingbackVoiceNotice(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 249 const HDI::Ril::V1_1::RingbackVoice &ringbackVoice) override; 250 int32_t CallSrvccStatusNotice(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 251 const HDI::Ril::V1_1::SrvccStatus &srvccStatus) override; 252 int32_t CallUssdNotice(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 253 const HDI::Ril::V1_1::UssdNoticeInfo &ussdNoticeInfo) override; 254 int32_t CallSsNotice(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 255 const HDI::Ril::V1_1::SsNoticeInfo &ssNoticeInfo) override; 256 int32_t CallEmergencyNotice(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 257 const HDI::Ril::V1_1::EmergencyInfoList &emergencyInfoList) override; 258 int32_t CallRsrvccStatusNotify(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 259 int32_t SetEmergencyCallListResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 260 int32_t GetEmergencyCallListResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 261 const HDI::Ril::V1_1::EmergencyInfoList &emergencyInfoList) override; 262 int32_t GetCallListResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 263 const HDI::Ril::V1_1::CallInfoList &callList) override; 264 int32_t DialResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 265 int32_t HangupResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 266 int32_t RejectResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 267 int32_t AnswerResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 268 int32_t HoldCallResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 269 int32_t UnHoldCallResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 270 int32_t SwitchCallResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 271 int32_t GetClipResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 272 const HDI::Ril::V1_1::GetClipResult &getClipResult) override; 273 int32_t SetClipResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 274 int32_t CombineConferenceResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 275 int32_t SeparateConferenceResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 276 int32_t CallSupplementResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 277 int32_t GetCallWaitingResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 278 const HDI::Ril::V1_1::CallWaitResult &callWaitResult) override; 279 int32_t SetCallWaitingResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 280 int32_t GetCallTransferInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 281 const HDI::Ril::V1_1::CallForwardQueryInfoList &cFQueryList) override; 282 int32_t SetCallTransferInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 283 int32_t GetCallRestrictionResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 284 const HDI::Ril::V1_1::CallRestrictionResult &result) override; 285 int32_t SetCallRestrictionResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 286 int32_t GetClirResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 287 const HDI::Ril::V1_1::GetClirResult &getClirResult) override; 288 int32_t SetClirResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 289 int32_t StartDtmfResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 290 int32_t SendDtmfResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 291 int32_t StopDtmfResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 292 int32_t GetCallPreferenceModeResponse( 293 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t mode) override; 294 int32_t SetCallPreferenceModeResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 295 int32_t SetUssdResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 296 int32_t GetUssdResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t cusd) override; 297 int32_t SetMuteResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 298 int32_t GetMuteResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t mute) override; 299 int32_t GetCallFailReasonResponse( 300 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t callFail) override; 301 int32_t SetBarringPasswordResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 302 int32_t CloseUnFinishedUssdResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 303 int32_t SetVonrSwitchResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 304 305 // Data 306 int32_t PdpContextListUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 307 const HDI::Ril::V1_1::DataCallResultList &dataCallResultList) override; 308 int32_t DataLinkCapabilityUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 309 const HDI::Ril::V1_1::DataLinkCapability &dataLinkCapability) override; 310 int32_t ActivatePdpContextResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 311 const HDI::Ril::V1_1::SetupDataCallResultInfo &setupDataCallResultInfo) override; 312 int32_t DeactivatePdpContextResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 313 int32_t GetPdpContextListResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 314 const HDI::Ril::V1_1::DataCallResultList &dataCallResultList) override; 315 int32_t SetInitApnInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 316 int32_t SetLinkBandwidthReportingRuleResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 317 int32_t GetLinkBandwidthInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 318 const HDI::Ril::V1_1::DataLinkBandwidthInfo &dataLinkBandwidthInfo) override; 319 int32_t SetDataPermittedResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 320 int32_t SetDataProfileInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo); 321 int32_t GetLinkCapabilityResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 322 const HDI::Ril::V1_1::DataLinkCapability &dataLinkCapability) override; 323 // Modem 324 int32_t RadioStateUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t state) override; 325 int32_t VoiceRadioTechUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 326 const HDI::Ril::V1_1::VoiceRadioTechnology &voiceRadioTechnology) override; 327 int32_t DsdsModeUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t mode) override; 328 int32_t ShutDownResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 329 int32_t SetRadioStateResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 330 int32_t GetRadioStateResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t state) override; 331 int32_t GetImeiResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &imei) override; 332 int32_t GetMeidResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &meid) override; 333 int32_t GetVoiceRadioTechnologyResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 334 const HDI::Ril::V1_1::VoiceRadioTechnology &voiceRadioTechnology) override; 335 int32_t GetBasebandVersionResponse( 336 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &basebandVersion) override; 337 338 // Sim notice 339 int32_t SimStateUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 340 int32_t SimStkSessionEndNotify(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 341 int32_t SimStkProactiveNotify( 342 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &response) override; 343 int32_t SimStkAlphaNotify( 344 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &response) override; 345 int32_t SimStkEventNotify( 346 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &response) override; 347 int32_t SimStkCallSetupNotify(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 348 int32_t SimRefreshNotify(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; SimRadioProtocolUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo,const HDI::Ril::V1_1::RadioProtocol & radioProtocol)349 int32_t SimRadioProtocolUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 350 const HDI::Ril::V1_1::RadioProtocol &radioProtocol) override 351 { 352 return 0; 353 } 354 // Sim response 355 int32_t GetSimIOResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 356 const HDI::Ril::V1_1::IccIoResultInfo &result) override; 357 int32_t GetSimStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 358 const HDI::Ril::V1_1::CardStatusInfo &result) override; 359 int32_t GetImsiResponse( 360 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &response) override; 361 int32_t GetSimLockStatusResponse( 362 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t simLockStatus) override; 363 int32_t SetSimLockResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 364 const HDI::Ril::V1_1::LockStatusResp &lockStatus) override; 365 int32_t ChangeSimPasswordResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 366 const HDI::Ril::V1_1::LockStatusResp &lockStatus) override; 367 int32_t UnlockPinResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 368 const HDI::Ril::V1_1::LockStatusResp &lockStatus) override; 369 int32_t UnlockPukResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 370 const HDI::Ril::V1_1::LockStatusResp &lockStatus) override; 371 int32_t UnlockPin2Response(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 372 const HDI::Ril::V1_1::LockStatusResp &lockStatus) override; 373 int32_t UnlockPuk2Response(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 374 const HDI::Ril::V1_1::LockStatusResp &lockStatus) override; 375 int32_t SetActiveSimResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 376 int32_t SimStkSendTerminalResponseResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 377 int32_t SimStkSendEnvelopeResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 378 int32_t SimStkSendCallSetupRequestResultResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 379 int32_t SimStkIsReadyResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 380 int32_t SetRadioProtocolResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 381 const HDI::Ril::V1_1::RadioProtocol &radioProtocol) override; GetRadioProtocolResponse(const HDI::Ril::V1_1::RilRadioResponseInfo & responseInfo,const HDI::Ril::V1_1::RadioProtocol & radioProtocol)382 int32_t GetRadioProtocolResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 383 const HDI::Ril::V1_1::RadioProtocol &radioProtocol) override 384 { 385 return 0; 386 } 387 int32_t SimOpenLogicalChannelResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 388 const HDI::Ril::V1_1::OpenLogicalChannelResponse &pOpenLogicalChannelResponse) override; 389 int32_t SimCloseLogicalChannelResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 390 int32_t SimTransmitApduLogicalChannelResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 391 const HDI::Ril::V1_1::IccIoResultInfo &result) override; 392 int32_t SimTransmitApduBasicChannelResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 393 const HDI::Ril::V1_1::IccIoResultInfo &result) override; 394 int32_t SimAuthenticationResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 395 const HDI::Ril::V1_1::IccIoResultInfo &result) override; 396 int32_t UnlockSimLockResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 397 const HDI::Ril::V1_1::LockStatusResp &lockStatus) override; 398 399 // Network 400 int32_t NetworkCsRegStatusUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 401 const HDI::Ril::V1_1::CsRegStatusInfo &csRegStatusInfo) override; 402 int32_t NetworkPsRegStatusUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 403 const HDI::Ril::V1_1::PsRegStatusInfo &psRegStatusInfo) override; 404 int32_t SignalStrengthUpdated( 405 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::Rssi &rssi) override; 406 int32_t NetworkTimeZoneUpdated( 407 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &timeZoneStr) override; 408 int32_t NetworkTimeUpdated( 409 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &timeStr) override; 410 int32_t NetworkPhyChnlCfgUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 411 const HDI::Ril::V1_1::ChannelConfigInfoList &channelConfigInfoList) override; 412 int32_t NetworkCurrentCellUpdated(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 413 const HDI::Ril::V1_1::CellListCurrentInfo &cellListCurrentInfo) override; 414 int32_t NetworkCurrentCellUpdated_1_1(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 415 const HDI::Ril::V1_1::CellListCurrentInfo_1_1 &cellListCurrentInfo) override; 416 int32_t GetSignalStrengthResponse( 417 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const HDI::Ril::V1_1::Rssi &rssi) override; 418 int32_t GetCsRegStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 419 const HDI::Ril::V1_1::CsRegStatusInfo &csRegStatusInfo) override; 420 int32_t GetPsRegStatusResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 421 const HDI::Ril::V1_1::PsRegStatusInfo &psRegStatusInfo) override; 422 int32_t GetOperatorInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 423 const HDI::Ril::V1_1::OperatorInfo &operatorInfo) override; 424 int32_t GetNetworkSearchInformationResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 425 const HDI::Ril::V1_1::AvailableNetworkList &availableNetworkList) override; 426 int32_t GetNetworkSelectionModeResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 427 const HDI::Ril::V1_1::SetNetworkModeInfo &setNetworkModeInfo) override; 428 int32_t SetNetworkSelectionModeResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 429 int32_t GetNeighboringCellInfoListResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 430 const HDI::Ril::V1_1::CellListNearbyInfo &cellInfoList) override; 431 int32_t GetCurrentCellInfoResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 432 const HDI::Ril::V1_1::CellListCurrentInfo &cellInfoList) override; 433 int32_t GetCurrentCellInfoResponse_1_1(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 434 const HDI::Ril::V1_1::CellListCurrentInfo_1_1 &cellListCurrentInfo) override; 435 int32_t SetPreferredNetworkResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 436 int32_t GetPreferredNetworkResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 437 const HDI::Ril::V1_1::PreferredNetworkTypeInfo &preferredNetworkTypeInfo) override; 438 int32_t GetPhysicalChannelConfigResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 439 const HDI::Ril::V1_1::ChannelConfigInfoList &channelConfigInfoList) override; 440 int32_t SetLocateUpdatesResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 441 int32_t SetNotificationFilterResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 442 int32_t SetDeviceStateResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 443 int32_t SetNrOptionModeResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 444 int32_t GetNrOptionModeResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t mode) override; 445 int32_t GetRrcConnectionStateResponse( 446 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t rrcConnectionState) override; 447 int32_t GetRrcConnectionStateUpdated( 448 const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t state) override; 449 450 // Sms 451 int32_t NewSmsNotify(const HDI::Ril::V1_1::HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 452 const HDI::Ril::V1_1::SmsMessageInfo &smsMessageInfo) override; 453 int32_t NewCdmaSmsNotify(const HDI::Ril::V1_1::HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 454 const HDI::Ril::V1_1::SmsMessageInfo &smsMessageInfo) override; 455 int32_t SmsStatusReportNotify(const HDI::Ril::V1_1::HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 456 const HDI::Ril::V1_1::SmsMessageInfo &smsMessageInfo) override; 457 int32_t NewSmsStoredOnSimNotify(const HDI::Ril::V1_1::HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 458 int32_t recordNumber, int32_t indicationType) override; 459 int32_t CBConfigNotify(const HDI::Ril::V1_1::HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 460 const HDI::Ril::V1_1::CBConfigReportInfo &cellBroadConfigReportInfo) override; 461 int32_t SendGsmSmsResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 462 const HDI::Ril::V1_1::SendSmsResultInfo &sendSmsResultInfo) override; 463 int32_t SendCdmaSmsResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 464 const HDI::Ril::V1_1::SendSmsResultInfo &sendSmsResultInfo) override; 465 int32_t AddSimMessageResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 466 int32_t DelSimMessageResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 467 int32_t UpdateSimMessageResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 468 int32_t AddCdmaSimMessageResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 469 int32_t DelCdmaSimMessageResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 470 int32_t UpdateCdmaSimMessageResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 471 int32_t SetSmscAddrResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 472 int32_t GetSmscAddrResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 473 const HDI::Ril::V1_1::ServiceCenterAddress &serviceCenterAddress) override; 474 int32_t SetCBConfigResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 475 int32_t GetCBConfigResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 476 const HDI::Ril::V1_1::CBConfigInfo &cellBroadcastInfo) override; 477 int32_t SetCdmaCBConfigResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 478 int32_t GetCdmaCBConfigResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 479 const HDI::Ril::V1_1::CdmaCBConfigInfo &cdmaCBConfigInfo) override; 480 int32_t SendSmsMoreModeResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, 481 const HDI::Ril::V1_1::SendSmsResultInfo &sendSmsResultInfo) override; 482 int32_t SendSmsAckResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; 483 484 int32_t CommonErrorResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo) override; GetSerialId()485 int32_t GetSerialId() 486 { 487 currentSerialId_ = rand() % RAND_MAX; 488 return currentSerialId_; 489 } IsReady(int32_t slotId)490 bool IsReady(int32_t slotId) 491 { 492 return simState_[slotId] != 0; 493 } GetCurrentChannelId()494 int32_t GetCurrentChannelId() 495 { 496 return currentChannelId_; 497 } 498 GetSmscAddr()499 std::string GetSmscAddr() 500 { 501 return smscAddr_; 502 } 503 504 private: 505 std::map<int32_t, int32_t> simState_; 506 std::mutex callbackMutex_; 507 std::condition_variable cv_; 508 int32_t currentChannelId_ = 1; 509 std::string smscAddr_ = "00"; 510 HdiId hdiId_; 511 HDI::Ril::V1_1::RilRadioResponseInfo resultInfo_; 512 int32_t currentSerialId_ = 0; 513 }; 514 } // namespace Telephony 515 } // namespace OHOS 516 #endif // OHOS_RIL_CALLBACK_TEST_H