3 This file is part of the MSP Märklin suite
4 Copyright © 2009 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef MARKLINNET_TRAIN_H_
9 #define MARKLINNET_TRAIN_H_
11 #include <sigc++/signal.h>
12 #include "libmarklin/locotype.h"
22 sigc::signal<void, const std::string &> signal_name_changed;
23 sigc::signal<void, unsigned> signal_speed_changed;
24 sigc::signal<void, bool> signal_reverse_changed;
25 sigc::signal<void, unsigned, bool> signal_function_changed;
26 sigc::signal<void, const std::string &> signal_status_changed;
30 const LocoType &loco_type;
39 NetTrain(Client &, const TrainInfoPacket &);
41 const LocoType &get_loco_type() const { return loco_type; }
42 unsigned get_address() const { return address; }
43 const std::string &get_name() const { return name; }
44 void set_speed(unsigned);
45 unsigned get_speed() const { return speed; }
46 void set_reverse(bool);
47 bool get_reverse() const { return reverse; }
48 void set_function(unsigned, bool);
49 bool get_function(unsigned i) const { return (functions>>i)&1; }
51 void process_packet(const TrainSpeedPacket &);
52 void process_packet(const TrainFunctionPacket &);
53 void process_packet(const TrainStatusPacket &);
56 } // namespace Marklin