Results 1 to 3 of 3
  1. #1
    eleara is offline Member
    Join Date
    Jul 2010
    Posts
    2
    Rep Power
    0

    Unhappy how to get wifi signal strength in ad hoc mode

    hi, i am trying to write a program that selects 2 devices to communicate with according to their signal strength.
    can anyone please help me on how i can get the signal strength of currently connected devices in an ad hoc mode.
    that is a device be able to see signal strength of other devices within its range.
    thanx

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    If you are running your [Java] program on a Linux (or Unix) platform, you might be able to make a system call to the 'iwlist' command (e.g. ProcessBuilder.exec() ), and programatically parse the output of that command.

    For example, when I run "iwlist scan"
    wlan0 Scan completed :
    Cell 01 - Address: 00:00:00:00:00:00
    Channel:9
    Frequency:2.452 GHz (Channel 9)
    Quality=54/70 Signal level=-56 dBm
    Encryption key:on
    ESSID:"Node J3"
    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s
    Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
    36 Mb/s; 48 Mb/s; 54 Mb/s
    Mode:Master
    Extra:tsf=0000004359bbc301
    Extra: Last beacon: 4930ms ago
    IE: Unknown: 00074E6F6465204A33
    IE: Unknown: 010482848B96
    IE: Unknown: 030109
    IE: Unknown: 2A0100
    IE: Unknown: 32080C1218243048606C
    IE: IEEE 802.11i/WPA2 Version 1
    Group Cipher : TKIP
    Pairwise Ciphers (2) : TKIP CCMP
    Authentication Suites (1) : PSK
    IE: WPA Version 1
    Group Cipher : TKIP
    Pairwise Ciphers (2) : TKIP CCMP
    Authentication Suites (1) : PSK
    Cell 02 - Address: 00:00:00:00:00:00
    Channel:9
    Frequency:2.452 GHz (Channel 9)
    Quality=70/70 Signal level=-35 dBm
    Encryption key:on
    ESSID:"NET2"
    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 22 Mb/s
    Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
    36 Mb/s; 48 Mb/s; 54 Mb/s
    Mode:Master
    Extra:tsf=00000088c1d31c28
    Extra: Last beacon: 0ms ago
    And a whole bunch of other probably useless stuff gets output too.

    Where in my example, I only have a single wlan0 interface, but here iwlist was able to find two wireless access points, where it identifies the signal strength as "Quality"
    (1) Quality=54/70 Signal level=-56 dBm
    (2) Quality=70/70 Signal level=-35 dBm
    I'm not entirely sure what a dBm means, but certainly you can infer something from the 'quality'. Now for two interfaces, you probably would have a default SSID that each would prefer to be attached to, if you could somehow know ahead of time what the SSID in use currently is (e.g. invoke the "iwconfig" system command and parse its output as well, it tells you the currently attaches SSID for a wireless interface). then you can filter to only read the Quality ratio for the SSID you care about, on each interface.

    Now that's just Unix specific Java system command calling to the iwutil commands, but I suspect it might be less work and perhaps more portable than trying to create a native interface to read the wireless status from the devices themselves.

  3. #3
    eleara is offline Member
    Join Date
    Jul 2010
    Posts
    2
    Rep Power
    0

    Default

    thanx!!!
    how about on widows? on cmd i tried the netsh wlan show networks mode=bssid but could not give the signal strength for ad hoc mode.
    any suggestions?

Similar Threads

  1. Replies: 0
    Last Post: 03-18-2010, 05:39 PM
  2. best way to signal a thread that's blocking on a socket receive
    By danieru in forum Threads and Synchronization
    Replies: 5
    Last Post: 09-08-2009, 04:47 PM
  3. Using an EMG signal to create a mouse click
    By cmc419 in forum New To Java
    Replies: 1
    Last Post: 03-27-2009, 05:38 PM
  4. WiFi signal strength
    By islamfunny in forum CLDC and MIDP
    Replies: 1
    Last Post: 10-02-2008, 08:53 AM
  5. Replies: 0
    Last Post: 08-26-2008, 09:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •