Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Connection Handler for the RS232 serial connection to the sfm
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, NLST, 2018-01-29
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "logger.h"
|
||||
#include <LtsSerialPortQuerry/lts_serial_port_querry.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QSerialPort>
|
||||
|
||||
|
||||
namespace EffectShowClient
|
||||
{
|
||||
|
||||
class ConnectionHandlerSerial : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConnectionHandlerSerial(QObject *parent = nullptr);
|
||||
~ConnectionHandlerSerial();
|
||||
|
||||
bool init();
|
||||
bool send(const QByteArray &binaryData);
|
||||
bool open();
|
||||
bool isOpen() const;
|
||||
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief received emits a byte pair with command and payload byte when a available. It is guaranteed that there will be 2 bytes
|
||||
* @param ba is a byte pair, with command 1st and payload 2nd.
|
||||
*/
|
||||
void received(const QByteArray &ba);
|
||||
void connectedToSerialConverter();
|
||||
void disconnectedFromSerialConverter();
|
||||
|
||||
|
||||
private slots:
|
||||
void read();
|
||||
|
||||
private:
|
||||
bool isValidCommandByte(const unsigned char command);
|
||||
bool isValidPayloadByte(const unsigned char payload);
|
||||
LtsSerialPortQuerry::LtsSerialPortQuerry *m_spQuerry;
|
||||
QSerialPort *m_serialPort;
|
||||
QTimer *m_receiveTimeoutTimer;
|
||||
QByteArray m_currentDataRead;
|
||||
QString m_portName;
|
||||
QByteArray *m_readBuffer;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} // namespace EffectShowClient
|
||||
Reference in new issue
Block a user