13d0407baSopenharmony_ci/* 23d0407baSopenharmony_ci * Copyright (c) 2022 FuZhou Lockzhiner Electronic Co., Ltd. All rights reserved. 33d0407baSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 43d0407baSopenharmony_ci * you may not use this file except in compliance with the License. 53d0407baSopenharmony_ci * You may obtain a copy of the License at 63d0407baSopenharmony_ci * 73d0407baSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 83d0407baSopenharmony_ci * 93d0407baSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 103d0407baSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 113d0407baSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 123d0407baSopenharmony_ci * See the License for the specific language governing permissions and 133d0407baSopenharmony_ci * limitations under the License. 143d0407baSopenharmony_ci */ 153d0407baSopenharmony_ci 163d0407baSopenharmony_ci/** 173d0407baSopenharmony_ci * @addtogroup Lockzhiner 183d0407baSopenharmony_ci * 193d0407baSopenharmony_ci * @file wifi.h 203d0407baSopenharmony_ci */ 213d0407baSopenharmony_ci 223d0407baSopenharmony_ci#ifndef LZ_HARDWARE_WIFI_H 233d0407baSopenharmony_ci#define LZ_HARDWARE_WIFI_H 243d0407baSopenharmony_ci 253d0407baSopenharmony_ci#define WIFI_MAX_SSID_LEN 33 // 32 + \0 263d0407baSopenharmony_ci#define WIFI_MAC_LEN 6 273d0407baSopenharmony_ci#define WIFI_MAX_KEY_LEN 65 // 64 + \0 283d0407baSopenharmony_ci 293d0407baSopenharmony_citypedef struct _WifiScanResult { 303d0407baSopenharmony_ci /** Service set ID (SSID). For its length. */ 313d0407baSopenharmony_ci char ssid[WIFI_MAX_SSID_LEN]; 323d0407baSopenharmony_ci /** Basic service set ID (BSSID). For its length. */ 333d0407baSopenharmony_ci unsigned char bssid[WIFI_MAC_LEN]; 343d0407baSopenharmony_ci /** Security type. For details. */ 353d0407baSopenharmony_ci int securityType; 363d0407baSopenharmony_ci /** Received signal strength indicator (RSSI) */ 373d0407baSopenharmony_ci int rssi; 383d0407baSopenharmony_ci /** Frequency band */ 393d0407baSopenharmony_ci int band; 403d0407baSopenharmony_ci /** Frequency in MHz */ 413d0407baSopenharmony_ci int frequency; 423d0407baSopenharmony_ci} WifiScanResult; 433d0407baSopenharmony_ci 443d0407baSopenharmony_citypedef enum { 453d0407baSopenharmony_ci LZ_HARDWARE_WIFI_DISCONNECTED, 463d0407baSopenharmony_ci LZ_HARDWARE_WIFI_CONNECTED, 473d0407baSopenharmony_ci} WifiConnStatus; 483d0407baSopenharmony_ci 493d0407baSopenharmony_citypedef struct _WifiConnInfo { 503d0407baSopenharmony_ci char ssid[WIFI_MAX_SSID_LEN]; 513d0407baSopenharmony_ci unsigned char bssid[WIFI_MAC_LEN]; 523d0407baSopenharmony_ci unsigned int channel; 533d0407baSopenharmony_ci WifiConnStatus status; 543d0407baSopenharmony_ci} WifiConnInfo; 553d0407baSopenharmony_ci 563d0407baSopenharmony_ciunsigned int WifiEnable(void); 573d0407baSopenharmony_ciunsigned int WifiDisable(void); 583d0407baSopenharmony_ciunsigned int WifiStartStation(void); 593d0407baSopenharmony_ciunsigned int WifiConnect(unsigned char *ssid, unsigned char *passphrase); 603d0407baSopenharmony_ciunsigned int WifiGetConnectInfo(WifiConnInfo *info); 613d0407baSopenharmony_ciunsigned int WifiDisconnect(unsigned short reasonCode); 623d0407baSopenharmony_ciunsigned int WifiStartScan(void); 633d0407baSopenharmony_ciunsigned int WifiAbortScan(void); 643d0407baSopenharmony_ciunsigned int WifiGetScanResult(WifiScanResult **result, unsigned int *size); 653d0407baSopenharmony_ciunsigned int WifiRegisterEvent(void); 663d0407baSopenharmony_ciunsigned int WifiUnregisterEvent(void); 673d0407baSopenharmony_ciunsigned int WifiConfigAP(unsigned char *ssid, unsigned char *preSharedKey, unsigned short channel); 683d0407baSopenharmony_ciunsigned int WifiStartAP(void); 693d0407baSopenharmony_ciunsigned int WifiStopAP(void); 703d0407baSopenharmony_ciunsigned int WifiResidentSet(int enter); 713d0407baSopenharmony_ci 723d0407baSopenharmony_ci#endif 733d0407baSopenharmony_ci 74