| // 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. | 
 |  | 
 | library fuchsia.wlan.device.service; | 
 |  | 
 | using fuchsia.wlan.device; | 
 | using fuchsia.wlan.minstrel; | 
 | using fuchsia.wlan.sme; | 
 | using fuchsia.wlan.stats; | 
 |  | 
 | struct PhyListItem { | 
 |     uint16 phy_id; | 
 |     string path; | 
 | }; | 
 |  | 
 | struct ListPhysResponse { | 
 |     vector<PhyListItem> phys; | 
 | }; | 
 |  | 
 | struct QueryPhyRequest { | 
 |     uint16 phy_id; | 
 | }; | 
 |  | 
 | struct QueryPhyResponse { | 
 |     fuchsia.wlan.device.PhyInfo info; | 
 | }; | 
 |  | 
 | struct IfaceListItem { | 
 |     uint16 iface_id; | 
 | }; | 
 |  | 
 | struct QueryIfaceResponse { | 
 |     /// The role the iface is currently operating in, e.g., client role. | 
 |     fuchsia.wlan.device.MacRole role; | 
 |     /// The iface's global ID. | 
 |     uint16 id; | 
 |     /// Iface's PHY ID. | 
 |     uint16 phy_id; | 
 |     /// Local ID assigned by this iface's PHY. | 
 |     uint16 phy_assigned_id; | 
 |     /// The iface's MAC. | 
 |     array<uint8>:6 mac_addr; | 
 | }; | 
 |  | 
 | struct ListIfacesResponse { | 
 |     vector<IfaceListItem> ifaces; | 
 | }; | 
 |  | 
 | struct CreateIfaceRequest { | 
 |     uint16 phy_id; | 
 |     fuchsia.wlan.device.MacRole role; | 
 |     bytes:6? mac_addr; | 
 | }; | 
 |  | 
 | struct CreateIfaceResponse { | 
 |     uint16 iface_id; | 
 | }; | 
 |  | 
 | struct DestroyIfaceRequest { | 
 |     uint16 iface_id; | 
 | }; | 
 |  | 
 | struct GetCountryResponse { | 
 |     array<byte>:2 alpha2; | 
 | }; | 
 |  | 
 | struct SetCountryRequest { | 
 |     uint16 phy_id; | 
 |     array<byte>:2 alpha2; | 
 | }; | 
 |  | 
 | struct ClearCountryRequest { | 
 |     uint16 phy_id; | 
 | }; | 
 |  | 
 | protocol DeviceWatcher { | 
 |     -> OnPhyAdded(uint16 phy_id); | 
 |     -> OnPhyRemoved(uint16 phy_id); | 
 |     -> OnIfaceAdded(uint16 iface_id); | 
 |     -> OnIfaceRemoved(uint16 iface_id); | 
 | }; | 
 |  | 
 | [Discoverable] | 
 | protocol DeviceService { | 
 |     // Phy methods | 
 |     ListPhys() -> (ListPhysResponse resp); | 
 |     QueryPhy(QueryPhyRequest req) -> (int32 status, QueryPhyResponse? resp); | 
 |     // 3-15: reserved | 
 |  | 
 |     // Iface methods | 
 |     ListIfaces() -> (ListIfacesResponse resp); | 
 |     QueryIface(uint16 iface_id) -> (int32 status, QueryIfaceResponse? resp); | 
 |     CreateIface(CreateIfaceRequest req) -> (int32 status, CreateIfaceResponse? resp); | 
 |     // 19: reserved for StartIface | 
 |     // 20: reserved for StopIface | 
 |     DestroyIface(DestroyIfaceRequest req) -> (int32 status); | 
 |     GetClientSme(uint16 iface_id, request<fuchsia.wlan.sme.ClientSme> sme) -> (int32 status); | 
 |     GetApSme(uint16 iface_id, request<fuchsia.wlan.sme.ApSme> sme) -> (int32 status); | 
 |     GetMeshSme(uint16 iface_id, request<fuchsia.wlan.sme.MeshSme> sme) -> (int32 status); | 
 |     GetIfaceStats(uint16 iface_id) -> (int32 status, fuchsia.wlan.stats.IfaceStats? stats); | 
 |     GetMinstrelList(uint16 iface_id) -> (int32 status, fuchsia.wlan.minstrel.Peers peers); | 
 |     GetMinstrelStats(uint16 iface_id, array<uint8>:6 peer_addr) | 
 |         -> (int32 status, fuchsia.wlan.minstrel.Peer? peer); | 
 |  | 
 |     WatchDevices(request<DeviceWatcher> watcher); | 
 |     GetCountry(uint16 phy_id) -> (GetCountryResponse resp) error int32; | 
 |     SetCountry(SetCountryRequest req) -> (int32 status); | 
 |     ClearCountry(ClearCountryRequest req) -> (int32 status); | 
 | }; |