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/09/21 09:26:25 UTC

[plc4x] branch develop updated: Updated the Knx related tools a bit ...

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 be1e72d  Updated the Knx related tools a bit ...
be1e72d is described below

commit be1e72d72f591cd1e75f28e819363f4d84534cc4
Author: cdutz <ch...@c-ware.de>
AuthorDate: Tue Sep 21 11:26:15 2021 +0200

    Updated the Knx related tools a bit ...
---
 .../protocol/knxnetip/KnxDefinitionsGenerator.java | 36 +++++++++++-----------
 .../knxnetip/KnxSpecificationStoreUpdater.java     | 10 ++++++
 2 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxDefinitionsGenerator.java b/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxDefinitionsGenerator.java
index e21c92e..7153e42 100644
--- a/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxDefinitionsGenerator.java
+++ b/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxDefinitionsGenerator.java
@@ -34,24 +34,24 @@ import java.util.*;
 
 public class KnxDefinitionsGenerator {
 
-    public static final String HEADER = "//\n" +
-        "// Licensed to the Apache Software Foundation (ASF) under one\n" +
-        "// or more contributor license agreements. See the NOTICE file\n" +
-        "// distributed with this work for additional information\n" +
-        "// regarding copyright ownership. The ASF licenses this file\n" +
-        "// to you under the Apache License, Version 2.0 (the\n" +
-        "// \"License\"); you may not use this file except in compliance\n" +
-        "// with the License. You may obtain a copy of the License at\n" +
-        "//\n" +
-        "// http://www.apache.org/licenses/LICENSE-2.0\n" +
-        "//\n" +
-        "// Unless required by applicable law or agreed to in writing,\n" +
-        "// software distributed under the License is distributed on an\n" +
-        "// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n" +
-        "// KIND, either express or implied. See the License for the\n" +
-        "// specific language governing permissions and limitations\n" +
-        "// under the License.\n" +
-        "//\n" +
+    public static final String HEADER = "/*\n" +
+        " * Licensed to the Apache Software Foundation (ASF) under one\n" +
+        " * or more contributor license agreements.  See the NOTICE file\n" +
+        " * distributed with this work for additional information\n" +
+        " * regarding copyright ownership.  The ASF licenses this file\n" +
+        " * to you under the Apache License, Version 2.0 (the\n" +
+        " * \"License\"); you may not use this file except in compliance\n" +
+        " * with the License.  You may obtain a copy of the License at\n" +
+        " *\n" +
+        " *   http://www.apache.org/licenses/LICENSE-2.0\n" +
+        " *\n" +
+        " * Unless required by applicable law or agreed to in writing,\n" +
+        " * software distributed under the License is distributed on an\n" +
+        " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n" +
+        " * KIND, either express or implied.  See the License for the\n" +
+        " * specific language governing permissions and limitations\n" +
+        " * under the License.\n" +
+        " */\n\n" +
         "\n" +
         "[enum uint 16 'DeviceInformation' [uint 16 'deviceDescriptor', string 'name', uint 16 'comObjectTableAddress']\n";
 
diff --git a/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxSpecificationStoreUpdater.java b/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxSpecificationStoreUpdater.java
index 9fca4d7..d294348 100644
--- a/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxSpecificationStoreUpdater.java
+++ b/protocols/knxnetip/src/test/java/org/apache/plc4x/protocol/knxnetip/KnxSpecificationStoreUpdater.java
@@ -136,12 +136,20 @@ public class KnxSpecificationStoreUpdater {
                     int applicationId = applicationIdentifier.getInt(2) << 8 | applicationIdentifier.getInt(3);
                     int applicationVersion = applicationIdentifier.getInt(4) & 0xFF;
 
+                    if(applicationId == 0 && applicationVersion == 0) {
+                        System.out.println("SKIPPED");
+                        continue;
+                    }
+
                     String productCode = String.format("M-%04X_A-%04X-%02X", manufacturerId, applicationId, applicationVersion);
 
+                    System.out.print("Fetching product: " + productCode + ": ");
+
                     // Check If we've already got that file (There are no updates, just new versions)
                     File[] files = manufacturerDirectory.listFiles((dir, name) -> name.startsWith(productCode));
                     // If we've already got the file, skip loading it
                     if(files.length > 0) {
+                        System.out.println("SKIPPED");
                         continue;
                     }
 
@@ -155,6 +163,7 @@ public class KnxSpecificationStoreUpdater {
                                 // Create an empty file indicating it's not in the catalog so we won't try to fetch it again.
                                 File dummy = new File(manufacturerDirectory, productCode + ".failed");
                                 dummy.createNewFile();
+                                System.out.println("FAILED");
                             } else {
                                 System.out.println("Got an unexpected status code " + downloadProductResponse.getStatusLine().getStatusCode());
                             }
@@ -167,6 +176,7 @@ public class KnxSpecificationStoreUpdater {
                                     if (fileName.startsWith(expectedPrefix)) {
                                         File productFile = new File(manufacturerDirectory, fileName.substring(fileName.indexOf('/') + 1));
                                         FileUtils.copyInputStreamToFile(zis, productFile);
+                                        System.out.println("SUCCESS");
                                         break;
                                     }
                                 }