1 /* 2 * Copyright (C) 2021 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_HRIL_MODEM_H 17 #define OHOS_HRIL_MODEM_H 18 19 #include "hril_base.h" 20 #include "hril_modem_parcel.h" 21 22 namespace OHOS { 23 namespace Telephony { 24 class HRilModem : public HRilBase { 25 public: 26 HRilModem(int32_t slotId, IHRilReporter &hrilReporter); 27 virtual ~HRilModem() = default; 28 29 int32_t ShutDown(int32_t serialId); 30 int32_t SetRadioState(int32_t serialId, int32_t fun, int32_t rst); 31 int32_t GetRadioState(int32_t serialId); 32 int32_t GetImei(int32_t serialId); 33 int32_t GetMeid(int32_t serialId); 34 int32_t GetVoiceRadioTechnology(int32_t serialId); 35 int32_t GetBasebandVersion(int32_t serialId); 36 int32_t ShutDownResponse( 37 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 38 int32_t SetRadioStateResponse( 39 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 40 int32_t GetRadioStateResponse( 41 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 42 int32_t GetImeiResponse( 43 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 44 int32_t GetMeidResponse( 45 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 46 int32_t GetVoiceRadioTechnologyResponse( 47 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 48 int32_t GetBasebandVersionResponse( 49 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 50 int32_t RadioStateUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 51 int32_t VoiceRadioTechUpdated(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 52 void AddHandlerToMap(); 53 bool IsModemRespOrNotify(uint32_t code); 54 void RegisterModemFuncs(const HRilModemReq *modemFuncs); 55 56 private: 57 bool IsModemResponse(uint32_t code); 58 bool IsModemNotification(uint32_t code); 59 void BuildIVoiceRadioTechnology( 60 HDI::Ril::V1_0::VoiceRadioTechnology &voiceRadioTech, const HRilVoiceRadioInfo &hRiadioInfo); 61 const HRilModemReq *modemFuncs_ = nullptr; 62 }; 63 } // namespace Telephony 64 } // namespace OHOS 65 #endif // OHOS_HRIL_COMMON_H 66