feat(io): Emit property change signals for byteorder and signedness

Added `PropertiesChanged` signals for `byteorder` and `signed` property
updates. Updated D-Bus interface annotations to specify change signal
behavior for properties. Simplified `emit_io_change` implementation.

Signed-off-by: Sven Sager <s.sager@kunbus.com>
This commit is contained in:
Sven Sager
2026-02-05 11:56:51 +01:00
parent 3d64cd5837
commit 1842bbd2f5

View File

@@ -24,15 +24,33 @@ class InterfaceInput:
<method name="SetSigned"> <method name="SetSigned">
<arg name="signed" type="b" direction="in"/> <arg name="signed" type="b" direction="in"/>
</method> </method>
<property name="address" type="n" access="read"/> <property name="address" type="n" access="read">
<property name="bmk" type="s" access="read"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
<property name="bitaddress" type="n" access="readwrite"/> </property>
<property name="byteorder" type="s" access="readwrite"/> <property name="bmk" type="s" access="read">
<property name="defaultvalue" type="v" access="read"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
<property name="length" type="q" access="read"/> </property>
<property name="name" type="s" access="read"/> <property name="bitaddress" type="n" access="readwrite">
<property name="signed" type="b" access="readwrite"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
<property name="value" type="v" access="read"/> </property>
<property name="byteorder" type="s" access="readwrite">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="invalidates"/>
</property>
<property name="defaultvalue" type="v" access="read">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<property name="length" type="q" access="read">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<property name="name" type="s" access="read">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<property name="signed" type="b" access="readwrite">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="invalidates"/>
</property>
<property name="value" type="v" access="read">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
</property>
</interface> </interface>
</node> </node>
""" """
@@ -53,7 +71,6 @@ class InterfaceInput:
self.variant_type = "ay" self.variant_type = "ay"
def emit_io_change(self): def emit_io_change(self):
if self.interface_name:
self.PropertiesChanged( self.PropertiesChanged(
self.interface_name, self.interface_name,
{ {
@@ -93,6 +110,15 @@ class InterfaceInput:
self.io._set_byteorder(value) self.io._set_byteorder(value)
self.variant_type = get_variant_type(self.io) self.variant_type = get_variant_type(self.io)
# Changing the byteorder can change the value, but we do NOT send a signal for that
# because the real value of the process image was not changed. But we inform the client
# about the changed byteorder property.
self.PropertiesChanged(
self.interface_name,
{},
["byteorder"],
)
@property @property
def defaultvalue(self) -> Variant: def defaultvalue(self) -> Variant:
return Variant( return Variant(
@@ -121,6 +147,15 @@ class InterfaceInput:
self.io._set_signed(value) self.io._set_signed(value)
self.variant_type = get_variant_type(self.io) self.variant_type = get_variant_type(self.io)
# Changing the signedness can change the value, but we do NOT send a signal for that
# because the real value of the process image was not changed. But we inform the client
# about the changed signedness property.
self.PropertiesChanged(
self.interface_name,
{},
["signed"],
)
@property @property
def value(self) -> Variant: def value(self) -> Variant:
if not self.io._parentdevice._selfupdate: if not self.io._parentdevice._selfupdate:
@@ -145,15 +180,33 @@ class InterfaceOutput(InterfaceInput):
<method name="SetValue"> <method name="SetValue">
<arg name="value" type="v" direction="in"/> <arg name="value" type="v" direction="in"/>
</method> </method>
<property name="address" type="n" access="read"/> <property name="address" type="n" access="read">
<property name="bmk" type="s" access="read"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
<property name="bitaddress" type="n" access="readwrite"/> </property>
<property name="byteorder" type="s" access="readwrite"/> <property name="bmk" type="s" access="read">
<property name="defaultvalue" type="v" access="read"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
<property name="length" type="q" access="read"/> </property>
<property name="name" type="s" access="read"/> <property name="bitaddress" type="n" access="readwrite">
<property name="signed" type="b" access="readwrite"/> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
<property name="value" type="v" access="readwrite"/> </property>
<property name="byteorder" type="s" access="readwrite">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="invalidates"/>
</property>
<property name="defaultvalue" type="v" access="read">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<property name="length" type="q" access="read">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<property name="name" type="s" access="read">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const"/>
</property>
<property name="signed" type="b" access="readwrite">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="invalidates"/>
</property>
<property name="value" type="v" access="readwrite">
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
</property>
</interface> </interface>
</node> </node>
""" """