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_route_changed;
27 sigc::signal<void, const std::string &> signal_status_changed;
31 const LocoType &loco_type;
41 NetTrain(Client &, const TrainInfoPacket &);
43 const LocoType &get_loco_type() const { return loco_type; }
44 unsigned get_address() const { return address; }
45 const std::string &get_name() const { return name; }
46 void set_speed(unsigned);
47 unsigned get_speed() const { return speed; }
48 void set_reverse(bool);
49 bool get_reverse() const { return reverse; }
50 void set_function(unsigned, bool);
51 bool get_function(unsigned i) const { return (functions>>i)&1; }
52 void set_route(const std::string &);
53 const std::string &get_route() const { return route; }
55 void process_packet(const TrainSpeedPacket &);
56 void process_packet(const TrainFunctionPacket &);
57 void process_packet(const TrainRoutePacket &);
58 void process_packet(const TrainStatusPacket &);
61 } // namespace Marklin