AusweisApp2/src/network/DatagramHandler.h

38 lines
706 B
C
Raw Normal View History

2017-07-03 09:33:28 +02:00
/*!
* \brief Provides an interface to send and receive datagrams over UDP.
*
2017-12-20 14:54:05 +01:00
* \copyright Copyright (c) 2016-2017 Governikus GmbH & Co. KG, Germany
2017-07-03 09:33:28 +02:00
*/
#pragma once
#include <QHostAddress>
#include <QJsonDocument>
#include <QSharedPointer>
2017-12-20 14:54:05 +01:00
class test_DatagramHandlerImpl;
2017-07-03 09:33:28 +02:00
namespace governikus
{
class DatagramHandler
: public QObject
{
Q_OBJECT
2017-12-20 14:54:05 +01:00
private:
friend class ::test_DatagramHandlerImpl;
2017-07-03 09:33:28 +02:00
2017-12-20 14:54:05 +01:00
public:
DatagramHandler(bool pListen = true);
2017-07-03 09:33:28 +02:00
virtual ~DatagramHandler();
virtual bool isBound() const = 0;
2017-12-20 14:54:05 +01:00
virtual bool send(const QJsonDocument& pData) = 0;
2017-07-03 09:33:28 +02:00
Q_SIGNALS:
void fireNewMessage(const QJsonDocument& pData, const QHostAddress& pAddress);
};
} /* namespace governikus */