初始版本
This commit is contained in:
78
external/tile/tile_lib/crypto/hmac_sha256.h
vendored
Normal file
78
external/tile/tile_lib/crypto/hmac_sha256.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* HMAC-SHA-224/256/384/512 implementation
|
||||
* Last update: 06/15/2005
|
||||
* Issue date: 06/15/2005
|
||||
*
|
||||
* Copyright (C) 2005 Olivier Gay <olivier.gay@a3.epfl.ch>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef HMAC_SHA2_H
|
||||
#define HMAC_SHA2_H
|
||||
|
||||
#include "crypto/sha256.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
sha256_ctx ctx;
|
||||
#if 0
|
||||
sha256_ctx ctx_inside;
|
||||
sha256_ctx ctx_outside;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* for hmac_reinit */
|
||||
sha256_ctx ctx_inside_reinit;
|
||||
sha256_ctx ctx_outside_reinit;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
unsigned char block_ipad[SHA256_BLOCK_SIZE];
|
||||
unsigned char block_opad[SHA256_BLOCK_SIZE];
|
||||
#endif
|
||||
} hmac_sha256_ctx;
|
||||
|
||||
void hmac_sha256_init(hmac_sha256_ctx *ctx, const unsigned char *key,
|
||||
unsigned int key_size);
|
||||
/* void hmac_sha256_reinit(hmac_sha256_ctx *ctx); */
|
||||
void hmac_sha256_update(hmac_sha256_ctx *ctx, const unsigned char *message,
|
||||
unsigned int message_len);
|
||||
void hmac_sha256_final(hmac_sha256_ctx *ctx, unsigned char *mac,
|
||||
unsigned int mac_size);
|
||||
void hmac_sha256_ogay(const unsigned char *key, unsigned int key_size,
|
||||
const unsigned char *message, unsigned int message_len,
|
||||
unsigned char *mac, unsigned mac_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !HMAC_SHA2_H */
|
||||
|
||||
84
external/tile/tile_lib/crypto/sha256.h
vendored
Normal file
84
external/tile/tile_lib/crypto/sha256.h
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* FIPS 180-2 SHA-224/256/384/512 implementation
|
||||
* Last update: 02/02/2007
|
||||
* Issue date: 04/30/2005
|
||||
*
|
||||
* Copyright (C) 2005, 2007 Olivier Gay <olivier.gay@a3.epfl.ch>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SHA2_H
|
||||
#define SHA2_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define SHA224_DIGEST_SIZE ( 224 / 8)
|
||||
#define SHA256_DIGEST_SIZE ( 256 / 8)
|
||||
#define SHA384_DIGEST_SIZE ( 384 / 8)
|
||||
#define SHA512_DIGEST_SIZE ( 512 / 8)
|
||||
|
||||
#define SHA256_BLOCK_SIZE ( 512 / 8)
|
||||
#define SHA512_BLOCK_SIZE (1024 / 8)
|
||||
#define SHA384_BLOCK_SIZE SHA512_BLOCK_SIZE
|
||||
#define SHA224_BLOCK_SIZE SHA256_BLOCK_SIZE
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
unsigned int tot_len;
|
||||
unsigned int len;
|
||||
//unsigned char block[2 * SHA256_BLOCK_SIZE];
|
||||
unsigned char block[SHA256_BLOCK_SIZE];
|
||||
uint32_t h[8];
|
||||
} sha256_ctx;
|
||||
|
||||
|
||||
typedef sha256_ctx sha224_ctx;
|
||||
|
||||
void sha224_init(sha224_ctx *ctx);
|
||||
void sha224_update(sha224_ctx *ctx, const unsigned char *message,
|
||||
unsigned int len);
|
||||
void sha224_final(sha224_ctx *ctx, unsigned char *digest);
|
||||
void sha224(const unsigned char *message, unsigned int len,
|
||||
unsigned char *digest);
|
||||
|
||||
void sha256_init(sha256_ctx * ctx);
|
||||
void sha256_update(sha256_ctx *ctx, const unsigned char *message,
|
||||
unsigned int len);
|
||||
void sha256_final(sha256_ctx *ctx, unsigned char *digest);
|
||||
void sha256(const unsigned char *message, unsigned int len,
|
||||
unsigned char *digest);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !SHA2_H */
|
||||
|
||||
82
external/tile/tile_lib/drivers/tile_button_driver.h
vendored
Normal file
82
external/tile/tile_lib/drivers/tile_button_driver.h
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 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_button_driver.h
|
||||
** @brief Tile Button driver
|
||||
*/
|
||||
|
||||
#ifndef TILE_BUTTON_DRIVER_H_
|
||||
#define TILE_BUTTON_DRIVER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Button states
|
||||
*/
|
||||
enum TILE_BUTTON_STATES
|
||||
{
|
||||
TILE_BUTTON_PRESSED,
|
||||
TILE_BUTTON_RELEASED,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Tile button driver.
|
||||
*/
|
||||
struct tile_button_driver
|
||||
{
|
||||
/**
|
||||
* Read the state of the Tile button.
|
||||
*
|
||||
* @param[out] button_state State of the button. See TILE_BUTTON_STATES.
|
||||
*
|
||||
* @return See @ref TILE_ERROR_CODES.
|
||||
*/
|
||||
int (*read_state)(uint8_t *button_state);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Register the button module.
|
||||
*
|
||||
* @param[in] driver Driver for the Tile button.
|
||||
*
|
||||
* @return TILE_ERROR_SUCCESS.
|
||||
*/
|
||||
int tile_button_register(struct tile_button_driver *driver);
|
||||
|
||||
|
||||
/**
|
||||
* Call when the Tile button has been pressed.
|
||||
*
|
||||
* @return TILE_ERROR_SUCCESS.
|
||||
*/
|
||||
int tile_button_pressed(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TILE_BUTTON_DRIVER_H_
|
||||
114
external/tile/tile_lib/drivers/tile_gap_driver.h
vendored
Normal file
114
external/tile/tile_lib/drivers/tile_gap_driver.h
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* 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_gap_driver.h
|
||||
** @brief Tile GAP Driver interface. Provides TileLib Control over GAP functions, like connection,
|
||||
** disconnection and connection parameters.
|
||||
*/
|
||||
|
||||
#ifndef TILE_GAP_DRIVER_H_
|
||||
#define TILE_GAP_DRIVER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define TILE_SERVICE_DATA_VERSION_0 0
|
||||
#define TILE_SERVICE_DATA_VERSION_2 2
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Connection parameters.
|
||||
*/
|
||||
struct tile_conn_params
|
||||
{
|
||||
uint16_t conn_interval;
|
||||
uint16_t slave_latency;
|
||||
uint16_t conn_sup_timeout;
|
||||
};
|
||||
|
||||
|
||||
struct tile_gap_driver
|
||||
{
|
||||
/**
|
||||
* Time in 10ms increments before Tile disconnects if no client has
|
||||
* authenticated. A value of 0 indicates that this feature is disabled.
|
||||
* The value may be updated at any time, but will not clear a timer which
|
||||
* is already running. The value is used after a connection is established.
|
||||
*/
|
||||
uint16_t authentication_timer_delay;
|
||||
|
||||
/**
|
||||
* Memory space for current connection parameters.
|
||||
*/
|
||||
struct tile_conn_params conn_params;
|
||||
|
||||
/**
|
||||
* Diagnostic info: counts the number of disconnections triggered by Auth Timer.
|
||||
*/
|
||||
uint16_t* auth_disconnect_count;
|
||||
|
||||
/**
|
||||
* Disconnect from the currently connected device.
|
||||
*
|
||||
* @return See @ref TILE_ERROR_CODES.
|
||||
*/
|
||||
int (*gap_disconnect)(void);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Register the GAP driver with Tile Library.
|
||||
*/
|
||||
int tile_gap_register(struct tile_gap_driver *driver);
|
||||
|
||||
|
||||
/**
|
||||
* Call when a connection has been established.
|
||||
*/
|
||||
int tile_gap_connected(struct tile_conn_params *conn_params);
|
||||
|
||||
/**
|
||||
* Call when a connection has been terminated.
|
||||
*/
|
||||
int tile_gap_disconnected(void);
|
||||
|
||||
/**
|
||||
* Call when the connection parameters have been updated. This function will
|
||||
* update the values contained in the driver structure.
|
||||
*/
|
||||
int tile_gap_params_updated(struct tile_conn_params *conn_params);
|
||||
|
||||
/***************************************************************************************
|
||||
* @brief Get the advertising parameters to use from TileLib.
|
||||
*
|
||||
* @param[out] adv_interval pointer to write the Advertising Interval.
|
||||
* @param[out] tile_service_uuid pointer to write the Service UUID to put in the list of 16-bit UUIDs and Service Data.
|
||||
* @param[out] tile_service_data_length pointer to write the Service Data length.
|
||||
* @param[out] tile_service_data pointer to write the Service Data. The required minimum available buffer size is TILE_SERVICE_DATA_MAX_LENGTH.
|
||||
* @param[out] manuf pointer to indicate whether munufacturing data is available.
|
||||
*
|
||||
* @return See @ref TILE_ERROR_CODES.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
int tile_gap_get_adv_params(uint16_t* adv_interval, uint16_t* tile_service_uuid, uint8_t* tile_service_data_length, uint8_t* tile_service_data, uint8_t* manuf);
|
||||
|
||||
#endif
|
||||
54
external/tile/tile_lib/drivers/tile_random_driver.h
vendored
Normal file
54
external/tile/tile_lib/drivers/tile_random_driver.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* 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_random_driver.h
|
||||
** @brief Tile Random Bytes Generation. Provides TileLib an interface to generate random numbers.
|
||||
*/
|
||||
|
||||
#ifndef TILE_RANDOM_DRIVER_H_
|
||||
#define TILE_RANDOM_DRIVER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/**
|
||||
* Tile random number driver
|
||||
*/
|
||||
struct tile_random_driver
|
||||
{
|
||||
/**
|
||||
* Generate random bytes.
|
||||
*
|
||||
* @param[out] dst Buffer to write random bytes to.
|
||||
* @param[in] length Number of random bytes to generate.
|
||||
*
|
||||
* @return See @ref TILE_ERROR_CODES.
|
||||
*/
|
||||
int (*random_bytes)(uint8_t *dst, uint8_t length);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Register the Tile random driver.
|
||||
*/
|
||||
int tile_random_register(struct tile_random_driver *driver);
|
||||
|
||||
#endif
|
||||
89
external/tile/tile_lib/drivers/tile_timer_driver.h
vendored
Normal file
89
external/tile/tile_lib/drivers/tile_timer_driver.h
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* 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_timer_driver.h
|
||||
** @brief Tile Timer Driver interface. Provides TileLib an interface to use timers.
|
||||
*/
|
||||
|
||||
#ifndef TILE_TIMER_DRIVER_H_
|
||||
#define TILE_TIMER_DRIVER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/**
|
||||
* Number of Tile ticks in one second. All Tile timer durations are
|
||||
* specified in Tile ticks.
|
||||
*/
|
||||
#define TILE_TICKS_PER_SEC ((uint32_t)100)
|
||||
|
||||
/**
|
||||
* IDs to associate with each Tile timer.
|
||||
*/
|
||||
enum TILE_TIMER_IDS
|
||||
{
|
||||
TILE_CONNECTION_TIMER,
|
||||
TILE_AUTHENTICATION_TIMER,
|
||||
TILE_TDT_DOUBLETAP_TIMER,
|
||||
TILE_TDT_HDC_TIMER,
|
||||
TILE_TCU_PARAM_UPDATE_TIMER,
|
||||
TILE_TKA_TIMER1,
|
||||
TILE_TKA_TIMER2,
|
||||
TILE_TKA_TIMER3,
|
||||
TILE_TEST_TIMER1,
|
||||
TILE_TEST_TIMER2,
|
||||
TILE_TEST_TIMER3,
|
||||
TILE_TEST_TIMER4,
|
||||
TILE_TEST_TIMER5,
|
||||
TILE_TEST_TIMER6,
|
||||
TILE_TEST_TIMER7,
|
||||
TILE_TEST_TIMER8,
|
||||
TILE_TILEID_COUNTER_TIMER,
|
||||
TILE_MAX_TIMERS /* < Number of timers used by Tile Lib. */
|
||||
};
|
||||
|
||||
struct tile_timer_driver
|
||||
{
|
||||
/**
|
||||
* Start a timer. duration is in 10ms increments.
|
||||
*/
|
||||
int (*start)(uint8_t timer_id, uint32_t duration);
|
||||
|
||||
/**
|
||||
* Cancel a timer.
|
||||
*/
|
||||
int (*cancel)(uint8_t timer_id);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Timer registration function.
|
||||
*/
|
||||
int tile_timer_register(struct tile_timer_driver *driver);
|
||||
|
||||
|
||||
/**
|
||||
* Call when a Tile timer has expired.
|
||||
*/
|
||||
int tile_timer_expired(uint8_t timer_id);
|
||||
|
||||
|
||||
#endif // TILE_TIMER_DRIVER_H_
|
||||
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_
|
||||
125
external/tile/tile_lib/tile_lib.h
vendored
Normal file
125
external/tile/tile_lib/tile_lib.h
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef TILE_LIB_H_
|
||||
#define TILE_LIB_H_
|
||||
|
||||
/** @defgroup tile_lib Tile Library API
|
||||
* @{
|
||||
* @ingroup TOA
|
||||
* @brief Tile Library Api
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Tile Service UUIDs.
|
||||
* These are 16-bit UUIDs.
|
||||
*/
|
||||
#define TILE_SHIPPING_UUID 0xFEEC /** Advertised by Tiles in Shipping Mode. */
|
||||
#define TILE_ACTIVATED_UUID 0xFEED /** Advertised by Tiles in Activated Mode. */
|
||||
#define TILE_SERVICE_UUID TILE_ACTIVATED_UUID /** Used to declare Tile Gatt Service. */
|
||||
|
||||
#define TILE_SVC_BASE_UUID { 0xC0, 0x91, 0xC4, 0x8D, 0xBD, 0xE7, 0x60, 0xBA, 0xDD, 0xF4, 0xD6, 0x35, 0x00, 0x00, 0x41, 0x9D }
|
||||
#define TILE_TOA_CMD_UUID { 0xC0, 0x91, 0xC4, 0x8D, 0xBD, 0xE7, 0x60, 0xBA, 0xDD, 0xF4, 0xD6, 0x35, 0x18, 0x00, 0x41, 0x9D }
|
||||
#define TILE_TOA_RSP_UUID { 0xC0, 0x91, 0xC4, 0x8D, 0xBD, 0xE7, 0x60, 0xBA, 0xDD, 0xF4, 0xD6, 0x35, 0x19, 0x00, 0x41, 0x9D }
|
||||
#define TILE_TILEID_CHAR_UUID { 0xC0, 0x91, 0xC4, 0x8D, 0xBD, 0xE7, 0x60, 0xBA, 0xDD, 0xF4, 0xD6, 0x35, 0x07, 0x00, 0x41, 0x9D }
|
||||
|
||||
#define TILE_DEFAULT_ADV_INT_ACTIVATED 3200 // In 0.625 ms Units
|
||||
#define TILE_DEFAULT_ADV_INT_SHIPPING 160 // In 0.625 ms Units
|
||||
|
||||
/**
|
||||
* TOA Command and Response characteristics lengths in octets.
|
||||
*/
|
||||
#define TILE_TOA_CMD_CHAR_LEN 20
|
||||
#define TILE_TOA_RSP_CHAR_LEN 20
|
||||
|
||||
/**
|
||||
* Attribute ID's associated with each Tile attribute.
|
||||
*/
|
||||
enum TILE_CHARACTERISTICS
|
||||
{
|
||||
TILE_TOA_CMD_CHAR,
|
||||
TILE_TOA_RSP_CHAR,
|
||||
TILE_TOA_RSP_CCCD,
|
||||
TILE_ID_CHAR,
|
||||
TILE_NUM_ATTRS
|
||||
};
|
||||
|
||||
/**
|
||||
* Length, in bytes, of the Tile ID.
|
||||
*/
|
||||
#define TILE_ID_LEN 8
|
||||
|
||||
/**
|
||||
* Length, in bytes, of the hashed_tileID.
|
||||
*/
|
||||
#define TILE_HASHED_TILEID_LEN 8
|
||||
|
||||
/**
|
||||
* Length, in bytes, of the Tile authentication key.
|
||||
*/
|
||||
#define TILE_AUTH_KEY_LEN 16
|
||||
|
||||
/**
|
||||
* Length, in bytes, of the Tile identity key.
|
||||
*/
|
||||
#define TILEID_KEY_LEN 16
|
||||
|
||||
/**
|
||||
* Length of the Tile firmware version string.
|
||||
*/
|
||||
#define TILE_FIRMWARE_VERSION_LEN 10
|
||||
|
||||
/**
|
||||
* Length of the Tile model number string.
|
||||
*/
|
||||
#define TILE_MODEL_NUMBER_LEN 10
|
||||
|
||||
/**
|
||||
* Length of the Tile hardware version string.
|
||||
*/
|
||||
#define TILE_HARDWARE_VERSION_LEN 5
|
||||
|
||||
/**
|
||||
* Length of the Tile BDADDR.
|
||||
*/
|
||||
#define TILE_BDADDR_LEN 6
|
||||
|
||||
#define TILE_SERVICE_DATA_MAX_LENGTH 10
|
||||
|
||||
/**
|
||||
* @brief Error codes returned by Tile Lib functions
|
||||
*/
|
||||
enum TILE_ERROR_CODES
|
||||
{
|
||||
TILE_ERROR_SUCCESS = 0,
|
||||
TILE_ERROR_NOT_INITIALIZED,
|
||||
TILE_ERROR_ILLEGAL_SERVICE,
|
||||
TILE_ERROR_ILLEGAL_PARAM,
|
||||
TILE_ERROR_ILLEGAL_OPERATION,
|
||||
TILE_ERROR_BUFFER_TOO_SMALL,
|
||||
TILE_ERROR_TERMINAL,
|
||||
TILE_ERROR_REENTRANCY,
|
||||
TILE_ERROR_NUM_TOA_CHANNELS,
|
||||
};
|
||||
|
||||
/**@}*/
|
||||
|
||||
#endif
|
||||
BIN
external/tile/tile_lib/tile_lib.lib
vendored
Normal file
BIN
external/tile/tile_lib/tile_lib.lib
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user