ekfsm 1.4.0a37__py3-none-any.whl → 1.4.0a42__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ekfsm might be problematic. Click here for more details.

ekfsm/core/utils.py CHANGED
@@ -88,6 +88,7 @@ _device_structure = Schema(
88
88
  Optional("slot_coding_mask"): int,
89
89
  Optional("channel_id"): int,
90
90
  Optional("service_suffix"): str,
91
+ Optional("keepaliveInterval"): int,
91
92
  Optional("provides"): {
92
93
  Optional(str): [Use(provides_validator)],
93
94
  },
ekfsm/devices/button.py CHANGED
@@ -4,7 +4,7 @@ from ekfsm.devices.generic import Device
4
4
 
5
5
  class Button(Device):
6
6
  """
7
- Device class for handling a button array.
7
+ Device class for handling a single button as part on array.
8
8
  """
9
9
 
10
10
  def __init__(
@@ -35,6 +35,11 @@ class Button(Device):
35
35
  def handler(self, func: Callable | None, *args, **kwargs):
36
36
  """
37
37
  Handle button events with a callback function.
38
+
39
+ Parameters
40
+ ----------
41
+ func : Callable | None
42
+ The function to call on button events. If None, no function is called.
38
43
  """
39
44
  if callable(func):
40
45
  self._handler = func
@@ -8,7 +8,13 @@ import io4edge_client.functionblock as fb
8
8
 
9
9
  class ButtonArray(Device):
10
10
  """
11
- Device class for handling a button array.
11
+ Device class for handling an io4edge button array.
12
+
13
+ To read button events, call the `read` method in a separate thread.
14
+
15
+ Note
16
+ ----
17
+ Button handlers are called in the context of the `read` method's thread and need to be set in the Button instances.
12
18
  """
13
19
 
14
20
  def __init__(
@@ -18,6 +24,7 @@ class ButtonArray(Device):
18
24
  children: list[Device] | None = None,
19
25
  abort: bool = False,
20
26
  service_suffix: str | None = None,
27
+ keepaliveInterval: int = 10000,
21
28
  *args,
22
29
  **kwargs,
23
30
  ):
@@ -33,12 +40,14 @@ class ButtonArray(Device):
33
40
 
34
41
  self.service_addr = f"{parent.deviceId}-{self.service_suffix}"
35
42
 
36
- self.client = binio.Client(self.service_addr)
43
+ self.client = binio.Client(
44
+ self.service_addr, command_timeout=keepaliveInterval / 1000 + 5
45
+ )
37
46
 
38
47
  self.subscriptionType = binio.Pb.SubscriptionType.BINARYIOTYPEB_ON_RISING_EDGE
39
48
  self.stream_cfg = fb.Pb.StreamControlStart(
40
49
  bucketSamples=1, # 1 sample per bucket, also ein event pro bucket
41
- keepaliveInterval=10000, # rueckmeldung auch ohne events alle 10 Sekunden
50
+ keepaliveInterval=keepaliveInterval,
42
51
  bufferedSamples=2, # 2 samples werden gepuffert
43
52
  low_latency_mode=True, # schickt soweit moeglich sofort die Events
44
53
  )
@@ -46,6 +55,17 @@ class ButtonArray(Device):
46
55
  def read(self, stop_event: threading.Event | None = None, timeout: float = 0.1):
47
56
  """
48
57
  Read all button events and dispatch to handlers.
58
+
59
+ Parameters
60
+ ----------
61
+ stop_event : threading.Event, optional
62
+ Event to signal stopping the reading loop. If None, the loop will run indefinitely.
63
+ timeout : float, optional
64
+ Timeout for reading from the stream in seconds. Default is 0.1 seconds.
65
+
66
+ Note
67
+ ----
68
+ This method blocks and should be run in a separate thread.
49
69
  """
50
70
  self.client.start_stream(
51
71
  binio.Pb.StreamControlStart(
ekfsm/devices/colorLed.py CHANGED
@@ -32,18 +32,37 @@ class ColorLED(Device):
32
32
  def get(self) -> tuple[Color, bool]:
33
33
  """
34
34
  Get color LED state.
35
- @raises RuntimeError: if the command fails
36
- @raises TimeoutError: if the command times out
35
+
36
+ Returns
37
+ -------
38
+ Current color and blink state.
39
+
40
+ Raises
41
+ ------
42
+ RuntimeError
43
+ if the command fails
44
+ TimeoutError
45
+ if the command times out
37
46
  """
38
47
  return self.client.get(self.channel_id)
39
48
 
40
49
  def set(self, color: Color, blink: bool) -> None:
41
50
  """
42
51
  Set the color of the color LED.
43
- @param Color: The color to set the LED to.
44
- @param blink: Whether to blink the LED.
45
- @raises RuntimeError: if the command fails
46
- @raises TimeoutError: if the command times out
52
+
53
+ Parameters
54
+ ----------
55
+ color : Color
56
+ The color to set the LED to.
57
+ blink : bool
58
+ Whether to blink the LED.
59
+
60
+ Raises
61
+ ------
62
+ RuntimeError
63
+ if the command fails
64
+ TimeoutError
65
+ if the command times out
47
66
  """
48
67
  self.client.set(self.channel_id, color, blink)
49
68
 
@@ -32,13 +32,18 @@ class ThermalHumidity(Device):
32
32
 
33
33
  self.client = Client(self.service_addr)
34
34
 
35
- def __repr__(self):
36
- return f"{self.name}; Service Address: {self.service_addr}"
37
-
38
35
  def temperature(self) -> float:
39
36
  """
40
37
  Get the temperature in Celsius.
41
- @raises RuntimeError: if the command fails
42
- @raises TimeoutError: if the command times out
38
+
39
+ Raises
40
+ ------
41
+ RuntimeError
42
+ if the command fails
43
+ TimeoutError
44
+ if the command times out
43
45
  """
44
46
  return self.client.value()
47
+
48
+ def __repr__(self):
49
+ return f"{self.name}; Service Address: {self.service_addr}"
ekfsm/devices/watchdog.py CHANGED
@@ -5,7 +5,7 @@ from io4edge_client.watchdog import Client
5
5
 
6
6
  class Watchdog(Device):
7
7
  """
8
- Device class for handling a color LED.
8
+ Device class for handling an application watchdog.
9
9
  """
10
10
 
11
11
  def __init__(
@@ -38,7 +38,15 @@ class Watchdog(Device):
38
38
  def kick(self) -> None:
39
39
  """
40
40
  Kick the watchdog.
41
- @raises RuntimeError: if the command fails
42
- @raises TimeoutError: if the command times out
41
+
42
+ Raises
43
+ ------
44
+ RuntimeError
45
+ if the command fails
46
+ TimeoutError
47
+ if the command times out
43
48
  """
44
49
  self.client.kick()
50
+
51
+ def __repr__(self):
52
+ return f"{self.name}; Service Address: {self.service_addr}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ekfsm
3
- Version: 1.4.0a37
3
+ Version: 1.4.0a42
4
4
  Summary: The EKF System Management Library (ekfsm) is a sensor monitoring suite for Compact PCI Serial devices.
5
5
  Author-email: Jan Jansen <jan@ekf.de>, Klaus Popp <klaus.popp@ci4rail.com>, Felix Päßler <fp@ekf.de>
6
6
  Requires-Python: >=3.10
@@ -25,11 +25,11 @@ ekfsm/core/components.py,sha256=iTetqtzNjEEj6FDJNfvXxW_cNNRlLX5_WgB5z3g3zqg,3883
25
25
  ekfsm/core/probe.py,sha256=DgJvkvMjVk09n0Rzn13ybRvidrmFn_D2PD56XS-KgxU,262
26
26
  ekfsm/core/slots.py,sha256=qmxfssVitsMFZYbJRCpOOsvEGqh8JVYdRS-_5BliOF4,6580
27
27
  ekfsm/core/sysfs.py,sha256=CWH1BXlanHAFzK6KY23qLuFvBZ7Q9td3X6JLRwb3vu0,7309
28
- ekfsm/core/utils.py,sha256=slSgFNmSvwWL5qlDQE9WXGv9u9skojlGtUM_B-WumsY,4634
28
+ ekfsm/core/utils.py,sha256=AjVj_QCb9umUmZZsGFPyCISdOKYlhRRSOTVjPu_gxyA,4678
29
29
  ekfsm/devices/__init__.py,sha256=EDFzBuUHt_3_6JD4cageHWZfoMn3WUIIDZk4yEOWgfg,1451
30
- ekfsm/devices/button.py,sha256=tPGBWi2ZxZDQX_WojQG3lKdsKcCTXRYQjRwRjcIv460,1036
31
- ekfsm/devices/buttonArray.py,sha256=bKNstHsmc6SM09BaQiQV09wRbgnb5I6KK7JTgCk6PnU,2910
32
- ekfsm/devices/colorLed.py,sha256=PrA3WsuMs-vi2DxxsW4hRIJh_ZWqs_hW2QmFeijsCxA,1410
30
+ ekfsm/devices/button.py,sha256=z3vzpTCY4ZweUd1M9_eJvepM7A-FchapdsaMz5RCUPE,1207
31
+ ekfsm/devices/buttonArray.py,sha256=KOI7ycLY9RxXOpalCxJz4rOqSC7vp6dihIGkvl2BdXw,3603
32
+ ekfsm/devices/colorLed.py,sha256=H0SFl0SkMHIV5Is31XQJfisDu2nmPh0TuWrtlhsi1bI,1622
33
33
  ekfsm/devices/coretemp.py,sha256=UEsPTMYm05qNCnqnPtbAoYdIfvVGkDl9rJg3tkAP748,1992
34
34
  ekfsm/devices/eeprom.py,sha256=cwcaM2YCKrw6du8d4zT_M3e4oFJh3XNQc5cQM2vqERE,33090
35
35
  ekfsm/devices/ekf_ccu_uc.py,sha256=hjs5r7TKsrFhyyGKClgSFBpchQpFcE7fTZeuLrYiflY,15905
@@ -46,10 +46,10 @@ ekfsm/devices/pixelDisplay.py,sha256=68SANN4S15_NncuDvu0hyjjdqhpxYn14cmxjXwfGqgU
46
46
  ekfsm/devices/pmbus.py,sha256=fi_kR7TlkcqYhHuB7PA2PjANCYmo3MSPeV-B5ZI_WrQ,7004
47
47
  ekfsm/devices/smbios.py,sha256=4P-sxOW27pkzIfVlvFNyVJOcZlYgk2KCTCEUvKf5D94,1067
48
48
  ekfsm/devices/smbus.py,sha256=kbtjEnfrVI6lbfqAbojVqO5nnnpa6HanLf0X2iZjgCg,500
49
- ekfsm/devices/thermal_humidity.py,sha256=OVr1zaCGGutfk1WYZ3509wx6qHqjjF2nFE9QYM_bWtE,1170
49
+ ekfsm/devices/thermal_humidity.py,sha256=HnoiR3mZxwuE74KTFiRhG4Znq21vgcyMFJizSCnULzw,1207
50
50
  ekfsm/devices/utils.py,sha256=qeDNpTpQ3bLGYERAH5lMsifmOaEcQ32FOwEt8tvmjWU,174
51
- ekfsm/devices/watchdog.py,sha256=-us3IMKsvTR7LzRCszHR19q0jsCGPZUIN_FWN-h8844,1060
52
- ekfsm-1.4.0a37.dist-info/METADATA,sha256=fz_N76MjDbeGbpB1dHKlmzLEwLb_qLPC6ov2pKLFPQ4,6717
53
- ekfsm-1.4.0a37.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
54
- ekfsm-1.4.0a37.dist-info/entry_points.txt,sha256=WhUR4FzuxPoGrbTOKLsNJO7NAnk2qd4T30fqzN1yLw8,45
55
- ekfsm-1.4.0a37.dist-info/RECORD,,
51
+ ekfsm/devices/watchdog.py,sha256=QjzvXrXV_XRvCYiy-sr6LOMJywb84aNThuDpsWGvxZk,1202
52
+ ekfsm-1.4.0a42.dist-info/METADATA,sha256=Vhv_XchVBp-Kx6k3PU9LOocJRPH4deC8y0ghkG4bTRc,6717
53
+ ekfsm-1.4.0a42.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
54
+ ekfsm-1.4.0a42.dist-info/entry_points.txt,sha256=WhUR4FzuxPoGrbTOKLsNJO7NAnk2qd4T30fqzN1yLw8,45
55
+ ekfsm-1.4.0a42.dist-info/RECORD,,