From cf1172ca5662938b9be4b2f2c04e3cc56fe3e652 Mon Sep 17 00:00:00 2001 From: zhangfeng Date: Mon, 13 Sep 2021 14:05:59 +0000 Subject: [PATCH] update c interface header Signed-off-by: zhangfeng --- interfaces/wifiservice/station_info.h | 11 +- interfaces/wifiservice/wifi_device.h | 163 ++++++++++++------- interfaces/wifiservice/wifi_device_config.h | 52 ++++-- interfaces/wifiservice/wifi_error_code.h | 19 +-- interfaces/wifiservice/wifi_event.h | 26 ++- interfaces/wifiservice/wifi_hotspot.h | 54 ++---- interfaces/wifiservice/wifi_hotspot_config.h | 30 ++-- interfaces/wifiservice/wifi_linked_info.h | 18 +- interfaces/wifiservice/wifi_scan_info.h | 16 +- 9 files changed, 201 insertions(+), 188 deletions(-) diff --git a/interfaces/wifiservice/station_info.h b/interfaces/wifiservice/station_info.h index b308849..4fafb4a 100644 --- a/interfaces/wifiservice/station_info.h +++ b/interfaces/wifiservice/station_info.h @@ -22,8 +22,7 @@ * You can use this module to enable and disable the Wi-Fi station or hotspot mode, connect to and disconnect from a * station or hotspot, query the station or hotspot status, and listen for events. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ /** @@ -34,8 +33,7 @@ * The station information is passed to {@link OnHotspotStaJoin} or {@link OnHotspotStaLeave} invoked when a specified * event occurs. * - * @since 1.0 - * @version 1.0 + * @since 7 */ #ifndef HARMONY_OS_LITE_WIFI_STATION_INFO_H @@ -47,12 +45,11 @@ * * The station information is returned when {@link OnHotspotStaJoin} or {@link OnHotspotStaLeave} is called. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef struct { /** Network name of the station */ - char* name; + char *name; /** MAC address. For its length, see {@link WIFI_MAC_LEN}. */ unsigned char macAddress[WIFI_MAC_LEN]; /** IP address of the station */ diff --git a/interfaces/wifiservice/wifi_device.h b/interfaces/wifiservice/wifi_device.h index cff31e4..170a0bf 100644 --- a/interfaces/wifiservice/wifi_device.h +++ b/interfaces/wifiservice/wifi_device.h @@ -22,8 +22,7 @@ * You can use this module to enable and disable the Wi-Fi station or hotspot mode, connect to and disconnect from a * station or hotspot, query the station or hotspot status, and listen for events. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ /** @@ -32,12 +31,11 @@ * @brief Provides capabilities to enable and disable the station mode, connect to and disconnect from a station, * query the station status, and listen for events. * - * @since 1.0 - * @version 1.0 + * @since 7 */ -#ifndef _WIFI_DEVICE_H -#define _WIFI_DEVICE_H +#ifndef WIFI_DEVICE_C_H +#define WIFI_DEVICE_C_H #include "wifi_event.h" #include "station_info.h" #include "wifi_scan_info.h" @@ -50,8 +48,7 @@ * * @return Returns {@link WIFI_SUCCESS} if the station mode is enabled; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ WifiErrorCode EnableWifi(void); @@ -60,8 +57,7 @@ WifiErrorCode EnableWifi(void); * * @return Returns {@link WIFI_SUCCESS} if the station mode is disabled; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ WifiErrorCode DisableWifi(void); @@ -70,8 +66,7 @@ WifiErrorCode DisableWifi(void); * * @return Returns {@link WIFI_STA_ACTIVE} if the station mode is enabled; returns {@link WIFI_STA_NOT_ACTIVE} * otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ int IsWifiActive(void); @@ -80,8 +75,7 @@ int IsWifiActive(void); * * @return Returns {@link WIFI_SUCCESS} if the Wi-Fi scan is started; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ WifiErrorCode Scan(void); @@ -95,10 +89,9 @@ WifiErrorCode Scan(void); * @param size Indicates the size of the array. * @return Returns {@link WIFI_SUCCESS} if the array of hotspots detected in the Wi-Fi scan is obtained; returns an * error code defined in {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ -WifiErrorCode GetScanInfoList(WifiScanInfo* result, unsigned int* size); +WifiErrorCode GetScanInfoList(WifiScanInfo *result, unsigned int *size); /** * @brief Adds a specified hotspot configuration for connecting to a hotspot. @@ -109,10 +102,9 @@ WifiErrorCode GetScanInfoList(WifiScanInfo* result, unsigned int* size); * @param result Indicates the generated networkId. Each networkId matches a hotspot configuration. * @return Returns {@link WIFI_SUCCESS} if the specified hotspot configuration is added; returns an error code defined * in {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ -WifiErrorCode AddDeviceConfig(const WifiDeviceConfig* config, int* result); +WifiErrorCode AddDeviceConfig(const WifiDeviceConfig *config, int *result); /** * @brief Obtains all hotspot configurations. @@ -124,10 +116,9 @@ WifiErrorCode AddDeviceConfig(const WifiDeviceConfig* config, int* result); * @param size Indicates the size of the array. * @return Returns {@link WIFI_SUCCESS} if all hotspot configurations are obtained; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ -WifiErrorCode GetDeviceConfigs(WifiDeviceConfig* result, unsigned int* size); +WifiErrorCode GetDeviceConfigs(WifiDeviceConfig *result, unsigned int *size); /** * @brief Removes a hotspot configuration matching a specified networkId. @@ -135,11 +126,32 @@ WifiErrorCode GetDeviceConfigs(WifiDeviceConfig* result, unsigned int* size); * @param networkId Indicates the networkId matching the hotspot configuration to remove. * @return Returns {@link WIFI_SUCCESS} if the hotspot configuration is removed; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ WifiErrorCode RemoveDevice(int networkId); +/** + * @brief Disable a hotspot configuration matching a specified networkId. If the config is diabled, it will + * not be auto connected. + * + * @param networkId Indicates the networkId matching the hotspot configuration to disable. + * @return Returns {@link WIFI_SUCCESS} if the hotspot configuration is disabled; returns an error code defined in + * {@link WifiErrorCode} otherwise. + * @since 7 + */ +WifiErrorCode DisableDeviceConfig(int networkId); + +/** + * @brief Enable a hotspot configuration matching a specified networkId. If the config is enabled, it will + * be connected automatically when wifi is enabled. When the config is added, it is enabled in default. + * + * @param networkId Indicates the networkId matching the hotspot configuration to enable. + * @return Returns {@link WIFI_SUCCESS} if the hotspot configuration is enabled; returns an error code defined in + * {@link WifiErrorCode} otherwise. + * @since 7 + */ +WifiErrorCode EnableDeviceConfig(int networkId); + /** * @brief Connects to a hotspot matching a specified networkId. * @@ -148,18 +160,26 @@ WifiErrorCode RemoveDevice(int networkId); * @param networkId Indicates the networkId matching the target hotspot. * @return Returns {@link WIFI_SUCCESS} if the hotspot is connected; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ WifiErrorCode ConnectTo(int networkId); +/** + * @brief Connect to a hotspot by config. + * + * @param config is device configuration to connect the Wi-Fi network. + * @return Returns {@link WIFI_SUCCESS} if the hotspot is connected; returns an error code defined in + * {@link WifiErrorCode} otherwise. + * @since 7 + */ +WifiErrorCode ConnectToDevice(const WifiDeviceConfig *config); + /** * @brief Disconnects this Wi-Fi connection. * * @return Returns {@link WIFI_SUCCESS} if this Wi-Fi connection is disconnected; returns an error code defined * in {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ WifiErrorCode Disconnect(void); @@ -169,60 +189,77 @@ WifiErrorCode Disconnect(void); * @param result Indicates the information about the connected hotspot. * @return Returns {@link WIFI_SUCCESS} if the information about the connected hotspot is obtained; returns an error * code defined in {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ -WifiErrorCode GetLinkedInfo(WifiLinkedInfo* result); +WifiErrorCode GetLinkedInfo(WifiLinkedInfo *result); /** - * @brief Registers a callback for a specified Wi-Fi event. - * - * The registered callback will be invoked when the Wi-Fi event defined in {@link WifiEvent} occurs. \n + * @brief Obtains the MAC address of this device. * - * @param event Indicates the event for which the callback is to be registered. - * @return Returns {@link WIFI_SUCCESS} if the callback is registered successfully; returns an error code defined + * @param result Indicates the MAC address of this device. It is a char array whose length is 6. + * @return Returns {@link WIFI_SUCCESS} if the MAC address of this device is obtained; returns an error code defined * in {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ -WifiErrorCode RegisterWifiEvent(WifiEvent* event); +WifiErrorCode GetDeviceMacAddress(unsigned char *result); /** - * @brief Unregisters a callback previously registered for a specified Wi-Fi event. + * @brief Starts a Wi-Fi scan based on a specified parameter. * - * @param event Indicates the event for which the callback is to be unregistered. - * @return Returns {@link WIFI_SUCCESS} if the callback is unregistered successfully; returns an error code defined + * Only results matching the specified parameter will be returned for the Wi-Fi scan.\n + * + * @param params Indicates the pointer to the parameter for starting the Wi-Fi scan. + * For details, see {@link WifiScanParams}. + * @return Returns {@link WIFI_SUCCESS} if the Wi-Fi scan is started successfully; + * returns an error code defined in {@link WifiErrorCode} otherwise. + * @since 7 + */ +WifiErrorCode AdvanceScan(WifiScanParams *params); + +/* + * @brief get the ip address. + * + * @return Returns {@link WIFI_SUCCESS} if the IP is got; returns an error code defined * in {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ -WifiErrorCode UnRegisterWifiEvent(const WifiEvent* event); +WifiErrorCode GetIpInfo(IpInfo *info); /** - * @brief Obtains the MAC address of this device. + * @brief Obtains the signal level indicated by a specified received signal strength indicator (RSSI) and frequency + * band. * * + * Based on the signal level, you can display the signal strength represented by the number of signal bars. \n * - * @param result Indicates the MAC address of this device. It is a char array whose length is 6. - * @return Returns {@link WIFI_SUCCESS} if the MAC address of this device is obtained; returns an error code defined - * in {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @param rssi Indicates the RSSI. + * @param band Indicates the frequency band, either {@link HOTSPOT_BAND_TYPE_5G} or {@link HOTSPOT_BAND_TYPE_2G}. + * @return Returns the signal level if it is obtained; returns -1 otherwise. + * @since 7 */ -WifiErrorCode GetDeviceMacAddress(unsigned char* result); +int GetSignalLevel(int rssi, int band); /** - * @brief Starts a Wi-Fi scan based on a specified parameter. + * @brief Registers a callback for a specified Wi-Fi event. * - * Only results matching the specified parameter will be returned for the Wi-Fi scan.\n + * The registered callback will be invoked when the Wi-Fi event defined in {@link WifiEvent} occurs. \n * - * @param params Indicates the pointer to the parameter for starting the Wi-Fi scan. - * For details, see {@link WifiScanParams}. - * @return Returns {@link WIFI_SUCCESS} if the Wi-Fi scan is started successfully; - * returns an error code defined in {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @param event Indicates the event for which the callback is to be registered. + * @return Returns {@link WIFI_SUCCESS} if the callback is registered successfully; returns an error code defined + * in {@link WifiErrorCode} otherwise. + * @since 7 */ -WifiErrorCode AdvanceScan(WifiScanParams *params); -#endif // _WIFI_DEVICE_H +WifiErrorCode RegisterWifiEvent(WifiEvent *event); + +/** + * @brief Unregisters a callback previously registered for a specified Wi-Fi event. + * + * @param event Indicates the event for which the callback is to be unregistered. + * @return Returns {@link WIFI_SUCCESS} if the callback is unregistered successfully; returns an error code defined + * in {@link WifiErrorCode} otherwise. + * @since 7 + */ +WifiErrorCode UnRegisterWifiEvent(const WifiEvent *event); + +#endif // WIFI_DEVICE_C_H /** @} */ diff --git a/interfaces/wifiservice/wifi_device_config.h b/interfaces/wifiservice/wifi_device_config.h index a6346b0..32167b9 100644 --- a/interfaces/wifiservice/wifi_device_config.h +++ b/interfaces/wifiservice/wifi_device_config.h @@ -22,8 +22,7 @@ * You can use this module to enable and disable the Wi-Fi station or hotspot mode, connect to and disconnect from a * station or hotspot, query the station or hotspot status, and listen for events. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ /** @@ -33,8 +32,7 @@ * * The Wi-Fi station configuration includes the security type and data length. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ #ifndef HARMONY_OS_LITE_WIFI_DEVICE_CONFIG_H @@ -77,6 +75,7 @@ * */ #define WIFI_PSK_LEN 32 + /** * @brief Indicates the maximum number of DNS servers. * @@ -84,11 +83,16 @@ */ #define WIFI_MAX_DNS_NUM 2 +/** + * @brief Indicates the maximum length of a device name. + * + */ +#define DEVICE_NAME_LEN 128 + /** * @brief Enumerates Wi-Fi security types. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef enum { /** Invalid security type */ @@ -106,8 +110,7 @@ typedef enum { /** * @brief Enumerates psk encryption types. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef enum { /** Indicates that the ascii type of psk encryption type */ @@ -125,13 +128,13 @@ typedef enum { */ typedef struct { /** IP address of the Wi-Fi device */ - int ipAddress; + unsigned int ipAddress; /** Gateway of the Wi-Fi device */ - int gateway; + unsigned int gateway; /** DNS server addresses for the Wi-Fi device */ - int dnsServers[WIFI_MAX_DNS_NUM]; + unsigned int dnsServers[WIFI_MAX_DNS_NUM]; /** Subnet mask of the Wi-Fi device */ - int netmask; + unsigned int netmask; } IpConfig; /** @@ -151,8 +154,7 @@ typedef enum { /** * @brief Represents the Wi-Fi station configuration used to connect to a specified Wi-Fi device. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef struct WifiDeviceConfig { /** Service set ID (SSID). For its length, see {@link WIFI_MAX_SSID_LEN}. */ @@ -173,13 +175,14 @@ typedef struct WifiDeviceConfig { IpType ipType; /** Static IP address */ IpConfig staticIp; + /* 1 for hidden config */ + int isHiddenSsid; } WifiDeviceConfig; /** * @brief Enumerates Wi-Fi scan types. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef enum { /** A scan based on a specified frequency. */ @@ -195,8 +198,7 @@ typedef enum { /** * @brief Represents the Wi-Fi station configuration used to connect to a specified Wi-Fi device. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef struct { /** Service set ID (SSID). Its maximum length is defined by {@link WIFI_MAX_SSID_LEN}. */ @@ -213,5 +215,19 @@ typedef struct { WifiScanType scanType; } WifiScanParams; +/** + * @brief IP info + * + * @since 7 + */ +typedef struct { + unsigned int ipAddress; + unsigned int netMask; + unsigned int netGate; + unsigned int dns1; + unsigned int dns2; + unsigned int serverAddress; + int leaseDuration; +} IpInfo; #endif // HARMONY_OS_LITE_WIFI_DEVICE_CONFIG_H /** @} */ diff --git a/interfaces/wifiservice/wifi_error_code.h b/interfaces/wifiservice/wifi_error_code.h index b6107d1..de6e240 100644 --- a/interfaces/wifiservice/wifi_error_code.h +++ b/interfaces/wifiservice/wifi_error_code.h @@ -22,8 +22,7 @@ * You can use this module to enable and disable the Wi-Fi station or hotspot mode, connect to and disconnect from a * station or hotspot, query the station or hotspot status, and listen for events. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ /** @@ -31,18 +30,16 @@ * * @brief Defines error codes of the Wi-Fi service. * - * @since 1.0 - * @version 1.0 + * @since 7 */ -#ifndef _WIFI_ERROR_CODE_H -#define _WIFI_ERROR_CODE_H +#ifndef WIFI_ERROR_CODE_C_H +#define WIFI_ERROR_CODE_C_H /** * @brief Enumerates Wi-Fi error codes. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef enum { /** No errors. */ @@ -63,9 +60,11 @@ typedef enum { ERROR_WIFI_NOT_STARTED = -7, /** System busy */ ERROR_WIFI_BUSY = -8, + /** Wi-Fi invalid password */ + ERROR_WIFI_INVALID_PASSWORD = -9, /** Unknown error */ - ERROR_WIFI_UNKNOWN = -9 + ERROR_WIFI_UNKNOWN = -128 } WifiErrorCode; -#endif // _WIFI_ERROR_CODE_H +#endif // WIFI_ERROR_CODE_C_H /** @} */ \ No newline at end of file diff --git a/interfaces/wifiservice/wifi_event.h b/interfaces/wifiservice/wifi_event.h index cac6d3a..53cbba6 100644 --- a/interfaces/wifiservice/wifi_event.h +++ b/interfaces/wifiservice/wifi_event.h @@ -22,8 +22,7 @@ * You can use this module to enable and disable the Wi-Fi station or hotspot mode, connect to and disconnect from a * station or hotspot, query the station or hotspot status, and listen for events. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ /** @@ -33,13 +32,14 @@ * * {@link RegisterWifiEvent} can be used to listen for Wi-Fi connection, disconnection, and scan events. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ -#ifndef _WIFI_EVENT_H -#define _WIFI_EVENT_H +#ifndef WIFI_EVENT_C_H +#define WIFI_EVENT_C_H + #include "wifi_linked_info.h" #include "station_info.h" +#include "wifi_error_code.h" /** * @brief Indicates that the Wi-Fi station mode is enabled. @@ -76,20 +76,19 @@ * * If you do not need a callback, set the value of its pointer to NULL. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef struct { /** Connection state change */ - void (*OnWifiConnectionChanged)(int state, WifiLinkedInfo* info); + void (*OnWifiConnectionChanged)(int state, WifiLinkedInfo *info); /** Scan state change */ void (*OnWifiScanStateChanged)(int state, int size); /** Hotspot state change */ void (*OnHotspotStateChanged)(int state); /** Station connected */ - void (*OnHotspotStaJoin)(StationInfo* info); + void (*OnHotspotStaJoin)(StationInfo *info); /** Station disconnected */ - void (*OnHotspotStaLeave)(StationInfo* info); + void (*OnHotspotStaLeave)(StationInfo *info); } WifiEvent; /** @@ -97,8 +96,7 @@ typedef struct { * * * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef enum { /** Unavailable state */ @@ -107,5 +105,5 @@ typedef enum { WIFI_STATE_AVALIABLE } WifiEventState; -#endif // _WIFI_EVENT_H +#endif // WIFI_EVENT_C_H /** @} */ diff --git a/interfaces/wifiservice/wifi_hotspot.h b/interfaces/wifiservice/wifi_hotspot.h index 8d2cb11..79b6a4c 100644 --- a/interfaces/wifiservice/wifi_hotspot.h +++ b/interfaces/wifiservice/wifi_hotspot.h @@ -22,8 +22,7 @@ * You can use this module to enable and disable the Wi-Fi station or hotspot mode, connect to and disconnect from a * station or hotspot, query the station or hotspot status, and listen for events. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ /** @@ -32,8 +31,7 @@ * @brief Provides capabilities to enable and disable the hotspot mode, connect to and disconnect from a hotspot, query * the hotspot status, and listen for events. * - * @since 1.0 - * @version 1.0 + * @since 7 */ #ifndef HARMONY_OS_LITE_WIFI_HOTSPOT_H @@ -56,8 +54,7 @@ * * @return Returns {@link WIFI_SUCCESS} if the hotspot mode is enabled; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ WifiErrorCode EnableHotspot(void); @@ -66,8 +63,7 @@ WifiErrorCode EnableHotspot(void); * * @return Returns {@link WIFI_SUCCESS} if the hotspot mode is disabled; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ WifiErrorCode DisableHotspot(void); @@ -81,10 +77,9 @@ WifiErrorCode DisableHotspot(void); * @param config Indicates the hotspot configuration to set. * @return Returns {@link WIFI_SUCCESS} if the hotspot configuration is set; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ -WifiErrorCode SetHotspotConfig(const HotspotConfig* config); +WifiErrorCode SetHotspotConfig(const HotspotConfig *config); /** * @brief Obtains a specified hotspot configuration. @@ -94,18 +89,16 @@ WifiErrorCode SetHotspotConfig(const HotspotConfig* config); * @param result Indicates the obtained hotspot configuration. * @return Returns {@link WIFI_SUCCESS} if the hotspot configuration is obtained; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ -WifiErrorCode GetHotspotConfig(HotspotConfig* result); +WifiErrorCode GetHotspotConfig(HotspotConfig *result); /** * @brief Checks whether the hotspot mode is enabled. * * @return Returns {@link WIFI_HOTSPOT_ACTIVE} if the hotspot mode is enabled; returns {@link WIFI_HOTSPOT_NOT_ACTIVE} * otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ int IsHotspotActive(void); @@ -119,38 +112,20 @@ int IsHotspotActive(void); * @param size Indicates the size of the array. * @return Returns {@link WIFI_SUCCESS} if the array of stations connected to this hotspot is obtained; returns an error * code defined in {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ -WifiErrorCode GetStationList(StationInfo* result, unsigned int* size); - -/** - * @brief Obtains the signal level indicated by a specified received signal strength indicator (RSSI) and frequency - * band. - * - * - * Based on the signal level, you can display the signal strength represented by the number of signal bars. \n - * - * @param rssi Indicates the RSSI. - * @param band Indicates the frequency band, either {@link HOTSPOT_BAND_TYPE_5G} or {@link HOTSPOT_BAND_TYPE_2G}. - * @return Returns the signal level if it is obtained; returns -1 otherwise. - * @since 1.0 - * @version 1.0 - */ -int GetSignalLevel(int rssi, int band); +WifiErrorCode GetStationList(StationInfo *result, unsigned int *size); /** * @brief Disconnects from the station with a specified MAC address. * - * - * * @param mac Indicates the pointer to the MAC address of the station. * @param macLen Indicates the length of the MAC address of the station. * @return Returns {@link WIFI_SUCCESS} if the function is successfully called; * returns an error code defined in {@link WifiErrorCode} otherwise. - * @since 3 + * @since 7 */ -WifiErrorCode DisassociateSta(unsigned char* mac, int macLen); +WifiErrorCode DisassociateSta(unsigned char *mac, int macLen); /** * @brief Adds the hotspot transmit power to the beacon. @@ -158,11 +133,10 @@ WifiErrorCode DisassociateSta(unsigned char* mac, int macLen); * After the transmit power is added, the beacon must contain specified IEs. If the minimum transmit power * 0xFFFFFFFF is added, the beacon does not contain the IEs. \n * The transmit power is added to the ie field only, exerting no impacts on the transmit power. \n - * * @param power Indicates the transmit power to add. * @return Returns {@link WIFI_SUCCESS} if the function is successfully called; returns an error code defined * in {@link WifiErrorCode} otherwise. - * @since 3 + * @since 7 */ WifiErrorCode AddTxPowerInfo(int power); diff --git a/interfaces/wifiservice/wifi_hotspot_config.h b/interfaces/wifiservice/wifi_hotspot_config.h index 1f0b766..fef32e7 100644 --- a/interfaces/wifiservice/wifi_hotspot_config.h +++ b/interfaces/wifiservice/wifi_hotspot_config.h @@ -22,8 +22,7 @@ * You can use this module to enable and disable the Wi-Fi station or hotspot mode, connect to and disconnect from a * station or hotspot, query the station or hotspot status, and listen for events. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ /** @@ -31,12 +30,12 @@ * * @brief Defines the Wi-Fi hotspot configuration. * - * @since 1.0 - * @version 1.0 + * @since 7 */ -#ifndef _WIFI_HOTSPOT_CONFIG_H -#define _WIFI_HOTSPOT_CONFIG_H +#ifndef WIFI_HOTSPOT_CONFIG_C_H +#define WIFI_HOTSPOT_CONFIG_C_H + #include "wifi_device_config.h" #include "wifi_error_code.h" @@ -50,8 +49,7 @@ * * Four RSSI levels are available: 1 to 4. The higher the RSSI level, the stronger the Wi-Fi signal. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef enum { /** Level 1. The RSSI value for a 2.4 GHz hotspot ranges from -88 (included) to -82 (excluded), @@ -70,8 +68,7 @@ typedef enum { /** * @brief Enumerates frequency bands supported by the Wi-Fi hotspot mode. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef enum { /** 2.4 GHz */ @@ -85,8 +82,7 @@ typedef enum { * * A hotspot configuration must contain the SSID (or BSSID), security type, and key (if the security type is open). \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef struct { /** Service set ID (SSID). For its length, see {@link WIFI_MAX_SSID_LEN}. */ @@ -107,8 +103,7 @@ typedef struct { * @param band Indicates the frequency band to set. * @return Returns {@link WIFI_SUCCESS} if the frequency band is set; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ WifiErrorCode SetBand(int band); @@ -118,10 +113,9 @@ WifiErrorCode SetBand(int band); * @param result Indicates the obtained frequency band. * @return Returns {@link WIFI_SUCCESS} if the frequency band is obtained; returns an error code defined in * {@link WifiErrorCode} otherwise. - * @since 1.0 - * @version 1.0 + * @since 7 */ -WifiErrorCode GetBand(int* result); +WifiErrorCode GetBand(int *result); -#endif // _WIFI_HOTSPOT_CONFIG_H +#endif // WIFI_HOTSPOT_CONFIG_C_H /** @} */ diff --git a/interfaces/wifiservice/wifi_linked_info.h b/interfaces/wifiservice/wifi_linked_info.h index 4dfdc76..0e6ea3c 100644 --- a/interfaces/wifiservice/wifi_linked_info.h +++ b/interfaces/wifiservice/wifi_linked_info.h @@ -22,8 +22,7 @@ * You can use this module to enable and disable the Wi-Fi station or hotspot mode, connect to and disconnect from a * station or hotspot, query the station or hotspot status, and listen for events. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ /** @@ -31,8 +30,7 @@ * * @brief Defines the data structure and macro of the Wi-Fi connection information. * - * @since 1.0 - * @version 1.0 + * @since 7 */ #ifndef HARMONY_OS_LITE_WIFI_LINKED_INFO_H @@ -42,8 +40,7 @@ /** * @brief Enumerates Wi-Fi connection states. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef enum { /** Disconnected */ @@ -58,8 +55,7 @@ typedef enum { * This refers to the information about the hotspot connected to this station. The information is obtained using * {@link GetLinkedInfo}. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef struct { /** Service set ID (SSID). For its length, see {@link WIFI_MAX_SSID_LEN}. */ @@ -68,12 +64,16 @@ typedef struct { unsigned char bssid[WIFI_MAC_LEN]; /** Received signal strength indicator (RSSI) */ int rssi; + /** Wi-Fi band information of hotspot */ + int band; + /** Wi-Fi frequency information of hotspot */ + int frequency; /** Wi-Fi connection state, which is defined in {@link WifiConnState} */ WifiConnState connState; /** Reason for Wi-Fi disconnection */ unsigned short disconnectedReason; /** IP address of the connected hotspot */ - int ipAddress; + unsigned int ipAddress; } WifiLinkedInfo; #endif // HARMONY_OS_LITE_WIFI_LINKED_INFO_H /** @} */ diff --git a/interfaces/wifiservice/wifi_scan_info.h b/interfaces/wifiservice/wifi_scan_info.h index 7b4f07b..c7feded 100644 --- a/interfaces/wifiservice/wifi_scan_info.h +++ b/interfaces/wifiservice/wifi_scan_info.h @@ -22,8 +22,7 @@ * You can use this module to enable and disable the Wi-Fi station or hotspot mode, connect to and disconnect from a * station or hotspot, query the station or hotspot status, and listen for events. \n * - * @since 1.0 - * @version 1.0 + * @since 7 */ /** @@ -31,12 +30,12 @@ * * @brief Defines the data structure and macro of the Wi-Fi scan result information. * - * @since 1.0 - * @version 1.0 + * @since 7 */ -#ifndef _WIFI_SCAN_INFO_H -#define _WIFI_SCAN_INFO_H +#ifndef WIFI_SCAN_INFO_C_H +#define WIFI_SCAN_INFO_C_H + #include "wifi_device_config.h" /** @@ -47,8 +46,7 @@ /** * @brief Represents the Wi-Fi scan result information. * - * @since 1.0 - * @version 1.0 + * @since 7 */ typedef struct { /** Service set ID (SSID). For its length, see {@link WIFI_MAX_SSID_LEN}. */ @@ -65,5 +63,5 @@ typedef struct { int frequency; } WifiScanInfo; -#endif // _WIFI_SCAN_INFO_H +#endif // WIFI_SCAN_INFO_C_H /** @} */ -- Gitee