nRF51 SDK - S210 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ANT-FS client device simulator

The ANT-FS client device simulator. More...

Data Structures

union  antfs_beacon_status_byte1_t
 ANT-FS beacon status. More...
 
struct  antfs_event_return_t
 ANT-FS <-> application event communication object. More...
 
struct  antfs_params_t
 ANT-FS parameters. More...
 
struct  antfs_dir_header_t
 ANT-FS directory header. More...
 
struct  antfs_dir_struct_t
 ANT-FS directory entry. More...
 
struct  antfs_request_info_t
 ANT-FS download/upload request context. More...
 
union  ushort_union_t
 uint16_t type presentation as an union. More...
 
union  ulong_union_t
 uint32_t type presentation as an union. More...
 

Macros

#define ANTFS_VERSION_MAJOR   1u
 
#define ANTFS_VERSION_MINOR   0
 
#define ANTFS_VERSION_ITERATION   0
 
#define ANTFS_VERSION_TYPE   'R'
 
#define ANTFS_VERSION_SPEC   '0.AK'
 
#define ANTFS_DIR_STRUCT_VERSION   1u
 
#define ANTFS_VERSION_DATE   20090522u
 
#define ANTFS_NETWORK_NUMBER   0
 
#define ANTFS_CHANNEL   0
 
#define ANTFS_LINK_FREQ   50u
 
#define ANTFS_PAIRING_TIMEOUT   120u
 
#define ANTFS_LINK_COMMAND_TIMEOUT   10u
 
#define ANTFS_TRANS_TYPE   5u
 
#define ANTFS_DEVICE_TYPE   1u
 
#define ANTFS_CHANNEL_TYPE   CHANNEL_TYPE_MASTER
 
#define ANTFS_BEACON_PERIOD_STATUS   BEACON_PERIOD_4_HZ
 
#define ANTFS_TRANSMIT_POWER   3u
 
#define ANTFS_CUSTOM_TRANSMIT_POWER   0u
 
#define ANTFS_AUTH_STRING_MAX   255u
 
#define ANTFS_PASSKEY_SIZE   16u
 
#define ANTFS_FRIENDLY_NAME_MAX   16u
 
#define ANTFS_REMOTE_FRIENDLY_NAME_MAX   16u
 
#define BEACON_PERIOD_SHIFT   0x00
 
#define BEACON_PERIOD_MASK   (0x07u << BEACON_PERIOD_SHIFT)
 
#define BEACON_PERIOD_0_5_HZ   (0x00 << BEACON_PERIOD_SHIFT)
 
#define BEACON_PERIOD_1_HZ   (0x01u << BEACON_PERIOD_SHIFT)
 
#define BEACON_PERIOD_2_HZ   (0x02u << BEACON_PERIOD_SHIFT)
 
#define BEACON_PERIOD_4_HZ   (0x03u << BEACON_PERIOD_SHIFT)
 
#define BEACON_PERIOD_8_HZ   (0x04u << BEACON_PERIOD_SHIFT)
 
#define PAIRING_AVAILABLE_FLAG_SHIFT   0x03u
 
#define PAIRING_AVAILABLE_FLAG_MASK   (0x01u << PAIRING_AVAILABLE_FLAG_SHIFT)
 
#define UPLOAD_ENABLED_FLAG_SHIFT   0x04u
 
#define UPLOAD_ENABLED_FLAG_MASK   (0x01u << UPLOAD_ENABLED_FLAG_SHIFT)
 
#define DATA_AVAILABLE_FLAG_SHIFT   0x05u
 
#define DATA_AVAILABLE_FLAG_MASK   (0x01u << DATA_AVAILABLE_FLAG_SHIFT)
 
#define ANTFS_PAIRING_BIT   0x00u
 
#define ANTFS_UPLOAD_BIT   0x00u
 
#define ANTFS_DEFAULT_BEACON   (ANTFS_BEACON_PERIOD_STATUS | ANTFS_UPLOAD_BIT | ANTFS_PAIRING_BIT | DATA_AVAILABLE_FLAG_MASK)
 
#define RESPONSE_MESSAGE_OK   0x00u
 
#define RESPONSE_MESSAGE_NOT_EXIST   0x01u
 
#define RESPONSE_MESSAGE_NOT_AVAILABLE   0x02u
 
#define RESPONSE_MESSAGE_NOT_READY   0x03u
 
#define RESPONSE_INVALID_OPERATION   0x04u
 
