diff --git a/interfaces/wifiservice/station_info.h b/interfaces/wifiservice/station_info.h index 29457d18dbba5f29a77a5245deab57ec34c7b0ff..b3088494bc5e5cbe85f64d5e3cf1be43ad091af7 100644 --- a/interfaces/wifiservice/station_info.h +++ b/interfaces/wifiservice/station_info.h @@ -38,8 +38,8 @@ * @version 1.0 */ -#ifndef _WIFI_STATION_INFO_H -#define _WIFI_STATION_INFO_H +#ifndef HARMONY_OS_LITE_WIFI_STATION_INFO_H +#define HARMONY_OS_LITE_WIFI_STATION_INFO_H #include "wifi_device_config.h" /** @@ -51,10 +51,14 @@ * @version 1.0 */ typedef struct { + /** Network name of the station */ + char* name; /** MAC address. For its length, see {@link WIFI_MAC_LEN}. */ unsigned char macAddress[WIFI_MAC_LEN]; + /** IP address of the station */ + unsigned int ipAddress; unsigned short disconnectedReason; } StationInfo; -#endif // _WIFI_STATION_INFO_H +#endif // HARMONY_OS_LITE_WIFI_STATION_INFO_H /** @} */ diff --git a/interfaces/wifiservice/wifi_device_config.h b/interfaces/wifiservice/wifi_device_config.h index b7037a7eef332bf1bcbfedee1778c02f45fc62d4..40355d17a1bc2985872109b40d4f865f27d1efb1 100644 --- a/interfaces/wifiservice/wifi_device_config.h +++ b/interfaces/wifiservice/wifi_device_config.h @@ -37,8 +37,8 @@ * @version 1.0 */ -#ifndef _WIFI_DEVICE_CONFIG_H -#define _WIFI_DEVICE_CONFIG_H +#ifndef HARMONY_OS_LITE_WIFI_DEVICE_CONFIG_H +#define HARMONY_OS_LITE_WIFI_DEVICE_CONFIG_H /** * @brief Indicates the maximum number of Wi-Fi station configurations that can be added using {@link AddDeviceConfig}. @@ -57,7 +57,8 @@ /** * @brief Indicates the maximum length of a Wi-Fi SSID. * - * The maximum length is 32, and the last bit is reserved and set to \0. \n */ + * The maximum length is 32, and the last bit is reserved and set to \0. \n + */ #define WIFI_MAX_SSID_LEN 33 // 32 + \0 /** * @brief Indicates the maximum length of a Wi-Fi key. @@ -76,6 +77,13 @@ * */ #define WIFI_PSK_LEN 32 +/** + * @brief Indicates the maximum number of DNS servers. + * + * A maximum of two DNS servers are allowed. \n + */ +#define WIFI_MAX_DNS_NUM 2 + /** * @brief Enumerates Wi-Fi security types. * @@ -108,6 +116,38 @@ typedef enum { WIFI_PSK_TYPE_HEX, } WifiPskType; +/** + * @brief Defines the IP configuration of the Wi-Fi device. + * + * The IP configuration is mainly used for connecting to the device. \n + * + * @since 3 + */ +typedef struct { + /** IP address of the Wi-Fi device */ + int ipAddress; + /** Gateway of the Wi-Fi device */ + int gateway; + /** DNS server addresses for the Wi-Fi device */ + int dnsServers[WIFI_MAX_DNS_NUM]; + /** Subnet mask of the Wi-Fi device */ + int netmask; +} IpConfig; + +/** + * @brief Enumerates IP address types for the Wi-Fi device. + * + * @since 3 + */ +typedef enum { + /** Static IP address */ + STATIC, + /** IP address dynamically assigned by DHCP */ + DHCP, + /** Unknown IP address type */ + UNKNOWN +} IpType; + /** * @brief Represents the Wi-Fi station configuration used to connect to a specified Wi-Fi device. * @@ -129,6 +169,10 @@ typedef struct WifiDeviceConfig { unsigned int freq; /** PSK type, see {@link WifiPskType}. */ int wapiPskType; + /** IP address type */ + IpType ipType; + /** Static IP address */ + IpConfig staticIp; } WifiDeviceConfig; /** @@ -169,5 +213,5 @@ typedef struct { WifiScanType scanType; } WifiScanParams; -#endif // _WIFI_DEVICE_CONFIG_H +#endif // HARMONY_OS_LITE_WIFI_DEVICE_CONFIG_H /** @} */ diff --git a/interfaces/wifiservice/wifi_hotspot.h b/interfaces/wifiservice/wifi_hotspot.h index db384a28e7c4eeea598c57a50b906e347f0d610e..8d2cb11795eeb974195c766b4207000a6e5ffd1d 100644 --- a/interfaces/wifiservice/wifi_hotspot.h +++ b/interfaces/wifiservice/wifi_hotspot.h @@ -36,8 +36,8 @@ * @version 1.0 */ -#ifndef _WIFI_HOTSPOT_H -#define _WIFI_HOTSPOT_H +#ifndef HARMONY_OS_LITE_WIFI_HOTSPOT_H +#define HARMONY_OS_LITE_WIFI_HOTSPOT_H #include "wifi_device.h" #include "wifi_error_code.h" #include "wifi_hotspot_config.h" @@ -82,7 +82,8 @@ WifiErrorCode DisableHotspot(void); * @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 */ + * @version 1.0 + */ WifiErrorCode SetHotspotConfig(const HotspotConfig* config); /** @@ -138,5 +139,32 @@ WifiErrorCode GetStationList(StationInfo* result, unsigned int* size); */ int GetSignalLevel(int rssi, int band); -#endif // _WIFI_HOTSPOT_H_ +/** + * @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 + */ +WifiErrorCode DisassociateSta(unsigned char* mac, int macLen); + +/** + * @brief Adds the hotspot transmit power to the beacon. + * + * 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 + */ +WifiErrorCode AddTxPowerInfo(int power); + +#endif // HARMONY_OS_LITE_WIFI_HOTSPOT_H_ /** @} */ diff --git a/interfaces/wifiservice/wifi_linked_info.h b/interfaces/wifiservice/wifi_linked_info.h index e4c84572c8f08bf8530df4cebe0106c16b08b056..4dfdc76c275d64191b560bac24c0eaed4f63c30a 100644 --- a/interfaces/wifiservice/wifi_linked_info.h +++ b/interfaces/wifiservice/wifi_linked_info.h @@ -35,8 +35,8 @@ * @version 1.0 */ -#ifndef _WIFI_LINKED_INFO_H -#define _WIFI_LINKED_INFO_H +#ifndef HARMONY_OS_LITE_WIFI_LINKED_INFO_H +#define HARMONY_OS_LITE_WIFI_LINKED_INFO_H #include "wifi_device_config.h" /** @@ -72,6 +72,8 @@ typedef struct { WifiConnState connState; /** Reason for Wi-Fi disconnection */ unsigned short disconnectedReason; + /** IP address of the connected hotspot */ + int ipAddress; } WifiLinkedInfo; -#endif // _WIFI_LINKED_INFO_H +#endif // HARMONY_OS_LITE_WIFI_LINKED_INFO_H /** @} */