save work

This commit is contained in:
Nanosonde 2020-06-08 14:15:22 +02:00
parent 332663897f
commit 54d8a009cf
22 changed files with 345 additions and 331 deletions

View File

@ -31,7 +31,8 @@ add_executable(knx-linux
../../src/knx/cemi_frame.cpp
../../src/knx/cemi_frame.h
../../src/knx/cemi_server.cpp
../../src/knx/cemi_server_object.cpp
../../src/knx/cemi_server.h
../../src/knx/cemi_server_object.cpp
../../src/knx/cemi_server_object.h
../../src/knx/data_link_layer.cpp
../../src/knx/data_link_layer.h
@ -55,14 +56,22 @@ add_executable(knx-linux
../../src/knx/ip_parameter_object.cpp
../../src/knx/ip_parameter_object.h
../../src/knx/knx_ip_device_information_dib.cpp
../../src/knx/knx_ip_dib.cpp
../../src/knx/knx_ip_frame.cpp
../../src/knx/knx_ip_routing_indication.cpp
../../src/knx/knx_ip_search_request.cpp
../../src/knx/knx_ip_search_response.cpp
../../src/knx/knx_ip_supported_service_dib.cpp
../../src/knx/ip_host_protocol_address_information.cpp
../../src/knx/knx_value.cpp
../../src/knx/knx_ip_device_information_dib.h
../../src/knx/knx_ip_dib.cpp
../../src/knx/knx_ip_dib.h
../../src/knx/knx_ip_frame.cpp
../../src/knx/knx_ip_frame.h
../../src/knx/knx_ip_routing_indication.cpp
../../src/knx/knx_ip_routing_indication.h
../../src/knx/knx_ip_search_request.cpp
../../src/knx/knx_ip_search_request.h
../../src/knx/knx_ip_search_response.cpp
../../src/knx/knx_ip_search_response.h
../../src/knx/knx_ip_supported_service_dib.cpp
../../src/knx/knx_ip_supported_service_dib.h
../../src/knx/ip_host_protocol_address_information.cpp
../../src/knx/ip_host_protocol_address_information.h
../../src/knx/knx_value.cpp
../../src/knx/knx_value.h
../../src/knx/memory.cpp
../../src/knx/memory.h
@ -70,7 +79,7 @@ add_executable(knx-linux
../../src/knx/network_layer.h
../../src/knx/npdu.cpp
../../src/knx/npdu.h
../../src/knx/platform.cpp
../../src/knx/platform.cpp
../../src/knx/platform.h
../../src/knx/property.cpp
../../src/knx/property.h
@ -93,7 +102,8 @@ add_executable(knx-linux
../../src/knx/transport_layer.cpp
../../src/knx/transport_layer.h
../../src/knx/usb_tunnel_interface.cpp
../../src/knx_facade.cpp
../../src/knx/usb_tunnel_interface.h
../../src/knx_facade.cpp
../../src/knx_facade.h
../../src/linux_platform.cpp
../../src/linux_platform.h

View File

@ -77,107 +77,157 @@ void ApplicationLayer::dataGroupConfirm(AckType ack, HopCountType hopType, Prior
}
}
void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu)
void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu, SystemBroadcast broadcastType)
{
uint8_t* data = apdu.data();
switch (apdu.type())
if (broadcastType == Broadcast)
{
case IndividualAddressWrite:
// APCI on Broadcast
switch (apdu.type())
{
uint16_t newAddress;
popWord(newAddress, data + 1);
_bau.individualAddressWriteIndication(hopType, newAddress);
break;
case IndividualAddressWrite:
{
uint16_t newAddress;
popWord(newAddress, data + 1);
_bau.individualAddressWriteIndication(hopType, newAddress);
break;
}
case IndividualAddressRead:
_bau.individualAddressReadIndication(hopType);
break;
case IndividualAddressResponse:
_bau.individualAddressReadAppLayerConfirm(hopType, apdu.frame().sourceAddress());
break;
case IndividualAddressSerialNumberRead:
{
uint8_t* knxSerialNumber = &data[1];
_bau.individualAddressSerialNumberReadIndication(priority, hopType, knxSerialNumber);
break;
}
case IndividualAddressSerialNumberResponse:
{
uint16_t domainAddress;
popWord(domainAddress, data + 7);
_bau.individualAddressSerialNumberReadAppLayerConfirm(hopType, data + 1, apdu.frame().sourceAddress(),
domainAddress);
break;
}
case IndividualAddressSerialNumberWrite:
{
uint8_t* knxSerialNumber = &data[1];
uint16_t newIndividualAddress;
popWord(newIndividualAddress, &data[7]);
_bau.individualAddressSerialNumberWriteIndication(priority, hopType, newIndividualAddress, knxSerialNumber);
break;
}
#if !((MEDIUM_TYPE == 5) || (MEDIUM_TYPE == 0))
default:
print("Broadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
break;
}
case IndividualAddressRead:
_bau.individualAddressReadIndication(hopType);
break;
case IndividualAddressResponse:
_bau.individualAddressReadAppLayerConfirm(hopType, apdu.frame().sourceAddress());
break;
case IndividualAddressSerialNumberRead:
}
else if (broadcastType == SysBroadcast)
{
// APCI on SystemBroadcast
switch (apdu.type())
{
uint8_t* knxSerialNumber = &data[1];
_bau.individualAddressSerialNumberReadIndication(priority, hopType, knxSerialNumber);
break;
}
case IndividualAddressSerialNumberResponse:
{
uint16_t domainAddress;
popWord(domainAddress, data + 7);
_bau.individualAddressSerialNumberReadAppLayerConfirm(hopType, data + 1, apdu.frame().sourceAddress(),
domainAddress);
break;
}
case IndividualAddressSerialNumberWrite:
{
uint8_t* knxSerialNumber = &data[1];
uint16_t newIndividualAddress;
popWord(newIndividualAddress, &data[7]);
_bau.individualAddressSerialNumberWriteIndication(priority, hopType, newIndividualAddress, knxSerialNumber);
break;
}
default:
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
dataSystemBroadcastIndication(hopType, priority, source, apdu);
#else
print("Broadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
#endif
// TODO: testInfo could be of any length
case SystemNetworkParameterRead:
{
uint16_t objectType;
uint16_t propertyId;
uint8_t testInfo[2];
popWord(objectType, data + 1);
popWord(propertyId, data + 3);
popByte(testInfo[0], data + 4);
popByte(testInfo[1], data + 5);
propertyId = (propertyId >> 4) & 0x0FFF;;
testInfo[0] &= 0x0F;
_bau.systemNetworkParameterReadIndication(priority, hopType, objectType, propertyId, testInfo, sizeof(testInfo));
break;
}
case DomainAddressSerialNumberWrite:
{
const uint8_t* knxSerialNumber = &data[1];
const uint8_t* domainAddress = &data[7];
_bau.domainAddressSerialNumberWriteIndication(priority, hopType, domainAddress, knxSerialNumber);
break;
}
case DomainAddressSerialNumberRead:
{
const uint8_t* knxSerialNumber = &data[1];
_bau.domainAddressSerialNumberReadIndication(priority, hopType, knxSerialNumber);
break;
}
#if !((MEDIUM_TYPE == 5) || (MEDIUM_TYPE == 0))
default:
if (broadcastType == SysBroadcast)
{
print("System");
}
#endif
print("Broadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
break;
}
}
}
void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status)
void ApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status, SystemBroadcast broadcastType)
{
uint8_t* data = apdu.data();
switch (apdu.type())
{
case IndividualAddressWrite:
{
uint16_t newAddress;
popWord(newAddress, data + 1);
_bau.individualAddressWriteLocalConfirm(ack, hopType, newAddress, status);
break;
}
case IndividualAddressRead:
_bau.individualAddressReadLocalConfirm(ack, hopType, status);
break;
case IndividualAddressResponse:
_bau.individualAddressReadResponseConfirm(ack, hopType, status);
break;
case IndividualAddressSerialNumberRead:
_bau.individualAddressSerialNumberReadLocalConfirm(ack, hopType, data + 1, status);
break;
case IndividualAddressSerialNumberResponse:
{
uint16_t domainAddress;
popWord(domainAddress, data + 7);
_bau.individualAddressSerialNumberReadResponseConfirm(ack, hopType, data + 1, domainAddress, status);
break;
}
case IndividualAddressSerialNumberWrite:
{
uint16_t newAddress;
popWord(newAddress, data + 7);
_bau.individualAddressSerialNumberWriteLocalConfirm(ack, hopType, data + 1, newAddress, status);
break;
}
default:
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
dataSystemBroadcastConfirm(hopType, priority, apdu, status);
#else
print("Broadcast-confirm: unhandled APDU-Type: ");
println(apdu.type());
#endif
}
}
void ApplicationLayer::dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu)
{
const uint8_t* data = apdu.data();
switch (apdu.type())
if (broadcastType == Broadcast)
{
// TODO: testInfo could be of any length
// APCI on Broadcast
switch (apdu.type())
{
case IndividualAddressWrite:
{
uint16_t newAddress;
popWord(newAddress, data + 1);
_bau.individualAddressWriteLocalConfirm(ack, hopType, newAddress, status);
break;
}
case IndividualAddressRead:
_bau.individualAddressReadLocalConfirm(ack, hopType, status);
break;
case IndividualAddressResponse:
_bau.individualAddressReadResponseConfirm(ack, hopType, status);
break;
case IndividualAddressSerialNumberRead:
_bau.individualAddressSerialNumberReadLocalConfirm(ack, hopType, data + 1, status);
break;
case IndividualAddressSerialNumberResponse:
{
uint16_t domainAddress;
popWord(domainAddress, data + 7);
_bau.individualAddressSerialNumberReadResponseConfirm(ack, hopType, data + 1, domainAddress, status);
break;
}
case IndividualAddressSerialNumberWrite:
{
uint16_t newAddress;
popWord(newAddress, data + 7);
_bau.individualAddressSerialNumberWriteLocalConfirm(ack, hopType, data + 1, newAddress, status);
break;
}
#if !((MEDIUM_TYPE == 5) || (MEDIUM_TYPE == 0))
default:
print("Broadcast-confirm: unhandled APDU-Type: ");
println(apdu.type());
break;
}
}
else if (broadcastType == SysBroadcast)
{
// APCI on SystemBroadcast
switch (apdu.type())
{
#endif
case SystemNetworkParameterRead:
{
uint16_t objectType;
@ -189,79 +239,33 @@ void ApplicationLayer::dataSystemBroadcastIndication(HopCountType hopType, Prior
popByte(testInfo[1], data + 5);
propertyId = (propertyId >> 4) & 0x0FFF;;
testInfo[0] &= 0x0F;
_bau.systemNetworkParameterReadIndication(priority, hopType, objectType, propertyId, testInfo, sizeof(testInfo));
//TODO: _bau.systemNetworkParameterReadLocalConfirm(priority, hopType, objectType, propertyId, testInfo, sizeof(testInfo), status);
break;
}
case DomainAddressSerialNumberWrite:
{
const uint8_t* knxSerialNumber = &data[1];
const uint8_t* domainAddress = &data[7];
_bau.domainAddressSerialNumberWriteIndication(priority, hopType, domainAddress, knxSerialNumber);
//TODO: _bau.domainAddressSerialNumberWriteLocalConfirm(priority, hopType, domainAddress, knxSerialNumber, status);
break;
}
case DomainAddressSerialNumberRead:
{
const uint8_t* knxSerialNumber = &data[1];
_bau.domainAddressSerialNumberReadIndication(priority, hopType, knxSerialNumber);
//TODO: _bau.domainAddressSerialNumberReadLocalConfirm(priority, hopType, knxSerialNumber, status);
break;
}
default:
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
// For closed media
print("Broadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
#else
// For open media (e.g. PL, RF)
print("SystemBroadcast-indication: unhandled APDU-Type: ");
println(apdu.type());
#endif
break;
}
}
void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, bool status)
{
const uint8_t* data = apdu.data();
switch (apdu.type())
{
case SystemNetworkParameterRead:
{
uint16_t objectType;
uint16_t propertyId;
uint8_t testInfo[2];
popWord(objectType, data + 1);
popWord(propertyId, data + 3);
popByte(testInfo[0], data + 4);
popByte(testInfo[1], data + 5);
propertyId = (propertyId >> 4) & 0x0FFF;;
testInfo[0] &= 0x0F;
//TODO: _bau.systemNetworkParameterReadLocalConfirm(priority, hopType, objectType, propertyId, testInfo, sizeof(testInfo), status);
break;
}
case DomainAddressSerialNumberWrite:
{
const uint8_t* knxSerialNumber = &data[1];
const uint8_t* domainAddress = &data[7];
//TODO: _bau.domainAddressSerialNumberWriteLocalConfirm(priority, hopType, domainAddress, knxSerialNumber, status);
break;
}
case DomainAddressSerialNumberRead:
{
const uint8_t* knxSerialNumber = &data[1];
//TODO: _bau.domainAddressSerialNumberReadLocalConfirm(priority, hopType, knxSerialNumber, status);
break;
}
default:
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
// For closed media
print("Broadcast-confirm: unhandled APDU-Type: ");
println(apdu.type());
#else
// For open media (e.g. PL, RF)
print("SystemBroadcast-confirm: unhandled APDU-Type: ");
println(apdu.type());
#if !((MEDIUM_TYPE == 5) || (MEDIUM_TYPE == 0))
if (broadcastType == SysBroadcast)
{
print("System");
}
#endif
print("Broadcast-confirm: unhandled APDU-Type: ");
println(apdu.type());
break;
}
}
}
@ -553,7 +557,7 @@ void ApplicationLayer::propertyValueWriteRequest(AckType ack, Priority priority,
}
void ApplicationLayer::functionPropertyStateResponse(AckType ack, Priority priority, HopCountType hopType, uint16_t asap,
uint8_t objectIndex, uint8_t propertyId, uint8_t returnCode, uint8_t* resultData, uint8_t resultLength)
uint8_t objectIndex, uint8_t propertyId, uint8_t* resultData, uint8_t resultLength)
{
CemiFrame frame(3 + resultLength + 1);
APDU& apdu = frame.apdu();
@ -562,9 +566,8 @@ void ApplicationLayer::functionPropertyStateResponse(AckType ack, Priority prior
data[0] = objectIndex;
data[1] = propertyId;
data[2] = returnCode;
if (resultLength > 0)
memcpy(&data[3], resultData, resultLength);
memcpy(&data[2], resultData, resultLength);
if (asap == _connectedTsap)
dataConnectedRequest(asap, priority, apdu);
@ -1011,11 +1014,11 @@ void ApplicationLayer::dataGroupRequest(AckType ack, HopCountType hopType, Prior
}
void ApplicationLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu)
{
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, Broadcast);
}
void ApplicationLayer::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu)
{
_transportLayer->dataSystemBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
_transportLayer->dataBroadcastRequest(ack, hopType, SystemPriority, apdu, SysBroadcast);
}
void ApplicationLayer::dataIndividualRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t destination, APDU& apdu)
{

View File

@ -65,10 +65,8 @@ class ApplicationLayer
*/
virtual void dataGroupConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap,
APDU& apdu, bool status);
virtual void dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu);
virtual void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status);
virtual void dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu);
virtual void dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, bool status);
virtual void dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu, SystemBroadcast broadcastType);
virtual void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status, SystemBroadcast broadcastType);
virtual void dataIndividualIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu);
virtual void dataIndividualConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, bool status);
virtual void connectIndication(uint16_t tsap);
@ -106,7 +104,7 @@ class ApplicationLayer
void propertyValueWriteRequest(AckType ack, Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
uint8_t propertyId, uint8_t numberOfElements, uint16_t startIndex, uint8_t* data, uint8_t length);
void functionPropertyStateResponse(AckType ack, Priority priority, HopCountType hopType, uint16_t asap,
uint8_t objectIndex, uint8_t propertyId, uint8_t returnCode, uint8_t *data, uint8_t length);
uint8_t objectIndex, uint8_t propertyId, uint8_t *resultData, uint8_t resultLength);
void propertyDescriptionReadRequest(AckType ack, Priority priority, HopCountType hopType, uint16_t asap,
uint8_t objectIndex, uint8_t propertyId, uint8_t propertyIndex);
void propertyDescriptionReadResponse(AckType ack, Priority priority, HopCountType hopType, uint16_t asap,

View File

@ -20,6 +20,9 @@ Bau07B0::Bau07B0(Platform& platform)
_dlLayer.cemiServer(_cemiServer);
_memory.addSaveRestore(&_cemiServerObject);
#endif
#ifdef USE_DATASECURE
_memory.addSaveRestore(&_secIfObj);
#endif
// Set Mask Version in Device Object depending on the BAU
_deviceObj.maskVersion(0x07B0);
@ -33,7 +36,12 @@ Bau07B0::Bau07B0(Platform& platform)
prop->write(3, OT_ASSOC_TABLE);
prop->write(4, OT_GRP_OBJ_TABLE);
prop->write(5, OT_APPLICATION_PROG);
#ifdef USE_CEMI_SERVER
#if defined(USE_DATASECURE) && defined(USE_CEMI_SERVER)
prop->write(6, OT_SECURITY);
prop->write(7, OT_CEMI_SERVER);
#elif defined(USE_DATASECURE)
prop->write(6, OT_SECURITY);
#elif defined(USE_CEMI_SERVER)
prop->write(6, OT_CEMI_SERVER);
#endif
}
@ -54,10 +62,18 @@ InterfaceObject* Bau07B0::getInterfaceObject(uint8_t idx)
return &_appProgram;
case 5: // would be app_program 2
return nullptr;
#ifdef USE_CEMI_SERVER
#if defined(USE_DATASECURE) && defined(USE_CEMI_SERVER)
case 6:
return &_secIfObj;
case 7:
return &_cemiServerObject;
#elif defined(USE_CEMI_SERVER)
case 6:
return &_cemiServerObject;
#endif
#elif defined(USE_DATASECURE)
case 6:
return &_secIfObj;
#endif
default:
return nullptr;
}
@ -81,6 +97,10 @@ InterfaceObject* Bau07B0::getInterfaceObject(ObjectType objectType, uint8_t obje
return &_groupObjTable;
case OT_APPLICATION_PROG:
return &_appProgram;
#ifdef USE_DATASECURE
case OT_SECURITY:
return &_secIfObj;
#endif
#ifdef USE_CEMI_SERVER
case OT_CEMI_SERVER:
return &_cemiServerObject;
@ -103,4 +123,4 @@ void Bau07B0::loop()
#endif
}
#endif
#endif

