nRF51 SDK
|
Functions | |
void | gzp_init () |
void | gzp_pairing_enable (bool enable) |
void | gzp_host_execute () |
void | gzll_rx_start (void) |
bool | gzp_id_req_received () |
void | gzp_id_req_reject () |
void | gzp_id_req_grant () |
void | gzp_id_req_cancel () |
bool | gzp_address_exchanged () |
bool | gzp_crypt_user_data_received () |
bool | gzp_crypt_user_data_read (uint8_t *dst, uint8_t *length) |
void | gzp_get_host_id (uint8_t *dst) |
void | nrf_gzll_device_tx_failed (uint32_t pipe, nrf_gzll_device_tx_info_t tx_info) |
Transmission failed callback (Device mode only). More... | |
void | nrf_gzll_device_tx_success (uint32_t pipe, nrf_gzll_device_tx_info_t tx_info) |
ACK received callback (Device mode only). More... | |
void | nrf_gzll_disabled (void) |
Disabled callback. More... | |
void | nrf_gzll_host_rx_data_ready (uint32_t pipe, nrf_gzll_host_rx_info_t rx_info) |
Data packet received callback (Host mode only). More... | |
Typedefs | |
enum | gzp_id_req_stat_t { GZP_ID_REQ_IDLE, GZP_ID_REQ_PENDING, GZP_ID_REQ_PENDING_AND_GRANTED, GZP_ID_REQ_PENDING_AND_REJECTED } |
Internal (static) function prototypes | |
static void | gzp_session_counter_inc (void) |
static void | gzp_get_session_counter (uint8_t *dst) |
static void | gzp_process_address_req (uint8_t *gzp_req) |
static void | gzp_process_id_req (uint8_t *rx_payload) |
static void | gzp_process_id_fetch (uint8_t *rx_payload) |
static void | gzp_process_key_update_prepare (void) |
static void | gzp_process_key_update (uint8_t *rx_payload) |
static void | gzp_process_encrypted_user_data (uint8_t *rx_payload, uint8_t length) |
static void | gzp_preload_ack (uint8_t *src, uint8_t length, uint8_t pipe) |
void | gzp_host_chip_id_read (uint8_t *dst, uint8_t n) |
static void | gzp_set_host_id (const uint8_t *src) |
static void | gzll_goto_idle (void) |
static void | gzll_tx_fifo_flush (void) |
static void | gzll_rx_fifo_flush (void) |
static void | gzll_set_rx_timeout (uint32_t timeout) |
Internal (static) variabls | |
static gzp_id_req_stat_t | gzp_id_req_stat |
Current state of Host ID request. | |
static bool | gzp_pairing_enabled_f |
True if Host is paired with a device. | |
static bool | gzp_address_exchanged_f |
True if Host has exchanged a system address with a device and thus pairing has begun. | |
static uint8_t | gzp_session_counter [GZP_SESSION_TOKEN_LENGTH] |
Session counter used for key generation and update. | |
static bool | gzp_encrypted_user_data [GZP_ENCRYPTED_USER_DATA_MAX_LENGTH] |
Placeholder for encrypted data from Device. | |
static uint8_t | gzp_encrypted_user_data_length |
Length of gzp_encrypted_user_data. Zero implies no data received. | |
static nrf_gzll_host_rx_info_t | prev_gzp_rx_info = {0, 0} |
RSSI and status of ACK payload transmission of previous Gazell packet. | |
enum gzp_id_req_stat_t |
Definition of internal states.
|
static |
Function for incrementing internal session counter.
|
static |
Function for reading value of internal session counter.
dst | Current session counter. |
|
static |
Function processing received "system address request" from Device.
gzp_req | Pointer to RX payload containing system address request. |
|
static |
Function to process Host ID request from device.
The Host shall retrieve the Host ID from NVM, or shall generate if it does not yet exist.
rx_payload | Pointer to rx_payload contaning Host ID request. |
|
static |
Function to process Host ID fetch request from Device.
The Device fetches the Host ID after the Host has generated/retrieved the Host ID.
rx_payload | Pointer to rx_payload contaning Host ID fetch request. |
|
static |
Function to process Key Update Prepare packet.
Device requests the Session Token to be used for the Key Update request.
|
static |
Function to process Key Update packet.
Device requests a Key Update and sends a new Dynamic Key. The Dynamic Key is updated on the Host.
rx_payload | Pointer to rx_payload containing Key Update request. |
|
static |
Function to process received Encrypted User packet.
rx_payload | Pointer to rx_payload containing the encrypted user data. |
length | Length of encrypted user data. |
|
static |
Function to preload the payload for the next ACK.
src | Pointer to source payload. |
length | Length of source payload. |
pipe | Pipe for the ACK payload. |
void gzp_host_chip_id_read | ( | uint8_t * | dst, |
uint8_t | n | ||
) |
Function for reading the Chip ID from non-volatile memory.
The chip ID is used for the system address.
If the Chip ID is not yet created a random Chip ID is created and written to non-volatile memory. Note that the term chip ID is used as the factory programmed chip sequence number was used for the system address in nRF24LU ICs.
dst | Address to copy Host ID to. | |
[in] | n | Number of bytes in the Host ID. |
|
static |
Function to set the Host ID.
Writes the Host ID to non-volatile memory.
src | Address of the Host ID to copy from. |
|
static |
Function to request disabling of Gazell and wait for it to be disabled.
Emulates legacy gzll_goto_idle().
|
static |
Flush all TX FIFOs.
Emulates legacy gzll_tx_fifo_flush().
|
static |
Flush all RX FIFOs.
Emulates legacy gzll_rx_fifo_flush().
|
static |
Set a timeout for the reception of packets on the Gazell Host.
Emulates legacy Gazell function: gzll_set_param(GZLL_PARAM_RX_TIMEOUT, x).
timeout | Timeout in number of legacy "RX periods" (1 RX period = 2 timeslot periods). |
void gzp_init | ( | void | ) |
Initialization function. This function initializes the Gazell Pairing Library.
This function must be called before any of the other Gazell Pairing Library functions are used and must be called after gzll_init() is called.
void gzp_pairing_enable | ( | bool | enable | ) |
Function for enabling/disabling pairing in a host. When pairing is enabled the host will be monitoring for "system address" and "Host ID" requests from Devices.
A "system address request" received from a Device will always be granted. When a "host ID request" has been received, the Host application have to grant, reject or cancel this by using one of the following functions:
enable |
|
void gzp_host_execute | ( | void | ) |
Execute the Gazell Pairing Library Host operation.
This function must be called regularly by the Host application.
void gzll_rx_start | ( | void | ) |
Function emulating behavior of gzll_rx_start() in legeacy nRF24xx Gaell linbrary.
This functions sets Gazell in Host mode and starts reception (enable).
bool gzp_id_req_received | ( | void | ) |
Function for checking if a "Host ID request" has been received from a Device.
If a request has been received, the Pairing library will enter "ID request pending" state.
The application is responsible for responding to this request by calling one of the following functions:
true | if a "Host ID request" has been received (internal state is "ID request pending") |
false | if no "Host ID request" has been received (internal state is "ID request idle") |
void gzp_id_req_reject | ( | void | ) |
Function for rejecting the previously received "Host ID request". This function should be called only when a "Host ID request" has been received (internal state is "ID request pending").
The internal state of the Pairing library will remain "ID request pending" until the a "reject" message has been successfully transmitted to the requesting Device. After this the internal state will change to "ID request idle".
void gzp_id_req_grant | ( | void | ) |
Function for granting the previously received "Host ID request". This function should be called only when a "Host ID request" has been received (internal state is "ID request pending").
The internal state of the Pairing library will remain "ID request pending" until the "Host ID" has been successfully transmitted to the requesting Device. After this the internal state will change to "ID request idle".
void gzp_id_req_cancel | ( | void | ) |
Function for cancelling an ongoing (pending) "Host ID request".
After calling this function the "Host ID request" status will go to "ID request Idle".
bool gzp_address_exchanged | ( | void | ) |
Address exchanged check.
true | If a "system address" was delivered to a requesting Device during the previous call to gzp_host_execute(); |
false | Otherwise. |
bool gzp_crypt_user_data_received | ( | void | ) |
Check if user data has been received.
true | If encrypted user data has been received. |
false | Otherwise. |
bool gzp_crypt_user_data_read | ( | uint8_t * | dst, |
uint8_t * | length | ||
) |
Function for reading encrypted user data.
Note that the read user data will be automatically decrypted. Only data that was decrypted correctly will be presented.
dst* | is a pointer to where the received data will be written. |
length* | is a pointer for returning the number of bytes received. Only 1 byte will be writtem to length*. |
true | if data has been received and is written to dst* |
false | if no data has been received. |
void gzp_get_host_id | ( | uint8_t * | dst | ) |
Get the Host ID.
dst | Pointer to write the Host ID to. |
void nrf_gzll_device_tx_failed | ( | uint32_t | pipe, |
nrf_gzll_device_tx_info_t | tx_info | ||
) |
This callback is made when a packet does not receive an ACK after nrf_gzll_max_retries is reached. The packet is deleted by Gazell.
pipe | is the pipe on which the transmission failed. |
tx_info | struct used to indicate whether a payload was received in the ack, as well as RSSI and the number of TX attempts and channel switches required. |
void nrf_gzll_device_tx_success | ( | uint32_t | pipe, |
nrf_gzll_device_tx_info_t | tx_info | ||
) |
This callback is made when the Device receives an ACK (acknowledgement) packet.
pipe | is the pipe on which an ACK packet was received. |
tx_info | struct used to indicate whether a payload was received in the ack, as well as the number of TX attempts and channel switches required. |
void nrf_gzll_disabled | ( | void | ) |
This is called after Gazell enters the disabled state. There is no further CPU use by Gazell, the radio is disabled and the timer is powered down.
void nrf_gzll_host_rx_data_ready | ( | uint32_t | pipe, |
nrf_gzll_host_rx_info_t | rx_info | ||
) |
This callback is made when a Host receives a data packet from a Device.
pipe | is the pipe on which the data packet was received. |
rx_info | struct used to indicate whether a payload was removed from the pipe's TX FIFO, as well as RSSI. |