67 lines
1.3 KiB
C++
67 lines
1.3 KiB
C++
/***************************************************************************
|
|
|
|
miniCashConnect
|
|
Copyright © 2022 christoph holzheuer
|
|
c.holzheuer@sourceworx.org
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
#ifndef MCRECEIVER_H
|
|
#define MCRECEIVER_H
|
|
|
|
#include <QTcpServer>
|
|
#include <QWidget>
|
|
|
|
#include <libMiniCash.h>
|
|
|
|
|
|
/**
|
|
* @brief Ein angespasster QTcpServer
|
|
*/
|
|
|
|
class LIBMINICASH_EXPORT MCReceiver : public QTcpServer
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit MCReceiver() = default;
|
|
virtual ~MCReceiver();
|
|
|
|
void setupConnection( int port );
|
|
|
|
public slots:
|
|
|
|
void onCreateConnection();
|
|
void onDiscardConnection();
|
|
|
|
signals:
|
|
|
|
void connectionChanged( miniCash::CState newState );
|
|
void newTransaction( QString data );
|
|
|
|
protected slots:
|
|
|
|
void onNewConnection();
|
|
void onReadReady();
|
|
void onSocketDisconnected();
|
|
|
|
protected:
|
|
|
|
void appendToSocketList(QTcpSocket* socket);
|
|
|
|
int _port = -1;
|
|
QSet<QTcpSocket*> _connections;
|
|
|
|
};
|
|
|
|
|
|
#endif // MCRECEIVER_H
|