@@ -94,7 +94,7 @@ void pbdrv_bluetooth_host_connection_changed(void) {
9494pbio_error_t pbdrv_bluetooth_tx (const uint8_t * data , uint32_t * size ) {
9595
9696 // make sure we have a Bluetooth connection
97- if (!pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_PYBRICKS )) {
97+ if (!pbdrv_bluetooth_host_is_connected ( )) {
9898 return PBIO_ERROR_INVALID_OP ;
9999 }
100100
@@ -112,15 +112,15 @@ pbio_error_t pbdrv_bluetooth_tx(const uint8_t *data, uint32_t *size) {
112112}
113113
114114uint32_t pbdrv_bluetooth_tx_available (void ) {
115- if (!pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_PYBRICKS )) {
115+ if (!pbdrv_bluetooth_host_is_connected ( )) {
116116 return UINT32_MAX ;
117117 }
118118
119119 return lwrb_get_free (& stdout_ring_buf );
120120}
121121
122122bool pbdrv_bluetooth_tx_is_idle (void ) {
123- if (!pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_PYBRICKS )) {
123+ if (!pbdrv_bluetooth_host_is_connected ( )) {
124124 return true;
125125 }
126126
@@ -130,7 +130,7 @@ bool pbdrv_bluetooth_tx_is_idle(void) {
130130pbio_error_t pbdrv_bluetooth_send_event_notification (pbio_os_state_t * state , pbio_pybricks_event_t event_type , const uint8_t * data , size_t size ) {
131131 PBIO_OS_ASYNC_BEGIN (state );
132132
133- if (!pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_PYBRICKS )) {
133+ if (!pbdrv_bluetooth_host_is_connected ( )) {
134134 return PBIO_ERROR_INVALID_OP ;
135135 }
136136
@@ -194,7 +194,7 @@ const char *pbdrv_bluetooth_peripheral_get_name(pbdrv_bluetooth_peripheral_t *pe
194194
195195pbio_error_t pbdrv_bluetooth_peripheral_scan_and_connect (pbdrv_bluetooth_peripheral_t * peri , pbdrv_bluetooth_peripheral_connect_config_t * config ) {
196196
197- if (!pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_HCI )) {
197+ if (!pbdrv_bluetooth_hci_is_enabled ( )) {
198198 return PBIO_ERROR_INVALID_OP ;
199199 }
200200
@@ -332,7 +332,7 @@ pbdrv_bluetooth_advertising_state_t pbdrv_bluetooth_advertising_state;
332332
333333pbio_error_t pbdrv_bluetooth_start_advertising (bool start ) {
334334
335- if (!pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_HCI )) {
335+ if (!pbdrv_bluetooth_hci_is_enabled ( )) {
336336 return PBIO_ERROR_INVALID_OP ;
337337 }
338338
@@ -367,7 +367,7 @@ uint8_t pbdrv_bluetooth_broadcast_data_size;
367367
368368pbio_error_t pbdrv_bluetooth_start_broadcasting (const uint8_t * data , size_t size ) {
369369
370- if (!pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_HCI )) {
370+ if (!pbdrv_bluetooth_hci_is_enabled ( )) {
371371 return PBIO_ERROR_INVALID_OP ;
372372 }
373373
@@ -417,7 +417,7 @@ pbdrv_bluetooth_start_observing_callback_t pbdrv_bluetooth_observe_callback;
417417
418418pbio_error_t pbdrv_bluetooth_start_observing (pbdrv_bluetooth_start_observing_callback_t callback ) {
419419
420- if (!pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_HCI )) {
420+ if (!pbdrv_bluetooth_hci_is_enabled ( )) {
421421 return PBIO_ERROR_INVALID_OP ;
422422 }
423423
@@ -514,7 +514,7 @@ static pbdrv_bluetooth_classic_task_context_t pbdrv_bluetooth_classic_task_conte
514514
515515pbio_error_t pbdrv_bluetooth_start_inquiry_scan (pbdrv_bluetooth_inquiry_result_t * results , uint32_t * results_count , uint32_t * results_count_max , uint32_t duration_ms ) {
516516
517- if (!pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_HCI )) {
517+ if (!pbdrv_bluetooth_hci_is_enabled ( )) {
518518 return PBIO_ERROR_INVALID_OP ;
519519 }
520520
@@ -582,7 +582,7 @@ pbio_error_t pbdrv_bluetooth_process_thread(pbio_os_state_t *state, void *contex
582582 pbio_error_t err ;
583583
584584 // Shorthand notation accessible throughout.
585- bool can_send = pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_PYBRICKS );
585+ bool can_send = pbdrv_bluetooth_host_is_connected ( );
586586
587587 // For looping over peripherals.
588588 static uint8_t peri_index ;
@@ -724,7 +724,7 @@ pbio_error_t pbdrv_bluetooth_close_user_tasks(pbio_os_state_t *state, pbio_os_ti
724724void pbdrv_bluetooth_deinit (void ) {
725725
726726 // If Bluetooth is not even initialized, nothing to do.
727- if (!pbdrv_bluetooth_is_connected ( PBDRV_BLUETOOTH_CONNECTION_HCI )) {
727+ if (!pbdrv_bluetooth_hci_is_enabled ( )) {
728728 return ;
729729 }
730730
0 commit comments