-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcscomqueue.h
More file actions
127 lines (87 loc) · 3.5 KB
/
cscomqueue.h
File metadata and controls
127 lines (87 loc) · 3.5 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef CSCOMQUEUE_H
#define CSCOMQUEUE_H
#include <QObject>
#include "cscomworker.h"
#include "common_inc.h"
//============================================================================================================
// Defines
//============================================================================================================
//Debug prefix
#define CScomQueue_DEBUG_PREFIX ("CScomQueue: ")
//============================================================================================================
// Typedefs
//============================================================================================================
namespace HD_SCOM {
struct SCOMQueueItem
{
SCOM_MSG mScomMsgSend;
SCOM_MSG mScomMsgExpectedAnswer;
unsigned int uintDelayAfter;
unsigned int uintMaxRepeatTime;
bool bCritical;
bool bWaitUntil;
bool bResult;
};
}
//============================================================================================================
// Classes
//============================================================================================================
namespace HD_SCOM {
class CScomQueue : public QObject
{
Q_OBJECT
public:
CScomQueue();
~CScomQueue();
//Start Queue
hd_common::e_Error Start(void);
//Stop Queue
hd_common::e_Error Stop(void);
//Execute SCOM Queue Item from Front Send
hd_common::e_Error ExecuteSend(void);
// Compare answer with expected target
hd_common::e_Error CompareAnswerWithTarget(SCOM_MSG& mSCOMAnswer, SCOM_MSG& mSCOMTarget);
// Output debug log
void OutputDebugLog(QString sFunction, QString sType, hd_common::e_Error Code);
// Output debug log
void OutputDebugLog(QString sFunction, QString sType, QString sText);
private:
//SCOM execution queue
QList<SCOMQueueItem> mListSCOMQueue;
//Combined SCOM Port
QSerialPort mSerialPortConnected;
//SCOM Worker
CScomWorker mScomWorker;
//global flag whether queue should be terminated
bool bTerminate = false;
///Timer used for delay after message
QTimer mDelayTimer;
signals:
//signal to notify the case is started
void SignalScomQueueStartStop(bool bOpen);
//signal to notify the case is finished
void SignalScomQueueFinish(hd_common::e_Error eRet);
//signal to output to log box
void SignalLogOutput(QString sLog);
private slots:
void DelayTimeoutRoutine(void);
public slots:
//Configure SCOM Worker Serial port
void PublicSlotConfigureSCOMWorker(QString qStringCOMPort, QString qStringBaudrate);
//Insert SCOM command to tail
void PublicSlotInsertSCOMQueue(SCOMQueueItem message);
//Insert SCOM Queue Item to Front and execute immediately
void PublicSlotInsertSCOMQueueAndShot(SCOMQueueItem message);
//Delete SCOM command at tail
void PublicSlotDeleteSCOMQueueTail(void);
//Delete SCOM command at front
void PublicSlotDeleteSCOMQueueFront(void);
//Start/Stop SCOM Queue with SCOM worker
void PublicSlotStartSCOMQueue(bool bStartStop);
//Execute SCOM Queue Item from Front Read
void PublicSlotExecuteRead(int number);
//Public slot to terminate current queue and shot
void PublicSlotTerminateQueueAndShot(bool bRunCancel);
};
}
#endif // CSCOMQUEUE_H