You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by ms...@apache.org on 2019/05/13 09:11:24 UTC

[plc4x] 01/01: Builder PlcReadRequest

This is an automated email from the ASF dual-hosted git repository.

msommer pushed a commit to branch feature/s7-cpp
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 365c22b64a99ac1029498034a53ac0239c624ec5
Author: Markus Sommer <ms...@apache.org>
AuthorDate: Mon May 13 11:06:33 2019 +0200

    Builder PlcReadRequest
---
 plc4cpp/CMakeLists.txt                             |  17 +-
 plc4cpp/api/CMakeLists.txt                         |   7 +-
 .../cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp |  93 ++++++---
 .../cpp/org/apache/plc4x/cpp/api/PlcConnection.h   | 228 +++++++++++++--------
 .../plc4x/cpp/api/messages/PlcFieldRequest.h       |  10 +-
 .../plc4x/cpp/api/messages/PlcReadRequest.cpp      |   6 -
 .../apache/plc4x/cpp/api/messages/PlcReadRequest.h |  10 +-
 .../plc4x/cpp/api/messages/PlcRequestBuilder.h     |   1 -
 plc4cpp/examples/CMakeLists.txt                    |   2 +-
 plc4cpp/integrations/apache-mynewt/CMakeLists.txt  |   2 +-
 plc4cpp/integrations/edgex-foundry/CMakeLists.txt  |   2 +-
 plc4cpp/protocols/driver-bases/base/CMakeLists.txt |   7 +-
 .../cpp/base/connection/AbstractPlcConnection.cpp  |  31 ++-
 .../cpp/base/connection/AbstractPlcConnection.h    |   5 +-
 .../plc4x/cpp/base/connection/PlcFieldHandler.h    |   2 +-
 .../cpp/base/messages/DefaultPlcReadRequest.cpp    | 100 +++++----
 .../cpp/base/messages/DefaultPlcReadRequest.h      |  35 +++-
 .../cpp/base/messages/DefaultPlcWriteRequest.cpp   | 127 ++++++------
 .../cpp/base/messages/DefaultPlcWriteRequest.h     |  11 +-
 .../cpp/base/messages/InternalPlcFieldRequest.h    |   2 +-
 plc4cpp/utils/CMakeLists.txt                       |   2 +
 plc4cpp/utils/logger/CMakeLists.txt                |   6 +
 .../org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp |   6 +-
 23 files changed, 447 insertions(+), 265 deletions(-)

diff --git a/plc4cpp/CMakeLists.txt b/plc4cpp/CMakeLists.txt
index 668ef96..465e7ae 100644
--- a/plc4cpp/CMakeLists.txt
+++ b/plc4cpp/CMakeLists.txt
@@ -24,13 +24,24 @@ set(CMAKE_CXX_EXTENSIONS OFF)
 
 set(PLC4CPP_ROOT_DIR ${CMAKE_SOURCE_DIR})
 
+set(BOOST_ROOT "./libs/boost/target/boost_1_70_0/")
+set(Boost_USE_STATIC_LIBS ON)
+set(Boost_USE_MULTITHREADED ON)
+find_package(Boost COMPONENTS filesystem log REQUIRED)
+
+#[[ Trace CMAKE Variable ]]
+get_cmake_property(_variableNames VARIABLES)
+list (SORT _variableNames)
+foreach (_variableName ${_variableNames})
+    message(STATUS "${_variableName}=${${_variableName}}")
+endforeach()
+
 
 #[[
     Build all the modules of PLC4Cpp
 ]]
 add_subdirectory(api)
 add_subdirectory(protocols)
+add_subdirectory(drivers)
 add_subdirectory(utils)
-
-add_subdirectory(examples)
-add_subdirectory(integrations)
+add_subdirectory(examples)
\ No newline at end of file
diff --git a/plc4cpp/api/CMakeLists.txt b/plc4cpp/api/CMakeLists.txt
index 9db5fc7..9d442d3 100644
--- a/plc4cpp/api/CMakeLists.txt
+++ b/plc4cpp/api/CMakeLists.txt
@@ -22,7 +22,9 @@ set(CMAKE_CXX_STANDARD 11)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)
 
