[Gambas-user] D-Bus - Change property

T Lee Davidson t.lee.davidson at gmail.com
Sat Mar 10 06:41:45 CET 2018


I get the same thing, Hans.

Interestingly, even though the documentation says that method and property names are case sensitive, this:

Public Sub btnDataRefresh_Click()
  Print hDBusProxy.trigger1
End

works.


BTW, Benoît, is there any way to make the Console tab the default when an application is executed from the IDE, instead of the
Debugging tab (which actually shows nothing unless there's an exception)? As a preference perhaps?


-- 
Lee



On 03/09/2018 11:59 AM, Hans Lehmann wrote:
> Hello,
> 
> after the notes in the documentation (http://gambaswiki.org/wiki/doc/dbus) I tested a (D-Bus-)Server, which only has a property'
> Trigger', whose value should read and change a (D-Bus-)Client:
> 
> FMain.class:
> 
> ' Gambas class file
> 
> Public Sub _new()
>    DBus.Unique = True
>    DBus.Session.Register(Export1, "/export1")
> End
> 
> Public Sub Form_Open()
>   FMain.Resizable = False
>   FMain.Caption = ("The data server is activated")
> End
> 
> Public Sub Form_Close()
>   FMain.Close()
> End
> 
> export1.class:
> 
> ' Gambas class file
> 
> Inherits DBusObject
> Create Static
> 
> Property Trigger1 As Float
> Private $fTrigger1 As Float = Pi(4)
> 
> Private Sub Trigger1_Read() As Float
>   Return $fTrigger1
> End
> 
> Private Sub Trigger1_Write(Value As Float)
>   $fTrigger1 = Value
> End
> 
> ' dbus-send --session --print-reply --dest=org.gambas.dbusserver /export1 org.freedesktop.DBus.Introspectable.Introspect
> ' Extract from the XML introspection file:
> ' ...
> '   <interface name="org.gambas.dbusserver.export1">
> '     <property name="Trigger1" type="d" access="readwrite"/>
> '     ...
> '   </interface>
> 
> ----
> 
> The client is simple:
> 
> FMain.class:
> 
> ' Gambas class file
> 
> Public hDBusProxy As DBusProxy
> 
> Public Sub Form_Open()
>   hDBusProxy = DBus["org.gambas.server"]["/export1"]
> End
> 
> Public Sub btnDataRefresh_Click()
>   Print hDBusProxy.Trigger1
> End
> 
> Public Sub btnSetData_Click()
>   hDBusProxy.Trigger1 = 44  ----->> ERROR
> End
> 
> As a result, I can read the value of the property from the exported object from the client via the D-Bus without any problems.
> However, I do not succeed in setting the value for the property Trigger. Only the error message "No function" is displayed.
> Where is my mental error? I have oriented myself to the following:
> 
> To get the value of a property, do: DBus[Application][ObjectPath].Property
> And to set the value of a property, do: DBus[Application][ObjectPath].Property = Value
> 
> Regards
> 
> Hans
> 
> --------------------------------------------------
> 
> This is the Gambas Mailing List:
> https://lists.gambas-basic.org/listinfo/user
> 
> Search the list:
> https://lists.gambas-basic.org/cgi-bin/search.cgi
> 
> Hosted by https://www.hostsharing.net


More information about the User mailing list