public WLAN_HOSTED_NETWORK_STATUS(IntPtr pStatus) { HostedNetworkState = (WLAN_HOSTED_NETWORK_STATE)Marshal.ReadInt32(pStatus, 0); IPDeviceID = (Guid)Marshal.PtrToStructure(new IntPtr(pStatus.ToInt64() + 4), typeof(Guid)); wlanHostedNetworkBSSID = new byte[6]; Marshal.Copy(new IntPtr(pStatus.ToInt64() + 4 + 16), wlanHostedNetworkBSSID, 0, 6); dot11PhyType = (DOT11_PHY_TYPE)Marshal.ReadInt32(pStatus, 4 + 16 + 6 + 2); //pack 4 ulChannelFrequency = (uint)Marshal.ReadInt32(pStatus, 4 + 16 + 6 + 2 + 4); dwNumberOfPeers = (uint)Marshal.ReadInt32(pStatus, 4 + 16 + 6 + 2 + 4 + 4); PeerList = new WLAN_HOSTED_NETWORK_PEER_STATE[dwNumberOfPeers]; for (int i = 0; i < dwNumberOfPeers; i++) { IntPtr pPeerItem = new IntPtr(pStatus.ToInt64() + 4 + 16 + 6 + 2 + 4 + 4 + 4 + (i * WLAN_HOSTED_NETWORK_PEER_STATE_SIZE)); PeerList[i] = (WLAN_HOSTED_NETWORK_PEER_STATE)Marshal.PtrToStructure(pPeerItem, typeof(WLAN_HOSTED_NETWORK_PEER_STATE)); } }
public static PhyType Convert(DOT11_PHY_TYPE source) { return(source switch { DOT11_PHY_TYPE.dot11_phy_type_any => PhyType.Any, DOT11_PHY_TYPE.dot11_phy_type_fhss => PhyType.Fhss, DOT11_PHY_TYPE.dot11_phy_type_dsss => PhyType.Dsss, DOT11_PHY_TYPE.dot11_phy_type_irbaseband => PhyType.IrBaseband, DOT11_PHY_TYPE.dot11_phy_type_ofdm => PhyType.Ofdm, DOT11_PHY_TYPE.dot11_phy_type_hrdsss => PhyType.HrDsss, DOT11_PHY_TYPE.dot11_phy_type_erp => PhyType.Erp, DOT11_PHY_TYPE.dot11_phy_type_ht => PhyType.Ht, DOT11_PHY_TYPE.dot11_phy_type_vht => PhyType.Vht, DOT11_PHY_TYPE.dot11_phy_type_IHV_start => PhyType.IhvStart, DOT11_PHY_TYPE.dot11_phy_type_IHV_end => PhyType.IhvEnd, _ => PhyType.Unknown, });
public static PhyType Convert(DOT11_PHY_TYPE source) { switch (source) { case DOT11_PHY_TYPE.dot11_phy_type_any: return(PhyType.Any); case DOT11_PHY_TYPE.dot11_phy_type_fhss: return(PhyType.Fhss); case DOT11_PHY_TYPE.dot11_phy_type_dsss: return(PhyType.Dsss); case DOT11_PHY_TYPE.dot11_phy_type_irbaseband: return(PhyType.IrBaseband); case DOT11_PHY_TYPE.dot11_phy_type_ofdm: return(PhyType.Ofdm); case DOT11_PHY_TYPE.dot11_phy_type_hrdsss: return(PhyType.HrDsss); case DOT11_PHY_TYPE.dot11_phy_type_erp: return(PhyType.Erp); case DOT11_PHY_TYPE.dot11_phy_type_ht: return(PhyType.Ht); case DOT11_PHY_TYPE.dot11_phy_type_vht: return(PhyType.Vht); case DOT11_PHY_TYPE.dot11_phy_type_IHV_start: return(PhyType.IhvStart); case DOT11_PHY_TYPE.dot11_phy_type_IHV_end: return(PhyType.IhvEnd); default: return(PhyType.Unknown); } }