Skip to content
Snippets Groups Projects
Commit 6f7dc38a authored by Younus Salman's avatar Younus Salman
Browse files

update wifi

parent 31068b49
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,6 @@ from drippy.util import astm_float_to_int_hex, get_timestamp, astm_time
from drippy.host_identity import HostIdentity
from wifi_beacon import beacon_wifi
from uuid import getnode as get_mac
# File with flight_id that will be incremented and used if no other
# flight_id is specified.
......@@ -109,7 +108,7 @@ def location_update(gpsd: GpsPoller, iroha: DripIrohaAccount, flight_id):
)
if is_wifi:
beacon_wifi(mac_arr, payload)
beacon_wifi(payload)
else:
# Set (Extended) Advertising command
if is_bt5:
......@@ -140,7 +139,7 @@ def basic_id_update(hhit):
print("basic_id_update")
# Set (Extended) Advertising Command
if is_wifi:
beacon_wifi(mac_arr, hhit)
beacon_wifi(hhit)
else:
if is_bt5:
"""
......@@ -171,10 +170,7 @@ def auth_update(auth_pages, msg_number):
for page in auth_pages:
msg = separate_bytes(hexlify(page).decode("utf-8"))
if is_wifi:
if msg_number == 1:
beacon_wifi(mac_arr, msg)
elif msg_number == 2:
beacon_wifi(mac_arr, msg)
beacon_wifi(msg)
else:
# Set (Extended) Advertising Command
if is_bt5:
......@@ -224,7 +220,6 @@ def main():
global is_bt5
global is_wifi
global mac_arr
parser = argparse.ArgumentParser(description=DESCRIPTION)
parser.add_argument(
......@@ -384,10 +379,7 @@ def main():
Enable: 0x01 (True)
"""
subprocess.run("hcitool -i hci0 cmd 0x08 0x000a 01", shell=True)
else:
mac = hex(get_mac()) # fetches device mac address
mac_arr = list(bytearray.fromhex(mac[2:])) # converts it into int
gpsd = None
if not args.run_scenario and args.gps:
gpsd = GpsPoller()
......
......@@ -22,9 +22,10 @@ if "wlan0" in addrs.keys():
elif "wlp2s0" in addrs.keys():
iface = 'wlp2s0'
mac = hex(get_mac()) # fetches device mac address
mac_address = list(bytearray.fromhex(mac[2:])) # converts it into int
def beacon_wifi(mac_address, element_info):
def beacon_wifi(element_info):
"""
Broadcasts a wifi beacon from mac_address with the SSID as the given element_info.
:param mac_address: A array of integer values representing the devices mac_address
......@@ -64,9 +65,6 @@ def beacon_wifi(mac_address, element_info):
sendp(frame, iface=iface, inter=0.100, loop=1) # send the packet over interface iface every 100 milliseconds
mac = hex(get_mac()) # fetches device mac address
mac_arr = list(bytearray.fromhex(mac[2:])) # converts it into int
#print(mac)
#print(mac_arr)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment