#define DEVICE_NAME "S140_"
uint32_t test_id = 10086;
/**@brief Function for the GAP initialization.
*
* @details This function will set up all the necessary GAP (Generic Access Profile) parameters of
* the device. It also sets the permissions and appearance.
*/
static void gap_params_init(void)
{
uint32_t err_code;
ble_gap_conn_params_t gap_conn_params;
ble_gap_conn_sec_mode_t sec_mode;
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
char buf[32];
uint8_t name_len = sprintf(buf,"%s%06u",DEVICE_NAME,test_id);
err_code = sd_ble_gap_device_name_set(&sec_mode,
(const uint8_t *) buf,
name_len);
APP_ERROR_CHECK(err_code);
memset(&gap_conn_params, 0, sizeof(gap_conn_params));
gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
gap_conn_params.slave_latency = SLAVE_LATENCY;
gap_conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT;
err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
APP_ERROR_CHECK(err_code);
}
voidsave_id_to_noinit_ram(void);/**@brief Function for handling the data from the Nordic UART Service.
*
* @details This function will process the data received from the Nordic UART BLE Service and send
* it to the UART module.
*
* @param[in] p_evt Nordic UART Service event.
*//**@snippet [Handling the data received over BLE] */staticvoidnus_data_handler(ble_nus_evt_t* p_evt){if(p_evt->type == BLE_NUS_EVT_RX_DATA){save_id_to_noinit_ram();sd_power_gpregret_clr(0,0xffffffff);sd_power_gpregret_set(0,0xb1);NVIC_SystemReset();}}