-add_library(plc4cpp-api src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
+add_library(plc4cpp-api 
+        src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.cpp
+        src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
         src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcAuthentication.cpp
         src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.cpp
         src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.cpp
@@ -42,7 +44,6 @@ add_library(plc4cpp-api src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
         src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldResponse.cpp
         src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcMessage.cpp
         src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp
-        src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.cpp
         src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadResponse.cpp
         src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequest.cpp
         src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.cpp
@@ -73,4 +74,6 @@ add_library(plc4cpp-api src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
     Import the boost headers
 ]]
 target_include_directories (plc4cpp-api PUBLIC target/dependencies/include)
+target_include_directories (plc4cpp-api PUBLIC ${Boost_INCLUDE_DIRS})
+target_include_directories (plc4cpp-api PUBLIC ../utils/logger/src/main/cpp)
 
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
index 12a9e9c..1b4479c 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
@@ -1,36 +1,81 @@
 /*
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
 
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
-*/
+   http://www.apache.org/licenses/LICENSE-2.0
 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+ 
 #include "PlcConnection.h"
+#include "exceptions/PlcRuntimeException.h"
 
 namespace org
 {
-	namespace apache
-	{
-		namespace plc4x
-		{
-			namespace cpp
+  namespace apache
+  {
+    namespace plc4x
+    {
+	    namespace cpp
+	    {
+			namespace api
 			{
-				namespace api
+                using namespace org::apache::plc4x::cpp::api::exceptions;
+
+				PlcConnection::PlcConnection() :
+                    _bConnected(false),
+					_pSendBuffer(nullptr),
+					_pRecvBuffer(nullptr),
+					_iSendBufferSize(0),
+					_iRecvBufferSize(0)
+				{
+					setSendBufferSize(DEFAULT_BUFFER_SIZE);
+					setRecvBufferSize(DEFAULT_BUFFER_SIZE);
+					_strErrorMessage = "";
+				}
+
+				PlcConnection::~PlcConnection()
+				{
+					if (_pSendBuffer != NULL) delete[] _pSendBuffer;
+					if (_pRecvBuffer != NULL) delete[] _pRecvBuffer;
+				}
+
+				PlcField* PlcConnection::prepareField(std::string strFieldQuery)
+				{
+						BOOST_THROW_EXCEPTION(PlcRuntimeException("Parse method is not implemented for this connection / driver"));
+				}
+				
+				void PlcConnection::setSendBufferSize(int iBufferSize)
+				{
+					if (iBufferSize != _iSendBufferSize)
+					{
+						_iSendBufferSize = iBufferSize;
+						if (_pSendBuffer != NULL) delete[] _pSendBuffer;
+						_pSendBuffer = new unsigned char[_iSendBufferSize];
+					}
+				}
+
+				void PlcConnection::setRecvBufferSize(int iBufferSize)
 				{
+					if (iBufferSize != _iRecvBufferSize)
+					{
+						_iRecvBufferSize = iBufferSize;
+						if (_pRecvBuffer != NULL) delete[] _pRecvBuffer;
+						_pRecvBuffer = new unsigned char[_iRecvBufferSize];
+					}
 				}
 			}
-		}
-	}
+	    }
+    }
+  }
 }
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h
index b301696..0dc3762 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h
@@ -1,22 +1,21 @@
 /*
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
-*/
-
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
 #ifndef _PLC_CONNECTION
 #define _PLC_CONNECTION
 
@@ -26,87 +25,136 @@ under the License.
 #include "../api/messages/PlcSubscriptionRequest.h"
 #include "../api/messages/PlcUnsubscriptionRequest.h"
 
-using namespace org::apache::plc4x::cpp::api::metadata;
-using namespace org::apache::plc4x::cpp::api::messages;
+#include <org/apache/plc4x/cpp/utils/logger/DatDmp.h>
+#include <boost/signals2.hpp>
+#include <boost/thread.hpp>
+
+#define DEFAULT_BUFFER_SIZE	16384
 
 namespace org
 {
-	namespace apache
-	{
-		namespace plc4x
-		{
-			namespace cpp
+  namespace apache
+  {
+    namespace plc4x
+    {
+	    namespace cpp
+	    {
+			namespace api
 			{
-				namespace api
+
+				using namespace boost::signals2;
+                using namespace org::apache::plc4x::cpp::api::metadata;
+                using namespace org::apache::plc4x::cpp::api::messages;
+                using namespace org::apache::plc4x::cpp::utils;
+
+				/**
+				* Interface defining the most basic methods a PLC4X connection should support.
+				* This generally handles the connection establishment itself and the parsing of
+				* field address strings to the platform dependent PlcField instances.
+				*/
+				
+				class PlcConnection
 				{
+				public:
+
+					PlcConnection();
+					~PlcConnection();
+					
+					
 					/**
-					* Interface defining the most basic methods a PLC4X connection should support.
-					* This generally handles the connection establishment itself and the parsing of
-					* field address strings to the platform dependent PlcField instances.
+					* Establishes the connection to the remote PLC.
+					* @throws PlcConnectionException if the connection attempt failed
 					*/
-					class PlcConnection
-					{
-						public:
-							/**
-							* Establishes the connection to the remote PLC.
-							* @throws PlcConnectionException if the connection attempt failed
-							*/
-							virtual void connect() = 0;
-
-							/**
-							* Indicates if the connection is established to a remote PLC.
-							* @return {@code true} if connected, {@code false} otherwise
-							*/
-							virtual bool isConnected() = 0;
-
-							/**
-							 * Closes the connection to the remote PLC.
-							 * @throws Exception if shutting down the connection failed
-							 * Todo: implement java.lang.Autocloseable
-							 */
-						
-								virtual void close() = 0;
-
-							/**
-							 * Provides connection metadata.
-							 */
-							virtual PlcConnectionMetadata* getMetadata() const = 0;
-
-							/**
-							 * Obtain read request builder.
-							 * @throws PlcUnsupportedOperationException if the connection does not support reading
-							 * Todo: implement pendant for java Builder pattern
-							 */
-							virtual PlcReadRequest* readRequestBuilder() = 0;
-
-							/**
-							 * Obtain write request builder.
-							 * @throws PlcUnsupportedOperationException if the connection does not support writing
-							  * Todo: implement pendant for java Builder pattern (PlcWriteRequest.Builder)
-							 */
-							virtual PlcWriteRequest* writeRequestBuilder() = 0;
-
-							/**
-							 * Obtain subscription request builder.
-							 * @throws PlcUnsupportedOperationException if the connection does not support subscription
-							 * Todo: implement pendant for java Builder pattern (PlcSubscriptionRequest.Builder)
-							 */
-							virtual PlcSubscriptionRequest* subscriptionRequestBuilder() = 0;
-
-							/**
-							 * Obtain unsubscription request builder.
-							 * @throws PlcUnsupportedOperationException if the connection does not support subscription
-							 * Todo: implement pendant for java Builder pattern (PlcSubscriptionRequest.Builder)
-
-							 */
-							virtual PlcUnsubscriptionRequest* unsubscriptionRequestBuilder() = 0;
-
-						private:
-					};
-				}
+					virtual void connect() = 0;
+					
+					/**
+					* Indicates if the connection is established to a remote PLC.
+					* @return {@code true} if connected, {@code false} otherwise
+					*/
+					
+					inline bool isConnected() const { return _bConnected; }
+					
+					/**
+					 * Closes the connection to the remote PLC.
+					 * @throws Exception if shutting down the connection failed
+					 */
+					virtual void close() = 0;
+
+					/**
+					 * Parse a fieldQuery for the given connection type.
+					 *
+					 * @throws PlcRuntimeException If the string cannot be parsed
+					 */
+                    PlcField* prepareField(std::string strFieldQuery);
+
+					/**
+					 * Provides connection metadata.
+					 */
+					virtual PlcConnectionMetadata* getMetadata() = 0;
+
+					/**
+					 * Execute a ping query against a remote device to check the availability of the connection.
+					 *
+					 * @return CompletableFuture that is completed successfully (Void) or unsuccessfully with an PlcException.
+					 */
+					virtual void ping() = 0;
+
+					/**
+					 * Obtain read request builder.
+					 * @throws PlcUnsupportedOperationException if the connection does not support reading
+					 */
+					virtual PlcReadRequest::Builder* readRequestBuilder() = 0;
+
+					/**
+					 * Obtain write request builder.
+					 * @throws PlcUnsupportedOperationException if the connection does not support writing
+					 */
+					//virtual void Builder* writeRequestBuilder() = 0;
+
+					/**
+					 * Obtain subscription request builder.
+					 * @throws PlcUnsupportedOperationException if the connection does not support subscription
+					 */
+					//virtual void Builder* subscriptionRequestBuilder() = 0;
+
+					/**
+					 * Obtain unsubscription request builder.
+					 * @throws PlcUnsupportedOperationException if the connection does not support subscription
+					 */
+					//virtual void Builder* unsubscriptionRequestBuilder() = 0;
+
+					
+					virtual bool send(unsigned char* pBytesToSend, int iNumBytesToSend) = 0;
+					
+
+					inline int getSendBufferSize() const { return _iSendBufferSize; }
+					void setSendBufferSize(int iBufferSize);
+				
+					inline int getRecvBufferSize() const { return _iRecvBufferSize; }
+					void setRecvBufferSize(int iBlockSize);
+
+				protected:
+
+					virtual void onReceive(const boost::system::error_code& errorCode, std::size_t szRecvBytes) = 0;
+
+				protected:
+					bool            _bConnected;
+					unsigned char*  _pSendBuffer;
+					int             _iSendBufferSize;
+					unsigned char*  _pRecvBuffer;
+					int             _iRecvBufferSize;
+					std::string     _strErrorMessage;
+
+					boost::mutex              _mtxComLock;
+					boost::condition_variable _condComHandler;
+
+                    DatDmp _dump;
+
+				};
 			}
 		}
-	}
+    }
+  }
 }
 
 #endif
\ No newline at end of file
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h
index 16cc1f9..1b4d302 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h
@@ -24,6 +24,7 @@ under the License.
 #include "PlcFieldResponse.h"
 
 #include <string>
+#include <map>
 
 namespace org
 {
@@ -40,13 +41,14 @@ namespace org
 						/**
 						 * Base type for all messages sent from the plc4x system to a connected plc.
 						 */
-						class PlcFieldRequest : PlcRequest
+						class PlcFieldRequest : public PlcRequest
 						{
 							public:	
 								virtual int getNumberOfFields() = 0;
-								virtual std::vector<std::string>* getFieldNames() const = 0;
-								virtual PlcField* getField(std::string) const = 0;
-								virtual std::vector<PlcField>* getFields() const = 0;
+                                virtual std::vector<std::string> getFieldNames();
+								virtual PlcField* getField(std::string) = 0;
+								virtual std::vector<PlcField*> getFields() = 0;
+                                virtual std::map<std::string, PlcField*> getNamedFields() = 0;
 
 							private:
 						};
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp
index 88a9b9f..9b9f9a0 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp
@@ -33,18 +33,12 @@ namespace org
 					{
 						PlcReadRequest::PlcReadRequest()
 						{
-                            _pPlcbuilder = nullptr;
 						}
 
 						PlcReadRequest::~PlcReadRequest()
 						{
 							 // TODO Free Pointer eg. use Smartpointer ?
 						}
-
-						PlcReadRequestBuilder* PlcReadRequest::getBuilder() const
-						{ 
-							return _pPlcbuilder;
-						}
 					}
 				}
 			}
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h
index 65dc62b..afcdbe5 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h
@@ -22,7 +22,6 @@ under the License.
 
 #include "PlcFieldRequest.h"
 #include "PlcRequestBuilder.h"
-#include "PlcReadRequestBuilder.h"
 
 
 namespace org
@@ -46,10 +45,15 @@ namespace org
 							PlcReadRequest();
 							~PlcReadRequest();
 
-							PlcReadRequestBuilder* getBuilder() const;
+                            class Builder : public PlcRequestBuilder
+                            {
+                            public:
+                                virtual PlcReadRequest* build() = 0;
+                                virtual Builder* addItem(std::string& strName, std::string& strFieldQuery) = 0;
+                            };
 
 						private:
-							PlcReadRequestBuilder* _pPlcbuilder;
+							
 						};
 												
 					}
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h
index d0732c3..6b80d19 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h
@@ -40,7 +40,6 @@ namespace org
 						class PlcRequestBuilder
 						{
 							public:	
-								virtual PlcRequest* build() = 0;
 
 							private:
 						};
