• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 NETWORK_SEARCH_INCLUDE_RADIO_INFO_H
17 #define NETWORK_SEARCH_INCLUDE_RADIO_INFO_H
18 
19 #include <memory>
20 #include "event_handler.h"
21 #include "hril_types.h"
22 #include "hril_modem_parcel.h"
23 #include "message_parcel.h"
24 #include "network_state.h"
25 #include "telephony_types.h"
26 namespace OHOS {
27 namespace Telephony {
28 class NetworkSearchManager;
29 class RadioInfo {
30 public:
31     RadioInfo(std::weak_ptr<NetworkSearchManager> networkSearchManager, int32_t slotId);
32     virtual ~RadioInfo() = default;
33     void ProcessGetRadioState(const AppExecFwk::InnerEvent::Pointer &event) const;
34     void ProcessSetRadioState(const AppExecFwk::InnerEvent::Pointer &event) const;
35     void RadioFirstPowerOn(std::shared_ptr<NetworkSearchManager> &nsm, ModemPowerState radioState) const;
36     void UpdatePreferredNetwork(std::shared_ptr<NetworkSearchManager> &nsm, ModemPowerState radioState) const;
37     void ProcessGetImei(const AppExecFwk::InnerEvent::Pointer &event) const;
38     void ProcessGetMeid(const AppExecFwk::InnerEvent::Pointer &event) const;
39     void UpdatePhone(RadioTech csRadioTech, const RadioTech &psRadioTech);
40     void SetPhoneType(PhoneType phoneType);
41     PhoneType GetPhoneType() const;
42     void ProcessVoiceTechChange(const AppExecFwk::InnerEvent::Pointer &event);
43     void AirplaneModeChange();
44     int32_t ProcessGetBasebandVersion(const AppExecFwk::InnerEvent::Pointer &event) const;
45     int32_t ProcessSetNrOptionMode(const AppExecFwk::InnerEvent::Pointer &event) const;
46     int32_t ProcessGetNrOptionMode(const AppExecFwk::InnerEvent::Pointer &event) const;
47     int32_t ProcessGetRrcConnectionState(const AppExecFwk::InnerEvent::Pointer &event) const;
48 
49 private:
50     PhoneType RadioTechToPhoneType(RadioTech csRadioTech, const RadioTech &psRadioTech) const;
51     bool WriteRadioStateResponseInfo(
52         int64_t &index, MessageParcel &data, bool result, std::shared_ptr<HRilRadioResponseInfo> &responseInfo) const;
53     bool WriteRadioStateObject(
54         int64_t &index, MessageParcel &data, bool result, std::unique_ptr<HRilRadioStateInfo> &object) const;
55     void UpdateInfoOfSetRadioState(ModemPowerState &radioState, bool result, MessageParcel &data, int64_t index) const;
56     PhoneType phoneType_ = PhoneType::PHONE_TYPE_IS_NONE;
57     std::weak_ptr<NetworkSearchManager> networkSearchManager_;
58     int32_t slotId_ = 0;
59 };
60 } // namespace Telephony
61 } // namespace OHOS
62 #endif // NETWORK_SEARCH_INCLUDE_RADIO_INFO_H
63