diff options
Diffstat (limited to 'applications/bt')
-rwxr-xr-x | applications/bt/bt_service/bt.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/applications/bt/bt_service/bt.c b/applications/bt/bt_service/bt.c index aa999e36..3336ab9f 100755 --- a/applications/bt/bt_service/bt.c +++ b/applications/bt/bt_service/bt.c @@ -81,7 +81,7 @@ Bt* bt_alloc() { } // Called from GAP thread from Serial service -static void bt_on_data_received_callback(uint8_t* data, uint16_t size, void* context) { +static uint16_t bt_on_data_received_callback(uint8_t* data, uint16_t size, void* context) { furi_assert(context); Bt* bt = context; @@ -89,6 +89,7 @@ static void bt_on_data_received_callback(uint8_t* data, uint16_t size, void* con if(bytes_processed != size) { FURI_LOG_E(BT_SERVICE_TAG, "Only %d of %d bytes processed by RPC", bytes_processed, size); } + return rpc_session_get_available_size(bt->rpc_session); } // Called from GAP thread from Serial service @@ -118,6 +119,11 @@ static void bt_rpc_send_bytes_callback(void* context, uint8_t* bytes, size_t byt } } +static void bt_rpc_buffer_is_empty_callback(void* context) { + furi_assert(context); + furi_hal_bt_notify_buffer_is_empty(); +} + // Called from GAP thread static void bt_on_gap_event_callback(BleEvent event, void* context) { furi_assert(context); @@ -132,9 +138,10 @@ static void bt_on_gap_event_callback(BleEvent event, void* context) { FURI_LOG_I(BT_SERVICE_TAG, "Open RPC connection"); bt->rpc_session = rpc_session_open(bt->rpc); rpc_session_set_send_bytes_callback(bt->rpc_session, bt_rpc_send_bytes_callback); + rpc_session_set_buffer_is_empty_callback(bt->rpc_session, bt_rpc_buffer_is_empty_callback); rpc_session_set_context(bt->rpc_session, bt); furi_hal_bt_set_data_event_callbacks( - bt_on_data_received_callback, bt_on_data_sent_callback, bt); + RPC_BUFFER_SIZE, bt_on_data_received_callback, bt_on_data_sent_callback, bt); // Update battery level PowerInfo info; power_get_info(bt->power, &info); |