You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2021/02/06 11:46:35 UTC

[plc4x] branch develop updated: - Started cleaining up before starting to work on the Modbus driver

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

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new e804483  - Started cleaining up before starting to work on the Modbus driver
e804483 is described below

commit e804483c96b2b5699f7ca91a335955a8d2c053f6
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Sat Feb 6 12:46:22 2021 +0100

    - Started cleaining up before starting to work on the Modbus driver
---
 sandbox/plc4c/examples/CMakeLists.txt              |   5 +-
 .../CMakeLists.txt                                 |   0
 .../src/hello_subscriptions.c                      |   0
 .../CMakeLists.txt                                 |  16 +-
 .../src/hello_world_modbus.c}                      | 180 +++------------------
 .../{hello-world => hello-world-s7}/CMakeLists.txt |  12 +-
 .../src/hello_world_s7.c}                          | 126 +--------------
 7 files changed, 41 insertions(+), 298 deletions(-)

diff --git a/sandbox/plc4c/examples/CMakeLists.txt b/sandbox/plc4c/examples/CMakeLists.txt
index 9f415eb..d1138de 100644
--- a/sandbox/plc4c/examples/CMakeLists.txt
+++ b/sandbox/plc4c/examples/CMakeLists.txt
@@ -17,5 +17,6 @@
   under the License.
 ]]
 
-add_subdirectory(hello-subsciptions)
-add_subdirectory(hello-world)
+add_subdirectory(hello-subscriptions)
+add_subdirectory(hello-world-modbus)
+add_subdirectory(hello-world-s7)
diff --git a/sandbox/plc4c/examples/hello-subsciptions/CMakeLists.txt b/sandbox/plc4c/examples/hello-subscriptions/CMakeLists.txt
similarity index 100%
rename from sandbox/plc4c/examples/hello-subsciptions/CMakeLists.txt
rename to sandbox/plc4c/examples/hello-subscriptions/CMakeLists.txt
diff --git a/sandbox/plc4c/examples/hello-subsciptions/src/hello_subscriptions.c b/sandbox/plc4c/examples/hello-subscriptions/src/hello_subscriptions.c
similarity index 100%
rename from sandbox/plc4c/examples/hello-subsciptions/src/hello_subscriptions.c
rename to sandbox/plc4c/examples/hello-subscriptions/src/hello_subscriptions.c
diff --git a/sandbox/plc4c/examples/hello-world/CMakeLists.txt b/sandbox/plc4c/examples/hello-world-modbus/CMakeLists.txt
similarity index 74%
copy from sandbox/plc4c/examples/hello-world/CMakeLists.txt
copy to sandbox/plc4c/examples/hello-world-modbus/CMakeLists.txt
index 5b0caf4..4a690a9 100644
--- a/sandbox/plc4c/examples/hello-world/CMakeLists.txt
+++ b/sandbox/plc4c/examples/hello-world-modbus/CMakeLists.txt
@@ -18,28 +18,24 @@
 ]]
 
 include_directories("../../api/include"
-        "../../drivers/s7/include"
+        "../../drivers/modbus/include"
         "../../transports/tcp/include" )
 
