wap rssi

B

billy

how can i tell which of my wireless nics is the one currently connected and
of the waps detected by said nic, which is the one providing said
connection?

once that's answered, i'm hoping someone can tell me how to convert the rssi
to a percentage.

here's my current vb.net code, if that helps...tia (sorry for the text
wrapping):

' ================

Imports System.Management

Public Class Network

#Region " structures "

Public Structure WirelessAccessPoint
Dim NetworkCard As String
Dim SignalStrength As Long
Dim SSID As String
End Structure

#End Region

#Region " methods "

Public Shared Function WirelessAccessPoints() As WirelessAccessPoint()
Dim device As ManagementObject
Dim deviceName As String
Dim deviceOptions As New ObjectGetOptions
Dim devices() As String
Dim waps() As wirelessAccessPoint
Try
' get wifi device names
Dim deviceClass As New ManagementClass("root/WMI",
"MSNDis_80211_BSSIList", deviceOptions)
For Each device In deviceClass.GetInstances
deviceName = device.GetPropertyValue("InstanceName").ToString()
If Not deviceName.ToLower.EndsWith("miniport") Then
Dim index As Integer = 0
If Not devices Is Nothing Then index = devices.Length
ReDim Preserve devices(index)
devices(index) = deviceName
End If
Next
If Not devices Is Nothing Then
' force active wifi nics to rescan for waps
Dim scanClass As New ManagementClass("root/WMI",
"MSNDis_80211_BssIdListScan", deviceOptions)
Dim scanObject As ManagementObject = scanClass.CreateInstance()
For Each deviceName In devices
scanObject("Active") = True
scanObject("InstanceName") = deviceName
scanObject("UnusedParameter") = 1
scanObject.Put()
'now, get signal strength
Dim sql As String = "SELECT * " &
vbCrLf & _
"FROM MSNDis_80211_BSSIList " &
vbCrLf & _
"WHERE Active = 'TRUE' " &
vbCrLf & _
"AND InstanceName = '" & deviceName
& "'"
Dim query As New ManagementObjectSearcher("root/WMI", sql)
Dim wap As ManagementBaseObject
Dim wapCollection As ManagementObjectCollection = query.Get()
Dim wapEnumerator As
ManagementObjectCollection.ManagementObjectEnumerator =
wapCollection.GetEnumerator
wapEnumerator.MoveNext()
For Each wap In
wapEnumerator.Current.Properties("Ndis80211BSSIList").Value
Dim wirelessAccessPoint As New wirelessAccessPoint
With wirelessAccessPoint
.NetworkCard = deviceName
.SignalStrength =
CType(wap.GetPropertyValue("Ndis80211Rssi").ToString, Long)
.SSID = New
String(Encoding.ASCII.GetChars(CType(wap.GetPropertyValue("Ndis80211Ssid"),
Byte()))).Trim
End With
Dim index As Integer = 0
If Not waps Is Nothing Then index = waps.Length
ReDim Preserve waps(index)
waps(index) = wirelessAccessPoint
Next
Next
End If
Return waps
Finally
End Try
Return Nothing
End Function

#End Region

End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top