#define RESPONSE_INVALID_CRC   0x05u
 
#define RESPONSE_MESSAGE_NOT_ENOUGH_SPACE   0x03u
 
#define RESPONSE_MESSAGE_FAIL   0x01u
 
#define ANTFS_DIR_READ_MASK   0x80u
 
#define ANTFS_DIR_WRITE_MASK   0x40u
 
#define ANTFS_DIR_ERASE_MASK   0x20u
 
#define ANTFS_DIR_ARCHIVE_MASK   0x10u
 
#define ANTFS_DIR_APPEND_MASK   0x08u
 
#define ANTFS_MAX_FILE_SIZE   0xFFFFFFFFu
 
#define ANTFS_BURST_BLOCK_SIZE   20u
 
#define MAX_ULONG   0xFFFFFFFFu
 
#define APP_TIMER_PRESCALER   0
 
#define ANT_EVENT_MSG_BUFFER_MIN_SIZE   32u
 
#define ANTFS_CLIENT_SERIAL_NUMBER   0xABCDEF12u
 
#define ANTFS_CLIENT_DEV_TYPE   416u
 
#define ANTFS_CLIENT_MANUF_ID   2u
 
#define ANTFS_CLIENT_NAME   { "Ref Design" }
 
#define ANTFS_CLIENT_PASSKEY   {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10}
 
#define APP_TIMER_MAX_TIMERS   2u
 
#define APP_TIMER_OP_QUEUE_SIZE   4u
 
#define APP_GPIOTE_MAX_USERS   1u
 
#define BUTTON_DETECTION_DELAY   APP_TIMER_TICKS(50u, APP_TIMER_PRESCALER)
 

Enumerations

enum  antfs_state_t {
  ANTFS_STATE_OFF,
  ANTFS_STATE_INIT,
  ANTFS_STATE_LINK,
  ANTFS_STATE_AUTH,
  ANTFS_STATE_TRANS
}
 
enum  antfs_link_substate_t { ANTFS_LINK_SUBSTATE_NONE }
 
enum  antfs_authenticate_substate_t {
  ANTFS_AUTH_SUBSTATE_NONE,
  ANTFS_AUTH_SUBSTATE_PAIR,
  ANTFS_AUTH_SUBSTATE_PASSKEY,
  ANTFS_AUTH_SUBSTATE_ACCEPT,
  ANTFS_AUTH_SUBSTATE_REJECT
}
 
enum  antfs_transport_substate_t {
  ANTFS_TRANS_SUBSTATE_NONE,
  ANTFS_TRANS_SUBSTATE_VERIFY_CRC,
  ANTFS_TRANS_SUBSTATE_DOWNLOADING,
  ANTFS_TRANS_SUBSTATE_UPLOAD_WAIT_FOR_DATA,
  ANTFS_TRANS_SUBSTATE_UPLOADING,
  ANTFS_TRANS_SUBSTATE_UPLOAD_RESUME
}
 
enum  antfs_event_t {
  ANTFS_EVENT_PAIRING_REQUEST = 0xB0,
  ANTFS_EVENT_PAIRING_TIMEOUT = 0xB1,
  ANTFS_EVENT_OPEN_COMPLETE = 0xB2,
  ANTFS_EVENT_CLOSE_COMPLETE = 0xB4,
  ANTFS_EVENT_LINK = 0xB6,
  ANTFS_EVENT_AUTH = 0xB7,
  ANTFS_EVENT_TRANS = 0xB8,
  ANTFS_EVENT_DOWNLOAD_REQUEST = 0xB9,
  ANTFS_EVENT_DOWNLOAD_REQUEST_DATA = 0xBA,
  ANTFS_EVENT_DOWNLOAD_START = 0xBB,
  ANTFS_EVENT_DOWNLOAD_COMPLETE = 0xBC,
  ANTFS_EVENT_DOWNLOAD_FAIL = 0xBD,
  ANTFS_EVENT_UPLOAD_REQUEST = 0xBE,
  ANTFS_EVENT_UPLOAD_DATA = 0xBF,
  ANTFS_EVENT_UPLOAD_START = 0xC0,
  ANTFS_EVENT_UPLOAD_COMPLETE = 0xC1,
  ANTFS_EVENT_UPLOAD_FAIL = 0xC2,
  ANTFS_EVENT_ERASE_REQUEST = 0xC3
}
 
