Skip to content

Commit fbba1f5

Browse files
committed
fixup! pbdrv/bluetooth: RFCOMM socket API.
Fix lib/pbio/test build.
1 parent 91a4240 commit fbba1f5

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

lib/pbio/drv/bluetooth/bluetooth_btstack.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,11 @@ static void link_db_settings_save(void) {
11491149
return;
11501150
}
11511151
uint8_t *base = pbsys_storage_settings_get_link_key_db();
1152+
if (base == NULL) {
1153+
DEBUG_PRINT("No storage for link key database in settings\n");
1154+
gap_link_key_iterator_done(&it);
1155+
return;
1156+
}
11521157
uint16_t off = 0;
11531158

11541159
uint8_t count = 0;
@@ -2006,7 +2011,7 @@ void pbdrv_bluetooth_rfcomm_cancel_connection() {
20062011
}
20072012
}
20082013

2009-
void pbdrv_bluetooth_rfcomm_disconnect_all(void) {
2014+
void pbdrv_bluetooth_rfcomm_disconnect_all() {
20102015
for (int i = 0; i < RFCOMM_SOCKET_COUNT; i++) {
20112016
pbdrv_bluetooth_classic_rfcomm_socket_t *sock =
20122017
&pbdrv_bluetooth_classic_rfcomm_sockets[i];

lib/pbio/include/pbsys/storage.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pbio_error_t pbsys_storage_get_user_data(uint32_t offset, uint8_t **data, uint32
2929

3030
void pbsys_storage_request_write(void);
3131

32+
bool pbsys_storage_settings_ready();
33+
3234
#else
3335

3436
static inline uint32_t pbsys_storage_get_maximum_program_size(void) {
@@ -49,6 +51,10 @@ static inline pbio_error_t pbsys_storage_get_user_data(uint32_t offset, uint8_t
4951
static inline void pbsys_storage_request_write(void) {
5052
}
5153

54+
static inline bool pbsys_storage_settings_ready() {
55+
return true;
56+
}
57+
5258
#endif // PBSYS_CONFIG_STORAGE
5359

5460
#endif // _PBSYS_STORAGE_H_

lib/pbio/include/pbsys/storage_settings.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ static inline uint8_t *pbsys_storage_settings_get_link_key_db(void) {
6464
}
6565
#endif
6666

67-
bool pbsys_storage_settings_ready();
68-
6967
#else
7068

7169
static inline void pbsys_storage_settings_set_defaults(pbsys_storage_settings_t *settings) {
@@ -77,8 +75,8 @@ static inline bool pbsys_storage_settings_bluetooth_enabled_get(void) {
7775
}
7876
static inline void pbsys_storage_settings_bluetooth_enabled_set(bool enable) {
7977
}
80-
static inline bool pbsys_storage_settings_ready() {
81-
return true;
78+
static inline uint8_t *pbsys_storage_settings_get_link_key_db(void) {
79+
return NULL;
8280
}
8381

8482
#endif // PBSYS_CONFIG_STORAGE

lib/pbio/sys/storage.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ pbio_error_t pbsys_storage_set_program_data(uint32_t offset, const void *data, u
2020
bool pbsys_storage_slot_change_is_allowed(void);
2121
void pbsys_storage_get_program_data(pbsys_main_program_t *program);
2222
pbsys_storage_settings_t *pbsys_storage_settings_get_settings(void);
23-
bool pbsys_storage_settings_ready();
2423

2524
#else
2625
static inline void pbsys_storage_init(void) {
@@ -50,9 +49,6 @@ static inline void pbsys_storage_get_program_data(pbsys_main_program_t *program)
5049
program->user_ram_start = &pbsys_storage_heap_start;
5150
program->user_ram_end = &pbsys_storage_heap_end;
5251
}
53-
static inline bool pbsys_storage_settings_ready() {
54-
return true;
55-
}
5652

5753
#endif // PBSYS_CONFIG_STORAGE
5854

lib/pbio/test/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ BTSTACK_SRC += $(addprefix $(BTSTACK_DIR)/platform/posix/,\
116116
hci_dump_posix_stdout.c \
117117
)
118118

119+
BTSTACK_SRC = $(addprefix lib/btstack/src/classic/,\
120+
btstack_link_key_db_memory.c \
121+
rfcomm.c \
122+
sdp_client.c \
123+
sdp_client_rfcomm.c \
124+
sdp_server.c \
125+
sdp_util.c \
126+
spp_server.c \
127+
)
128+
119129
# pbio library
120130
PBIO_DIR = ..
121131
PBIO_INC = -I$(PBIO_DIR)/include -I$(PBIO_DIR)

0 commit comments

Comments
 (0)