turn TUNNELLING of again

This commit is contained in:
Thomas Kunze 2024-08-18 00:05:30 +02:00
parent 8c3af52892
commit 897acfe10f
14 changed files with 682 additions and 18 deletions

View File

@ -99,7 +99,7 @@ void setup()
srand((unsigned int)time(NULL));
knx.readMemory();
if (knx.individualAddress() == 0)
if (knx.individualAddress() == 0xFFFF)
knx.progMode(true);
if (knx.configured())

View File

@ -188,5 +188,4 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -
add_library(knx SHARED ${SOURCES})
target_include_directories(knx PUBLIC .)
set_property(TARGET knx PROPERTY CXX_STANDARD 11)
target_compile_definitions(knx PUBLIC -DUSE_USB -DUSE_CEMI_SERVER
-DKNX_TUNNELING=1 -DUSE_DATASECURE)
target_compile_definitions(knx PUBLIC)

View File

@ -3,6 +3,9 @@
#include "address_table_object.h"
#include "bits.h"
#include "data_property.h"
#include "util/logger.h"
#define LOGGER Logger::logger("AddressTableObject")
using namespace std;
@ -87,6 +90,7 @@ bool AddressTableObject::contains(uint16_t addr)
void AddressTableObject::beforeStateChange(LoadState& newState)
{
LOGGER.info("beforeStateChange %S", enum_name(newState));
TableObject::beforeStateChange(newState);
if (newState != LS_LOADED)

View File

@ -91,7 +91,8 @@ void ApplicationLayer::dataGroupConfirm(AckType ack, HopCountType hopType, Prior
void ApplicationLayer::dataGroupConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, const SecurityControl& secCtrl, bool status)
{
LOGGER.info("dataGroupConfirm %S", apdu.toString());
LOGGER.info("dataGroupConfirm %S", apdu.toString());
switch (apdu.type())
{
case GroupValueRead:
@ -128,7 +129,7 @@ void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority pr
void ApplicationLayer::dataBroadcastIndication(HopCountType hopType, Priority priority, uint16_t source, APDU& apdu, const SecurityControl& secCtrl)
{
LOGGER.info("dataBroadcastIndication %S", apdu.toString());
LOGGER.info("dataBroadcastIndication %S", apdu.toString());
uint8_t* data = apdu.data();
switch (apdu.type())
@ -292,7 +293,7 @@ void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority
void ApplicationLayer::dataSystemBroadcastConfirm(HopCountType hopType, Priority priority, APDU& apdu, const SecurityControl& secCtrl, bool status)
{
LOGGER.info("dataSystemBroadcastConfirm %S", apdu.toString());
LOGGER.info("dataSystemBroadcastConfirm %S", apdu.toString());
const uint8_t* data = apdu.data();
switch (apdu.type())
@ -1116,6 +1117,7 @@ void ApplicationLayer::userMemorySend(ApduType type, AckType ack, Priority prior
void ApplicationLayer::individualIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, const SecurityControl& secCtrl)
{
LOGGER.info("individualIndication %S", apdu.toString());
uint8_t* data = apdu.data();
switch (apdu.type())
@ -1377,6 +1379,7 @@ void ApplicationLayer::individualIndication(HopCountType hopType, Priority prior
void ApplicationLayer::individualConfirm(AckType ack, HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu, const SecurityControl& secCtrl, bool status)
{
LOGGER.info("individualConfirm %S", apdu.toString());
uint8_t* data = apdu.data();
switch (apdu.type())

View File

@ -4,6 +4,9 @@
#include "callback_property.h"
#include "dptconvert.h"
#include <cstring>
#include "util/logger.h"
#define LOGGER Logger::logger("ApplicationProgramObject")
ApplicationProgramObject::ApplicationProgramObject(Memory& memory)
#if MASK_VERSION == 0x091A
@ -97,3 +100,9 @@ double ApplicationProgramObject::getFloat(uint32_t addr, ParameterFloatEncodings
break;
}
}
void ApplicationProgramObject::beforeStateChange(LoadState& newState)
{
LOGGER.info("beforeStateChange %S", enum_name(newState));
TableObject::beforeStateChange(newState);
}

View File

@ -15,4 +15,7 @@ class ApplicationProgramObject : public TableObject
uint16_t getWord(uint32_t addr);
uint32_t getInt(uint32_t addr);
double getFloat(uint32_t addr, ParameterFloatEncodings encoding);
protected:
void beforeStateChange(LoadState& newState) override;
};

View File

@ -3,6 +3,9 @@
#include "association_table_object.h"
#include "bits.h"
#include "data_property.h"
#include "util/logger.h"
#define LOGGER Logger::logger("AssociationTableObject")
using namespace std;
@ -147,6 +150,7 @@ int32_t AssociationTableObject::translateAsap(uint16_t asap)
void AssociationTableObject::beforeStateChange(LoadState& newState)
{
LOGGER.info("beforeStateChange %S", enum_name(newState));
TableObject::beforeStateChange(newState);
if (newState != LS_LOADED)

View File

@ -216,7 +216,10 @@ void CemiServer::handleLData(CemiFrame& frame)
print(frame.destinationAddress(), HEX);
printHex(" frame: ", frame.data(), frame.dataLength());
#endif
#ifdef KNX_TUNNELING
_dataLinkLayer->dataRequestFromTunnel(frame);
#endif
}
void CemiServer::handleMPropRead(CemiFrame& frame)

View File

@ -31,11 +31,13 @@ class DataLinkLayer
public:
DataLinkLayer(DeviceObject& devObj, NetworkLayerEntity& netLayerEntity,
Platform& platform);
#ifdef USE_CEMI_SERVER
void cemiServer(CemiServer& cemiServer);
#endif
#ifdef KNX_TUNNELING
// from tunnel
void dataRequestFromTunnel(CemiFrame& frame);
void cemiServer(CemiServer& cemiServer);
#ifdef KNX_TUNNELING
virtual void dataRequestToTunnel(CemiFrame& frame);
virtual void dataConfirmationToTunnel(CemiFrame& frame);
virtual void dataIndicationToTunnel(CemiFrame& frame);

View File

@ -4,6 +4,9 @@
#include "group_object.h"
#include "bits.h"
#include "data_property.h"
#include "util/logger.h"
#define LOGGER Logger::logger("GroupObjectTableObject")
GroupObjectTableObject::GroupObjectTableObject(Memory& memory)
: TableObject(memory)
@ -77,6 +80,7 @@ void GroupObjectTableObject::groupObjects(GroupObject* objs, uint16_t size)
void GroupObjectTableObject::beforeStateChange(LoadState& newState)
{
LOGGER.info("beforeStateChange %S", enum_name(newState));
TableObject::beforeStateChange(newState);
if (newState != LS_LOADED)

View File

@ -62,7 +62,7 @@ bool IpDataLinkLayer::sendFrame(CemiFrame& frame)
dataConReceived(frame, success);
return success;
}
#ifdef KNX_TUNNELING
void IpDataLinkLayer::dataRequestToTunnel(CemiFrame& frame)
{
if (frame.addressType() == AddressType::GroupAddress)
@ -270,13 +270,14 @@ bool IpDataLinkLayer::isSentToTunnel(uint16_t address, bool isGrpAddr)
return false;
}
}
#endif
void IpDataLinkLayer::loop()
{
if (!_enabled)
return;
#ifdef KNX_TUNNELING
for (int i = 0; i < KNX_TUNNELING; i++)
@ -303,7 +304,7 @@ void IpDataLinkLayer::loop()
break;
}
}
#endif
uint8_t buffer[512];
uint16_t remotePort = 0;
uint32_t remoteAddr = 0;
@ -363,7 +364,7 @@ void IpDataLinkLayer::loop()
}
#ifdef KNX_TUNNELING
case ConnectRequest:
{
loopHandleConnectRequest(buffer, len, remoteAddr, remotePort);
@ -413,7 +414,7 @@ void IpDataLinkLayer::loop()
//println("got Ack");
break;
}
#endif
default:
LOGGER.warning("Unhandled service identifier: %s", word2hex(code).c_str());
break;
@ -567,7 +568,7 @@ void IpDataLinkLayer::loopHandleSearchRequestExtended(uint8_t* buffer, uint16_t
sendUnicast(searchRequest.hpai().ipAddress(), searchRequest.hpai().ipPortNumber(), searchResponse);
}
#ifdef KNX_TUNNELING
void IpDataLinkLayer::loopHandleConnectRequest(uint8_t* buffer, uint16_t length, uint32_t& src_addr, uint16_t& src_port)
{
@ -987,6 +988,7 @@ void IpDataLinkLayer::loopHandleDisconnectRequest(uint8_t* buffer, uint16_t leng
sendUnicast(discReq.hpaiCtrl().ipAddress(), discReq.hpaiCtrl().ipPortNumber(), discRes);
tun->Reset();
}
#endif
void IpDataLinkLayer::loopHandleDescriptionRequest(uint8_t* buffer, uint16_t length)
{
@ -994,7 +996,7 @@ void IpDataLinkLayer::loopHandleDescriptionRequest(uint8_t* buffer, uint16_t len
KnxIpDescriptionResponse descRes(_ipParameters, _deviceObject);
sendUnicast(descReq.hpaiCtrl().ipAddress(), descReq.hpaiCtrl().ipPortNumber(), descRes);
}
#ifdef KNX_TUNNELING
void IpDataLinkLayer::loopHandleDeviceConfigurationRequest(uint8_t* buffer, uint16_t length)
{
KnxIpConfigRequest confReq(buffer, length);
@ -1101,7 +1103,7 @@ void IpDataLinkLayer::loopHandleTunnelingRequest(uint8_t* buffer, uint16_t lengt
_cemiServer->frameReceived(tunnReq.frame());
}
#endif
void IpDataLinkLayer::enabled(bool value)
{

View File

@ -19,10 +19,12 @@ class IpDataLinkLayer : public DataLinkLayer
void enabled(bool value);
bool enabled() const;
DptMedium mediumType() const override;
#ifdef KNX_TUNNELING
void dataRequestToTunnel(CemiFrame& frame) override;
void dataConfirmationToTunnel(CemiFrame& frame) override;
void dataIndicationToTunnel(CemiFrame& frame) override;
bool isTunnelAddress(uint16_t addr) override;
#endif
bool isSentToTunnel(uint16_t address, bool isGrpAddr);
private:
@ -31,13 +33,15 @@ class IpDataLinkLayer : public DataLinkLayer
uint8_t _frameCountBase = 0;
uint32_t _frameCountTimeBase = 0;
bool sendFrame(CemiFrame& frame);
#ifdef KNX_TUNNELING
void sendFrameToTunnel(KnxIpTunnelConnection* tunnel, CemiFrame& frame);
void loopHandleConnectRequest(uint8_t* buffer, uint16_t length, uint32_t& src_addr, uint16_t& src_port);
void loopHandleConnectionStateRequest(uint8_t* buffer, uint16_t length);
void loopHandleDisconnectRequest(uint8_t* buffer, uint16_t length);
void loopHandleDescriptionRequest(uint8_t* buffer, uint16_t length);
void loopHandleDeviceConfigurationRequest(uint8_t* buffer, uint16_t length);
void loopHandleTunnelingRequest(uint8_t* buffer, uint16_t length);
void loopHandleDeviceConfigurationRequest(uint8_t* buffer, uint16_t length);
#endif
void loopHandleDescriptionRequest(uint8_t* buffer, uint16_t length);
void loopHandleSearchRequestExtended(uint8_t* buffer, uint16_t length);
bool sendMulicast(KnxIpFrame& ipFrame);
bool sendUnicast(uint32_t addr, uint16_t port, KnxIpFrame& ipFrame);

View File

@ -2,6 +2,7 @@
#include "bits.h"
#include <cstring>
using namespace std;
PropertyID Property::Id() const
{
@ -243,3 +244,622 @@ void Property::state(uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t
(void)resultData;
resultLength = 0;
}
const string enum_name(const PropertyDataType enum_val)
{
switch (enum_val)
{
case PDT_CONTROL:
return "PDT_CONTROL";
case PDT_CHAR:
return "PDT_CHAR";
case PDT_UNSIGNED_CHAR:
return "PDT_UNSIGNED_CHAR";
case PDT_INT:
return "PDT_INT";
case PDT_UNSIGNED_INT:
return "PDT_UNSIGNED_INT";
case PDT_KNX_FLOAT:
return "PDT_KNX_FLOAT";
case PDT_DATE:
return "PDT_DATE";
case PDT_TIME:
return "PDT_TIME";
case PDT_LONG:
return "PDT_LONG";
case PDT_UNSIGNED_LONG:
return "PDT_UNSIGNED_LONG";
case PDT_FLOAT:
return "PDT_FLOAT";
case PDT_DOUBLE:
return "PDT_DOUBLE";
case PDT_CHAR_BLOCK:
return "PDT_CHAR_BLOCK";
case PDT_POLL_GROUP_SETTING:
return "PDT_POLL_GROUP_SETTING";
case PDT_SHORT_CHAR_BLOCK:
return "PDT_SHORT_CHAR_BLOCK";
case PDT_DATE_TIME:
return "PDT_DATE_TIME";
case PDT_VARIABLE_LENGTH:
return "PDT_VARIABLE_LENGTH";
case PDT_GENERIC_01:
return "PDT_GENERIC_01";
case PDT_GENERIC_02:
return "PDT_GENERIC_02";
case PDT_GENERIC_03:
return "PDT_GENERIC_03";
case PDT_GENERIC_04:
return "PDT_GENERIC_04";
case PDT_GENERIC_05:
return "PDT_GENERIC_05";
case PDT_GENERIC_06:
return "PDT_GENERIC_06";
case PDT_GENERIC_07:
return "PDT_GENERIC_07";
case PDT_GENERIC_08:
return "PDT_GENERIC_08";
case PDT_GENERIC_09:
return "PDT_GENERIC_09";
case PDT_GENERIC_10:
return "PDT_GENERIC_10";
case PDT_GENERIC_11:
return "PDT_GENERIC_11";
case PDT_GENERIC_12:
return "PDT_GENERIC_12";
case PDT_GENERIC_13:
return "PDT_GENERIC_13";
case PDT_GENERIC_14:
return "PDT_GENERIC_14";
case PDT_GENERIC_15:
return "PDT_GENERIC_15";
case PDT_GENERIC_16:
return "PDT_GENERIC_16";
case PDT_GENERIC_17:
return "PDT_GENERIC_17";
case PDT_GENERIC_18:
return "PDT_GENERIC_18";
case PDT_GENERIC_19:
return "PDT_GENERIC_19";
case PDT_GENERIC_20:
return "PDT_GENERIC_20";
case PDT_UTF8:
return "PDT_UTF8";
case PDT_VERSION:
return "PDT_VERSION";
case PDT_ALARM_INFO:
return "PDT_ALARM_INFO";
case PDT_BINARY_INFORMATION:
return "PDT_BINARY_INFORMATION";
case PDT_BITSET8:
return "PDT_BITSET8";
case PDT_BITSET16:
return "PDT_BITSET16";
case PDT_ENUM8:
return "PDT_ENUM8";
case PDT_SCALING:
return "PDT_SCALING";
case PDT_NE_VL:
return "PDT_NE_VL";
case PDT_NE_FL:
return "PDT_NE_FL";
case PDT_FUNCTION:
return "PDT_FUNCTION";
case PDT_ESCAPE:
return "PDT_ESCAPE";
}
return to_string(enum_val);
}
const string enum_name(const PropertyID enum_val)
{
switch (enum_val)
{
case PID_OBJECT_TYPE:
return "PID_OBJECT_TYPE";
case PID_LOAD_STATE_CONTROL:
return "PID_LOAD_STATE_CONTROL";
case PID_RUN_STATE_CONTROL:
return "PID_RUN_STATE_CONTROL";
case PID_TABLE_REFERENCE:
return "PID_TABLE_REFERENCE";
case PID_SERVICE_CONTROL:
return "PID_SERVICE_CONTROL";
case PID_FIRMWARE_REVISION:
return "PID_FIRMWARE_REVISION";
case PID_SERIAL_NUMBER:
return "PID_SERIAL_NUMBER";
case PID_MANUFACTURER_ID:
return "PID_MANUFACTURER_ID";
case PID_PROG_VERSION:
return "PID_PROG_VERSION";
case PID_DEVICE_CONTROL:
return "PID_DEVICE_CONTROL";
case PID_ORDER_INFO:
return "PID_ORDER_INFO";
case PID_PEI_TYPE:
return "PID_PEI_TYPE";
case PID_PORT_CONFIGURATION:
return "PID_PORT_CONFIGURATION";
case PID_TABLE:
return "PID_TABLE";
case PID_VERSION:
return "PID_VERSION";
case PID_MCB_TABLE:
return "PID_MCB_TABLE";
case PID_ERROR_CODE:
return "PID_ERROR_CODE";
case PID_OBJECT_INDEX:
return "PID_OBJECT_INDEX";
case PID_DOWNLOAD_COUNTER:
return "PID_DOWNLOAD_COUNTER";
case PID_ROUTING_COUNT:
return "PID_ROUTING_COUNT/RF_MULTI_TYPE/PROJECT_INSTALLATION_ID";
case PID_PROG_MODE:
return "PID_PROG_MODE/CURRENT_IP_ASSIGNMENT_METHOD";
case PID_MAX_APDU_LENGTH:
return "PID_MAX_APDU_LENGTH/RF_DOMAIN_ADDRESS/IP_CAPABILITIES";
case PID_SUBNET_ADDR:
return "PID_SUBNET_ADDR/RF_RETRANSMITTER";
case PID_DEVICE_ADDR:
return "PID_DEVICE_ADDR/RF_FILTERING_MODE_SUPPORT";
case PID_IO_LIST:
return "PID_IO_LIST/PRIORITY_FIFO_ENABLED";
case PID_HARDWARE_TYPE:
return "PID_HARDWARE_TYPE";
case PID_RF_DOMAIN_ADDRESS_CEMI_SERVER:
return "PID_RF_DOMAIN_ADDRESS_CEMI_SERVER";
case PID_DEVICE_DESCRIPTOR:
return "PID_DEVICE_DESCRIPTOR";
case PID_RF_FILTERING_MODE_SELECT:
return "PID_RF_FILTERING_MODE_SELECT";
case PID_RF_BIDIR_TIMEOUT:
return "PID_RF_BIDIR_TIMEOUT";
case PID_RF_DIAG_SA_FILTER_TABLE:
return "PID_RF_DIAG_SA_FILTER_TABLE";
case PID_RF_DIAG_BUDGET_TABLE:
return "PID_RF_DIAG_BUDGET_TABLE";
case PID_RF_DIAG_PROBE:
return "PID_RF_DIAG_PROBE";
case PID_KNX_INDIVIDUAL_ADDRESS:
return "PID_KNX_INDIVIDUAL_ADDRESS";
case PID_ADDITIONAL_INDIVIDUAL_ADDRESSES:
return "PID_ADDITIONAL_INDIVIDUAL_ADDRESSES";
case PID_IP_ASSIGNMENT_METHOD:
return "PID_IP_ASSIGNMENT_METHOD";
/*
case PID_CURRENT_IP_ADDRESS:
return "PID_CURRENT_IP_ADDRESS";
case PID_CURRENT_SUBNET_MASK:
return "PID_CURRENT_SUBNET_MASK";
case PID_CURRENT_DEFAULT_GATEWAY:
return "PID_CURRENT_DEFAULT_GATEWAY";
case PID_IP_ADDRESS:
return "PID_IP_ADDRESS";
case PID_SUBNET_MASK:
return "PID_SUBNET_MASK";
case PID_DEFAULT_GATEWAY:
return "PID_DEFAULT_GATEWAY";
case PID_DHCP_BOOTP_SERVER:
return "PID_DHCP_BOOTP_SERVER";
*/
case PID_MAC_ADDRESS:
return "PID_MAC_ADDRESS";
case PID_SYSTEM_SETUP_MULTICAST_ADDRESS:
return "PID_SYSTEM_SETUP_MULTICAST_ADDRESS";
case PID_ROUTING_MULTICAST_ADDRESS:
return "PID_ROUTING_MULTICAST_ADDRESS";
case PID_TTL:
return "PID_TTL";
case PID_KNXNETIP_DEVICE_CAPABILITIES:
return "PID_KNXNETIP_DEVICE_CAPABILITIES";
case PID_KNXNETIP_DEVICE_STATE:
return "PID_KNXNETIP_DEVICE_STATE";
case PID_KNXNETIP_ROUTING_CAPABILITIES:
return "PID_KNXNETIP_ROUTING_CAPABILITIES";
/*
case PID_PRIORITY_FIFO_ENABLED:
return "PID_PRIORITY_FIFO_ENABLED";
*/
case PID_QUEUE_OVERFLOW_TO_IP:
return "PID_QUEUE_OVERFLOW_TO_IP";
case PID_QUEUE_OVERFLOW_TO_KNX:
return "PID_QUEUE_OVERFLOW_TO_KNX";
case PID_MSG_TRANSMIT_TO_IP:
return "PID_MSG_TRANSMIT_TO_IP";
case PID_MSG_TRANSMIT_TO_KNX:
return "PID_MSG_TRANSMIT_TO_KNX";
case PID_FRIENDLY_NAME:
return "PID_FRIENDLY_NAME";
/*
case PID_ROUTING_BUSY_WAIT_TIME:
return "PID_ROUTING_BUSY_WAIT_TIME";
*/
case PID_CUSTOM_RESERVED_TUNNELS_CTRL:
return "PID_CUSTOM_RESERVED_TUNNELS_CTRL";
case PID_CUSTOM_RESERVED_TUNNELS_IP:
return "PID_CUSTOM_RESERVED_TUNNELS_IP";
/*
case PID_MEDIUM_TYPE:
return "PID_MEDIUM_TYPE";
case PID_COMM_MODE:
return "PID_COMM_MODE";
case PID_MEDIUM_AVAILABILITY:
return "PID_MEDIUM_AVAILABILITY";
case PID_ADD_INFO_TYPES:
return "PID_ADD_INFO_TYPES";
case PID_TIME_BASE:
return "PID_TIME_BASE";
case PID_TRANSP_ENABLE:
return "PID_TRANSP_ENABLE";
case PID_CLIENT_SNA:
return "PID_CLIENT_SNA";
case PID_CLIENT_DEVICE_ADDRESS:
return "PID_CLIENT_DEVICE_ADDRESS";
case PID_BIBAT_NEXTBLOCK:
return "PID_BIBAT_NEXTBLOCK";
case PID_RF_MODE_SELECT:
return "PID_RF_MODE_SELECT";
case PID_RF_MODE_SUPPORT:
return "PID_RF_MODE_SUPPORT";
case PID_RF_FILTERING_MODE_SELECT_CEMI_SERVER:
return "PID_RF_FILTERING_MODE_SELECT_CEMI_SERVER";
case PID_RF_FILTERING_MODE_SUPPORT_CEMI_SERVER:
return "PID_RF_FILTERING_MODE_SUPPORT_CEMI_SERVER";
case PID_COMM_MODES_SUPPORTED:
return "PID_COMM_MODES_SUPPORTED";
case PID_FILTERING_MODE_SUPPORT:
return "PID_FILTERING_MODE_SUPPORT";
case PID_FILTERING_MODE_SELECT:
return "PID_FILTERING_MODE_SELECT";
case PID_MAX_INTERFACE_APDU_LENGTH:
return "PID_MAX_INTERFACE_APDU_LENGTH";
case PID_MAX_LOCAL_APDU_LENGTH:
return "PID_MAX_LOCAL_APDU_LENGTH";
case PID_SECURITY_MODE:
return "PID_SECURITY_MODE";
case PID_P2P_KEY_TABLE:
return "PID_P2P_KEY_TABLE";
case PID_GRP_KEY_TABLE:
return "PID_GRP_KEY_TABLE";
case PID_SECURITY_INDIVIDUAL_ADDRESS_TABLE:
return "PID_SECURITY_INDIVIDUAL_ADDRESS_TABLE";
case PID_SECURITY_FAILURES_LOG:
return "PID_SECURITY_FAILURES_LOG";
case PID_TOOL_KEY:
return "PID_TOOL_KEY";
case PID_SECURITY_REPORT:
return "PID_SECURITY_REPORT";
case PID_SECURITY_REPORT_CONTROL:
return "PID_SECURITY_REPORT_CONTROL";
case PID_SEQUENCE_NUMBER_SENDING:
return "PID_SEQUENCE_NUMBER_SENDING";
case PID_ZONE_KEY_TABLE:
return "PID_ZONE_KEY_TABLE";
case PID_GO_SECURITY_FLAGS:
return "PID_GO_SECURITY_FLAGS";
case PID_ROLE_TABLE:
return "PID_ROLE_TABLE";
*/
case PID_TOOL_SEQUENCE_NUMBER_SENDING:
return "PID_TOOL_SEQUENCE_NUMBER_SENDING";
/*
case PID_MEDIUM_STATUS:
return "PID_MEDIUM_STATUS";
case PID_MAIN_LCCONFIG:
return "PID_MAIN_LCCONFIG";
case PID_SUB_LCCONFIG:
return "PID_SUB_LCCONFIG";
case PID_MAIN_LCGRPCONFIG:
return "PID_MAIN_LCGRPCONFIG";
case PID_SUB_LCGRPCONFIG:
return "PID_SUB_LCGRPCONFIG";
case PID_ROUTETABLE_CONTROL:
return "PID_ROUTETABLE_CONTROL";
case PID_COUPLER_SERVICES_CONTROL:
return "PID_COUPLER_SERVICES_CONTROL";
case PID_MAX_APDU_LENGTH_ROUTER:
return "PID_MAX_APDU_LENGTH_ROUTER";
case PID_L2_COUPLER_TYPE:
return "PID_L2_COUPLER_TYPE";
case PID_HOP_COUNT:
return "PID_HOP_COUNT";
case PID_MEDIUM:
return "PID_MEDIUM";
case PID_FILTER_TABLE_USE:
return "PID_FILTER_TABLE_USE";
*/
case PID_RF_ENABLE_SBC:
return "PID_RF_ENABLE_SBC";
case PID_IP_ENABLE_SBC:
return "PID_IP_ENABLE_SBC";
}
return to_string(enum_val);
}
const string enum_name(const LoadState enum_val)
{
switch (enum_val)
{
case LS_UNLOADED:
return "LS_UNLOADED";
case LS_LOADED:
return "LS_LOADED";
case LS_LOADING:
return "LS_LOADING";
case LS_ERROR:
return "LS_ERROR";
case LS_UNLOADING:
return "LS_UNLOADING";
case LS_LOADCOMPLETING:
return "LS_LOADCOMPLETING";
}
return to_string(enum_val);
}
const string enum_name(const LoadEvents enum_val)
{
switch (enum_val)
{
case LE_NOOP:
return "LE_NOOP";
case LE_START_LOADING:
return "LE_START_LOADING";
case LE_LOAD_COMPLETED:
return "LE_LOAD_COMPLETED";
case LE_ADDITIONAL_LOAD_CONTROLS:
return "LE_ADDITIONAL_LOAD_CONTROLS";
case LE_UNLOAD:
return "LE_UNLOAD";
}
return to_string(enum_val);
}
const string enum_name(const ErrorCode enum_val)
{
switch (enum_val)
{
case E_NO_FAULT:
return "E_NO_FAULT";
case E_GENERAL_DEVICE_FAULT:
return "E_GENERAL_DEVICE_FAULT";
case E_COMMUNICATION_FAULT:
return "E_COMMUNICATION_FAULT";
case E_CONFIGURATION_FAULT:
return "E_CONFIGURATION_FAULT";
case E_HARDWARE_FAULT:
return "E_HARDWARE_FAULT";
case E_SOFTWARE_FAULT:
return "E_SOFTWARE_FAULT";
case E_INSUFFICIENT_NON_VOLATILE_MEMORY:
return "E_INSUFFICIENT_NON_VOLATILE_MEMORY";
case E_INSUFFICIENT_VOLATILE_MEMORY:
return "E_INSUFFICIENT_VOLATILE_MEMORY";
case E_GOT_MEM_ALLOC_ZERO:
return "E_GOT_MEM_ALLOC_ZERO";
case E_CRC_ERROR:
return "E_CRC_ERROR";
case E_WATCHDOG_RESET:
return "E_WATCHDOG_RESET";
case E_INVALID_OPCODE:
return "E_INVALID_OPCODE";
case E_GENERAL_PROTECTION_FAULT:
return "E_GENERAL_PROTECTION_FAULT";
case E_MAX_TABLE_LENGTH_EXEEDED:
return "E_MAX_TABLE_LENGTH_EXEEDED";
case E_GOT_UNDEF_LOAD_CMD:
return "E_GOT_UNDEF_LOAD_CMD";
case E_GAT_NOT_SORTED:
return "E_GAT_NOT_SORTED";
case E_INVALID_CONNECTION_NUMBER:
return "E_INVALID_CONNECTION_NUMBER";
case E_INVALID_GO_NUMBER:
return "E_INVALID_GO_NUMBER";
case E_GO_TYPE_TOO_BIG:
return "E_GO_TYPE_TOO_BIG";
}
return to_string(enum_val);
}
const string enum_name(const AccessLevel enum_val)
{
switch (enum_val)
{
case ReadLv0:
return "ReadLv0/WriteLv0";
case ReadLv1:
return "ReadLv1";
case ReadLv2:
return "ReadLv2";
case ReadLv3:
return "ReadLv3";
case WriteLv1:
return "WriteLv1";
case WriteLv2:
return "WriteLv2";
case WriteLv3:
return "WriteLv3";
}
return to_string(enum_val);
}

View File

@ -11,6 +11,7 @@
#include <stdint.h>
#include "save_restore.h"
#include <string>
/** The data type of a property. */
enum PropertyDataType
@ -65,6 +66,7 @@ enum PropertyDataType
PDT_FUNCTION = 0x3e, //!< length: 3
PDT_ESCAPE = 0x3f, //!< length: 3
};
const std::string enum_name(const PropertyDataType enum_val);
enum PropertyID
{
@ -193,6 +195,7 @@ enum PropertyID
PID_RF_ENABLE_SBC = 112, // Exists only if medium for this router object is RF (PDT_FUNCTION)
PID_IP_ENABLE_SBC = 120, // Exists only if medium for this router object is IP (PDT_FUNCTION)
};
const std::string enum_name(const PropertyID enum_val);
enum LoadState
{
@ -203,6 +206,7 @@ enum LoadState
LS_UNLOADING = 4,
LS_LOADCOMPLETING = 5
};
const std::string enum_name(const LoadState enum_val);
enum LoadEvents
{
@ -212,6 +216,7 @@ enum LoadEvents
LE_ADDITIONAL_LOAD_CONTROLS = 3,
LE_UNLOAD = 4
};
const std::string enum_name(const LoadEvents enum_val);
// 20.011 DPT_ErrorClass_System
enum ErrorCode
@ -236,6 +241,7 @@ enum ErrorCode
E_INVALID_GO_NUMBER = 17,
E_GO_TYPE_TOO_BIG = 18
};
const std::string enum_name(const ErrorCode enum_val);
/** The access level necessary to read a property of an interface object. */
enum AccessLevel
@ -249,6 +255,7 @@ enum AccessLevel
WriteLv2 = 0x02,
WriteLv3 = 0x03,
};
const std::string enum_name(const AccessLevel enum_val);
struct PropertyDescription
{