• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 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_IDL_CLIENT_H
17 #define OHOS_WIFI_IDL_CLIENT_H
18 
19 #include <string>
20 #include <vector>
21 #include "wifi_msg.h"
22 #include "wifi_internal_msg.h"
23 #include "wifi_error_no.h"
24 #include "supplicant_event_callback.h"
25 #include "wifi_chip_event_callback.h"
26 #include "wifi_event_callback.h"
27 #include "wifi_ap_event_callback.h"
28 #include "wifi_p2p_event_callback.h"
29 #include "wifi_scan_param.h"
30 #include "wifi_sta_request.h"
31 #include "client.h"
32 #include "i_wifi_chip.h"
33 #include "i_wifi_hotspot_iface.h"
34 #include "i_wifi_struct.h"
35 #include "wifi_global_func.h"
36 #include "wifi_hid2d_msg.h"
37 
38 namespace OHOS {
39 namespace Wifi {
40 class WifiIdlClient {
41 public:
42     /**
43      * @Description Construct a new Wifi Idl Client object.
44      *
45      */
46     WifiIdlClient();
47     /**
48      * @Description Destroy the Wifi Idl Client object.
49      *
50      */
51     ~WifiIdlClient();
52 
53     /**
54      * @Description Init Client.
55      *
56      * @return int - 0 Success, -1 Failed.
57      */
58     int InitClient(void);
59     /**
60      * @Description Exit All Client.
61      *
62      */
63     void ExitAllClient(void);
64     /* ************************ Sta Interface ************************** */
65 
66     /**
67      * @Description Open Wifi.
68      *
69      * @return WifiErrorNo
70      */
71     WifiErrorNo StartWifi(void);
72 
73     /**
74      * @Description Close Wifi.
75      *
76      * @return WifiErrorNo
77      */
78     WifiErrorNo StopWifi(void);
79 
80     /**
81      * @Description Connect Wifi.
82      *
83      * @param networkId
84      * @return WifiErrorNo
85      */
86     WifiErrorNo ReqConnect(int networkId);
87 
88     /**
89      * @Description Reconnect Wifi.
90      *
91      * @return WifiErrorNo
92      */
93     WifiErrorNo ReqReconnect(void);
94 
95     /**
96      * @Description Reassociate Wifi.
97      *
98      * @return WifiErrorNo
99      */
100     WifiErrorNo ReqReassociate(void);
101 
102     /**
103      * @Description Disconnect Wifi.
104      *
105      * @return WifiErrorNo
106      */
107     WifiErrorNo ReqDisconnect(void);
108 
109     /**
110      * @Description Obtaining the STA Support Capability.
111      *
112      * @param capabilities
113      * @return WifiErrorNo
114      */
115     WifiErrorNo GetStaCapabilities(unsigned int &capabilities);
116 
117     /**
118      * @Description Obtaining the MAC Address of a STA.
119      *
120      * @param mac
121      * @return WifiErrorNo
122      */
123     WifiErrorNo GetStaDeviceMacAddress(std::string &mac);
124 
125     /**
126      * @Description Obtains the frequencies supported by a specified
127      *              frequency band.
128      *
129      * @param band
130      * @param frequencies
131      * @return WifiErrorNo
132      */
133     WifiErrorNo GetSupportFrequencies(int band, std::vector<int> &frequencies);
134 
135     /**
136      * @Description Sets the MAC address of the Wi-Fi connection.
137      *
138      * @param mac
139      * @return WifiErrorNo
140      */
141     WifiErrorNo SetConnectMacAddr(const std::string &mac);
142 
143     /**
144      * @Description Sets the MAC address for Wi-Fi scanning.
145      *
146      * @param mac
147      * @return WifiErrorNo
148      */
149     WifiErrorNo SetScanMacAddress(const std::string &mac);
150 
151     /**
152      * @Description Disconnect the BSSID of the last roaming subscriber.
153      *
154      * @param mac
155      * @return WifiErrorNo
156      */
157     WifiErrorNo DisconnectLastRoamingBssid(const std::string &mac);
158 
159     /**
160      * @Description Get total supported feature, and call user can determine whether
161      *              support a feature.
162      *
163      * @param feature
164      * @return WifiErrorNo
165      */
166     WifiErrorNo ReqGetSupportFeature(long &feature);
167 
168     /**
169      * @Description Send instructions to the Wi-Fi driver or chip.
170      *
171      * @param request
172      * @return WifiErrorNo
173      */
174     WifiErrorNo SendRequest(const WifiStaRequest &request);
175 
176     /**
177      * @Description Set the Wi-Fi transmit power.
178      *
179      * @param power
180      * @return WifiErrorNo
181      */
182     WifiErrorNo SetTxPower(int power);
183 
184     /**
185      * @Description Scan by specified parameter.
186      *
187      * @param scanParam
188      * @return WifiErrorNo
189      */
190     WifiErrorNo Scan(const WifiScanParam &scanParam);
191 
192     /**
193      * @Description Obtain the scanning result.
194      *
195      * @param scanInfos
196      * @return WifiErrorNo
197      */
198     WifiErrorNo QueryScanInfos(std::vector<InterScanInfo> &scanInfos);
199 
200     /**
201      * @Description Initiate PNO scanning.
202      *
203      * @param scanParam
204      * @return WifiErrorNo
205      */
206     WifiErrorNo ReqStartPnoScan(const WifiPnoScanParam &scanParam);
207 
208     /**
209      * @Description Stop PNO Scanning.
210      *
211      * @return WifiErrorNo
212      */
213     WifiErrorNo ReqStopPnoScan(void);
214 
215     /**
216      * @Description Deleting a Network.
217      *
218      * @param networkId
219      * @return WifiErrorNo
220      */
221     WifiErrorNo RemoveDevice(int networkId);
222 
223     /**
224      * @Description Clears the network configuration information saved by wpa_supplicant.
225      *
226      * @return WifiErrorNo
227      */
228     WifiErrorNo ClearDeviceConfig(void) const;
229 
230     /**
231      * @Description Request to obtain the next network ID.
232      *
233      * @param networkId
234      * @return WifiErrorNo
235      */
236     WifiErrorNo GetNextNetworkId(int &networkId);
237 
238     /**
239      * @Description Enable a network.
240      *
241      * @param networkId
242      * @return WifiErrorNo
243      */
244     WifiErrorNo ReqEnableNetwork(int networkId);
245 
246     /**
247      * @Description Disable a network.
248      *
249      * @param networkId
250      * @return WifiErrorNo
251      */
252     WifiErrorNo ReqDisableNetwork(int networkId);
253 
254     /**
255      * @Description Get the network.
256      *
257      * @param config
258      * @return WifiErrorNo
259      */
260     WifiErrorNo GetDeviceConfig(WifiIdlGetDeviceConfig &config);
261 
262     /**
263      * @Description Setting the network.
264      *
265      * @param networkId
266      * @param config - Setting Network Parameters.
267      * @return WifiErrorNo
268      */
269     WifiErrorNo SetDeviceConfig(int networkId, const WifiIdlDeviceConfig &config);
270 
271     /**
272      * @Description Set bssid to supplicant.
273      *
274      * @param networkId
275      * @param bssid
276      * @return WifiErrorNo
277      */
278     WifiErrorNo SetWpsBssid(int networkId, const std::string &bssid);
279 
280     /**
281      * @Description Save the network.
282      *
283      * @return WifiErrorNo
284      */
285     WifiErrorNo SaveDeviceConfig(void);
286 
287     /**
288      * @Description Registering the Sta Event Callback.
289      *
290      * @param callback - Registering an Event Callback Function.
291      * @return WifiErrorNo
292      */
293     WifiErrorNo ReqRegisterStaEventCallback(const WifiEventCallback &callback);
294 
295     /**
296      * @Description Enabling WPS in PBC Mode.
297      *
298      * @param config
299      * @return WifiErrorNo
300      */
301     WifiErrorNo ReqStartWpsPbcMode(const WifiIdlWpsConfig &config);
302 
303     /**
304      * @Description Enable PIN mode WPS.
305      *
306      * @param config
307      * @param pinCode
308      * @return WifiErrorNo
309      */
310     WifiErrorNo ReqStartWpsPinMode(const WifiIdlWpsConfig &config, int &pinCode);
311 
312     /**
313      * @Description Close wps.
314      *
315      * @return WifiErrorNo
316      */
317     WifiErrorNo ReqStopWps(void);
318 
319     /**
320      * @Description Obtains the roaming support capability.
321      *
322      * @param capability - Roaming Support Capability.
323      * @return WifiErrorNo
324      */
325     WifiErrorNo ReqGetRoamingCapabilities(WifiIdlRoamCapability &capability);
326 
327     /**
328      * @Description Setting Roaming Configurations.
329      *
330      * @param config
331      * @return WifiErrorNo
332      */
333     WifiErrorNo ReqSetRoamConfig(const WifiIdlRoamConfig &config);
334 
335     /**
336      * @Description Get current connect signal info, rssi, linkspeed, noise ...
337      *
338      * @param endBssid - peer end bssid, i.e. linked ap's bssid
339      * @param info - signal info
340      * @return WifiErrorNo
341      */
342     WifiErrorNo ReqGetConnectSignalInfo(const std::string &endBssid, WifiWpaSignalInfo &info) const;
343 
344     /* -------------------AP Interface-------------------------- */
345 
346     /**
347      * @Description Start Ap.
348      *
349      * @return WifiErrorNo
350      */
351     WifiErrorNo StartAp(int id = 0);
352 
353     /**
354      * @Description Close Ap.
355      *
356      * @return WifiErrorNo
357      */
358     WifiErrorNo StopAp(int id = 0);
359 
360     /**
361      * @Description Setting SoftAP Configurations.
362      *
363      * @param config
364      * @return WifiErrorNo
365      */
366     WifiErrorNo SetSoftApConfig(const HotspotConfig &config, int id = 0);
367 
368     /**
369      * @Description Obtains information about all connected STAs.
370      *
371      * @param result
372      * @return WifiErrorNo
373      */
374     WifiErrorNo GetStationList(std::vector<std::string> &result, int id = 0);
375 
376     /**
377      * @Description To set the blocklist filtering in AP mode to prohibit the MAC
378      *              address connection.
379      *
380      * @param mac - Blocklisted address.
381      * @return WifiErrorNo
382      */
383     WifiErrorNo AddBlockByMac(const std::string &mac, int id = 0);
384 
385     /**
386      * @Description To set blocklist filtering in AP mode and delete a specified MAC
387      *              address from the blocklist.
388      *
389      * @param mac - Blocklisted address.
390      * @return WifiErrorNo
391      */
392     WifiErrorNo DelBlockByMac(const std::string &mac, int id = 0);
393 
394     /**
395      * @Description Disconnect the STA with a specified MAC address.
396      *
397      * @param mac
398      * @return WifiErrorNo
399      */
400     WifiErrorNo RemoveStation(const std::string &mac, int id = 0);
401 
402     /**
403      * @Description Obtains the hotspot frequency supported by a specified frequency band.
404      *
405      * @param band
406      * @param frequencies
407      * @return WifiErrorNo
408      */
409     WifiErrorNo GetFrequenciesByBand(int band, std::vector<int> &frequencies, int id = 0);
410 
411     /**
412      * @Description Listening to Wi-Fi disconnection or connection events
413      *              of the STA in AP mode.
414      *
415      * @param callback
416      * @return WifiErrorNo
417      */
418     WifiErrorNo RegisterApEvent(IWifiApMonitorEventCallback callback, int id = 0) const;
419 
420     /**
421      * @Description Sets the Wi-Fi country code.
422      *
423      * @param code
424      * @return WifiErrorNo
425      */
426     WifiErrorNo SetWifiCountryCode(const std::string &code, int id = 0);
427 
428     /**
429      * @Description Disconnect the STA connection based on the MAC address.
430      *
431      * @param mac
432      * @return WifiErrorNo
433      */
434     WifiErrorNo ReqDisconnectStaByMac(const std::string &mac, int id = 0);
435 
436     /**
437      * @Description Request get the power mode.
438      *
439      * @param mode - The mode of power.
440      * @return WifiErrorNo
441      */
442     WifiErrorNo ReqGetPowerModel(int& model, int id = 0);
443 
444     /**
445      * @Description Request set the power mode.
446      *
447      * @param mode - The mode to set.
448      * @return WifiErrorNo
449      */
450     WifiErrorNo ReqSetPowerModel(const int& model, int id = 0);
451 
452     /* ************************** ChipMode interface **************************** */
453 
454     /**
455      * @Description Obtains the chip object by ID.
456      *
457      * @param id
458      * @param chip
459      * @return WifiErrorNo
460      */
461     WifiErrorNo GetWifiChipObject(int id, IWifiChip &chip);
462 
463     /**
464      * @Description Obtains the Wi-Fi chip ID set.
465      *
466      * @param ids
467      * @return WifiErrorNo
468      */
469     WifiErrorNo GetChipIds(std::vector<int> &ids);
470 
471     /**
472      * @Description Obtains the chip ID.
473      *
474      * @param id
475      * @return WifiErrorNo
476      */
477     WifiErrorNo GetUsedChipId(int &id);
478 
479     /**
480      * @Description Obtains chip capabilities.
481      *
482      * @param capabilities
483      * @return WifiErrorNo
484      */
485     WifiErrorNo GetChipCapabilities(int &capabilities);
486 
487     /**
488      * @Description Obtains the joint mode supported by the chip, for
489      *              example, sta+sta/sta+p2p/sta+ap/sta+nan/ap+nan.
490      *
491      * @param modes
492      * @return WifiErrorNo
493      */
494     WifiErrorNo GetSupportedModes(std::vector<int> &modes);
495 
496     /**
497      * @Description Configure the current joint mode of the chip.
498      *
499      * @param mode
500      * @return WifiErrorNo
501      */
502     WifiErrorNo ConfigRunModes(int mode);
503 
504     /**
505      * @Description Gets the current federation mode.
506      *
507      * @param mode
508      * @return WifiErrorNo
509      */
510     WifiErrorNo GetCurrentMode(int &mode);
511 
512     /**
513      * @Description Registering a Wi-Fi Chip Event.
514      *
515      * @param callback
516      * @return WifiErrorNo
517      */
518     WifiErrorNo RegisterChipEventCallback(WifiChipEventCallback &callback);
519 
520     /**
521      * @Description Requesting the debugging information of the firmware chip.
522      *
523      * @param debugInfo
524      * @return WifiErrorNo
525      */
526     WifiErrorNo RequestFirmwareDebugInfo(std::string &debugInfo);
527 
528     /**
529      * @Description is support DBDC
530      *
531      * @param isSupport
532      * @return WifiErrorNo
533      */
534     WifiErrorNo ReqIsSupportDbdc(bool &isSupport) const;
535 
536     /**
537      * @Description is support CSA
538      *
539      * @param isSupport
540      * @return WifiErrorNo
541      */
542     WifiErrorNo ReqIsSupportCsa(bool &isSupport) const;
543 
544     /**
545      * @Description is support radar detection
546      *
547      * @param isSupport
548      * @return WifiErrorNo
549      */
550     WifiErrorNo ReqIsSupportRadarDetect(bool &isSupport) const;
551 
552     /**
553      * @Description is support DFS channel
554      *
555      * @param isSupport
556      * @return WifiErrorNo
557      */
558     WifiErrorNo ReqIsSupportDfsChannel(bool &isSupport) const;
559 
560     /**
561      * @Description is support indoor channel
562      *
563      * @param isSupport
564      * @return WifiErrorNo
565      */
566     WifiErrorNo ReqIsSupportIndoorChannel(bool &isSupport) const;
567 
568     /* ******************************* Supplicant interface********************** */
569 
570     /**
571      * @Description Starting the Supplementary Service.
572      *
573      * @return WifiErrorNo
574      */
575     WifiErrorNo ReqStartSupplicant(void);
576 
577     /**
578      * @Description Disabling the Supplementary Service.
579      *
580      * @return WifiErrorNo
581      */
582     WifiErrorNo ReqStopSupplicant(void);
583 
584     /**
585      * @Description Connecting to the Supplier.
586      *
587      * @return WifiErrorNo
588      */
589     WifiErrorNo ReqConnectSupplicant(void);
590 
591     /**
592      * @Description Disconnecting the Supply.
593      *
594      * @return WifiErrorNo
595      */
596     WifiErrorNo ReqDisconnectSupplicant(void);
597 
598     /**
599      * @Description Send a request to the supplier.
600      *
601      * @param request
602      * @return WifiErrorNo
603      */
604     WifiErrorNo ReqRequestToSupplicant(const std::string &request);
605 
606     /**
607      * @Description Registers the supplementary event callback function.
608      *
609      * @param callback
610      * @return WifiErrorNo
611      */
612     WifiErrorNo ReqRegisterSupplicantEventCallback(SupplicantEventCallback &callback);
613 
614     /**
615      * @Description Deregisters the supplementary event callback function.
616      *
617      * @return WifiErrorNo
618      */
619     WifiErrorNo ReqUnRegisterSupplicantEventCallback(void);
620 
621     /**
622      * @Description Turn on/off power save mode for the interface.
623      *
624      * @param enable
625      * @return WifiErrorNo
626      */
627     WifiErrorNo ReqSetPowerSave(bool enable);
628 
629     /**
630      * @Description Setting the country code.
631      *
632      * @param countCode
633      * @return WifiErrorNo
634      */
635     WifiErrorNo ReqWpaSetCountryCode(const std::string &countryCode);
636 
637     /**
638      * @Description Obtains the country code.
639      *
640      * @param countCode
641      * @return WifiErrorNo
642      */
643     WifiErrorNo ReqWpaGetCountryCode(std::string &countryCode);
644 
645     /**
646      * @Description Wpa_s disable/enable(0/1) automatic reconnection.
647      *
648      * @param enable
649      * @return WifiErrorNo
650      */
651     WifiErrorNo ReqWpaAutoConnect(int enable);
652 
653 
654     /**
655      * @Description Clearing the wpa Blocklist.
656      *
657      * @return WifiErrorNo
658      */
659     WifiErrorNo ReqWpaBlocklistClear(void);
660 
661     /**
662      * @Description Obtaining the Network List.
663      *
664      * @param networkList
665      * @return WifiErrorNo
666      */
667     WifiErrorNo ReqGetNetworkList(std::vector<WifiWpaNetworkInfo> &networkList);
668 
669     /* ******************************* P2P interface************************** */
670 
671     /**
672      * @Description Open P2p
673      *
674      * @return WifiErrorNo
675      */
676     WifiErrorNo ReqP2pStart(void) const;
677 
678     /**
679      * @Description Close p2p
680      *
681      * @return WifiErrorNo
682      */
683     WifiErrorNo ReqP2pStop(void) const;
684 
685     /**
686      * @Description P2P hal-layer registration event
687      *
688      * @return WifiErrorNo
689      */
690     WifiErrorNo ReqP2pRegisterCallback(const P2pHalCallback &callbacks) const;
691 
692     /**
693      * @Description Send a request for setup wps pbc to the P2P
694      *
695      * @param groupInterface
696      * @param bssid
697      * @return WifiErrorNo
698      */
699     WifiErrorNo ReqP2pSetupWpsPbc(const std::string &groupInterface, const std::string &bssid) const;
700 
701     /**
702      * @Description Enable Wps Pin mode
703      *
704      * @param groupInterface - p2p group
705      * @param address
706      * @param pin - pin code
707      * @param result - when pin is empty, represent use pin display mode, this return pin code
708      * @return WifiErrorNo
709      */
710     WifiErrorNo ReqP2pSetupWpsPin(const std::string &groupInterface, const std::string &address, const std::string &pin,
711         std::string &result) const;
712 
713     /**
714      * @Description Send a request for remove a p2p network to the P2P
715      *
716      * @param networkId
717      * @return WifiErrorNo
718      */
719     WifiErrorNo ReqP2pRemoveNetwork(int networkId) const;
720 
721     /**
722      * @Description Send a request for get p2p network list to the P2P
723      *
724      * @param mapGroups
725      * @return WifiErrorNo
726      */
727     WifiErrorNo ReqP2pListNetworks(std::map<int, WifiP2pGroupInfo> &mapGroups) const;
728 
729     /**
730      * @Description Requesting P2P Setting Device Name
731      *
732      * @param name
733      * @return WifiErrorNo
734      */
735     WifiErrorNo ReqP2pSetDeviceName(const std::string &name) const;
736 
737     /**
738      * @Description Send a request for setting the WPS primary device type in P2P mode
739      *
740      * @param type
741      * @return WifiErrorNo
742      */
743     WifiErrorNo ReqP2pSetWpsDeviceType(const std::string &type) const;
744 
745     /**
746      * @Description Send a request for setting the WPS secondary device type in P2P mode
747      *
748      * @param type
749      * @return WifiErrorNo
750      */
751     WifiErrorNo ReqP2pSetWpsSecondaryDeviceType(const std::string &type) const;
752 
753     /**
754      * @Description Send a request for setting the WPS configuration method to the P2P.
755      *
756      * @param config
757      * @return WifiErrorNo
758      */
759     WifiErrorNo ReqP2pSetWpsConfigMethods(const std::string &config) const;
760 
761     /**
762      * @Description Send a P2P request for setting the SSID suffix
763      *
764      * @param postfixName
765      * @return WifiErrorNo
766      */
767     WifiErrorNo ReqP2pSetSsidPostfixName(const std::string &postfixName) const;
768 
769     /**
770      * @Description Send a request for set group max idle to the P2P
771      *
772      * @param groupInterface
773      * @param time
774      * @return WifiErrorNo
775      */
776     WifiErrorNo ReqP2pSetGroupMaxIdle(const std::string &groupInterface, size_t time) const;
777 
778     /**
779      * @Description Send a request for set power save to the P2P
780      *
781      * @param groupInterface
782      * @param enable
783      * @return WifiErrorNo
784      */
785     WifiErrorNo ReqP2pSetPowerSave(const std::string &groupInterface, bool enable) const;
786 
787     /**
788      * @Description enable/disable Wi-Fi Display
789      *
790      * @param enable
791      * @return WifiErrorNo
792      */
793     WifiErrorNo ReqP2pSetWfdEnable(bool enable) const;
794 
795     /**
796      * @Description Send a request for set Wi-Fi Display config
797      *
798      * @param config
799      * @return WifiErrorNo
800      */
801     WifiErrorNo ReqP2pSetWfdDeviceConfig(const std::string &config) const;
802 
803     /**
804      * @Description Send a request for start p2p find to the P2P
805      *
806      * @param timeout
807      * @return WifiErrorNo
808      */
809     WifiErrorNo ReqP2pStartFind(size_t timeout) const;
810 
811     /**
812      * @Description Send a request for stop p2p find to the P2P
813      *
814      * @return WifiErrorNo
815      */
816     WifiErrorNo ReqP2pStopFind() const;
817 
818     /**
819      * @Description Send a request for set ext listen to the P2P
820      *
821      * @param enable
822      * @param period
823      * @param interval
824      * @return WifiErrorNo
825      */
826     WifiErrorNo ReqP2pSetExtListen(bool enable, size_t period, size_t interval) const;
827 
828     /**
829      * @Description Send a request for set listen channel to the P2P
830      *
831      * @param channel
832      * @param regClass
833      * @return WifiErrorNo
834      */
835     WifiErrorNo ReqP2pSetListenChannel(size_t channel, unsigned char regClass) const;
836 
837     /**
838      * @Description Send a request for flush to the P2P.
839      *
840      * @return WifiErrorNo
841      */
842     WifiErrorNo ReqP2pFlush() const;
843 
844     /**
845      * @Description Send a request for connect to the P2P
846      *
847      * @param config
848      * @param isJoinExistingGroup
849      * @param pin
850      * @return WifiErrorNo
851      */
852     WifiErrorNo ReqP2pConnect(const WifiP2pConfigInternal &config, bool isJoinExistingGroup, std::string &pin) const;
853 
854     /**
855      * @Description Send a request for cancel connect to the P2P
856      *
857      * @return WifiErrorNo
858      */
859     WifiErrorNo ReqP2pCancelConnect() const;
860 
861     /**
862      * @Description Send a request for Provision Discovery to the P2P
863      *
864      */
865     WifiErrorNo ReqP2pProvisionDiscovery(const WifiP2pConfigInternal &config) const;
866 
867     /**
868      * @Description Send a request for add a P2P group to the P2P
869      *
870      * @param isPersistent
871      * @param networkId
872      * @param freq
873      * @return WifiErrorNo
874      */
875     WifiErrorNo ReqP2pAddGroup(bool isPersistent, int networkId, int freq) const;
876 
877     /**
878      * @Description Send a request for remove group to the P2P
879      *
880      * @param groupInterface
881      * @return WifiErrorNo
882      */
883     WifiErrorNo ReqP2pRemoveGroup(const std::string &groupInterface) const;
884 
885     /**
886      * @Description Send a request for invite to the P2P
887      *
888      * @return WifiErrorNo
889      */
890     WifiErrorNo ReqP2pInvite(const WifiP2pGroupInfo &group, const std::string &deviceAddr) const;
891 
892     /**
893      * @Description Send a request for reinvoke to the P2P
894      *
895      * @param networkId
896      * @param deviceAddr
897      * @return WifiErrorNo
898      */
899     WifiErrorNo ReqP2pReinvoke(int networkId, const std::string &deviceAddr) const;
900 
901     /**
902      * @Description Send a request for get device address to the P2P.
903      *
904      * @param deviceAddress
905      * @return WifiErrorNo
906      */
907     WifiErrorNo ReqP2pGetDeviceAddress(std::string &deviceAddress) const;
908 
909     /**
910      * @Description Send a request for get group capability to the P2P
911      *
912      * @param deviceAddress
913      * @param cap
914      * @return WifiErrorNo
915      */
916     WifiErrorNo ReqP2pGetGroupCapability(const std::string &deviceAddress, uint32_t &cap) const;
917 
918     /**
919      * @Description Send a request for add service to the P2P
920      *
921      * @param WifiP2pServiceInfo
922      * @return WifiErrorNo
923      */
924     WifiErrorNo ReqP2pAddService(const WifiP2pServiceInfo &info) const;
925 
926     /**
927      * @Description Send a request for remove service to the P2P
928      *
929      * @param RemoveService
930      * @return WifiErrorNo
931      */
932     WifiErrorNo ReqP2pRemoveService(const WifiP2pServiceInfo &info) const;
933 
934     /**
935      * @Description Send a request for flush service to the P2P
936      *
937      * @return WifiErrorNo
938      */
939     WifiErrorNo ReqP2pFlushService() const;
940 
941     /**
942      * @Description Send a request for save config to the P2P
943      *
944      * @return WifiErrorNo
945      */
946     WifiErrorNo ReqP2pSaveConfig() const;
947 
948     /**
949      * @Description Send a request for request service discovery to the P2P
950      *
951      * @param macAddr
952      * @param queryMsg
953      * @return WifiErrorNo
954      */
955     WifiErrorNo ReqP2pReqServiceDiscovery(
956         const std::string &deviceAddress, const std::vector<unsigned char> &tlvs, std::string &reqID) const;
957 
958     /**
959      * @Description Send a request for cancel request service discovery to the P2P
960      *
961      * @param id
962      * @return WifiErrorNo
963      */
964     WifiErrorNo ReqP2pCancelServiceDiscovery(const std::string &id) const;
965 
966     /**
967      * @Description set enable/disable using random mac address
968      *
969      * @param enable
970      * @return WifiErrorNo
971      */
972     WifiErrorNo ReqP2pSetRandomMac(bool enable) const;
973 
974     /**
975      * @Description Send a request for set the miracast type to the P2P
976      *
977      * @param type
978      * @return WifiErrorNo
979      */
980     WifiErrorNo ReqP2pSetMiracastType(int type) const;
981 
982     /**
983      * @Description Set the Persistent Reconnect mode.
984      *
985      * @param mode
986      * @return WifiErrorNo
987      */
988     WifiErrorNo ReqSetPersistentReconnect(int mode) const;
989 
990     /**
991      * @Description
992      *
993      * @param deviceAddress
994      * @param frequency
995      * @param dialogToken
996      * @param tlvs
997      * @param tlvsLength
998      * @return WifiErrorNo
999      */
1000     WifiErrorNo ReqRespServiceDiscovery(
1001         const WifiP2pDevice &device, int frequency, int dialogToken, const std::vector<unsigned char> &tlvs) const;
1002 
1003     /**
1004      * @Description Set P2p server discovery external.
1005      *
1006      * @param isExternalProcess
1007      * @return WifiErrorNo
1008      */
1009     WifiErrorNo ReqSetServiceDiscoveryExternal(bool isExternalProcess) const;
1010 
1011      /**
1012      * @Description Show information about known P2P peer
1013      *
1014      * @param deviceAddress
1015      * @param device
1016      * @return WifiErrorNo
1017      */
1018     WifiErrorNo ReqGetP2pPeer(const std::string &deviceAddress, WifiP2pDevice &device) const;
1019 
1020     /**
1021      * @Description Obtains the P2P frequency supported by a specified frequency band.
1022      *
1023      * @param band - Frequency band.
1024      * @param frequencies - Frequency list.
1025      * @return WifiErrorNo
1026      */
1027     WifiErrorNo ReqP2pGetSupportFrequencies(int band, std::vector<int> &frequencies) const;
1028 
1029     /**
1030      * @Description Setting the P2P group config.
1031      *
1032      * @param networkId
1033      * @param config
1034      * @return WifiErrorNo
1035      */
1036     WifiErrorNo ReqP2pSetGroupConfig(int networkId, const IdlP2pGroupConfig &config) const;
1037 
1038     /**
1039      * @Description Getting the P2P group config.
1040      *
1041      * @param networkId
1042      * @param config
1043      * @return WifiErrorNo
1044      */
1045     WifiErrorNo ReqP2pGetGroupConfig(int networkId, IdlP2pGroupConfig &config) const;
1046 
1047     /**
1048      * @Description Request to obtain the next network ID.
1049      *
1050      * @param networkId
1051      * @return WifiErrorNo
1052      */
1053     WifiErrorNo ReqP2pAddNetwork(int &networkId) const;
1054 
1055     /**
1056      * @Description Send a request for hid2d connect
1057      *
1058      * @param config
1059      * @return WifiErrorNo
1060      */
1061     WifiErrorNo ReqP2pHid2dConnect(const Hid2dConnectConfig &config) const;
1062 
1063     /**
1064      * @Description Send suspend mode to wpa
1065      *
1066      * @param mode: true for suspend, false for resume
1067      * @return WifiErrorNo
1068      */
1069     WifiErrorNo ReqWpaSetSuspendMode(bool mode) const;
1070 public:
1071     RpcClient *pRpcClient;
1072 
1073 private:
1074     char **ConVectorToCArrayString(const std::vector<std::string> &vec) const;
1075     WifiErrorNo ConvertPnoScanParam(const WifiPnoScanParam &param, PnoScanSettings *pSettings) const;
1076     int PushDeviceConfigString(SetNetworkConfig *pConfig, DeviceConfigType type, const std::string &msg) const;
1077     int PushDeviceConfigInt(SetNetworkConfig *pConfig, DeviceConfigType type, int i) const;
1078     int PushDeviceConfigAuthAlgorithm(SetNetworkConfig *pConfig, DeviceConfigType type, unsigned int alg) const;
1079     WifiErrorNo CheckValidDeviceConfig(const WifiIdlDeviceConfig &config) const;
1080     int PushP2pGroupConfigString(P2pGroupConfig *pConfig, P2pGroupConfigType type, const std::string &str) const;
1081     int PushP2pGroupConfigInt(P2pGroupConfig *pConfig, P2pGroupConfigType type, int i) const;
1082 };
1083 }  // namespace Wifi
1084 }  // namespace OHOS
1085 
1086 #endif