]> git.tdb.fi Git - r2c2.git/blob - source/serial/serial.h
Set turnout paths synchronously when allocating blocks
[r2c2.git] / source / serial / serial.h
1 #ifndef SERIAL_H_
2 #define SERIAL_H_
3
4 #include <msp/core/application.h>
5 #include <msp/io/serial.h>
6 #include "network/client.h"
7
8 class Serial: public Msp::RegisteredApplication<Serial>
9 {
10 private:
11         Msp::IO::EventDispatcher event_disp;
12         R2C2::Catalogue catalogue;
13         R2C2::Client client;
14         Msp::IO::Serial serial_port;
15         R2C2::NetTrain *train;
16         bool reverse;
17         char rx_buf[3];
18         unsigned rx_fill;
19
20 public:
21         Serial(int, char **);
22
23 private:
24         virtual void tick();
25         void train_added(R2C2::NetTrain &);
26         void error(const std::string &);
27         void set_train(R2C2::NetTrain *);
28         void next_train();
29         void prev_train();
30         void data_available();
31 };
32
33 #endif