uint32_t socket_medium_init(void) { APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false); static ipv6_medium_init_params_t ipv6_medium_init_params; memset(&ipv6_medium_init_params, 0x00, sizeof(ipv6_medium_init_params)); ipv6_medium_init_params.ipv6_medium_evt_handler = on_ipv6_medium_evt; ipv6_medium_init_params.ipv6_medium_error_handler = on_ipv6_medium_error; ipv6_medium_init_params.use_scheduler = false; uint32_t err_code = ipv6_medium_init(&ipv6_medium_init_params, IPV6_MEDIUM_ID_BLE, &m_ipv6_medium); APP_ERROR_CHECK(err_code); eui48_t ipv6_medium_eui48; err_code = ipv6_medium_eui48_get(m_ipv6_medium.ipv6_medium_instance_id, &ipv6_medium_eui48); ipv6_medium_eui48.identifier[EUI_48_SIZE - 1] = 0x00; err_code = ipv6_medium_eui48_set(m_ipv6_medium.ipv6_medium_instance_id, &ipv6_medium_eui48); APP_ERROR_CHECK(err_code); err_code = ipv6_medium_eui64_get(m_ipv6_medium.ipv6_medium_instance_id, &eui64_local_iid); APP_ERROR_CHECK(err_code); return NRF_SUCCESS; }
/**@brief Function for initializing IP stack. * * @details Initialize the IP Stack and its driver. */ static void ip_stack_init(void) { uint32_t err_code; err_code = ipv6_medium_eui64_get(m_ipv6_medium.ipv6_medium_instance_id, \ &eui64_local_iid); APP_ERROR_CHECK(err_code); err_code = nrf_mem_init(); APP_ERROR_CHECK(err_code); //Initialize LwIP stack. lwip_init(); //Initialize LwIP stack driver. err_code = nrf_driver_init(); APP_ERROR_CHECK(err_code); }
/**@brief Function for initializing IP stack. * * @details Initialize the IP Stack. */ static void ip_stack_init(void) { uint32_t err_code; ipv6_init_t init_param; err_code = ipv6_medium_eui64_get(m_ipv6_medium.ipv6_medium_instance_id, \ &eui64_local_iid); APP_ERROR_CHECK(err_code); init_param.p_eui64 = &eui64_local_iid; init_param.event_handler = ip_app_handler; err_code = ipv6_init(&init_param); APP_ERROR_CHECK(err_code); err_code = icmp6_receive_register(icmp6_handler); APP_ERROR_CHECK(err_code); }