summaryrefslogtreecommitdiffstats
path: root/Src/eclipse/.metadata/.plugins/org.eclipse.core.resources/.history/67/9046d1037ff2001019c79f38f40e52ba
blob: d35a1acda996e591842b1552c8d8dc4eafe4db6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import sys
import pygtk
import gtk #@UnresolvedImport
import gtk.glade #@UnresolvedImport
from driverConnector import DriverConnector
from pyCatcherModel import BaseStationInformation, BaseStationInformationList
from pyCatcherView import PyCatcherGUI

class PyCatcherController:
    def __init__(self):
        
        self._base_station_list = BaseStationInformationList()              
        self._gui = PyCatcherGUI(self)
        self._driver_connector = DriverConnector()       
        self._gui.log_line("GUI initialized")
        self.bs_tree_list_data = gtk.ListStore(str,str,str,str)
        gtk.main()
                
    def log_message(self, message):
        self._gui.log_line(message)            
    
    def start_scan(self):
        self._gui.log_line("start scan")
        self._driver_connector.start_scanning(self._found_base_station_callback)
        
    def stop_scan(self):
        self._gui.log_line("stop scan")
        self._driver_connector.stop_scanning()
        
    def start_firmware(self):
        self._gui.log_line("start firmware")
        self._driver_connector.start_firmware(self._firmware_waiting_callback, self._firmware_done_callback)
        
    def stop_firmware(self):
        self._gui.log_line("stop firmware")
        print 'stop firmwares'
        self._driver_connector.stop_firmware()
    
    def shutdown(self):
        self._driver_connector.shutdown()
    
    def _found_base_station_callback(self, base_station_info):
        self._gui.log_line("found " + base_station_info.country + '(' + base_station_info.arfcn + ')')
        #self.bs_tree_list_data = 
    
    def _firmware_waiting_callback(self):
        self._gui.log_line("firmware waiting for device")
        self._gui.show_info('Switch on the phone now.', 'Firmware')
        
    def _firmware_done_callback(self):
        self._gui.log_line("firmware loaded, ready for scanning")
        self._gui.show_info('Firmware load completed', 'Firmware')