Zürcher Eliteeinheit / Mbed 2 deprecated ROME2_P4

Dependencies:   ROME2_P2 mbed

Fork of ROME2_P3 by Zürcher Eliteeinheit

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SerialServer.h Source File

SerialServer.h

00001 /*
00002  * SerialServer.h
00003  * Copyright (c) 2018, ZHAW
00004  * All rights reserved.
00005  */
00006 
00007 #ifndef SERIAL_SERVER_H_
00008 #define SERIAL_SERVER_H_
00009 
00010 #include <cstdlib>
00011 #include <string>
00012 #include <mbed.h>
00013 #include "IMU.h"
00014 #include "Controller.h"
00015 
00016 using namespace std;
00017 
00018 /**
00019  * This class implements a communication server using a serial interface.
00020  */
00021 class SerialServer {
00022     
00023     public:
00024         
00025                         SerialServer(Serial& serial, IMU& imu, Controller& controller);
00026         virtual         ~SerialServer();
00027         
00028     private:
00029         
00030         static const float  PERIOD;
00031         static const int    BUFFER_SIZE = 64;
00032         
00033         Serial&         serial;
00034         IMU&            imu;
00035         Controller&     controller;
00036         string          input;
00037         string          output;
00038         Ticker          ticker;
00039         
00040         void            receive();
00041         void            transmit();
00042 };
00043 
00044 #endif /* SERIAL_SERVER_H_ */
00045