diff --git a/plc4cpp/examples/CMakeLists.txt b/plc4cpp/examples/CMakeLists.txt
index 1989a97..e720a1f 100644
--- a/plc4cpp/examples/CMakeLists.txt
+++ b/plc4cpp/examples/CMakeLists.txt
@@ -17,4 +17,4 @@
   under the License.
 ]]
 
-//add_subdirectory(module-name)
+add_subdirectory(hello-world-plc4x)
diff --git a/plc4cpp/integrations/apache-mynewt/CMakeLists.txt b/plc4cpp/integrations/apache-mynewt/CMakeLists.txt
index 1989a97..4875af1 100644
--- a/plc4cpp/integrations/apache-mynewt/CMakeLists.txt
+++ b/plc4cpp/integrations/apache-mynewt/CMakeLists.txt
@@ -17,4 +17,4 @@
   under the License.
 ]]
 
-//add_subdirectory(module-name)
+# [[add_subdirectory(module-name) ]]
diff --git a/plc4cpp/integrations/edgex-foundry/CMakeLists.txt b/plc4cpp/integrations/edgex-foundry/CMakeLists.txt
index 1989a97..4875af1 100644
--- a/plc4cpp/integrations/edgex-foundry/CMakeLists.txt
+++ b/plc4cpp/integrations/edgex-foundry/CMakeLists.txt
@@ -17,4 +17,4 @@
   under the License.
 ]]
 
