nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
gzp.h File Reference

Gazell Pairing API. More...

#include <stdint.h>
#include <stdbool.h>
#include <nrf_gzll.h>
#include "gzp_config.h"

Go to the source code of this file.

Macros

Pairing configuration defines
#define GZP_PAIRING_PIPE   0
 
#define GZP_DATA_PIPE   1
 
#define GZP_TX_RX_TRANS_DELAY   10
 
#define GZP_SYSTEM_ADDRESS_WIDTH   4
 
#define GZP_VALIDATION_ID   {0x32, 0x53, 0x66}
 
#define GZP_VALIDATION_ID_LENGTH   3
 
#define GZP_HOST_ID_LENGTH   5
 
#define GZP_SESSION_TOKEN_LENGTH   GZP_HOST_ID_LENGTH
 
#define GZP_DYN_KEY_LENGTH   (16 - GZP_VALIDATION_ID_LENGTH)
 
#define GZP_HOST_RX_POWER_THRESHOLD   -64
 
Device -> Host packet definitions
#define GZP_CMD_HOST_ADDRESS_REQ_PAYLOAD_LENGTH   1
 
#define GZP_CMD_HOST_ADDRESS_FETCH_PAYLOAD_LENGTH   1
 
#define GZP_CMD_HOST_ID_REQ_SESSION_TOKEN   1
 
#define GZP_CMD_HOST_ID_REQ_PAYLOAD_LENGTH
 
#define GZP_CMD_HOST_ID_FETCH_VALIDATION_ID   1
 
#define GZP_CMD_HOST_ID_FETCH_PAYLOAD_LENGTH
 
#define GZP_CMD_KEY_UPDATE_PREPARE_PAYLOAD_LENGTH   1
 
#define GZP_CMD_KEY_UPDATE_VALIDATION_ID   1
 
#define GZP_CMD_KEY_UPDATE_NEW_KEY   (GZP_CMD_KEY_UPDATE_VALIDATION_ID + GZP_VALIDATION_ID_LENGTH)
 
#define GZP_CMD_KEY_UPDATE_PAYLOAD_LENGTH   (GZP_CMD_KEY_UPDATE_NEW_KEY + GZP_DYN_KEY_LENGTH)
 
#define GZP_CMD_ENCRYPTED_USER_DATA_VALIDATION_ID   1
 
#define GZP_CMD_ENCRYPTED_USER_DATA_PAYLOAD
 
#define GZP_ENCRYPTED_USER_DATA_PACKET_OVERHEAD
 
#define GZP_ENCRYPTED_USER_DATA_MAX_LENGTH   (17 - GZP_ENCRYPTED_USER_DATA_PACKET_OVERHEAD)
 
#define GZP_CMD_FETCH_RESP_PAYLOAD_LENGTH   1
 
Host -> Device packet definitions
#define GZP_CMD_HOST_ADDRESS_RESP_ADDRESS   1
 
#define GZP_CMD_HOST_ADDRESS_RESP_PAYLOAD_LENGTH
 
#define GZP_CMD_HOST_ID_FETCH_RESP_VALIDATION_ID   1
 
#define GZP_CMD_HOST_ID_FETCH_RESP_STATUS
 
#define GZP_CMD_HOST_ID_FETCH_RESP_HOST_ID   (GZP_CMD_HOST_ID_FETCH_RESP_STATUS + 1)
 
#define GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH
 
#define GZP_CMD_KEY_UPDATE_PREPARE_RESP_SESSION_TOKEN   1
 
#define GZP_CMD_KEY_UPDATE_PREPARE_RESP_PAYLOAD_LENGTH
 
#define GZP_CMD_ENCRYPTED_USER_DATA_RESP_SESSION_TOKEN   1
 
#define GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID
 
#define GZP_CMD_ENCRYPTED_USER_DATA_RESP_PAYLOAD_LENGTH
 

Functions

Misc. function prototypes
void gzp_crypt_set_session_token (const uint8_t *token)
 
void gzp_crypt_get_session_token (uint8_t *dst_token)
 
void gzp_crypt_set_dyn_key (const uint8_t *dyn_key)
 
