summaryrefslogtreecommitdiff
path: root/include/serial/SerialPort.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/serial/SerialPort.hpp')
-rw-r--r--include/serial/SerialPort.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/serial/SerialPort.hpp b/include/serial/SerialPort.hpp
new file mode 100644
index 0000000..a207d0c
--- /dev/null
+++ b/include/serial/SerialPort.hpp
@@ -0,0 +1,31 @@
+/*
+* Author: Manash Kumar Mandal
+* Modified Library introduced in Arduino Playground which does not work
+* This works perfectly
+* LICENSE: MIT
+*/
+
+#pragma once
+
+#define ARDUINO_WAIT_TIME 2000
+#define MAX_DATA_LENGTH 255
+
+#include <windows.h>
+#include <iostream>
+
+class SerialPort
+{
+private:
+ HANDLE handler;
+ bool connected;
+ COMSTAT status;
+ DWORD errors;
+public:
+ explicit SerialPort(const char *portName, int BAUD);
+ ~SerialPort();
+
+ int readSerialPort(const char *buffer, unsigned int buf_size);
+ bool writeSerialPort(const char *buffer, unsigned int buf_size);
+ bool isConnected();
+ void closeSerial();
+}; \ No newline at end of file