diff --git a/wlan/v1_0/IWlanCallback.idl b/wlan/v1_0/IWlanCallback.idl index c7be5835a94a9413c6e688b48ce3d55452b89564..885ec71cd233cc0fb3ebb94a273343dec222d7ca 100644 --- a/wlan/v1_0/IWlanCallback.idl +++ b/wlan/v1_0/IWlanCallback.idl @@ -13,12 +13,81 @@ * limitations under the License. */ +/** + * @addtogroup WLAN + * @{ + * + * @brief Defines APIs for the upper-layer WLAN service. + * + * You can use the APIs to enable or disable a WLAN hotspot, scan for hotspots, connect to a WLAN hotspot, + * manage WLAN chips, network devices, and power, and apply for, release, and move network data buffers. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IWlanCallback.idl + * + * @brief Provides callbacks to be invoked when the WLAN driver is restarted, the scan result is returned, + * and a Netlink message is received. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the WLAN module interface. + * + * @since 3.2 + * @version 1.0 + */ package ohos.hdi.wlan.v1_0; import ohos.hdi.wlan.v1_0.WlanTypes; +/** + * @brief Defines the callbacks of the WLAN module. + * + * The callback is invoked to continue the subsequent processing when the WLAN module restarts, hotspot scan ends, + * or a Netlink message is received. + * + * @since 3.2 + * @version 1.0 + */ [callback] interface IWlanCallback { + /** + * @brief Called to process the result returned when the WLAN driver restarts. + * + * @param event Indicates the ID of a driver restart event. + * @param code Indicates the result returned when the driver is restarted. + * @param ifName Indicates the network interface card (NIC) name. + * + * @since 3.2 + * @version 1.0 + */ ResetDriverResult([in] unsigned int event, [in] int code, [in] String ifName); + + /** + * @brief Called to process the scan result returned when a scan ends. + * + * @param event Indicates the ID of a scan result event. + * @param scanResult Indicates the scan result. + * @param ifName Indicates the NIC name. + * + * @since 3.2 + * @version 1.0 + */ ScanResult([in] unsigned int event, [in] struct HdfWifiScanResult scanResult, [in] String ifName); + + /** + * @brief Called to process the Netlink message received. + * + * @param recvMsg Indicates the Netlink message received. + * + * @since 3.2 + * @version 1.0 + */ WifiNetlinkMessage([in] unsigned char[] recvMsg); } +/** @} */ diff --git a/wlan/v1_0/IWlanInterface.idl b/wlan/v1_0/IWlanInterface.idl index f5d806a301f057bf39a1fbe0ae8a878963caf546..125b6ed66d7d34ac534f9d7dcbe254a328d8e33d 100644 --- a/wlan/v1_0/IWlanInterface.idl +++ b/wlan/v1_0/IWlanInterface.idl @@ -13,40 +13,473 @@ * limitations under the License. */ +/** + * @addtogroup WLAN + * @{ + * + * @brief Provides APIs for the upper-layer WLAN service. + * + * You can use the APIs to enable or disable a WLAN hotspot, scan for hotspots, connect to a WLAN hotspot, + * manage WLAN chips, network devices, and power, and apply for, release, and move network data buffers. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IWlanInterface.idl + * + * @brief Provides APIs to enable or disable a WLAN hotspot, scan for hotspots, connect to or disconnect from a WLAN hotspot, + * set the country code, and manage network devices. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the WLAN module interface. + * + * @since 3.2 + * @version 1.0 + */ package ohos.hdi.wlan.v1_0; import ohos.hdi.wlan.v1_0.WlanTypes; import ohos.hdi.wlan.v1_0.IWlanCallback; +/** + * @brief Defines an interface for the upper-layer WLAN service. + * + * @since 3.2 + * @version 1.0 + */ + interface IWlanInterface { + /** + * @brief Creates a channel between the HAL and the WLAN driver and obtains the driver network interface card (NIC) + * information. This function must be called after an IWiFi instance is created. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ Start(); + + /** + * @brief Destroys the channel between the HAL and the WLAN driver. This function must be called before an IWiFi + * instance is destroyed. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ Stop(); + + /** + * @brief Creates a Feature object based on the specified type. + * + * @param type Indicates the type of the Feature object to create. + * @param ifeature Indicates the Feature object created. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ CreateFeature([in] int type, [out] struct HdfFeatureInfo ifeature); + + /** + * @brief Destroys a Feature object. + * + * @param ifeature Indicates the Feature object to destroy. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ DestroyFeature([in] struct HdfFeatureInfo ifeature); + + /** + * @brief Obtains information about all STAs connected to this AP. Currently, the STA information contains only the MAC address. + * + * @param ifeature Indicates the Feature object. + * @param staInfo Indicates the basic information about the STAs connected to the AP. + * @param num Indicates the number of connected STAs. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetAsscociatedStas([in] struct HdfFeatureInfo ifeature, [out] struct HdfStaInfo[] staInfo, [out] unsigned int num); + + /** + * @brief Obtains the chip ID of the current driver. + * + * @param ifeature Indicates the Feature object. + * @param chipId Indicates the chip ID obtained. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetChipId([in] struct HdfFeatureInfo ifeature, [out] unsigned char chipId); + + /** + * @brief Obtains the device MAC address. + * + * @param ifeature Indicates the Feature object. + * @param mac Indicates the MAC address obtained. + * @param len Indicates the length of the MAC address. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetDeviceMacAddress([in] struct HdfFeatureInfo ifeature, [out] unsigned char[] mac, [in] unsigned char len); + + /** + * @brief Obtains the Feature object based on the specified NIC name. + * + * @param ifName Indicates the NIC name. + * @param ifeature Indicates the Feature object obtained. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetFeatureByIfName([in] String ifName, [out] struct HdfFeatureInfo ifeature); + + /** + * @brief Obtains the type of a Feature object. + * + * @param ifeature Indicates the Feature object. + * @param featureType Indicates the type of the Feature object obtained. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetFeatureType([in] struct HdfFeatureInfo ifeature, [out] int featureType); + + /** + * @brief Obtains the frequencies supported by the specified frequency band. + * + * @param ifeature Indicates the Feature object. + * @param wifiInfo Indicates the frequency band, which can be 2.4 GHz or 5 GHz. + * @param freq Indicates the supported frequencies obtained. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetFreqsWithBand([in] struct HdfFeatureInfo ifeature, [in] struct HdfWifiInfo wifiInfo, [out] int[] freq); + + /** + * @brief Obtains all the NIC names of a chip. + * + * @param chipId Indicates the ID of the target chip. + * @param ifNames Indicates the NIC names obtained. + * @param num Indicates the number of NICs. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetIfNamesByChipId([in] unsigned char chipId, [out] String ifName, [out] unsigned int num); + + /** + * @brief Obtains the NIC name based on the Feature object. + * + * @param ifeature Indicates the Feature object. + * @param ifName Indicates the NIC name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetNetworkIfaceName([in] struct HdfFeatureInfo ifeature, [out] String ifName); + + /** + * @brief Obtains information about the coexistence of multiple NICs. + * + * @param combo Indicates the information obtained, for example, different combinations of the AP, STA, and P2P. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetSupportCombo([out] unsigned long combo); + + /** + * @brief Obtains the WLAN features supported by the device, regardless of the device status. + * + * @param supType Indicates the features obtained. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetSupportFeature([out] unsigned char[] supType); + + /** + * @brief Registers a callback to listen for asynchronous events. + * + * @param cbFunc Indicates the callback to register. + * @param ifName Indicates the NIC name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ RegisterEventCallback([in] IWlanCallback cbFunc, [in] String ifName); + + /** + * @brief Unregisters a callback. + + * @param cbFunc Indicates the callback to unregister. + * @param ifName Indicates the NIC name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ UnregisterEventCallback([in] IWlanCallback cbFunc, [in] String ifName); + + /** + * @brief Restarts the WLAN driver based on the specified chip ID. + * + * @param chipId Indicates the ID of the chip whose driver is to be restarted. + * @param ifName Indicates the NIC name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ ResetDriver([in] unsigned char chipId, [in] String ifName); + + /** + * @brief Sets a country code. + * + * The country code indicates the country where the AP radio is located. It specifies the AP radio features, + * including the transmit power and supported channels of the AP, ensuring that radio attributes of APs comply + * with local laws and regulations. + * + * @param ifeature Indicates the Feature object. + * @param code Indicates the country code to set. + * @param len Indicates the length of the country code. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ SetCountryCode([in] struct HdfFeatureInfo ifeature, [in] String code, [in] unsigned int len); + + /** + * @brief Sets a MAC address for an NIC. + * + * @param ifeature Indicates the Feature object. + * @param mac Indicates the MAC address to set. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ SetMacAddress([in] struct HdfFeatureInfo ifeature, [in] unsigned char[] mac); + + /** + * @brief Scans a single MAC address. + * + * @param ifeature Indicates the Feature object. + * @param scanMac Indicates the MAC address to be scanned by the STA. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ SetScanningMacAddress([in] struct HdfFeatureInfo ifeature, [in] unsigned char[] scanMac); + + /** + * @brief Sets the transmit power. + * + * @param ifeature Indicates the Feature object. + * @param power Indicates the transmit power to set. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ SetTxPower([in] struct HdfFeatureInfo ifeature, [in] int power); + + /** + * @brief Obtains network device information, such as the device index, NIC name, and MAC address. + * + * @param netDeviceInfoResult Indicates the network device information obtained. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetNetDevInfo([out] struct HdfNetDeviceInfoResult netDeviceInfoResult); + + /** + * @brief Starts scanning. + * + * @param ifeature Indicates the Feature object. + * @param scan Indicates the scan parameters. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ StartScan([in] struct HdfFeatureInfo ifeature, [in] struct HdfWifiScan scan); + + /** + * @brief Obtains the power mode in use. + * + * @param ifeature Indicates the Feature object. + * @param mode Indicates the power mode obtained. The power mode can be sleeping (running in standby mode), + * general (running at normal rated power), + * and through-wall (running at the maximum power to improve the signal strength and coverage). + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetPowerMode([in] struct HdfFeatureInfo ifeature, [out] unsigned char mode); + + /** + * @brief Sets the power mode. + * + * @param ifeature Indicates the Feature object. + * @param mode Indicates the power mode to set. The power mode can be sleeping (running in standby mode), + * general (running at normal rated power), + * and through-wall (running at the maximum power to improve the signal strength and coverage). + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ SetPowerMode([in] struct HdfFeatureInfo ifeature, [in] unsigned char mode); + + /** + * @brief Starts channel measurement. + * + * @param ifName Indicates the NIC name. + * @param measChannelParam Indicates the channel measurement parameters (channel ID and measurement time). + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ [oneway] StartChannelMeas([in] String ifName, [in] struct MeasChannelParam measChannelParam); + + /** + * @brief Obtains the channel measurement result. + * + * @param ifName Indicates the NIC name. + * @param measChannelResult Indicates the channel measurement result (including the channel ID, load, and noise). + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetChannelMeasResult([in] String ifName, [out] struct MeasChannelResult measChannelResult); + + /** + * @brief Sets the projection parameters. + * + * @param ifName Indicates the NIC name. + * @param param Indicates the projection parameters to set. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ SetProjectionScreenParam([in] String ifName, [in] struct ProjectionScreenCmdParam param); + + /** + * @brief Sends an I/O control command to the driver. + * + * @param ifName Indicates the NIC name. + * @param cmdId Indicates the ID of the command to send. + * @param paramBuf Indicates the command content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ WifiSendCmdIoctl([in] String ifName, [in] int cmdId, [in] byte[] paramBuf); + + /** + * @brief Obtains the STA information of the specified NIC. + * + * @param ifName Indicates the NIC name. + * @param info Indicates the STA information obtained. For details, see {@link WifiStationInfo}. + * @param mac Indicates the MAC address of the STA. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ GetStaInfo([in] String ifName, [out] struct WifiStationInfo info, [in] unsigned char[] mac); } +/** @} */ diff --git a/wlan/v1_0/WlanTypes.idl b/wlan/v1_0/WlanTypes.idl index 23e6217cae68acd51e4e88d559cdbf3fc1df58c6..283afad9869499772730425834de86decfc8d29d 100644 --- a/wlan/v1_0/WlanTypes.idl +++ b/wlan/v1_0/WlanTypes.idl @@ -13,86 +13,236 @@ * limitations under the License. */ +/** + * @addtogroup WLAN + * @{ + * + * @brief Provides APIs for the upper-layer WLAN service. + * + * You can use the APIs to enable or disable a WLAN hotspot, scan for hotspots, connect to a WLAN hotspot, + * manage WLAN chips, network devices, and power, and apply for, release, and move network data buffers. + * + * @since 3.2 + * @version 1.0 + */ + + /** + * @file WlanTypes.idl + * + * @brief Defines data types related to the WLAN module. + * + * The WLAN module data includes the {@code Feature} object information, station (STA) information, + * scan information, and network device information. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the WLAN module interface. + * + * @since 3.2 + * @version 1.0 + */ package ohos.hdi.wlan.v1_0; +/** + * @brief Defines the {@code Feature} object information. + * + * @since 3.2 + * @version 1.0 + */ struct HdfFeatureInfo { + /** NIC name of the {@code Feature} object. */ String ifName; + /** {@code Feature} object. */ int type; }; +/** + * @brief Defines STA information. + * + * @since 3.2 + * @version 1.0 + */ struct HdfStaInfo { + /** MAC address of an STA. */ unsigned char[] mac; }; +/** + * @brief Defines the service set identifier (SSID) information for a Wi-Fi scan. + * + * @since 3.2 + * @version 1.0 + */ struct HdfWifiDriverScanSsid { + /** SSID to scan. */ String ssid; + /** Length of the SSID. */ int ssidLen; }; +/** + * @brief Defines Wi-Fi scan parameters. + * + * @since 3.2 + * @version 1.0 + */ struct HdfWifiScan{ + /** SSIDs to scan. */ struct HdfWifiDriverScanSsid[] ssids; + /** Frequencies to scan. */ int[] freqs; + /** Extended information element (IE) carried in a Wi-Fi scan request. */ unsigned char[] extraIes; + /** Basic service set identifier (BSSID) to scan. */ unsigned char[] bssid; + /** Whether the SSID to be scanned has a prefix. */ unsigned char prefixSsidScanFlag; + /** Fast connect flag. */ unsigned char fastConnectFlag; }; +/** + * @brief Defines network device Information. + * + * @since 3.2 + * @version 1.0 + */ struct HdfNetDeviceInfo { + /** Index of the network device. */ unsigned int index; + /** Network interface card (NIC) name. */ String ifName; + /** Length of the NIC name. */ unsigned int ifNameLen; + /** NIC type. */ unsigned char iftype; + /** MAC address of the network device. */ unsigned char[] mac; }; +/** + * @brief Defines the network device information set. + * + * @since 3.2 + * @version 1.0 + */ struct HdfNetDeviceInfoResult { + /** A sef of network device information. */ struct HdfNetDeviceInfo[] deviceInfos; }; +/** + * @brief Defines the Wi-Fi scan result. + * + * @since 3.2 + * @version 1.0 + */ struct HdfWifiScanResult { + /** Flag of the basic service set (BSS)/independent basic service set (IBSS). */ unsigned int flags; + /** BSSID information. */ unsigned char[] bssid; + /** Capability information fields (in host byte order). */ unsigned short caps; + /** Channel frequency. */ unsigned int freq; + /** Beacon interval. */ unsigned short beaconInt; + /** Signal quality. */ int qual; + /** Signal strength. */ int level; + /** Time for receiving the latest beacon or probe response frame, in milliseconds. */ unsigned int age; + /** Variable value in the scan result. */ unsigned char[] variable; + /** IE in the following Probe Response message. */ unsigned char[] ie; + /** IE in the following beacon. */ unsigned char[] beaconIe; }; +/** + * @brief Define Wi-Fi frequency band information. + * + * @since 3.2 + * @version 1.0 + */ struct HdfWifiInfo { + /** Wi-Fi frequency band. */ int band; + /** Number of frequencies supported in the Wi-Fi frequency band. */ unsigned int size; }; +/** + * @brief Defines the channel measurement parameters. + * + * @since 3.2 + * @version 1.0 + */ struct MeasChannelParam { + /** Channel ID. */ int channelId; + /** Measure time. */ int measTime; }; +/** + * @brief Defines the channel measurement result. + * + * @since 3.2 + * @version 1.0 + */ struct MeasChannelResult { + /** Channel ID. */ int channelId; + /** Channel load. */ int chload; + /** Channel noise. */ int noise; }; +/** + * @brief Defines the projection parameters. + * + * @since 3.2 + * @version 1.0 + */ struct ProjectionScreenCmdParam { + /** ID of the projection command. */ int cmdId; + /** Content of the projection command. */ byte[] buf; }; +/** + * @brief Defines STA information. + * + * @since 3.2 + * @version 1.0 + */ struct WifiStationInfo { + /** Receive (RX) rate. */ unsigned int rxRate; + /** Transmit (TX) rate. */ unsigned int txRate; + /** Transmission type. */ unsigned int flags; + /** RX Very High Throughput Modulation and Coding Scheme (VHT-MCS) configuration. */ unsigned char rxVhtmcs; + /** TX VHT-MCS configuration. */ unsigned char txVhtmcs; + /** RX Modulation and Coding Scheme (MCS) index. */ unsigned char rxMcs; + /** TX MCS index. */ unsigned char txMcs; + /** RX Very High Throughput Number of Spatial Streams (VHT-NSS) configuration. */ unsigned char rxVhtNss; + /** TX VHT-NSS configuration. */ unsigned char txVhtNss; -}; \ No newline at end of file +}; +/** @} */ \ No newline at end of file