]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/turnout.h
616a7fedb3bcabddef78cd9dc52c56ea0a6185b1
[r2c2.git] / source / libmarklin / turnout.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBMARKLIN_TURNOUT_H_
9 #define LIBMARKLIN_TURNOUT_H_
10
11 #include <list>
12 #include <map>
13 #include <string>
14 #include <sigc++/sigc++.h>
15 #include "constants.h"
16
17 namespace Marklin {
18
19 class Control;
20 class Reply;
21
22 class Turnout
23 {
24 private:
25         Control  &control;
26         unsigned addr;
27         unsigned route;
28         bool     dual;
29
30 public:
31         sigc::signal<void, unsigned> signal_route_changing;
32         sigc::signal<void, unsigned> signal_route_changed;
33
34         Turnout(Control &, unsigned, bool =false);
35
36         void     set_route(unsigned);
37         unsigned get_address() const { return addr; }
38         unsigned get_route() const   { return route; }
39 private:
40         void command(bool);
41         void status_reply(const Reply &, bool);
42         bool switch_timeout();
43         void turnout_event(unsigned, bool);
44 };
45
46 } // namespace Marklin
47
48 #endif