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_HAL_CRPC_P2P_H 17 #define OHOS_WIFI_HAL_CRPC_P2P_H 18 19 #include "server.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 /** 25 * @Description Enable P2P 26 * 27 * @param server - Pointer to the global structure of the communication server. 28 * @param context - Pointer to the global communication context structure of the server. 29 * @return int - 0 Success, -1 Failed. 30 */ 31 int RpcP2pStart(RpcServer *server, Context *context); 32 33 /** 34 * @Description Disabling P2P 35 * 36 * @param server - Pointer to the global structure of the communication server. 37 * @param context - Pointer to the global communication context structure of the server. 38 * @return int - 0 Success, -1 Failed. 39 */ 40 int RpcP2pStop(RpcServer *server, Context *context); 41 42 /** 43 * @Description Setting Random MAC Address 44 * 45 * @param server - Pointer to the global structure of the communication server. 46 * @param context - Pointer to the global communication context structure of the server. 47 * @return int - 0 Success, -1 Failed. 48 */ 49 int RpcP2pSetRandomMac(RpcServer *server, Context *context); 50 51 /** 52 * @Description Sets the WPS device name. 53 * 54 * @param server - Pointer to the global structure of the communication server. 55 * @param context - Pointer to the global communication context structure of the server. 56 * @return int - 0 Success, -1 Failed. 57 */ 58 int RpcP2pSetDeviceName(RpcServer *server, Context *context); 59 60 /** 61 * @Description Sets the P2P SSID suffix. 62 * 63 * @param server - Pointer to the global structure of the communication server. 64 * @param context - Pointer to the global communication context structure of the server. 65 * @return int - 0 Success, -1 Failed. 66 */ 67 int RpcP2pSetSsidPostfixName(RpcServer *server, Context *context); 68 69 /** 70 * @Description Setting the WPS Primary Device Type 71 * 72 * @param server - Pointer to the global structure of the communication server. 73 * @param context - Pointer to the global communication context structure of the server. 74 * @return int - 0 Success, -1 Failed. 75 */ 76 int RpcP2pSetWpsDeviceType(RpcServer *server, Context *context); 77 78 /** 79 * @Description Setting the WPS Secondary Device Type 80 * 81 * @param server - Pointer to the global structure of the communication server. 82 * @param context - Pointer to the global communication context structure of the server. 83 * @return int - 0 Success, -1 Failed. 84 */ 85 int RpcP2pSetWpsSecondaryDeviceType(RpcServer *server, Context *context); 86 87 /** 88 * @Description Setting WPS config methods 89 * 90 * @param server - Pointer to the global structure of the communication server. 91 * @param context - Pointer to the global communication context structure of the server. 92 * @return int - 0 Success, -1 Failed. 93 */ 94 int RpcP2pSetWpsConfigMethods(RpcServer *server, Context *context); 95 96 /** 97 * @Description Obtains the MAC address of the working device. 98 * 99 * @param server - Pointer to the global structure of the communication server. 100 * @param context - Pointer to the global communication context structure of the server. 101 * @return int - 0 Success, -1 Failed. 102 */ 103 int RpcP2pGetDeviceAddress(RpcServer *server, Context *context); 104 105 /** 106 * @Description flush P2P table and status 107 * 108 * @param server - Pointer to the global structure of the communication server. 109 * @param context - Pointer to the global communication context structure of the server. 110 * @return int - 0 Success, -1 Failed. 111 */ 112 int RpcP2pFlush(RpcServer *server, Context *context); 113 114 /** 115 * @Description Flush all services on the current device. 116 * 117 * @param server - Pointer to the global structure of the communication server. 118 * @param context - Pointer to the global communication context structure of the server. 119 * @return int - 0 Success, -1 Failed. 120 */ 121 int RpcP2pFlushService(RpcServer *server, Context *context); 122 123 /** 124 * @Description Save config. 125 * 126 * @param server - Pointer to the global structure of the communication server. 127 * @param context - Pointer to the global communication context structure of the server. 128 * @return int - 0 Success, -1 Failed. 129 */ 130 int RpcP2pSaveConfig(RpcServer *server, Context *context); 131 132 /** 133 * @Description Enable WPS PBC 134 * 135 * @param server - Pointer to the global structure of the communication server. 136 * @param context - Pointer to the global communication context structure of the server. 137 * @return int - 0 Success, -1 Failed. 138 */ 139 int RpcP2pSetupWpsPbc(RpcServer *server, Context *context); 140 141 /** 142 * @Description Enable WPS PIN 143 * 144 * @param server - Pointer to the global structure of the communication server. 145 * @param context - Pointer to the global communication context structure of the server. 146 * @return int - 0 Success, -1 Failed. 147 */ 148 int RpcP2pSetupWpsPin(RpcServer *server, Context *context); 149 150 /** 151 * @Description Remove p2p Network. 152 * 153 * @param server - Pointer to the global structure of the communication server. 154 * @param context - Pointer to the global communication context structure of the server. 155 * @return int - 0 Success, -1 Failed. 156 */ 157 int RpcP2pRemoveNetwork(RpcServer *server, Context *context); 158 159 /** 160 * @Description Get network list. 161 * 162 * @param server - Pointer to the global structure of the communication server. 163 * @param context - Pointer to the global communication context structure of the server. 164 * @return int - 0 Success, -1 Failed. 165 */ 166 int RpcP2pListNetworks(RpcServer *server, Context *context); 167 168 /** 169 * @Description Set the maximum idle time of a group. 170 * 171 * @param server - Pointer to the global structure of the communication server. 172 * @param context - Pointer to the global communication context structure of the server. 173 * @return int - 0 Success, -1 Failed. 174 */ 175 int RpcP2pSetGroupMaxIdle(RpcServer *server, Context *context); 176 177 /** 178 * @Description Setting the Power Saving Mode 179 * 180 * @param server - Pointer to the global structure of the communication server. 181 * @param context - Pointer to the global communication context structure of the server. 182 * @return int - 0 Success, -1 Failed. 183 */ 184 int RpcP2pSetPowerSave(RpcServer *server, Context *context); 185 186 /** 187 * @Description Enable or disable Wi-Fi display. 188 * 189 * @param server - Pointer to the global structure of the communication server. 190 * @param context - Pointer to the global communication context structure of the server. 191 * @return int - 0 Success, -1 Failed. 192 */ 193 int RpcP2pSetWfdEnable(RpcServer *server, Context *context); 194 195 /** 196 * @Description Sets Wi-Fi display device information. 197 * 198 * @param server - Pointer to the global structure of the communication server. 199 * @param context - Pointer to the global communication context structure of the server. 200 * @return int - 0 Success, -1 Failed. 201 */ 202 int RpcP2pSetWfdDeviceConfig(RpcServer *server, Context *context); 203 204 /** 205 * @Description Start P2P service discovery. 206 * 207 * @param server - Pointer to the global structure of the communication server. 208 * @param context - Pointer to the global communication context structure of the server. 209 * @return int - 0 Success, -1 Failed. 210 */ 211 int RpcP2pStartFind(RpcServer *server, Context *context); 212 213 /** 214 * @Description Disabling P2P Service Discovery 215 * 216 * @param server - Pointer to the global structure of the communication server. 217 * @param context - Pointer to the global communication context structure of the server. 218 * @return int - 0 Success, -1 Failed. 219 */ 220 int RpcP2pStopFind(RpcServer *server, Context *context); 221 222 /** 223 * @Description Setting the Extended Listening Timing 224 * 225 * @param server - Pointer to the global structure of the communication server. 226 * @param context - Pointer to the global communication context structure of the server. 227 * @return int - 0 Success, -1 Failed. 228 */ 229 int RpcP2pSetExtListen(RpcServer *server, Context *context); 230 231 /** 232 * @Description Setting listen channel 233 * 234 * @param server - Pointer to the global structure of the communication server. 235 * @param context - Pointer to the global communication context structure of the server. 236 * @return int - 0 Success, -1 Failed. 237 */ 238 int RpcP2pSetListenChannel(RpcServer *server, Context *context); 239 240 /** 241 * @Description P2P Connect. 242 * 243 * @param server - Pointer to the global structure of the communication server. 244 * @param context - Pointer to the global communication context structure of the server. 245 * @return int - 0 Success, -1 Failed. 246 */ 247 int RpcP2pConnect(RpcServer *server, Context *context); 248 249 /** 250 * @Description Cancel the ongoing P2P group and join the group. 251 * 252 * @param server - Pointer to the global structure of the communication server. 253 * @param context - Pointer to the global communication context structure of the server. 254 * @return int - 0 Success, -1 Failed. 255 */ 256 int RpcP2pCancelConnect(RpcServer *server, Context *context); 257 258 /** 259 * @Description Provision Discovery. 260 * 261 * @param server - Pointer to the global structure of the communication server. 262 * @param context - Pointer to the global communication context structure of the server. 263 * @return int - 0 Success, -1 Failed. 264 */ 265 int RpcP2pProvisionDiscovery(RpcServer *server, Context *context); 266 267 /** 268 * @Description Add P2P Group. 269 * @param server - Pointer to the global structure of the communication server. 270 * @param context - Pointer to the global communication context structure of the server. 271 * @return int - 0 Success, -1 Failed. 272 */ 273 int RpcP2pAddGroup(RpcServer *server, Context *context); 274 275 /** 276 * @Description Terminate a group. 277 * 278 * @param server - Pointer to the global structure of the communication server. 279 * @param context - Pointer to the global communication context structure of the server. 280 * @return int - 0 Success, -1 Failed. 281 */ 282 int RpcP2pRemoveGroup(RpcServer *server, Context *context); 283 284 /** 285 * @Description Terminate a group. 286 * 287 * @param server - Pointer to the global structure of the communication server. 288 * @param context - Pointer to the global communication context structure of the server. 289 * @return int - 0 Success, -1 Failed. 290 */ 291 int RpcP2pRemoveClient(RpcServer *server, Context *context); 292 293 /** 294 * @Description Invite 295 * 296 * @param server - Pointer to the global structure of the communication server. 297 * @param context - Pointer to the global communication context structure of the server. 298 * @return int - 0 Success, -1 Failed. 299 */ 300 int RpcP2pInvite(RpcServer *server, Context *context); 301 302 /** 303 * @Description Persistent group Reinvoke peer 304 * 305 * @param server - Pointer to the global structure of the communication server. 306 * @param context - Pointer to the global communication context structure of the server. 307 * @return int - 0 Success, -1 Failed. 308 */ 309 int RpcP2pReinvoke(RpcServer *server, Context *context); 310 311 /** 312 * @Description Obtains the capability of the group to which the deviceAddress belongs. 313 * 314 * @param server - Pointer to the global structure of the communication server. 315 * @param context - Pointer to the global communication context structure of the server. 316 * @return int - 0 Success, -1 Failed. 317 */ 318 int RpcP2pGetGroupCapability(RpcServer *server, Context *context); 319 320 /** 321 * @Description Add an UPNP/Bonjour service. 322 * 323 * @param server - Pointer to the global structure of the communication server. 324 * @param context - Pointer to the global communication context structure of the server. 325 * @return int - 0 Success, -1 Fail. 326 */ 327 int RpcP2pAddService(RpcServer *server, Context *context); 328 329 /** 330 * @Description Deleting an UPNP/Bonjour Service 331 * 332 * @param server - Pointer to the global structure of the communication server. 333 * @param context - Pointer to the global communication context structure of the server. 334 * @return int - 0 Success, -1 Fail. 335 */ 336 int RpcP2pRemoveService(RpcServer *server, Context *context); 337 338 /** 339 * @Description Initiate a ServiceDiscovery request. 340 * 341 * @param server - Pointer to the global structure of the communication server. 342 * @param context - Pointer to the global communication context structure of the server. 343 * @return int - 0 Success, -1 Failed. 344 */ 345 int RpcP2pReqServiceDiscovery(RpcServer *server, Context *context); 346 347 /** 348 * @Description Canceling a ServiceDiscovery Request 349 * 350 * @param server - Pointer to the global structure of the communication server. 351 * @param context - Pointer to the global communication context structure of the server. 352 * @return int - 0 Success, -1 Failed. 353 */ 354 int RpcP2pCancelServiceDiscovery(RpcServer *server, Context *context); 355 356 /** 357 * @Description Set the Miracast mode to the driver. 358 * 359 * @param server - Pointer to the global structure of the communication server. 360 * @param context - Pointer to the global communication context structure of the server. 361 * @return int - 0 Success, -1 Failed. 362 */ 363 int RpcP2pSetMiracastType(RpcServer *server, Context *context); 364 365 /** 366 * @Description Set the P2P mode of persistent reconnect. 367 * 368 * @param server - Pointer to the global structure of the communication server. 369 * @param context - Pointer to the global communication context structure of the server. 370 * @return int - 0 Success, -1 Failed. 371 */ 372 int RpcP2pSetPersistentReconnect(RpcServer *server, Context *context); 373 374 /** 375 * @Description P2p response server discovery 376 * 377 * @param server - Pointer to the global structure of the communication server. 378 * @param context - Pointer to the global communication context structure of the server. 379 * @return int - 0 Success, -1 Failed. 380 */ 381 int RpcP2pRespServerDiscovery(RpcServer *server, Context *context); 382 383 /** 384 * @Description P2p Set Service Discovery External 385 * 386 * @param server - Pointer to the global structure of the communication server. 387 * @param context - Pointer to the global communication context structure of the server. 388 * @return int - 0 Success, -1 Failed. 389 */ 390 int RpcP2pSetServDiscExternal(RpcServer *server, Context *context); 391 392 /** 393 * @Description Show information about known P2P peer. 394 * 395 * @param server - Pointer to the global structure of the communication server. 396 * @param context - Pointer to the global communication context structure of the server. 397 * @return int - 0 Success, -1 Failed. 398 */ 399 int RpcP2pGetPeer(RpcServer *server, Context *context); 400 401 /** 402 * @Description Get chba0 frequency. 403 * 404 * @param server - Pointer to the global structure of the communication server. 405 * @param context - Pointer to the global communication context structure of the server. 406 * @return int - 0 Success, -1 Failed. 407 */ 408 int RpcP2pGetChba0Freq(RpcServer *server, Context *context); 409 410 /** 411 * @Description Obtains the frequencies supported by a specified frequency band. 412 * 413 * @param server - Pointer to the global structure of the communication server. 414 * @param context - Pointer to the global communication context structure of the server. 415 * @return int - 0 Success, -1 Failed. 416 */ 417 int RpcP2pGetFrequencies(RpcServer *server, Context *context); 418 419 /** 420 * @Description Setting the P2P Group Configure. 421 * 422 * @param server - Pointer to the global structure of the communication server. 423 * @param context - Pointer to the global communication context structure of the server. 424 * @return int - 0 Success, -1 Failed. 425 */ 426 int RpcP2pSetGroupConfig(RpcServer *server, Context *context); 427 428 /** 429 * @Description Getting the P2P Group Configure. 430 * 431 * @param server - Pointer to the global structure of the communication server. 432 * @param context - Pointer to the global communication context structure of the server. 433 * @return int - 0 Success, -1 Failed. 434 */ 435 int RpcP2pGetGroupConfig(RpcServer *server, Context *context); 436 437 /** 438 * @Description Add Network interface. 439 * 440 * @param server - Pointer to the global structure of the communication server. 441 * @param context - Pointer to the global communication context structure of the server. 442 * @return int - 0 Success, -1 Failed. 443 */ 444 int RpcP2pAddNetwork(RpcServer *server, Context *context); 445 446 /** 447 * @Description P2P Connect. 448 * 449 * @param server - Pointer to the global structure of the communication server. 450 * @param context - Pointer to the global communication context structure of the server. 451 * @return int - 0 Success, -1 Failed. 452 */ 453 int RpcP2pHid2dConnect(RpcServer *server, Context *context); 454 455 #ifdef __cplusplus 456 } 457 #endif 458 #endif