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 2022/08/22 08:23:18 UTC

[plc4x] branch feature/ads-symbol-discovery updated: chore(plc4j/ads): Refactored the ADS driver to require less input. - Also noticed the integration tests seem to be ignored in Java and tried fixing them

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

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


The following commit(s) were added to refs/heads/feature/ads-symbol-discovery by this push:
     new 640aa4f12 chore(plc4j/ads): Refactored the ADS driver to require less input. - Also noticed the integration tests seem to be ignored in Java and tried fixing them
640aa4f12 is described below

commit 640aa4f121d712e21b0cc21e85c6ea06548e374b
Author: Christofer Dutz <ch...@rivian.com>
AuthorDate: Mon Aug 22 10:23:09 2022 +0200

    chore(plc4j/ads): Refactored the ADS driver to require less input.
    - Also noticed the integration tests seem to be ignored in Java and tried fixing them
---
 .../plc4x/include/plc4x_subscription_type.h        |  58 ++++++++++++
 .../plc4x/src/plc4x_subscription_type.c            | 103 +++++++++++++++++++++
 2 files changed, 161 insertions(+)

diff --git a/plc4c/generated-sources/plc4x/include/plc4x_subscription_type.h b/plc4c/generated-sources/plc4x/include/plc4x_subscription_type.h
new file mode 100644
index 000000000..811243dbe
--- /dev/null
+++ b/plc4c/generated-sources/plc4x/include/plc4x_subscription_type.h
@@ -0,0 +1,58 @@
+/*
+ * 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
+ *
+ *   https://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 PLC4C_PLC4X_READ_WRITE_PLC4X_SUBSCRIPTION_TYPE_H_
+#define PLC4C_PLC4X_READ_WRITE_PLC4X_SUBSCRIPTION_TYPE_H_
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <plc4c/spi/read_buffer.h>
+#include <plc4c/spi/write_buffer.h>
+
+// Code generated by code-generation. DO NOT EDIT.
+
+
+enum plc4c_plc4x_read_write_plc4x_subscription_type {
+  plc4c_plc4x_read_write_plc4x_subscription_type_CYCLIC = 0x01,
+  plc4c_plc4x_read_write_plc4x_subscription_type_CHANGE_OF_STATE = 0x02,
+  plc4c_plc4x_read_write_plc4x_subscription_type_EVENT = 0x03
+};
+typedef enum plc4c_plc4x_read_write_plc4x_subscription_type plc4c_plc4x_read_write_plc4x_subscription_type;
+
+// Get an empty NULL-struct
+plc4c_plc4x_read_write_plc4x_subscription_type plc4c_plc4x_read_write_plc4x_subscription_type_null();
+
+plc4c_return_code plc4c_plc4x_read_write_plc4x_subscription_type_parse(plc4c_spi_read_buffer* readBuffer, plc4c_plc4x_read_write_plc4x_subscription_type* message);
+
+plc4c_return_code plc4c_plc4x_read_write_plc4x_subscription_type_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_plc4x_read_write_plc4x_subscription_type* message);
+
+plc4c_plc4x_read_write_plc4x_subscription_type plc4c_plc4x_read_write_plc4x_subscription_type_for_value(uint8_t value);
+
+plc4c_plc4x_read_write_plc4x_subscription_type plc4c_plc4x_read_write_plc4x_subscription_type_value_of(char* value_string);
+
+int plc4c_plc4x_read_write_plc4x_subscription_type_num_values();
+
+plc4c_plc4x_read_write_plc4x_subscription_type plc4c_plc4x_read_write_plc4x_subscription_type_value_for_index(int index);
+
+uint16_t plc4c_plc4x_read_write_plc4x_subscription_type_length_in_bytes(plc4c_plc4x_read_write_plc4x_subscription_type* message);
+
+uint16_t plc4c_plc4x_read_write_plc4x_subscription_type_length_in_bits(plc4c_plc4x_read_write_plc4x_subscription_type* message);
+
+
+#endif  // PLC4C_PLC4X_READ_WRITE_PLC4X_SUBSCRIPTION_TYPE_H_
diff --git a/plc4c/generated-sources/plc4x/src/plc4x_subscription_type.c b/plc4c/generated-sources/plc4x/src/plc4x_subscription_type.c
new file mode 100644
index 000000000..29535bf63
--- /dev/null
+++ b/plc4c/generated-sources/plc4x/src/plc4x_subscription_type.c
@@ -0,0 +1,103 @@
+/*
+ * 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
+ *
+ *   https://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 <string.h>
+#include <plc4c/driver_plc4x_static.h>
+
+#include "plc4x_subscription_type.h"
+
+// Code generated by code-generation. DO NOT EDIT.
+
+
+// Create an empty NULL-struct
+static const plc4c_plc4x_read_write_plc4x_subscription_type plc4c_plc4x_read_write_plc4x_subscription_type_null_const;
+
+plc4c_plc4x_read_write_plc4x_subscription_type plc4c_plc4x_read_write_plc4x_subscription_type_null() {
+  return plc4c_plc4x_read_write_plc4x_subscription_type_null_const;
+}
+
+// Parse function.
+plc4c_return_code plc4c_plc4x_read_write_plc4x_subscription_type_parse(plc4c_spi_read_buffer* readBuffer, plc4c_plc4x_read_write_plc4x_subscription_type* _message) {
+    plc4c_return_code _res = OK;
+
+    uint8_t value;
+    _res = plc4c_spi_read_unsigned_byte(readBuffer, 8, (uint8_t*) &value);
+    *_message = plc4c_plc4x_read_write_plc4x_subscription_type_for_value(value);
+
+    return _res;
+}
+
+plc4c_return_code plc4c_plc4x_read_write_plc4x_subscription_type_serialize(plc4c_spi_write_buffer* writeBuffer, plc4c_plc4x_read_write_plc4x_subscription_type* _message) {
+    plc4c_return_code _res = OK;
+
+    _res = plc4c_spi_write_unsigned_byte(writeBuffer, 8, *_message);
+
+    return _res;
+}
+
+plc4c_plc4x_read_write_plc4x_subscription_type plc4c_plc4x_read_write_plc4x_subscription_type_for_value(uint8_t value) {
+    for(int i = 0; i < plc4c_plc4x_read_write_plc4x_subscription_type_num_values(); i++) {
+        if(plc4c_plc4x_read_write_plc4x_subscription_type_value_for_index(i) == value) {
+            return plc4c_plc4x_read_write_plc4x_subscription_type_value_for_index(i);
+        }
+    }
+    return -1;
+}
+
+plc4c_plc4x_read_write_plc4x_subscription_type plc4c_plc4x_read_write_plc4x_subscription_type_value_of(char* value_string) {
+    if(strcmp(value_string, "CYCLIC") == 0) {
+        return plc4c_plc4x_read_write_plc4x_subscription_type_CYCLIC;
+    }
+    if(strcmp(value_string, "CHANGE_OF_STATE") == 0) {
+        return plc4c_plc4x_read_write_plc4x_subscription_type_CHANGE_OF_STATE;
+    }
+    if(strcmp(value_string, "EVENT") == 0) {
+        return plc4c_plc4x_read_write_plc4x_subscription_type_EVENT;
+    }
+    return -1;
+}
+
+int plc4c_plc4x_read_write_plc4x_subscription_type_num_values() {
+  return 3;
+}
+
+plc4c_plc4x_read_write_plc4x_subscription_type plc4c_plc4x_read_write_plc4x_subscription_type_value_for_index(int index) {
+    switch(index) {
+      case 0: {
+        return plc4c_plc4x_read_write_plc4x_subscription_type_CYCLIC;
+      }
+      case 1: {
+        return plc4c_plc4x_read_write_plc4x_subscription_type_CHANGE_OF_STATE;
+      }
+      case 2: {
+        return plc4c_plc4x_read_write_plc4x_subscription_type_EVENT;
+      }
+      default: {
+        return -1;
+      }
+    }
+}
+
+uint16_t plc4c_plc4x_read_write_plc4x_subscription_type_length_in_bytes(plc4c_plc4x_read_write_plc4x_subscription_type* _message) {
+    return plc4c_plc4x_read_write_plc4x_subscription_type_length_in_bits(_message) / 8;
+}
+
+uint16_t plc4c_plc4x_read_write_plc4x_subscription_type_length_in_bits(plc4c_plc4x_read_write_plc4x_subscription_type* _message) {
+    return 8;
+}