unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Dbus method argument encoding problem
@ 2010-06-28 12:37 christian.lynbech
  2010-07-03  8:52 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: christian.lynbech @ 2010-06-28 12:37 UTC (permalink / raw)
  To: emacs-devel@gnu.org

I have been experimenting to the pidgin chat client over dbus and have
run into a problem with method calls. This is with emacs "23.2.50.1" (as
taking from bzr a few weeks ago) on Linux.

I want to call the PurpleBuddyGetName() method which takes a number as
argument.

If I call:

    (dbus-call-method :session 
                      "im.pidgin.purple.PurpleService"
                      "/im/pidgin/purple/PurpleObject"
                      "im.pidgin.purple.PurpleService" 
                      "PurpleBuddyGetName" 
                      4671)

I get the following error:

    (dbus-error "Argument 0 is specified to be of type \"int32\", but is actually of type \"uint32\"")

If one looks at the documentation of `dbus-call-method', I see the
following encoding scheme for method arguments:

...
  number    => DBUS_TYPE_UINT32
  integer   => DBUS_TYPE_INT32
...

I am guessing that `4671' matches `number' and thus is encoded as a
UINT32 but pidgin/libpurple insists on it being an INT32.

One thing is that the documentation should probably say "natural number"
instead of just "number" (since all integers are conventionally also
numbers), but how can I force a positive integer to encode as INT32?


------------------------+-----------------------------------------------------
Christian Lynbech       | christian #\@ defun #\. dk
------------------------+-----------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Dbus method argument encoding problem
  2010-06-28 12:37 Dbus method argument encoding problem christian.lynbech
@ 2010-07-03  8:52 ` Michael Albinus
  2010-07-04 20:46   ` Christian Lynbech
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2010-07-03  8:52 UTC (permalink / raw)
  To: christian.lynbech; +Cc: emacs-devel@gnu.org

<christian.lynbech@tieto.com> writes:

> I have been experimenting to the pidgin chat client over dbus and have
> run into a problem with method calls. This is with emacs "23.2.50.1" (as
> taking from bzr a few weeks ago) on Linux.
>
> I want to call the PurpleBuddyGetName() method which takes a number as
> argument.
>
> If I call:
>
>     (dbus-call-method :session 
>                       "im.pidgin.purple.PurpleService"
>                       "/im/pidgin/purple/PurpleObject"
>                       "im.pidgin.purple.PurpleService" 
>                       "PurpleBuddyGetName" 
>                       4671)
>
> I get the following error:
>
>     (dbus-error "Argument 0 is specified to be of type \"int32\", but is actually of type \"uint32\"")
>
> If one looks at the documentation of `dbus-call-method', I see the
> following encoding scheme for method arguments:
>
> ...
>   number    => DBUS_TYPE_UINT32
>   integer   => DBUS_TYPE_INT32
> ...
>
> I am guessing that `4671' matches `number' and thus is encoded as a
> UINT32 but pidgin/libpurple insists on it being an INT32.
>
> One thing is that the documentation should probably say "natural number"
> instead of just "number" (since all integers are conventionally also
> numbers), but how can I force a positive integer to encode as INT32?

"number" refers to the result of `numberp':

    (numberp 4671) => t

Type casting is possible by respective keywords. You shall call

    (dbus-call-method :session 
                      "im.pidgin.purple.PurpleService"
                      "/im/pidgin/purple/PurpleObject"
                      "im.pidgin.purple.PurpleService" 
                      "PurpleBuddyGetName" 
                      :int32 4671)


> ------------------------+-----------------------------------------------------
> Christian Lynbech       | christian #\@ defun #\. dk
> ------------------------+-----------------------------------------------------
> Hit the philistines three times over the head with the Elisp reference manual.
>                                         - petonic@hal.com (Michael A. Petonic)

And continue with the dbus manual :-)

Best regards, Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Dbus method argument encoding problem
  2010-07-03  8:52 ` Michael Albinus
@ 2010-07-04 20:46   ` Christian Lynbech
  2010-07-05  3:25     ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Lynbech @ 2010-07-04 20:46 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel@gnu.org, christian.lynbech

>>>>> "Michael" == Michael Albinus <michael.albinus@gmx.de> writes:

Michael> "number" refers to the result of `numberp':

Michael>     (numberp 4671) => t

My suspicion and also why I find it slightly confusing. 

        (numberp -4671) => t

so if it really was `numberp', all numbers (negative or positive) should
map to UINT. Obviously a very minor quibble.

Michael> Type casting is possible by respective keywords.

Thanks, I actually stumbled across this from another post on dbus.

Michael> And continue with the dbus manual :-)

Yeah, I keep forgetting how vast the documentation that accompanies
Emacs actually is.


------------------------+-----------------------------------------------------
Christian Lynbech       | christian #\@ defun #\. dk
------------------------+-----------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Dbus method argument encoding problem
  2010-07-04 20:46   ` Christian Lynbech
@ 2010-07-05  3:25     ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2010-07-05  3:25 UTC (permalink / raw)
  To: Christian Lynbech; +Cc: emacs-devel@gnu.org, christian.lynbech

Christian Lynbech <christian@defun.dk> writes:

>>>>>> "Michael" == Michael Albinus <michael.albinus@gmx.de> writes:
>
> Michael> "number" refers to the result of `numberp':
>
> Michael>     (numberp 4671) => t
>
> My suspicion and also why I find it slightly confusing. 
>
>         (numberp -4671) => t
>
> so if it really was `numberp', all numbers (negative or positive) should
> map to UINT. Obviously a very minor quibble.

I meant to say `natnump'. It's really time to finish with the damned vacations!

> Christian Lynbech       | christian #\@ defun #\. dk

Best regards, Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-05  3:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-28 12:37 Dbus method argument encoding problem christian.lynbech
2010-07-03  8:52 ` Michael Albinus
2010-07-04 20:46   ` Christian Lynbech
2010-07-05  3:25     ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).