]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/locomotive.h
Add networking library and a remote control program
[r2c2.git] / source / libmarklin / locomotive.h
index b8d58c29b34a35174780ab661ef5b123e6bc15fc..4a6770ec6c9feb701165828286d49bd52b9a1801 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of the MSP Märklin suite
-Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
+Copyright © 2006-200 Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
 
@@ -17,36 +17,41 @@ namespace Marklin {
 
 class Control;
 class LocoType;
+class Reply;
 
 class Locomotive
 {
+public:
+       sigc::signal<void, unsigned> signal_speed_changing;
+       sigc::signal<void, unsigned> signal_speed_changed;
+       sigc::signal<void, bool> signal_reverse_changed;
+       sigc::signal<void, unsigned, bool> signal_function_changed;
+
 private:
        const LocoType &type;
-       Control  &control;
+       Control &control;
        unsigned addr;
        unsigned speed;
-       bool     reverse;
+       bool reverse;
        unsigned funcs;
 
 public:
-       sigc::signal<void, unsigned> signal_speed_changed;
-       sigc::signal<void, unsigned, bool> signal_function_changed;
-
        Locomotive(const LocoType &, Control &, unsigned);
 
        const LocoType &get_type() const { return type; }
-       void     set_speed(unsigned);
-       void     set_reverse(bool);
-       void     set_function(unsigned, bool);
-       unsigned get_address() const   { return addr; }
-       unsigned get_speed() const     { return speed; }
-       bool     get_reverse() const   { return reverse; }
-       bool     get_function(unsigned f) const { return (funcs>>f)&1; }
-       void     refresh_status();
+       unsigned get_address() const { return addr; }
+       void set_speed(unsigned);
+       void set_reverse(bool);
+       void set_function(unsigned, bool);
+       unsigned get_speed() const { return speed; }
+       bool get_reverse() const { return reverse; }
+       bool get_function(unsigned f) const { return (funcs>>f)&1; }
+       unsigned get_functions() const { return funcs; }
+       void refresh_status();
 private:
-       void     send_command(bool);
-       void     status_reply(Error, const std::string &);
-       bool     reverse_timeout();
+       void send_command(bool);
+       void status_reply(const Reply &);
+       bool reverse_timeout();
 };
 
 } // namespace Marklin