Hi,
- I have a network of several centrals und several peripherals. I’m trying to find I way to manage the devices connections using the device manager and whiltelists.
- Peripheral start directed_slow advertising without timeout
- A Central, that goes to sleep after Max 2 mins, wakes up and should connect and bond with one specific peripheral. After some data exchange Central goes back to sleep for power save (PSV) reasons. The Centrals will be dedicated Remote Controls (RC), hence the PSV, or Apps running on Android or iOS.
I took the example in [ \..\..\examples\ble_peripheral\ble_app_uart\pca10028\s130\arm5_no_packs ] from SDK and would like to extend it with device manager functionalities as explained here.
At this point already, my peripheral won’t even advertise after I added device manager implementations. Pretty sure I’m missing an important configuration but it all seems ok to me. I need help in this.
static void sys_evt_dispatch(uint32_t sys_evt)
{
pstorage_sys_event_handler(sys_evt); // Forward Softdevice events to the pstorage module
ble_advertising_on_sys_evt(sys_evt);
}
static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
ble_conn_params_on_ble_evt(p_ble_evt);
ble_nus_on_ble_evt(&m_nus, p_ble_evt);
dm_ble_evt_handler(p_ble_evt);// Forward BLE events to the Device Manager
on_ble_evt(p_ble_evt);
ble_advertising_on_ble_evt(p_ble_evt);
bsp_btn_ble_on_ble_evt(p_ble_evt);
{
uint32_t err_code;
dm_init_param_t init_param = {.clear_persistent_data = erase_bonds};
dm_application_param_t register_param;
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);
APP_ERROR_CHECK(err_code);
register_param.sec_param.mitm = SEC_PARAM_MITM;
register_param.sec_param.lesc = SEC_PARAM_LESC;
register_param.sec_param.keypress = SEC_PARAM_KEYPRESS;
register_param.sec_param.io_caps = SEC_PARAM_IO_CAPABILITIES;
register_param.sec_param.oob = SEC_PARAM_OOB;
register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
register_param.evt_handler = device_manager_evt_handler;
register_param.service_type = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;
APP_ERROR_CHECK(err_code);
}
dm_event_t const * p_event,
ret_code_t event_result)
{
APP_ERROR_CHECK(event_result);
if (p_event->event_id == DM_EVT_LINK_SECURED)
{
app_context_load(p_handle);
}
#endif // BLE_DFU_APP_SUPPORT
}
{
uint32_t err_code;
ble_advdata_t advdata;
ble_advdata_t scanrsp;
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance = false;
advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
memset(&scanrsp, 0, sizeof(scanrsp));
scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
scanrsp.uuids_complete.p_uuids = m_adv_uuids;
options.ble_adv_fast_enabled = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout = APP_ADV_TIMEOUT_IN_SECONDS;
APP_ERROR_CHECK(err_code);
}
{
uint32_t err_code;
{
case BLE_ADV_EVT_FAST:
err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
APP_ERROR_CHECK(err_code);
break;
case BLE_ADV_EVT_IDLE:
sleep_mode_enter();
break;
default:
break;
}
}