Commit Graph

134 Commits

Author SHA1 Message Date
Szymon Janc
a328efa7b6 android/bluetooth: Add support for adapter bonded devices property
This allows to get property with list of bonded devices.
2013-12-11 15:38:01 +02:00
Szymon Janc
63d0afde96 android/bluetooth: Add support for reporting adapter type property
This allows to get property with adapter type.
2013-12-11 15:37:23 +02:00
Szymon Janc
ab663fe425 android/bluetooth: Add send_adapter_property helper function
Adapter property notification are send from multiple places so it make
sense to have helper for that. This is especially usefull for 'simple'
properties.
2013-12-10 17:28:14 +02:00
Szymon Janc
51185f0fa5 android/bluetooth: Add send_device_property helper function
Remote device property notification will be send from multiple places
so it make sense to have helper for that. This will be especially
usefull for 'simple' properties.
2013-12-10 17:27:59 +02:00
Szymon Janc
87b0ec339f android/bluetooth: Add stubs for set device property command
This adds per property stubs.
2013-12-10 17:27:50 +02:00
Szymon Janc
01376acfdc android/bluetooth: Add stubs for get device properties command
This adds per property stubs.
2013-12-10 17:27:34 +02:00
Szymon Janc
fffc2b05d5 android/bluetooth: Refactor send_remote_device_name_prop
Rename send_remote_device_name_prop to get_device_name and make it
accept struct device as parameter. Also return HAL status code.
This will allow to use this function also in get device property
command handler.
2013-12-10 17:27:03 +02:00
Szymon Janc
3effdfbd16 android/bluetooth: Fix coding style issue in set_device_bond_state 2013-12-10 17:26:52 +02:00
Szymon Janc
7ad67aedc3 android/bluetooth: Use single list for device caching
This makes code much simpler and easier to follow. It is also
a preparation for supporting remote device properties getting, setting
and storing.
2013-12-10 17:26:33 +02:00
Szymon Janc
e634c06c3b android/bluetooth: Rename functions to match adapter properties names
This match adapter properties handling functions with properties names.
Will make code easier to understand and avoid clashes with remote
device properties functions.
2013-12-10 17:22:11 +02:00
Andrei Emeltchenko
7560b22e96 core: Remove useless eir parsing function return value
Currently eir_parse always return 0 but it is checked throughout the code
(in android/bluetooth code as well in src/adapteri, etc) for return value
(err < 0) which never happens. Make function eir_parse return void. This
fixes warnings from static analyzer tools.
2013-12-10 10:32:57 +02:00
Szymon Janc
ffb856322c android: Use G_N_ELEMENTS macro for table elements calculation
It is more common in codebase to use this macro instead of opencoded
(sizeof(foo)/sizeof(foo[0])).
2013-12-03 13:44:04 +02:00
Szymon Janc
d64785addb android/bluetooth: Make property handling function return HAL status
This makes funtions follow have similar style and makes properties
dispatch function much simpler.
2013-12-02 16:24:02 +02:00
Szymon Janc
a29d4b3212 android/bluetooth: Use generic IPC msg handling for commands
Handlers are registered on service register and unregistered on
unregister.
2013-12-02 16:24:02 +02:00
Szymon Janc
7624ea2d42 android: Don't pass notification socket on services register
It is no longer needed as proper socket is use by IPC helpers.
2013-11-28 18:02:27 +02:00
Szymon Janc
9ed863baef android/bluetooth: Remove not needed notification_sk checks
This is now checked inside ipc_send_notif helper.
2013-11-28 18:02:27 +02:00
Szymon Janc
daf1186c38 android: Use ipc_send_notif for sending notifications 2013-11-28 18:02:26 +02:00
Szymon Janc
a50edbf560 android: Use ipc_send_rsp helper for replying success
Where applicable use helper as this make code easier to understand.
2013-11-28 18:02:26 +02:00
Szymon Janc
6456e15664 android: Remove socket parameter from ipc_send_rsp
Use command socket provided to IPC on init.
2013-11-28 18:02:26 +02:00
Szymon Janc
63681815bd android/bluetooth: Change discoverable mode only if connectable
There is no need to sending set_discoverable command if new settings
are not connectable as clearing connectable also clear discoverable.
Sending set_discoverable when not connectable result in 'rejected'
mgmt response.
2013-11-27 12:57:04 +02:00
Johan Hedberg
cc38f090de android: Fix pointless eir debug log 2013-11-27 12:52:29 +02:00
Andrei Emeltchenko
044baf78ef android/bluetooth: Fix memory leak 2013-11-25 14:51:08 +02:00
Ravi kumar Veeramally
b32461d42d android: Handle multiple init(register) and cleanup(unregister) calls properly
This can be tested with haltest.
2013-11-19 18:15:37 +02:00
Szymon Janc
fc10c55498 android: Improve IPC helper to not send invalid status response
This fix issue with sending invalid success response from several
places where ipc_send_rsp was used for reporting success. Instead of
using using ipc_send for success response, make helper handle that.
2013-11-18 15:17:22 +02:00
Szymon Janc
2e86eac876 android: Refactor update_found_device function
This makes function flow easier to follow and understand. Besides that
it also fix issue with sending to many bytes if some prop were not
present in EIR.
2013-11-16 20:22:03 +02:00
Szymon Janc
51012a0104 android: Fix sending invalid remote device property event
Remote device property event has variable length, pass whole event
length to ipc_send, not only header.
2013-11-16 20:22:01 +02:00
Szymon Janc
ff7246fb8f android: Fix sending remote device property if name is not present
This fix missing bdaddr to string convertion if name was NULL. This
was resulting in using undefined dst value.
2013-11-16 20:21:59 +02:00
Lukasz Rymanowski
ba310d7f90 android: Change TODO with explaining comment 2013-11-15 20:23:38 +02:00
Lukasz Rymanowski
e623075212 android: Update bond state on auth and connect failed 2013-11-15 20:22:23 +02:00
Lukasz Rymanowski
818d532ba3 android: Cache device name on device list. 2013-11-15 20:20:51 +02:00
Lukasz Rymanowski
e9d43a87fa android: Update bond state on incoming bonding
Before sending any ssp request or pin code request up to HAL library we
need to send bond state change with bonding state. Otherwise incoming
bonding is not correctly handled by Bluetooth.apk.
In this patch also device list has been added in order to e.g track
bonding state.

