1 /*
2  * Copyright (c) 2023 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 #ifdef HDI_WPA_INTERFACE_SUPPORT
17 #ifndef OHOS_WIFI_HDI_WPA_CLIENT_H
18 #define OHOS_WIFI_HDI_WPA_CLIENT_H
19 
20 #include <string>
21 #include <vector>
22 #include "wifi_internal_msg.h"
23 #include "wifi_error_no.h"
24 #include "wifi_native_struct.h"
25 #include "wifi_global_func.h"
26 #include "i_wifi_struct.h"
27 #include "wifi_event_callback.h"
28 #include "wifi_ap_event_callback.h"
29 #include "wifi_p2p_event_callback.h"
30 #include "define.h"
31 
32 namespace OHOS {
33 namespace Wifi {
34 class WifiHdiWpaClient {
35 public:
36     WifiHdiWpaClient() = default;
37     ~WifiHdiWpaClient() = default;
38 
39     /* ************************ Sta Interface ************************** */
40     /**
41      * @Description Open Wifi.
42      *
43      * @return WifiErrorNo
44      */
45     WifiErrorNo StartWifi(const std::string &ifaceName, int instId = 0);
46 
47     /**
48      * @Description Close Wifi.
49      *
50      * @return WifiErrorNo
51      */
52     WifiErrorNo StopWifi(int instId = 0);
53 
54     /**
55      * @Description Connect Wifi.
56      *
57      * @param networkId
58      * @return WifiErrorNo
59      */
60     WifiErrorNo ReqConnect(int networkId, const char *ifaceName);
61 
62     /**
63      * @Description Reconnect Wifi.
64      *
65      * @return WifiErrorNo
66      */
67     WifiErrorNo ReqReconnect(const char *ifaceName);
68 
69     /**
70      * @Description Reassociate Wifi.
71      *
72      * @return WifiErrorNo
73      */
74     WifiErrorNo ReqReassociate(const char *ifaceName);
75 
76     /**
77      * @Description Disconnect Wifi.
78      *
79      * @return WifiErrorNo
80      */
81     WifiErrorNo ReqDisconnect(const char *ifaceName);
82 
83     /**
84      * @Description Obtaining the STA Support Capability.
85      *
86      * @param capabilities
87      * @return WifiErrorNo
88      */
89     WifiErrorNo GetStaCapabilities(unsigned int &capabilities);
90 
91     /**
92      * @Description Obtaining the MAC Address of a STA.
93      *
94      * @param mac
95      * @return WifiErrorNo
96      */
97     WifiErrorNo GetStaDeviceMacAddress(std::string &mac, const char *ifaceName);
98 
99     /**
100      * @Description Obtains the frequencies supported by a specified
101      *              frequency band.
102      *
103      * @param band
104      * @param frequencies
105      * @return WifiErrorNo
106      */
107     WifiErrorNo GetSupportFrequencies(int band, std::vector<int> &frequencies);
108 
109     /**
110      * @Description Sets the MAC address of the Wi-Fi connection.
111      *
112      * @param mac
113      * @return WifiErrorNo
114      */
115     WifiErrorNo SetConnectMacAddr(const std::string &mac);
116 
117     /**
118      * @Description Scan by specified parameter.
119      *
120      * @param scanParam
121      * @return WifiErrorNo
122      */
123     WifiErrorNo Scan(const WifiHalScanParam &scanParam);
124 
125     /**
126      * @Description Obtain the scanning result.
127      *
128      * @param scanInfos
129      * @return WifiErrorNo
130      */
131     WifiErrorNo QueryScanInfos(std::vector<InterScanInfo> &scanInfos);
132 
133     /**
134      * @Description Initiate PNO scanning.
135      *
136      * @param scanParam
137      * @return WifiErrorNo
138      */
139     WifiErrorNo ReqStartPnoScan(const WifiHalPnoScanParam &scanParam);
140 
141     /**
142      * @Description Stop PNO Scanning.
143      *
144      * @return WifiErrorNo
145      */
146     WifiErrorNo ReqStopPnoScan(void);
147 
148     /**
149      * @Description Deleting a Network.
150      *
151      * @param networkId
152      * @return WifiErrorNo
153      */
154     WifiErrorNo RemoveDevice(int networkId, const char *ifaceName);
155 
156     /**
157      * @Description Clears the network configuration information saved by wpa_supplicant.
158      *
159      * @return WifiErrorNo
160      */
161     WifiErrorNo ClearDeviceConfig(const char *ifaceName) const;
162 
163     /**
164      * @Description Request to obtain the next network ID.
165      *
166      * @param networkId
167      * @return WifiErrorNo
168      */
169     WifiErrorNo GetNextNetworkId(int &networkId, const char *ifaceName);
170 
171     /**
172      * @Description Enable a network.
173      *
174      * @param networkId
175      * @return WifiErrorNo
176      */
177     WifiErrorNo ReqEnableNetwork(int networkId, const char *ifaceName);
178 
179     /**
180      * @Description Disable a network.
181      *
182      * @param networkId
183      * @return WifiErrorNo
184      */
185     WifiErrorNo ReqDisableNetwork(int networkId, const char *ifaceName);
186 
187     /**
188      * @Description Setting the network.
189      *
190      * @param networkId
191      * @param config - Setting Network Parameters.
192      * @return WifiErrorNo
193      */
194     WifiErrorNo SetDeviceConfig(int networkId, const WifiHalDeviceConfig &config, const char *ifaceName);
195 
196     /**
197      * @Description Set bssid to supplicant.
198      *
199      * @param networkId
200      * @param bssid
201      * @return WifiErrorNo
202      */
203     WifiErrorNo SetBssid(int networkId, const std::string &bssid, const char *ifaceName);
204 
205     /**
206      * @Description Save the network.
207      *
208      * @return WifiErrorNo
209      */
210     WifiErrorNo SaveDeviceConfig(const char *ifaceName);
211 
212     /**
213      * @Description Registering the Sta Event Callback.
214      *
215      * @param callback - Registering an Event Callback Function.
216      * @return WifiErrorNo
217      */
218     WifiErrorNo ReqRegisterStaEventCallback(const WifiEventCallback &callback, const char *ifaceName, int instId);
219 
220     /**
221      * @Description Enabling WPS in PBC Mode.
222      *
223      * @param config
224      * @return WifiErrorNo
225      */
226     WifiErrorNo ReqStartWpsPbcMode(const WifiHalWpsConfig &config, const char *ifaceName);
227 
228     /**
229      * @Description Enable PIN mode WPS.
230      *
231      * @param config
232      * @param pinCode
233      * @return WifiErrorNo
234      */
235     WifiErrorNo ReqStartWpsPinMode(const WifiHalWpsConfig &config, int &pinCode, const char *ifaceName);
236 
237     /**
238      * @Description Close wps.
239      *
240      * @return WifiErrorNo
241      */
242     WifiErrorNo ReqStopWps(const char *ifaceName);
243 
244     /**
245      * @Description Obtains the roaming support capability.
246      *
247      * @param capability - Roaming Support Capability.
248      * @return WifiErrorNo
249      */
250     WifiErrorNo ReqGetRoamingCapabilities(WifiHalRoamCapability &capability);
251 
252     /**
253      * @Description Setting Roaming Configurations.
254      *
255      * @param config
256      * @return WifiErrorNo
257      */
258     WifiErrorNo ReqSetRoamConfig(const WifiHalRoamConfig &config);
259 
260     /**
261      * @Description Get current connect signal info, rssi, linkspeed, noise ...
262      *
263      * @param endBssid - peer end bssid, i.e. linked ap's bssid
264      * @param info - signal info
265      * @return WifiErrorNo
266      */
267     WifiErrorNo ReqGetConnectSignalInfo(const std::string &endBssid, WifiHalWpaSignalInfo &info) const;
268 
269     /**
270      * @Description Wpa_s disable/enable(0/1) automatic reconnection.
271      *
272      * @param enable
273      * @return WifiErrorNo
274      */
275     WifiErrorNo ReqWpaAutoConnect(int enable, const char *ifaceName);
276 
277     /**
278      * @Description Clearing the wpa Blocklist.
279      *
280      * @return WifiErrorNo
281      */
282     WifiErrorNo ReqWpaBlocklistClear(const char *ifaceName);
283 
284     /**
285      * @Description Turn on/off power save mode for the interface.
286      *
287      * @param enable
288      * @return WifiErrorNo
289      */
290     WifiErrorNo ReqSetPowerSave(bool enable, const char *ifaceName);
291 
292     /**
293      * @Description Setting the country code.
294      *
295      * @param countCode
296      * @return WifiErrorNo
297      */
298     WifiErrorNo ReqWpaSetCountryCode(const std::string &countryCode, const char *ifaceName);
299     WifiErrorNo ReqWpaGetCountryCode(std::string &countryCode, const char *ifaceName);
300     /**
301      * @Description Send suspend mode to wpa
302      *
303      * @param mode: true for suspend, false for resume
304      * @return WifiErrorNo
305      */
306     WifiErrorNo ReqWpaSetSuspendMode(bool mode, const char *ifaceName) const;
307     WifiErrorNo GetNetworkList(std::vector<WifiHalWpaNetworkInfo> &networkList, const char *ifaceName);
308     WifiErrorNo GetDeviceConfig(WifiHalGetDeviceConfig &config, const char *ifaceName);
309 
310     /**
311      * @Description Send SIM/AKA/AKA' authentication to wpa
312      *
313      * @param ifName: Interface name
314      * @param cmd: Request message content
315      * @return WifiErrorNo
316      */
317     WifiErrorNo ReqWpaShellCmd(const std::string &ifName, const std::string &cmd);
318 
319     /**
320      * @Description get psk pass phrase
321      *
322      * @param ifName: Interface name
323      * @param psk: psk
324      * @return WifiErrorNo
325      */
326     WifiErrorNo ReqWpaGetPskPassphrase(const std::string &ifName, std::string &psk);
327     void SetWapiConfig(const WifiHalDeviceConfig &config, SetNetworkConfig *conf, int &num);
328 
329     /* ************************ softAp Interface ************************** */
330     /**
331      * @Description Start Ap.
332      *
333      * @return WifiErrorNo
334      */
335     WifiErrorNo StartAp(int id, const std::string &ifaceName);
336 
337     /**
338      * @Description Close Ap.
339      *
340      * @return WifiErrorNo
341      */
342     WifiErrorNo StopAp(int id = 0);
343 
344     /**
345      * @Description Save callback.
346      *
347      * @return WifiErrorNo
348      */
349     WifiErrorNo RegisterApEvent(IWifiApMonitorEventCallback callback, int id = 0) const;
350 
351     /**
352      * @Description Setting SoftAp Configurations.
353      *
354      * @param config
355      * @return WifiErrorNo
356      */
357     WifiErrorNo SetSoftApConfig(const std::string &ifName, const HotspotConfig &config, int id = 0);
358 
359     /**
360      * @Description Obtain information about all connected STAs.
361      *
362      * @param result
363      * @return WifiErrorNo
364      */
365     WifiErrorNo GetStationList(std::vector<std::string> &result, int id = 0);
366 
367      /**
368      * @Description To set the blocked list filtering in AP mode to prohibit the MAC address connection.
369      *
370      * @param mac The mac is going to be added
371      * @return WifiErrorNo
372      */
373     WifiErrorNo AddBlockByMac(const std::string &mac, int id = 0);
374 
375     /**
376      * @Description To set the blocked list filtering in AP mode and delete a specified MAC address
377      *              from the blocked list.
378      *
379      * @param mac The mac is going to be deleted
380      * @return WifiErrorNo
381      */
382     WifiErrorNo DelBlockByMac(const std::string &mac, int id = 0);
383 
384     /**
385      * @Description Disconnect the STA with a specified MAC address.
386      *
387      * @param mac The mac is going to be removed
388      * @return WifiErrorNo
389      */
390     WifiErrorNo RemoveStation(const std::string &mac, int id = 0);
391 
392     /**
393      * @Description Disconnect the STA connection based on the MAC address.
394      *
395      * @param mac The mac is going to be disconnected
396      * @return WifiErrorNo
397      */
398     WifiErrorNo ReqDisconnectStaByMac(const std::string &mac, int id = 0);
399 
400     /* ************************ P2p Interface ************************** */
401     /**
402      * @Description P2P start
403      *
404      * @return WifiErrorNo
405      */
406     WifiErrorNo ReqP2pStart(const std::string &ifaceName, const bool hasPersisentGroup);
407 
408     /**
409      * @Description P2P stop
410      *
411      * @return WifiErrorNo
412      */
413     WifiErrorNo ReqP2pStop();
414 
415     /**
416      * @Description P2P hal-layer registration event
417      *
418      * @return WifiErrorNo
419      */
420     WifiErrorNo ReqP2pRegisterCallback(const P2pHalCallback &callbacks) const;
421 
422     /**
423      * @Description Send a request for setup wps pbc to the P2P
424      *
425      * @param groupInterface
426      * @param bssid
427      * @return WifiErrorNo
428      */
429     WifiErrorNo ReqP2pSetupWpsPbc(const std::string &groupInterface, const std::string &bssid) const;
430 
431     /**
432      * @Description Enable Wps Pin mode
433      *
434      * @param groupInterface - p2p group
435      * @param address
436      * @param pin - pin code
437      * @param result - when pin is empty, represent use pin display mode, this return pin code
438      * @return WifiErrorNo
439      */
440     WifiErrorNo ReqP2pSetupWpsPin(const std::string &groupInterface, const std::string &address, const std::string &pin,
441         std::string &result) const;
442 
443     /**
444      * @Description Send a request for remove a p2p network to the P2P
445      *
446      * @param networkId
447      * @return WifiErrorNo
448      */
449     WifiErrorNo ReqP2pRemoveNetwork(int networkId) const;
450 
451     /**
452      * @Description Send a request for get p2p network list to the P2P
453      *
454      * @param mapGroups
455      * @return WifiErrorNo
456      */
457     WifiErrorNo ReqP2pListNetworks(std::map<int, WifiP2pGroupInfo> &mapGroups) const;
458 
459     /**
460      * @Description Requesting P2P Setting Device Name
461      *
462      * @param name
463      * @return WifiErrorNo
464      */
465     WifiErrorNo ReqP2pSetDeviceName(const std::string &name) const;
466 
467     /**
468      * @Description Send a request for setting the WPS primary device type in P2P mode
469      *
470      * @param type
471      * @return WifiErrorNo
472      */
473     WifiErrorNo ReqP2pSetWpsDeviceType(const std::string &type) const;
474 
475     /**
476      * @Description Send a request for setting the WPS secondary device type in P2P mode
477      *
478      * @param type
479      * @return WifiErrorNo
480      */
481     WifiErrorNo ReqP2pSetWpsSecondaryDeviceType(const std::string &type) const;
482 
483     /**
484      * @Description Send a request for setting the WPS configuration method to the P2P.
485      *
486      * @param config
487      * @return WifiErrorNo
488      */
489     WifiErrorNo ReqP2pSetWpsConfigMethods(const std::string &config) const;
490 
491     /**
492      * @Description Send a P2P request for setting the SSID suffix
493      *
494      * @param postfixName
495      * @return WifiErrorNo
496      */
497     WifiErrorNo ReqP2pSetSsidPostfixName(const std::string &postfixName) const;
498 
499     /**
500      * @Description Send a request for set group max idle to the P2P
501      *
502      * @param groupInterface
503      * @param time
504      * @return WifiErrorNo
505      */
506     WifiErrorNo ReqP2pSetGroupMaxIdle(const std::string &groupInterface, size_t time) const;
507 
508     /**
509      * @Description Send a request for set power save to the P2P
510      *
511      * @param groupInterface
512      * @param enable
513      * @return WifiErrorNo
514      */
515     WifiErrorNo ReqP2pSetPowerSave(const std::string &groupInterface, bool enable) const;
516 
517     /**
518      * @Description enable/disable Wi-Fi Display
519      *
520      * @param enable
521      * @return WifiErrorNo
522      */
523     WifiErrorNo ReqP2pSetWfdEnable(bool enable) const;
524 
525     /**
526      * @Description Send a request for set Wi-Fi Display config
527      *
528      * @param config
529      * @return WifiErrorNo
530      */
531     WifiErrorNo ReqP2pSetWfdDeviceConfig(const std::string &config) const;
532 
533     /**
534      * @Description Send a request for start p2p find to the P2P
535      *
536      * @param timeout
537      * @return WifiErrorNo
538      */
539     WifiErrorNo ReqP2pStartFind(size_t timeout) const;
540 
541     /**
542      * @Description Send a request for stop p2p find to the P2P
543      *
544      * @return WifiErrorNo
545      */
546     WifiErrorNo ReqP2pStopFind() const;
547 
548     /**
549      * @Description Send a request for set ext listen to the P2P
550      *
551      * @param enable
552      * @param period
553      * @param interval
554      * @return WifiErrorNo
555      */
556     WifiErrorNo ReqP2pSetExtListen(bool enable, size_t period, size_t interval) const;
557 
558     /**
559      * @Description Send a request for set listen channel to the P2P
560      *
561      * @param channel
562      * @param regClass
563      * @return WifiErrorNo
564      */
565     WifiErrorNo ReqP2pSetListenChannel(size_t channel, unsigned char regClass) const;
566 
567     /**
568      * @Description Send a request for flush to the P2P.
569      *
570      * @return WifiErrorNo
571      */
572     WifiErrorNo ReqP2pFlush() const;
573 
574     /**
575      * @Description Send a request for connect to the P2P
576      *
577      * @param config
578      * @param isJoinExistingGroup
579      * @param pin
580      * @return WifiErrorNo
581      */
582     WifiErrorNo ReqP2pConnect(const WifiP2pConfigInternal &config, bool isJoinExistingGroup, std::string &pin) const;
583 
584     /**
585      * @Description Send a request for cancel connect to the P2P
586      *
587      * @return WifiErrorNo
588      */
589     WifiErrorNo ReqP2pCancelConnect() const;
590 
591     /**
592      * @Description Send a request for Provision Discovery to the P2P
593      *
594      */
595     WifiErrorNo ReqP2pProvisionDiscovery(const WifiP2pConfigInternal &config) const;
596 
597     /**
598      * @Description Send a request for add a P2P group to the P2P
599      *
600      * @param isPersistent
601      * @param networkId
602      * @param freq
603      * @return WifiErrorNo
604      */
605     WifiErrorNo ReqP2pAddGroup(bool isPersistent, int networkId, int freq) const;
606 
607     /**
608      * @Description Send a request for remove group to the P2P
609      *
610      * @param groupInterface
611      * @return WifiErrorNo
612      */
613     WifiErrorNo ReqP2pRemoveGroup(const std::string &groupInterface) const;
614 
615     /**
616      * @Description Send a request for invite to the P2P
617      *
618      * @return WifiErrorNo
619      */
620     WifiErrorNo ReqP2pInvite(const WifiP2pGroupInfo &group, const std::string &deviceAddr) const;
621 
622     /**
623      * @Description Send a request for reinvoke to the P2P
624      *
625      * @param networkId
626      * @param deviceAddr
627      * @return WifiErrorNo
628      */
629     WifiErrorNo ReqP2pReinvoke(int networkId, const std::string &deviceAddr) const;
630 
631     /**
632      * @Description Send a request for get device address to the P2P.
633      *
634      * @param deviceAddress
635      * @return WifiErrorNo
636      */
637     WifiErrorNo ReqP2pGetDeviceAddress(std::string &deviceAddress) const;
638 
639     /**
640      * @Description Send a request for get group capability to the P2P
641      *
642      * @param deviceAddress
643      * @param cap
644      * @return WifiErrorNo
645      */
646     WifiErrorNo ReqP2pGetGroupCapability(const std::string &deviceAddress, uint32_t &cap) const;
647 
648     /**
649      * @Description Send a request for add service to the P2P
650      *
651      * @param WifiP2pServiceInfo
652      * @return WifiErrorNo
653      */
654     WifiErrorNo ReqP2pAddService(const WifiP2pServiceInfo &info) const;
655 
656     /**
657      * @Description Send a request for remove service to the P2P
658      *
659      * @param RemoveService
660      * @return WifiErrorNo
661      */
662     WifiErrorNo ReqP2pRemoveService(const WifiP2pServiceInfo &info) const;
663 
664     /**
665      * @Description Send a request for flush service to the P2P
666      *
667      * @return WifiErrorNo
668      */
669     WifiErrorNo ReqP2pFlushService() const;
670 
671     /**
672      * @Description Send a request for save config to the P2P
673      *
674      * @return WifiErrorNo
675      */
676     WifiErrorNo ReqP2pSaveConfig() const;
677 
678     /**
679      * @Description Send a request for request service discovery to the P2P
680      *
681      * @param macAddr
682      * @param queryMsg
683      * @return WifiErrorNo
684      */
685     WifiErrorNo ReqP2pReqServiceDiscovery(
686         const std::string &deviceAddress, const std::vector<unsigned char> &tlvs, std::string &reqID) const;
687 
688     /**
689      * @Description Send a request for cancel request service discovery to the P2P
690      *
691      * @param id
692      * @return WifiErrorNo
693      */
694     WifiErrorNo ReqP2pCancelServiceDiscovery(const std::string &id) const;
695 
696     /**
697      * @Description set enable/disable using random mac address
698      *
699      * @param enable
700      * @return WifiErrorNo
701      */
702     WifiErrorNo ReqP2pSetRandomMac(bool enable) const;
703 
704     /**
705      * @Description Send a request for set the miracast type to the P2P
706      *
707      * @param type
708      * @return WifiErrorNo
709      */
710     WifiErrorNo ReqP2pSetMiracastType(int type) const;
711 
712     /**
713      * @Description Set the Persistent Reconnect mode.
714      *
715      * @param mode
716      * @return WifiErrorNo
717      */
718     WifiErrorNo ReqSetPersistentReconnect(int mode) const;
719 
720     /**
721      * @Description
722      *
723      * @param deviceAddress
724      * @param frequency
725      * @param dialogToken
726      * @param tlvs
727      * @param tlvsLength
728      * @return WifiErrorNo
729      */
730     WifiErrorNo ReqRespServiceDiscovery(
731         const WifiP2pDevice &device, int frequency, int dialogToken, const std::vector<unsigned char> &tlvs) const;
732 
733     /**
734      * @Description Set P2p server discovery external.
735      *
736      * @param isExternalProcess
737      * @return WifiErrorNo
738      */
739     WifiErrorNo ReqSetServiceDiscoveryExternal(bool isExternalProcess) const;
740 
741      /**
742      * @Description Show information about known P2P peer
743      *
744      * @param deviceAddress
745      * @param device
746      * @return WifiErrorNo
747      */
748     WifiErrorNo ReqGetP2pPeer(const std::string &deviceAddress, WifiP2pDevice &device) const;
749 
750     /**
751      * @Description Obtains the P2P frequency supported by a specified frequency band.
752      *
753      * @param band - Frequency band.
754      * @param frequencies - Frequency list.
755      * @return WifiErrorNo
756      */
757     WifiErrorNo ReqP2pGetSupportFrequencies(int band, std::vector<int> &frequencies) const;
758 
759     /**
760      * @Description Setting the P2P group config.
761      *
762      * @param networkId
763      * @param config
764      * @return WifiErrorNo
765      */
766     WifiErrorNo ReqP2pSetGroupConfig(int networkId, const HalP2pGroupConfig &config) const;
767 
768     int PushP2pGroupConfigString(P2pGroupConfig *pConfig, P2pGroupConfigType type, const std::string &str) const;
769 
770     int PushP2pGroupConfigInt(P2pGroupConfig *pConfig, P2pGroupConfigType type, int i) const;
771 
772     /**
773      * @Description Getting the P2P group config.
774      *
775      * @param networkId
776      * @param config
777      * @return WifiErrorNo
778      */
779     WifiErrorNo ReqP2pGetGroupConfig(int networkId, HalP2pGroupConfig &config) const;
780 
781     /**
782      * @Description Request to obtain the next network ID.
783      *
784      * @param networkId
785      * @return WifiErrorNo
786      */
787     WifiErrorNo ReqP2pAddNetwork(int &networkId) const;
788 
789     /**
790      * @Description Send a request for hid2d connect
791      *
792      * @param config
793      * @return WifiErrorNo
794      */
795     WifiErrorNo ReqP2pHid2dConnect(const Hid2dConnectConfig &config) const;
796 
797     /**
798      * @Description Send power mode to wpa
799      *
800      * @param mode: true for power, false for resume
801      * @return WifiErrorNo
802      */
803     WifiErrorNo ReqWpaSetPowerMode(bool mode) const;
804     /**
805      * @Description Send power mode to wpa
806      *
807      * @param mode: true for power, false for resume
808      * @return WifiErrorNo
809      */
810     WifiErrorNo DeliverP2pData(int32_t cmdType, int32_t dataType, const std::string& carryData) const;
811 
812     /**
813      * @Description Enable Softap.
814      *
815      * @param id
816      * @return WifiErrorNo
817      */
818     WifiErrorNo EnableAp(int id = 0);
819 
820     /**
821      * @Description register callback for death recipient of native process
822      *
823      * @param id
824      * @return WifiErrorNo
825      */
826     WifiErrorNo ReqRegisterNativeProcessCallback(const std::function<void(int)> &callback) const;
827 
828 private:
829     int PushDeviceConfigString(SetNetworkConfig *pConfig, DeviceConfigType type,
830         const std::string &msg, bool checkEmpty = true) const;
831     int PushDeviceConfigInt(SetNetworkConfig *pConfig, DeviceConfigType type, int i) const;
832     int PushDeviceConfigAuthAlgorithm(SetNetworkConfig *pConfig, DeviceConfigType type, unsigned int alg) const;
833     int PushDeviceConfigParseMask(SetNetworkConfig *pConfig, DeviceConfigType type, unsigned int mask,
834         const std::string parseStr[], int size) const;
835     WifiErrorNo CheckValidDeviceConfig(const WifiHalDeviceConfig &config) const;
836     void GetSsidString(std::string &ssidString, std::vector<uint8_t> &ssidUtf8);
837     bool GetEncryptionString(const HotspotConfig &config, std::string &encryptionString);
838     void GetChannelString(const HotspotConfig &config, std::string &channelString);
839     void GetModeString(const HotspotConfig &config, std::string &modeString);
840     void ConvertToUtf8(const std::string ssid, std::vector<uint8_t> &ssidUtf8);
841     std::string StringCombination(const char* fmt, ...);
842     void AppendStr(std::string &dst, const char* format, va_list args);
843     bool WriteConfigToFile(const std::string &fileContext);
844 };
845 }  // namespace Wifi
846 }  // namespace OHOS
847 #endif
848 #endif