integrate coap better into libguh

This commit is contained in:
Simon Stürz 2016-04-13 12:40:39 +02:00 committed by Michael Zanetti
parent 444a113c33
commit 05a7b69240
10 changed files with 69 additions and 61 deletions

View File

@ -29,6 +29,7 @@
#include <QPointer> #include <QPointer>
#include <QQueue> #include <QQueue>
#include "libguh.h"
#include "coaprequest.h" #include "coaprequest.h"
#include "coapreply.h" #include "coapreply.h"
#include "coapobserveresource.h" #include "coapobserveresource.h"
@ -44,9 +45,10 @@
Q_DECLARE_LOGGING_CATEGORY(dcCoap) Q_DECLARE_LOGGING_CATEGORY(dcCoap)
class Coap : public QObject class LIBGUH_EXPORT Coap : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
Coap(QObject *parent = 0, const quint16 &port = 5683); Coap(QObject *parent = 0, const quint16 &port = 5683);
@ -67,7 +69,6 @@ private:
QPointer<CoapReply> m_reply; QPointer<CoapReply> m_reply;
QQueue<CoapReply *> m_replyQueue; QQueue<CoapReply *> m_replyQueue;
QHash<int, CoapReply *> m_runningHostLookups; QHash<int, CoapReply *> m_runningHostLookups;
QHash<QByteArray, CoapObserveResource> m_observeResources; // token | resource QHash<QByteArray, CoapObserveResource> m_observeResources; // token | resource
@ -93,7 +94,6 @@ private:
void processBlock2Notification(CoapReply *reply, const CoapPdu &pdu); void processBlock2Notification(CoapReply *reply, const CoapPdu &pdu);
signals: signals:
void replyFinished(CoapReply *reply); void replyFinished(CoapReply *reply);
void notificationReceived(const CoapObserveResource &resource, const int &notificationNumber, const QByteArray &payload); void notificationReceived(const CoapObserveResource &resource, const int &notificationNumber, const QByteArray &payload);
@ -103,6 +103,7 @@ private slots:
void onReadyRead(); void onReadyRead();
void onReplyTimeout(); void onReplyTimeout();
void onReplyFinished(); void onReplyFinished();
}; };
#endif // COAP_H #endif // COAP_H

View File

