Added Logout

This commit is contained in:
2024-06-14 12:50:12 +02:00
parent bc00d25ded
commit fc94e603c5
2 changed files with 58 additions and 5 deletions

View File

@@ -17,6 +17,11 @@ public:
// POS_HOST_FORMAT_1_UNENCRYPTED = 0x21
};
enum AsyncPosCommand : std::uint8_t {
LOGIN = 0,
LOGOUT = 1
};
explicit MessageHelper(QString const &posID = "T-TPS-SELF2002in",
QString const &apak = "8AC304380E0E476BA2558B75DB9E2516");
explicit MessageHelper(QByteArray const &posID, QString const &apak);
@@ -29,8 +34,9 @@ public:
bool insertEncryptedPacketID(QByteArray const &encryptedPacketID);
QByteArrayList const &getMessageChunksToSend();
QByteArrayList const &createLoginMessageChunksToSend(char ext);
QByteArrayList createLoginMessageChunksToSend(char etx);
QByteArrayList createLogoutMessageChunksToSend(char etx);
QByteArrayList const &createMessageChunksToSend(AsyncPosCommand cmd, char etx);
// private:
@@ -40,11 +46,13 @@ public:
QByteArray m_messageHeaderPrefix;
QByteArray m_rawPacket; // without leading STX and trailing [ETX(1/2), LRC]
QByteArray m_loginMessage;
QByteArray m_logoutMessage;
QByteArrayList m_messageChunkList;
bool setMessageHeaderPacketType(PacketType packetType);
bool createMessageHeaderPrefix(PacketType packetType, QByteArray const &encryptedPacketID);
void createLoginMessage();
void createLogoutMessage();
static QByteArray const &mask(QByteArray &messageChunk);
static QByteArray const &unMask(QByteArray &messageChunk);