| // Copyright 2018 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| @available(added=HEAD) |
| library fuchsia.wlan.device.service; |
| |
| using fuchsia.wlan.common; |
| using fuchsia.wlan.ieee80211 as ieee80211; |
| using fuchsia.wlan.internal; |
| using fuchsia.wlan.sme; |
| using fuchsia.wlan.stats; |
| using zx; |
| |
| type QueryIfaceResponse = struct { |
| /// The role the iface is currently operating in, e.g., client role. |
| role fuchsia.wlan.common.WlanMacRole; |
| /// The iface's global ID. |
| id uint16; |
| /// Iface's PHY ID. |
| phy_id uint16; |
| /// Local ID assigned by this iface's PHY. |
| phy_assigned_id uint16; |
| /// The iface's MAC. |
| sta_addr ieee80211.MacAddr; |
| }; |
| |
| type DestroyIfaceRequest = struct { |
| iface_id uint16; |
| }; |
| |
| type GetCountryResponse = struct { |
| alpha2 array<byte, 2>; |
| }; |
| |
| type SetCountryRequest = struct { |
| phy_id uint16; |
| alpha2 array<byte, 2>; |
| }; |
| |
| type ClearCountryRequest = struct { |
| phy_id uint16; |
| }; |
| |
| type SetPowerSaveModeRequest = struct { |
| /// Interface's PHY ID |
| phy_id uint16; |
| /// Power Save Mode bit mask |
| ps_mode fuchsia.wlan.common.PowerSaveType; |
| }; |
| |
| type GetPowerSaveModeResponse = struct { |
| /// Power Save Mode bit mask |
| ps_mode fuchsia.wlan.common.PowerSaveType; |
| }; |
| |
| // TODO(https://fxbug.dev/42164319): Move this to wlan_internal.fidl after https://fxbug.dev/42166364 is fixed |
| type GetIfaceHistogramStatsResponse = strict union { |
| 1: stats fuchsia.wlan.stats.IfaceHistogramStats; |
| 2: error_status zx.Status; |
| }; |
| |
| closed protocol DeviceWatcher { |
| strict -> OnPhyAdded(struct { |
| phy_id uint16; |
| }); |
| strict -> OnPhyRemoved(struct { |
| phy_id uint16; |
| }); |
| strict -> OnIfaceAdded(struct { |
| iface_id uint16; |
| }); |
| strict -> OnIfaceRemoved(struct { |
| iface_id uint16; |
| }); |
| }; |
| |
| type DeviceMonitorError = flexible enum { |
| INVALID_PHY = 0; |
| INVALID_IFACE = 1; |
| NOT_SUPPORTED = 2; |
| INTERNAL = 3; |
| }; |
| |
| @discoverable |
| closed protocol DeviceMonitor { |
| // Phy methods |
| strict ListPhys() -> (struct { |
| phy_list vector<uint16>:MAX; |
| }); |
| strict ListIfaces() -> (struct { |
| iface_list vector<uint16>:MAX; |
| }); |
| strict GetDevPath(struct { |
| phy_id uint16; |
| }) -> (struct { |
| dev_path string:optional; |
| }); |
| strict GetSupportedMacRoles(struct { |
| phy_id uint16; |
| }) -> (struct { |
| supported_mac_roles |
| vector<fuchsia.wlan.common.WlanMacRole>:fuchsia.wlan.common.MAX_SUPPORTED_MAC_ROLES; |
| }) error zx.Status; |
| strict WatchDevices(resource struct { |
| watcher server_end:DeviceWatcher; |
| }); |
| strict GetCountry(struct { |
| phy_id uint16; |
| }) -> (struct { |
| resp GetCountryResponse; |
| }) error int32; |
| strict SetCountry(struct { |
| req SetCountryRequest; |
| }) -> (struct { |
| status int32; |
| }); |
| strict ClearCountry(struct { |
| req ClearCountryRequest; |
| }) -> (struct { |
| status int32; |
| }); |
| strict SetPowerSaveMode(struct { |
| req SetPowerSaveModeRequest; |
| }) -> (struct { |
| status int32; |
| }); |
| strict GetPowerSaveMode(struct { |
| phy_id uint16; |
| }) -> (struct { |
| resp GetPowerSaveModeResponse; |
| }) error int32; |
| |
| /// All interfaces should be deleted before calling this method. If supported, the |
| /// wlan driver will power down the wlan chip. Refer to wlan.phyimpl fidl for more details. |
| strict PowerDown(struct { |
| phy_id uint16; |
| }) -> () error zx.Status; |
| |
| /// If supported, the wlan driver will power up the wlan chip. Refer to wlan.phyimpl fidl |
| /// for more details. |
| strict PowerUp(struct { |
| phy_id uint16; |
| }) -> () error zx.Status; |
| |
| /// If supported, the wlan driver will reset the wlan chip. An attempt is made to delete |
| /// any existing interfaces. Refer to wlan.phyimpl fidl for more details. |
| strict Reset(struct { |
| phy_id uint16; |
| }) -> () error zx.Status; |
| |
| /// Applies the provided TxPowerScenario to the specified PHY. |
| strict SetTxPowerScenario(struct { |
| phy_id uint16; |
| scenario fuchsia.wlan.internal.TxPowerScenario; |
| }) -> () error DeviceMonitorError; |
| |
| /// Clears any existing TxPowerScenario that has been applied and resets the PHY to use its default TxPowerScenario. |
| strict ResetTxPowerScenario(struct { |
| phy_id uint16; |
| }) -> () error DeviceMonitorError; |
| |
| /// Queries the current TxPowerScenario setting for the specified PHY. |
| strict GetTxPowerScenario(struct { |
| phy_id uint16; |
| }) -> (struct { |
| scenario fuchsia.wlan.internal.TxPowerScenario; |
| }) error DeviceMonitorError; |
| |
| /// This will return the current power state of the wlan chip. |
| strict GetPowerState(struct { |
| phy_id uint16; |
| }) -> (struct { |
| power_on bool; |
| }) error zx.Status; |
| |
| /// Set the Bluetooth coexistence mode. |
| /// Likely errors include: |
| /// * NOT_FOUND: The given phy_id does not exist. |
| /// * NOT_SUPPORTED: The specified BT coexistence mode is not supported. |
| strict SetBtCoexistenceMode(struct { |
| phy_id uint16; |
| mode fuchsia.wlan.internal.BtCoexistenceMode; |
| }) -> () error zx.Status; |
| |
| // Iface methods |
| strict CreateIface(table { |
| 1: phy_id uint16; |
| 2: role fuchsia.wlan.common.WlanMacRole; |
| 3: sta_address ieee80211.MacAddr; |
| }) -> (table { |
| 1: iface_id uint16; |
| }) error DeviceMonitorError; |
| strict QueryIface(struct { |
| iface_id uint16; |
| }) -> (struct { |
| resp QueryIfaceResponse; |
| }) error zx.Status; |
| strict DestroyIface(struct { |
| req DestroyIfaceRequest; |
| }) -> (struct { |
| status int32; |
| }); |
| |
| // SME methods |
| |
| /// Attempt to establish a new connection to a Client SME. |
| /// Connections may be established for the whole lifetime of the SME, |
| /// but concurrent connections might lead to unexpected behavior. |
| /// Likely errors include: |
| /// * NOT_FOUND: The given iface_id does not exist. |
| /// * NOT_SUPPORTED: The underlying SME is not a Client SME. |
| /// * PEER_CLOSED: The underlying SME is shutting down. |
| strict GetClientSme(resource struct { |
| iface_id uint16; |
| sme_server server_end:fuchsia.wlan.sme.ClientSme; |
| }) -> () error zx.Status; |
| /// Attempt to establish a new connection to an AP SME. |
| /// Connections may be established for the whole lifetime of the SME, |
| /// but concurrent connections might lead to unexpected behavior. |
| /// Likely errors include: |
| /// * NOT_FOUND: The given iface_id does not exist. |
| /// * NOT_SUPPORTED: The underlying SME is not a Client SME. |
| /// * PEER_CLOSED: The underlying SME is shutting down. |
| strict GetApSme(resource struct { |
| iface_id uint16; |
| sme_server server_end:fuchsia.wlan.sme.ApSme; |
| }) -> () error zx.Status; |
| /// Attempt to establish a new connection to telemetry for an SME. |
| /// Connections may be established for the whole lifetime of the SME, and |
| /// concurrent connections are safe since this is a read-only API. |
| /// Likely errors include: |
| /// * NOT_FOUND: The given iface_id does not exist. |
| /// * NOT_SUPPORTED: The underlying SME is not a Client SME. |
| /// * PEER_CLOSED: The underlying SME is shutting down. |
| strict GetSmeTelemetry(resource struct { |
| iface_id uint16; |
| telemetry_server server_end:fuchsia.wlan.sme.Telemetry; |
| }) -> () error zx.Status; |
| }; |