-
Notifications
You must be signed in to change notification settings - Fork 0
/
TC110Communicator.h
95 lines (62 loc) · 1.78 KB
/
TC110Communicator.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#pragma once
#include <string>
#include <windows.h>
class TC110Communicator
{
private:
// Serial comm handler
HANDLE hSerial;
// Connection status
bool connected;
// Get various information about the connection
COMSTAT status;
// Keep track of last error
DWORD errors;
// ID of pumping station
int id;
// Write a package to the TC110
bool WritePackage(std::string package);
// Read a package from TC110
std::string ReadPackage(unsigned int byteCount);
//Calculate the check sum for a package being sent
std::string CalculateCheckSum(std::string string);
// Check a check sum for data provided
bool CheckSumValidation(std::string package);
// Create the package
std::string CreatePackage(std::string action, std::string parameterValue, std::string data);
public:
// Start the communication
TC110Communicator(char *portName, int id);
// Close class and communication link
~TC110Communicator(void);
// Close the com port
bool Close();
// Is the PC still connected to TC110?
bool IsConnected();
// Send the package
std::string send(std::string action, std::string parameterValue, std::string data, unsigned int bytesRead);
// Get temperature
double GetTemperature(int location);
// Get turbo speed
double GetTurboSpeed(int type);
// get error message
std::string GetError(int id);
// Get gas mode
int GetGasMode();
// Get backing pump mode
int GetBackingPumpMode();
// Get turbo pump mode
int GetTurboPumpState();
// Is unit pumping?
int GetPumpingState();
// Set turbo speed
bool SetTurboSpeed(int speed);
// Set gas mode
bool SetGasMode(int mode);
// Set backing pump mode
bool SetBackingPumpMode(int mode);
// Set turbo pump state
bool SetTurboPumpState(int state);
// Should the station be pumping?
bool SetPumpingState(int state);
};