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 #ifndef OHOS_WIFI_HDI_WPA_P2P_IMPL_H 17 #define OHOS_WIFI_HDI_WPA_P2P_IMPL_H 18 19 #ifdef HDI_WPA_INTERFACE_SUPPORT 20 #include "wifi_hdi_wpa_proxy.h" 21 #include "i_wifi_struct.h" 22 23 enum P2pRemoveGroupEvent { 24 P2P_REMOVE_GROUP_CLIENT = 0, 25 P2P_REJECT, 26 P2P_SET_MIRACAST_SINK_CONFIG, 27 P2P_CREATE_TEMP_GROUP, 28 EVENT_MAX, 29 }; 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 WifiErrorNo HdiWpaP2pStart(const char *ifaceName, const bool hasPersisentGroup); 36 37 WifiErrorNo HdiWpaP2pStop(); 38 39 WifiErrorNo RegisterHdiWpaP2pEventCallback(struct IWpaCallback *callback); 40 41 WifiErrorNo HdiP2pSetSsidPostfixName(const char *name); 42 43 WifiErrorNo HdiP2pSetWpsDeviceType(const char *type); 44 45 WifiErrorNo HdiP2pSetWpsConfigMethods(const char *methods); 46 47 WifiErrorNo HdiP2pSetGroupMaxIdle(const char *groupIfc, int time); 48 49 WifiErrorNo HdiP2pSetWfdEnable(int enable); 50 51 WifiErrorNo HdiP2pSetPersistentReconnect(int status); 52 53 WifiErrorNo HdiP2pSetWpsSecondaryDeviceType(const char *type); 54 55 WifiErrorNo HdiP2pSetupWpsPbc(const char *groupIfc, const char *address); 56 57 WifiErrorNo HdiP2pSetupWpsPin(const char *groupIfc, const char *address, const char *pin, char *result); 58 59 WifiErrorNo HdiP2pSetPowerSave(const char *groupIfc, int enable); 60 61 WifiErrorNo HdiP2pSetDeviceName(const char *name); 62 63 WifiErrorNo HdiP2pSetWfdDeviceConfig(const char *config); 64 65 WifiErrorNo HdiP2pSetRandomMac(int enable); 66 67 WifiErrorNo HdiP2pStartFind(int timeout); 68 69 WifiErrorNo HdiP2pSetExtListen(int enable, int period, int interval); 70 71 WifiErrorNo HdiP2pSetListenChannel(int channel, int regClass); 72 73 WifiErrorNo HdiP2pProvisionDiscovery(const char *peerBssid, int mode); 74 75 WifiErrorNo HdiP2pAddGroup(int isPersistent, int networkId, int freq); 76 77 WifiErrorNo HdiP2pAddService(struct HdiP2pServiceInfo *info); 78 79 WifiErrorNo HdiP2pRemoveService(struct HdiP2pServiceInfo *info); 80 81 WifiErrorNo HdiP2pStopFind(); 82 83 WifiErrorNo HdiP2pFlush(); 84 85 WifiErrorNo HdiP2pFlushService(); 86 87 WifiErrorNo HdiP2pRemoveNetwork(int networkId); 88 89 WifiErrorNo HdiP2pSetSingleConfig(int networkId, const char *key, const char *value); 90 91 WifiErrorNo HdiP2pSetGroupConfig(int networkId, P2pGroupConfig *pConfig, int size); 92 93 WifiErrorNo HdiP2pInvite(const char *peerBssid, const char *goBssid, const char *ifname); 94 95 WifiErrorNo HdiP2pReinvoke(int networkId, const char *bssid); 96 97 WifiErrorNo HdiP2pGetDeviceAddress(char *deviceAddress, int size); 98 99 WifiErrorNo HdiP2pReqServiceDiscovery(struct HdiP2pReqService *reqService, char *replyDisc, int size); 100 101 WifiErrorNo HdiP2pCancelServiceDiscovery(const char *id); 102 103 WifiErrorNo HdiP2pRespServerDiscovery(struct HdiP2pServDiscReqInfo *info); 104 105 WifiErrorNo HdiP2pConnect(P2pConnectInfo *info, char *replyPin, int size); 106 107 WifiErrorNo HdiP2pHid2dConnect(struct Hid2dConnectInfo *info); 108 109 WifiErrorNo HdiP2pRemoveGroupClient(const char *deviceMac, const char *ifName); 110 111 WifiErrorNo HdiP2pSetServDiscExternal(int mode); 112 113 WifiErrorNo HdiP2pRemoveGroup(const char *groupName); 114 115 WifiErrorNo HdiP2pCancelConnect(); 116 117 WifiErrorNo HdiP2pGetGroupConfig(int networkId, char *param, char *value); 118 119 WifiErrorNo HdiP2pAddNetwork(int *networkId); 120 121 WifiErrorNo HdiP2pGetPeer(const char *bssid, struct HdiP2pDeviceInfo *info); 122 123 WifiErrorNo HdiP2pGetGroupCapability(const char *bssid, int cap); 124 125 WifiErrorNo HdiP2pListNetworks(struct HdiP2pNetworkList *infoList); 126 127 WifiErrorNo HdiP2pSaveConfig(); 128 129 WifiErrorNo HdiDeliverP2pData(int32_t cmdType, int32_t dataType, const char *carryData); 130 131 void ReleaseP2pCallback(void); 132 133 WifiErrorNo HdiP2pReject(const char *bssid); 134 135 WifiErrorNo HdiSetMiracastSinkConfig(const char *config); 136 137 WifiErrorNo HdiP2pTempGroupAdd(int freq); 138 #ifdef __cplusplus 139 } 140 #endif 141 #endif 142 #endif