Fix build for cemi_server without RF support

This commit is contained in:
Tony 2024-06-20 02:09:16 +08:00
parent 57b5b05ce1
commit 9a46d7b1b2
2 changed files with 9 additions and 2 deletions

View File

@ -56,6 +56,7 @@ void CemiServer::dataConfirmationToTunnel(CemiFrame& frame)
void CemiServer::dataIndicationToTunnel(CemiFrame& frame)
{
#ifdef USE_RF
bool isRf = _dataLinkLayer->mediumType() == DptMedium::KNX_RF;
uint8_t data[frame.dataLength() + (isRf ? 10 : 0)];
@ -74,6 +75,10 @@ void CemiServer::dataIndicationToTunnel(CemiFrame& frame)
{
memcpy(&data[0], frame.data(), frame.dataLength());
}
#else
uint8_t data[frame.dataLength()];
memcpy(&data[0], frame.data(), frame.dataLength());
#endif
CemiFrame tmpFrame(data, sizeof(data));
@ -102,7 +107,7 @@ void CemiServer::frameReceived(CemiFrame& frame)
{
frame.sourceAddress(_clientAddress);
}
#ifdef USE_RF
if (isRf)
{
// Check if we have additional info for RF
@ -133,7 +138,7 @@ void CemiServer::frameReceived(CemiFrame& frame)
_frameNumber = (_frameNumber + 1) & 0x7;
}
}
#endif
print("L_data_req: src: ");
print(frame.sourceAddress(), HEX);
print(" dst: ");

View File

@ -173,9 +173,11 @@ bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationA
// 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)
#ifdef USE_RF
tmpFrame.rfSerialOrDoA(frame.rfSerialOrDoA());
tmpFrame.rfInfo(frame.rfInfo());
tmpFrame.rfLfn(frame.rfLfn());
#endif
tmpFrame.confirm(ConfirmNoError);
_cemiServer->dataIndicationToTunnel(tmpFrame);
#endif