初始版本
This commit is contained in:
274
external/tile/tile_lib/modules/tile_song_module.h
vendored
Normal file
274
external/tile/tile_lib/modules/tile_song_module.h
vendored
Normal file
@@ -0,0 +1,274 @@
|
||||
/**
|
||||
* NOTICE
|
||||
*
|
||||
* Copyright 2020 Tile Inc. All Rights Reserved.
|
||||
* All code or other information included in the accompanying files ("Tile Source Material")
|
||||
* is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
|
||||
* is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
|
||||
* and may not be otherwise distributed or made available to others, including for commercial purposes.
|
||||
* Without limiting the foregoing , you understand and agree that no production use
|
||||
* of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
|
||||
* agreement with Tile.
|
||||
* You also understand and agree that Tile may terminate the limited rights granted under these terms
|
||||
* at any time in its discretion.
|
||||
* All Tile Source Material is provided AS-IS without warranty of any kind.
|
||||
* Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
|
||||
* Tile will not be liable for any damages resulting from your use of or inability to use
|
||||
* the Tile Source Material.
|
||||
*
|
||||
* Support: firmware_support@tile.com
|
||||
*/
|
||||
|
||||
/** @file tile_song_module.h
|
||||
** @addtogroup TOA
|
||||
** @{
|
||||
** @brief Tile Song Module
|
||||
*/
|
||||
|
||||
#ifndef TILE_SONG_MODULE_H_
|
||||
#define TILE_SONG_MODULE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "crypto/hmac_sha256.h"
|
||||
|
||||
/**
|
||||
* @brief Tile Song numbers
|
||||
*/
|
||||
enum TILE_SONG
|
||||
{
|
||||
TILE_SONG_1_CLICK = 0x00,
|
||||
TILE_SONG_FIND = 0x01,
|
||||
TILE_SONG_ACTIVE = 0x02,
|
||||
TILE_SONG_SLEEP = 0x03,
|
||||
TILE_SONG_WAKEUP = 0x04,
|
||||
TILE_SONG_FACTORY_TEST = 0x05,
|
||||
TILE_SONG_MYSTERY = 0x06,
|
||||
TILE_SONG_SILENT = 0x07,
|
||||
TILE_SONG_BUTTON = 0x08,
|
||||
TILE_SONG_WAKEUP_PART = 0x09,
|
||||
TILE_SONG_DT_SUCCESS = 0x0a,
|
||||
TILE_SONG_DT_FAILURE = 0x0b,
|
||||
TILE_SONG_2_CLICK = 0x0c,
|
||||
TILE_SONG_1_BIP = 0x0d,
|
||||
TILE_SONG_2_BIP = 0x0e,
|
||||
TILE_SONG_3_BIP = 0x0f,
|
||||
TILE_SONG_4_BIP = 0x10,
|
||||
TILE_SONG_5_BIP = 0x11,
|
||||
TILE_SONG_6_BIP = 0x12,
|
||||
TILE_SONG_7_BIP = 0x13,
|
||||
TILE_SONG_DT_HB = 0x14,
|
||||
TILE_SONG_MAX = 0x15,
|
||||
|
||||
TILE_SONG_STOP = 0xFF
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Enumerate notes from C0 to B9
|
||||
*
|
||||
* Tile songs are created as a sequence of pairs,
|
||||
* (note, duration). Each value in the pair is one byte.
|
||||
* A song ends with the pair (REST, REST).
|
||||
*/
|
||||
enum NOTES {
|
||||
REST = 0x00,
|
||||
C0, CS0, D0, DS0, E0, F0, FS0, G0, GS0, A0, AS0, B0,
|
||||
C1, CS1, D1, DS1, E1, F1, FS1, G1, GS1, A1, AS1, B1,
|
||||
C2, CS2, D2, DS2, E2, F2, FS2, G2, GS2, A2, AS2, B2,
|
||||
C3, CS3, D3, DS3, E3, F3, FS3, G3, GS3, A3, AS3, B3,
|
||||
C4, CS4, D4, DS4, E4, F4, FS4, G4, GS4, A4, AS4, B4,
|
||||
C5, CS5, D5, DS5, E5, F5, FS5, G5, GS5, A5, AS5, B5,
|
||||
C6, CS6, D6, DS6, E6, F6, FS6, G6, GS6, A6, AS6, B6,
|
||||
C7, CS7, D7, DS7, E7, F7, FS7, G7, GS7, A7, AS7, B7,
|
||||
C8, CS8, D8, DS8, E8, F8, FS8, G8, GS8, A8, AS8, B8,
|
||||
C9, CS9, D9, DS9, E9, F9, FS9, G9, GS9, A9, AS9, B9,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief TILE_SONG_DURATION
|
||||
* Duration to play the Tile Song for.
|
||||
* The duration is in seconds and here are special values.
|
||||
*/
|
||||
enum TILE_SONG_DURATION
|
||||
{
|
||||
TILE_SONG_DURATION_NOPLAY = 0x00, /**< Do not play anything */
|
||||
TILE_SONG_DURATION_ONCE = 0xFE, /**< Play the Song just once */
|
||||
TILE_SONG_DURATION_FOREVER = 0xFF /**< Play the song forever, till someone stops it */
|
||||
};
|
||||
|
||||
|
||||
#define SONG_METADATA_SIZE (sizeof(struct song_metadata_t))
|
||||
#define SONG_INFO_SIZE (sizeof(struct song_hdr_info_t))
|
||||
#define SONG_SECURITY_SIZE (sizeof(struct song_hdr_sec_t))
|
||||
#define SONG_HEADER_SIZE (SONG_INFO_SIZE + SONG_SECURITY_SIZE)
|
||||
|
||||
#define SONG_HASH_SIZE 32 /**< Size of the song hash */
|
||||
#define SONG_SIG_SIZE 64 /**< Size of the song signature */
|
||||
#define SONG_CRC16_SIZE 2 /**< Size of the Block CRC */
|
||||
|
||||
|
||||
#define TILE_PROGRAMMABLE_SONG_LENGTH 1024 /**< Maximum length of the programmable song section in flash */
|
||||
#define TILE_SONG_BLOCK_SIZE 128 /**< Size of data in a data block */
|
||||
#define TILE_SONG_BUFFER_SIZE TILE_SONG_BLOCK_SIZE + SONG_CRC16_SIZE /**< Size of intermediate buffer for programming */
|
||||
#define TILE_SONG_VERSION 1 /**< Version field, to allow future format changes to take place */
|
||||
#define TILE_SONG_VALID 0xAA /**< Flag indicating a song is valid */
|
||||
|
||||
|
||||
/** @brief Song file header info portion */
|
||||
struct song_hdr_info_t
|
||||
{
|
||||
uint8_t song_format; ///< song_format is a Version Number that would describe the Tsong Format Variations
|
||||
uint8_t song_number; ///< song_number describes what the Type of Song being Programmed and what song_number to use for playing the Song using TOA_CMD_SONG command.
|
||||
uint16_t song_id; ///< song_id is the Tile Assigned ID Number of this Song. See @ref TILE_SONG
|
||||
uint16_t song_size; ///< song_size represents the Song Payload Size, excluding any Security or Info Header.
|
||||
};
|
||||
|
||||
/** @brief Song file header security info */
|
||||
struct song_hdr_sec_t
|
||||
{
|
||||
uint8_t hash[SONG_HASH_SIZE]; ///< A SHA-256 Hash Calculated using the Info Header and Song Payload.
|
||||
uint8_t sign[SONG_SIG_SIZE]; ///< Signature of the Song, calculated using the hash as input and Song Private Key with ECC Secp256k1 Curve.
|
||||
};
|
||||
|
||||
/** @brief State of song programming */
|
||||
struct song_program_state_t
|
||||
{
|
||||
uint16_t pos; ///< accumulated number of bytes written for current Song
|
||||
uint8_t buf_pos; ///< accumulated number of bytes received for current block
|
||||
uint8_t state; ///< Song Programming State
|
||||
uint16_t file_size; ///< Total File Size of the current song being programmed
|
||||
uint32_t bank; ///< Memory Bank currently being used to program the Song
|
||||
sha256_ctx hash_ctx; ///< Current programmed Song Hash Calculation Context
|
||||
struct song_hdr_info_t info; ///< Current programmed Song Info Header
|
||||
struct song_hdr_sec_t sec; ///< Current programmed Song Security Header
|
||||
uint8_t cached_cid; ///< TOA CID of the current TPS session
|
||||
uint8_t block_dataSize; ///< datasize of the received block
|
||||
};
|
||||
|
||||
/** @brief Metadata info stored in flash */
|
||||
struct song_metadata_t
|
||||
{
|
||||
uint8_t valid;
|
||||
uint8_t id;
|
||||
};
|
||||
|
||||
/** @brief Cache for information related to the currently loaded song */
|
||||
struct song_info_cache_t
|
||||
{
|
||||
struct song_metadata_t curMeta;
|
||||
struct song_hdr_info_t curInfo;
|
||||
uint32_t curBank;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Tile Programmable Songs module.
|
||||
*
|
||||
* Tile Lib supports the ability to update the find song over the air.
|
||||
*/
|
||||
struct tile_song_tps_module_t {
|
||||
/**
|
||||
* Public key used for ECC signature verification
|
||||
* Generating ECC keys:
|
||||
* $ openssl ecparam -genkey -name secp256k1 -out k.perm
|
||||
* $ openssl ec -outform DER -in k.perm -noout -text
|
||||
*/
|
||||
uint8_t *pub_key;
|
||||
|
||||
/**
|
||||
* If set to 0, it means the programmable song is currently not playable
|
||||
*/
|
||||
uint8_t useProgrammableSong;
|
||||
|
||||
/**
|
||||
* Buffer used to receive TPS Song data
|
||||
*/
|
||||
uint8_t tileSongBuffer[TILE_SONG_BUFFER_SIZE];
|
||||
|
||||
/**
|
||||
* Cache for information related to the currently loaded song
|
||||
*/
|
||||
struct song_info_cache_t song_info_cache;
|
||||
|
||||
/**
|
||||
* Internal state used by TPS
|
||||
*/
|
||||
struct song_program_state_t state;
|
||||
|
||||
/**
|
||||
* Song Programming is starting.
|
||||
*
|
||||
*/
|
||||
int (*begin)(void);
|
||||
|
||||
/**
|
||||
* A TPS block has been received. Write to nonvolatile storage.
|
||||
* After writting, it is recommended to read back the data from flash in the tileSongBuffer.
|
||||
* The reason is TileLib will check the CRC again after this call returns (song_block_done is called).
|
||||
*
|
||||
*/
|
||||
int (*block_ready)(void);
|
||||
|
||||
/**
|
||||
* TPS has completed successfully
|
||||
*/
|
||||
int (*complete)(void);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Tile Song module.
|
||||
*
|
||||
* This module is used to allow the Tile app to play a song on the device.
|
||||
*/
|
||||
struct tile_song_module {
|
||||
/**
|
||||
* Play song with given index number with strength from 0-3.
|
||||
*/
|
||||
int (*play)(uint8_t number, uint8_t strength, uint8_t duration);
|
||||
|
||||
/**
|
||||
* Stop all songs.
|
||||
*/
|
||||
int (*stop)(void);
|
||||
|
||||
/**
|
||||
* Optional TPS Module (set to NULL if not supported).
|
||||
*/
|
||||
struct tile_song_tps_module_t* tps_module;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Register the song module.
|
||||
*/
|
||||
int tile_song_register(struct tile_song_module *module);
|
||||
|
||||
/**
|
||||
* Call when the song programming begin command has completed.
|
||||
*
|
||||
* NOTE: Only required if TPS is supported.
|
||||
*/
|
||||
void song_begin_done(uint8_t error);
|
||||
|
||||
/**
|
||||
* Call when the song programming block ready command has completed.
|
||||
* tileSongBuffer is expected to contain the valid song block data when this function is called.
|
||||
* The reason is TileLib will check the CRC again in this function.
|
||||
* This allows the application to implement a read back of the data from flash to verify integrity.
|
||||
*
|
||||
* NOTE: Only required if TPS is supported.
|
||||
*/
|
||||
void song_block_done(uint8_t error);
|
||||
|
||||
/**
|
||||
* Call when the song programming complete command has completed.
|
||||
*
|
||||
* NOTE: Only required if TPS is supported.
|
||||
*/
|
||||
void song_complete_done(uint8_t error);
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif
|
||||
83
external/tile/tile_lib/modules/tile_tdg_module.h
vendored
Normal file
83
external/tile/tile_lib/modules/tile_tdg_module.h
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* NOTICE
|
||||
*
|
||||
* Copyright 2020 Tile Inc. All Rights Reserved.
|
||||
* All code or other information included in the accompanying files ("Tile Source Material")
|
||||
* is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
|
||||
* is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
|
||||
* and may not be otherwise distributed or made available to others, including for commercial purposes.
|
||||
* Without limiting the foregoing , you understand and agree that no production use
|
||||
* of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
|
||||
* agreement with Tile.
|
||||
* You also understand and agree that Tile may terminate the limited rights granted under these terms
|
||||
* at any time in its discretion.
|
||||
* All Tile Source Material is provided AS-IS without warranty of any kind.
|
||||
* Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
|
||||
* Tile will not be liable for any damages resulting from your use of or inability to use
|
||||
* the Tile Source Material.
|
||||
*
|
||||
* Support: firmware_support@tile.com
|
||||
*/
|
||||
|
||||
/** @file tile_tdg_module.h
|
||||
** @brief Tile GATT Server Driver interface
|
||||
*/
|
||||
|
||||
#ifndef TILE_TDG_MODULE_H_
|
||||
#define TILE_TDG_MODULE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "modules/tile_toa_module.h"
|
||||
|
||||
/**
|
||||
* @defgroup tile_tdg Tile Diagnostics module
|
||||
* @{
|
||||
* @ingroup TOA
|
||||
*
|
||||
* @brief Tile Diagnostics module.
|
||||
*
|
||||
* @details This module is used by Tile Lib to send diagnostic information to the Tile
|
||||
* data collection system. Consult with Tile for the proper format for
|
||||
* diagnostic data, if it is to be automatically parsed by the Tile backend.
|
||||
*/
|
||||
struct tile_tdg_module {
|
||||
/**
|
||||
* Retrieve diagnostic information.
|
||||
*
|
||||
* This function should call @ref tdg_add_data for each diagnostic data
|
||||
* field to be added, and then @ref tdg_finish when all data has been added.
|
||||
*/
|
||||
int (*get_diagnostics)(void);
|
||||
|
||||
uint8_t buffer[TOA_MPS];
|
||||
uint8_t buffer_pos;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Register the TDG module.
|
||||
*/
|
||||
int tile_tdg_register(struct tile_tdg_module *module);
|
||||
|
||||
/**
|
||||
* @brief Add diagnostic data.
|
||||
* @details Should be called during the call to get_diagnostics.
|
||||
* This function can be called multiple times, for each piece of diagnostic
|
||||
* info that is to be added.
|
||||
*
|
||||
* @param[in] data Data to add to diagnostics.
|
||||
* @param[in] length Length of data to add.
|
||||
*/
|
||||
int tdg_add_data(void *data, uint8_t length);
|
||||
|
||||
/**
|
||||
* @brief Finish adding diagnostic data.
|
||||
* @details Should be called during the call to
|
||||
* get_diagnostics, after all data has been added.
|
||||
*/
|
||||
int tdg_finish(void);
|
||||
|
||||
/**@}*/
|
||||
|
||||
#endif
|
||||
85
external/tile/tile_lib/modules/tile_tdi_module.h
vendored
Normal file
85
external/tile/tile_lib/modules/tile_tdi_module.h
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* NOTICE
|
||||
*
|
||||
* Copyright 2020 Tile Inc. All Rights Reserved.
|
||||
* All code or other information included in the accompanying files ("Tile Source Material")
|
||||
* is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
|
||||
* is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
|
||||
* and may not be otherwise distributed or made available to others, including for commercial purposes.
|
||||
* Without limiting the foregoing , you understand and agree that no production use
|
||||
* of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
|
||||
* agreement with Tile.
|
||||
* You also understand and agree that Tile may terminate the limited rights granted under these terms
|
||||
* at any time in its discretion.
|
||||
* All Tile Source Material is provided AS-IS without warranty of any kind.
|
||||
* Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
|
||||
* Tile will not be liable for any damages resulting from your use of or inability to use
|
||||
* the Tile Source Material.
|
||||
*
|
||||
* Support: firmware_support@tile.com
|
||||
*/
|
||||
|
||||
/** @file tile_tdi_module.h
|
||||
** @brief Tile Device Information Module. Provides TileLib Device specific information and unique numbers.
|
||||
*/
|
||||
|
||||
#ifndef TILE_TDI_MODULE_H_
|
||||
#define TILE_TDI_MODULE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/**
|
||||
* Tile Device Information module.
|
||||
*
|
||||
* This module is used by Tile Lib to allow the Tile app to read some
|
||||
* information about the device in order to properly activate and authenticate
|
||||
* with the device.
|
||||
*/
|
||||
struct tile_tdi_module
|
||||
{
|
||||
/**
|
||||
* Tile ID -- 64-bit identifier for Tile Nodes.
|
||||
* Example: {0x1a, 0x95, 0xd9, 0x97, 0xf0, 0xf2, 0x66, 0x07}.
|
||||
*/
|
||||
uint8_t *tile_id;
|
||||
/**
|
||||
* BLE MAC address -- 48-bit number. Points to the MAC address advertised Over The Air.
|
||||
*/
|
||||
uint8_t *bdaddr;
|
||||
/**
|
||||
* Firmware Version -- 10 8-bit ASCII characters (null terminaison accepted but not required)
|
||||
* Format: "xx.xx.xx.x"
|
||||
* Example: "02.00.00.0"
|
||||
*/
|
||||
char *firmware_version;
|
||||
/**
|
||||
* Model Number -- 10 8-bit ASCII characters (null terminaison accepted but not required)
|
||||
* Format shall follow the following pattern: "XXXX YY.YY" with the following constraints:
|
||||
* - "XXXX" uses 4 ASCII letters ('A' to 'Z') to describe the Vendor ID.
|
||||
* - The Vendor ID is assigned by Tile.
|
||||
* - A space character after "XXXX".
|
||||
* - "YY.YY" uses 4 ASCII numbers ('0' to '9') and describes the Model ID.
|
||||
* Example: "TEST 00.00".
|
||||
|
||||
*/
|
||||
char *model_number;
|
||||
/**
|
||||
* Hardware Revision -- 5 8-bit ASCII characters (null terminaison accepted but not required)
|
||||
* The character pattern is "YY.YY" and uses 4 ASCII numbers ('0' to '9').
|
||||
* Example: "01.00".
|
||||
*/
|
||||
char *hardware_version;
|
||||
/**
|
||||
* Serial Number -- (TOA_MPS-1) bytes
|
||||
*/
|
||||
uint8_t *serial_num;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register the TDI module with Tile Library.
|
||||
*/
|
||||
int tile_tdi_register(struct tile_tdi_module *module);
|
||||
|
||||
|
||||
#endif // TILE_TDI_MODULE_H_
|
||||
133
external/tile/tile_lib/modules/tile_tdt_module.h
vendored
Normal file
133
external/tile/tile_lib/modules/tile_tdt_module.h
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* NOTICE
|
||||
*
|
||||
* Copyright 2017 Tile Inc. All Rights Reserved.
|
||||
* All code or other information included in the accompanying files ("Tile Source Material")
|
||||
* is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
|
||||
* is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
|
||||
* and may not be otherwise distributed or made available to others, including for commercial purposes.
|
||||
* Without limiting the foregoing , you understand and agree that no production use
|
||||
* of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
|
||||
* agreement with Tile.
|
||||
* You also understand and agree that Tile may terminate the limited rights granted under these terms
|
||||
* at any time in its discretion.
|
||||
* All Tile Source Material is provided AS-IS without warranty of any kind.
|
||||
* Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
|
||||
* Tile will not be liable for any damages resulting from your use of or inability to use
|
||||
* the Tile Source Material.
|
||||
*
|
||||
* Support: firmware_support@tile.com
|
||||
*/
|
||||
|
||||
/** @file tile_tdt_module.h
|
||||
** @brief Tile Double Tap module
|
||||
*/
|
||||
|
||||
#ifndef TILE_TDT_MODULE_H_
|
||||
#define TILE_TDT_MODULE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TDT_HDC_IBEACON_DURATION 200 ///< in tens of miliseconds
|
||||
#define TDT_HDC_ADVERTISING_STEP_DURATION 200 ///< Advertising step in tens of miliseconds
|
||||
#define TDT_HDC_ADVERTISING_LAST_STEP_DURATION 100 ///< Advertising last step in tens of miliseconds
|
||||
|
||||
#define TDT_HDC_IBEACON_INTERVAL 40 ///< in 0.625 milisecond increments
|
||||
#define TDT_HDC_ADVERTISING_INTERVAL 160 ///< in 0.625 milisecond increments
|
||||
|
||||
|
||||
/**
|
||||
* @brief TDT Local Config Struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t SE_LTF:1; ///< [0] Song Enable: LongTap Failure
|
||||
uint16_t SE_LTS:1; ///< [1] Song Enable: LongTap Success
|
||||
uint16_t SE_DTF:1; ///< [2] Song Enable: DoubleTap Failure
|
||||
uint16_t SE_DTS:1; ///< [3] Song Enable: DoubleTap Success
|
||||
uint16_t SE_STIF:1; ///< [4] Song Enable: SingleTapImmediate Failure
|
||||
uint16_t SE_STIS:1; ///< [5] Song Enable: SingleTapImmediate Success
|
||||
uint16_t SE_STDF:1; ///< [6] Song Enable: SingleTapDelayed Failure
|
||||
uint16_t SE_STDS:1; ///< [7] Song Enable: SingleTapDelayed Success
|
||||
uint16_t EN_DT:1; ///< [8] Enable: DoubleTap
|
||||
uint16_t EN_LT:1; ///< [9] Enable: LongTap
|
||||
uint16_t EN_STI:1; ///< [10] Enable: SingleTapImmediate
|
||||
uint16_t EN_STD:1; ///< [11] Enable: SingleTapDelayed
|
||||
uint16_t SS_Strength:2; ///< [12:13] Success Song Strength (0/1: Low; 2: Med; 3: High)
|
||||
uint16_t FS_Strength:2; ///< [14:15] Fail Song Strength (0/1: Low; 2: Med; 3: High)
|
||||
uint8_t Delay; ///< DoubleTap and LongTap detection delay: in units of 20 ms, plus an offset of 10ms.
|
||||
uint8_t NotifDebounceDelay; ///< DoubleTap Notification Debouncing Delay: in units of 100ms. 0 means no debouncing.
|
||||
|
||||
} tdt_config_t;
|
||||
|
||||
|
||||
/**
|
||||
* Tile DoubleTap module.
|
||||
*
|
||||
* This module is used by Tile Lib to detect various types of button press.
|
||||
* Furthermore, this module also supports the "TDT HDC" feature, which is used
|
||||
* to advertise with a high duty cycle when a double tap is detected.
|
||||
*/
|
||||
struct tile_tdt_module
|
||||
{
|
||||
/**
|
||||
* Configuration for TDT. Used internally by Tile Lib.
|
||||
*/
|
||||
tdt_config_t config;
|
||||
|
||||
/**
|
||||
* Variables to support optional TDT HDC feature.
|
||||
*/
|
||||
uint8_t hdc_status;
|
||||
|
||||
/*** Diagnostic information ***/
|
||||
uint16_t *single_tap;
|
||||
uint8_t *long_tap;
|
||||
uint16_t *double_tap_detect;
|
||||
uint16_t *double_tap_notify;
|
||||
uint16_t *double_tap_failure2;
|
||||
|
||||
/**
|
||||
* Configuration was written by the app. Should be stored to NVM.
|
||||
*/
|
||||
int (*config_written)(tdt_config_t *config);
|
||||
|
||||
/**
|
||||
* Called when a double tap is detected and the Tile should move into
|
||||
* high duty cycle advertising.
|
||||
*/
|
||||
void (*hdc_cb)(void);
|
||||
};
|
||||
|
||||
/**
|
||||
* TDT_HDC_STATUS.
|
||||
*
|
||||
* Used by the TDT HDC optional feature (see @ref tile_tdt_module).
|
||||
*/
|
||||
enum TDT_HDC_STATUS
|
||||
{
|
||||
TDT_HDC_STATUS_NORMAL = 0x00, // Default state, Nothing special
|
||||
TDT_HDC_STATUS_IBEACON = 0x01, // Advertise iBeacon
|
||||
TDT_HDC_STATUS_FAST_ADV = 0x02, // Advertise fast
|
||||
TDT_HDC_STATUS_FAST_ADV2 = 0x03, // Advertise fast
|
||||
TDT_HDC_STATUS_FAST_ADV3 = 0x04, // Advertise fast
|
||||
TDT_HDC_STATUS_FAST_ADV4 = 0x05, // Advertise fast
|
||||
TDT_HDC_STATUS_FAST_ADV5 = 0x06, // Advertise fast
|
||||
TDT_HDC_STATUS_NOTIFY = 0x07, // Send a TDT notification
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Register TDT module
|
||||
*/
|
||||
int tile_tdt_register(struct tile_tdt_module *module);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TILE_TDT_MODULE_H_
|
||||
52
external/tile/tile_lib/modules/tile_test_module.h
vendored
Normal file
52
external/tile/tile_lib/modules/tile_test_module.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* NOTICE
|
||||
*
|
||||
* Copyright 2020 Tile Inc. All Rights Reserved.
|
||||
* All code or other information included in the accompanying files ("Tile Source Material")
|
||||
* is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
|
||||
* is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
|
||||
* and may not be otherwise distributed or made available to others, including for commercial purposes.
|
||||
* Without limiting the foregoing , you understand and agree that no production use
|
||||
* of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
|
||||
* agreement with Tile.
|
||||
* You also understand and agree that Tile may terminate the limited rights granted under these terms
|
||||
* at any time in its discretion.
|
||||
* All Tile Source Material is provided AS-IS without warranty of any kind.
|
||||
* Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
|
||||
* Tile will not be liable for any damages resulting from your use of or inability to use
|
||||
* the Tile Source Material.
|
||||
*
|
||||
* Support: firmware_support@tile.com
|
||||
*/
|
||||
|
||||
/** @file tile_test_module.h
|
||||
** @brief Receive TEST commands over TOA
|
||||
*/
|
||||
|
||||
#ifndef TILE_TEST_MODULE_H_
|
||||
#define TILE_TEST_MODULE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/**
|
||||
* @brief All TEST commands/responses through this module will need a code
|
||||
* greater than @ref TILE_TEST_MODULE_CODE_BASE.
|
||||
*/
|
||||
#define TILE_TEST_MODULE_CODE_BASE 0x80
|
||||
|
||||
struct tile_test_module
|
||||
{
|
||||
/**
|
||||
* @brief Receive a TEST message
|
||||
*/
|
||||
int (*process)(uint8_t code, uint8_t *message, uint8_t length);
|
||||
};
|
||||
|
||||
|
||||
int tile_test_register(struct tile_test_module *module);
|
||||
|
||||
|
||||
int tile_test_response(uint8_t code, uint8_t *response, uint8_t length);
|
||||
|
||||
#endif
|
||||
73
external/tile/tile_lib/modules/tile_tmd_module.h
vendored
Normal file
73
external/tile/tile_lib/modules/tile_tmd_module.h
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* NOTICE
|
||||
*
|
||||
* Copyright 2020 Tile Inc. All Rights Reserved.
|
||||
* All code or other information included in the accompanying files ("Tile Source Material")
|
||||
* is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
|
||||
* is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
|
||||
* and may not be otherwise distributed or made available to others, including for commercial purposes.
|
||||
* Without limiting the foregoing , you understand and agree that no production use
|
||||
* of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
|
||||
* agreement with Tile.
|
||||
* You also understand and agree that Tile may terminate the limited rights granted under these terms
|
||||
* at any time in its discretion.
|
||||
* All Tile Source Material is provided AS-IS without warranty of any kind.
|
||||
* Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
|
||||
* Tile will not be liable for any damages resulting from your use of or inability to use
|
||||
* the Tile Source Material.
|
||||
*
|
||||
* Support: firmware_support@tile.com
|
||||
*/
|
||||
|
||||
/** @file tile_tmd_module.h
|
||||
** @brief Tile Mode module interface. Controls Tile Mode.
|
||||
*/
|
||||
|
||||
#ifndef TILE_TMD_MODULE_H_
|
||||
#define TILE_TMD_MODULE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** \defgroup TMD Tile mode
|
||||
* \ingroup TOA
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief TILE_MODE <br>
|
||||
*/
|
||||
enum TILE_MODE
|
||||
{
|
||||
TILE_MODE_MANUFACTURING = 0x0,
|
||||
TILE_MODE_SHIPPING = 0x1,
|
||||
TILE_MODE_ACTIVATED = 0x2
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* Tile Mode module.
|
||||
*
|
||||
* This module is used by Tile Lib to get and set the mode.
|
||||
*/
|
||||
struct tile_tmd_module
|
||||
{
|
||||
/**
|
||||
* Get the current mode
|
||||
*/
|
||||
int (*get)(uint8_t *mode);
|
||||
|
||||
/**
|
||||
* Set the mode. Value should be saved in NVM.
|
||||
*/
|
||||
int (*set)(uint8_t mode);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Register the TMD module
|
||||
*/
|
||||
int tile_tmd_register(struct tile_tmd_module *module);
|
||||
|
||||
|
||||
#endif
|
||||
334
external/tile/tile_lib/modules/tile_toa_module.h
vendored
Normal file
334
external/tile/tile_lib/modules/tile_toa_module.h
vendored
Normal file
@@ -0,0 +1,334 @@
|
||||
/**
|
||||
* NOTICE
|
||||
*
|
||||
* Copyright 2020 Tile Inc. All Rights Reserved.
|
||||
* All code or other information included in the accompanying files ("Tile Source Material")
|
||||
* is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
|
||||
* is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
|
||||
* and may not be otherwise distributed or made available to others, including for commercial purposes.
|
||||
* Without limiting the foregoing , you understand and agree that no production use
|
||||
* of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
|
||||
* agreement with Tile.
|
||||
* You also understand and agree that Tile may terminate the limited rights granted under these terms
|
||||
* at any time in its discretion.
|
||||
* All Tile Source Material is provided AS-IS without warranty of any kind.
|
||||
* Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
|
||||
* Tile will not be liable for any damages resulting from your use of or inability to use
|
||||
* the Tile Source Material.
|
||||
*
|
||||
* Support: firmware_support@tile.com
|
||||
*/
|
||||
|
||||
/** @file tile_toa_module.h
|
||||
** @brief Tile Over-the-air API module
|
||||
*/
|
||||
|
||||
#ifndef TILE_TOA_MODULE_H_
|
||||
#define TILE_TOA_MODULE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup toa_module Tile Over-the-air API module
|
||||
* @{
|
||||
* @ingroup TOA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief TOA Max Payload Size.
|
||||
* This is the maximum Payload that can be carried by a TOA Command or Response.
|
||||
* It excludes the TOA_CMD/TOA_RSP Code and excludes the MIC.
|
||||
*/
|
||||
#define TOA_MPS 14
|
||||
|
||||
|
||||
#define TILE_SESSION_KEY_LEN 16
|
||||
|
||||
|
||||
/**
|
||||
* Session information for a TOA channel
|
||||
*/
|
||||
struct toa_channel_tag
|
||||
{
|
||||
uint8_t session_key[TILE_SESSION_KEY_LEN];
|
||||
uint32_t nonceA;
|
||||
uint32_t nonceT;
|
||||
uint16_t state;
|
||||
uint16_t check_delay;
|
||||
uint16_t ack_delay;
|
||||
};
|
||||
|
||||
typedef struct toa_channel_tag toa_channel_t; //!< Structure containing session information for a TOA channel
|
||||
|
||||
|
||||
/**
|
||||
* Tile Over-the-air API module.
|
||||
*
|
||||
* This module is used by Tile Lib in order to implement its over-the-air
|
||||
* protocol.
|
||||
*/
|
||||
struct tile_toa_module
|
||||
{
|
||||
/**
|
||||
* Tile ID -- 64-bit identifier for Tile Nodes.
|
||||
* Example: {0x1a, 0x95, 0xd9, 0x97, 0xf0, 0xf2, 0x66, 0x07}.
|
||||
*/
|
||||
uint8_t* tile_id;
|
||||
|
||||
/**
|
||||
* Auth Key -- 128-bit master key for Tile Nodes.
|
||||
* Example: {0x14, 0x27, 0xe3, 0x03, 0xa2, 0x51, 0xc5, 0xb5, 0x07, 0x2a, 0xa9, 0x81, 0xa9, 0x42, 0x8a, 0x43}.
|
||||
*/
|
||||
uint8_t* auth_key;
|
||||
|
||||
/**
|
||||
* Pointer to an array of @ref toa_channel_t structures. It is recommended
|
||||
* to use 4 channels, but if memory is a constraint then the number can be
|
||||
* decreased.
|
||||
*/
|
||||
toa_channel_t* channels;
|
||||
|
||||
/**
|
||||
* Pointer to a buffer for queueing TOA messages.
|
||||
*/
|
||||
uint8_t* queue;
|
||||
|
||||
/**
|
||||
* Size of buffer used for TOA queue. Recommended to be at least size
|
||||
* 100 for one channel, and add 40 for each additional channel.
|
||||
*/
|
||||
uint16_t queue_size;
|
||||
|
||||
/**
|
||||
* Number of channels contained in the channels array.
|
||||
*/
|
||||
uint8_t num_channels;
|
||||
|
||||
/**
|
||||
* Diagnostic info: counts the mic failures
|
||||
*/
|
||||
uint8_t* mic_failure_count;
|
||||
|
||||
/**
|
||||
* Diagnostic info: counts the authentication failures
|
||||
*/
|
||||
uint8_t* auth_failure_count;
|
||||
|
||||
/**
|
||||
* Diagnostic info: counts the Number of successfull TOA Channel Open (with a successfull authentication)
|
||||
*/
|
||||
uint32_t* channel_open_count;
|
||||
|
||||
/**
|
||||
* Diagnostic info: counts the number of TOA Authenticate Commands received
|
||||
*/
|
||||
uint32_t* authenticate_count;
|
||||
|
||||
/**
|
||||
* Diagnostic info: counts the number of TOA channel close triggered by TKA
|
||||
*/
|
||||
uint16_t* tka_closed_channel_count;
|
||||
|
||||
/**
|
||||
* Send a TOA Response.
|
||||
* @param[in] data: Pointer to the TOA Response.
|
||||
* @param[in] len: Length of the TOA Response.
|
||||
*/
|
||||
int (*send_response)(uint8_t *data, uint16_t len);
|
||||
|
||||
/**
|
||||
* Optional callback called when an association is happenning (can be set to NULL).
|
||||
* It is mostly needed for Commissioning Tiles using an Interim TileID, Key.
|
||||
*
|
||||
* @param[in] tile_id: 8-byte unique tile identification code.
|
||||
* @param[in] tile_auth_key: 16-byte authentication key.
|
||||
* @param[in] authorization_type: Pointer to authorization type.
|
||||
*
|
||||
* @param[out] authorization_type: set to the right value if an authorization is required (ie 1 for Button Press).
|
||||
*
|
||||
* @return See @ref TILE_ERROR_CODES.
|
||||
*/
|
||||
int (*associate)(uint8_t* tile_id, uint8_t* tile_auth_key, uint8_t* authorization_type);
|
||||
};
|
||||
|
||||
|
||||
/** \ingroup TOA
|
||||
* @brief TOA feature error codes. Any feature which uses these error
|
||||
* codes will return the error in a standard format. This format is:
|
||||
*
|
||||
* TOA Response | Error Response | Offending Command | Error Code | Additional Payload
|
||||
* -------------|----------------|-------------------|------------|-------------------
|
||||
* 1 Byte | 1 Byte | 1 Byte | 1 Byte | Varies. Up to TOA_MPS - 4 bytes.
|
||||
*
|
||||
* Example 1: Say a TOFU_CTL_CMD_RESUME command is sent at a bad time. Then, the Tile would
|
||||
* respond with
|
||||
* TOA_RSP_TOFU_CTL | TOFU_CTL_RSP_ERROR | TOFU_CTL_CMD_RESUME | TOA_ERROR_INVALID_STATE
|
||||
* ------------------|----------------|---------------------|--------------------
|
||||
* 1 Byte | 1 Byte | 1 Byte | 1 Byte
|
||||
*
|
||||
*/
|
||||
enum TOA_FEATURE_ERROR_CODES
|
||||
{
|
||||
TOA_ERROR_OK = 0x00,
|
||||
/**< This code is used when there's no error */
|
||||
TOA_ERROR_UNSUPPORTED = 0x01,
|
||||
/**< This code is used when the given command is not supported */
|
||||
TOA_ERROR_PARAMETERS = 0x02,
|
||||
/**< This code is used when the parameters to the command are invalid */
|
||||
TOA_ERROR_SECURITY = 0x03,
|
||||
/**< This code is used when the app has insufficient security privileges
|
||||
* to execute the given command */
|
||||
TOA_ERROR_INVALID_STATE = 0x04,
|
||||
/**< This code is used when the given command cannot be executed in
|
||||
* the current state of the Tile */
|
||||
TOA_ERROR_MEM_READ = 0x05,
|
||||
/**< This code is used when a memory read fail */
|
||||
TOA_ERROR_MEM_WRITE = 0x06,
|
||||
/**< This code is used when a memory write fails */
|
||||
TOA_ERROR_DATA_LENGTH = 0x07,
|
||||
/**< This code is used when a received data block is not the expected size */
|
||||
TOA_ERROR_INVALID_SIZE = 0x08,
|
||||
/**< This code is used when the app requests to write data of inappropriate size */
|
||||
TOA_ERROR_SIGNATURE = 0x09,
|
||||
/**< This code is used when a signature check fails */
|
||||
TOA_ERROR_CRC = 0x0A,
|
||||
/**< This code is used when a CRC check fails */
|
||||
TOA_ERROR_CRC2 = 0x0B,
|
||||
/**< This code is used when there are multiple CRC checks */
|
||||
TOA_ERROR_HASH = 0x0C,
|
||||
/**< This code is used when a hash check fails */
|
||||
TOA_ERROR_PRODUCT_HEADER = 0x0D,
|
||||
/**< This code is used when the product header is invalid. If this happens,
|
||||
* the Tile is in a very bad state. */
|
||||
TOA_ERROR_IMAGE_HEADER = 0x0E,
|
||||
/**< This code is used when a received image header is invalid */
|
||||
TOA_ERROR_SAME_IMAGE = 0x0F,
|
||||
/**< This code is used when the image to send matches the image already on the Tile */
|
||||
TOA_ERROR_INVALID_DATA = 0x10,
|
||||
/**< This code is used when the data sent to the Tile is invalid */
|
||||
TOA_ERROR_MEM_ERASE = 0x11,
|
||||
/**< This code is used when a memory erase fails */
|
||||
TOA_ERROR_RESOURCE_IN_USE = 0x12,
|
||||
/**< This code is used when there is an attempt to access a resource in use by someone else */
|
||||
};
|
||||
|
||||
/** \ingroup TOA
|
||||
* @brief TOA Error Response Codes
|
||||
*/
|
||||
enum TOA_ERROR_CODES
|
||||
{
|
||||
TOA_RSP_ERROR_SECURITY = 0x01,
|
||||
/**< Error Code sent by TOA Server when required security level for the command is not met (like authentication)
|
||||
Format:
|
||||
@ref TOA_RSP_ERROR_SECURITY Code | The TOA_CMD that failed
|
||||
---------------------------------|-----------------------------
|
||||
1 Byte | 1 Byte
|
||||
*/
|
||||
|
||||
TOA_RSP_ERROR_UNSUPPORTED = 0x02,
|
||||
/**< Error Code sent by TOA Server when an unsupported TOA Command is received
|
||||
Format:
|
||||
@ref TOA_RSP_ERROR_UNSUPPORTED Code | The TOA_CMD that failed
|
||||
------------------------------------|-----------------------------
|
||||
1 Byte | 1 Byte
|
||||
*/
|
||||
|
||||
TOA_RSP_ERROR_PARAMETERS = 0x03,
|
||||
/**< Error Code sent by TOA Server when a TOA Command with wrong parameters is received
|
||||
Format:
|
||||
|
||||
@ref TOA_RSP_ERROR_PARAMETERS Code | The TOA_CMD that failed
|
||||
-----------------------------------|------------------------------
|
||||
1 Byte | 1 Byte
|
||||
*/
|
||||
|
||||
TOA_RSP_ERROR_DROPPED_RSP = 0x04,
|
||||
/**< Error Code sent by TOA Server when 1 or more Responses were dropped, most likely due to an overflow.<br>
|
||||
The Client should close the connection when this happens.
|
||||
Format:
|
||||
@ref TOA_RSP_ERROR_DROPPED_RSP Code | The first TOA_RSP that was dropped
|
||||
-------------------------------------|----------------------------------------
|
||||
1 Byte | 1 Byte
|
||||
*/
|
||||
|
||||
TOA_RSP_ERROR_NO_CID_AVAILABLE = 0x05,
|
||||
/**< Error Code sent by a TOA Server when there are no CIDs available for allocation.
|
||||
|
||||
Format:
|
||||
@ref TOA_RSP_ERROR_NO_CID_AVAILABLE | TOA_CMD_OPEN_CHANNEL
|
||||
------------------------------------|--------------------------
|
||||
1 Byte | 1 Byte
|
||||
*/
|
||||
|
||||
TOA_RSP_ERROR_AUTHORIZATION = 0x06,
|
||||
/**< Error Code sent by a TOA Server when the required authorization level for the command is not met
|
||||
Format:
|
||||
@ref TOA_RSP_ERROR_AUTHORIZATION Code | The TOA_CMD that failed | The required Authorization Type
|
||||
--------------------------------------|------------------------------|--------------------------------
|
||||
1 Byte | 1 Byte | 1 Byte (value 1 for Button Press)
|
||||
*/
|
||||
|
||||
TOA_RSP_SERVICE_UNAVAILABLE = 0x07,
|
||||
/**< Error Code sent by a TOA Server when the required service is unavailable (i.e. user trigger)
|
||||
Format:
|
||||
@ref TOA_RSP_SERVICE_UNAVAILABLE Code | The TOA_CMD that failed
|
||||
--------------------------------------|-----------------------------
|
||||
1 Byte | 1 Byte
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Register TOA module.
|
||||
*/
|
||||
int tile_toa_register(struct tile_toa_module *module);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief The underlying TOA transport is ready.
|
||||
* This is the case when TOA_RSP channel was enabled for notifications or indications.
|
||||
*
|
||||
* @param[in] ready 1 for ready, 0 for not ready.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
void tile_toa_transport_ready(bool ready);
|
||||
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief A TOA response was successfully sent to the TOA Client (and an other one can be sent).
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
void tile_toa_response_sent_ok(void);
|
||||
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief An TOA Commands was received.
|
||||
*
|
||||
* @param[in] data pointer to data.
|
||||
* @param[in] datalen number of bytes of data.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
void tile_toa_command_received(const uint8_t* data, uint8_t datalen);
|
||||
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Send an Authorized Notification.
|
||||
*
|
||||
* @param[in] authorization_type The type of authorization (ie Button press).
|
||||
* @param[in] authorization_time The time for which the authorization is valid.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
int tile_toa_authorized(uint8_t authorization_type, uint16_t authorization_time);
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif
|
||||
81
external/tile/tile_lib/modules/tile_tpi_module.h
vendored
Normal file
81
external/tile/tile_lib/modules/tile_tpi_module.h
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* NOTICE
|
||||
*
|
||||
* Copyright 2020 Tile Inc. All Rights Reserved.
|
||||
* All code or other information included in the accompanying files ("Tile Source Material")
|
||||
* is PROPRIETARY information of Tile Inc. ("Tile") and access and use of the Tile Source Material
|
||||
* is subject to these terms. The Tile Source Material may only be used for demonstration purposes,
|
||||
* and may not be otherwise distributed or made available to others, including for commercial purposes.
|
||||
* Without limiting the foregoing , you understand and agree that no production use
|
||||
* of the Tile Source Material is allowed without a Tile ID properly obtained under a separate
|
||||
* agreement with Tile.
|
||||
* You also understand and agree that Tile may terminate the limited rights granted under these terms
|
||||
* at any time in its discretion.
|
||||
* All Tile Source Material is provided AS-IS without warranty of any kind.
|
||||
* Tile does not warrant that the Tile Source Material will be error-free or fit for your purposes.
|
||||
* Tile will not be liable for any damages resulting from your use of or inability to use
|
||||
* the Tile Source Material.
|
||||
*
|
||||
* Support: firmware_support@tile.com
|
||||
*/
|
||||
|
||||
/** @file tile_tpi_module.h
|
||||
** @brief Tile Private Identification API module
|
||||
*/
|
||||
|
||||
#ifndef TILE_TPI_MODULE_H_
|
||||
#define TILE_TPI_MODULE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Tile TPI API module.
|
||||
*
|
||||
* This module is used by Tile Lib in order to implement PrivateID
|
||||
*/
|
||||
struct tile_tpi_module
|
||||
{
|
||||
/**
|
||||
* tileID_counter, Maintained by TileLib and persistently stored by the Application at each update.
|
||||
*/
|
||||
uint16_t* tileID_counter;
|
||||
/**
|
||||
* Tile Identity Key. Saved by the Application in persistent memory when the key is refreshed.
|
||||
* 16 bytes.
|
||||
*/
|
||||
uint8_t* tileID_key;
|
||||
|
||||
/**
|
||||
* Hashed TileID, Created by TileLib and to be accessed and used by the Application to advertise.
|
||||
* 8 bytes.
|
||||
*/
|
||||
uint8_t* hashed_tileID;
|
||||
|
||||
/**
|
||||
* The tileID_counter was incremented and its new value shall be saved into flash by the application.
|
||||
* Also, Advertising Data need to be updated with the new hashed_tileID.
|
||||
*/
|
||||
int (*tileID_counter_updated)(void);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Register TPI Module.
|
||||
*
|
||||
* @param[in] module Pointer to the TPI Module struct.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
int tile_tpi_register(struct tile_tpi_module *module);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TILE_TPI_MODULE_H_
|
||||
Reference in New Issue
Block a user