/**@brief Function for handling the Application's BLE Stack events. * * @param[in] p_ble_evt Bluetooth stack event. */ static void on_ble_evt(ble_evt_t * p_ble_evt) { uint32_t err_code; uint8_t i; uint32_t tmp; uint8_t tx_CLOSE[20] = ("AT+CIPCLOSE=0\r\n"); uint8_t tx_DATA[20]; const ble_gap_evt_t * p_gap_evt = &p_ble_evt->evt.gap_evt; const ble_gap_evt_adv_report_t *p_adv = &p_ble_evt->evt.gap_evt.params.adv_report; switch (p_ble_evt->header.evt_id) { case BLE_GAP_EVT_ADV_REPORT: { const ble_gap_evt_adv_report_t * p_adv_report = &p_gap_evt->params.adv_report; { // scan is automatically stopped by the connect err_code = bsp_indication_set(BSP_INDICATE_IDLE); APP_ERROR_CHECK(err_code); tx_DATA[2] = p_adv_report->peer_addr.addr[5]; NRF_LOG_INFO("Mac address %02x%02x%02x%02x%02x%02x\r\n", tx_DATA[2], p_adv_report->peer_addr.addr[4], p_adv_report->peer_addr.addr[3], p_adv_report->peer_addr.addr[2], p_adv_report->peer_addr.addr[1], p_adv_report->peer_addr.addr[0] ); NRF_LOG_INFO("Data: "); for(i=0;i<17;i++) { NRF_LOG_INFO("%02x", p_adv->data[i]); } NRF_LOG_INFO(" \r\nRSSI: %d\n", p_adv->rssi); } uart_loopback_test(); //} }break; // BLE_GAP_EVT_ADV_REPORT