WiFi signal strength in vista

  • Thread starter Thread starter Maarten Weyn
  • Start date Start date
M

Maarten Weyn

Is there a way to get the signal strength of all surroundin access points in
c# on a vista pc?

regards

Maarten Weyn
 
This might help, although I haven't used it:

public static int GetSignalStrengthAsInt()
{
Int32 returnStrength = 0;
ManagementObjectSearcher searcher = null;
try
{
// Query the management object with the valid scope and the
correct query statment
searcher = new ManagementObjectSearcher( @"root\WMI",
"select Ndis80211ReceivedSignalStrength from
MSNdis_80211_ReceivedSignalStrength where active=true" );

// Call the get in order to populate the collection
ManagementObjectCollection adapterObjects = searcher.Get();
// Loop though the management object and pull out the signal
strength
foreach ( ManagementObject mo in adapterObjects )
{
returnStrength = Convert.ToInt32( mo[
"Ndis80211ReceivedSignalStrength" ].ToString() );
break;
}

}
catch ( Exception e )
{

}
finally
{
if ( searcher != null )
{
searcher.Dispose();
}
}

return returnStrength;
}

--
--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com
 
This should work for WinXP, but it does not work for vista.
thanks anyway



Peter Bromberg said:
This might help, although I haven't used it:

public static int GetSignalStrengthAsInt()
{
Int32 returnStrength = 0;
ManagementObjectSearcher searcher = null;
try
{
// Query the management object with the valid scope and the
correct query statment
searcher = new ManagementObjectSearcher( @"root\WMI",
"select Ndis80211ReceivedSignalStrength from
MSNdis_80211_ReceivedSignalStrength where active=true" );

// Call the get in order to populate the collection
ManagementObjectCollection adapterObjects = searcher.Get();
// Loop though the management object and pull out the
signal
strength
foreach ( ManagementObject mo in adapterObjects )
{
returnStrength = Convert.ToInt32( mo[
"Ndis80211ReceivedSignalStrength" ].ToString() );
break;
}

}
catch ( Exception e )
{

}
finally
{
if ( searcher != null )
{
searcher.Dispose();
}
}

return returnStrength;
}

--
--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com



Maarten Weyn said:
Is there a way to get the signal strength of all surroundin access points
in
c# on a vista pc?

regards

Maarten Weyn
 
Maarten Weyn said:
This should work for WinXP, but it does not work for vista.
thanks anyway

Doesn't work is of little help, what error do you get when you run this?


Willy.
 
Willy Denoyette said:
Doesn't work is of little help, what error do you get when you run this?


Willy.

It runs fine for me under Vista, though the values for strength I get are
negative. I'm not sure what that indicates.
 
If you are having issues you could try this approach which runs netsh under
the hood:

http://www.codeproject.com/gadgets/WifiScanner.asp


--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com



Maarten Weyn said:
This should work for WinXP, but it does not work for vista.
thanks anyway



Peter Bromberg said:
This might help, although I haven't used it:

public static int GetSignalStrengthAsInt()
{
Int32 returnStrength = 0;
ManagementObjectSearcher searcher = null;
try
{
// Query the management object with the valid scope and the
correct query statment
searcher = new ManagementObjectSearcher( @"root\WMI",
"select Ndis80211ReceivedSignalStrength from
MSNdis_80211_ReceivedSignalStrength where active=true" );

// Call the get in order to populate the collection
ManagementObjectCollection adapterObjects = searcher.Get();
// Loop though the management object and pull out the
signal
strength
foreach ( ManagementObject mo in adapterObjects )
{
returnStrength = Convert.ToInt32( mo[
"Ndis80211ReceivedSignalStrength" ].ToString() );
break;
}

}
catch ( Exception e )
{

}
finally
{
if ( searcher != null )
{
searcher.Dispose();
}
}

return returnStrength;
}

--
--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com



Maarten Weyn said:
Is there a way to get the signal strength of all surroundin access points
in
c# on a vista pc?

regards

Maarten Weyn
 
Family Tree Mike said:
It runs fine for me under Vista, though the values for strength I get are
negative. I'm not sure what that indicates.

The value is the signal level, expressed in dBm, relative to the 1 milliWatt
(0dBm) energy level.
The lower the value the lower the signal level, -10dBm =
xcellent ------> -100dBm too low to be usable.



Willy.
 
The value is the signal level, expressed in dBm, relative to the 1 milliWatt
(0dBm) energy level.
The lower the value the lower the signal level, -10dBm =
xcellent ------> -100dBm too low to be usable.



Willy.

Thanks for the explanation. I wish I was at -10 then...
 
It gives a "not supported" at the line:
foreach ( ManagementObject mo in adapterObjects )

regards

Maarten
 
Two possibilities:
- the adapter is not a wireless type
- the adapter's NDIS driver is not WMI compliant.

Willy.
 
Thanks a lot,

the problem with that one is that the signal strength in % is more the link
quality and not the real RSSI value.

Thanks anyway


Peter Bromberg said:
If you are having issues you could try this approach which runs netsh
under
the hood:

http://www.codeproject.com/gadgets/WifiScanner.asp


--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com



Maarten Weyn said:
This should work for WinXP, but it does not work for vista.
thanks anyway



Peter Bromberg said:
This might help, although I haven't used it:

public static int GetSignalStrengthAsInt()
{
Int32 returnStrength = 0;
ManagementObjectSearcher searcher = null;
try
{
// Query the management object with the valid scope and
the
correct query statment
searcher = new ManagementObjectSearcher( @"root\WMI",
"select Ndis80211ReceivedSignalStrength from
MSNdis_80211_ReceivedSignalStrength where active=true" );

// Call the get in order to populate the collection
ManagementObjectCollection adapterObjects =
searcher.Get();
// Loop though the management object and pull out the
signal
strength
foreach ( ManagementObject mo in adapterObjects )
{
returnStrength = Convert.ToInt32( mo[
"Ndis80211ReceivedSignalStrength" ].ToString() );
break;
}

}
catch ( Exception e )
{

}
finally
{
if ( searcher != null )
{
searcher.Dispose();
}
}

return returnStrength;
}

--
--Peter
"Inside every large program, there is a small program trying to get
out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com



:

Is there a way to get the signal strength of all surroundin access
points
in
c# on a vista pc?

regards

Maarten Weyn
 
the problem is as well, that when you are connected to an access point, this
link quality will mostly be better than an otherone which can be closer.
so does anyway has an idea how you can get the real rssi values (db) in c#

regards

Maarten


funghy said:
Thanks a lot,

the problem with that one is that the signal strength in % is more the
link quality and not the real RSSI value.

Thanks anyway


Peter Bromberg said:
If you are having issues you could try this approach which runs netsh
under
the hood:

http://www.codeproject.com/gadgets/WifiScanner.asp


--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com



Maarten Weyn said:
This should work for WinXP, but it does not work for vista.
thanks anyway



"Peter Bromberg [C# MVP]" <[email protected]> schreef in
bericht This might help, although I haven't used it:

public static int GetSignalStrengthAsInt()
{
Int32 returnStrength = 0;
ManagementObjectSearcher searcher = null;
try
{
// Query the management object with the valid scope and
the
correct query statment
searcher = new ManagementObjectSearcher( @"root\WMI",
"select Ndis80211ReceivedSignalStrength from
MSNdis_80211_ReceivedSignalStrength where active=true" );

// Call the get in order to populate the collection
ManagementObjectCollection adapterObjects =
searcher.Get();
// Loop though the management object and pull out the
signal
strength
foreach ( ManagementObject mo in adapterObjects )
{
returnStrength = Convert.ToInt32( mo[
"Ndis80211ReceivedSignalStrength" ].ToString() );
break;
}

}
catch ( Exception e )
{

}
finally
{
if ( searcher != null )
{
searcher.Dispose();
}
}

return returnStrength;
}

--
--Peter
"Inside every large program, there is a small program trying to get
out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com



:

Is there a way to get the signal strength of all surroundin access
points
in
c# on a vista pc?

regards

Maarten Weyn
 

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

Back
Top