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