]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/sensor.h
Add state loading and saving to engineer
[r2c2.git] / source / libmarklin / sensor.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBMARKLIN_SENSOR_H_
9 #define LIBMARKLIN_SENSOR_H_
10
11 #include <list>
12 #include <map>
13 #include <sigc++/signal.h>
14 #include <msp/time/timestamp.h>
15
16 namespace Marklin {
17
18 class Control;
19
20 class Sensor
21 {
22 private:
23         Control  &control;
24         unsigned addr;
25         bool     state;
26         Msp::Time::TimeStamp off_timeout;
27
28 public:
29         sigc::signal<void, bool> signal_state_changed;
30
31         Sensor(Control &, unsigned);
32
33         unsigned get_address() const { return addr; }
34         bool     get_state() const   { return state; }
35         void     tick();
36 private:
37         void sensor_event(unsigned, bool);
38 };
39
40 } // namespace Marklin
41
42 #endif