- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArduinoReader.h
More file actions
Latest commit
36 lines (34 loc) · 995 Bytes
/
Copy pathArduinoReader.h
File metadata and controls
36 lines (34 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include<thread>
#include"mainWindow.h"
#include"threadSafeScreen.h"
classArduinoReader {
public:
ArduinoReader(mainWindow* window, threadSafeScreen* tss, bool resetFlag, bool debug, std::string comPort, long baud);
~ArduinoReader();
ArduinoReader(ArduinoReader const&) = delete; //can't move or copy, as neither atomic types nor threads can be copied or moved
ArduinoReader& operator =(ArduinoReader const&) = delete;
private:
voidonFatalError(std::string function, unsignedlong error);
voidonFatalError();
unsignedintparseInt(unsignedchar* buffer);
boolwaitForArduinoStart();
boolreadHeader();
boolmainLoop();
voidstartReal();
boolinitializeSerial();
//pointers (owned)
HANDLE serialHandle;
DCB dcb;
//pointers (not owned)
mainWindow* window;
threadSafeScreen* tss;
//threads (owned)
std::thread readerThread;
//instance vars
std::atomic_bool shouldStop;
std::string comPort;
bool resetFlag, debugDisabled;
int xRes, yRes;
long baud;
};