View File

@ -20,6 +20,9 @@ Bau27B0::Bau27B0(Platform& platform)
_dlLayer.cemiServer(_cemiServer);
_memory.addSaveRestore(&_cemiServerObject);
#endif
#ifdef USE_DATASECURE
_memory.addSaveRestore(&_secIfObj);
#endif
// Set Mask Version in Device Object depending on the BAU
_deviceObj.maskVersion(0x27B0);
@ -41,7 +44,12 @@ Bau27B0::Bau27B0(Platform& platform)
prop->write(4, OT_GRP_OBJ_TABLE);
prop->write(5, OT_APPLICATION_PROG);
prop->write(6, OT_RF_MEDIUM);
#ifdef USE_CEMI_SERVER
#if defined(USE_DATASECURE) && defined(USE_CEMI_SERVER)
prop->write(7, OT_SECURITY);
prop->write(8, OT_CEMI_SERVER);
#elif defined(USE_DATASECURE)
prop->write(7, OT_SECURITY);
#elif defined(USE_CEMI_SERVER)
prop->write(7, OT_CEMI_SERVER);
#endif
}
@ -65,10 +73,18 @@ InterfaceObject* Bau27B0::getInterfaceObject(uint8_t idx)
return nullptr;
case 6:
return &_rfMediumObj;
#ifdef USE_CEMI_SERVER
#if defined(USE_DATASECURE) && defined(USE_CEMI_SERVER)
case 7:
return &_secIfObj;
case 8:
return &_cemiServerObject;
#elif defined(USE_CEMI_SERVER)
case 7:
return &_cemiServerObject;
#endif
#elif defined(USE_DATASECURE)
case 7:
return &_secIfObj;
#endif
default:
return nullptr;
}
@ -94,6 +110,10 @@ InterfaceObject* Bau27B0::getInterfaceObject(ObjectType objectType, uint8_t obje
return &_appProgram;
case OT_RF_MEDIUM:
return &_rfMediumObj;
#ifdef USE_DATASECURE
case OT_SECURITY:
return &_secIfObj;
#endif
#ifdef USE_CEMI_SERVER
case OT_CEMI_SERVER:
return &_cemiServerObject;

View File

@ -22,6 +22,9 @@ Bau57B0::Bau57B0(Platform& platform)
_cemiServer.dataLinkLayer(_dlLayer);
_dlLayer.cemiServer(_cemiServer);
_memory.addSaveRestore(&_cemiServerObject);
#endif
#ifdef USE_DATASECURE
_memory.addSaveRestore(&_secIfObj);
#endif
_memory.addSaveRestore(&_ipParameters);
@ -38,7 +41,12 @@ Bau57B0::Bau57B0(Platform& platform)
prop->write(4, OT_GRP_OBJ_TABLE);
prop->write(5, OT_APPLICATION_PROG);
prop->write(6, OT_IP_PARAMETER);
#ifdef USE_CEMI_SERVER
#if defined(USE_DATASECURE) && defined(USE_CEMI_SERVER)
prop->write(7, OT_SECURITY);
prop->write(8, OT_CEMI_SERVER);
#elif defined(USE_DATASECURE)
prop->write(7, OT_SECURITY);
#elif defined(USE_CEMI_SERVER)
prop->write(7, OT_CEMI_SERVER);
#endif
}
@ -61,6 +69,18 @@ InterfaceObject* Bau57B0::getInterfaceObject(uint8_t idx)
return nullptr;
case 6:
return &_ipParameters;
#if defined(USE_DATASECURE) && defined(USE_CEMI_SERVER)
case 7:
return &_secIfObj;
case 8:
return &_cemiServerObject;
#elif defined(USE_CEMI_SERVER)
case 7:
return &_cemiServerObject;
#elif defined(USE_DATASECURE)
case 7:
return &_secIfObj;
#endif
default:
return nullptr;
}
@ -86,6 +106,14 @@ InterfaceObject* Bau57B0::getInterfaceObject(ObjectType objectType, uint8_t obje
return &_appProgram;
case OT_IP_PARAMETER:
return &_ipParameters;
#ifdef USE_DATASECURE
case OT_SECURITY:
return &_secIfObj;
#endif
#ifdef USE_CEMI_SERVER
case OT_CEMI_SERVER:
return &_cemiServerObject;
#endif
default:
return nullptr;
}
@ -96,4 +124,4 @@ DataLinkLayer& Bau57B0::dataLinkLayer()
return _dlLayer;
}
#endif
#endif