enum  leddriver_led_id_t {
  LED_ID_0,
  LED_ID_1,
  LED_ID_MAX
}
 
enum  pairing_state_t {
  PAIRING_OFF = 0,
  PAIRING_ACCEPT,
  PAIRING_DENY
}
 

Functions

void antfs_init (const antfs_params_t *const p_params)
 Function for setting initial ANT-FS configuration parameters. More...
 
const char * antfs_hostname_get (void)
 Function for getting host name if received. More...
 
bool antfs_pairing_resp_transmit (bool accept)
 Function for transmitting a response to a pairing request issued by ANT-FS host. More...
 
void antfs_download_req_resp_prepare (uint8_t response, const antfs_request_info_t *const p_request_info)
 Function for doing calculations prior downloading the data to the ANT-FS host. More...
 
uint32_t antfs_input_data_download (uint16_t index, uint32_t offset, uint32_t num_bytes, const uint8_t *const p_message)
 Function for downloading requested data. More...
 
bool antfs_upload_req_resp_transmit (uint8_t response, const antfs_request_info_t *const p_request_info)
 Function for transmitting upload request response to a upload request command by ANT-FS host. More...
 
bool antfs_upload_data_resp_transmit (bool data_upload_success)
 Function for transmitting upload data response to a upload data command by ANT-FS host. More...
 
void antfs_erase_req_resp_transmit (uint8_t response)
 Function for transmitting erase response to a erase request. More...
 
bool antfs_event_extract (antfs_event_return_t *const p_event)
 Function for extracting possible pending ANT-FS event. More...
 
void antfs_message_process (uint8_t *p_message)
 Function for processing ANT events and data received from the ANT-FS channel. More...
 
void antfs_channel_setup (void)
 Function for setting up the ANT-FS channel.
 
uint16_t crc_crc16_update (uint16_t current_crc, const volatile void *p_data, uint32_t size)
 Function for calculating CRC-16 in blocks. More...
 
void leddriver_init (void)
 Function for configuring all the GPIOs needed by the driver.
 
void leddriver_led_turn_on (leddriver_led_id_t led_id)
 Function for turning on a single LED. More...
 
void leddriver_led_turn_off (leddriver_led_id_t led_id)
 Function for turning off a single LED. More...
 
void leddriver_led_toggle (leddriver_led_id_t led_id)
 Function for toggling a single LED. More...
 
bool mem_file_write (uint16_t index, uint32_t offset, const void *p_data, uint32_t size)
 Function for writing data to file system. More...
 
void mem_file_read (uint16_t index, uint32_t offset, void *p_data, uint32_t size)
 Function for reading data from file system. More...
 
bool mem_file_erase (uint16_t index)
 Function for erasing file from file system. More...
 
bool mem_file_info_get (uint16_t index, antfs_dir_struct_t *p_file_info)
 Function for retrieving file information from directory. More...
 
void softdevice_assert_callback (uint32_t pc, uint16_t line_num, const uint8_t *p_file_name)
 Function for handling SoftDevice asserts, does not return. More...
 
void app_error_handler (uint32_t error_code, uint32_t line_num, const uint8_t *p_file_name)
 Function for handling an error. More...
 
void SD_EVT_IRQHandler (void)
 Function for handling protocol stack IRQ. More...
 
void button_event_handler (uint8_t pin_no, uint8_t button_action)
 Function for handling button events. More...
 
int main (void)
 Function for application main entry, does not return. More...
 

Detailed Description

The ANT-FS client device simulator.

Note
The ANT-FS Network Key is available for ANT+ Adopters. Please refer to http://thisisant.com to become an ANT+ Adopter and access the key.

Macro Definition Documentation

#define ANT_EVENT_MSG_BUFFER_MIN_SIZE   32u

Minimum size of ANT event message buffer.

#define ANTFS_AUTH_STRING_MAX   255u

Maximum size of authentication strings (passkey/friendly name).

#define ANTFS_BEACON_PERIOD_STATUS   BEACON_PERIOD_4_HZ

ANT-FS Beacon Message Period.

#define ANTFS_BURST_BLOCK_SIZE   20u

Size of each block of burst data that the client attempts to send when it processes a data request event.

#define ANTFS_CHANNEL   0

ANT Channel Number.

#define ANTFS_CHANNEL_TYPE   CHANNEL_TYPE_MASTER

ANT-FS Client Channel Type.

#define ANTFS_CLIENT_DEV_TYPE   416u

