Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP4336/9336 Mobile Data Networking
Lab 3: Access to the WiFi API with your program
Objectives
• To access to the WiFi API of your OS with your program
Prerequisites
Opt 1:
Mac computer/laptop
Opt 2:
Windows computer/laptop
Opt3:
Linux computer/laptop
Your Tasks
WiFi API information extraction [1 mark]
Try to run the following commands to output the WiFi information:
macOS:
You can simply use this command to fetch AP information:
lists all the visible APs individually:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A
/Resources/airport -s
Show current AP:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/C
urrent/Resources/airport -I
Try to run this short shell script in your terminal to show the signal strength:
while i=1; do echo -ne 'Wifi signal strength:' $(/System/Library/
PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
/airport -I | grep CtlRSSI | awk {'print $2'}) '\r'; sleep 0.3; d
one
sample output:
Wifi signal strength: -18
Windows:
Run the following commands in your terminal to print out the interface information:
netsh wlan show networks mode=Bssid
sample output:
Linux:
You can get the rssi value of your current link when using WiFi station as follows (wlan0 is the
usual default wi-fi device, but depends on the driver and configuration):
$ iw dev wlan0 link
Connected to 9c:4e:20:c8:ee:9e (on wlan0)
SSID: CORP1
freq: 5240
RX: 7306266 bytes (6124 packets)
TX: 776491 bytes (4117 packets)
signal: -75 dBm
tx bitrate: 39.0 MBit/s MCS 4
To list available WiFi signals:
$ ip link set wlan0 up
$ iw dev wlan0 scan
...
BSS 9c:4e:20:c8:ee:9d(on wlan0)
TSF: 0 usec (0d, 00:00:00)
freq: 5240
beacon interval: 102 TUs
capability: ESS Privacy RadioMeasure (0x1011)
signal: -75.00 dBm
last seen: 765 ms ago
SSID: CORP1
...
Application development: Wi-Fi performance and distance estimation [3 marks]
Python programming with system API
You are required to plot the table showing the connected WiFi AP performance at real-time in
your program. The table should display the time, signal strength, also show other information(e.g.
frequency, channel, rate …) if applicable. And use the Free space path loss equation to calculate
the estimate distance.
distance = 10 ^ ((27.55 - (20 * log10(frequency)) + signalLevel)/20)
Please note that your program should have the environment check before running or you can
provide a readme documentation about the working environment (i.e. which OS and the version).
A sample of application:
$ python3 wifi_performance.py
Connected to SSID uniwide
Please bring the laptop and walk around with the laptop..
Time | Frequency | Channel |Signal strength| Est. distance
-----+-----------+---------+---------------+------------------
0.00 | 2.4 GHz | 1 | -57 dbm | 7m
-----+-----------+---------+---------------+------------------
60.00| 5 GHz | 9 | -60 dbm | 4.73m
-----+-----------+---------+---------------+------------------
90.00| 5 GHz | 60 | -75 dbm | 25.3m
What to submit?
1. Submit a ZIP file containing the program file.
2. Submit a PDF report containing the following:
a. Your observations of Task 1: What do you get from the command? [1 mark]
b. A brief document about how to run your program and a screenshot of sample output [3
mark]