X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Flocomotive.h;h=4a6770ec6c9feb701165828286d49bd52b9a1801;hb=dcfa1e9503b7e97b61396d7458f0b2e5896779cd;hp=eae99f57dddfdb66e5f7183fa3fa52356a540e97;hpb=1d735b80482317fd930eb47ca255ab9f1f120a7d;p=r2c2.git diff --git a/source/libmarklin/locomotive.h b/source/libmarklin/locomotive.h index eae99f5..4a6770e 100644 --- a/source/libmarklin/locomotive.h +++ b/source/libmarklin/locomotive.h @@ -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_ @@ -9,33 +16,42 @@ namespace Marklin { class Control; +class LocoType; +class Reply; class Locomotive { +public: + sigc::signal signal_speed_changing; + sigc::signal signal_speed_changed; + sigc::signal signal_reverse_changed; + sigc::signal signal_function_changed; + private: - Control &control; + const LocoType &type; + Control &control; unsigned addr; unsigned speed; - bool reverse; + bool reverse; unsigned funcs; public: - sigc::signal signal_speed_changed; - - Locomotive(Control &, unsigned); - - 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(); + Locomotive(const LocoType &, Control &, unsigned); + + const LocoType &get_type() const { return type; } + 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