1 /*
2  * Copyright (C) 2021 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_VENDOR_INTERFACE_H
17 #define OHOS_WIFI_HAL_VENDOR_INTERFACE_H
18 
19 #include <stdint.h>
20 #include "wifi_hal_define.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 typedef enum {
27     HAL_VENDOR_SUCCESS = 0,
28     HAL_VENDOR_ERROR_NONE = 1,
29     HAL_VENDOR_ERROR_UNKNOWN = -1,
30     HAL_VENDOR_ERROR_UNINITIALIZED = -2,
31     HAL_VENDOR_ERROR_NOT_SUPPORTED = -3,
32     HAL_VENDOR_ERROR_NOT_AVAILABLE = -4, /* Not available right now, but try later */
33     HAL_VENDOR_ERROR_INVALID_ARGS = -5,
34     HAL_VENDOR_ERROR_INVALID_REQUEST_ID = -6,
35     HAL_VENDOR_ERROR_TIMED_OUT = -7,
36     HAL_VENDOR_ERROR_TOO_MANY_REQUESTS = -8, /* Too many instances of this request */
37     HAL_VENDOR_ERROR_OUT_OF_MEMORY = -9,
38     HAL_VENDOR_ERROR_BUSY = -10,
39 } HalVendorError;
40 
41 typedef struct {
42     HalVendorError (*wifiInitialize)(void);
43     HalVendorError (*wifiCleanUp)(void);
44     HalVendorError (*wifiGetSupportedFeature)(long *feature);
45     HalVendorError (*wifiSetScanningMacAddress)(const char *szMac, int macSize);
46     HalVendorError (*wifiDeauthLastRoamingBssid)(const char *szMac, int macSize);
47     HalVendorError (*wifiSetWifiTxPower)(int32_t power);
48     HalVendorError (*wifiConfigComboModes)(int32_t mode);
49     HalVendorError (*wifiGetComboModes)(int32_t *id);
50     HalVendorError (*wifiRequestFirmwareDebugDump)(unsigned char *bytes, int32_t *size);
51     HalVendorError (*wifiSetMiracastMode)(int32_t mode);
52 } WifiHalVendorFunc;
53 
54 typedef HalVendorError (*pInitHalVendorFunc)(WifiHalVendorFunc *func);
55 /**
56  * @Description Init Default Hal Vendor Func.
57  *
58  * @param func
59  * @return HalVendorError
60  */
61 HalVendorError InitDefaultHalVendorFunc(WifiHalVendorFunc *func);
62 /**
63  * @Description Convert Error Code.
64  *
65  * @param code
66  * @return WifiErrorNo
67  */
68 WifiErrorNo ConvertErrorCode(HalVendorError code);
69 
70 /* vendor hal so need implement these functions */
71 /**
72  * @Description Init Hal Vendor Func.
73  *
74  * @param func
75  * @return HalVendorError
76  */
77 HalVendorError InitHalVendorFunc(WifiHalVendorFunc *func);
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 #endif