1/* 2 * Copyright (c) 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_HDI_WLAN_V1_0_IWLANCALLBACK_H 17#define OHOS_HDI_WLAN_V1_0_IWLANCALLBACK_H 18 19#include <stdbool.h> 20#include <stdint.h> 21#include <hdf_base.h> 22#include "wlan/v1_0/wlan_types.h" 23 24#ifdef __cplusplus 25extern "C" { 26#endif /* __cplusplus */ 27 28struct HdfRemoteService; 29 30#define IWLANCALLBACK_INTERFACE_DESC "ohos.hdi.wlan.v1_0.IWlanCallback" 31 32#define IWLAN_CALLBACK_MAJOR_VERSION 1 33#define IWLAN_CALLBACK_MINOR_VERSION 0 34 35#ifndef HDI_BUFF_MAX_SIZE 36#define HDI_BUFF_MAX_SIZE (1024 * 200) 37#endif 38 39#ifndef HDI_CHECK_VALUE_RETURN 40#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ 41 if ((lv) compare (rv)) { \ 42 return ret; \ 43 } \ 44} while (false) 45#endif 46 47#ifndef HDI_CHECK_VALUE_RET_GOTO 48#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ 49 if ((lv) compare (rv)) { \ 50 ret = value; \ 51 goto table; \ 52 } \ 53} while (false) 54#endif 55 56enum { 57 CMD_WLAN_CALLBACK_GET_VERSION = 0, 58 CMD_WLAN_CALLBACK_RESET_DRIVER_RESULT = 1, 59 CMD_WLAN_CALLBACK_SCAN_RESULT = 2, 60 CMD_WLAN_CALLBACK_WIFI_NETLINK_MESSAGE = 3, 61}; 62 63struct IWlanCallback { 64 int32_t (*ResetDriverResult)(struct IWlanCallback *self, uint32_t event, int32_t code, const char* ifName); 65 66 int32_t (*ScanResult)(struct IWlanCallback *self, uint32_t event, const struct HdfWifiScanResult* scanResult, 67 const char* ifName); 68 69 int32_t (*WifiNetlinkMessage)(struct IWlanCallback *self, const uint8_t* recvMsg, uint32_t recvMsgLen); 70 71 int32_t (*GetVersion)(struct IWlanCallback *self, uint32_t* majorVer, uint32_t* minorVer); 72 73 struct HdfRemoteService* (*AsObject)(struct IWlanCallback *self); 74}; 75 76// no external method used to create client object, it only support ipc mode 77struct IWlanCallback *IWlanCallbackGet(struct HdfRemoteService *remote); 78 79// external method used to release client object, it support ipc and passthrought mode 80void IWlanCallbackRelease(struct IWlanCallback *instance); 81#ifdef __cplusplus 82} 83#endif /* __cplusplus */ 84 85#endif // OHOS_HDI_WLAN_V1_0_IWLANCALLBACK_H