Filter only the first few characters of the name

Hello Nordic Engineer,

I used SDK17.1.0 and ble_app_multirole_lesc

(I have changed my mind and want to address the issue using appearance, because the device name is determined by the customer.)

// ------------ sdk_config.h ------------
#define DEVICE_NAME "NordicLESCApp"



// ------------ main.c ------------ 
static const char m_target_periph_name[] = "NordicLESCApp";

static void scan_init(void)
{
    ...
    
    nrf_ble_scan_filter_set(&m_scan, SCAN_NAME_FILTER, m_target_periph_name);
    nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_NAME_FILTER, false);
}

static void advertising_init(void)
{
    ...
    
    init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    
    ...
}

According to this setting, the advertising is the full name, which is "NordicLESCApp".

Can I filter only the first few characters of the name, such as "NordicLESC", or just "Nordic"?

Thanks

======================【Upadate:appearance】==========================

ble_advertising_init_t init;

init.advdata.include_appearance      = true;

sd_ble_gap_appearance_set(BLE_APPEARANCE_HID_KEYBOARD);

ble_advertising_init(&m_advertising, &init);

Should the code for setting the appearance be placed before ble_advertising_init()?

The following is the scan section.

uint16_t a;

nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);

a = BLE_APPEARANCE_HID_KEYBOARD;

nrf_ble_scan_filter_set(&m_scan, SCAN_APPEARANCE_FILTER, &a);

nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_APPEARANCE_FILTER, false);

Can I use appearance filtering like this? Have I missed anything(Just like sdk_config.h)?

Thanks

Related