BA / SerialCom

Fork of OmniWheels by Gustav Atmel

Revision:
1:9c5af431a1f1
diff -r d698f15ceaf1 -r 9c5af431a1f1 SerialServerSend.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SerialServerSend.h	Tue May 01 15:47:08 2018 +0000
@@ -0,0 +1,50 @@
+/*
+ * SerialServer.h
+ * Copyright (c) 2017, ZHAW
+ * All rights reserved.
+ *
+ *  Created on: 05.06.2017
+ *      Author: Marcel Honegger
+ */
+
+#ifndef SERIAL_SERVER_SEND_H_
+#define SERIAL_SERVER_SEND_H_
+
+#include <cstdlib>
+#include <string>
+#include <mbed.h>
+#include "Signal.h"
+
+using namespace std;
+
+
+
+/**
+ * This class implements a communication server using a serial interface.
+ */
+class SerialServerSend {
+    
+    public:
+        
+                    SerialServerSend(RawSerial& serial);
+        virtual     ~SerialServerSend();
+       
+    private:
+        
+        static const uint32_t   STACK_SIZE = 2048;      // stack size of thread, given in [bytes]
+        static const float      PERIOD;                 // the period of the timer interrupt, given in [s]
+        static const int32_t    DATA_SIZE = 8;          // size of data message, without hex encoding and termination, in [bytes]
+        static const int32_t    MESSAGE_SIZE = 315+1;    // size of entire message, incl. termination, given in [bytes]
+        
+        RawSerial&      serial;
+        string          input;
+        string          output;
+        Signal          signal;
+        Thread          thread;
+        Ticker          ticker;
+
+        void        sendSignal();
+        void        run();
+};
+
+#endif /* SERIAL_SERVER_H_ */