-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse Wifi SSIDs and convert to Capture and add back NavVis test data #68
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
import collections | ||
|
||
from pytijo import parser | ||
import re | ||
|
||
IWConfigData = collections.namedtuple('IWConfigData', | ||
['mac_address', | ||
'signal_strength_dbm', | ||
'frequency_khz', | ||
'time_offset_ms']) | ||
'time_offset_ms', | ||
'ssid']) | ||
|
||
WifiMeasurement = collections.namedtuple( | ||
'WifiMeasurement', [ | ||
'timestamp_s', | ||
'mac_address', | ||
'signal_strength_dbm', | ||
'center_channel_freq_khz', | ||
'time_offset_ms']) | ||
|
||
'time_offset_ms', | ||
'ssid']) | ||
|
||
def frequency_string_to_khz(frequency_str): | ||
|
||
|
@@ -49,15 +51,17 @@ def parse_iwconfig(data): | |
'mac_address': r'Address:\s((?:[a-fA-F0-9]{2}[:|\-]?){6})', | ||
'signal_level': r'Signal level=(-?\d{1,2}) dBm', | ||
'frequency': r'Frequency:(\d{1,2}.\d{1,6}\s([ G|M|k]Hz))', | ||
'time_offset': r'Extra: Last beacon: (\d{1,6})ms' | ||
'time_offset': r'Extra: Last beacon: (\d{1,6})ms', | ||
'ssid': r'ESSID:"(.{1,32})"' | ||
}] | ||
}, { | ||
'wifi samples': [{ | ||
'#id': r'(BSS (?:[a-fA-F0-9]{2}[:|\-]?){6})', | ||
'mac_address': r'\s((?:[a-fA-F0-9]{2}[:|\-]?){6})', | ||
'signal_level': r'signal: (-?\d{1,2}.\d{1,2}) dBm', | ||
'frequency': r'freq: (\d{1,4})', | ||
'time_offset': r'last seen: (\d{1,6}) ms' | ||
'time_offset': r'last seen: (\d{1,6}) ms', | ||
'ssid': r'SSID: (.{1,32})' | ||
}] | ||
}] | ||
|
||
|
@@ -76,12 +80,14 @@ def parse_iwconfig(data): | |
assert -127 <= float(wifi_sample['signal_level']) <= 127 | ||
assert wifi_sample['frequency'] is not None | ||
assert wifi_sample['time_offset'] is not None | ||
assert wifi_sample['ssid'] is not None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did we verify we can do this? we've recently found that some WiFi samples on some other platforms do not contain ssid so flagging here whether we're certain this is always available There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For NavVis I have not seen any wifi sample without it. And I would argue we should also be strict here. Thanks for checking. |
||
|
||
wifi_sample = IWConfigData( | ||
wifi_sample['mac_address'], | ||
float(wifi_sample['signal_level']), | ||
frequency_string_to_khz(wifi_sample['frequency']), | ||
wifi_sample['time_offset']) | ||
wifi_sample['time_offset'], | ||
wifi_sample['ssid']) | ||
|
||
parsed_samples.append(wifi_sample) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
locals like these do not bring much value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know.. was rather following the pattern