-//add_subdirectory(module-name)
+# [[add_subdirectory(module-name) ]]
diff --git a/plc4cpp/protocols/driver-bases/base/CMakeLists.txt b/plc4cpp/protocols/driver-bases/base/CMakeLists.txt
index e3157a7..3c5d607 100644
--- a/plc4cpp/protocols/driver-bases/base/CMakeLists.txt
+++ b/plc4cpp/protocols/driver-bases/base/CMakeLists.txt
@@ -22,7 +22,9 @@ set(CMAKE_CXX_STANDARD 11)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)
 
-add_library(plc4cpp-protocols-driver-base-base src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp
+add_library(plc4cpp-protocols-driver-base-base 
+        src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp
+        #src/main/cpp/org/apache/plc4x/cpp/base/connection/BoostConnection.cpp
         src/main/cpp/org/apache/plc4x/cpp/base/connection/ChannelFactory.cpp
         src/main/cpp/org/apache/plc4x/cpp/base/connection/DefaultPlcFieldHandler.cpp
         src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.cpp
@@ -63,3 +65,6 @@ add_library(plc4cpp-protocols-driver-base-base src/main/cpp/org/apache/plc4x/cpp
     Import the headers for boost and the plc4cpp-api module
 ]]
 target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC target/dependencies/include)
