-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsercomm.h
92 lines (70 loc) · 1.61 KB
/
sercomm.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
#ifndef SERCOMM_H
#define SERCOMM_H
#include "paramwarehouse.h"
class SerComm : public QObject
{
Q_OBJECT
public:
explicit SerComm(QObject *parent = 0);
private://data
//FSM
int sc_State;
int fsm();
//private data members
QSerialPort *serial;
//Buffers
unsigned char recvbuff[250];
int inSize;
int expectedSize;
unsigned char* transbuff;
int outSize;
//flags
bool reseter;
bool localError;
//**outgoing flags
int g_sc_Error;
bool sc_replyReady;
//**incoming flags
bool g_sc_Write;
bool g_sc_Discon;
private: //functions
//data channels
void load_transbuff(unsigned char* , int);
unsigned char* generate_payload();
//transmit & receive
bool Transmit();
bool fauxTransmit();
int Receive();
int fauxReceive();
//parse reply
bool checkDestRegs();
bool checkCRC();
public:
//execute
void exeFSM();
bool serviceCOMM();
//data channels
unsigned char* get_payload();
int getInSize();
int get_scState();
bool getReplyReady();
bool getWriteFlag();
int getError();
bool getContinueError();
bool setWrite(unsigned char *modcmd, int size);
void squelchReadyFlag();
//outward data buffer
unsigned char* payload;
int payloadLength;
//flags
int showState();
int showError();
//formerly slots, now data 'settors'
public:
bool openCOMPort(QString portN, QString baudR,
QString parity, QString stopB);
bool closeCOMPort();
void reset(bool local);
void setCOM(QString portName);
};
#endif // SERCOMM_H