]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/locomotive.h
Allow intercepting and denying turnout route and locomotive speed changes
[r2c2.git] / source / libmarklin / locomotive.h
index 4188df5e809dd3cbf756dbfc4b070700a900c8d3..89b275ecb0db2020cc635dc695c8853648bd1d02 100644 (file)
@@ -1,3 +1,10 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2006-2009  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
 #ifndef LIBMARKLIN_LOCOMOTIVE_H_
 #define LIBMARKLIN_LOCOMOTIVE_H_
 
 namespace Marklin {
 
 class Control;
+class LocoType;
+class Reply;
 
 class Locomotive
 {
+private:
+       const LocoType &type;
+       Control  &control;
+       unsigned addr;
+       unsigned speed;
+       bool     reverse;
+       unsigned funcs;
+
 public:
+       sigc::signal<void, unsigned> signal_speed_changing;
        sigc::signal<void, unsigned> signal_speed_changed;
+       sigc::signal<void, unsigned, bool> signal_function_changed;
+
+       Locomotive(const LocoType &, Control &, unsigned);
 
-       Locomotive(Control &, unsigned);
+       const LocoType &get_type() const { return type; }
        void     set_speed(unsigned);
        void     set_reverse(bool);
        void     set_function(unsigned, bool);
@@ -25,14 +46,8 @@ public:
        bool     get_function(unsigned f) const { return (funcs>>f)&1; }
        void     refresh_status();
 private:
-       Control  &control;
-       unsigned addr;
-       unsigned speed;
-       bool     reverse;
-       unsigned funcs;
-
        void     send_command(bool);
-       void     status_reply(Error, const std::string &);
+       void     status_reply(const Reply &);
        bool     reverse_timeout();
 };