+target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC ${Boost_INCLUDE_DIRS})
+target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC ../../../api/src/main/cpp)
+target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC ../../../utils/logger/src/main/cpp)
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp
index af47faa..6a6eab0 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp
@@ -18,6 +18,7 @@ under the License.
 */
 
 #include "AbstractPlcConnection.h"
+#include <org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.h>
 
 namespace org
 {
@@ -31,9 +32,11 @@ namespace org
 				{
 					namespace connection
 					{
-						PlcConnectionMetadata& AbstractPlcConnection::getMetadata()
+                        using namespace org::apache::plc4x::cpp::api::exceptions;
+
+                        PlcConnectionMetadata* AbstractPlcConnection::getMetadata()
 						{
-							return *this;
+							return this;
 						}
 						bool AbstractPlcConnection::canRead()
 						{
@@ -47,6 +50,30 @@ namespace org
 						{
 							return false;
 						}
+
+                        PlcReadRequest::Builder* AbstractPlcConnection::readRequestBuilder()
+                        {
+                            BOOST_THROW_EXCEPTION(PlcUnsupportedOperationException("The connection does not support reading"));
+                        }
+
+                        
+
+                        /*@Override
+                            public PlcWriteRequest.Builder writeRequestBuilder() {
+                            throw new PlcUnsupportedOperationException("The connection does not support writing");
+                        }
+
+                        @Override
+                            public PlcSubscriptionRequest.Builder subscriptionRequestBuilder() {
+                            throw new PlcUnsupportedOperationException("The connection does not support subscription");
+                        }
+
+                        @Override
+                            public PlcUnsubscriptionRequest.Builder unsubscriptionRequestBuilder() {
+                            throw new PlcUnsupportedOperationException("The connection does not support subscription");
+                        }*/
+
+
 					}
 				}
 			}
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h
index e7b0683..c17e933 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h
@@ -48,7 +48,7 @@ namespace org
 						{
 
 						public:
-							PlcConnectionMetadata& getMetadata();
+							PlcConnectionMetadata* getMetadata();
 							bool canRead();
 							bool canWrite();
 							bool canSubscribe();
@@ -57,8 +57,7 @@ namespace org
 							virtual void close() = 0;
 							virtual bool send(unsigned char* pBytesToSend, int iNumBytesToSend) = 0;
 
-							// Todo: Check if required
-							//PlcReadRequest.Builder readRequestBuilder();
+							PlcReadRequest::Builder* readRequestBuilder();
 							// PlcWriteRequest.Builder writeRequestBuilder();
 							// PlcSubscriptionRequest.Builder subscriptionRequestBuilder();
 							// PlcUnsubscriptionRequest.Builder nsubscriptionRequestBuilder();
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h
index b26339f..3ee2257 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h
@@ -58,7 +58,7 @@ namespace org
 
 						public:
 
-							virtual PlcField createField(std::string strFieldQuery) = 0;
+							virtual PlcField* createField(std::string strFieldQuery) = 0;
 
 							virtual BaseDefaultFieldItem<bool>* encodeBoolean(PlcField plcField, std::vector<void*> pValues) = 0;
 
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp
index 21005b7..82a53ad 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp
@@ -39,81 +39,103 @@ namespace org
 						}
 
 						// =========================================================
-						DefaultPlcReadRequest::DefaultPlcReadRequest(PlcReader* reader, std::map<std::string, PlcField> fields)
+						DefaultPlcReadRequest::DefaultPlcReadRequest(PlcReader* plcReader, std::map<std::string, PlcField*> mplcFields)
 						{
-							this->_reader = reader;
-							this->_fields = fields;
+                            _plcReader = plcReader;
+                            _mplcFields = mplcFields;
 						}
 
+                        // ====================================================
+                        PlcReader* DefaultPlcReadRequest::getReader()
+                        {
+                            return _plcReader;
+                        }
+
 						// ==========================================================
 						int DefaultPlcReadRequest::getNumberOfFields()
 						{
-							return _fields.size();
+							return _mplcFields.size();
 						}
 
 						// =========================================================
-						PlcField* DefaultPlcReadRequest::getField(std::string name)
+						PlcField* DefaultPlcReadRequest::getField(std::string strName)
 						{
-							// sgl: check 1st, whether the key is contained in vector 
-							// (otherwise an exception is thrown)...
-							std::map<std::string, PlcField>::iterator iterator = _fields.find(name);
+                            PlcField* plcField = nullptr;
+                            
+                            std::map<std::string, PlcField*>::iterator iterator = _mplcFields.find(strName);
 
-							if (iterator == _fields.end())
+							if (iterator != _mplcFields.end())
 							{
-								return nullptr;
+                                plcField = iterator->second;
 							}
 
-							return &(iterator->second);
-							
+							return plcField;							
 						}
 
 						// ======================================================
-						std::map<std::string, PlcField> DefaultPlcReadRequest::getNamedFields()
-						{
-							// Todo:
-							/*return fields.entrySet()
-								.stream()
-								.map(stringPlcFieldEntry->Pair.of(stringPlcFieldEntry.getKey(), stringPlcFieldEntry.getValue()))
-								.collect(Collectors.toCollection(LinkedList::new));
-*/
-							return std::map<std::string, PlcField>();
-						}
-
-						// ====================================================
-						PlcReader* DefaultPlcReadRequest::getReader()
+						std::map<std::string, PlcField*> DefaultPlcReadRequest::getNamedFields()
 						{
-							return _reader;
+							return std::map<std::string, PlcField*>();
 						}
 
 						// =====================================================
-						std::vector<PlcField> DefaultPlcReadRequest::getFields()
+						std::vector<PlcField*> DefaultPlcReadRequest::getFields()
 						{
-							// TODO: check if already exists...
-							std::pair<std::string, PlcField> me;
-							std::vector<PlcField> vNames;
+							std::pair<std::string, PlcField*> me;
+							std::vector<PlcField*> vplcFields;
 
-							BOOST_FOREACH(me, _fields)
+							BOOST_FOREACH(me, _mplcFields)
 							{
-								vNames.push_back(me.second);
+                                vplcFields.push_back(me.second);
 							}
 
-							return vNames;
+							return vplcFields;
 						}
 
 						// =========================================================
 						std::vector<std::string> DefaultPlcReadRequest::getFieldNames()
 						{							
 							// TODO: check if already exists...
-							std::pair<std::string, PlcField> me;
-							std::vector<std::string> vNames;
+							std::pair<std::string, PlcField*> me;
+							std::vector<std::string> vstrNames;
 
-							BOOST_FOREACH(me, _fields)
+							BOOST_FOREACH(me, _mplcFields)
 							{
-								vNames.push_back(me.first);
+                                vstrNames.push_back(me.first);
 							}
 
-							return vNames;
-						}						
+							return vstrNames;
+						}
+
+                        DefaultPlcReadRequest::Builder::Builder(PlcReader* plcReader, PlcFieldHandler* plcFieldHandler)
+                        {
+                            _plcReader = plcReader;
+                            _plcFieldHandler = plcFieldHandler;
+                        }
+
+                        DefaultPlcReadRequest::Builder* DefaultPlcReadRequest::Builder::addItem(std::string strName, std::string strFieldQuery)
+                        {
+                            std::map<std::string, std::string>::iterator iterator = _mFields.find(strName);
+                            if (iterator != _mFields.end())
+                            {
+                                BOOST_THROW_EXCEPTION(PlcRuntimeException("Duplicate field definition '" + strName + "'"));
+                            }
+                            _mFields.insert(std::pair<std::string,std::string>(strName, strFieldQuery));
+                            return this;
+                        }
+
+                        PlcReadRequest* DefaultPlcReadRequest::Builder::build()
+                        {
+                            std::map<std::string, PlcField*> mParsedFields;
+                            std::pair<std::string, std::string> me;
+
+                            BOOST_FOREACH(me, _mFields)
+                            {
+                                PlcField* parsedField = _plcFieldHandler->createField(me.second);
+                                mParsedFields.insert(std::pair<std::string, PlcField*>(me.first, parsedField));
+                            }
+                            return new DefaultPlcReadRequest(_plcReader, mParsedFields);
+                        }
 					}
 				}
 			}
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h
index ef31dd1..4ce2c9c 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h
@@ -24,11 +24,12 @@ under the License.
 #include "InternalPlcFieldRequest.h"
 #include "PlcReader.h"
 #include <org/apache/plc4x/cpp/api/model/PlcField.h>