Beacon device type.

#define ANTFS_CLIENT_MANUF_ID   2u

Beacon manufacturer ID.

#define ANTFS_CLIENT_NAME   { "Ref Design" }

Client's friendly name.

#define ANTFS_CLIENT_PASSKEY   {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10}

Client passkey.

#define ANTFS_CLIENT_SERIAL_NUMBER   0xABCDEF12u

Serial number of client device.

#define ANTFS_CUSTOM_TRANSMIT_POWER   0u

ANT Custom Transmit Power (0dBm).

Define the default beacon setting.

#define ANTFS_DEVICE_TYPE   1u

ANT-FS Device Type.

#define ANTFS_DIR_APPEND_MASK   0x08u

Append (can append to file only).

#define ANTFS_DIR_ARCHIVE_MASK   0x10u

Archive (has been downloaded).

#define ANTFS_DIR_ERASE_MASK   0x20u

Erase (can erase).

#define ANTFS_DIR_READ_MASK   0x80u

Read (can download).

#define ANTFS_DIR_STRUCT_VERSION   1u

Version of the directory file structure.

#define ANTFS_DIR_WRITE_MASK   0x40u

Write (can upload).

#define ANTFS_FRIENDLY_NAME_MAX   16u

Maximum size of friendly name received from host.

#define ANTFS_LINK_COMMAND_TIMEOUT   10u

Command timeout (time the client will wait without receiving any commands before switching to the link layer, in seconds).

#define ANTFS_LINK_FREQ   50u

RF Frequency (+2400MHz).

#define ANTFS_MAX_FILE_SIZE   0xFFFFFFFFu

Maximum file size, as specified by directory structure.

#define ANTFS_NETWORK_NUMBER   0

ANT-FS Network Number.

#define ANTFS_PAIRING_BIT   0x00u

Build pairing disabled default beacon setting.

#define ANTFS_PAIRING_TIMEOUT   120u

Pairing timeout (time the UI will wait for a response to the pairing request before switching to the link layer, in seconds).

#define ANTFS_PASSKEY_SIZE   16u

Passkey size.

#define ANTFS_REMOTE_FRIENDLY_NAME_MAX   16u

Maximum size of client's friendly name.

#define ANTFS_TRANS_TYPE   5u

ANT-FS Transmission Type.

#define ANTFS_TRANSMIT_POWER   3u

ANT Transmit Power (0dBm).

#define ANTFS_UPLOAD_BIT   0x00u

Build upload disabled default beacon setting.

#define ANTFS_VERSION_DATE   20090522u

Version date.

#define ANTFS_VERSION_ITERATION   0

Version iteration.

#define ANTFS_VERSION_MAJOR   1u

Version major number.

#define ANTFS_VERSION_MINOR   0

Version minor number.

#define ANTFS_VERSION_SPEC   '0.AK'

Version of the ANT-FS Technology Specification.

#define ANTFS_VERSION_TYPE   'R'

Version type is release.

#define APP_GPIOTE_MAX_USERS   1u

Maximum number of users of the GPIOTE handler.

#define APP_TIMER_MAX_TIMERS   2u

Maximum number of simultaneously created timers.

#define APP_TIMER_OP_QUEUE_SIZE   4u

Size of timer operation queues.

#define APP_TIMER_PRESCALER   0

Value of the RTC1 PRESCALER register.

#define BEACON_PERIOD_0_5_HZ   (0x00 << BEACON_PERIOD_SHIFT)

Value for 0,5Hz beacon period.

#define BEACON_PERIOD_1_HZ   (0x01u << BEACON_PERIOD_SHIFT)

Value for 1Hz beacon period.

#define BEACON_PERIOD_2_HZ   (0x02u << BEACON_PERIOD_SHIFT)

Value for 2Hz beacon period.

#define BEACON_PERIOD_4_HZ   (0x03u << BEACON_PERIOD_SHIFT)

Value for 4Hz beacon period.

#define BEACON_PERIOD_8_HZ   (0x04u << BEACON_PERIOD_SHIFT)

Value for 8Hz beacon period.

#define BEACON_PERIOD_MASK   (0x07u << BEACON_PERIOD_SHIFT)

Beacon period bitmask.

#define BEACON_PERIOD_SHIFT   0x00

Shift value for masking out beacon period.

#define BUTTON_DETECTION_DELAY   APP_TIMER_TICKS(50u, APP_TIMER_PRESCALER)

