Package kenozooid :: Package driver :: Module dummy

Source Code for Module kenozooid.driver.dummy

 1  # 
 2  # Kenozooid - dive planning and analysis toolbox. 
 3  # 
 4  # Copyright (C) 2009-2019 by Artur Wroblewski <wrobell@riseup.net> 
 5  # 
 6  # This program is free software: you can redistribute it and/or modify 
 7  # it under the terms of the GNU General Public License as published by 
 8  # the Free Software Foundation, either version 3 of the License, or 
 9  # (at your option) any later version. 
10  # 
11  # This program is distributed in the hope that it will be useful, 
12  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
14  # GNU General Public License for more details. 
15  # 
16  # You should have received a copy of the GNU General Public License 
17  # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
18  # 
19   
20  """ 
21  Dummy driver does not communicate to any computer device. Instead, it 
22  provides some sample data and displays provided information like time and 
23  depth during dive simulation. 
24  """ 
25   
26  from datetime import datetime 
27   
28  from kenozooid.driver import DeviceDriver, Simulator 
29  from kenozooid.component import inject 
30   
31  @inject(DeviceDriver, id='dummy', name='Dummy Device Driver', 
32          models=('Dummy',)) 
33 -class DummyDriver(object):
34 - def version(self):
35 return 'Dummy Device 1.0'
36 37 @staticmethod
38 - def scan(port=None):
39 yield DummyDriver()
40
41 42 43 @inject(Simulator, id='dummy') 44 -class DummySimulator(object):
45 """ 46 Dummy simulator implementation. 47 """
48 - def start(self):
49 """ 50 Print information about starting dive simulation. 51 """ 52 print('Starting dive simulation')
53 54
55 - def depth(self, d):
56 """ 57 Print current time and depth. 58 """ 59 print('%s -> %02dm' % (datetime.now().time(), d))
60 61
62 - def stop(self):
63 """ 64 Print information about stopping dive simulation. 65 """ 66 print('Stopping dive simulation')
67