diff --git a/knx-linux/CMakeLists.txt b/knx-linux/CMakeLists.txt
index deccfbb..5a9ba65 100644
--- a/knx-linux/CMakeLists.txt
+++ b/knx-linux/CMakeLists.txt
@@ -31,7 +31,9 @@ add_executable(knx-linux
main.cpp
../src/linux_platform.cpp
../src/knx_facade.cpp
- ../src/knx/dptconvert.cpp)
+ ../src/knx/dptconvert.cpp
+ ../src/knx/knx_value.cpp
+ ../src/knx/dpt.cpp)
target_link_libraries(knx-linux "${LIBRARIES_FROM_REFERENCES}")
include_directories(../src)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -Wno-switch -g -O0")
diff --git a/knx-linux/knx-linux.vcxproj b/knx-linux/knx-linux.vcxproj
index 839a421..87f4d0f 100644
--- a/knx-linux/knx-linux.vcxproj
+++ b/knx-linux/knx-linux.vcxproj
@@ -84,6 +84,7 @@
+
@@ -91,6 +92,7 @@
+
@@ -127,12 +129,14 @@
+
+
diff --git a/knx-linux/knx-linux.vcxproj.filters b/knx-linux/knx-linux.vcxproj.filters
index 7d9b90b..207d5cb 100644
--- a/knx-linux/knx-linux.vcxproj.filters
+++ b/knx-linux/knx-linux.vcxproj.filters
@@ -135,6 +135,12 @@
Header files\knx
+
+ Header files\knx
+
+
+ Header files\knx
+
@@ -227,5 +233,11 @@
Source files\knx
+
+ Source files\knx
+
+
+ Source files\knx
+
\ No newline at end of file
diff --git a/src/knx/dpt.cpp b/src/knx/dpt.cpp
new file mode 100644
index 0000000..6128f5c
--- /dev/null
+++ b/src/knx/dpt.cpp
@@ -0,0 +1,18 @@
+#include "dpt.h"
+
+Dpt::Dpt()
+{}
+
+Dpt::Dpt(short mainGroup, short subGroup, short index /* = 0 */)
+ : mainGroup(mainGroup), subGroup(subGroup), index(index)
+{}
+
+bool Dpt::operator==(const Dpt& other) const
+{
+ return other.mainGroup == mainGroup && other.subGroup == subGroup && other.index == index;
+}
+
+bool Dpt::operator!=(const Dpt& other) const
+{
+ return !(other == *this);
+}
diff --git a/src/knx/dpt.h b/src/knx/dpt.h
new file mode 100644
index 0000000..596aff6
--- /dev/null
+++ b/src/knx/dpt.h
@@ -0,0 +1,13 @@
+#pragma once
+
+class Dpt
+{
+ public:
+ Dpt();
+ Dpt(short mainGroup, short subGroup, short index = 0);
+ unsigned short mainGroup;
+ unsigned short subGroup;
+ unsigned short index;
+ bool operator==(const Dpt& other) const;
+ bool operator!=(const Dpt& other) const;
+};
\ No newline at end of file
diff --git a/src/knx/dptconvert.h b/src/knx/dptconvert.h
index 219916f..98d7192 100644
--- a/src/knx/dptconvert.h
+++ b/src/knx/dptconvert.h
@@ -29,105 +29,9 @@
#pragma once
#include
-#include
-class Dpt
-{
- public:
- Dpt() {}
- Dpt(short mainGroup, short subGroup, short index = 0)
- {
- this->mainGroup = mainGroup;
- this->subGroup = subGroup;
- this->index = index;
- }
- unsigned short mainGroup;
- unsigned short subGroup;
- unsigned short index;
- bool operator==(const Dpt& other) const
- {
- return other.mainGroup == mainGroup && other.subGroup == subGroup && other.index == index;
- }
-
- bool operator!=(const Dpt& other) const
- {
- return !(other == *this);
- }
-};
-
-class KNXValue
-{
- public:
- KNXValue() {}
- KNXValue(bool value) { _value.boolValue = value; }
- KNXValue(uint8_t value) { _value.ucharValue = value; }
- KNXValue(uint16_t value) { _value.ushortValue = value; }
- KNXValue(uint32_t value) { _value.uintValue = value; }
- KNXValue(uint64_t value) { _value.ulongValue = value; }
- KNXValue(int8_t value) { _value.charValue = value; }
- KNXValue(int16_t value) { _value.shortValue = value; }
- KNXValue(int32_t value) { _value.intValue = value; }
- KNXValue(int64_t value) { _value.longValue = value; }
- KNXValue(double value) { _value.doubleValue = value; }
- KNXValue(char* value) { _value.stringValue = value; }
- KNXValue(struct tm value) { _value.timeValue = value; }
-
- operator bool() const { return _value.boolValue; }
- operator uint8_t() const { return _value.ucharValue; }
- operator uint16_t() const { return _value.ushortValue; }
- operator uint32_t() const { return _value.uintValue; }
- operator uint64_t() const { return _value.ulongValue; }
- operator int8_t() const { return _value.charValue; }
- operator int16_t() const { return _value.shortValue; }
- operator int32_t() const { return _value.intValue; }
- operator int64_t() const { return _value.longValue; }
- operator double() const { return _value.doubleValue; }
- operator char*() const { return _value.stringValue; }
- operator struct tm() const { return _value.timeValue; }
-
- bool boolValue() const { return _value.boolValue; }
- uint8_t ucharValue() const { return _value.ucharValue; }
- uint16_t ushortValue() const { return _value.ushortValue; }
- uint32_t uintValue() const { return _value.uintValue; }
- uint64_t ulongValue() const { return _value.ulongValue; }
- int8_t charValue() const { return _value.charValue; }
- int16_t shortValue() const { return _value.shortValue; }
- int32_t intValue() const { return _value.intValue; }
- int64_t longValue() const { return _value.longValue; }
- double doubleValue() const { return _value.doubleValue; }
- char* stringValue() const { return _value.stringValue; }
- struct tm timeValue() const { return _value.timeValue; }
-
- void boolValue(bool value) { _value.boolValue = value; }
- void ucharValue(uint8_t value) { _value.ucharValue = value; }
- void ushortValue(uint16_t value) { _value.ushortValue = value; }
- void uintValue(uint32_t value) { _value.uintValue = value; }
- void ulongValue(uint64_t value) { _value.ulongValue = value; }
- void charValue(int8_t value) { _value.charValue = value; }
- void shortValue(int16_t value) { _value.shortValue = value; }
- void intValue(int32_t value) { _value.intValue = value; }
- void longValue(int64_t value) { _value.longValue = value; }
- void doubleValue(double value) { _value.doubleValue = value; }
- void stringValue(char* value) { _value.stringValue = value; }
- void timeValue(struct tm value) { _value.timeValue = value; }
- private:
- union Value
- {
- bool boolValue;
- uint8_t ucharValue;
- uint16_t ushortValue;
- uint32_t uintValue;
- uint64_t ulongValue;
- int8_t charValue;
- int16_t shortValue;
- int32_t intValue;
- int64_t longValue;
- double doubleValue;
- char* stringValue;
- struct tm timeValue;
- };
- Value _value;
-};
+#include "dpt.h"
+#include "knx_value.h"
/**
* Converts the KNX Payload given by the specific DPT and puts the value in the KNXValue struc
diff --git a/src/knx/knx_value.cpp b/src/knx/knx_value.cpp
new file mode 100644
index 0000000..fb8a09f
--- /dev/null
+++ b/src/knx/knx_value.cpp
@@ -0,0 +1,250 @@
+#include "knx_value.h"
+
+KNXValue::KNXValue()
+{}
+
+KNXValue::KNXValue(bool value)
+{
+ _value.boolValue = value;
+}
+
+KNXValue::KNXValue(uint8_t value)
+{
+ _value.ucharValue = value;
+}
+
+KNXValue::KNXValue(uint16_t value)
+{
+ _value.ushortValue = value;
+}
+
+KNXValue::KNXValue(uint32_t value)
+{
+ _value.uintValue = value;
+}
+
+KNXValue::KNXValue(uint64_t value)
+{
+ _value.ulongValue = value;
+}
+
+KNXValue::KNXValue(int8_t value)
+{
+ _value.charValue = value;
+}
+
+KNXValue::KNXValue(int16_t value)
+{
+ _value.shortValue = value;
+}
+
+KNXValue::KNXValue(int32_t value)
+{
+ _value.intValue = value;
+}
+
+KNXValue::KNXValue(int64_t value)
+{
+ _value.longValue = value;
+}
+
+KNXValue::KNXValue(double value)
+{
+ _value.doubleValue = value;
+}
+
+KNXValue::KNXValue(char* value)
+{
+ _value.stringValue = value;
+}
+
+KNXValue::KNXValue(struct tm value)
+{
+ _value.timeValue = value;
+}
+
+KNXValue::operator bool() const
+{
+ return _value.boolValue;
+}
+
+KNXValue::operator uint8_t() const
+{
+ return _value.ucharValue;
+}
+
+KNXValue::operator uint16_t() const
+{
+ return _value.ushortValue;
+}
+
+KNXValue::operator uint32_t() const
+{
+ return _value.uintValue;
+}
+
+KNXValue::operator uint64_t() const
+{
+ return _value.ulongValue;
+}
+
+KNXValue::operator int8_t() const
+{
+ return _value.charValue;
+}
+
+KNXValue::operator int16_t() const
+{
+ return _value.shortValue;
+}
+
+KNXValue::operator int32_t() const
+{
+ return _value.intValue;
+}
+
+KNXValue::operator int64_t() const
+{
+ return _value.longValue;
+}
+
+KNXValue::operator double() const
+{
+ return _value.doubleValue;
+}
+
+KNXValue::operator char*() const
+{
+ return _value.stringValue;
+}
+
+KNXValue::operator struct tm() const
+{
+ return _value.timeValue;
+}
+
+KNXValue& KNXValue::operator=(const bool value)
+{
+ _value.boolValue = value;
+ return *this;
+}
+
+bool KNXValue::boolValue() const
+{
+ return _value.boolValue;
+}
+
+uint8_t KNXValue::ucharValue() const
+{
+ return _value.ucharValue;
+}
+
+uint16_t KNXValue::ushortValue() const
+{
+ return _value.ushortValue;
+}
+
+uint32_t KNXValue::uintValue() const
+{
+ return _value.uintValue;
+}
+
+uint64_t KNXValue::ulongValue() const
+{
+ return _value.ulongValue;
+}
+
+int8_t KNXValue::charValue() const
+{
+ return _value.charValue;
+}
+
+int16_t KNXValue::shortValue() const
+{
+ return _value.shortValue;
+}
+
+int32_t KNXValue::intValue() const
+{
+ return _value.intValue;
+}
+
+int64_t KNXValue::longValue() const
+{
+ return _value.longValue;
+}
+
+double KNXValue::doubleValue() const
+{
+ return _value.doubleValue;
+}
+
+char* KNXValue::stringValue() const
+{
+ return _value.stringValue;
+}
+
+struct tm KNXValue::timeValue() const
+{
+ return _value.timeValue;
+}
+
+void KNXValue::boolValue(bool value)
+{
+ _value.boolValue = value;
+}
+
+void KNXValue::ucharValue(uint8_t value)
+{
+ _value.ucharValue = value;
+}
+
+void KNXValue::ushortValue(uint16_t value)
+{
+ _value.ushortValue = value;
+}
+
+void KNXValue::uintValue(uint32_t value)
+{
+ _value.uintValue = value;
+}
+
+void KNXValue::ulongValue(uint64_t value)
+{
+ _value.ulongValue = value;
+}
+
+void KNXValue::charValue(int8_t value)
+{
+ _value.charValue = value;
+}
+
+void KNXValue::shortValue(int16_t value)
+{
+ _value.shortValue = value;
+}
+
+void KNXValue::intValue(int32_t value)
+{
+ _value.intValue = value;
+}
+
+void KNXValue::longValue(int64_t value)
+{
+ _value.longValue = value;
+}
+
+void KNXValue::doubleValue(double value)
+{
+ _value.doubleValue = value;
+}
+
+void KNXValue::stringValue(char* value)
+{
+ _value.stringValue = value;
+}
+
+void KNXValue::timeValue(struct tm value)
+{
+ _value.timeValue = value;
+}
diff --git a/src/knx/knx_value.h b/src/knx/knx_value.h
new file mode 100644
index 0000000..641d998
--- /dev/null
+++ b/src/knx/knx_value.h
@@ -0,0 +1,81 @@
+#pragma once
+
+#include
+#include
+
+class KNXValue
+{
+ public:
+ KNXValue();
+ KNXValue(bool value);
+ KNXValue(uint8_t value);
+ KNXValue(uint16_t value);
+ KNXValue(uint32_t value);
+ KNXValue(uint64_t value);
+ KNXValue(int8_t value);
+ KNXValue(int16_t value);
+ KNXValue(int32_t value);
+ KNXValue(int64_t value);
+ KNXValue(double value);
+ KNXValue(char* value);
+ KNXValue(struct tm value);
+
+ operator bool() const;
+ operator uint8_t() const;
+ operator uint16_t() const;
+ operator uint32_t() const;
+ operator uint64_t() const;
+ operator int8_t() const;
+ operator int16_t() const;
+ operator int32_t() const;
+ operator int64_t() const;
+ operator double() const;
+ operator char*() const;
+ operator struct tm() const;
+
+ KNXValue& operator=(const bool value);
+
+ bool boolValue() const;
+ uint8_t ucharValue() const;
+ uint16_t ushortValue() const;
+ uint32_t uintValue() const;
+ uint64_t ulongValue() const;
+ int8_t charValue() const;
+ int16_t shortValue() const;
+ int32_t intValue() const;
+ int64_t longValue() const;
+ double doubleValue() const;
+ char* stringValue() const;
+ struct tm timeValue() const;
+
+ void boolValue(bool value);
+ void ucharValue(uint8_t value);
+ void ushortValue(uint16_t value);
+ void uintValue(uint32_t value);
+ void ulongValue(uint64_t value);
+ void charValue(int8_t value);
+ void shortValue(int16_t value);
+ void intValue(int32_t value);
+ void longValue(int64_t value);
+ void doubleValue(double value);
+ void stringValue(char* value);
+ void timeValue(struct tm value);
+
+ private:
+ union Value
+ {
+ bool boolValue;
+ uint8_t ucharValue;
+ uint16_t ushortValue;
+ uint32_t uintValue;
+ uint64_t ulongValue;
+ int8_t charValue;
+ int16_t shortValue;
+ int32_t intValue;
+ int64_t longValue;
+ double doubleValue;
+ char* stringValue;
+ struct tm timeValue;
+ };
+ Value _value;
+};
\ No newline at end of file