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 WIFI_COMMON_HAL_H 17 #define WIFI_COMMON_HAL_H 18 19 #include "server.h" 20 #include "wifi_hal_struct.h" 21 #include "wifi_hal_define.h" 22 #include "wifi_hal_chba_struct.h" 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 #define WIFI_CMD_STR_LENGTH 512 29 30 typedef struct stWifiWpaChbaInterface WifiWpaChbaInterface; 31 struct stWifiWpaChbaInterface { 32 char ifname[WIFI_IFACE_NAME_MAXLEN]; 33 ChbaSupplicantErrCode (*wpaChbaCliCmdCreateGroup)(WifiWpaChbaInterface *p, int freq); 34 ChbaSupplicantErrCode (*wpaChbaCliCmdRemoveGroup)(WifiWpaChbaInterface *p, const char *ifname); 35 ChbaSupplicantErrCode (*wpaChbaCliCmdConnect)(WifiWpaChbaInterface *p, const ChbaConnectInfo *connect); 36 ChbaSupplicantErrCode (*wpaChbaCliCmdDisConnect)(WifiWpaChbaInterface *p, const char *ifname, const char *address); 37 ChbaSupplicantErrCode (*wpaChbaCliCmdConnectNotify)(WifiWpaChbaInterface *p, const ChbaConnNotifyInfo *connectNotify); 38 }; 39 40 41 /** 42 * @Description Receive the issued string command and send. 43 * 44 * @param sendcmd - send hal common cmd 45 * @return int 0 successful -1 failed 46 */ 47 int SendComCmd(const char* sendcmd); 48 49 /** 50 * @Description send the issued string command. 51 * 52 * @param event - recv common notify 53 * @return int 0 successful 54 */ 55 int HalCallbackNotify(const char* event); 56 57 /** 58 * @Description Get wpa interface about wpachba. 59 * 60 * @return WifiWpaChbaInterface*. 61 */ 62 WifiWpaChbaInterface *GetWifiWpaChbaInterface(); 63 64 /** 65 * @Description Release wpachba interface 66 */ 67 void ReleaseWpaChbaInterface(void); 68 #ifdef __cplusplus 69 } 70 #endif 71 #endif