void gzp_crypt_get_dyn_key (uint8_t *dst_key)
 
void gzp_set_host_id (const uint8_t *src)
 
void gzp_get_host_id (uint8_t *dst)
 
void gzp_crypt_select_key (enum gzp_key_select key_select)
 
void gzp_crypt (uint8_t *dst, const uint8_t *src, uint8_t length)
 
bool gzp_validate_id (const uint8_t *src_id)
 
void gzp_add_validation_id (uint8_t *dst_id)
 
void gzp_random_numbers_generate (uint8_t *dst, uint8_t n)
 
bool gzp_update_radio_params (const uint8_t *system_address)
 
void gzp_generate_channels (uint8_t *ch_dst, const uint8_t *address, uint8_t channel_set_size)
 
void gzp_xor_cipher (uint8_t *dst, const uint8_t *src, const uint8_t *pad, uint8_t length)
 
Common Device and Host functions
void gzp_init (void)
 
void gzp_erase_pairing_data (void)
 
void nrf_gzp_disable_gzll (void)
 
void gzp_id_req_cancel (void)
 
void nrf_gzp_flush_rx_fifo (uint32_t pipe)
 
Device functions
void gzp_tx_result_callback_register (gzp_tx_result_callback callback)
 
int8_t gzp_get_pairing_status (void)
 
bool gzp_address_req_send (void)
 
void gzp_address_req_send_async (gzp_address_req_callback callback, void *context)
 
enum gzp_id_req_res gzp_id_req_send (void)
 
void gzp_id_req_send_async (gzp_id_req_callback callback, void *context)
 
bool gzp_crypt_data_send (const uint8_t *src, uint8_t length)
 
void gzp_crypt_data_send_async (const uint8_t *src, uint8_t length, gzp_crypt_data_send_callback callback, void *context)
 
Host functions
void gzp_pairing_enable (bool enable)
 
void gzp_host_execute (void)
 
bool gzp_address_exchanged (void)
 
bool gzp_id_req_received (void)
 
void gzp_id_req_reject (void)
 
void gzp_id_req_grant (void)
 
bool gzp_crypt_user_data_received (void)
 
bool gzp_crypt_user_data_read (uint8_t *dst, uint8_t *length)
 
void gzll_rx_start (void)
 

Typedefs

enum  gzp_key_select { GZP_ID_EXCHANGE , GZP_KEY_EXCHANGE , GZP_DATA_EXCHANGE }
 Enumerator used for selecting the key to be used for encryption. More...
 
enum  gzp_cmd {
  GZP_CMD_HOST_ADDRESS_REQ = 0 , GZP_CMD_HOST_ADDRESS_FETCH , GZP_CMD_HOST_ID_REQ , GZP_CMD_HOST_ID_FETCH ,
  GZP_CMD_KEY_UPDATE_PREPARE , GZP_CMD_KEY_UPDATE , GZP_CMD_ENCRYPTED_USER_DATA , GZP_CMD_FETCH_RESP ,
  GZP_CMD_HOST_ADDRESS_RESP , GZP_CMD_HOST_ID_FETCH_RESP , GZP_CMD_KEY_UPDATE_PREPARE_RESP , GZP_CMD_ENCRYPTED_USER_DATA_RESP
}
 Enumerator used in the first payload byte of each packet to indicate the packet type. More...
 
enum  gzp_id_req_res {
  GZP_ID_RESP_PENDING , GZP_ID_RESP_GRANTED , GZP_ID_RESP_REJECTED , GZP_ID_RESP_FAILED ,
  GZP_ID_RESP_NO_REQUEST
}
 Enumerator used to identify the state of the current Host ID request. More...
 
typedef void(* gzp_tx_result_callback) (bool success, uint32_t pipe, const nrf_gzll_device_tx_info_t *tx_info)
 
typedef void(* gzp_address_req_callback) (bool result, void *context)
 
typedef void(* gzp_id_req_callback) (enum gzp_id_req_res result, void *context)
 
typedef void(* gzp_crypt_data_send_callback) (bool result, void *context)
 

Detailed Description

Gazell Pairing API.