Note: For incoming paring (security mode 3) there is a  need to send
HAL_EVE_REMOTE_DEVICE_PROPS before HAL_EV_PIN_REQUEST.
It is because Android will crash due to bug in pinRequestCallback
function in java. Android checks if device is already in HashMap and if
not then creates  device, but forget to use that one, but instead do
operations on NULL. By sending HAL_BOND_STATE_BONDING event it works
better but we have race issue. It is because new device is added to
HashMap not in callback context but later after BONDING msg will be
received  by BondStateMachine. If it happens before pin_request_cb hits
java then we are fine, otherwise not. So for that reason we send
HAL_EV_REMOTE_DEVICE_PROPS so in the java handler class new device will
be added to HashMap in the  callback context.

In ssp case we don't have this problem as we send device found once acl
is created.
2013-11-15 20:19:50 +02:00
Szymon Janc
e30125fa92 android: Fix not storing adapter index in index added event
If controller was addded after daemon start its index was not stored
resulting in mgmt commands to be always send to MGMT_INDEX_NONE index.
2013-11-15 14:44:10 +02:00
Szymon Janc
9ad9540f7d android: Rename bluetooth service functions to match service name
Make public functions match service name.
2013-11-14 14:58:16 +02:00
Szymon Janc
c060fc6976 android: Rename adapter.c to bluetooth.c
Match service name that is implemened in that file. This will also
keep convention of foo.c and hal-foo.c implementing remote parts of
same service.
2013-11-14 14:57:56 +02:00