X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Flocomotive.h;h=e3cbf7de238770e18dad536fb74dcc7cfc7d7d95;hb=ae0600f7c3df5b6ef46992b1423888dd0e9a5026;hp=68e1330efd3451fd9472acc746b179e1362a0670;hpb=6c61179fe09af2f5366d50f10aadbf5f83438087;p=r2c2.git diff --git a/source/libmarklin/locomotive.h b/source/libmarklin/locomotive.h index 68e1330..e3cbf7d 100644 --- a/source/libmarklin/locomotive.h +++ b/source/libmarklin/locomotive.h @@ -1,18 +1,41 @@ +/* $Id$ + +This file is part of the MSP Märklin suite +Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa +Distributed under the GPL +*/ + #ifndef LIBMARKLIN_LOCOMOTIVE_H_ #define LIBMARKLIN_LOCOMOTIVE_H_ #include #include +#include #include "constants.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: - Locomotive(Control &, unsigned); + sigc::signal signal_speed_changed; + sigc::signal 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); @@ -22,17 +45,10 @@ 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(); }; -typedef std::list LocomotiveSeq; } // namespace Marklin