WLAN Device¶
The WLAN device represents an 802.11 device in a WLAN network. This can be a node running the 802.11 Reference Design or a commercial 802.11 device.
Class Definition¶
-
class
WlanDevice
(mac_address, name=None, ht_capable=True)[source]¶ Class for WLAN Device. This is the parent class for all wlan_exp node class definitions. This class also provides a node type for devices which exist in a wireless network but are not controlled by wlan_exp (i.e. a Wi-Fi client connected to an 802.11 Reference Design AP).
Parameters: - mac_address (int, str) – Medium Access Control (MAC) address of the WLAN device (48-bits) The mac_address should be of the format: 0x0123456789AB or ‘01:23:45:67:89:AB’
- name (string) – User generated description of the WLAN device
- ht_capable (bool) – Indicates if device has PHY capable of HT (802.11n) rates
Class Members:
Variables: - name (string) – User generated description of the WLAN device
- wlan_mac_address (int) – MAC Address of WLAN Device
- ht_capable (bool) – Indicates if device has PHY capable of HT (802.11n) rates
Example¶
To create a WLAN device, first specify the MAC address and name of the device:
# WLAN devices
# Contains a list of tuples: (MAC Address, 'String description of device')
# MAC addresses must be expressed as uint64 values
# For example, use 0x0123456789AB for MAC address 01:23:45:67:89:AB
WLAN_DEVICE_LIST = [(0x000000000000, 'My Device')]
Given the device parameters, create WLAN devices for each device:
# Setup WLAN devices
devices = []
for device in WLAN_DEVICE_LIST:
devices.append(wlan_device.WlanDevice(mac_address=device[0], name=device[1]))
Finally, interact with the devices within the 802.11 Reference Design Experiments Framework:
# Wait for devices to associate with the AP
print("Waiting for devices to join:")
total_devices = len(devices)
tmp_devices = list(devices)
num_joined = 0
while (total_devices != num_joined):
for device in tmp_devices:
if n_ap.is_associated(device):
print(" {0} joined".format(device.name))
num_joined += 1
tmp_devices.remove(device)