Avoid using app_id when we shall use app structure itself. Otherwise we
end up with unnecessary searches for app and problems for incoming
connections.
System ID is not just a string but has a specified format and
should be unique.
DIS specification p. 3.7:
"The System ID characteristic shall represent a structure containing
an Organizationally Unique Identifier (OUI) followed by a manufacturer-defined
identifier and is unique for each individual instance of the product."
If primary is not provided meaning primary should be auto discovered it
probably means other primary services such as Scan Parameter Profile
are not being handled either so just handle ScPP as well in such case.
Fixes clang warning:
...
android/mcap-lib.c:2366:20: warning: The left operand of '*' is a
garbage value
return tv->tv_sec * 1000000ll + tv->tv_nsec / 1000ll;
~~~~~~~~~~ ^
1 warning generated.
...
In order to run PTS MDL disconnect and reconnect, HAL api does
not support it. This close simply shutdown the fd, remote device
will be notified like data channel is closed not deleted. So ready
for reconnection.
This fixes the following memory leak:
32 bytes in 1 blocks are definitely lost in loss record 20 of 35
at 0x4C291D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x400DC2: queue_new (queue.c:65)
by 0x400AA5: test_foreach_remove_all (test-queue.c:92)
by 0x4E9E5E0: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E9E7A5: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E9EB1A: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x40083E: main (test-queue.c:109)
If the queue elements are destroyed by queue_destroy the head will point
to freed memory causing the following error when unit/test-queue is run:
Invalid read of size 8
at 0x401040: queue_foreach (queue.c:194)
by 0x4E9E5E0: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E9E7A5: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E9EB1A: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x40083E: main (test-queue.c:109)
Address 0x7f65738 is 8 bytes inside a block of size 16 free'd
at 0x4C28577: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x400E29: queue_destroy (queue.c:93)
by 0x40102C: queue_foreach (queue.c:219)
by 0x4E9E5E0: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E9E7A5: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E9EB1A: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x40083E: main (test-queue.c:109)