From 270ee6f5b2d38d4681ffdf308ca47a978f15bade Mon Sep 17 00:00:00 2001 From: nanosonde <2073569+nanosonde@users.noreply.github.com> Date: Sat, 9 Nov 2019 12:12:56 +0100 Subject: [PATCH] Save work --- src/knx/address_table_object.h | 2 ++ src/knx/application_program_object.h | 1 + src/knx/association_table_object.h | 1 + src/knx/bau.cpp | 5 ++- src/knx/bau.h | 4 +++ src/knx/bau27B0.cpp | 42 ++++++++++++++++++++----- src/knx/bau27B0.h | 9 +++--- src/knx/bau_systemB.cpp | 27 +++++++++++++++- src/knx/bau_systemB.h | 5 ++- src/knx/cemi_server.cpp | 25 ++++++++++++--- src/knx/cemi_server.h | 6 ++-- src/knx/cemi_server_object.h | 1 + src/knx/data_link_layer.cpp | 5 ++- src/knx/device_object.h | 2 +- src/knx/group_object_table_object.h | 1 + src/knx/interface_object.cpp | 3 +- src/knx/interface_object.h | 7 +++++ src/knx/ip_parameter_object.h | 1 + src/knx/rf_medium_object.h | 1 + src/knx/usb_data_link_layer.cpp | 47 +++++++++++++--------------- src/knx/usb_data_link_layer.h | 17 +++------- 21 files changed, 149 insertions(+), 63 deletions(-) diff --git a/src/knx/address_table_object.h b/src/knx/address_table_object.h index 28ce2bc..1df9c38 100644 --- a/src/knx/address_table_object.h +++ b/src/knx/address_table_object.h @@ -21,6 +21,8 @@ class AddressTableObject : public TableObject void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data); uint8_t* save(uint8_t* buffer); uint8_t* restore(uint8_t* buffer); + ObjectType objectType() { return OT_ADDR_TABLE; } + /** * returns the number of group addresses of the object. */ diff --git a/src/knx/application_program_object.h b/src/knx/application_program_object.h index e7ac83f..14c7f3f 100644 --- a/src/knx/application_program_object.h +++ b/src/knx/application_program_object.h @@ -9,6 +9,7 @@ class ApplicationProgramObject : public TableObject void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data); void writeProperty(PropertyID id, uint8_t start, uint8_t* data, uint8_t count); uint8_t propertySize(PropertyID id); + ObjectType objectType() { return OT_APPLICATION_PROG; } uint8_t* data(uint32_t addr); uint8_t getByte(uint32_t addr); uint16_t getWord(uint32_t addr); diff --git a/src/knx/association_table_object.h b/src/knx/association_table_object.h index b56587c..32f2e89 100644 --- a/src/knx/association_table_object.h +++ b/src/knx/association_table_object.h @@ -7,6 +7,7 @@ class AssociationTableObject : public TableObject public: AssociationTableObject(Platform& platform); void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data); + ObjectType objectType() { return OT_ASSOC_TABLE; } uint8_t* save(uint8_t* buffer); uint8_t* restore(uint8_t* buffer); diff --git a/src/knx/bau.cpp b/src/knx/bau.cpp index b60d60c..2b71c2f 100644 --- a/src/knx/bau.cpp +++ b/src/knx/bau.cpp @@ -256,6 +256,9 @@ void BusAccessUnit::domainAddressSerialNumberReadIndication(Priority priority, H { } - +void BusAccessUnit::propertyValueRead(ObjectType objectType, uint8_t objectInstance, uint8_t propertyId, uint32_t &numberOfElements, uint16_t startIndex, + uint8_t *data, uint32_t &dataSize) +{ +} diff --git a/src/knx/bau.h b/src/knx/bau.h index d2d6ada..31c4117 100644 --- a/src/knx/bau.h +++ b/src/knx/bau.h @@ -1,6 +1,7 @@ #pragma once #include #include "knx_types.h" +#include "interface_object.h" class BusAccessUnit { @@ -117,4 +118,7 @@ class BusAccessUnit uint8_t* knxSerialNumber); virtual void domainAddressSerialNumberReadIndication(Priority priority, HopCountType hopType, uint8_t* knxSerialNumber); + + virtual void propertyValueRead(ObjectType objectType, uint8_t objectInstance, uint8_t propertyId, uint32_t &numberOfElements, uint16_t startIndex, + uint8_t *data, uint32_t &dataSize); }; diff --git a/src/knx/bau27B0.cpp b/src/knx/bau27B0.cpp index e1d0c53..ee14da0 100644 --- a/src/knx/bau27B0.cpp +++ b/src/knx/bau27B0.cpp @@ -10,14 +10,13 @@ using namespace std; Bau27B0::Bau27B0(Platform& platform) : BauSystemB(platform), _dlLayer(_deviceObj, _rfMediumObj, _addrTable, _netLayer, _platform) -#ifdef USE_USBIF - , _cemiServer(_tunnelInterface, *this) - , _tunnelInterface(_deviceObj, _cemiServer, _platform) +#ifdef USE_CEMI_SERVER + , _cemiServer(*this) #endif { _netLayer.dataLinkLayer(_dlLayer); _memory.addSaveRestore(&_rfMediumObj); -#ifdef USE_USBIF +#ifdef USE_CEMI_SERVER _cemiServer.dataLinkLayer(_dlLayer); _dlLayer.cemiServer(_cemiServer); _memory.addSaveRestore(&_cemiServerObject); @@ -60,7 +59,7 @@ InterfaceObject* Bau27B0::getInterfaceObject(uint8_t idx) return nullptr; case 6: return &_rfMediumObj; -#ifdef USE_USBIF +#ifdef USE_CEMI_SERVER case 7: return &_cemiServerObject; #endif @@ -69,6 +68,35 @@ InterfaceObject* Bau27B0::getInterfaceObject(uint8_t idx) } } +InterfaceObject* Bau27B0::getInterfaceObject(ObjectType objectType, uint8_t objectInstance) +{ + // We do not use it right now. + // Required for coupler mode as there are multiple router objects for example + (void) objectInstance; + + switch (objectType) + { + case OT_DEVICE: + return &_deviceObj; + case OT_ADDR_TABLE: + return &_addrTable; + case OT_ASSOC_TABLE: + return &_assocTable; + case OT_GRP_OBJ_TABLE: + return &_groupObjTable; + case OT_APPLICATION_PROG: + return &_appProgram; + case OT_RF_MEDIUM: + return &_rfMediumObj; +#ifdef USE_CEMI_SERVER + case OT_CEMI_SERVER: + return &_cemiServerObject; +#endif + default: + return nullptr; + } +} + uint8_t* Bau27B0::descriptor() { return _descriptor; @@ -82,13 +110,13 @@ DataLinkLayer& Bau27B0::dataLinkLayer() void Bau27B0::enabled(bool value) { ::BauSystemB::enabled(value); - _tunnelInterface.enabled(value); + //_tunnelInterface.enabled(value); } void Bau27B0::loop() { ::BauSystemB::loop(); - _tunnelInterface.loop(); + //_tunnelInterface.loop(); } void Bau27B0::domainAddressSerialNumberWriteIndication(Priority priority, HopCountType hopType, uint8_t* rfDoA, diff --git a/src/knx/bau27B0.h b/src/knx/bau27B0.h index 39bddf6..70a2295 100644 --- a/src/knx/bau27B0.h +++ b/src/knx/bau27B0.h @@ -4,8 +4,7 @@ #include "rf_medium_object.h" #include "rf_physical_layer.h" #include "rf_data_link_layer.h" -#ifdef USE_USBIF -#include "usb_data_link_layer.h" +#ifdef USE_CEMI_SERVER #include "cemi_server.h" #include "cemi_server_object.h" #endif @@ -19,20 +18,20 @@ class Bau27B0 : public BauSystemB protected: InterfaceObject* getInterfaceObject(uint8_t idx); + InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance); uint8_t* descriptor(); DataLinkLayer& dataLinkLayer(); private: RfDataLinkLayer _dlLayer; RfMediumObject _rfMediumObj; -#ifdef USE_USBIF +#ifdef USE_CEMI_SERVER CemiServer _cemiServer; - UsbDataLinkLayer _tunnelInterface; CemiServerObject _cemiServerObject; #endif uint8_t _descriptor[2] = {0x27, 0xB0}; -#ifdef USE_USBIF +#ifdef USE_CEMI_SERVER const uint32_t _ifObjs[8] = { 7, // length OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_RF_MEDIUM, OT_CEMI_SERVER}; #else diff --git a/src/knx/bau_systemB.cpp b/src/knx/bau_systemB.cpp index 9840c0d..e71510a 100644 --- a/src/knx/bau_systemB.cpp +++ b/src/knx/bau_systemB.cpp @@ -218,7 +218,7 @@ void BauSystemB::propertyValueWriteIndication(Priority priority, HopCountType ho void BauSystemB::propertyValueReadIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex, uint8_t propertyId, uint8_t numberOfElements, uint16_t startIndex) { - uint8_t size = 0; + uint8_t size = 0; uint32_t elementCount = numberOfElements; InterfaceObject* obj = getInterfaceObject(objectIndex); if (obj) @@ -391,3 +391,28 @@ void BauSystemB::systemNetworkParameterReadIndication(Priority priority, HopCoun break; } } + +void BauSystemB::propertyValueRead(ObjectType objectType, uint8_t objectInstance, uint8_t propertyId, + uint32_t &numberOfElements, uint16_t startIndex, uint8_t *data, uint32_t &dataSize) +{ + uint32_t size = 0; + uint32_t elementCount = numberOfElements; + + InterfaceObject* obj = getInterfaceObject(objectType, objectInstance); + + if (obj) + { + uint8_t elementSize = obj->propertySize((PropertyID)propertyId); + size = elementSize * numberOfElements; + data = new uint8_t [size]; + obj->readProperty((PropertyID)propertyId, startIndex, elementCount, data); + } + else + { + elementCount = 0; + data = nullptr; + } + + numberOfElements = elementCount; + dataSize = size; +} diff --git a/src/knx/bau_systemB.h b/src/knx/bau_systemB.h index 5ca0ff5..978b94e 100644 --- a/src/knx/bau_systemB.h +++ b/src/knx/bau_systemB.h @@ -59,10 +59,13 @@ class BauSystemB : protected BusAccessUnit void groupValueWriteIndication(uint16_t asap, Priority priority, HopCountType hopType, uint8_t* data, uint8_t dataLength) override; void systemNetworkParameterReadIndication(Priority priority, HopCountType hopType, uint16_t objectType, - uint16_t propertyId, uint8_t* testInfo, uint16_t testinfoLength); + uint16_t propertyId, uint8_t* testInfo, uint16_t testinfoLength) override; void connectConfirm(uint16_t tsap) override; + void propertyValueRead(ObjectType objectType, uint8_t objectInstance, uint8_t propertyId, uint32_t &numberOfElements, uint16_t startIndex, + uint8_t *data, uint32_t &dataSize) override; virtual InterfaceObject* getInterfaceObject(uint8_t idx) = 0; + virtual InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance) = 0; void sendNextGroupTelegram(); void updateGroupObject(GroupObject& go, uint8_t* data, uint8_t length); void nextRestartState(); diff --git a/src/knx/cemi_server.cpp b/src/knx/cemi_server.cpp index 301c22f..797a077 100644 --- a/src/knx/cemi_server.cpp +++ b/src/knx/cemi_server.cpp @@ -2,13 +2,14 @@ #include "cemi_frame.h" #include "bau.h" #include "usb_data_link_layer.h" +#include "data_link_layer.h" #include "string.h" #include "bits.h" #include -CemiServer::CemiServer(UsbDataLinkLayer& tunnelInterface, BusAccessUnit& bau): - _tunnelInterface(tunnelInterface), - _bau(bau) +CemiServer::CemiServer(BusAccessUnit& bau) + : _bau(bau), + _usbTunnelInterface(*this) { } @@ -19,9 +20,19 @@ void CemiServer::dataLinkLayer(DataLinkLayer& layer) void CemiServer::dataIndicationToTunnel(CemiFrame& frame) { - _tunnelInterface.sendCemiFrame(frame); + _usbTunnelInterface.sendCemiFrame(frame); } +/* +void CemiServer::localManagmentRequestFromTunnel(CemiFrame& frame) +{ + // called from KNXNET/IP for Management Services + + // Send response to IP data link layer + _dataLinkLayer->localManagmentResponseToTunnel(); +} +*/ + void CemiServer::frameReceived(CemiFrame& frame) { switch(frame.messageCode()) @@ -34,12 +45,16 @@ void CemiServer::frameReceived(CemiFrame& frame) // Send local reply to tunnel frame.messageCode(L_data_con); - _tunnelInterface.sendCemiFrame(frame); + _usbTunnelInterface.sendCemiFrame(frame); break; } case M_PropRead_req: { + uint8_t* data; + uint32_t dataSize; + //ObjectType opjectType = data[] + //_bau.propertyValueRead() break; } diff --git a/src/knx/cemi_server.h b/src/knx/cemi_server.h index 3e93b4f..375322d 100644 --- a/src/knx/cemi_server.h +++ b/src/knx/cemi_server.h @@ -2,8 +2,8 @@ #include #include "knx_types.h" +#include "usb_data_link_layer.h" -class UsbDataLinkLayer; class BusAccessUnit; class DataLinkLayer; class CemiFrame; @@ -24,7 +24,7 @@ class CemiServer * @param tunnelInterface The TunnelInterface of the KNX tunnel (e.g. USB or KNXNET/IP) * @param bau methods are called here depending of the content of the APDU */ - CemiServer(UsbDataLinkLayer& tunnelInterface, BusAccessUnit& bau); + CemiServer(BusAccessUnit& bau); void dataLinkLayer(DataLinkLayer& layer); @@ -58,6 +58,6 @@ class CemiServer void individualConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, bool status); */ DataLinkLayer* _dataLinkLayer; - UsbDataLinkLayer& _tunnelInterface; BusAccessUnit& _bau; + UsbDataLinkLayer _usbTunnelInterface; }; diff --git a/src/knx/cemi_server_object.h b/src/knx/cemi_server_object.h index b917183..4162980 100644 --- a/src/knx/cemi_server_object.h +++ b/src/knx/cemi_server_object.h @@ -11,6 +11,7 @@ public: uint8_t* save(uint8_t* buffer); uint8_t* restore(uint8_t* buffer); void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access); + ObjectType objectType() { return OT_CEMI_SERVER; } protected: uint8_t propertyCount(); diff --git a/src/knx/data_link_layer.cpp b/src/knx/data_link_layer.cpp index 9e2b8f0..86598e7 100644 --- a/src/knx/data_link_layer.cpp +++ b/src/knx/data_link_layer.cpp @@ -94,9 +94,12 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame) uint16_t ownAddr = _deviceObject.induvidualAddress(); SystemBroadcast systemBroadcast = frame.systemBroadcast(); + if (_cemiServer) + { // if (source != _cemiServerObj.tunnelAddress) _cemiServer->dataIndicationToTunnel(frame); - + } + if (source == ownAddr) _deviceObject.induvidualAddressDuplication(true); diff --git a/src/knx/device_object.h b/src/knx/device_object.h index 35704f1..8793075 100644 --- a/src/knx/device_object.h +++ b/src/knx/device_object.h @@ -11,7 +11,7 @@ public: uint8_t* save(uint8_t* buffer); uint8_t* restore(uint8_t* buffer); void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access); - + ObjectType objectType() { return OT_DEVICE; } uint16_t induvidualAddress(); void induvidualAddress(uint16_t value); diff --git a/src/knx/group_object_table_object.h b/src/knx/group_object_table_object.h index bd9bdd3..0561652 100644 --- a/src/knx/group_object_table_object.h +++ b/src/knx/group_object_table_object.h @@ -11,6 +11,7 @@ class GroupObjectTableObject : public TableObject GroupObjectTableObject(Platform& platform); virtual ~GroupObjectTableObject(); void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data); + ObjectType objectType() { return OT_GRP_OBJ_TABLE; } uint16_t entryCount(); GroupObject& get(uint16_t asap); GroupObject& nextUpdatedObject(bool& valid); diff --git a/src/knx/interface_object.cpp b/src/knx/interface_object.cpp index 21cd541..f75eb8e 100644 --- a/src/knx/interface_object.cpp +++ b/src/knx/interface_object.cpp @@ -68,4 +68,5 @@ uint8_t InterfaceObject::propertyCount() PropertyDescription* InterfaceObject::propertyDescriptions() { return nullptr; -} \ No newline at end of file +} + diff --git a/src/knx/interface_object.h b/src/knx/interface_object.h index 2d2cfe8..43bc17b 100644 --- a/src/knx/interface_object.h +++ b/src/knx/interface_object.h @@ -118,6 +118,13 @@ class InterfaceObject : public SaveRestore void readPropertyDescription(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access); + /** + * Gets object type. + * + * @returns object type + */ + virtual ObjectType objectType() = 0; + protected: /** * Returns the number of properties the interface object has. diff --git a/src/knx/ip_parameter_object.h b/src/knx/ip_parameter_object.h index 4b23e34..90cf93b 100644 --- a/src/knx/ip_parameter_object.h +++ b/src/knx/ip_parameter_object.h @@ -11,6 +11,7 @@ class IpParameterObject : public InterfaceObject void readProperty(PropertyID id, uint32_t start, uint32_t& count, uint8_t* data); void writeProperty(PropertyID id, uint8_t start, uint8_t* data, uint8_t count); uint8_t propertySize(PropertyID id); + ObjectType objectType() { return OT_IP_PARAMETER; } uint8_t* save(uint8_t* buffer); uint8_t* restore(uint8_t* buffer); diff --git a/src/knx/rf_medium_object.h b/src/knx/rf_medium_object.h index 57c0a2e..18bcab3 100644 --- a/src/knx/rf_medium_object.h +++ b/src/knx/rf_medium_object.h @@ -11,6 +11,7 @@ public: uint8_t* save(uint8_t* buffer); uint8_t* restore(uint8_t* buffer); void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access); + ObjectType objectType() { return OT_RF_MEDIUM; } uint8_t* rfDomainAddress(); void rfDomainAddress(uint8_t* value); diff --git a/src/knx/usb_data_link_layer.cpp b/src/knx/usb_data_link_layer.cpp index 2c59d72..72d86e4 100644 --- a/src/knx/usb_data_link_layer.cpp +++ b/src/knx/usb_data_link_layer.cpp @@ -1,17 +1,15 @@ -#include "usb_data_link_layer.h" - #include "bits.h" -#include "platform.h" -#include "device_object.h" -#include "address_table_object.h" +#include "usb_data_link_layer.h" +#include "cemi_server.h" #include "cemi_frame.h" #include #include +#include #define MIN(a, b) ((a < b) ? (a) : (b)) -Adafruit_USBD_HID usb_hid; +static Adafruit_USBD_HID usb_hid; // HID report descriptor using TinyUSB's template // Generic In Out with 64 bytes report (max) @@ -57,8 +55,8 @@ struct _rx_queue_frame_t static struct _rx_queue_t { - _rx_queue_frame_t* front = NULL; - _rx_queue_frame_t* back = NULL; + _rx_queue_frame_t* front = nullptr; + _rx_queue_frame_t* back = nullptr; } _rx_queue; static void addFrameRxQueue(CemiFrame& frame) @@ -67,7 +65,7 @@ static void addFrameRxQueue(CemiFrame& frame) rx_frame->length = frame.totalLenght(); rx_frame->data = new uint8_t[rx_frame->length]; - rx_frame->next = NULL; + rx_frame->next = nullptr; /* print("cEMI USB RX len: "); @@ -75,7 +73,7 @@ static void addFrameRxQueue(CemiFrame& frame) printHex(" data:", rx_frame->data, rx_frame->length); */ - if (_rx_queue.back == NULL) + if (_rx_queue.back == nullptr) { _rx_queue.front = _rx_queue.back = rx_frame; } @@ -88,7 +86,7 @@ static void addFrameRxQueue(CemiFrame& frame) static bool isRxQueueEmpty() { - if (_rx_queue.front == NULL) + if (_rx_queue.front == nullptr) { return true; } @@ -97,7 +95,7 @@ static bool isRxQueueEmpty() static void loadNextRxFrame(uint8_t** receiveBuffer, uint16_t* receiveBufferLength) { - if (_rx_queue.front == NULL) + if (_rx_queue.front == nullptr) { return; } @@ -106,9 +104,9 @@ static void loadNextRxFrame(uint8_t** receiveBuffer, uint16_t* receiveBufferLeng *receiveBufferLength = rx_frame->length; _rx_queue.front = rx_frame->next; - if (_rx_queue.front == NULL) + if (_rx_queue.front == nullptr) { - _rx_queue.back = NULL; + _rx_queue.back = nullptr; } delete rx_frame; } @@ -322,8 +320,8 @@ static void set_report_callback(uint8_t report_id, hid_report_type_t report_type // class UsbDataLinkLayer -UsbDataLinkLayer::UsbDataLinkLayer(DeviceObject& deviceObject, CemiServer& cemiServer, Platform& platform) - : _deviceObject(deviceObject), _cemiServer(cemiServer), _platform(platform) +UsbDataLinkLayer::UsbDataLinkLayer(CemiServer& cemiServer) + : _cemiServer(cemiServer) { } @@ -393,14 +391,13 @@ void UsbDataLinkLayer::enabled(bool value) while( !USBDevice.mounted() ) delay(1); _enabled = true; - print("ownaddr "); - println(_deviceObject.induvidualAddress(), HEX); + println("KNX USB Interface enabled."); return; } if (!value && _enabled) { - println("USB data link layer cannot be disabled once enabled!"); + println("KNX USB Interface cannot be disabled once enabled!"); return; } } @@ -416,7 +413,7 @@ void UsbDataLinkLayer::addFrameTxQueue(CemiFrame& frame) tx_frame->length = frame.totalLenght(); tx_frame->data = new uint8_t[tx_frame->length]; - tx_frame->next = NULL; + tx_frame->next = nullptr; /* print("cEMI USB TX len: "); @@ -424,7 +421,7 @@ void UsbDataLinkLayer::addFrameTxQueue(CemiFrame& frame) printHex(" data:", tx_frame->data, tx_frame->length); */ - if (_tx_queue.back == NULL) + if (_tx_queue.back == nullptr) { _tx_queue.front = _tx_queue.back = tx_frame; } @@ -437,7 +434,7 @@ void UsbDataLinkLayer::addFrameTxQueue(CemiFrame& frame) bool UsbDataLinkLayer::isTxQueueEmpty() { - if (_tx_queue.front == NULL) + if (_tx_queue.front == nullptr) { return true; } @@ -446,7 +443,7 @@ bool UsbDataLinkLayer::isTxQueueEmpty() void UsbDataLinkLayer::loadNextTxFrame(uint8_t** sendBuffer, uint16_t* sendBufferLength) { - if (_tx_queue.front == NULL) + if (_tx_queue.front == nullptr) { return; } @@ -455,9 +452,9 @@ void UsbDataLinkLayer::loadNextTxFrame(uint8_t** sendBuffer, uint16_t* sendBuffe *sendBufferLength = tx_frame->length; _tx_queue.front = tx_frame->next; - if (_tx_queue.front == NULL) + if (_tx_queue.front == nullptr) { - _tx_queue.back = NULL; + _tx_queue.back = nullptr; } delete tx_frame; } diff --git a/src/knx/usb_data_link_layer.h b/src/knx/usb_data_link_layer.h index cb0aa3c..c52fb4d 100644 --- a/src/knx/usb_data_link_layer.h +++ b/src/knx/usb_data_link_layer.h @@ -1,21 +1,16 @@ #pragma once #include -#include -#include "data_link_layer.h" -#include "cemi_server.h" #define MAX_KNX_TELEGRAM_SIZE 263 -extern Adafruit_USBD_HID usb_hid; - -class DeviceObject; -class Platform; +class CemiServer; +class CemiFrame; class UsbDataLinkLayer { public: - UsbDataLinkLayer(DeviceObject& deviceObject, CemiServer& cemiServer, Platform& platform); + UsbDataLinkLayer(CemiServer& cemiServer); void loop(); void enabled(bool value); @@ -36,13 +31,11 @@ class UsbDataLinkLayer struct _tx_queue_t { - _tx_queue_frame_t* front = NULL; - _tx_queue_frame_t* back = NULL; + _tx_queue_frame_t* front = nullptr; + _tx_queue_frame_t* back = nullptr; } _tx_queue; - DeviceObject& _deviceObject; CemiServer& _cemiServer; - Platform& _platform; void addFrameTxQueue(CemiFrame& frame); bool isTxQueueEmpty();