diff --git a/examples/knx-linux/CMakeLists.txt b/examples/knx-linux/CMakeLists.txt
index fb1d483..24cff37 100644
--- a/examples/knx-linux/CMakeLists.txt
+++ b/examples/knx-linux/CMakeLists.txt
@@ -2,88 +2,88 @@ cmake_minimum_required(VERSION 2.7)
project(knx-linux)
set(LIBRARIES_FROM_REFERENCES "")
add_executable(knx-linux
- ../src/knx/address_table_object.cpp
- ../src/knx/address_table_object.h
- ../src/knx/apdu.cpp
- ../src/knx/apdu.h
- ../src/knx/application_layer.cpp
- ../src/knx/application_layer.h
- ../src/knx/application_program_object.cpp
- ../src/knx/application_program_object.h
- ../src/knx/association_table_object.cpp
- ../src/knx/association_table_object.h
- ../src/knx/bau.cpp
- ../src/knx/bau.h
- ../src/knx/bau07B0.cpp
- ../src/knx/bau07B0.h
- ../src/knx/bau27B0.cpp
- ../src/knx/bau27B0.h
- ../src/knx/bau57B0.cpp
- ../src/knx/bau57B0.h
- ../src/knx/bau_systemB.cpp
- ../src/knx/bau_systemB.h
- ../src/knx/bits.cpp
- ../src/knx/bits.h
- ../src/knx/callback_property.h
- ../src/knx/cemi_frame.cpp
- ../src/knx/cemi_frame.h
- ../src/knx/cemi_server.cpp
- ../src/knx/cemi_server_object.cpp
- ../src/knx/data_link_layer.cpp
- ../src/knx/data_link_layer.h
- ../src/knx/data_property.cpp
- ../src/knx/data_property.h
- ../src/knx/device_object.cpp
- ../src/knx/device_object.h
- ../src/knx/dpt.cpp
- ../src/knx/dpt.h
- ../src/knx/dptconvert.cpp
- ../src/knx/dptconvert.h
- ../src/knx/group_object.cpp
- ../src/knx/group_object.h
- ../src/knx/group_object_table_object.cpp
- ../src/knx/group_object_table_object.h
- ../src/knx/interface_object.cpp
- ../src/knx/interface_object.h
- ../src/knx/ip_data_link_layer.cpp
- ../src/knx/ip_data_link_layer.h
- ../src/knx/ip_parameter_object.cpp
- ../src/knx/ip_parameter_object.h
- ../src/knx/knx_ip_frame.cpp
- ../src/knx/knx_value.cpp
- ../src/knx/knx_value.h
- ../src/knx/memory.cpp
- ../src/knx/memory.h
- ../src/knx/network_layer.cpp
- ../src/knx/network_layer.h
- ../src/knx/npdu.cpp
- ../src/knx/npdu.h
- ../src/knx/platform.cpp
- ../src/knx/platform.h
- ../src/knx/property.cpp
- ../src/knx/property.h
- ../src/knx/rf_data_link_layer.cpp
- ../src/knx/rf_data_link_layer.h
- ../src/knx/rf_medium_object.cpp
- ../src/knx/rf_medium_object.h
- ../src/knx/rf_physical_layer.cpp
- ../src/knx/rf_physical_layer.h
- ../src/knx/table_object.cpp
- ../src/knx/table_object.h
- ../src/knx/tpdu.cpp
- ../src/knx/tpdu.h
- ../src/knx/tpuart_data_link_layer.cpp
- ../src/knx/tpuart_data_link_layer.h
- ../src/knx/transport_layer.cpp
- ../src/knx/transport_layer.h
- ../src/knx/usb_tunnel_interface.cpp
- ../src/knx_facade.cpp
- ../src/knx_facade.h
- ../src/linux_platform.cpp
- ../src/linux_platform.h
+ ../../src/knx/address_table_object.cpp
+ ../../src/knx/address_table_object.h
+ ../../src/knx/apdu.cpp
+ ../../src/knx/apdu.h
+ ../../src/knx/application_layer.cpp
+ ../../src/knx/application_layer.h
+ ../../src/knx/application_program_object.cpp
+ ../../src/knx/application_program_object.h
+ ../../src/knx/association_table_object.cpp
+ ../../src/knx/association_table_object.h
+ ../../src/knx/bau.cpp
+ ../../src/knx/bau.h
+ ../../src/knx/bau07B0.cpp
+ ../../src/knx/bau07B0.h
+ ../../src/knx/bau27B0.cpp
+ ../../src/knx/bau27B0.h
+ ../../src/knx/bau57B0.cpp
+ ../../src/knx/bau57B0.h
+ ../../src/knx/bau_systemB.cpp
+ ../../src/knx/bau_systemB.h
+ ../../src/knx/bits.cpp
+ ../../src/knx/bits.h
+ ../../src/knx/callback_property.h
+ ../../src/knx/cemi_frame.cpp
+ ../../src/knx/cemi_frame.h
+ ../../src/knx/cemi_server.cpp
+ ../../src/knx/cemi_server_object.cpp
+ ../../src/knx/data_link_layer.cpp
+ ../../src/knx/data_link_layer.h
+ ../../src/knx/data_property.cpp
+ ../../src/knx/data_property.h
+ ../../src/knx/device_object.cpp
+ ../../src/knx/device_object.h
+ ../../src/knx/dpt.cpp
+ ../../src/knx/dpt.h
+ ../../src/knx/dptconvert.cpp
+ ../../src/knx/dptconvert.h
+ ../../src/knx/group_object.cpp
+ ../../src/knx/group_object.h
+ ../../src/knx/group_object_table_object.cpp
+ ../../src/knx/group_object_table_object.h
+ ../../src/knx/interface_object.cpp
+ ../../src/knx/interface_object.h
+ ../../src/knx/ip_data_link_layer.cpp
+ ../../src/knx/ip_data_link_layer.h
+ ../../src/knx/ip_parameter_object.cpp
+ ../../src/knx/ip_parameter_object.h
+ ../../src/knx/knx_ip_frame.cpp
+ ../../src/knx/knx_value.cpp
+ ../../src/knx/knx_value.h
+ ../../src/knx/memory.cpp
+ ../../src/knx/memory.h
+ ../../src/knx/network_layer.cpp
+ ../../src/knx/network_layer.h
+ ../../src/knx/npdu.cpp
+ ../../src/knx/npdu.h
+ ../../src/knx/platform.cpp
+ ../../src/knx/platform.h
+ ../../src/knx/property.cpp
+ ../../src/knx/property.h
+ ../../src/knx/rf_data_link_layer.cpp
+ ../../src/knx/rf_data_link_layer.h
+ ../../src/knx/rf_medium_object.cpp
+ ../../src/knx/rf_medium_object.h
+ ../../src/knx/rf_physical_layer.cpp
+ ../../src/knx/rf_physical_layer.h
+ ../../src/knx/table_object.cpp
+ ../../src/knx/table_object.h
+ ../../src/knx/tpdu.cpp
+ ../../src/knx/tpdu.h
+ ../../src/knx/tpuart_data_link_layer.cpp
+ ../../src/knx/tpuart_data_link_layer.h
+ ../../src/knx/transport_layer.cpp
+ ../../src/knx/transport_layer.h
+ ../../src/knx/usb_tunnel_interface.cpp
+ ../../src/knx_facade.cpp
+ ../../src/knx_facade.h
+ ../../src/linux_platform.cpp
+ ../../src/linux_platform.h
main.cpp)
target_link_libraries(knx-linux "${LIBRARIES_FROM_REFERENCES}")
-include_directories(../src)
+include_directories(../../src)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -Wno-switch -g -O0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -Wno-switch -g -O0")
set_property(TARGET knx-linux PROPERTY CXX_STANDARD 11)
diff --git a/examples/knx-linux/knx-linux-Debug.vgdbsettings b/examples/knx-linux/knx-linux-Debug.vgdbsettings
index 8e4ab7c..2b12566 100644
--- a/examples/knx-linux/knx-linux-Debug.vgdbsettings
+++ b/examples/knx-linux/knx-linux-Debug.vgdbsettings
@@ -18,7 +18,7 @@
SSH
tkunze
- $(ProjectDir)\..
+ $(ProjectDir)\..\..
/home/tkunze/vgdb/knx-linux
*.cpp
@@ -36,7 +36,6 @@
false
true
-
true
true
@@ -59,7 +58,7 @@
0
- knx-linux
+ examples/knx-linux
DEBUG
Debug
knx-linux
diff --git a/examples/knx-linux/knx-linux.vcxproj.filters b/examples/knx-linux/knx-linux.vcxproj.filters
index f8de660..e4f7cab 100644
--- a/examples/knx-linux/knx-linux.vcxproj.filters
+++ b/examples/knx-linux/knx-linux.vcxproj.filters
@@ -32,276 +32,276 @@
-
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
+ Header files\knx
+
+
Header files
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
+
Header files
-
+
Header files
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Header files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files\knx
-
-
- Source files
-
Source files
-
+
Source files
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
Source files\knx
-
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
+ Source files\knx
+
+
Source files\knx
diff --git a/src/knx/bau57B0.cpp b/src/knx/bau57B0.cpp
index b86b238..1165e53 100644
--- a/src/knx/bau57B0.cpp
+++ b/src/knx/bau57B0.cpp
@@ -12,8 +12,17 @@ Bau57B0::Bau57B0(Platform& platform)
: BauSystemB(platform),
_ipParameters(_deviceObj, platform),
_dlLayer(_deviceObj, _addrTable, _ipParameters, _netLayer, _platform)
+#ifdef USE_CEMI_SERVER
+ ,
+ _cemiServer(*this)
+#endif
{
_netLayer.dataLinkLayer(_dlLayer);
+#ifdef USE_CEMI_SERVER
+ _cemiServer.dataLinkLayer(_dlLayer);
+ _dlLayer.cemiServer(_cemiServer);
+ _memory.addSaveRestore(&_cemiServerObject);
+#endif
_memory.addSaveRestore(&_ipParameters);
// Set Mask Version in Device Object depending on the BAU
diff --git a/src/knx/bau57B0.h b/src/knx/bau57B0.h
index 7374788..635ccbc 100644
--- a/src/knx/bau57B0.h
+++ b/src/knx/bau57B0.h
@@ -5,6 +5,7 @@
#include "bau_systemB.h"
#include "ip_parameter_object.h"
#include "ip_data_link_layer.h"
+#include "cemi_server_object.h"
class Bau57B0 : public BauSystemB
{
@@ -20,6 +21,10 @@ class Bau57B0 : public BauSystemB
private:
IpParameterObject _ipParameters;
IpDataLinkLayer _dlLayer;
+#ifdef USE_CEMI_SERVER
+ CemiServer _cemiServer;
+ CemiServerObject _cemiServerObject;
+#endif
uint8_t _descriptor[2] = {0x57, 0xb0};
const uint32_t _ifObjs[7] = { 6, // length
OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_IP_PARAMETER};
diff --git a/src/knx/callback_property.h b/src/knx/callback_property.h
index 8e83183..faee212 100644
--- a/src/knx/callback_property.h
+++ b/src/knx/callback_property.h
@@ -27,7 +27,7 @@ template class CallbackProperty : public Property
}
virtual uint8_t write(uint16_t start, uint8_t count, uint8_t* data) override
{
- if (count == 0 || start > _maxElements || !_writeEnable || start + count > _maxElements + 1 || _writeCallback == nullptr)
+ if (count == 0 || start > _maxElements || start + count > _maxElements + 1 || _writeCallback == nullptr)
return 0;
return _writeCallback(_interfaceObject, start, count, data);
}
diff --git a/src/knx/cemi_server.h b/src/knx/cemi_server.h
index c2d4cd2..b44e1cf 100644
--- a/src/knx/cemi_server.h
+++ b/src/knx/cemi_server.h
@@ -44,10 +44,10 @@ class CemiServer
void loop();
private:
- uint16_t _clientAddress;
+ uint16_t _clientAddress = 0;
uint8_t _frameNumber = 0;
- DataLinkLayer* _dataLinkLayer;
+ DataLinkLayer* _dataLinkLayer = nullptr;
BauSystemB& _bau;
UsbTunnelInterface _usbTunnelInterface;
};
diff --git a/src/knx/data_link_layer.h b/src/knx/data_link_layer.h
index 770e943..28ba679 100644
--- a/src/knx/data_link_layer.h
+++ b/src/knx/data_link_layer.h
@@ -1,5 +1,7 @@
#pragma once
+#include "config.h"
+
#include
#include "device_object.h"
#include "address_table_object.h"
diff --git a/src/knx/data_property.cpp b/src/knx/data_property.cpp
index ec60447..88e6dbc 100644
--- a/src/knx/data_property.cpp
+++ b/src/knx/data_property.cpp
@@ -25,7 +25,7 @@ uint8_t DataProperty::read(uint16_t start, uint8_t count, uint8_t* data) const
uint8_t DataProperty::write(uint16_t start, uint8_t count, uint8_t* data)
{
- if (count == 0 || start > _maxElements || !_writeEnable || start + count > _maxElements + 1)
+ if (count == 0 || start > _maxElements || start + count > _maxElements + 1)
return 0;
if (start == 0)
@@ -152,7 +152,7 @@ uint8_t* DataProperty::save(uint8_t* buffer)
{
buffer = pushWord(_currentElements, buffer);
if (_currentElements > 0)
- buffer = pushByteArray(_data, _currentElements, buffer);
+ buffer = pushByteArray(_data, _currentElements * ElementSize(), buffer);
return buffer;
}
diff --git a/src/knx/device_object.h b/src/knx/device_object.h
index 74b09ee..b3aecc1 100644
--- a/src/knx/device_object.h
+++ b/src/knx/device_object.h
@@ -59,7 +59,7 @@ private:
uint8_t _knxSerialNumber[6] = { 0x00, 0xFA, 0x00, 0x00, 0x00, 0x00 }; //Default to KNXA (0xFA)
char _orderNumber[10] = "";
uint8_t _hardwareType[6] = { 0, 0, 0, 0, 0, 0};
- uint16_t _version = 0;
+ uint16_t _version = 1;
uint16_t _maskVersion = 0x0000;
uint16_t _maxApduLength = 254;
const uint32_t* _ifObjs;
diff --git a/src/knx/dptconvert.cpp b/src/knx/dptconvert.cpp
index bf8cfcc..5da8fde 100644
--- a/src/knx/dptconvert.cpp
+++ b/src/knx/dptconvert.cpp
@@ -8,9 +8,7 @@
if (payload_length != (x)) \
return false
#define ENSURE_PAYLOAD(x)
-//\
-// for (int pi = 0; pi < (x); ++pi) \
-// payload[pi] = 0
+
int KNX_Decode_Value(uint8_t* payload, size_t payload_length, const Dpt& datatype, KNXValue& value)
{
diff --git a/src/knx/platform.cpp b/src/knx/platform.cpp
index c975b6b..14e6187 100644
--- a/src/knx/platform.cpp
+++ b/src/knx/platform.cpp
@@ -56,7 +56,7 @@ void Platform::setupUart()
uint32_t Platform::currentIpAddress()
{
- return 0;
+ return 0x01020304;
}
uint32_t Platform::currentSubnetMask()