X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fintellibox.h;h=efdf3b2edd633b72fe54a1f0471b75d45269bef4;hb=32316772d422223827833366a7ee2d0a76d76ff1;hp=8655bfc8ddc9509a472c0c091a6122ef02034004;hpb=1ff06c5bc46a677fa389ef86c6b26664368f1653;p=r2c2.git diff --git a/source/libr2c2/intellibox.h b/source/libr2c2/intellibox.h index 8655bfc..efdf3b2 100644 --- a/source/libr2c2/intellibox.h +++ b/source/libr2c2/intellibox.h @@ -1,14 +1,8 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #ifndef LIBR2C2_INTELLIBOX_H_ #define LIBR2C2_INTELLIBOX_H_ #include +#include #include #include "driver.h" @@ -68,11 +62,12 @@ private: ERR_NO_I2C_SPACE, ERR_LOW_TURNOUT_SPACE=0x40, ERR_LOK_HALTED, - ERR_LOK_POWER_OFF, + ERR_LOK_POWER_OFF }; enum Protocol { + NONE, MM, MM_27 }; @@ -80,6 +75,7 @@ private: struct Locomotive { Protocol protocol; + bool ext_func; unsigned speed; bool reverse; unsigned funcs; @@ -91,9 +87,11 @@ private: struct Turnout { - bool state; + unsigned bits; + unsigned state; bool active; - bool pending; + bool synced; + unsigned pending; Msp::Time::TimeStamp off_timeout; Turnout(); @@ -115,7 +113,7 @@ private: unsigned length; }; - int serial_fd; + Msp::IO::Serial serial; bool power; bool halted; std::map locos; @@ -136,14 +134,14 @@ public: virtual const char *enumerate_protocols(unsigned) const; virtual unsigned get_protocol_speed_steps(const std::string &) const; - virtual void add_loco(unsigned, const std::string &); + virtual void add_loco(unsigned, const std::string &, const VehicleType &); virtual void set_loco_speed(unsigned, unsigned); virtual void set_loco_reverse(unsigned, bool); virtual void set_loco_function(unsigned, unsigned, bool); - virtual void add_turnout(unsigned); - virtual void set_turnout(unsigned, bool); - virtual bool get_turnout(unsigned) const; + virtual void add_turnout(unsigned, const TrackType &); + virtual void set_turnout(unsigned, unsigned); + virtual unsigned get_turnout(unsigned) const; virtual void add_sensor(unsigned); virtual void set_sensor(unsigned, bool) { } @@ -157,7 +155,7 @@ private: void command(Command); void command(Command, const unsigned char *, unsigned); void command(Command, unsigned, const unsigned char *, unsigned); - void loco_command(unsigned, unsigned, bool, unsigned); + void loco_command(unsigned, unsigned, bool, unsigned, bool); void turnout_command(unsigned, bool, bool); void process_reply(const Msp::Time::TimeStamp &); unsigned read_all(unsigned char *, unsigned);