+#include "../connection/PlcFieldHandler.h"
 
 #include <map>
 #include <boost/foreach.hpp>
 
-using namespace org::apache::plc4x::cpp::api::messages;
+
 
 
 namespace org
@@ -43,8 +44,10 @@ namespace org
 				{
 					namespace messages
 					{
-						
-						class DefaultPlcReadRequest : public InternalPlcReadRequest //, public InternalPlcFieldRequest
+                        using namespace org::apache::plc4x::cpp::api::messages;
+                        using namespace org::apache::plc4x::cpp::base::connection;
+
+                        class DefaultPlcReadRequest : public InternalPlcReadRequest
 						{
 						public:
 							// Todo:
@@ -55,21 +58,37 @@ namespace org
 
 							// Todo: implement java Builder-pattern for C++							
 							
-							DefaultPlcReadRequest(PlcReader* reader, std::map<std::string, PlcField> fields);
+							DefaultPlcReadRequest(PlcReader* plcReader, std::map<std::string, PlcField*> mplcFields);
 							int getNumberOfFields();						
 							std::vector<std::string> getFieldNames();			
 							PlcField* getField(std::string name);
-							std::vector<PlcField> getFields();
-							std::map<std::string, PlcField> getNamedFields();
+							std::vector<PlcField*> getFields();
+							std::map<std::string, PlcField*> getNamedFields();
+
+                            class Builder
+                            {
+                            public:
+                                Builder(PlcReader* plcReader, PlcFieldHandler* plcFieldHandler);
+                                Builder* addItem(std::string strName, std::string strFieldQuery);
+                                PlcReadRequest* build();
+
+                            private:
+                                PlcReader* _plcReader;
+                                PlcFieldHandler* _plcFieldHandler;
+                                std::map<std::string, std::string> _mFields;
+                            };
+
 
 						protected:
+
 							PlcReader* getReader();
 							
 
 						private:					
+
 							DefaultPlcReadRequest();
-							PlcReader* _reader;
-							std::map<std::string, PlcField> _fields;
+							PlcReader* _plcReader;
+							std::map<std::string, PlcField*> _mplcFields;
 						};
 					}
 				}
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp
index bccc0c3..e0d6f9d 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp
@@ -17,7 +17,7 @@ specific language governing permissions and limitations
 under the License.
 */
 
