Minor cutting/pasting in device connection manager.

No functional change.
This commit is contained in:
sawinglogz 2020-06-30 11:35:23 -04:00
parent 09a96b893e
commit e47610cf5c
2 changed files with 23 additions and 29 deletions

View File

@ -14,6 +14,8 @@
#include <QDir>
#include <QBuffer>
#include <QDateTime>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include <QDebug>
@ -940,12 +942,27 @@ bool SerialPortInfo::operator==(const SerialPortInfo & other) const
}
// TODO: restrict constructor to OpenConnectionEvent
// MARK: -
// MARK: Device connection base class
class OpenConnectionEvent : public XmlReplayBase<OpenConnectionEvent>
{
public:
OpenConnectionEvent() {}
OpenConnectionEvent(const QString & type, const QString & name)
{
set("type", type);
set("name", name);
}
virtual const QString id() const { return m_values["name"]; }
};
REGISTER_XMLREPLAYEVENT("openConnection", OpenConnectionEvent);
class ConnectionEvent : public XmlReplayBase<ConnectionEvent>
{
public:
ConnectionEvent() { Q_ASSERT(false); } // Implement if we ever support string-based substreams
ConnectionEvent(const XmlReplayEvent & trigger)
ConnectionEvent(const OpenConnectionEvent & trigger)
{
copy(trigger);
}
@ -957,9 +974,6 @@ public:
};
REGISTER_XMLREPLAYEVENT("connection", ConnectionEvent);
// MARK: -
// MARK: Device connection base class
class ConnectionRecorder : public XmlRecorder
{
public:
@ -1027,19 +1041,6 @@ public:
};
REGISTER_XMLREPLAYEVENT("get", GetValueEvent);
class OpenConnectionEvent : public XmlReplayBase<OpenConnectionEvent>
{
public:
OpenConnectionEvent() {}
OpenConnectionEvent(const QString & type, const QString & name)
{
set("type", type);
set("name", name);
}
virtual const QString id() const { return m_values["name"]; }
};
REGISTER_XMLREPLAYEVENT("openConnection", OpenConnectionEvent);
class CloseConnectionEvent : public XmlReplayBase<CloseConnectionEvent>
{
public:

View File

@ -15,20 +15,13 @@
#include <QtSerialPort/QSerialPort>
#include <QHash>
#include <QVariant>
#include <QDateTime>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
class XmlRecorder;
class XmlReplay;
class XmlReplayEvent;
class DeviceConnection : public QObject
{
Q_OBJECT
protected:
DeviceConnection(const QString & name, XmlRecorder* record, XmlReplay* replay);
DeviceConnection(const QString & name, class XmlRecorder* record, class XmlReplay* replay);
const QString & m_name;
XmlRecorder* m_record;
@ -99,7 +92,7 @@ class SerialPortConnection : public DeviceConnection
private:
QSerialPort m_port;
void checkResult(bool ok, XmlReplayEvent & event) const;
void checkResult(bool ok, class XmlReplayEvent & event) const;
void checkResult(qint64 len, XmlReplayEvent & event) const;
void checkError(XmlReplayEvent & event) const;
void close();
@ -197,8 +190,8 @@ public:
inline bool isNull() const { return m_info.isEmpty(); }
operator QString() const;
friend QXmlStreamWriter & operator<<(QXmlStreamWriter & xml, const SerialPortInfo & info);
friend QXmlStreamReader & operator>>(QXmlStreamReader & xml, SerialPortInfo & info);
friend class QXmlStreamWriter & operator<<(QXmlStreamWriter & xml, const SerialPortInfo & info);
friend class QXmlStreamReader & operator>>(QXmlStreamReader & xml, SerialPortInfo & info);
bool operator==(const SerialPortInfo & other) const;
protected: