Aligned ble_modem code with the W800SmartWatch ble modem code, corrected an english mistake in a comment

This commit is contained in:
anschrammh 2023-04-04 08:21:58 +02:00
parent 44edace353
commit 1faa5b3c84
3 changed files with 17 additions and 10 deletions

View File

@ -10,14 +10,15 @@
//Is needed for the BT off workaround
#include "wm_wifi.h"
bool ble_modem_on(bool startService)
bool ble_modem_on(bool bluetoothOnly, bool startService)
{
int status = BLE_HS_ENOERR;
bool serviceStartSuccess = true;
uint8_t uart_no = 0xFF;
tls_appl_trace_level = TLS_BT_LOG_VERBOSE; //Should be set with a config define
if(bt_adapter_state == WM_BT_STATE_ON) {
if(bt_adapter_state == WM_BT_STATE_ON)
{
TLS_BT_APPL_TRACE_VERBOSE("ble modem already on"NEW_LINE);
return true;
}
@ -26,13 +27,19 @@ bool ble_modem_on(bool startService)
tls_appl_trace_level);
status = tls_bt_init(uart_no);
if((status != BLE_HS_ENOERR) && (status != BLE_HS_EALREADY)) {
if((status != BLE_HS_ENOERR) && (status != BLE_HS_EALREADY))
{
TLS_BT_APPL_TRACE_ERROR("%s, tls_bt_init ret:%s"NEW_LINE, __FUNCTION__, tls_bt_rc_2_str(status));
}
// Start the ble service if it was asked and if it is not yet started
if(startService && !ble_service_is_started())
serviceStartSuccess = ble_service_start();
else
{
// If we successfully started the modem, we can set it's working mode.
if(bluetoothOnly)
tls_rf_bt_mode(true);
// Start the ble service if it was asked and if it is not yet started
if(startService && !ble_service_is_started())
serviceStartSuccess = ble_service_start();
}
return ((status == BLE_HS_ENOERR || status == BLE_HS_EALREADY) && serviceStartSuccess) ? true : false;
}

View File

@ -10,7 +10,7 @@
* @return true on success
* @return false on failure
*/
bool ble_modem_on(bool startService);
bool ble_modem_on(bool bluetoothOnly, bool startService);
/**
* @brief Turns the BLE modem off
@ -29,4 +29,4 @@ bool ble_modem_off(void);
*/
bool is_ble_modem_on(void);
#endif //BLE_MODEM_H
#endif //BLE_MODEM_H

View File

@ -333,7 +333,7 @@ bool ble_service_request_mtu_exchange(void)
bool ble_service_send_nus_data(const uint8_t *data, uint16_t length)
{
// The NUS TX is using notifications
// The NUS is TX is using notifications
if(notification_data.transfer_in_progress)
{
TLS_BT_APPL_TRACE_WARNING("%s, a transfer is already in progress"NEW_LINE, __FUNCTION__);