WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit d6171a3c authored by Jack Henderson's avatar Jack Henderson
Browse files

add wifi monitor

parent a0dcf892
......@@ -16,9 +16,12 @@ class PtpMonitor:
task.addTask(diagnostic_updater.FunctionDiagnosticTask("PTP Stats", self.update_stats))
task.addTask(diagnostic_updater.FunctionDiagnosticTask("Clock sync check", self.check_sync_bounds))
task.addTask(diagnostic_updater.FunctionDiagnosticTask("Clock correction check", self.check_correction_bounds))
wifi_task = diagnostic_updater.FunctionDiagnosticTask("Wifi Status", self.update_wifi)
self.rate = rospy.Rate(0.5)
self.file = "/var/run/ptpd2.status"
self.ptp_file = "/var/run/ptpd2.status"
self.wifi_file = "/proc/net/wireless"
self.port_state = ''
self.offset = 0
......@@ -42,13 +45,13 @@ class PtpMonitor:
return stat
def get_ptp_data(self):
with open(self.file, 'r') as f:
with open(self.ptp_file, 'r') as f:
lines = f.readlines()
data = dict(map(line_to_map, lines))
return data
def update_stats(self, stat):
if os.path.exists(self.file):
if os.path.exists(self.ptp_file):
data = self.get_ptp_data()
stat.add('Local Time', data['Local time'])
......@@ -71,6 +74,32 @@ class PtpMonitor:
return stat
def get_wifi_data(self):
with open(self.wifi_file, 'r') as f:
lines = f.readlines()
if len(lines) > 2:
data = lines[2].split()
return data
return None
def update_wifi(self, stat):
if os.path.exists(self.wifi_file):
data = self.get_wifi_data()
if data is not None:
stat.add('Link Quality', data[2])
stat.add('Link Level', data[3])
stat.add('Link Noise', data[4])
stat.summary(diagnostic_msgs.msg.DiagnosticStatus.OK, "Wifi Connected")
stat.summary(diagnostic_msgs.msg.DiagnosticStatus.ERROR, "Wifi Not Connected")
stat.summary(diagnostic_msgs.msg.DiagnosticStatus.ERROR, "Unknown Wifi Status")
return stat
def run(self):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment