mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Proper BT custom name length handling
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "../../features_config.h"
|
||||
|
||||
#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME
|
||||
#define TOTP_BT_WORKER_BT_ADV_NAME_MAX_LEN 18
|
||||
#define TOTP_BT_WORKER_BT_ADV_NAME_MAX_LEN FURI_HAL_BT_ADV_NAME_LENGTH
|
||||
#define TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN GAP_MAC_ADDR_SIZE
|
||||
#endif
|
||||
|
||||
@@ -46,4 +46,4 @@ void totp_bt_type_code_worker_stop(TotpBtTypeCodeWorkerContext* context);
|
||||
void totp_bt_type_code_worker_notify(
|
||||
TotpBtTypeCodeWorkerContext* context,
|
||||
TotpBtTypeCodeWorkerEvent event,
|
||||
uint8_t flags);
|
||||
uint8_t flags);
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#define BAD_KB_APP_SCRIPT_EXTENSION ".txt"
|
||||
#define BAD_KB_APP_LAYOUT_EXTENSION ".kl"
|
||||
|
||||
#define BAD_KB_MAC_ADDRESS_LEN 6 // need replace with MAC size maccro
|
||||
#define BAD_KB_ADV_NAME_MAX_LEN 18
|
||||
#define BAD_KB_ADV_NAME_MAX_LEN FURI_HAL_BT_ADV_NAME_LENGTH
|
||||
#define BAD_KB_MAC_ADDRESS_LEN GAP_MAC_ADDR_SIZE
|
||||
|
||||
typedef enum {
|
||||
BadKbAppErrorNoFiles,
|
||||
|
||||
@@ -402,7 +402,7 @@ void bt_set_profile_adv_name(Bt* bt, const char* fmt, ...) {
|
||||
furi_assert(bt);
|
||||
furi_assert(fmt);
|
||||
|
||||
char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH];
|
||||
char name[FURI_HAL_BT_ADV_NAME_LENGTH];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsnprintf(name, sizeof(name), fmt, args);
|
||||
|
||||
@@ -1124,7 +1124,7 @@ Function,+,furi_hal_bt_serial_start,void,
|
||||
Function,+,furi_hal_bt_serial_stop,void,
|
||||
Function,+,furi_hal_bt_serial_tx,_Bool,"uint8_t*, uint16_t"
|
||||
Function,+,furi_hal_bt_set_key_storage_change_callback,void,"BleGlueKeyStorageChangedCallback, void*"
|
||||
Function,+,furi_hal_bt_set_profile_adv_name,void,"FuriHalBtProfile, const char[( 1 + ( 8 + 1 ) ) + 9 - 1]"
|
||||
Function,+,furi_hal_bt_set_profile_adv_name,void,"FuriHalBtProfile, const char[( 18 + 1 )]"
|
||||
Function,+,furi_hal_bt_set_profile_mac_addr,void,"FuriHalBtProfile, const uint8_t[( 6 )]"
|
||||
Function,+,furi_hal_bt_set_profile_pairing_method,void,"FuriHalBtProfile, GapPairing"
|
||||
Function,+,furi_hal_bt_start_advertising,void,
|
||||
|
||||
|
@@ -477,7 +477,7 @@ bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode) {
|
||||
|
||||
void furi_hal_bt_set_profile_adv_name(
|
||||
FuriHalBtProfile profile,
|
||||
const char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH - 1]) {
|
||||
const char name[FURI_HAL_BT_ADV_NAME_LENGTH]) {
|
||||
furi_assert(profile < FuriHalBtProfileNumber);
|
||||
furi_assert(name);
|
||||
|
||||
@@ -491,7 +491,7 @@ void furi_hal_bt_set_profile_adv_name(
|
||||
memcpy(
|
||||
&(profile_config[profile].config.adv_name[1]),
|
||||
name,
|
||||
FURI_HAL_VERSION_DEVICE_NAME_LENGTH - 1);
|
||||
FURI_HAL_BT_ADV_NAME_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode);
|
||||
*/
|
||||
void furi_hal_bt_set_profile_adv_name(
|
||||
FuriHalBtProfile profile,
|
||||
const char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH - 1]);
|
||||
const char name[FURI_HAL_BT_ADV_NAME_LENGTH]);
|
||||
|
||||
const char* furi_hal_bt_get_profile_adv_name(FuriHalBtProfile profile);
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ extern "C" {
|
||||
|
||||
#define FURI_HAL_VERSION_NAME_LENGTH 8
|
||||
#define FURI_HAL_VERSION_ARRAY_NAME_LENGTH (FURI_HAL_VERSION_NAME_LENGTH + 1)
|
||||
/** BLE symbol + name */
|
||||
#define FURI_HAL_BT_ADV_NAME_LENGTH (18 + 1) // 18 characters + null terminator
|
||||
#define FURI_HAL_VERSION_DEVICE_NAME_LENGTH \
|
||||
(1 + FURI_HAL_VERSION_ARRAY_NAME_LENGTH) + 9 // for bad kb custom name
|
||||
(1 + FURI_HAL_BT_ADV_NAME_LENGTH) // Used for custom BT name, BLE symbol + name
|
||||
|
||||
/** OTP Versions enum */
|
||||
typedef enum {
|
||||
|
||||
Reference in New Issue
Block a user