Delay from a GPIOTE event until a button is reported as pushed (in number of timer ticks).

#define DATA_AVAILABLE_FLAG_MASK   (0x01u << DATA_AVAILABLE_FLAG_SHIFT)

Data available bitmask.

#define DATA_AVAILABLE_FLAG_SHIFT   0x05u

Shift value for masking out data available bit.

#define MAX_ULONG   0xFFFFFFFFu

The Max value for the type.

#define PAIRING_AVAILABLE_FLAG_MASK   (0x01u << PAIRING_AVAILABLE_FLAG_SHIFT)

Pairing enabled bitmask.

#define PAIRING_AVAILABLE_FLAG_SHIFT   0x03u

Shift value for masking out pairing enabled bit.

#define RESPONSE_INVALID_CRC   0x05u

CRC incorrect.

#define RESPONSE_INVALID_OPERATION   0x04u

Request invalid.

#define RESPONSE_MESSAGE_FAIL   0x01u

Data File Index does not exist / Erase failed.

#define RESPONSE_MESSAGE_NOT_AVAILABLE   0x02u

File can not be read/written to (download/upload respectively).

#define RESPONSE_MESSAGE_NOT_ENOUGH_SPACE   0x03u

Not enough space to to complete write.

#define RESPONSE_MESSAGE_NOT_EXIST   0x01u

File does not exist.

#define RESPONSE_MESSAGE_NOT_READY   0x03u

Not ready to download.

#define RESPONSE_MESSAGE_OK   0x00u

Download request ok.

#define UPLOAD_ENABLED_FLAG_MASK   (0x01u << UPLOAD_ENABLED_FLAG_SHIFT)

Upload enabled bitmask.

#define UPLOAD_ENABLED_FLAG_SHIFT   0x04u

Shift value for masking out upload enabled bit.

Enumeration Type Documentation

Enumerator
ANTFS_AUTH_SUBSTATE_NONE 

None state.

ANTFS_AUTH_SUBSTATE_PAIR 

Pairing state.

ANTFS_AUTH_SUBSTATE_PASSKEY 

Passkey state.

ANTFS_AUTH_SUBSTATE_ACCEPT 

Authenticate accept state.

ANTFS_AUTH_SUBSTATE_REJECT 

Authenticate reject state.

Enumerator
ANTFS_EVENT_PAIRING_REQUEST 

Pairing request event.

ANTFS_EVENT_PAIRING_TIMEOUT 

Pairing timeout event.

ANTFS_EVENT_OPEN_COMPLETE 

Channel setup complete event.

ANTFS_EVENT_CLOSE_COMPLETE 

Channel closed event.

ANTFS_EVENT_LINK 

Enter link layer event.

ANTFS_EVENT_AUTH 

Enter authenticate layer event.

ANTFS_EVENT_TRANS 

Enter transport layer event.

ANTFS_EVENT_DOWNLOAD_REQUEST 

Download request event.

ANTFS_EVENT_DOWNLOAD_REQUEST_DATA 

Download request data event.

ANTFS_EVENT_DOWNLOAD_START 

Download started event.

ANTFS_EVENT_DOWNLOAD_COMPLETE 

Download completed event.

ANTFS_EVENT_DOWNLOAD_FAIL 

Download failed event.

ANTFS_EVENT_UPLOAD_REQUEST 

Upload request event.

ANTFS_EVENT_UPLOAD_DATA 

Upload data available for read event.

ANTFS_EVENT_UPLOAD_START 

Upload begin event.

ANTFS_EVENT_UPLOAD_COMPLETE 

Upload completed event.

ANTFS_EVENT_UPLOAD_FAIL 

Upload process failed event.

ANTFS_EVENT_ERASE_REQUEST 

Erase request event.

Enumerator
ANTFS_LINK_SUBSTATE_NONE 

None state.

Enumerator
ANTFS_STATE_OFF 

Off state.

ANTFS_STATE_INIT 

Init state.

ANTFS_STATE_LINK 

Link state.

ANTFS_STATE_AUTH 

Authenticate state.

ANTFS_STATE_TRANS 

Transport state.

Enumerator
ANTFS_TRANS_SUBSTATE_NONE 

None state.

ANTFS_TRANS_SUBSTATE_VERIFY_CRC 

Verify CRC state.

ANTFS_TRANS_SUBSTATE_DOWNLOADING 

Downloading state.