-#include "DefaultPlcReadRequest.h"
+#include "DefaultPlcWriteRequest.h"
 
 namespace org
 {
@@ -32,86 +32,83 @@ namespace org
 					namespace messages
 					{
 						// =========================================================
-						DefaultPlcReadRequest::DefaultPlcReadRequest()
+                        DefaultPlcWriteRequest::DefaultPlcWriteRequest()
 						{
 						}
 
 						// =========================================================
-						DefaultPlcReadRequest::DefaultPlcReadRequest(PlcReader* reader, std::map<std::string, PlcField> fields)
+						DefaultPlcWriteRequest::DefaultPlcWriteRequest(PlcWriter* plcWriter, std::map<std::string, PlcField*> mplcFields)
 						{
-							this->_reader = reader;
-							this->_fields = fields;
+							_plcWriter = plcWriter;
+                            _mplcFields = mplcFields;
 						}
 
-						// ==========================================================
-						int DefaultPlcReadRequest::getNumberOfFields()
-						{
-							return _fields.size();
-						}
+                        // ====================================================
+                        PlcWriter* DefaultPlcWriteRequest::getWriter()
+                        {
+                            return _plcWriter;
+                        }
 
-						// =========================================================
-						PlcField* DefaultPlcReadRequest::getField(std::string name)
-						{
-							// sgl: check 1st, whether the key is contained in vector 
-							// (otherwise an exception is thrown)...
-							std::map<std::string, PlcField>::iterator iterator = _fields.find(name);
+                        // ==========================================================
+                        int DefaultPlcWriteRequest::getNumberOfFields()
+                        {
+                            return _mplcFields.size();
+                        }
 
-							if (iterator == _fields.end())
-							{
-								return nullptr;
-							}
+                        // =========================================================
+                        PlcField* DefaultPlcWriteRequest::getField(std::string strName)
+                        {
+                            PlcField* plcField = nullptr;
 
-							return &(iterator->second);
-							
-						}
+                            std::map<std::string, PlcField*>::iterator iterator = _mplcFields.find(strName);
 
-						// ======================================================
-						std::map<std::string, PlcField> DefaultPlcReadRequest::getNamedFields()
-						{
-							// Todo:
-							/*return fields.entrySet()
-								.stream()
-								.map(stringPlcFieldEntry->Pair.of(stringPlcFieldEntry.getKey(), stringPlcFieldEntry.getValue()))
-								.collect(Collectors.toCollection(LinkedList::new));
-*/
-							return std::map<std::string, PlcField>();
-						}
+                            if (iterator != _mplcFields.end())
+                            {
+                                plcField = iterator->second;
+                            }
 
-						// ====================================================
-						PlcReader* DefaultPlcReadRequest::getReader()
-						{
-							return _reader;
-						}
+                            return plcField;
 
-						// =====================================================
-						std::vector<PlcField> DefaultPlcReadRequest::getFields()
-						{
-							// TODO: check if already exists...
-							std::pair<std::string, PlcField> me;
-							std::vector<PlcField> vNames;
+                        }
 
-							BOOST_FOREACH(me, _fields)
-							{
-								vNames.push_back(me.second);
-							}
+                        // ======================================================
+                        std::map<std::string, PlcField*> DefaultPlcWriteRequest::getNamedFields()
+                        {
+                            return std::map<std::string, PlcField*>();
+                        }
 
-							return vNames;
-						}
+                        // =====================================================
+                        std::vector<PlcField*> DefaultPlcWriteRequest::getFields()
+                        {
+                            std::pair<std::string, PlcField*> me;
+                            std::vector<PlcField*> vplcFields;
 
-						// =========================================================
-						std::vector<std::string> DefaultPlcReadRequest::getFieldNames()
-						{							
-							// TODO: check if already exists...
-							std::pair<std::string, PlcField> me;
-							std::vector<std::string> vNames;
-
-							BOOST_FOREACH(me, _fields)
-							{
-								vNames.push_back(me.first);
-							}
-
-							return vNames;
-						}						
+                            BOOST_FOREACH(me, _mplcFields)
+                            {
+                                vplcFields.push_back(me.second);
+                            }
+
+                            return vplcFields;
+                        }
+
+                        // =========================================================
+                        std::vector<std::string> DefaultPlcWriteRequest::getFieldNames()
+                        {
+                            // TODO: check if already exists...
+                            std::pair<std::string, PlcField*> me;
+                            std::vector<std::string> vstrNames;
+
+                            BOOST_FOREACH(me, _mplcFields)
+                            {
+                                vstrNames.push_back(me.first);
+                            }
+
+                            return vstrNames;
+                        }
+
+						
+
+											
 					}
 				}
 			}
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h
index 163c64b..a349dbe 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h
@@ -54,22 +54,21 @@ namespace org
 
 							// Todo: implement java Builder-pattern for C++							
 							
