Allan Brignoli
/
Rome2_P6
gugus
SerialServer.h@0:1a0321f1ffbc, 2018-05-18 (annotated)
- Committer:
- Brignall
- Date:
- Fri May 18 12:18:21 2018 +0000
- Revision:
- 0:1a0321f1ffbc
lala;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Brignall | 0:1a0321f1ffbc | 1 | /* |
Brignall | 0:1a0321f1ffbc | 2 | * SerialServer.h |
Brignall | 0:1a0321f1ffbc | 3 | * Copyright (c) 2018, ZHAW |
Brignall | 0:1a0321f1ffbc | 4 | * All rights reserved. |
Brignall | 0:1a0321f1ffbc | 5 | */ |
Brignall | 0:1a0321f1ffbc | 6 | |
Brignall | 0:1a0321f1ffbc | 7 | #ifndef SERIAL_SERVER_H_ |
Brignall | 0:1a0321f1ffbc | 8 | #define SERIAL_SERVER_H_ |
Brignall | 0:1a0321f1ffbc | 9 | |
Brignall | 0:1a0321f1ffbc | 10 | #include <cstdlib> |
Brignall | 0:1a0321f1ffbc | 11 | #include <string> |
Brignall | 0:1a0321f1ffbc | 12 | #include <mbed.h> |
Brignall | 0:1a0321f1ffbc | 13 | #include "LIDAR.h" |
Brignall | 0:1a0321f1ffbc | 14 | #include "Controller.h" |
Brignall | 0:1a0321f1ffbc | 15 | |
Brignall | 0:1a0321f1ffbc | 16 | using namespace std; |
Brignall | 0:1a0321f1ffbc | 17 | |
Brignall | 0:1a0321f1ffbc | 18 | /** |
Brignall | 0:1a0321f1ffbc | 19 | * This class implements a communication server using a serial interface. |
Brignall | 0:1a0321f1ffbc | 20 | */ |
Brignall | 0:1a0321f1ffbc | 21 | class SerialServer { |
Brignall | 0:1a0321f1ffbc | 22 | |
Brignall | 0:1a0321f1ffbc | 23 | public: |
Brignall | 0:1a0321f1ffbc | 24 | |
Brignall | 0:1a0321f1ffbc | 25 | SerialServer(RawSerial& serial, LIDAR& lidar, Controller& controller); |
Brignall | 0:1a0321f1ffbc | 26 | virtual ~SerialServer(); |
Brignall | 0:1a0321f1ffbc | 27 | |
Brignall | 0:1a0321f1ffbc | 28 | private: |
Brignall | 0:1a0321f1ffbc | 29 | |
Brignall | 0:1a0321f1ffbc | 30 | static const float PERIOD; |
Brignall | 0:1a0321f1ffbc | 31 | static const char INT_TO_CHAR[]; |
Brignall | 0:1a0321f1ffbc | 32 | static const int BUFFER_SIZE = 64; |
Brignall | 0:1a0321f1ffbc | 33 | |
Brignall | 0:1a0321f1ffbc | 34 | RawSerial& serial; |
Brignall | 0:1a0321f1ffbc | 35 | LIDAR& lidar; |
Brignall | 0:1a0321f1ffbc | 36 | Controller& controller; |
Brignall | 0:1a0321f1ffbc | 37 | string input; |
Brignall | 0:1a0321f1ffbc | 38 | string output; |
Brignall | 0:1a0321f1ffbc | 39 | Ticker ticker; |
Brignall | 0:1a0321f1ffbc | 40 | |
Brignall | 0:1a0321f1ffbc | 41 | void receive(); |
Brignall | 0:1a0321f1ffbc | 42 | void transmit(); |
Brignall | 0:1a0321f1ffbc | 43 | }; |
Brignall | 0:1a0321f1ffbc | 44 | |
Brignall | 0:1a0321f1ffbc | 45 | #endif /* SERIAL_SERVER_H_ */ |
Brignall | 0:1a0321f1ffbc | 46 |