Comments (10)
That is a legitimate way to define multiple output arguments, but it isn't supported by the proxy. It only supports a single return type.
Lines 172 to 182 in f976d50
In your mocked test that worked what did the signature look like?
There is a chance that if you change line 180 of proxy.py:
Line 180 in f976d50
To:
self.return_signature += x.attrib['type']
it may work.
It'll be easier for you to test since you have all of your tooling setup.
from adbus.
D-Bus supports multiple in and out values for method calls. The multiple ins map nicely to multiple arguments in Python, but there isn't a straight-forward equivalent to multiple outs.
We could convert it to a tuple if there are multiple outs, it may make sense with the Python unpacking syntax.
I don't have an easy way to test it, but it may be as simple as fudging the return signature into a struct. You'd have to count how many out definitions there are if you have more than 1 out enclose it in "()".
Something like this:
self.arg_signatures = []
self.return_signature = ''
num_outs = 0
for x in etree.iter():
if x.tag == 'method':
self.name = x.attrib['name']
if x.tag == 'arg':
if x.attrib['direction'] == 'out':
self.return_signature += x.attrib['type']
num_outs += 1
elif x.attrib['direction'] == 'in':
self.arg_signatures.append(x.attrib['type'])
if num_outs > 1:
self.return_signature = "(" + self.return_signature + ")"
from adbus.
Thanks for trying.
I'll have to add this as a new feature, it may be a few days before I have some time to look at it.
from adbus.
I created a branch with a few updates for this new feature. I don't have time to test it (or even build it right now) but it should get things started. If you get a chance to test it that would be a big help.
feature-multi-return-proxy-call
from adbus.
This is strange, the output signature looks like it can be either 'i' or 's'?
<method name="New">
<arg type="s" direction="in"/>
<arg type="i" direction="out"/>
<arg type="s" direction="out"/>
</method>
It's been a while since I worked with D-Bus introspect xml, I'm not sure what that means. Looking it up now.
from adbus.
Hi @charleseidsness, thanks for your response.
You're right, output signature of mock-up is different from main program.
Return type of mock-up:
‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=4 ReplyCookie=3
Sender=:1.169 Destination=:1.172
UniqueName=:1.169
MESSAGE "(is)" {
STRUCT "is" {
INT32 10;
STRING "success";
};
};
Return type of main program:
‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=47 ReplyCookie=3
Sender=:1.111 Destination=:1.147
UniqueName=:1.111
MESSAGE "is" {
INT32 6;
STRING "";
};
About changing in proxy.py
source line 180
. The result is no exception occurs anymore, but still just int
part returned from proxy.
If I should test something else, I'll be appreciate if you tell me.
from adbus.
Nice idea, but unfortunately didn't work.
The reason of failure, I guess, is that the program is asking for (is)
, and there's no such a thing.
Here is occurred exception:
File "client.py", line 18, in <module>
asyncio.run(main())
File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "client.py", line 15, in main
ret = await proxy.New("body")
File "/usr/local/lib/python3.7/site-packages/adbus/client/proxy.py", line 202, in __call__
timeout_ms=self.timeout_ms
File "/usr/local/lib/python3.7/site-packages/adbus/client/call.py", line 48, in call
raise call.response
File "adbus/sdbus/call.pyx", line 13, in adbus.sdbus.call_callback
File "adbus/sdbus/message.pyx", line 221, in adbus.sdbus.Message.read
File "adbus/sdbus/message.pyx", line 170, in adbus.sdbus.Message._read_struct
adbus.sdbus.SdbusError: Failed to enter structure b'is'
from adbus.
I hope you get free time soon, feel free to ask me if I can help.
from adbus.
Great work @charleseidsness,
Problem fixed, now it's working for both services (mock-up and my C program)
Do I need to provide log or something ?
from adbus.
That's great, I'll issue a PR.
from adbus.
Related Issues (20)
- Rare Signature Decode Memory Error HOT 3
- Please document why the library wants Python >= 3.7. HOT 5
- adbus.sdbus.SdbusError: Failed to enter array b'y' HOT 3
- Segfault in __pyx_f_5adbus_5sdbus_call_callback HOT 11
- Invalid read of size 1 in message.pyx HOT 1
- Python 3.5 compatibility? HOT 2
- NoReply: Method call timed out HOT 13
- Typing problem in `signal2` in the Readme server example code HOT 1
- `depreciated` and `deprectiated` parameters/properties should be spelled `deprecated` HOT 2
- Active Listen object is garbage collected HOT 3
- new release HOT 1
- systemd dbus activation timeout on first try HOT 3
- travis integration is broken HOT 5
- Watch signal events HOT 2
- getting error while installing on ubuntu HOT 5
- dbus service thread count HOT 5
- Exception caused by typing issue when running example code HOT 2
- DepreciationWarning Python 3.8 HOT 2
- Dbus server method with an unsigned int HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adbus.