The ANT-FS client device simulator.
More...
|
typedef void(* | antfs_burst_wait_handler_t )(void) |
| The burst wait handler can be configured by the application to customize the code that is executed while waiting for the burst busy flag.
|
|
|
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
} |
|
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.
#define ANTFS_AUTH_STRING_MAX 255u |
Maximum size of authentication strings (passkey/friendly name).
#define ANTFS_BURST_BLOCK_SIZE 16u |
Size of each block of burst data that the client attempts to send when it processes a data request event.
ANT-FS Client Channel 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 |
#define ANTFS_DIR_READ_MASK 0x80u |
#define ANTFS_DIR_STRUCT_VERSION 1u |
Version of the directory file structure.
#define ANTFS_DIR_WRITE_MASK 0x40u |
#define ANTFS_FRIENDLY_NAME_MAX 16u |
Maximum size of friendly name received from host.
#define ANTFS_LINK_FREQ 50u |
#define ANTFS_MAX_FILE_SIZE 0xFFFFFFFFu |
Maximum file size, as specified by directory structure.
#define ANTFS_PASSKEY_SIZE 16u |
#define ANTFS_REMOTE_FRIENDLY_NAME_MAX 16u |
Maximum size of client's friendly name.
#define ANTFS_VERSION_DATE 20090522u |
#define ANTFS_VERSION_ITERATION 0 |
#define ANTFS_VERSION_MAJOR 1u |
#define ANTFS_VERSION_MINOR 0 |
#define ANTFS_VERSION_SPEC '0.AK' |
Version of the ANT-FS Technology Specification.
#define ANTFS_VERSION_TYPE 'R' |
#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) |
#define BEACON_PERIOD_SHIFT 0x00 |
Shift value for masking out beacon period.
#define DATA_AVAILABLE_FLAG_MASK (0x01u << DATA_AVAILABLE_FLAG_SHIFT) |
#define DATA_AVAILABLE_FLAG_SHIFT 0x05u |
Shift value for masking out data available bit.
#define PAIRING_AVAILABLE_FLAG_MASK (0x01u << PAIRING_AVAILABLE_FLAG_SHIFT) |
#define PAIRING_AVAILABLE_FLAG_SHIFT 0x03u |
Shift value for masking out pairing enabled bit.
#define RESPONSE_INVALID_CRC 0x05u |
#define RESPONSE_INVALID_OPERATION 0x04u |
#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 |
#define RESPONSE_MESSAGE_NOT_READY 0x03u |
#define RESPONSE_MESSAGE_OK 0x00u |
#define RESPONSE_MESSAGE_UPLOAD_NOT_READY 0x05u |
#define UPLOAD_ENABLED_FLAG_MASK (0x01u << UPLOAD_ENABLED_FLAG_SHIFT) |
#define UPLOAD_ENABLED_FLAG_SHIFT 0x04u |
Shift value for masking out upload enabled bit.
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.
|
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] | response | The download request response code. |
[in] | p_request_info | ANT-FS request info structure. |
void antfs_erase_req_resp_transmit |
( |
uint8_t |
response | ) |
|
Function for transmitting erase response to a erase request.
- Parameters
-
[in] | response | The erase response code. |
Function for extracting possible pending ANT-FS event.
- Parameters
-
[out] | p_event | The output event structure. |
- Return values
-
true | Operation success. Pending ANT-FS event available and it was copied to the output event structure. |
false | Operation failure. No pending ANT-FS event available. |
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.
Function for setting initial ANT-FS configuration parameters.
- Parameters
-
[in] | p_params | The initial ANT-FS configuration parameters. |
[in] | burst_wait_handler | Burst wait handler. |
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] | index | Index of the current file downloaded. |
[in] | offset | Offset specified by client. |
[in] | num_bytes | Number of bytes requested to be transmitted from the buffer. |
[in] | p_message | Data buffer to be transmitted. |
- Returns
- Number of data bytes transmitted.
void antfs_message_process |
( |
uint8_t * |
p_message | ) |
|
Function for processing ANT events and data received from the ANT-FS channel.
- Parameters
-
[in] | p_message | The message buffer containing the message received from the ANT-FS channel. |
bool antfs_pairing_resp_transmit |
( |
bool |
accept | ) |
|
Function for transmitting a response to a pairing request issued by ANT-FS host.
- Parameters
-
[in] | accept | The pairing response, true if pairing accepted. |
- Return values
-
true | Operation success. Response to a pairing request was transmitted. |
false | Operation failure. Not in pairing mode or pairing not supported by the implementation. |
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_success | The upload response code, true for success. |
- Return values
-
true | Operation success. Response to upload data command was transmitted. |
false | Operation failure. Upload not supported by the implementation or not in correct state. |
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] | response | The upload response code. |
[in] | p_request_info | ANT-FS request info structure. |
- Return values
-
true | Operation success. Response to upload request command was transmitted. |
false | Operation failure. Upload not supported by the implementation or not in correct state or application is sending a response for a different file than requested. |