26 #define NFC_TEST_TIMEOUT_MS (20000U)
29 static bool m_has_connected;
30 static bool m_has_disconnected;
31 static bool m_has_sent;
32 static bool m_has_received;
36 void * p_data,
size_t data_len)
42 m_has_connected =
true;
46 m_has_disconnected =
true;
54 m_has_received =
true;
56 m_channel.
read (&rx_data);
76 printfp (
"\"init\":");
105 printfp (
"\"fail\",\r\n");
109 printfp (
"\"pass\",\r\n");
125 uint64_t start_time = 0;
126 bool timeout =
false;
128 printfp (
"\"tx_rx\":");
130 const char test_data[] =
"Lorem Ipsum";
137 m_channel.
on_evt = nfc_isr;
138 err_code |= m_channel.
send (&msg);
142 while (! (m_has_connected
143 && m_has_disconnected
154 if (
false == timeout)
170 printfp (
"\"timeout\"\r\n");
176 printfp (
"\"fail\"\r\n");
180 printfp (
"\"pass\"\r\n");
192 printfp (
"\"nfc\":{\r\n");
193 status |= ri_nfc_init_test (printfp);
194 status |= ri_nfc_rx_test (printfp);
uint32_t rd_status_t
bitfield for representing errors
#define RD_SUCCESS
Internal Error.
#define RD_ERROR_INVALID_STATE
Invalid state, operation disallowed in this state.
bool ri_communication_nfc_run_integration_test(const rd_test_print_fp printfp)
void(* rd_test_print_fp)(const char *const msg)
function pointer to print test information
Header to enable and disable module compilation.
Ruuvi error codes and error check function.
Functions for testing drivers.
#define RI_COMM_MESSAGE_MAX_LENGTH
The maximum length for the application message for sending over BLE, which depends on whether extende...
ri_comm_evt_t
Communication event type.
@ RI_COMM_CONNECTED
Connection established, OK to send, may receive data.
@ RI_COMM_RECEIVED
New data received, available to read with read function.
@ RI_COMM_SENT
One queued message was sent with all repetitions.
@ RI_COMM_DISCONNECTED
Connection lost, cannot send, may not receive data.
rd_status_t ri_nfc_init(ri_comm_channel_t *const channel)
rd_status_t ri_nfc_uninit(ri_comm_channel_t *const channel)
rd_status_t ri_rtc_init(void)
Initializes RTC at 0 ms.
rd_status_t ri_rtc_uninit(void)
Stop RTC if applicable.
uint64_t ri_rtc_millis(void)
Get milliseconds since init.
control API for communication via outside world
ri_comm_evt_handler_fp_t on_evt
Callback to application-level event handler, must be set in application.
ri_comm_xfer_fp_t send
Asynchronous send function.
ri_comm_xfer_fp_t read
Asynchronous read function.
Application message structure used for communication.
uint8_t data[RI_COMM_MESSAGE_MAX_LENGTH]
Data payload.
uint8_t data_length
Length of data.