View File

@ -243,29 +243,27 @@ void BauSystemB::propertyValueReadIndication(Priority priority, HopCountType hop
void BauSystemB::functionPropertyCommandIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
uint8_t propertyId, uint8_t* data, uint8_t length)
{
uint8_t returnCode = 0xFF;
uint8_t resultLength = 0;
uint8_t resultData[32];
InterfaceObject* obj = getInterfaceObject(objectIndex);
if(obj)
returnCode = obj->command((PropertyID)propertyId, data, length, resultData, resultLength);
obj->command((PropertyID)propertyId, data, length, resultData, resultLength);
_appLayer.functionPropertyStateResponse(AckRequested, priority, hopType, asap, objectIndex, propertyId, returnCode, resultData, resultLength);
_appLayer.functionPropertyStateResponse(AckRequested, priority, hopType, asap, objectIndex, propertyId, resultData, resultLength);
}
void BauSystemB::functionPropertyStateIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
uint8_t propertyId, uint8_t* data, uint8_t length)
{
uint8_t returnCode = 0xFF;
uint8_t resultLength = 0;
uint8_t resultData[32];
InterfaceObject* obj = getInterfaceObject(objectIndex);
if(obj)
returnCode = obj->state((PropertyID)propertyId, data, length, resultData, resultLength);
obj->state((PropertyID)propertyId, data, length, resultData, resultLength);
_appLayer.functionPropertyStateResponse(AckRequested, priority, hopType, asap, objectIndex, propertyId, returnCode, resultData, resultLength);
_appLayer.functionPropertyStateResponse(AckRequested, priority, hopType, asap, objectIndex, propertyId, resultData, resultLength);
}
void BauSystemB::individualAddressReadIndication(HopCountType hopType)