ANTFS_TRANS_SUBSTATE_UPLOAD_WAIT_FOR_DATA 

Wait for upload data request state.

ANTFS_TRANS_SUBSTATE_UPLOADING 

Ready / receiving upload data state.

ANTFS_TRANS_SUBSTATE_UPLOAD_RESUME 

RX failure upon receiving upload data state.

Enumerator
LED_ID_0 

Led 0 ID.

LED_ID_1 

Led 1 ID.

Enumerator
PAIRING_OFF 

Pairing state not active.

PAIRING_ACCEPT 

Pairing accept.

PAIRING_DENY 

Pairing deny.

Function Documentation

void antfs_download_req_resp_prepare ( uint8_t  response,
const antfs_request_info_t *const  p_request_info 
)

Function for doing calculations prior downloading the data to the ANT-FS host.

Function does the necessary pre processing calculations, which are required prior downloading the data, and also transmits the download request response right away in case of the download request was rejected or there is no data to send.

Parameters
[in]responseThe download request response code.
[in]p_request_infoANT-FS request info structure.

< ANT-FS download request command ID.

void antfs_erase_req_resp_transmit ( uint8_t  response)

Function for transmitting erase response to a erase request.

Parameters
[in]responseThe erase response code.

< ANT-FS erase request command ID.

< The burst packet size.

< The ANT-FS command ID.

< ANT-FS erase response command ID.

bool antfs_event_extract ( antfs_event_return_t *const  p_event)

Function for extracting possible pending ANT-FS event.

Parameters
[out]p_eventThe output event structure.
Return values
trueOperation success. Pending ANT-FS event available and it was copied to the output event structure.
falseOperation failure. No pending ANT-FS event available.

< ANT-FS event queue size.

const char* antfs_hostname_get ( void  )

Function for getting host name if received.

Returns
Pointer to host name buffer if a host name was recieved, NULL otherwise.
void antfs_init ( const antfs_params_t *const  p_params)

Function for setting initial ANT-FS configuration parameters.

Parameters
[in]p_paramsThe initial ANT-FS configuration parameters.
uint32_t antfs_input_data_download ( uint16_t  index,
uint32_t  offset,
uint32_t  num_bytes,
const uint8_t *const  p_message 
)

Function for downloading requested data.

Parameters
[in]indexIndex of the current file downloaded.
[in]offsetOffset specified by client.
[in]num_bytesNumber of bytes requested to be transmitted from the buffer.
[in]p_messageData buffer to be transmitted.
Returns
Number of data bytes transmitted.

< The burst packet size.

< The burst packet size.

< The burst packet size.

< The burst packet size.

void antfs_message_process ( uint8_t *  p_message)

Function for processing ANT events and data received from the ANT-FS channel.

Parameters
[in]p_messageThe message buffer containing the message received from the ANT-FS channel.

< ANT message buffer index channel number offset.

< ANT message buffer index ID offset.

< ANT message buffer index response code offset.

< ANT message buffer index ID offset.

< The control offset within ANT-FS message.

< The data offset within ANT-FS message.

< The control offset within ANT-FS message.

< The data offset within ANT-FS message.

< The control offset within ANT-FS message.

< The data offset within ANT-FS message.

< The control offset within ANT-FS message.

< The data offset within ANT-FS message.

< ANT message buffer index response code offset.

< Used to identify that no ANT-FS command is in progress.

< Used to identify that no ANT-FS command is in progress.

< Used to identify that no ANT-FS command is in progress.

< ANT message buffer index response code offset.

bool antfs_pairing_resp_transmit ( bool  accept)

Function for transmitting a response to a pairing request issued by ANT-FS host.

Parameters
[in]acceptThe pairing response, true if pairing accepted.
Return values
trueOperation success. Response to a pairing request was transmitted.
falseOperation failure. Not in pairing mode or pairing not supported by the implementation.

< ANT-FS authenticate command ID.

< Command response type accept.

< Command response type reject.

bool antfs_upload_data_resp_transmit ( bool  data_upload_success)

Function for transmitting upload data response to a upload data command by ANT-FS host.

Parameters
[in]data_upload_successThe upload response code, true for success.
Return values
trueOperation success. Response to upload data command was transmitted.
falseOperation failure. Upload not supported by the implementation or not in correct state.

< The burst packet size.

< The ANT-FS command ID.

< ANT-FS upload data response command ID.

< ANT-FS upload request command ID.

