From 05a7b69240985f2f0b1b1f07bbd8a1a6ebeee108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Wed, 13 Apr 2016 12:40:39 +0200 Subject: [PATCH] integrate coap better into libguh --- libguh/coap/coap.h | 7 ++- libguh/coap/coapobserveresource.h | 2 +- libguh/coap/coapoption.h | 4 +- libguh/coap/coappdu.h | 4 +- libguh/coap/coappdublock.h | 4 +- libguh/coap/coapreply.h | 3 +- libguh/coap/coaprequest.h | 5 +- libguh/coap/corelink.h | 3 +- libguh/coap/corelinkparser.h | 3 +- libguh/libguh.pro | 95 ++++++++++++++++--------------- 10 files changed, 69 insertions(+), 61 deletions(-) diff --git a/libguh/coap/coap.h b/libguh/coap/coap.h index 37c6238f..477057a6 100644 --- a/libguh/coap/coap.h +++ b/libguh/coap/coap.h @@ -29,6 +29,7 @@ #include #include +#include "libguh.h" #include "coaprequest.h" #include "coapreply.h" #include "coapobserveresource.h" @@ -44,9 +45,10 @@ Q_DECLARE_LOGGING_CATEGORY(dcCoap) -class Coap : public QObject +class LIBGUH_EXPORT Coap : public QObject { Q_OBJECT + public: Coap(QObject *parent = 0, const quint16 &port = 5683); @@ -67,7 +69,6 @@ private: QPointer m_reply; QQueue m_replyQueue; - QHash m_runningHostLookups; QHash m_observeResources; // token | resource @@ -93,7 +94,6 @@ private: void processBlock2Notification(CoapReply *reply, const CoapPdu &pdu); - signals: void replyFinished(CoapReply *reply); void notificationReceived(const CoapObserveResource &resource, const int ¬ificationNumber, const QByteArray &payload); @@ -103,6 +103,7 @@ private slots: void onReadyRead(); void onReplyTimeout(); void onReplyFinished(); + }; #endif // COAP_H diff --git a/libguh/coap/coapobserveresource.h b/libguh/coap/coapobserveresource.h index ec9ab0a0..49e0584a 100644 --- a/libguh/coap/coapobserveresource.h +++ b/libguh/coap/coapobserveresource.h @@ -25,7 +25,7 @@ #include #include -class CoapObserveResource +class LIBGUH_EXPORT CoapObserveResource { public: diff --git a/libguh/coap/coapoption.h b/libguh/coap/coapoption.h index cca635cd..d744ea2c 100644 --- a/libguh/coap/coapoption.h +++ b/libguh/coap/coapoption.h @@ -25,7 +25,9 @@ #include #include -class CoapOption +#include "libguh.h" + +class LIBGUH_EXPORT CoapOption { Q_GADGET Q_ENUMS(Option) diff --git a/libguh/coap/coappdu.h b/libguh/coap/coappdu.h index 796c5fc6..11c77915 100644 --- a/libguh/coap/coappdu.h +++ b/libguh/coap/coappdu.h @@ -24,6 +24,7 @@ #include #include +#include "libguh.h" #include "coapoption.h" #include "coappdublock.h" @@ -42,7 +43,7 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -class CoapPdu : public QObject +class LIBGUH_EXPORT CoapPdu : public QObject { Q_OBJECT Q_ENUMS(MessageType) @@ -149,7 +150,6 @@ public: void clear(); bool isValid() const; - bool isNull() const; QByteArray pack() const; diff --git a/libguh/coap/coappdublock.h b/libguh/coap/coappdublock.h index 459d1a22..6a2924b8 100644 --- a/libguh/coap/coappdublock.h +++ b/libguh/coap/coappdublock.h @@ -23,7 +23,9 @@ #include -class CoapPduBlock +#include "libguh.h" + +class LIBGUH_EXPORT CoapPduBlock { public: CoapPduBlock(); diff --git a/libguh/coap/coapreply.h b/libguh/coap/coapreply.h index 5897149d..02c63532 100644 --- a/libguh/coap/coapreply.h +++ b/libguh/coap/coapreply.h @@ -24,11 +24,12 @@ #include #include +#include "libguh.h" #include "coappdu.h" #include "coapoption.h" #include "coaprequest.h" -class CoapReply : public QObject +class LIBGUH_EXPORT CoapReply : public QObject { friend class Coap; diff --git a/libguh/coap/coaprequest.h b/libguh/coap/coaprequest.h index b61992e6..bdc3f649 100644 --- a/libguh/coap/coaprequest.h +++ b/libguh/coap/coaprequest.h @@ -24,12 +24,11 @@ #include #include +#include "libguh.h" #include "coappdu.h" #include "coapoption.h" -//class Coap; - -class CoapRequest +class LIBGUH_EXPORT CoapRequest { // friend class Coap; public: diff --git a/libguh/coap/corelink.h b/libguh/coap/corelink.h index b57be375..87d76236 100644 --- a/libguh/coap/corelink.h +++ b/libguh/coap/corelink.h @@ -24,9 +24,10 @@ #include #include +#include "libguh.h" #include "coappdu.h" -class CoreLink +class LIBGUH_EXPORT CoreLink { public: CoreLink(); diff --git a/libguh/coap/corelinkparser.h b/libguh/coap/corelinkparser.h index 799787a1..06c69511 100644 --- a/libguh/coap/corelinkparser.h +++ b/libguh/coap/corelinkparser.h @@ -23,11 +23,12 @@ #include +#include "libguh.h" #include "corelink.h" // Constrained RESTful Environments (CoRE) Link Format : http://tools.ietf.org/html/rfc6690 -class CoreLinkParser : public QObject +class LIBGUH_EXPORT CoreLinkParser : public QObject { Q_OBJECT public: diff --git a/libguh/libguh.pro b/libguh/libguh.pro index 6f3a308f..bd294922 100644 --- a/libguh/libguh.pro +++ b/libguh/libguh.pro @@ -12,58 +12,14 @@ target.path = /usr/lib INSTALLS += target contains(DEFINES, BLUETOOTH_LE) { + HEADERS += bluetooth/bluetoothscanner.h \ + bluetooth/bluetoothlowenergydevice.h \ + SOURCES += bluetooth/bluetoothscanner.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 \ libguh.h \ typeutils.h \ @@ -111,6 +67,51 @@ HEADERS += devicemanager.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 generateplugininfo.files = $$top_srcdir/plugins/guh-generateplugininfo generateplugininfo.path = /usr/bin