View File

@ -6,6 +6,7 @@
#include "address_table_object.h"
#include "association_table_object.h"
#include "group_object_table_object.h"
#include "security_interface_object.h"
#include "application_program_object.h"
#include "application_layer.h"
#include "secure_application_layer.h"
@ -98,6 +99,7 @@ class BauSystemB : protected BusAccessUnit
Platform& _platform;
#ifdef USE_DATASECURE
SecureApplicationLayer _appLayer;
SecurityInterfaceObject _secIfObj;
#else
ApplicationLayer _appLayer;
#endif

View File

@ -41,14 +41,15 @@ void DataLinkLayer::dataRequest(AckType ack, AddressType addrType, uint16_t dest
sendTelegram(npdu, ack, destinationAddr, addrType, format, priority, Broadcast);
}
void DataLinkLayer::systemBroadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu)
void DataLinkLayer::broadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu, SystemBroadcast broadcastType)
{
// System Broadcast requests will always be transmitted as broadcast with KNX serial number for open media (e.g. RF medium)
// See 3.2.5 p.22
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
(void)broadcastType; // not used on TP/IP, always normal broadcast
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, Broadcast);
#else
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, SysBroadcast);
sendTelegram(npdu, ack, 0, GroupAddress, format, priority, broadcastType);
#endif
}
@ -64,7 +65,7 @@ void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
FrameFormat type = frame.frameType();
Priority priority = frame.priority();
NPDU& npdu = frame.npdu();
SystemBroadcast systemBroadcast = frame.systemBroadcast();
SystemBroadcast broadcastType = frame.systemBroadcast();
#ifdef USE_CEMI_SERVER
// if the confirmation was caused by a tunnel request then
@ -78,15 +79,11 @@ void DataLinkLayer::dataConReceived(CemiFrame& frame, bool success)
if (addrType == GroupAddress && destination == 0)
{
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
(void) systemBroadcast; // not used
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success);
#else
if (systemBroadcast == SysBroadcast)
_networkLayer.systemBroadcastConfirm(ack, type, priority, source, npdu, success);
else
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success);
#endif
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success, broadcastType);
}
else if (addrType == InduvidualAddress && destination == 0)
{
_networkLayer.broadcastConfirm(ack, type, priority, source, npdu, success, broadcastType);
}
else
_networkLayer.dataConfirm(ack, addrType, destination, type, priority, source, npdu, success);
@ -104,7 +101,7 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
Priority priority = frame.priority();
NPDU& npdu = frame.npdu();
uint16_t ownAddr = _deviceObject.induvidualAddress();
SystemBroadcast systemBroadcast = frame.systemBroadcast();
SystemBroadcast broadcastType = frame.systemBroadcast();
#ifdef USE_CEMI_SERVER
// Do not send our own message back to the tunnel
@ -119,15 +116,11 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
if (addrType == GroupAddress && destination == 0)
{
#if (MEDIUM_TYPE == 5)||(MEDIUM_TYPE == 0)
(void) systemBroadcast; // not used
_networkLayer.broadcastIndication(ack, type, npdu, priority, source);
#else
if (systemBroadcast == SysBroadcast)
_networkLayer.systemBroadcastIndication(ack, type, npdu, priority, source);
else
_networkLayer.broadcastIndication(ack, type, npdu, priority, source);
#endif
_networkLayer.broadcastIndication(ack, type, npdu, priority, source, broadcastType);
}
else if (addrType == InduvidualAddress && destination == 0)
{
_networkLayer.broadcastIndication(ack, type, npdu, priority, source, broadcastType);
}
else
{
@ -147,7 +140,7 @@ void DataLinkLayer::frameRecieved(CemiFrame& frame)
}
}
bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast systemBroadcast)
bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast broadcastType)
{
CemiFrame& frame = npdu.frame();
frame.messageCode(L_data_ind);
@ -156,7 +149,7 @@ bool DataLinkLayer::sendTelegram(NPDU & npdu, AckType ack, uint16_t destinationA
frame.addressType(addrType);
frame.priority(priority);
frame.repetition(RepititionAllowed);
frame.systemBroadcast(systemBroadcast);
frame.systemBroadcast(broadcastType);
if (npdu.octetCount() <= 15)
frame.frameType(StandardFrame);

View File

@ -24,7 +24,7 @@ class DataLinkLayer
// from network layer
void dataRequest(AckType ack, AddressType addrType, uint16_t destinationAddr, FrameFormat format,
Priority priority, NPDU& npdu);
void systemBroadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu);
void broadcastRequest(AckType ack, FrameFormat format, Priority priority, NPDU& npdu, SystemBroadcast broadcastType);
virtual void loop() = 0;
virtual void enabled(bool value) = 0;
virtual bool enabled() const = 0;
@ -32,7 +32,7 @@ class DataLinkLayer
protected:
void frameRecieved(CemiFrame& frame);
void dataConReceived(CemiFrame& frame, bool success);
bool sendTelegram(NPDU& npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast systemBroadcast);
bool sendTelegram(NPDU& npdu, AckType ack, uint16_t destinationAddr, AddressType addrType, FrameFormat format, Priority priority, SystemBroadcast broadcastType);
virtual bool sendFrame(CemiFrame& frame) = 0;
uint8_t* frameData(CemiFrame& frame);
DeviceObject& _deviceObject;

View File

@ -8,8 +8,8 @@ template <class T> class FunctionProperty : public Property
{
public:
FunctionProperty(T* io, PropertyID id, uint8_t access,
uint8_t (*commandCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&),
uint8_t (*stateCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&))
void (*commandCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&),
void (*stateCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&))
: Property(id, false, PDT_FUNCTION, 1, access), _interfaceObject(io), _commandCallback(commandCallback), _stateCallback(stateCallback)
/* max_elements is set to 1, see 3.3.7 Application Layer p.68 */
{}
@ -24,24 +24,28 @@ template <class T> class FunctionProperty : public Property
return 0;
}
virtual uint8_t command(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) override
virtual void command(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) override
{
if (length == 0 || _commandCallback == nullptr )
return 0xFF;
return _commandCallback(_interfaceObject, data, length, resultData, resultLength);
{
resultLength = 0;
return;
}
_commandCallback(_interfaceObject, data, length, resultData, resultLength);
}
virtual uint8_t state(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) override
virtual void state(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) override
{
if (length == 0 || _stateCallback == nullptr )
return 0xFF;
return _stateCallback(_interfaceObject, data, length, resultData, resultLength);
{
resultLength = 0;
return;
}
_stateCallback(_interfaceObject, data, length, resultData, resultLength);
}
private:
T* _interfaceObject = nullptr;
uint8_t (*_commandCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&) = nullptr;
uint8_t (*_stateCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&) = nullptr;
void (*_commandCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&) = nullptr;
void (*_stateCallback)(T*, uint8_t*, uint8_t, uint8_t*, uint8_t&) = nullptr;
};

