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 TEL_RIL_MODEM_H
17 #define TEL_RIL_MODEM_H
18 
19 #include "tel_ril_modem_parcel.h"
20 #include "tel_ril_base.h"
21 #include "telephony_types.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 class TelRilModem : public TelRilBase {
26 public:
27     TelRilModem(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
28         std::shared_ptr<ObserverHandler> observerHandler, std::shared_ptr<TelRilHandler> handler);
29     ~TelRilModem() = default;
30 
31     int32_t SetRadioStateResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo);
32     int32_t GetRadioStateResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, int32_t state);
33     int32_t ShutDown(const AppExecFwk::InnerEvent::Pointer &response);
34     int32_t ShutDownResponse(const HDI::Ril::V1_1::RilRadioResponseInfo responseInfo);
35     int32_t RadioStateUpdated(int32_t state);
36     int32_t VoiceRadioTechUpdated(const HDI::Ril::V1_1::VoiceRadioTechnology &voiceRadioTechnology);
37     int32_t DsdsModeUpdated(int32_t mode);
38     int32_t SetRadioState(int32_t fun, int32_t rst, const AppExecFwk::InnerEvent::Pointer &response);
39     int32_t GetRadioState(const AppExecFwk::InnerEvent::Pointer &response);
40     int32_t GetImei(const AppExecFwk::InnerEvent::Pointer &response);
41     int32_t GetImeiSv(const AppExecFwk::InnerEvent::Pointer &response);
42     int32_t GetMeid(const AppExecFwk::InnerEvent::Pointer &response);
43     int32_t GetVoiceRadioTechnology(const AppExecFwk::InnerEvent::Pointer &response);
44     int32_t GetBasebandVersion(const AppExecFwk::InnerEvent::Pointer &response);
45     int32_t GetImeiResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &imei);
46     int32_t GetImeiSvResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &imeiSv);
47     int32_t GetMeidResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &meid);
48     int32_t GetVoiceRadioTechnologyResponse(const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo,
49         const HDI::Ril::V1_1::VoiceRadioTechnology &voiceRadioTechnology);
50     int32_t GetBasebandVersionResponse(
51         const HDI::Ril::V1_1::RilRadioResponseInfo &responseInfo, const std::string &basebandVersion);
52     int32_t OnRilAdapterHostDied();
53 
54 public:
55     ModemPowerState radioState_ = ModemPowerState::CORE_SERVICE_POWER_NOT_AVAILABLE;
56 
57 private:
58     void BuildVoiceRadioTechnology(const HDI::Ril::V1_1::VoiceRadioTechnology &voiceRadioTechnology,
59         std::shared_ptr<VoiceRadioTechnology> &mVoiceRadioTechnology);
60 };
61 } // namespace Telephony
62 } // namespace OHOS
63 #endif // TEL_RIL_MODEM_H
64