mirror of
https://github.com/thelsing/knx.git
synced 2025-08-31 13:47:01 +02:00
save work
This commit is contained in:
parent
9b1505e379
commit
7c185a9293
@ -4,10 +4,8 @@
|
||||
#include "rf_medium_object.h"
|
||||
#include "rf_physical_layer.h"
|
||||
#include "rf_data_link_layer.h"
|
||||
#ifdef USE_CEMI_SERVER
|
||||
#include "cemi_server.h"
|
||||
#include "cemi_server_object.h"
|
||||
#endif
|
||||
|
||||
class Bau27B0 : public BauSystemB
|
||||
{
|
||||
|
@ -1,3 +1,5 @@
|
||||
#ifdef USE_CEMI_SERVER
|
||||
|
||||
#include "cemi_server.h"
|
||||
#include "cemi_frame.h"
|
||||
#include "bau_systemB.h"
|
||||
@ -346,3 +348,5 @@ void CemiServer::loop()
|
||||
{
|
||||
_usbTunnelInterface.loop();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,3 +1,5 @@
|
||||
#ifdef USE_CEMI_SERVER
|
||||
|
||||
#include <cstring>
|
||||
#include "cemi_server_object.h"
|
||||
#include "bits.h"
|
||||
@ -109,3 +111,5 @@ PropertyDescription* CemiServerObject::propertyDescriptions()
|
||||
{
|
||||
return _propertyDescriptions;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -21,4 +21,4 @@ private:
|
||||
uint8_t _addInfoTypesTable[1] = { 0x02 };
|
||||
uint8_t _commMode = 0x00;
|
||||
|
||||
};
|
||||
};
|
||||
|
@ -12,6 +12,8 @@ DataLinkLayer::DataLinkLayer(DeviceObject& devObj, AddressTableObject& addrTab,
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef USE_CEMI_SERVER
|
||||
|
||||
void DataLinkLayer::cemiServer(CemiServer& cemiServer)
|
||||
{
|
||||
_cemiServer = &cemiServer;
|
||||
@ -30,6 +32,7 @@ void DataLinkLayer::dataRequestFromTunnel(CemiFrame& frame)
|
||||
// Send to KNX medium
|
||||
sendFrame(frame);
|
||||
}
|
||||
#endif
|
||||
|
||||
void DataLinkLayer::dataRequest(AckType ack, AddressType addrType, uint16_t destinationAddr, FrameFormat format, Priority priority, NPDU& npdu)
|
||||
{
|
||||
@ -60,16 +63,15 @@ void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
|
||||
NPDU& npdu = frame.npdu();
|
||||
SystemBroadcast systemBroadcast = frame.systemBroadcast();
|
||||
|
||||
if (_cemiServer)
|
||||
#ifdef USE_CEMI_SERVER
|
||||
// if the confirmation was caused by a tunnel request then
|
||||
// do not send it to the local stack
|
||||
if (frame.sourceAddress() == _cemiServer->clientAddress())
|
||||
{
|
||||
// if the confirmation was caused by a tunnel request then
|
||||
// do not send it to the local stack
|
||||
if (frame.sourceAddress() == _cemiServer->clientAddress())
|
||||
{
|
||||
// Stop processing here and do NOT send it the local network layer
|
||||
return;
|
||||
}
|
||||
// Stop processing here and do NOT send it the local network layer
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (addrType == GroupAddress && destination == 0)
|
||||
if (systemBroadcast == SysBroadcast)
|
||||
@ -94,15 +96,14 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
|
||||
uint16_t ownAddr = _deviceObject.induvidualAddress();
|
||||
SystemBroadcast systemBroadcast = frame.systemBroadcast();
|
||||
|
||||
if (_cemiServer)
|
||||
#ifdef USE_CEMI_SERVER
|
||||
// Do not send our own message back to the tunnel
|
||||
if (frame.sourceAddress() != _cemiServer->clientAddress())
|
||||
{
|
||||
// Do not send our own message back to the tunnel
|
||||
if (frame.sourceAddress() != _cemiServer->clientAddress())
|
||||
{
|
||||
_cemiServer->dataIndicationToTunnel(frame);
|
||||
}
|
||||
_cemiServer->dataIndicationToTunnel(frame);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (source == ownAddr)
|
||||
_deviceObject.induvidualAddressDuplication(true);
|
||||
|
||||
@ -166,18 +167,17 @@ bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationA
|
||||
// Thus, reuse the modified cEMI frame as "frame" is only passed by reference here!
|
||||
bool success = sendFrame(frame);
|
||||
|
||||
if (_cemiServer)
|
||||
{
|
||||
CemiFrame tmpFrame(frame.data(), frame.totalLenght());
|
||||
// We can just copy the pointer for rfSerialOrDoA as sendFrame() sets
|
||||
// a pointer to const uint8_t data in either device object (serial) or
|
||||
// RF medium object (domain address)
|
||||
tmpFrame.rfSerialOrDoA(frame.rfSerialOrDoA());
|
||||
tmpFrame.rfInfo(frame.rfInfo());
|
||||
tmpFrame.rfLfn(frame.rfLfn());
|
||||
tmpFrame.confirm(ConfirmNoError);
|
||||
_cemiServer->dataIndicationToTunnel(tmpFrame);
|
||||
}
|
||||
#ifdef USE_CEMI_SERVER
|
||||
CemiFrame tmpFrame(frame.data(), frame.totalLenght());
|
||||
// We can just copy the pointer for rfSerialOrDoA as sendFrame() sets
|
||||
// a pointer to const uint8_t data in either device object (serial) or
|
||||
// RF medium object (domain address)
|
||||
tmpFrame.rfSerialOrDoA(frame.rfSerialOrDoA());
|
||||
tmpFrame.rfInfo(frame.rfInfo());
|
||||
tmpFrame.rfLfn(frame.rfLfn());
|
||||
tmpFrame.confirm(ConfirmNoError);
|
||||
_cemiServer->dataIndicationToTunnel(tmpFrame);
|
||||
#endif
|
||||
|
||||
return success;
|
||||
}
|
||||
|
@ -13,9 +13,11 @@ class DataLinkLayer
|
||||
DataLinkLayer(DeviceObject& devObj, AddressTableObject& addrTab, NetworkLayer& layer,
|
||||
Platform& platform);
|
||||
|
||||
#ifdef USE_CEMI_SERVER
|
||||
// from tunnel
|
||||
void cemiServer(CemiServer& cemiServer);
|
||||
void dataRequestFromTunnel(CemiFrame& frame);
|
||||
#endif
|
||||
|
||||
// from network layer
|
||||
void dataRequest(AckType ack, AddressType addrType, uint16_t destinationAddr, FrameFormat format,
|
||||
@ -35,5 +37,7 @@ class DataLinkLayer
|
||||
AddressTableObject& _groupAddressTable;
|
||||
NetworkLayer& _networkLayer;
|
||||
Platform& _platform;
|
||||
#ifdef USE_CEMI_SERVER
|
||||
CemiServer* _cemiServer;
|
||||
#endif
|
||||
};
|
||||
|
@ -1,3 +1,5 @@
|
||||
#ifdef USE_CEMI_SERVER
|
||||
|
||||
#include "bits.h"
|
||||
#include "usb_tunnel_interface.h"
|
||||
#include "cemi_server.h"
|
||||
@ -537,3 +539,5 @@ uint16_t UsbTunnelInterface::getHidReportDescriptorLength()
|
||||
{
|
||||
return sizeof(descHidReport);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user