View File

@ -137,26 +137,28 @@ uint8_t InterfaceObject::propertySize(PropertyID id)
return prop->ElementSize();
}
uint8_t InterfaceObject::command(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength)
void InterfaceObject::command(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength)
{
Property* prop = property(id);
if (prop == nullptr)
{
return 0xFF;
resultLength = 0;
return;;
}
return prop->command(data, length, resultData, resultLength);
prop->command(data, length, resultData, resultLength);
}
uint8_t InterfaceObject::state(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t resultLength)
void InterfaceObject::state(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t resultLength)
{
Property* prop = property(id);
if (prop == nullptr)
{
return 0xFF;
resultLength = 0;
return;;
}
return prop->state(data, length, resultData, resultLength);
prop->state(data, length, resultData, resultLength);
}
uint8_t InterfaceObject::propertyDescriptionCount()

View File

@ -114,7 +114,7 @@ class InterfaceObject : public SaveRestore
*
* @param[out] resultData The result data for the function
*/
virtual uint8_t command(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t &resultLength);
virtual void command(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t &resultLength);
/**
* Get state of a function property of the interface object. Property type must be PDT_FUNCTION
*
@ -128,7 +128,7 @@ class InterfaceObject : public SaveRestore
*
* @param[out] resultData The result data for the function
*/
virtual uint8_t state(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t resultLength);
virtual void state(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t resultLength);
/**
* Read the Description of a property of the interface object. The output parameters are only valid if nuberOfElements is not zero.
*

View File

@ -43,9 +43,10 @@ void NetworkLayer::dataIndication(AckType ack, AddressType addrType, uint16_t de
_transportLayer.dataGroupIndication(destination, hopType, priority, source, npdu.tpdu());
return;
}
// destination == 0
_transportLayer.dataBroadcastIndication(hopType, priority, source, npdu.tpdu());
// assert: programming error
// should never be reached!
// destination == 0 && (addrType == InduvidualAddress || ddrType == GroupAddress)
}
void NetworkLayer::dataConfirm(AckType ack, AddressType addressType, uint16_t destination, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status)
@ -62,32 +63,22 @@ void NetworkLayer::dataConfirm(AckType ack, AddressType addressType, uint16_t de
_transportLayer.dataGroupConfirm(ack, source, destination, hopType, priority, npdu.tpdu(), status);
return;
}
// destination == 0
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status);
// assert: programming error
// should never be reached!
// destination == 0 && (addrType == InduvidualAddress || ddrType == GroupAddress)
}
void NetworkLayer::broadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source)
void NetworkLayer::broadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source, SystemBroadcast broadcastType)
{
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
_transportLayer.dataBroadcastIndication(hopType, priority, source, npdu.tpdu());
_transportLayer.dataBroadcastIndication(hopType, priority, source, npdu.tpdu(), broadcastType);
}
void NetworkLayer::broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status)
void NetworkLayer::broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status, SystemBroadcast broadcastType)
{
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status);
}
void NetworkLayer::systemBroadcastIndication(AckType ack, FrameFormat format, NPDU& npdu, Priority priority, uint16_t source)
{
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
_transportLayer.dataSystemBroadcastIndication(hopType, priority, source, npdu.tpdu());
}
void NetworkLayer::systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status)
{
HopCountType hopType = npdu.hopCount() == 7 ? UnlimitedRouting : NetworkLayerParameter;
_transportLayer.dataSystemBroadcastConfirm(ack, hopType, npdu.tpdu(), priority, status);
_transportLayer.dataBroadcastConfirm(ack, hopType, priority, npdu.tpdu(), status, broadcastType);
}
void NetworkLayer::dataIndividualRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu)
@ -119,12 +110,7 @@ void NetworkLayer::dataGroupRequest(AckType ack, uint16_t destination, HopCountT
sendDataRequest(tpdu, hopType, ack, destination, priority, GroupAddress);
}
void NetworkLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
{
sendDataRequest(tpdu, hopType, ack, 0, priority, GroupAddress);
}
void NetworkLayer::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu)
void NetworkLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, SystemBroadcast broadcastType)
{
NPDU& npdu = tpdu.frame().npdu();
@ -135,5 +121,5 @@ void NetworkLayer::dataSystemBroadcastRequest(AckType ack, HopCountType hopType,
FrameFormat frameFormat = npdu.octetCount() > 15 ? ExtendedFrame : StandardFrame;
_dataLinkLayer->systemBroadcastRequest(ack, frameFormat, priority, npdu);
_dataLinkLayer->broadcastRequest(ack, frameFormat, priority, npdu, broadcastType);
}

View File

@ -21,17 +21,14 @@ class NetworkLayer
void dataConfirm(AckType ack, AddressType addressType, uint16_t destination, FrameFormat format, Priority priority,
uint16_t source, NPDU& npdu, bool status);
void broadcastIndication(AckType ack, FrameFormat format, NPDU& npdu,
Priority priority, uint16_t source);
void broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status);
void systemBroadcastIndication(AckType ack, FrameFormat format, NPDU& npdu,
Priority priority, uint16_t source);
void systemBroadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status);
Priority priority, uint16_t source, SystemBroadcast broadcastType);
void broadcastConfirm(AckType ack, FrameFormat format, Priority priority, uint16_t source, NPDU& npdu, bool status,
SystemBroadcast broadcastType);
// from transport layer
void dataIndividualRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu);
void dataGroupRequest(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu);
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu);
void dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu);
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, SystemBroadcast broadcastType);
private:
void sendDataRequest(TPDU& tpdu, HopCountType hopType, AckType ack, uint16_t destination, Priority priority, AddressType addrType);

View File

@ -204,22 +204,18 @@ uint8_t Property::write(uint16_t position, uint16_t value)
return write(position, 1, data);
}
uint8_t Property::command(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength)
void Property::command(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength)
{
(void)data;
(void)length;
(void)resultData;
resultLength = 0;
return 0xFF;
}
uint8_t Property::state(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t &resultLength)
void Property::state(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t &resultLength)
{
(void)data;
(void)length;
(void)resultData;
resultLength = 0;
return 0xFF;
}

View File

@ -251,8 +251,8 @@ class Property : public SaveRestore
uint8_t ElementSize() const;
virtual uint8_t read(uint16_t start, uint8_t count, uint8_t* data) const = 0;
virtual uint8_t write(uint16_t start, uint8_t count, const uint8_t* data) = 0;
virtual uint8_t command(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength);
virtual uint8_t state(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength);
virtual void command(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength);
virtual void state(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength);
uint8_t read(uint8_t& value) const;
uint8_t read(uint16_t& value) const;
uint8_t read(uint32_t& value) const;

View File

@ -55,7 +55,7 @@ void SecureApplicationLayer::dataGroupConfirm(AckType ack, HopCountType hopType,
}
}
void SecureApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu)
void SecureApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu, SystemBroadcast broadcastType)
{
if (apdu.type() == SecureService)
{
@ -64,31 +64,13 @@ void SecureApplicationLayer::dataBroadcastIndication(HopCountType hopType, Prior
}
else
{
ApplicationLayer::dataBroadcastIndication(hopType, priority, source, apdu);
ApplicationLayer::dataBroadcastIndication(hopType, priority, source, apdu, broadcastType);
}
}
void SecureApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status)
void SecureApplicationLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status, SystemBroadcast broadcastType)
{
ApplicationLayer::dataBroadcastConfirm(ack, hopType, priority, apdu, status);
}
void SecureApplicationLayer::dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu)
{
if (apdu.type() == SecureService)
{
// Secure APDU is not allowed in Broadcast
println("Secure APDU in SystemBroadcast not allowed!");
}
else
{
ApplicationLayer::dataSystemBroadcastIndication(hopType, priority, source, apdu);
}
}
void SecureApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, bool status)
{
ApplicationLayer::dataSystemBroadcastConfirm(hopType, priority, apdu, status);
ApplicationLayer::dataBroadcastConfirm(ack, hopType, priority, apdu, status, broadcastType);
}
void SecureApplicationLayer::dataIndividualIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu)
@ -198,7 +180,7 @@ void SecureApplicationLayer::dataBroadcastRequest(AckType ack, HopCountType hopT
void SecureApplicationLayer::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu)
{
ApplicationLayer::dataSystemBroadcastRequest(AckDontCare, hopType, SystemPriority, apdu);
ApplicationLayer::dataSystemBroadcastRequest(ack, hopType, SystemPriority, apdu);
}
void SecureApplicationLayer::dataIndividualRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t destination, APDU& apdu)

View File

@ -28,10 +28,8 @@ class SecureApplicationLayer : public ApplicationLayer
virtual void dataGroupIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu) override;
virtual void dataGroupConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap,
APDU& apdu, bool status) override;
virtual void dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu) override;
virtual void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status) override;
virtual void dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu) override;
virtual void dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, bool status) override;
virtual void dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu, SystemBroadcast broadcastType) override;
virtual void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, bool status, SystemBroadcast broadcastType) override;
virtual void dataIndividualIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu) override;
virtual void dataIndividualConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, bool status) override;
virtual void connectIndication(uint16_t tsap) override;

View File

@ -31,28 +31,24 @@ SecurityInterfaceObject::SecurityInterfaceObject()
}),
new FunctionProperty<SecurityInterfaceObject>(this, PID_SECURITY_MODE, ReadLv3 | WriteLv0,
// Command Callback of PID_SECURITY_MODE
[](SecurityInterfaceObject* obj, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) -> uint8_t {
[](SecurityInterfaceObject* obj, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) -> void {
// TODO
return 0;
},
// State Callback of PID_SECURITY_MODE
[](SecurityInterfaceObject* obj, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) -> uint8_t {
[](SecurityInterfaceObject* obj, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) -> void {
// TODO
return 0;
}),
new DataProperty( PID_P2P_KEY_TABLE, true, PDT_GENERIC_20, 1, ReadLv3 | WriteLv0, (uint16_t)0 ), // TODO: value
new DataProperty( PID_GRP_KEY_TABLE, true, PDT_GENERIC_18, 1, ReadLv3 | WriteLv0, (uint16_t)0 ), // TODO: value
new DataProperty( PID_SECURITY_INDIVIDUAL_ADDRESS_TABLE, true, PDT_GENERIC_08, 1, ReadLv3 | WriteLv0, (uint16_t)0 ), // TODO: value
new FunctionProperty<SecurityInterfaceObject>(this, PID_SECURITY_FAILURES_LOG, ReadLv3 | WriteLv0,
// Command Callback of PID_SECURITY_FAILURES_LOG
[](SecurityInterfaceObject* obj, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) -> uint8_t {
[](SecurityInterfaceObject* obj, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) -> void {
// TODO
return 0;
},
// State Callback of PID_SECURITY_FAILURES_LOG
[](SecurityInterfaceObject* obj, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) -> uint8_t {
[](SecurityInterfaceObject* obj, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength) -> void {
// TODO
return 0;
}),
new DataProperty( PID_TOOL_KEY, true, PDT_GENERIC_16, 1, ReadLv3 | WriteLv0, (uint16_t)0 ), // TODO: value (default is FDSK)
new DataProperty( PID_SECURITY_REPORT, true, PDT_BITSET8, 1, ReadLv3 | WriteLv0, (uint16_t)0 ), // TODO: value

View File

@ -373,24 +373,14 @@ void TransportLayer::dataGroupConfirm(AckType ack, uint16_t source, uint16_t des
_applicationLayer.dataGroupConfirm(ack, hopType, priority, destination, tpdu.apdu(), status);
}
void TransportLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu)
void TransportLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu, SystemBroadcast broadcastType)
{
_applicationLayer.dataBroadcastIndication(hopType, priority, source, tpdu.apdu());
_applicationLayer.dataBroadcastIndication(hopType, priority, source, tpdu.apdu(), broadcastType);
}
void TransportLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status)
void TransportLayer::dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status, SystemBroadcast broadcastType)
{
_applicationLayer.dataBroadcastConfirm(ack, hopType, priority, tpdu.apdu(), status);
}
void TransportLayer::dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu)
{
_applicationLayer.dataSystemBroadcastIndication(hopType, priority, source, tpdu.apdu());
}
void TransportLayer::dataSystemBroadcastConfirm(AckType ack, HopCountType hopType, TPDU& tpdu, Priority priority, bool status)
{
_applicationLayer.dataSystemBroadcastConfirm(hopType, priority, tpdu.apdu(), status);
_applicationLayer.dataBroadcastConfirm(ack, hopType, priority, tpdu.apdu(), status, broadcastType);
}
void TransportLayer::dataGroupRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu)
@ -400,16 +390,10 @@ void TransportLayer::dataGroupRequest(AckType ack, HopCountType hopType, Priorit
_networkLayer->dataGroupRequest(ack, groupAdress, hopType, priority, tpdu);
}
void TransportLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu)
void TransportLayer::dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, SystemBroadcast broadcastType)
{
TPDU& tpdu = apdu.frame().tpdu();
_networkLayer->dataBroadcastRequest(ack, hopType, priority, tpdu);
}
void TransportLayer::dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu)
{
TPDU& tpdu = apdu.frame().tpdu();
return _networkLayer->dataSystemBroadcastRequest(ack, hopType, priority, tpdu);
_networkLayer->dataBroadcastRequest(ack, hopType, priority, tpdu, broadcastType);
}
void TransportLayer::dataIndividualRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t destination, APDU& apdu)

View File

@ -24,10 +24,8 @@ public:
void dataIndividualConfirm(AckType ack, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu, bool status);
void dataGroupIndication(uint16_t destination, HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu);
void dataGroupConfirm(AckType ack, uint16_t source, uint16_t destination, HopCountType hopType, Priority priority, TPDU& tpdu, bool status);
void dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu);
void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status);
void dataSystemBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu);
void dataSystemBroadcastConfirm(AckType ack, HopCountType hopType, TPDU& tpdu, Priority priority, bool status);
void dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, TPDU& tpdu, SystemBroadcast broadcastType);
void dataBroadcastConfirm(AckType ack, HopCountType hopType, Priority priority, TPDU& tpdu, bool status, SystemBroadcast broadcastType);
#pragma endregion
#pragma region from application layer
@ -48,8 +46,7 @@ public:
* @param ack Did we want a DataLinkLayer acknowledgement? See ::AckType.
*/
void dataGroupRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu);
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu);
void dataSystemBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu);
void dataBroadcastRequest(AckType ack, HopCountType hopType, Priority priority, APDU& apdu, SystemBroadcast broadcastType);
void dataIndividualRequest(AckType ack, HopCountType hopType, Priority priority, uint16_t destination, APDU& apdu);
void connectRequest(uint16_t destination, Priority priority);