-add_executable(plc4c-examples-hello-world
-        src/hello_world.c
+add_executable(plc4c-examples-hello-world-modbus
+        src/hello_world_modbus.c
         )
 
 IF (NOT WIN32)
-    target_link_libraries(plc4c-examples-hello-world
+    target_link_libraries(plc4c-examples-hello-world-modbus
             plc4c-spi
-            plc4c-driver-simulated
-            plc4c-driver-s7
             plc4c-driver-modbus
-            plc4c-transport-dummy
             plc4c-transport-tcp
-            plc4c-transport-serial
             m
     )
 ELSE()
-    target_link_libraries(plc4c-examples-hello-world
+    target_link_libraries(plc4c-examples-hello-world-modbus
             plc4c-spi
-            plc4c-driver-s7
+            plc4c-driver-modbus
             plc4c-transport-tcp
     )
 ENDIF()
diff --git a/sandbox/plc4c/examples/hello-world/src/hello_world.c b/sandbox/plc4c/examples/hello-world-modbus/src/hello_world_modbus.c
similarity index 60%
copy from sandbox/plc4c/examples/hello-world/src/hello_world.c
copy to sandbox/plc4c/examples/hello-world-modbus/src/hello_world_modbus.c
index 86c5d2e..9cdef7d 100644
--- a/sandbox/plc4c/examples/hello-world/src/hello_world.c
+++ b/sandbox/plc4c/examples/hello-world-modbus/src/hello_world_modbus.c
@@ -16,14 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-//#include <plc4c/driver_simulated.h>
-#include <plc4c/driver_s7.h>
-//#include <plc4c/driver_modbus.h>
+#include <plc4c/driver_modbus.h>
 #include <plc4c/plc4c.h>
-//#include <plc4c/transport_dummy.h>
 #include <plc4c/transport_tcp.h>
-//#include <plc4c/transport_serial.h>
-#include <plc4c/utils/list.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -50,20 +45,11 @@ void onGlobalDisconnect(plc4c_connection *cur_connection) {
   numOpenConnections--;
 }
 
-void delete_read_response_item(plc4c_list_element *response_read_item_element) {
-
-}
-
-void delete_write_response_item(
-    plc4c_list_element *response_write_item_element) {}
-
 enum plc4c_connection_state_t {
   CONNECTING,
   CONNECTED,
   READ_REQUEST_SENT,
   READ_RESPONSE_RECEIVED,
-  WRITE_REQUEST_SENT,
-  WRITE_RESPONSE_RECEIVED,
   DISCONNECTING,
   DISCONNECTED
 };
@@ -91,52 +77,25 @@ int main() {
   printf("SUCCESS\n");
 
   // Manually register the "simulated" driver with the system.
-  /*printf("Registering driver for the 'simulated' protocol ... ");
-  plc4c_driver *simulated_driver = plc4c_driver_simulated_create();
-  result = plc4c_system_add_driver(system, simulated_driver);
-  if (result != OK) {
-    printf("FAILED adding simulated driver\n");
-    return -1;
-  }*/
-  printf("Registering driver for the 's7' protocol ... ");
-  plc4c_driver *s7_driver = plc4c_driver_s7_create();
-  result = plc4c_system_add_driver(system, s7_driver);
-  if (result != OK) {
-    printf("FAILED adding s7 driver\n");
-    return -1;
-  }
-  /*printf("Registering driver for the 'modbus' protocol ... ");
+  printf("Registering driver for the 'modbus' protocol ... ");
   plc4c_driver *modbus_driver = plc4c_driver_modbus_create();
   result = plc4c_system_add_driver(system, modbus_driver);
   if (result != OK) {
     printf("FAILED adding modbus driver\n");
     return -1;
-  }*/
+  }
   printf("SUCCESS\n");
 
-  /*printf("Registering transport for the 'dummy' transport ... ");
-  plc4c_transport *dummy_transport = plc4c_transport_dummy_create();
-  result = plc4c_system_add_transport(system, dummy_transport);
-  if (result != OK) {
-    printf("FAILED adding dummy transport\n");
-    return -1;
-  }*/
   plc4c_transport *tcp_transport = plc4c_transport_tcp_create();
   result = plc4c_system_add_transport(system, tcp_transport);
   if (result != OK) {
     printf("FAILED adding tcp transport\n");
     return -1;
   }
-  /*plc4c_transport *serial_transport = plc4c_transport_serial_create();
-  result = plc4c_system_add_transport(system, serial_transport);
-  if (result != OK) {
-    printf("FAILED adding serial transport\n");
-    return -1;
-  }*/
   printf("SUCCESS\n");
 
-  // Initialize the plc4c_system (loading of drivers, setting up other stuff,
-  // ...)
+  // Initialize the plc4c_system
+  // (loading of drivers, setting up other stuff ...)
   printf(
       "Initializing the PLC4C system (Loading of drivers and transports) ... ");
   result = plc4c_system_init(system);
@@ -152,8 +111,8 @@ int main() {
 
   // Establish connections to remote devices
   // you may or may not care about the connection handle
-  printf("Connecting to 's7:tcp://192.168.23.30' ... ");
-  result = plc4c_system_connect(system, "s7:tcp://192.168.23.30", &connection);
+  printf("Connecting to 'modbus:tcp://192.168.23.30' ... ");
+  result = plc4c_system_connect(system, "modbus:tcp://192.168.23.30", &connection);
   if (result != OK) {
     printf("FAILED\n");
     return -1;
@@ -196,118 +155,96 @@ int main() {
         printf("SUCCESS\n");
 
         result =
-            plc4c_read_request_add_item(read_request, "BOOL", "%DB4:0.0:BOOL");
+            plc4c_read_request_add_item(read_request, "BOOL", "holding-register:1:BOOL");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "BYTE", "%DB4.1:BYTE");
+            plc4c_read_request_add_item(read_request, "BYTE", "holding-register:2:BYTE");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "WORD", "%DB4.2:WORD");
+            plc4c_read_request_add_item(read_request, "WORD", "holding-register:3:WORD");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "DWORD", "%DB4.4:DWORD");
+            plc4c_read_request_add_item(read_request, "DWORD", "holding-register:4:DWORD");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "SINT", "%DB4.16:SINT");
+            plc4c_read_request_add_item(read_request, "LWORD", "holding-register:6:LWORD");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "USINT", "%DB4.17:USINT");
+            plc4c_read_request_add_item(read_request, "SINT", "holding-register:10:SINT");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "INT", "%DB4.18:INT");
+            plc4c_read_request_add_item(read_request, "USINT", "holding-register:11:USINT");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "UINT", "%DB4.20:UINT");
+            plc4c_read_request_add_item(read_request, "INT", "holding-register:12:INT");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "DINT", "%DB4.22:DINT");
+            plc4c_read_request_add_item(read_request, "UINT", "holding-register:13:UINT");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "UDINT", "%DB4.26:UDINT");
+            plc4c_read_request_add_item(read_request, "DINT", "holding-register:14:DINT");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "REAL", "%DB4.46:REAL");
+            plc4c_read_request_add_item(read_request, "UDINT", "holding-register:16:UDINT");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "TIME", "%DB4:58:TIME");
+            plc4c_read_request_add_item(read_request, "LINT", "holding-register:18:LINT");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "DATE", "%DB4:70:DATE");
-        if (result != OK) {
-          printf("FAILED\n");
-          return -1;
-        }
-        result = plc4c_read_request_add_item(read_request, "TIME_OF_DAY",
-                                             "%DB4:72:TIME_OF_DAY");
+            plc4c_read_request_add_item(read_request, "ULINT", "holding-register:22:ULINT");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "TOD", "%DB4:76:TOD");
+            plc4c_read_request_add_item(read_request, "REAL", "holding-register:26:REAL");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         result =
-            plc4c_read_request_add_item(read_request, "CHAR", "%DB4:136:CHAR");
-        if (result != OK) {
-          printf("FAILED\n");
-          return -1;
-        }
-        // UTF-16 doesn't work well in a portable way
-        /*result =
-            plc4c_read_request_add_item(read_request, "WCHAR",
-        "%DB4:138:WCHAR"); if (result != OK) { printf("FAILED\n"); return -1;
-        }*/
-        result = plc4c_read_request_add_item(read_request, "STRING",
-                                             "%DB4:140:STRING(10)");
+            plc4c_read_request_add_item(read_request, "REAL", "holding-register:26:LREAL");
         if (result != OK) {
           printf("FAILED\n");
           return -1;
         }
         // UTF-16 doesn't work well in a portable way
