This adds avrcp_register_player function to register callbacks for
requests and responses, the fundamental difference is that the
callbacks are called after the original PDU is parsed and the parameter
are converted to host byte order making us able to unit test the
parsing itself.
Disconnect scenarios:
1. If there is more then one client for a given gatt_device then
client id is removed from dev->clients, success response is sent
together with success disconnect event.
2. If there is only one client for a given remote device then we
do what is decribed above plus clean of gattrib stuff
3. In case client_if or conn_id is incorrect, response failed is sent
This patch introduce connect LE device functionality.
There is gatt_device representing remote le device. Each gatt device
has a list own list of clients as it is possible that more apps
would like to use same remote device.
Possible connect scenarios:
1. There is no ACL connection to device:
Then new dev is put on conn_wait_queue and le scan is enabled.
Once device is found we do connect it.
Once device is connected then device is moved form conn_wait_queue to
conn_list and success event is sent to client(s) with conn_id
2. Device is already connected:
Then we update client list, reply with success and do send connect event.
3. For unregisterd clients or uknown conn_id, failed response is sent.
This patch introduce API which GATT can use to start/stop discovery
and register for required events.
This is because GATT needs to get from GAP notifications about
founded devices and also notification when discovery has been stopped.
GATT will need it explicity when GATT client calls scan, and also in
case of connect device, as before le connect is sent we do scan first
to make sure that device is available.
For now on adapter have two variables tracing discovery.
1. cur_discovery_type which show type of ongoing discovery type.
2. exp_discovery_type which shows type of next discovery session.
We need this because of scenarion when GATT is interesting in scan and
in the same time HAL wants to do scanning.
There are few cases when framework doesn't call connect_audio method
from HAL but we should do it internally. Call connect_audio if
we started dialing or we accepted incoming call. Also if headset
connects during active call, start SCO connection. We don't have to
disconnect SCO internally, because Android always call disconect_audio
when call has finished.
This adds code needed for translating phone_state_change command to
call, callsetup and callheld indicators. Android HAL specifcy common
type for all calls state but only subset of values are valid for
phone_state_change.
This fix following Valgrind report:
Syscall param sendmsg(msg.msg_iov[1]) points to uninitialised byte(s)
at 0x534823D: ??? (syscall-template.S:81)
by 0x5F68689: hal_ipc_cmd (hal-ipc.c:357)
by 0x5F6240B: init (hal-bluetooth.c:437)
by 0x4128C0: setup_base (android-tester.c:2594)
by 0x40DDE5: setup_callback (tester.c:380)
by 0x50803B5: g_main_context_dispatch (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x5080707: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3800.1)
by 0x5080B09: g_main_loop_run (in /lib/x86_64-linux-gnu/
libglib-2.0.so.0.3800.1)
by 0x40EA0C: tester_run (tester.c:798)
by 0x404475: main (android-tester.c:4864)
Address 0x7ff0002b1 is on thread 1's stack
This patch fix segfault driven by lack of 4 element in avrg array.
If user put only two arguments, reading of lacking (auto set to start=1)
third argument, will trigger segfault.