@ -25,7 +25,7 @@
#include <QHash> #include <QHash>
#include <QUrl> #include <QUrl>
class CoapObserveResource class LIBGUH_EXPORT CoapObserveResource
{ {
public: public:

View File

@ -25,7 +25,9 @@
#include <QObject> #include <QObject>
#include <QByteArray> #include <QByteArray>
class CoapOption #include "libguh.h"
class LIBGUH_EXPORT CoapOption
{ {
Q_GADGET Q_GADGET
Q_ENUMS(Option) Q_ENUMS(Option)

View File

@ -24,6 +24,7 @@
#include <QDebug> #include <QDebug>
#include <QObject> #include <QObject>
#include "libguh.h"
#include "coapoption.h" #include "coapoption.h"
#include "coappdublock.h" #include "coappdublock.h"
@ -42,7 +43,7 @@
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/ */
class CoapPdu : public QObject class LIBGUH_EXPORT CoapPdu : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_ENUMS(MessageType) Q_ENUMS(MessageType)
@ -149,7 +150,6 @@ public:
void clear(); void clear();
bool isValid() const; bool isValid() const;
bool isNull() const;
QByteArray pack() const; QByteArray pack() const;

View File

@ -23,7 +23,9 @@
#include <QByteArray> #include <QByteArray>
class CoapPduBlock #include "libguh.h"
class LIBGUH_EXPORT CoapPduBlock
{ {
public: public:
CoapPduBlock(); CoapPduBlock();

View File

@ -24,11 +24,12 @@
#include <QObject> #include <QObject>
#include <QTimer> #include <QTimer>
#include "libguh.h"
#include "coappdu.h" #include "coappdu.h"
#include "coapoption.h" #include "coapoption.h"
#include "coaprequest.h" #include "coaprequest.h"
class CoapReply : public QObject class LIBGUH_EXPORT CoapReply : public QObject
{ {
friend class Coap; friend class Coap;

View File

@ -24,12 +24,11 @@
#include <QUrl> #include <QUrl>
#include <QHostAddress> #include <QHostAddress>
#include "libguh.h"
#include "coappdu.h" #include "coappdu.h"
#include "coapoption.h" #include "coapoption.h"
//class Coap; class LIBGUH_EXPORT CoapRequest
class CoapRequest
{ {
// friend class Coap; // friend class Coap;
public: public:

View File

@ -24,9 +24,10 @@
#include <QObject> #include <QObject>
#include <QDebug> #include <QDebug>
#include "libguh.h"
#include "coappdu.h" #include "coappdu.h"
class CoreLink class LIBGUH_EXPORT CoreLink
{ {
public: public:
CoreLink(); CoreLink();

View File

@ -23,11 +23,12 @@
#include <QObject> #include <QObject>
#include "libguh.h"
#include "corelink.h" #include "corelink.h"
// Constrained RESTful Environments (CoRE) Link Format : http://tools.ietf.org/html/rfc6690 // Constrained RESTful Environments (CoRE) Link Format : http://tools.ietf.org/html/rfc6690
class CoreLinkParser : public QObject class LIBGUH_EXPORT CoreLinkParser : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -12,58 +12,14 @@ target.path = /usr/lib
INSTALLS += target INSTALLS += target
contains(DEFINES, BLUETOOTH_LE) { contains(DEFINES, BLUETOOTH_LE) {
HEADERS += bluetooth/bluetoothscanner.h \
bluetooth/bluetoothlowenergydevice.h \
SOURCES += bluetooth/bluetoothscanner.cpp \ SOURCES += bluetooth/bluetoothscanner.cpp \
bluetooth/bluetoothlowenergydevice.cpp \ bluetooth/bluetoothlowenergydevice.cpp \
HEADERS += bluetooth/bluetoothscanner.h \
bluetooth/bluetoothlowenergydevice.h \
} }
SOURCES += devicemanager.cpp \
loggingcategories.cpp \
guhsettings.cpp \
plugin/device.cpp \
plugin/deviceclass.cpp \
plugin/deviceplugin.cpp \
plugin/devicedescriptor.cpp \
plugin/devicepairinginfo.cpp \
hardware/gpio.cpp \
hardware/gpiomonitor.cpp \
hardware/radio433/radio433.cpp \
hardware/radio433/radio433transmitter.cpp \
hardware/radio433/radio433receiver.cpp \
hardware/radio433/radio433brennenstuhlgateway.cpp \
network/upnpdiscovery/upnpdiscovery.cpp \
network/upnpdiscovery/upnpdevice.cpp \
network/upnpdiscovery/upnpdevicedescriptor.cpp \
network/upnpdiscovery/upnpdiscoveryrequest.cpp \
network/networkmanager.cpp \
network/oauth2.cpp \
coap/coap.cpp \
coap/coappdu.cpp \
coap/coapoption.cpp \
coap/coaprequest.cpp \
coap/coapreply.cpp \
coap/coappdublock.cpp \
coap/corelinkparser.cpp \
coap/corelink.cpp \
coap/coapobserveresource.cpp \
types/action.cpp \
types/actiontype.cpp \
types/state.cpp \
types/statetype.cpp \
types/eventtype.cpp \
types/event.cpp \
types/eventdescriptor.cpp \
types/vendor.cpp \
types/paramtype.cpp \
types/param.cpp \
types/paramdescriptor.cpp \
types/ruleaction.cpp \
types/ruleactionparam.cpp \
types/statedescriptor.cpp \
HEADERS += devicemanager.h \ HEADERS += devicemanager.h \
libguh.h \ libguh.h \
typeutils.h \ typeutils.h \
@ -111,6 +67,51 @@ HEADERS += devicemanager.h \
types/statedescriptor.h \ types/statedescriptor.h \
SOURCES += devicemanager.cpp \
loggingcategories.cpp \
guhsettings.cpp \
plugin/device.cpp \
plugin/deviceclass.cpp \
plugin/deviceplugin.cpp \
plugin/devicedescriptor.cpp \
plugin/devicepairinginfo.cpp \
hardware/gpio.cpp \
hardware/gpiomonitor.cpp \
hardware/radio433/radio433.cpp \
hardware/radio433/radio433transmitter.cpp \
hardware/radio433/radio433receiver.cpp \
hardware/radio433/radio433brennenstuhlgateway.cpp \
network/upnpdiscovery/upnpdiscovery.cpp \
network/upnpdiscovery/upnpdevice.cpp \
network/upnpdiscovery/upnpdevicedescriptor.cpp \
network/upnpdiscovery/upnpdiscoveryrequest.cpp \
network/networkmanager.cpp \
network/oauth2.cpp \
coap/coap.cpp \
coap/coappdu.cpp \
coap/coapoption.cpp \
coap/coaprequest.cpp \
coap/coapreply.cpp \
coap/coappdublock.cpp \
coap/corelinkparser.cpp \
coap/corelink.cpp \
coap/coapobserveresource.cpp \
types/action.cpp \
types/actiontype.cpp \
types/state.cpp \
types/statetype.cpp \
types/eventtype.cpp \
types/event.cpp \
types/eventdescriptor.cpp \
types/vendor.cpp \
types/paramtype.cpp \
types/param.cpp \
types/paramdescriptor.cpp \
types/ruleaction.cpp \
types/ruleactionparam.cpp \
types/statedescriptor.cpp \
# install plugininfo python script for libguh-dev # install plugininfo python script for libguh-dev
generateplugininfo.files = $$top_srcdir/plugins/guh-generateplugininfo generateplugininfo.files = $$top_srcdir/plugins/guh-generateplugininfo
generateplugininfo.path = /usr/bin generateplugininfo.path = /usr/bin