/**@brief Function for initializing the client handling. */ void client_handling_init(void) { uint32_t err_code; uint32_t i; ble_uuid128_t base_uuid = MULTILINK_PERIPHERAL_BASE_UUID; err_code = sd_ble_uuid_vs_add(&base_uuid, &m_base_uuid_type); APP_ERROR_CHECK(err_code); for (i = 0; i < MAX_CLIENTS; i++) { m_client[i].state = IDLE; } m_client_count = 0; db_discovery_init(); // Register with discovery module for the discovery of the service. ble_uuid_t uuid; uuid.type = m_base_uuid_type; uuid.uuid = MULTILINK_PERIPHERAL_SERVICE_UUID; err_code = ble_db_discovery_evt_register(&uuid, db_discovery_evt_handler); APP_ERROR_CHECK(err_code); }
int main(void) { uint32_t err_code; bool erase_bonds; // Initialize. APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, NULL); buttons_leds_init(&erase_bonds); uart_init(); printf("Relay Example\r\n"); ble_stack_init(); device_manager_init(erase_bonds); db_discovery_init(); hrs_c_init(); rscs_c_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); // Start scanning for peripherals and initiate connection // with devices that advertise Heart Rate UUID. scan_start(); // Start advertising. err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); for (;; ) { power_manage(); } }
int main(void) { ret_code_t err_code; err_code = NRF_LOG_INIT(); APP_ERROR_CHECK(err_code); NRF_LOG_PRINTF("[APP]: Multilink Example\r\n"); leds_init(); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL); buttons_init(); ble_stack_init(); db_discovery_init(); lbs_c_init(); // Start scanning for peripherals and initiate connection to devices which // advertise. scan_start(); // Turn on the LED to signal scanning. LEDS_ON(CENTRAL_SCANNING_LED); for (;;) { // Wait for BLE events. power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; bool erase_bonds; // Initialize timers_init(); nrf_log_init(); buttons_leds_init(&erase_bonds); ble_stack_init(); device_manager_init(erase_bonds); db_discovery_init(); scheduler_init(); gap_params_init(); advertising_init(); services_init(); conn_params_init(); // Start execution err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); NRF_LOG("\r\nCTS Start!\r\n"); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { bool erase_bonds; uint32_t err_code; // Initialize. app_trace_init(); timers_init(); uart_init(); buttons_leds_init(&erase_bonds); ble_stack_init(); APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE); printf("BLE ANCS\n"); device_manager_init(erase_bonds); db_discovery_init(); scheduler_init(); gap_params_init(); service_init(); advertising_init(); conn_params_init(); // Start execution. err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); // Enter main loop. for (;;) { app_sched_execute(); power_manage(); } }
int main(void) { bool erase_bonds; // Initialize. APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, NULL); buttons_leds_init(&erase_bonds); uart_init(); printf("Battery collector example\r\n"); ble_stack_init(); device_manager_init(erase_bonds); db_discovery_init(); //hrs_c_init(); bas_c_init(); pwm_init(); // Start scanning for peripherals and initiate connection // with devices that advertise Heart Rate UUID. scan_start(); for (;; ) { power_manage(); } }
int main(void) { uint32_t err_code; APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, NULL); err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),NULL); APP_ERROR_CHECK(err_code); leds_init(); timers_init(); uart_init(); ble_stack_init(); device_manager_init(); db_discovery_init(); uart_c_init(); printf("Scanning ...\r\n"); // Start scanning for peripherals and initiate connection // with devices that advertise NUS UUID. scan_start(); for (;;) { power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; bool erase_bonds; // Initialize. err_code = NRF_LOG_INIT(); APP_ERROR_CHECK(err_code); timers_init(); buttons_leds_init(&erase_bonds); ble_stack_init(); peer_manager_init(erase_bonds); if (erase_bonds == true) { NRF_LOG_DEBUG("Bonds erased!\r\n"); } gap_params_init(); advertising_init(); db_discovery_init(); alert_notification_init(); conn_params_init(); // Start execution. advertising_start(); // Enter main loop. for (;;) { power_manage(); } }
int main(void) { ret_code_t err_code; bool erase_bonds; err_code = NRF_LOG_INIT(); APP_ERROR_CHECK(err_code); NRF_LOG_PRINTF("Relay Example\r\n"); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL); buttons_leds_init(&erase_bonds); if (erase_bonds == true) { NRF_LOG("Bonds erased!\r\n"); } ble_stack_init(); peer_manager_init(erase_bonds); db_discovery_init(); hrs_c_init(); rscs_c_init(); gap_params_init(); conn_params_init(); services_init(); advertising_init(); /** Start scanning for peripherals and initiate connection to devices which * advertise Heart Rate or Running speed and cadence UUIDs. */ scan_start(); // Turn on the LED to signal scanning. LEDS_ON(CENTRAL_SCANNING_LED); // Start advertising. err_code = ble_advertising_start(BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); for (;;) { // Wait for BLE events. power_manage(); } }
static QState Ble_initial(Ble* const me) { timers_init(); //nrf_log_init(); ble_stack_init(); uint8_t BSP_readButton(); uint8_t btn = BSP_readButton(); device_manager_init(btn); db_discovery_init(); //scheduler_init(); gap_params_init(); service_init(); advertising_init(); conn_params_init(); return Q_TRAN(&Ble_disconnected); }
int main(void) { // Initialization of various modules. uint32_t err_code; const app_uart_comm_params_t comm_params = { RX_PIN_NUMBER, TX_PIN_NUMBER, RTS_PIN_NUMBER, CTS_PIN_NUMBER, APP_UART_FLOW_CONTROL_ENABLED, false, UART_BAUDRATE_BAUDRATE_Baud38400 }; APP_UART_FIFO_INIT(&comm_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_error_handle, APP_IRQ_PRIORITY_LOW, err_code); APP_ERROR_CHECK(err_code); app_trace_init(); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, NULL); APP_GPIOTE_INIT(1); err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),NULL); APP_ERROR_CHECK(err_code); printf("Heart rate collector example\r\n"); ble_stack_init(); device_manager_init(); db_discovery_init(); hrs_c_init(); bas_c_init(); // Start scanning for peripherals and initiate connection // with devices that advertise Heart Rate UUID. scan_start(); for (;; ) { power_manage(); } }
/**@brief Function for initializing the client handling. */ void client_handling_init(void) { uint32_t err_code; uint32_t i; //Add the Ms. Pacman base UUID ble_uuid128_t base_uuid = BLE_MS_PACMAN_BASE_UUID; err_code = sd_ble_uuid_vs_add(&base_uuid, &m_base_uuid_type_ms_pacman); APP_ERROR_CHECK(err_code); //Add the Nunchuck base UUID ble_uuid128_t base_uuid_1 = BLE_NUNCHUCK_BASE_UUID; err_code = sd_ble_uuid_vs_add(&base_uuid_1, &m_base_uuid_type_nunchuck); APP_ERROR_CHECK(err_code); for (i = 0; i < MAX_CLIENTS; i++) { m_client[i].state = IDLE; } m_client_count = 0; db_discovery_init(); // Register with discovery module for the discovery of the service. ble_uuid_t uuid; //Register the Ms. Pacman Service with the discover module uuid.type = m_base_uuid_type_ms_pacman; uuid.uuid = BLE_MS_PACMAN_SERVICE_UUID; err_code = ble_db_discovery_evt_register(&uuid, db_discovery_evt_handler); //Register the Nunchuck Service with the discover module uuid.type = m_base_uuid_type_nunchuck; uuid.uuid = BLE_NUNCHUCK_SERVICE_UUID; err_code = ble_db_discovery_evt_register(&uuid, db_discovery_evt_handler); APP_ERROR_CHECK(err_code); }
void ble_central_mode_init(void) { // app_trace_init(); // APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, NULL); // APP_GPIOTE_INIT(1); // err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),NULL); // APP_ERROR_CHECK(err_code); // printf("Heart rate collector example\r\n"); ble_stack_init(); device_manager_init(); db_discovery_init(); hrs_c_init(); bas_c_init(); // Start scanning for peripherals and initiate connection // with devices that advertise Heart Rate UUID. scan_start(); }
int main(void) { ret_code_t err_code; bool erase_bonds; err_code = NRF_LOG_INIT(); APP_ERROR_CHECK(err_code); NRF_LOG_PRINTF("Relay Example\r\n"); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL); buttons_leds_init(&erase_bonds); if (erase_bonds) { NRF_LOG_PRINTF("Bonds erased!\r\n"); } ble_stack_init(); peer_manager_init(erase_bonds); db_discovery_init(); hrs_c_init(); rscs_c_init(); gap_params_init(); conn_params_init(); services_init(); advertising_init(); adv_scan_start(); for (;;) { // Wait for BLE events. power_manage(); } }