From 537b5e4deabf796305a3db539c7b9b31ed8f4023 Mon Sep 17 00:00:00 2001
From: Fischertechnik-OpenSource <fischertechnik-opensource@online.de>
Date: Wed, 12 Feb 2025 11:47:26 +0100
Subject: [PATCH] Update to 3.1.8

---
 openapi.json                                  |  3 ++
 txtapi/requirements.txt                       |  2 +-
 txtapi/setup.py                               |  2 +-
 txtapi/txtapi/models/line_detector.py         | 32 +++++++++++++++++--
 txtapi/txtapi/openapi/openapi.yaml            |  2 ++
 txtapi/txtapi/txt/txt.py                      |  3 +-
 .../utility/debugger/response_converter.py    | 26 +++++++++++----
 7 files changed, 57 insertions(+), 13 deletions(-)

diff --git a/openapi.json b/openapi.json
index 79084c1..f611040 100644
--- a/openapi.json
+++ b/openapi.json
@@ -3954,6 +3954,9 @@
             "type": "integer",
             "format": "int32",
             "default": 1
+          },
+          "invert": {
+            "type": "boolean"
           }
         },
         "x-body-name": "line_detector"
diff --git a/txtapi/requirements.txt b/txtapi/requirements.txt
index da027c3..d208762 100644
--- a/txtapi/requirements.txt
+++ b/txtapi/requirements.txt
@@ -4,7 +4,7 @@ python_dateutil==2.6.0
 setuptools==41.4.0
 Flask-Cors==3.0.6
 rpdb==0.1.6
-ft-controllerlib==6.2.1
+ft-controllerlib==6.3.0
 Werkzeug==0.16.1
 waitress>=1.4.4
 psutil==5.7.3
diff --git a/txtapi/setup.py b/txtapi/setup.py
index e0ca077..c196bca 100644
--- a/txtapi/setup.py
+++ b/txtapi/setup.py
@@ -20,7 +20,7 @@ REQUIRES = [
     "Flask-Cors==3.0.6",
     "rpdb==0.1.6",
     "websockets==7.0",
-    "ft-controllerlib==6.2.1",
+    "ft-controllerlib==6.3.0",
     "jsonschema==3.2.0",
     "Werkzeug==0.16.1",
     "waitress>=1.4.4",
diff --git a/txtapi/txtapi/models/line_detector.py b/txtapi/txtapi/models/line_detector.py
index f0a5ffa..f682983 100644
--- a/txtapi/txtapi/models/line_detector.py
+++ b/txtapi/txtapi/models/line_detector.py
@@ -17,7 +17,7 @@ class LineDetector(Model):
     Do not edit the class manually.
     """
 
-    def __init__(self, name=None, area=None, min_line_width=5, max_line_width=20, start_range_value=-100, end_range_value=100, number_of_lines=1):  # noqa: E501
+    def __init__(self, name=None, area=None, min_line_width=5, max_line_width=20, start_range_value=-100, end_range_value=100, number_of_lines=1, invert=None):  # noqa: E501
         """LineDetector - a model defined in OpenAPI
 
         :param name: The name of this LineDetector.  # noqa: E501
@@ -34,6 +34,8 @@ class LineDetector(Model):
         :type end_range_value: int
         :param number_of_lines: The number_of_lines of this LineDetector.  # noqa: E501
         :type number_of_lines: int
+        :param invert: The invert of this LineDetector.  # noqa: E501
+        :type invert: bool
         """
         self.openapi_types = {
             'name': str,
@@ -42,7 +44,8 @@ class LineDetector(Model):
             'max_line_width': int,
             'start_range_value': int,
             'end_range_value': int,
-            'number_of_lines': int
+            'number_of_lines': int,
+            'invert': bool
         }
 
         self.attribute_map = {
@@ -52,7 +55,8 @@ class LineDetector(Model):
             'max_line_width': 'max_line_width',
             'start_range_value': 'start_range_value',
             'end_range_value': 'end_range_value',
-            'number_of_lines': 'number_of_lines'
+            'number_of_lines': 'number_of_lines',
+            'invert': 'invert'
         }
 
         self._name = name
@@ -62,6 +66,7 @@ class LineDetector(Model):
         self._start_range_value = start_range_value
         self._end_range_value = end_range_value
         self._number_of_lines = number_of_lines
+        self._invert = invert
 
     @classmethod
     def from_dict(cls, dikt) -> 'LineDetector':
@@ -220,3 +225,24 @@ class LineDetector(Model):
         """
 
         self._number_of_lines = number_of_lines
+
+    @property
+    def invert(self):
+        """Gets the invert of this LineDetector.
+
+
+        :return: The invert of this LineDetector.
+        :rtype: bool
+        """
+        return self._invert
+
+    @invert.setter
+    def invert(self, invert):
+        """Sets the invert of this LineDetector.
+
+
+        :param invert: The invert of this LineDetector.
+        :type invert: bool
+        """
+
+        self._invert = invert
diff --git a/txtapi/txtapi/openapi/openapi.yaml b/txtapi/txtapi/openapi/openapi.yaml
index cf028fe..f5bf169 100644
--- a/txtapi/txtapi/openapi/openapi.yaml
+++ b/txtapi/txtapi/openapi/openapi.yaml
@@ -3729,6 +3729,8 @@ components:
           default: 1
           format: int32
           type: integer
+        invert:
+          type: boolean
       type: object
       x-body-name: line_detector
     controller:
diff --git a/txtapi/txtapi/txt/txt.py b/txtapi/txtapi/txt/txt.py
index 0e0bc68..7b4983e 100644
--- a/txtapi/txtapi/txt/txt.py
+++ b/txtapi/txtapi/txt/txt.py
@@ -191,7 +191,8 @@ class Txt:
                     line_config.max_line_width,
                     line_config.start_range_value,
                     line_config.end_range_value,
-                    line_config.number_of_lines
+                    line_config.number_of_lines,
+                    line_config.invert
                 )
                 line_detector.set_identifier(line_config.name)
                 camera.add_detector(line_detector)
