/** ***************************************************************************************** * Copyright(c) 2015, Realtek Semiconductor Corporation. All rights reserved. ***************************************************************************************** * @file ota_client.h * @brief Head file for using ota service Client. * @details Data structs and external functions declaration. * @author * @date * @version * ************************************************************************************* */ /* Define to prevent recursive inclusion */ #ifndef _OTA_CLIENT_H_ #define _OTA_CLIENT_H_ #ifdef __cplusplus extern "C" { #endif /* Add Includes here */ #include "profile_client.h" #include "dfu_api.h" /** @defgroup OTA_Client OTA Service Client * @{ */ /*============================================================================* * Macros *============================================================================*/ /** @addtogroup OTA_Client_Exported_Macros OTA Client Exported Macros * @brief * @{ */ /** @defgroup OTA UUIDs * @brief ota BLE Profile UUID definitions * @{ */ #define GATT_UUID_OTA_SERVICE 0x12, 0xA2, 0x4D, 0x2E, 0xFE, 0x14, 0x48, 0x8e, 0x93, 0xD2, 0x17, 0x3C, 0xFF, 0xD0, 0x00, 0x00 #define GATT_UUID_OTA_PROFILE #define GATT_UUID_CHAR_OTA 0xFFD1 //1, write #define GATT_UUID_CHAR_MAC 0xFFD2 //2 #define GATT_UUID_CHAR_PATCH 0xFFD3 //3 #define GATT_UUID_CHAR_APP_VERSION 0xFFD4 //4 #define GATT_UUID_CHAR_PATCH_EXTENSION 0xFFD5 //5 #define GATT_UUID_CHAR_TEST_MODE 0xFFD8 //6, write #define GATT_UUID_CHAR_DEVICE_INFO 0xFFF1 //7 #define GATT_UUID_CHAR_IMAGE_COUNT_TO_UPDATE 0xFFF2 //8, write #define GATT_UUID_CHAR_IMAGE_VERSION 0xFFE0 /** @} End of OTA_UUIDs */ #define OTA_WRITE_OTA_CMD_CHAR_VAL 0x01 #define OTA_WRITE_TEST_MODE_CHAR_VAL 0x02 #define OTA_WRITE_OTA_IMG_COUNTER_CHAR_VAL 0x03 /** @brief Define links number. range: 0-4 */ #define OTA_MAX_LINKS 4 /** End of OTA_Client_Exported_Macros * @} */ /*============================================================================* * Types *============================================================================*/ /** @defgroup OTA_Client_Exported_Types OTA Client Exported Types * @brief * @{ */ /** @brief OTA client device info*/ typedef struct _T_OTA_DEVICE_INFO { uint8_t ictype; uint8_t ota_version; uint8_t secure_version; T_OTA_MODE ota_mode; uint16_t max_buffer_size; uint16_t rsvd; uint32_t img_indicator; } T_OTA_DEVICE_INFO, *P_OTA_DEVICE_INFO; /** @brief OTA client handle type*/ typedef enum { HDL_OTA_SRV_START, //!< start handle of battery service HDL_OTA_SRV_END, //!< end handle of battery service HDL_OTA_CMD, //!< OTA CMD characteristic value handle HDL_OTA_DEVICE_MAC, HDL_OTA_PATCH_VER, HDL_OTA_APP_VER, HDL_OTA_PATCH_EXT_VER, HDL_OTA_TEST_MODE, //!< OTA test mode characteristic handle HDL_OTA_DEVICE_INFO, HDL_OTA_IMG_COUNTER, //!