-        /*result =
-               plc4c_read_request_add_item(read_request, "WSTRING",
-           "%DB4:396:WSTRING(10)"); if (result != OK) { printf("FAILED\n");
-             return -1;
-           }*/
         printf("SUCCESS\n");
 
         // Execute the read-request.
@@ -323,7 +260,7 @@ int main() {
         }
         break;
       }
-        // Wait until the read-request execution is finished.
+      // Wait until the read-request execution is finished.
       case READ_REQUEST_SENT: {
         if (plc4c_read_request_execution_check_finished_successfully(
                 read_request_execution)) {
@@ -373,7 +310,6 @@ int main() {
         plc4c_read_request_execution_destroy(read_request_execution);
         plc4c_read_request_destroy(read_request);
 
-        // TODO: Comment out after implementing the write functionality.
         // Disconnect.
         printf("Disconnecting ... ");
         result = plc4c_connection_disconnect(connection);
@@ -383,77 +319,9 @@ int main() {
         }
         state = DISCONNECTING;
 
-        // Create a new write-request.
-        /*        printf("Preparing a write-request ... ");
-                char value[] = "bar";
-                result =
-                    plc4c_connection_create_write_request(connection,
-           &write_request); if (result != OK) { printf("FAILED\n"); return -1;
-                }
-                printf("SUCCESS\n");
-
-                printf("Adding an item for 'STDOUT/foo:INTEGER' ... ");
-                result = plc4c_write_request_add_item(
-                    write_request, "STDOUT/foo:STRING",
-                    plc4c_data_create_constant_string_data(strlen(value),
-           value)); if (result != OK) { printf("FAILED\n"); return -1;
-                }
-                printf("SUCCESS\n");
-
-                // Execute the write-request.
-                printf("Executing a write-request ... \n");
-                result = plc4c_write_request_execute(write_request,
-                                                     &write_request_execution);
-                if (result != OK) {
-                  printf("FAILED\n");
-                  return -1;
-                } else {
-                  state = WRITE_REQUEST_SENT;
-                }*/
-        break;
-      }
-        // Wait until the write-request execution is finished.
-      case WRITE_REQUEST_SENT: {
-        if (plc4c_write_request_check_finished_successfully(
-                write_request_execution)) {
-          printf("SUCCESS\n");
-          state = WRITE_RESPONSE_RECEIVED;
-        } else if (plc4c_write_request_execution_check_completed_with_error(
-                       write_request_execution)) {
-          printf("FAILED\n");
-          return -1;
-        }
-        break;
-      }
-      case WRITE_RESPONSE_RECEIVED: {
-        plc4c_write_response *write_response =
-            plc4c_write_request_execution_get_response(write_request_execution);
-
-        // Iterate over the responses ...
-        plc4c_list_element *cur_element =
-            plc4c_utils_list_head(write_response->response_items);
-        while (cur_element != NULL) {
-          plc4c_response_item *response_item = cur_element->value;
-          printf(" - Write Value %s (%s)\n", response_item->item->name,
-                 plc4c_response_code_to_message(response_item->response_code));
-          cur_element = cur_element->next;
-        }
-
-        // Clean up.
-        plc4c_write_destroy_write_response(write_response);
-        plc4c_write_request_execution_destroy(write_request_execution);
-
-        // Disconnect.
-        printf("Disconnecting ... ");
-        result = plc4c_connection_disconnect(connection);
-        if (result != OK) {
-          printf("FAILED");
-          return -1;
-        }
-        state = DISCONNECTING;
         break;
       }
-        // Wait until the connection is disconnected
+      // Wait until the connection is disconnected
       case DISCONNECTING: {
         if (!plc4c_connection_get_connected(connection)) {
           printf("SUCCESS\n");
diff --git a/sandbox/plc4c/examples/hello-world/CMakeLists.txt b/sandbox/plc4c/examples/hello-world-s7/CMakeLists.txt
similarity index 78%
rename from sandbox/plc4c/examples/hello-world/CMakeLists.txt
rename to sandbox/plc4c/examples/hello-world-s7/CMakeLists.txt
index 5b0caf4..27b4492 100644
--- a/sandbox/plc4c/examples/hello-world/CMakeLists.txt
+++ b/sandbox/plc4c/examples/hello-world-s7/CMakeLists.txt
@@ -21,23 +21,19 @@ include_directories("../../api/include"
         "../../drivers/s7/include"
         "../../transports/tcp/include" )
 
-add_executable(plc4c-examples-hello-world
-        src/hello_world.c
+add_executable(plc4c-examples-hello-world-s7
+        src/hello_world_s7.c
         )
 
 IF (NOT WIN32)
-    target_link_libraries(plc4c-examples-hello-world
+    target_link_libraries(plc4c-examples-hello-world-s7
             plc4c-spi
-            plc4c-driver-simulated
             plc4c-driver-s7
-            plc4c-driver-modbus
-            plc4c-transport-dummy
             plc4c-transport-tcp
-            plc4c-transport-serial
             m
     )
 ELSE()
-    target_link_libraries(plc4c-examples-hello-world
+    target_link_libraries(plc4c-examples-hello-world-s7
             plc4c-spi
             plc4c-driver-s7
             plc4c-transport-tcp
diff --git a/sandbox/plc4c/examples/hello-world/src/hello_world.c b/sandbox/plc4c/examples/hello-world-s7/src/hello_world_s7.c
similarity index 70%
rename from sandbox/plc4c/examples/hello-world/src/hello_world.c
rename to sandbox/plc4c/examples/hello-world-s7/src/hello_world_s7.c
index 86c5d2e..bb9faae 100644
--- a/sandbox/plc4c/examples/hello-world/src/hello_world.c
+++ b/sandbox/plc4c/examples/hello-world-s7/src/hello_world_s7.c
@@ -16,13 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-//#include <plc4c/driver_simulated.h>
 #include <plc4c/driver_s7.h>
-//#include <plc4c/driver_modbus.h>
 #include <plc4c/plc4c.h>
-//#include <plc4c/transport_dummy.h>
 #include <plc4c/transport_tcp.h>
-//#include <plc4c/transport_serial.h>
 #include <plc4c/utils/list.h>
 #include <stdio.h>
 #include <string.h>
@@ -50,20 +46,11 @@ void onGlobalDisconnect(plc4c_connection *cur_connection) {
   numOpenConnections--;
 }
 
-void delete_read_response_item(plc4c_list_element *response_read_item_element) {
-
-}
-
-void delete_write_response_item(
-    plc4c_list_element *response_write_item_element) {}
-
 enum plc4c_connection_state_t {
   CONNECTING,
   CONNECTED,
   READ_REQUEST_SENT,
   READ_RESPONSE_RECEIVED,
-  WRITE_REQUEST_SENT,
-  WRITE_RESPONSE_RECEIVED,
   DISCONNECTING,
   DISCONNECTED
 };
@@ -91,13 +78,6 @@ int main() {
   printf("SUCCESS\n");
 
   // Manually register the "simulated" driver with the system.
-  /*printf("Registering driver for the 'simulated' protocol ... ");
-  plc4c_driver *simulated_driver = plc4c_driver_simulated_create();
-  result = plc4c_system_add_driver(system, simulated_driver);
-  if (result != OK) {
-    printf("FAILED adding simulated driver\n");
-    return -1;
-  }*/
   printf("Registering driver for the 's7' protocol ... ");
   plc4c_driver *s7_driver = plc4c_driver_s7_create();
   result = plc4c_system_add_driver(system, s7_driver);
@@ -105,38 +85,18 @@ int main() {
     printf("FAILED adding s7 driver\n");
     return -1;
   }
-  /*printf("Registering driver for the 'modbus' protocol ... ");
-  plc4c_driver *modbus_driver = plc4c_driver_modbus_create();
-  result = plc4c_system_add_driver(system, modbus_driver);
-  if (result != OK) {
-    printf("FAILED adding modbus driver\n");
-    return -1;
-  }*/
   printf("SUCCESS\n");
 
-  /*printf("Registering transport for the 'dummy' transport ... ");
-  plc4c_transport *dummy_transport = plc4c_transport_dummy_create();
-  result = plc4c_system_add_transport(system, dummy_transport);
-  if (result != OK) {
-    printf("FAILED adding dummy transport\n");
-    return -1;
-  }*/
   plc4c_transport *tcp_transport = plc4c_transport_tcp_create();
   result = plc4c_system_add_transport(system, tcp_transport);
   if (result != OK) {
     printf("FAILED adding tcp transport\n");
     return -1;
   }
-  /*plc4c_transport *serial_transport = plc4c_transport_serial_create();
-  result = plc4c_system_add_transport(system, serial_transport);
-  if (result != OK) {
-    printf("FAILED adding serial transport\n");
-    return -1;
-  }*/
   printf("SUCCESS\n");
 
-  // Initialize the plc4c_system (loading of drivers, setting up other stuff,
-  // ...)
+  // Initialize the plc4c_system
+  // (loading of drivers, setting up other stuff ...)
   printf(
       "Initializing the PLC4C system (Loading of drivers and transports) ... ");
   result = plc4c_system_init(system);
@@ -292,10 +252,6 @@ int main() {
           return -1;
         }
         // UTF-16 doesn't work well in a portable way
-        /*result =
-            plc4c_read_request_add_item(read_request, "WCHAR",
-        "%DB4:138:WCHAR"); if (result != OK) { printf("FAILED\n"); return -1;
-        }*/
         result = plc4c_read_request_add_item(read_request, "STRING",
                                              "%DB4:140:STRING(10)");
         if (result != OK) {
@@ -303,11 +259,6 @@ int main() {
           return -1;
         }
         // UTF-16 doesn't work well in a portable way
-        /*result =
-               plc4c_read_request_add_item(read_request, "WSTRING",
-           "%DB4:396:WSTRING(10)"); if (result != OK) { printf("FAILED\n");
-             return -1;
-           }*/
         printf("SUCCESS\n");
 
         // Execute the read-request.
@@ -323,7 +274,7 @@ int main() {
         }
         break;
       }
-        // Wait until the read-request execution is finished.
+      // Wait until the read-request execution is finished.
       case READ_REQUEST_SENT: {
         if (plc4c_read_request_execution_check_finished_successfully(
                 read_request_execution)) {
@@ -373,7 +324,6 @@ int main() {
         plc4c_read_request_execution_destroy(read_request_execution);
         plc4c_read_request_destroy(read_request);
 
-        // TODO: Comment out after implementing the write functionality.
         // Disconnect.
         printf("Disconnecting ... ");
         result = plc4c_connection_disconnect(connection);
@@ -383,77 +333,9 @@ int main() {
         }
         state = DISCONNECTING;
 
-        // Create a new write-request.
-        /*        printf("Preparing a write-request ... ");
-                char value[] = "bar";
-                result =
-                    plc4c_connection_create_write_request(connection,
-           &write_request); if (result != OK) { printf("FAILED\n"); return -1;
-                }
-                printf("SUCCESS\n");
-
-                printf("Adding an item for 'STDOUT/foo:INTEGER' ... ");
-                result = plc4c_write_request_add_item(
-                    write_request, "STDOUT/foo:STRING",
-                    plc4c_data_create_constant_string_data(strlen(value),
-           value)); if (result != OK) { printf("FAILED\n"); return -1;
-                }
-                printf("SUCCESS\n");
-
-                // Execute the write-request.
-                printf("Executing a write-request ... \n");
-                result = plc4c_write_request_execute(write_request,
-                                                     &write_request_execution);
-                if (result != OK) {
-                  printf("FAILED\n");
-                  return -1;
-                } else {
-                  state = WRITE_REQUEST_SENT;
-                }*/
-        break;
-      }
-        // Wait until the write-request execution is finished.
-      case WRITE_REQUEST_SENT: {
-        if (plc4c_write_request_check_finished_successfully(
-                write_request_execution)) {
-          printf("SUCCESS\n");
-          state = WRITE_RESPONSE_RECEIVED;
-        } else if (plc4c_write_request_execution_check_completed_with_error(
-                       write_request_execution)) {
-          printf("FAILED\n");
-          return -1;
-        }
-        break;
-      }
-      case WRITE_RESPONSE_RECEIVED: {
-        plc4c_write_response *write_response =
-            plc4c_write_request_execution_get_response(write_request_execution);
-
-        // Iterate over the responses ...
-        plc4c_list_element *cur_element =
-            plc4c_utils_list_head(write_response->response_items);
-        while (cur_element != NULL) {
-          plc4c_response_item *response_item = cur_element->value;
-          printf(" - Write Value %s (%s)\n", response_item->item->name,
-                 plc4c_response_code_to_message(response_item->response_code));
-          cur_element = cur_element->next;
-        }
-
-        // Clean up.
-        plc4c_write_destroy_write_response(write_response);
-        plc4c_write_request_execution_destroy(write_request_execution);
-
-        // Disconnect.
-        printf("Disconnecting ... ");
-        result = plc4c_connection_disconnect(connection);
-        if (result != OK) {
-          printf("FAILED");
-          return -1;
-        }
-        state = DISCONNECTING;
         break;
       }
-        // Wait until the connection is disconnected
+      // Wait until the connection is disconnected
       case DISCONNECTING: {
         if (!plc4c_connection_get_connected(connection)) {
           printf("SUCCESS\n");