• 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_NETWORK_SELECTION_H
17 #define NETWORK_SEARCH_INCLUDE_NETWORK_SELECTION_H
18 
19 #include <memory>
20 #include <set>
21 
22 #include "event_handler.h"
23 #include "tel_ril_network_parcel.h"
24 #include "iremote_stub.h"
25 
26 namespace OHOS {
27 namespace Telephony {
28 class NetworkSearchManager;
29 class NetworkSelection {
30 public:
31     NetworkSelection(std::weak_ptr<NetworkSearchManager> networkSearchManager, int32_t slotId);
32     virtual ~NetworkSelection() = default;
33     void ProcessNetworkSearchResult(const AppExecFwk::InnerEvent::Pointer &event) const;
34     void ProcessGetNetworkSelectionMode(const AppExecFwk::InnerEvent::Pointer &event) const;
35     void ProcessSetNetworkSelectionMode(const AppExecFwk::InnerEvent::Pointer &event) const;
36 
37 private:
38     bool AvailNetworkResult(
39         std::shared_ptr<AvailableNetworkList> availNetworkResult, MessageParcel &data, int64_t &index) const;
40     bool SelectModeResult(
41         std::shared_ptr<SetNetworkModeInfo> selectModeResult, MessageParcel &data, int64_t &index) const;
42     bool ResponseInfoOfResult(
43         std::shared_ptr<RadioResponseInfo> responseInfo, MessageParcel &data, int64_t &index) const;
44     bool ResponseInfoOfGet(
45         std::shared_ptr<RadioResponseInfo> responseInfo, MessageParcel &data, int64_t &index) const;
46     bool ResponseInfoOfSet(
47         std::shared_ptr<RadioResponseInfo> responseInfo, MessageParcel &data, int64_t &index) const;
48     static std::string GetCustomName(const AvailableNetworkInfo &info);
49 
50     std::weak_ptr<NetworkSearchManager> networkSearchManager_;
51     int32_t slotId_ = 0;
52     static const std::set<std::string> radioTechStrings_;
53 };
54 } // namespace Telephony
55 } // namespace OHOS
56 #endif // NETWORK_SEARCH_INCLUDE_NETWORK_SELECTION_H
57