On 02/20/2016 01:13 PM, T Lee Davidson wrote:
> On 02/20/2016 07:32 AM, T Lee Davidson wrote:
>>
>>
>> Problem solved! :-)
>>
>>
>
> Well I *thought* the problem was solved. Apparently I spoke to soon from 
> behind bleary eyes.
>

So here I thought I was helping others who may have been in the same situation. 
As it turns out, I've just caused alot of noise 
because the issue was not related to the DBus Name at all. Unfortunately, I 
haven't the slightest clue how I didn't get an error 
with the fix I presented.

The original DBus object class file I was using:
------
' DBusInterface class file

Inherits DBusObject
Create Static

Public Sub Receiver(myString As String)
   Print "Received: " & myString
End
------

And, I said the fix was to do some name swapping before sending the data:

     ' ' Send command line args to existing instance
     ReceiverDbusName = DBus.Name 'Preserve receiver name
     DBus.Name = "org.gambas.Transient" & Application.Name  ' Set different 
name for transient relay of args.
     DBus[ReceiverDbusName]["/DBusInterface"].Receiver("command line arguments")


WRONG!!

Don't bother with name swapping. It isn't necessary. When Gambas makes a call 
of the format 
"DBus[Application][ObjectPath].Method(Arguments)", it does not create a 
connection on the bus with the name of DBus.Name. It 
allows the DBus daemon to create a generic, number-formatted-name connection.

The real problem, I've discovered, was in the DBusInterface class code.

According to 
https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-types 
:
"When an application handles a method call message, it is required to return a 
reply."

And, as you can see, the created DBusInterface object would do no such thing. 
The example class code should be:
------
' DBusInterface class file

Inherits DBusObject
Create Static

Public Sub Receiver(myString As String) As Boolean '** Return type
Print "Received: " & myString
Return True '** Return a reply
End
------



***   "Artificial Intelligence is no match for natural stupidity."   ***


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to