bool antfs_upload_req_resp_transmit ( uint8_t  response,
const antfs_request_info_t *const  p_request_info 
)

Function for transmitting upload request response to a upload request command by ANT-FS host.

Parameters
[in]responseThe upload response code.
[in]p_request_infoANT-FS request info structure.
Return values
trueOperation success. Response to upload request command was transmitted.
falseOperation failure. Upload not supported by the implementation or not in correct state or application is sending a response for a different file than requested.

< ANT-FS upload request command ID.

< The burst packet size.

< The ANT-FS command ID.

< ANT-FS upload request response command ID.

< ANT-FS upload request command ID.

void app_error_handler ( uint32_t  error_code,
uint32_t  line_num,
const uint8_t *  p_file_name 
)

Function for handling an error.

Function for error handling, which is called when an error has occurred.

Parameters
[in]error_codeError code supplied to the handler.
[in]line_numLine number where the error occurred.
[in]p_file_namePointer to the file name.
void button_event_handler ( uint8_t  pin_no,
uint8_t  button_action 
)

Function for handling button events.

Provides the user input regarding pairing request to the ANT-FS module.

Parameters
[in]pin_noThe pin number of the button pressed.
uint16_t crc_crc16_update ( uint16_t  current_crc,
const volatile void *  p_data,
uint32_t  size 
)

Function for calculating CRC-16 in blocks.

Feed each consecutive data block into this function, along with the current value of current_crc as returned by the previous call of this function. The first call of this function should pass the initial value (usually 0) of the crc in current_crc.

Parameters
[in]current_crcThe current calculated CRC-16 value.
[in]p_dataThe input data block for computation.
[in]sizeThe size of the input data block in bytes.
Returns
The updated CRC-16 value, based on the input supplied.
void leddriver_led_toggle ( leddriver_led_id_t  led_id)

Function for toggling a single LED.

Parameters
[in]led_idID of the led to be toggled.
void leddriver_led_turn_off ( leddriver_led_id_t  led_id)

Function for turning off a single LED.

Parameters
[in]led_idID of the led to be turned off.
void leddriver_led_turn_on ( leddriver_led_id_t  led_id)

Function for turning on a single LED.

Parameters
[in]led_idID of the led to be turned on.
int main ( void  )

Function for application main entry, does not return.

< Maximum number of simultaneously created timers.

< Size of timer operation queues.

< Maximum number of users of the GPIOTE handler.

< Delay from a GPIOTE event until a button is reported as pushed (in number of timer ticks).

< Serial number of client device.

< Beacon device type.

< Beacon manufacturer ID.

< Minimum size of ANT event message buffer.

bool mem_file_erase ( uint16_t  index)

Function for erasing file from file system.

Parameters
[in]indexThe file index.
Return values
trueOperation success.
trueOperation failure.

< Example directory size.

< Defined invalid index value.

bool mem_file_info_get ( uint16_t  index,
antfs_dir_struct_t p_file_info 
)

Function for retrieving file information from directory.

Parameters
[in]indexThe file index, which information to retrieve.
[out]p_file_infoThe container where information is read.
Return values
trueOperation success.
trueOperation failure.

< Example directory size.

< Example directory size.

void mem_file_read ( uint16_t  index,
uint32_t  offset,
void *  p_data,
uint32_t  size 
)

Function for reading data from file system.

Parameters
[in]indexThe file index, 0 for directory.
[in]offsetThe read data offset.
[out]p_dataThe buffer where data is read.
[in]sizeThe number of bytes to read.
bool mem_file_write ( uint16_t  index,
uint32_t  offset,
const void *  p_data,
uint32_t  size 
)

Function for writing data to file system.

Parameters
[in]indexThe file index.
[in]offsetThe write data offset.
[in]p_dataThe data to be written.
[in]sizeThe number of bytes to be written.
Return values
trueOperation success.
trueOperation failure.

< Example directory size.

< Defined invalid index value.

void SD_EVT_IRQHandler ( void  )

Function for handling protocol stack IRQ.

Interrupt is generated by the ANT stack upon sending event to the application.

void softdevice_assert_callback ( uint32_t  pc,
uint16_t  line_num,
const uint8_t *  p_file_name 
)

Function for handling SoftDevice asserts, does not return.

Traces out the user supplied parameters and busy loops.

Parameters
[in]pcValue of the program counter.
[in]line_numLine number where the assert occurred.
[in]p_file_namePointer to the file name.