|
3 | 3 |
|
4 | 4 | // Bluetooth driver using BlueKitchen BTStack. |
5 | 5 |
|
| 6 | +#include <btstack_config.h> |
6 | 7 | #include <pbdrv/config.h> |
7 | 8 |
|
8 | 9 | #if PBDRV_CONFIG_BLUETOOTH_BTSTACK |
|
21 | 22 | #include <classic/sdp_client.h> |
22 | 23 | #include <classic/sdp_server.h> |
23 | 24 | #include <classic/spp_server.h> |
| 25 | +#include <gap.h> |
| 26 | +#include <lwrb/lwrb.h> |
24 | 27 | #include <pbsys/storage.h> |
25 | 28 | #include <pbsys/storage_settings.h> |
26 | | -#include <lwrb/lwrb.h> |
27 | 29 |
|
28 | 30 | #if HAVE_UMM_MALLOC |
29 | 31 | #include <umm_malloc.h> |
|
61 | 63 | #define PERIPHERAL_TIMEOUT_MS_CONNECT (5000) |
62 | 64 | #define PERIPHERAL_TIMEOUT_MS_PAIRING (5000) |
63 | 65 |
|
64 | | -#define DEBUG 0 |
| 66 | +#define DEBUG 2 |
65 | 67 |
|
66 | 68 | #if DEBUG |
67 | 69 | #include <pbio/debug.h> |
@@ -1847,6 +1849,7 @@ pbio_error_t pbdrv_bluetooth_rfcomm_listen( |
1847 | 1849 | // ready when the bluetooth system is initialized, but it will be ready by |
1848 | 1850 | // the time we try to make any rfcomm connections. |
1849 | 1851 | link_db_settings_load_once(); |
| 1852 | + gap_discoverable_control(1); |
1850 | 1853 |
|
1851 | 1854 | sock = pbdrv_bluetooth_classic_rfcomm_socket_alloc(); |
1852 | 1855 | if (!sock) { |
@@ -1884,11 +1887,12 @@ pbio_error_t pbdrv_bluetooth_rfcomm_listen( |
1884 | 1887 | } |
1885 | 1888 |
|
1886 | 1889 | DEBUG_PRINT("[btc:rfcomm_listen] Connected\n"); |
| 1890 | + gap_discoverable_control(0); |
1887 | 1891 |
|
1888 | 1892 | PBIO_OS_ASYNC_END(PBIO_SUCCESS); |
1889 | 1893 |
|
1890 | | -cleanup: |
1891 | | - ; |
| 1894 | +cleanup:; |
| 1895 | + gap_discoverable_control(0); |
1892 | 1896 | pbio_error_t err = sock->err; |
1893 | 1897 | pbdrv_bluetooth_classic_rfcomm_socket_reset(sock); |
1894 | 1898 | return err; |
|
0 commit comments