I've been working on this idea.
The idea stems from way back in my Amiga1200 days when i used to program GUIs using MUI (Magic User Interface)
One of the cool things about MUI was that Every MUI program had what was called "An ARexx port"
Essentially an interface where you could easily access and control one application from another.
I'm doing the same here with DBus
Currently I have the following commands on each DBus application that might use it...
ObjectGetProperty(ObjectName As String, PropertyNane As String) As Variant
Like running Object.GetProperty()
ObjectSetProperty(ObjectName As String, PropertyName As String, Value As Variant)
Like running Object.SetProperty()
ObjectCall(ObjectName As String, MethodName As String, Value As Variant[]) As String
Like running Object.Call() to run a method.
I attached the current version , still very W.I.P (only started making it yesterday)
It opens a test form with a button and a textarea in it.
then it runs a gambas script file that uses DBus to get/set some stuff.
To enable in your own progs should just be a case of dropping the DBusController folder in yr .src folder.
if you have your own override files then there could be possible conflicts as the folder contains a Controls folder that has various override files , this was to enable a DBusVisible property so only those controls can be used.
I am unsure of security implications so i thought making DBusVisible was a good idea, so for example, no DBus for the password box.
(Old attachment removed, see post below for updated version)
Application control with DBus
- BruceSteers
- Posts: 1340
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Application control with DBus
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- BruceSteers
- Posts: 1340
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Application control with DBus
Some updates...
I did away with the DBusVisible property for every control and instead made an Object array you add objects you want to be visible to it.
To use, drop the DBusControls folder into your .src folder
Then add the controls you want to access to the DBusController.Controls array.
Eg.
Commands available in the interface are...
org.control.ObjectLock(ObjectName As String, Value As Boolean)
org.control.ObjectIsLocked(ObjectName As String) As Boolean
org.control.ObjectGetProperty(ObjectName As String, PropertyNane As String) As Variant
org.control.ObjectSetProperty(ObjectName As String, PropertyName As String, Value As Variant)
org.control.ObjectCall(ObjectName As String, MethodName As String, Value As Variant[]) As String
org.control.Activate(FormName As String)
All Object* commands use the Object.class methods of the similar name.
See the "Test(Run me).gbs" script for usage.
to test just run the "Test(Run me).gbs" script in the project dir. It will compile the executable if it does not exist and run it for you.
there are 2 buttons in the application, one runs the DBus script with a delay between actions, the other does it with no delay.
I did away with the DBusVisible property for every control and instead made an Object array you add objects you want to be visible to it.
To use, drop the DBusControls folder into your .src folder
Then add the controls you want to access to the DBusController.Controls array.
Eg.
DBusController.Controls = [ Textbox1, ListBox1 ]
Commands available in the interface are...
org.control.ObjectLock(ObjectName As String, Value As Boolean)
org.control.ObjectIsLocked(ObjectName As String) As Boolean
org.control.ObjectGetProperty(ObjectName As String, PropertyNane As String) As Variant
org.control.ObjectSetProperty(ObjectName As String, PropertyName As String, Value As Variant)
org.control.ObjectCall(ObjectName As String, MethodName As String, Value As Variant[]) As String
org.control.Activate(FormName As String)
All Object* commands use the Object.class methods of the similar name.
See the "Test(Run me).gbs" script for usage.
to test just run the "Test(Run me).gbs" script in the project dir. It will compile the executable if it does not exist and run it for you.
there are 2 buttons in the application, one runs the DBus script with a delay between actions, the other does it with no delay.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: Application control with DBus
I think that is a much better approach. I look at dbus more as a "publisher/subscriber" and to do what you are making I use a facade style of class that has the complete responsibility for dbus interaction with an underlying business class. In some cases I use more than one facade for a class that has sensitive data or methods to be exposed to only certain "subscribers" but obviously this is not generic like you are building.
Have you tried dbus signal handling yet? I am having trouble getting the event registration defined in the subscriber class. (Raising dbus signals otoh is simple!)
b
Have you tried dbus signal handling yet? I am having trouble getting the event registration defined in the subscriber class. (Raising dbus signals otoh is simple!)
b
Have you ever noticed that software is never advertised using the adjective "spreadable".
- BruceSteers
- Posts: 1340
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Application control with DBus
It is very generic 
could be useful i think though.
I remember MUI programs on the Amiga all having an ARexx interface was super useful.
Now I just need to find a use for it with gambas since i've made it. lol
Primarily i think I plan to add an interface to my script editor so i can make external programs (plugins) interact with it better
Re. signal handler
Sorry i think you probably have more experience with dbus than me so i don't think i can help with your signal config.

could be useful i think though.
I remember MUI programs on the Amiga all having an ARexx interface was super useful.
Now I just need to find a use for it with gambas since i've made it. lol
Primarily i think I plan to add an interface to my script editor so i can make external programs (plugins) interact with it better

Re. signal handler
Sorry i think you probably have more experience with dbus than me so i don't think i can help with your signal config.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- BruceSteers
- Posts: 1340
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Application control with DBus
Some updates/fixes
now does a better job of finding nested object paths like TextArea1.Font
Added some info methods
Objects() As String[] lists all added object names
Functions(UseArray As Boolean) As variant , lists available DBus functions either as a String or a String[]
Command list as returned by the Functions() method...
The test script now loads the program twice. giving both programs a DBus port to communicate to. al it has is a slider in it.
moving one of the sliders sends a dbus message to the other program to move the slider too.
now does a better job of finding nested object paths like TextArea1.Font
Added some info methods
Objects() As String[] lists all added object names
Functions(UseArray As Boolean) As variant , lists available DBus functions either as a String or a String[]
Command list as returned by the Functions() method...
- Msg(String) ' Triggers DBusController_Msg() event
- Eval(String) As Variant ' use Eval on a string
- Enabled() As Boolean ' is the controller enabled
- Functions(Boolean) As Variant ' List functions (produces this list)
- Objects() As String[] ' list all objects that are controllable.
- Activate(String) ' activate a form (null string assumes main window)
- ErrorText() As String ' last error message
- ErrorValue() As Integer ' last error value
- ObjectLock(String, Boolean) As Boolean ' lock or unlock an object (returns previous lock state)
- ObjectLocked(String) As Boolean ' see if an object is locked
- ObjectCall(String, String, Variant[]) As String ' run an objects method/function
- ObjectGetProperty(String, String) As Variant ' get an objects property
- ObjectSetProperty(String, String, Variant) ' set an objects property
The test script now loads the program twice. giving both programs a DBus port to communicate to. al it has is a slider in it.
moving one of the sliders sends a dbus message to the other program to move the slider too.
- Attachments
-
dbus.control-1.0.1.tar.gz
- (56.86 KiB) Downloaded 23 times
If at first you don't succeed , try doing something differently.
BruceS
BruceS