• 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 OHOS_WIFI_SUPPLICANT_HAL_INTERFACE_H
17 #define OHOS_WIFI_SUPPLICANT_HAL_INTERFACE_H
18 
19 #include <string>
20 #include "supplicant_event_callback.h"
21 #include "wifi_base_hal_interface.h"
22 #include "wifi_error_no.h"
23 #include "i_wifi_struct.h"
24 
25 namespace OHOS {
26 namespace Wifi {
27 class WifiSupplicantHalInterface : public WifiBaseHalInterface {
28 public:
29     /**
30      * @Description Get the Instance object.
31      *
32      * @return WifiSupplicantHalInterface&
33      */
34     static WifiSupplicantHalInterface &GetInstance(void);
35 
36     /**
37      * @Description Open Supplicant.
38      *
39      * @return WifiErrorNo
40      */
41     WifiErrorNo StartSupplicant(void) const;
42 
43     /**
44      * @Description Close Supplicant.
45      *
46      * @return WifiErrorNo
47      */
48     WifiErrorNo StopSupplicant(void) const;
49 
50     /**
51      * @Description Connect Supplicant.
52      *
53      * @return WifiErrorNo
54      */
55     WifiErrorNo ConnectSupplicant(void) const;
56 
57     /**
58      * @Description Disconnect Supplicant.
59      *
60      * @return WifiErrorNo
61      */
62     WifiErrorNo DisconnectSupplicant(void) const;
63 
64     /**
65      * @Description Request to Supplicant.
66      *
67      * @param request
68      * @return WifiErrorNo
69      */
70     WifiErrorNo RequestToSupplicant(const std::string &request) const;
71 
72     /**
73      * @Description Registers the supplementary event callback function.
74      *
75      * @param callback
76      * @return WifiErrorNo
77      */
78     WifiErrorNo RegisterSupplicantEventCallback(SupplicantEventCallback &callback);
79 
80     /**
81      * @Description Deregisters the supplementary event callback function.
82      *
83      * @return WifiErrorNo
84      */
85     WifiErrorNo UnRegisterSupplicantEventCallback(void);
86 
87     /**
88      * @Description Turn on/off power save mode for the interface.
89      *
90      * @param enable
91      * @return WifiErrorNo
92      */
93     WifiErrorNo SetPowerSave(bool enable) const;
94 
95     /**
96      * @Description Setting the country code.
97      *
98      * @param countryCode
99      * @return WifiErrorNo
100      */
101     WifiErrorNo WpaSetCountryCode(const std::string &countryCode) const;
102 
103     /**
104      * @Description Obtains the country code.
105      *
106      * @param countryCode
107      * @return WifiErrorNo
108      */
109     WifiErrorNo WpaGetCountryCode(std::string &countryCode) const;
110 
111     /**
112      * @Description Get register callback objects
113      *
114      * @return const SupplicantEventCallback& - register callback objects
115      */
116     const SupplicantEventCallback &GetCallbackInst(void) const;
117 
118     /**
119      * @Description  Set suspend mode to wpa
120      *
121      * @param mode - true for suspend mode, false for resume mode
122      *
123      * @Return success: WIFI_OPT_SUCCESS, fail: WIFI_OPT_FAILED
124      */
125     WifiErrorNo WpaSetSuspendMode(bool mode) const;
126 private:
127     SupplicantEventCallback mCallback;
128 };
129 }  // namespace Wifi
130 }  // namespace OHOS
131 
132 #endif