Check the experimental flag, there is no value in starting the
Advertising Manager when there is no method for advertising.
This also makes startup quieter when experimental is not set.
Improves the example-advertisement script in two ways:
It uses 16-bit service UUIDs so that it does not overflow the
Advertisement Data
It turns the adapter's power on so that it works out of the box.
The bt_ad structure provides an abstraction for easy translation of defined
Advertisement Data fields into the resulting raw bytes needed by the Bluetooth
HCI LE Set Advertising Data command.
This patch adds the bt_gatt_client_get_db function, which allows
to get a reference to db from client structure. This is useful
when as a client we need to have an access db, to explore some
attributes.
The %zX format specifier for st_size causes the following warning:
tools/create-image.c:120:5: error: format ‘%zX’ expects argument of type ‘size_t’, but argument 10 has type ‘__off_t’ [-Werror=format=]
st.st_size, 0, 0, 0, 0, namelen + 1, 0, name);
^
The best way to solve this (as off_t doesn't have a standard format
specifier) is to use 'j' and do a typecast to uintmax_t.
Similar to issue found with unit test it is necessary to protect
bt_gatt_client instance before calling the callback otherwise it may
destroy it causing a crash.
This fixes TP/GAW/CL/BV-05-C which destroy bt_gatt_client instance on
the called producing the following bracktrace:
at 0x445C7C: start_next_long_write.isra.2 (gatt-client.c:2393)
by 0x4462A8: execute_write_cb (gatt-client.c:2429)
by 0x44099B: handle_rsp (att.c:640)
by 0x44099B: can_read_data (att.c:813)
by 0x44E4BA: watch_callback (io-glib.c:170)
by 0x4E7E7FA: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4200.2)
by 0x4E7EB97: ??? (in /usr/lib64/libglib-2.0.so.0.4200.2)
by 0x4E7EEC1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4200.2)
by 0x43E791: tester_run (tester.c:831)
by 0x43A685: main (test-gatt.c:3935)
Address 0x5b12fd8 is 104 bytes inside a block of size 208 free'd
at 0x4C2ACE9: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x446820: bt_gatt_client_unref (gatt-client.c:1694)
by 0x43AB7C: destroy_context (test-gatt.c:342)
by 0x43AB7C: context_quit (test-gatt.c:370)
by 0x43AD0F: test_long_write_cb (test-gatt.c:1029)
by 0x446290: execute_write_cb (gatt-client.c:2426)
by 0x44099B: handle_rsp (att.c:640)
by 0x44099B: can_read_data (att.c:813)
by 0x44E4BA: watch_callback (io-glib.c:170)
by 0x4E7E7FA: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4200.2)
by 0x4E7EB97: ??? (in /usr/lib64/libglib-2.0.so.0.4200.2)
by 0x4E7EEC1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4200.2)
by 0x43E791: tester_run (tester.c:831)
by 0x43A685: main (test-gatt.c:3935)
Setting MALLOC_CHECK_=3 causes additional checks in glibc for malloc()
usage errors, abort()ing the test if those trigger. MALLOC_PERTURB_=69
causes free()'d memory to be poisoned with 0x45, leading to crashes in
case of use-after-free.
Together, both are useful for spotting more errors during "make check"