[maemo-developers] [maemo-developers] BT PIN blues ...

From: Johan Hedberg johan.hedberg at nokia.com
Date: Wed Aug 2 08:57:13 EEST 2006
Hi Ian,

On Tue, Aug 01, 2006, Ian Malcom wrote:
> I am trying to use com.nokia.btpin. I register my own 
> handler. My "guess" at the signature is no arguments
> in, a string out. However, the handler function never
> ends up getting called. Looking at code snippets, I
> "believe" that btpin will send my handler a PinRequest
> message. Using the system monitor shows no activity
> other than the pin_req message.
> 
> Any help would be much appreciated! I need to get this
> working for a school project in the next few days, and
> the lack of documentation is driving me to tears.

Take a look at the README [1] file which comes with osso-bttools source (the 
package that btpin belongs to). It describes the handler registration 
interface. The actual pin request interface is identical to the one that 
pre-3.0 versions of bluez have when configured to use D-Bus for pin 
handling (unfortunately this interface doesn't have much documentation).

[1] http://www.maemo.org/platform/docs/bttools.html

To parse the parameters in the pin request use something like the 
folowing:
dbus_message_get_args(message, NULL,
                      DBUS_TYPE_BOOLEAN, &out,
                      DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &bda, &bdalen,
                      DBUS_TYPE_INVALID));

The pin reply consists of one string parameter. For more details take a 
look at the btpin and bluez-pin source code.

Btw, in the future btpin will go away in favor of the new D-Bus passkey 
handler system provided by hcid (which is actually very similar to 
btpin). This bluez D-Bus interface is actually already in the 2006 
release and btpin is just a wrapper to it.

Johan

More information about the maemo-developers mailing list