• 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_INFORMATION_H
17 #define NETWORK_INFORMATION_H
18 
19 #include "parcel.h"
20 
21 namespace OHOS {
22 namespace Telephony {
23 enum class NetworkPlmnState {
24     NETWORK_PLMN_STATE_UNKNOWN = 0,
25     NETWORK_PLMN_STATE_AVAILABLE = 1,
26     NETWORK_PLMN_STATE_REGISTERED = 2,
27     NETWORK_PLMN_STATE_FORBIDDEN = 3
28 };
29 
30 enum class NetworkRat { NETWORK_GSM_OR_GPRS = 0, NETWORK_WCDMA = 2, NETWORK_LTE = 7 };
31 
32 class NetworkInformation : public Parcelable {
33 public:
34     void SetOperateInformation(const std::string &operatorLongName, const std::string &operatorShortName,
35         const std::string &operatorNumeric, int32_t state, int32_t rat_);
36     int32_t GetNetworkState() const;
37     std::string GetOperatorShortName() const;
38     std::string GetOperatorLongName() const;
39     std::string GetOperatorNumeric() const;
40     int32_t GetRadioTech() const;
41     bool ReadFromParcel(Parcel &parcel);
42     bool Marshalling(Parcel &parcel) const override;
43     static NetworkInformation *Unmarshalling(Parcel &parcel);
44 
45 private:
46     NetworkPlmnState networkPlmnState_ = NetworkPlmnState::NETWORK_PLMN_STATE_UNKNOWN;
47     std::string operatorShortName_;
48     std::string operatorLongName_;
49     std::string operatorNumeric_;
50     NetworkRat rat_ = NetworkRat::NETWORK_GSM_OR_GPRS;
51 };
52 } // namespace Telephony
53 } // namespace OHOS
54 #endif // NETWORK_INFORMATION_H
55