From 30381dbf4bd45b62a8a11100ea60c121a966a73a Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 16 Aug 2011 13:03:35 +0200 Subject: need to clean up git --- Src/PyCatcher/src/driverConnector.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Src/PyCatcher/src/driverConnector.py (limited to 'Src/PyCatcher/src/driverConnector.py') diff --git a/Src/PyCatcher/src/driverConnector.py b/Src/PyCatcher/src/driverConnector.py new file mode 100644 index 0000000..d7509e6 --- /dev/null +++ b/Src/PyCatcher/src/driverConnector.py @@ -0,0 +1,26 @@ +from pyCatcherModel import BaseStationInformation +import subprocess +import threading + +class DriverConnector: + def __init__ (self, bs_found_callback): + self._thread_break = False + self._bs_found_callback = bs_found_callback + pass + + def start_scanning (self): + self._thread_break = False + threading.Thread(target= self._do_scan).start() + + def _do_scan(self): + #TODO: insert right command here + ps_object = subprocess.Popen('ps', stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + while not self._thread_break: + base_station_info = BaseStationInformation() + base_station_info.parse_file(ps_object.stdout) + self._bs_found_callback(base_station_info) + ps_object.kill() + + def stop_scanning (self): + self._thread_break = True + \ No newline at end of file -- cgit v1.2.3-55-g7522