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 2020/10/26 15:46:44 UTC

[plc4x] 02/02: - Added the parse-char stuff to plc4c

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

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

commit fd80b897b6e9888c664853d05486f5a2a9e8fefe
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Oct 26 16:46:35 2020 +0100

    - Added the parse-char stuff to plc4c
---
 sandbox/plc4c/drivers/s7/include/plc4c/driver_s7.h |  2 ++
 sandbox/plc4c/drivers/s7/src/driver_s7.c           |  5 +++++
 sandbox/plc4c/generated-sources/s7/src/data_item.c | 10 ++++++++++
 3 files changed, 17 insertions(+)

diff --git a/sandbox/plc4c/drivers/s7/include/plc4c/driver_s7.h b/sandbox/plc4c/drivers/s7/include/plc4c/driver_s7.h
index 715a867..9e12392 100644
--- a/sandbox/plc4c/drivers/s7/include/plc4c/driver_s7.h
+++ b/sandbox/plc4c/drivers/s7/include/plc4c/driver_s7.h
@@ -73,6 +73,8 @@ plc4c_driver *plc4c_driver_s7_create();
 
 char* plc4c_s7_read_write_parse_s7_string(plc4c_spi_read_buffer* io, int32_t stringLength, char* encoding);
 
+char* plc4c_s7_read_write_parse_s7_char(plc4c_spi_read_buffer* io, char* encoding);
+
 time_t plc4c_s7_read_write_parse_tia_time(plc4c_spi_read_buffer* io);
 
 time_t plc4c_s7_read_write_parse_s5_time(plc4c_spi_read_buffer* io);
diff --git a/sandbox/plc4c/drivers/s7/src/driver_s7.c b/sandbox/plc4c/drivers/s7/src/driver_s7.c
index 9f897db..2cfd568 100644
--- a/sandbox/plc4c/drivers/s7/src/driver_s7.c
+++ b/sandbox/plc4c/drivers/s7/src/driver_s7.c
@@ -75,6 +75,11 @@ char* plc4c_s7_read_write_parse_s7_string(plc4c_spi_read_buffer* io, int32_t str
   return "";
 }
 
+char* plc4c_s7_read_write_parse_s7_char(plc4c_spi_read_buffer* io, char* encoding) {
+  // TODO: Implement ...
+  return "";
+}
+
 time_t plc4c_s7_read_write_parse_tia_time(plc4c_spi_read_buffer* io) {
   // TODO: Implement ...
   return 0;
diff --git a/sandbox/plc4c/generated-sources/s7/src/data_item.c b/sandbox/plc4c/generated-sources/s7/src/data_item.c
index 9cfb060..db44784 100644
--- a/sandbox/plc4c/generated-sources/s7/src/data_item.c
+++ b/sandbox/plc4c/generated-sources/s7/src/data_item.c
@@ -191,6 +191,16 @@ plc4c_return_code plc4c_s7_read_write_data_item_parse(plc4c_spi_read_buffer* io,
                 *data_item = plc4c_data_create_double_data(value);
 
         } else 
+        if(dataProtocolId == 41) { /* CHAR */
+
+                    // Manual Field (value)
+                    char* value = (char*) (plc4c_s7_read_write_parse_s7_char(io, "UTF-8"));
+        } else 
+        if(dataProtocolId == 42) { /* CHAR */
+
+                    // Manual Field (value)
+                    char* value = (char*) (plc4c_s7_read_write_parse_s7_char(io, "UTF-16"));
+        } else 
         if(dataProtocolId == 43) { /* STRING */
 
                     // Manual Field (value)