• 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_STATE_H
17 #define NETWORK_STATE_H
18 
19 #include "parcel.h"
20 #include "network_search_types.h"
21 
22 namespace OHOS {
23 namespace Telephony {
24 class NetworkState : public Parcelable {
25 public:
26     NetworkState();
27     virtual ~NetworkState() = default;
28     void Init();
29     bool operator==(const NetworkState &other) const;
30     bool ReadFromParcel(Parcel &parcel);
31     bool Marshalling(Parcel &parcel) const override;
32     static NetworkState *Unmarshalling(Parcel &parcel);
33     void SetOperatorInfo(const std::string &longName, const std::string &shortName, const std::string &numeric,
34         DomainType domainType);
35     void SetEmergency(bool isEmergency);
36     void SetNetworkType(RadioTech tech, DomainType domainType);
37     void SetRoaming(RoamingType roamingType, DomainType domainType);
38     void SetNetworkState(RegServiceState state, DomainType domainType);
39     void SetNrState(NrState state);
40     void SetCfgTech(RadioTech tech);
41     RegServiceState GetPsRegStatus() const;
42     RegServiceState GetCsRegStatus() const;
43     RoamingType GetPsRoamingStatus() const;
44     RoamingType GetCsRoamingStatus() const;
45     /*
46      * Obtains RAT of the PS domain on the registered network.
47      * @return Returns RAT of the PS domain on the registered network
48      */
49     RadioTech GetPsRadioTech() const;
50     /*
51      * Obtains RAT of the CS domain on the registered network.
52      * @return Returns RAT of the CS domain on the registered network
53      */
54     RadioTech GetCsRadioTech() const;
55     /*
56      * Obtains the operator name in the long alphanumeric format of the registered network.
57      * @return Returns operator name in the long alphanumeric format
58      */
59     std::string GetLongOperatorName() const;
60     /*
61      * Obtains the operator name in the short alphanumeric format of the registered network.
62      * @return Returns operator name in the short alphanumeric format
63      */
64     std::string GetShortOperatorName() const;
65     /*
66      * Obtains the PLMN code of the registered network.
67      * @return Returns the PLMN code
68      */
69     std::string GetPlmnNumeric() const;
70     /*
71      * Obtains the network registration status of the device.
72      * @return Returns the network registration status
73      */
74     RegServiceState GetRegStatus() const;
75     /*
76      * Checks whether this device is allowed to make emergency calls only.
77      * @return Returns the device emergency calls state.
78      */
79     bool IsEmergency() const;
80     /*
81      * Checks whether the device is roaming.
82      * @return Returns roaming state.
83      */
84     bool IsRoaming() const;
85     std::string ToString() const;
86     /*
87      * Obtains the NSA network registration status of the device.
88      * @return Returns nsa state.
89      */
90     NrState GetNrState() const;
91     /*
92      *  Obtains the radio Access technology after config conversion.
93      * @return Returns Access technology .
94      */
95     RadioTech GetCfgTech() const;
96 
97 private:
98     bool isEmergency_;
99     OperatorInformation psOperatorInfo_;
100     OperatorInformation csOperatorInfo_;
101     RoamingType csRoaming_;
102     RoamingType psRoaming_;
103     RegServiceState psRegStatus_;
104     RegServiceState csRegStatus_;
105     RadioTech psRadioTech_;
106     RadioTech csRadioTech_;
107     RadioTech cfgTech_;
108     NrState nrState_;
109 };
110 } // namespace Telephony
111 } // namespace OHOS
112 #endif // NETWORK_STATE_H
113