-							DefaultPlcWriteRequest(PlcWriter* writer, std::map<std::string, PlcField> fields);
+							DefaultPlcWriteRequest(PlcWriter* writer, std::map<std::string, PlcField*> fields);
 							int getNumberOfFields();						
 							std::vector<std::string> getFieldNames();			
 							PlcField* getField(std::string name);
-							std::vector<PlcField> getFields();
-							std::map<std::string, PlcField> getNamedFields();
+							std::vector<PlcField*> getFields();
+							std::map<std::string, PlcField*> getNamedFields();
 							// Todo: implement callback to: execute() { _writer.write(this); }
 
 						protected:
 							PlcWriter* getWriter();
 							
-
 						private:					
 							DefaultPlcWriteRequest();
-							PlcWriter* _writer;
-							std::map<std::string, PlcField> _fields;
+							PlcWriter* _plcWriter;
+							std::map<std::string, PlcField*> _mplcFields;
 						};
 					}
 				}
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h
index 9247d54..37415ca 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h
@@ -41,7 +41,7 @@ namespace org
 						class InternalPlcFieldRequest : public InternalPlcRequest, PlcFieldRequest
 						{
 						public:
-							virtual std::map<std::string, PlcField> getNamedFields() = 0;
+							virtual std::map<std::string, PlcField*> getNamedFields() = 0;
 							InternalPlcFieldRequest();
 						};
 					}
diff --git a/plc4cpp/utils/CMakeLists.txt b/plc4cpp/utils/CMakeLists.txt
index 557916a..be2e8f8 100644
--- a/plc4cpp/utils/CMakeLists.txt
+++ b/plc4cpp/utils/CMakeLists.txt
@@ -18,3 +18,5 @@
 ]]
 
 add_subdirectory(logger)
+add_subdirectory(systemconfig)
+
diff --git a/plc4cpp/utils/logger/CMakeLists.txt b/plc4cpp/utils/logger/CMakeLists.txt
index eccf20e..8c4a38d 100644
--- a/plc4cpp/utils/logger/CMakeLists.txt
+++ b/plc4cpp/utils/logger/CMakeLists.txt
@@ -34,4 +34,10 @@ add_library(plc4cpp-utils-logger
 #[[
     Import the headers for boost and the plc4cpp-utils module
 ]]
+
+TARGET_LINK_LIBRARIES (plc4cpp-utils-logger ${Boost_LIBRARIES})
+
+
 target_include_directories (plc4cpp-utils-logger PUBLIC target/dependencies/include)
+target_include_directories (plc4cpp-utils-logger PUBLIC ${Boost_INCLUDE_DIRS})
+
diff --git a/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp b/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp
index 57c99e5..09c8e88 100644
--- a/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp
+++ b/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp
@@ -33,9 +33,9 @@ void TracerW(const wchar_t* formatStr, ...)
 	static wchar_t arcBuffer[TRACE_BUFFERSIZE];
 	va_list args;
 	va_start(args, formatStr);
-	_vstprintf_s(arcBuffer, TRACE_BUFFERSIZE, formatStr, args);
+    swprintf_s(arcBuffer, TRACE_BUFFERSIZE, formatStr, args);
 	va_end(args);
-	::OutputDebugString(buffer);
+	::OutputDebugStringW(arcBuffer);
 }
 
 
@@ -46,7 +46,7 @@ void Tracer(const char* formatStr, ...)
 	va_start(args, formatStr);
 	vsprintf_s(arcBuffer, TRACE_BUFFERSIZE, formatStr, args);
 	va_end(args);
-	::OutputDebugStringA(buffer);
+	::OutputDebugStringA(arcBuffer);
 }
 
 #endif