diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-02-24 02:04:08 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-02-24 02:04:08 +0000 |
commit | 5aa5d226872dc680d834096185d492ad715a5cc6 (patch) | |
tree | 1084ec8046c84f0f9ec16039660c9a47a6c705f8 /hcid/dbus-device.c | |
parent | 1670b1237dee92f83cb46ea0d9840d88dd49c57a (diff) |
Add support for remembering the PIN code length
Diffstat (limited to 'hcid/dbus-device.c')
-rw-r--r-- | hcid/dbus-device.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/hcid/dbus-device.c b/hcid/dbus-device.c index 3935df12..97bb590f 100644 --- a/hcid/dbus-device.c +++ b/hcid/dbus-device.c @@ -1021,8 +1021,35 @@ failed: static DBusMessage *handle_dev_pin_code_length_req(DBusMessage *msg, void *data) { - /*FIXME: */ - return bluez_new_failure_msg(msg, BLUEZ_EDBUS_NOT_IMPLEMENTED); + struct hci_dbus_data *dbus_data = data; + DBusMessageIter iter; + DBusMessage *reply; + bdaddr_t local, peer; + char addr[18], *addr_ptr; + uint8_t length; + int len; + + get_device_address(dbus_data->dev_id, addr, sizeof(addr)); + + str2ba(addr, &local); + + dbus_message_iter_init(msg, &iter); + dbus_message_iter_get_basic(&iter, &addr_ptr); + + str2ba(addr_ptr, &peer); + + len = read_pin_length(&local, &peer); + if (len < 0) + return bluez_new_failure_msg(msg, BLUEZ_ESYSTEM_OFFSET | -len); + + reply = dbus_message_new_method_return(msg); + + length = len; + + dbus_message_append_args(reply, DBUS_TYPE_BYTE, &length, + DBUS_TYPE_INVALID); + + return reply; } static DBusMessage *handle_dev_encryption_key_size_req(DBusMessage *msg, void *data) |