diff --git a/txtapi/txtapi/utility/debugger/response_converter.py b/txtapi/txtapi/utility/debugger/response_converter.py
index 25fe80b..a5040ac 100644
--- a/txtapi/txtapi/utility/debugger/response_converter.py
+++ b/txtapi/txtapi/utility/debugger/response_converter.py
@@ -112,15 +112,21 @@ def convert_add_breakpoint_response(response: str) -> Breakpoint:
     pattern_entire_line = r"\ABreakpoint \d+ at " + re.escape(WORKSPACE_ABSPATH) + r".+:\d+"
     match = re.search(pattern_entire_line, response)
     if not match:
-        raise Exception("Could not set breakpoint: " + response)
+        return None
     response = match.group(0)
 
-    i_d = re.search(r"\d+", response)[0]
+    match = re.search(r"\d+", response)
+    if not match:
+        return None
+    i_d = match.group(0)
 
     pattern = r"(?<=" + re.escape(WORKSPACE_ABSPATH) + r").+" # matches everything after WORKSPACE_ABSPATH
-    filename_and_line = re.search(pattern, response)[0]
-    filename, line = extract_filename_line(filename_and_line)
+    match = re.search(pattern, response)
+    if not match:
+        return None
+    filename_and_line = match.group(0)
 
+    filename, line = extract_filename_line(filename_and_line)
     bp = Breakpoint(id=int(i_d), filename=filename, line=int(line), enabled=True)
     return bp
 
@@ -142,12 +148,18 @@ def convert_toggle_breakpoint_response(response: str, enabled: bool) -> Breakpoi
     # get only the matching string without additional lines or line breaks
     response = match.group(0)
 
-    i_d = re.search(r"(?<=abled breakpoint )\d+", response)[0]
+    match = re.search(r"(?<=abled breakpoint )\d+", response)
+    if not match:
+        return None
+    i_d = match.group(0)
     # without "(Dis|En)" because look-behind requires fixed-width pattern
 
-    filename_and_line = re.search(r"(?<=" + re.escape(WORKSPACE_ABSPATH) + ").+", response)[0]
-    filename, line = extract_filename_line(filename_and_line)
+    match = re.search(r"(?<=" + re.escape(WORKSPACE_ABSPATH) + ").+", response)
+    if not match:
+        return None
+    filename_and_line = match.group(0)
 
+    filename, line = extract_filename_line(filename_and_line)
     bp = Breakpoint(id=int(i_d), filename=filename, line=int(line), enabled=enabled)
     return bp
 
-- 
GitLab