]> git.tdb.fi Git - r2c2.git/blob - source/serial/serial.h
Rename the project to R²C²
[r2c2.git] / source / serial / serial.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef SERIAL_H_
9 #define SERIAL_H_
10
11 #include <msp/core/application.h>
12 #include <msp/io/serial.h>
13 #include "network/client.h"
14
15 class Serial: public Msp::Application
16 {
17 private:
18         Msp::IO::EventDispatcher event_disp;
19         R2C2::Catalogue catalogue;
20         R2C2::Client client;
21         Msp::IO::Serial serial_port;
22         R2C2::NetTrain *train;
23         bool reverse;
24         char rx_buf[3];
25         unsigned rx_fill;
26
27         static Msp::Application::RegApp<Serial> reg;
28
29 public:
30         Serial(int, char **);
31
32 private:
33         virtual void tick();
34         void train_added(R2C2::NetTrain &);
35         void error(const std::string &);
36         void set_train(R2C2::NetTrain *);
37         void next_train();
38         void prev_train();
39         void data_available();
40 };
41
42 #endif