#ifndef __TSTAT_H_
#define __TSTAT_H_

#include <stdint.h>
#include "boards.h"
#include "ble.h"
#include "ble_srv_common.h"
#include "nrf_sdh_ble.h"

#define BLE_TSTAT_BLE_OBSERVER_PRIO 2

#define BLE_TSTAT_DEF(_name)                                                                          \
static ble_tstat_t _name;                                                                             \
NRF_SDH_BLE_OBSERVER(_name ## _obs,                                                                 \
                     BLE_TSTAT_BLE_OBSERVER_PRIO,                                                     \
                     ble_tstat_on_ble_evt, &_name)


// 1B42494A-E0EB-4D9E-A86B-DCABCC3565B9
#define TZC_SERVICE_UUID_BASE                                                                      \
  {                                                                                                \
    0xB9, 0x65, 0x35, 0xCC, 0xAB, 0xDC, 0x6B, 0xA8, 0x9E, 0x4D, 0xEB, 0xE0, 0x4A, 0x49, 0x42, 0x1B \
  }
#define TZC_SERVICE_UUID 0x3141
#define TZC_TSTAT_CHAR_UUID 0x3143

// Forward declaration of the custom_service_t type.
typedef struct ble_tstat_s ble_tstat_t;
 
 
/** @brief LED Service init structure. This structure contains all options and data needed for
 *        initialization of the service.*/
typedef struct
{
    uint8_t some_value;
} ble_tstat_init_t;
 
/**@brief LED Service structure.
 *        This contains various status information
 *        for the service.
 */
typedef struct ble_tstat_s
{
    uint16_t                            conn_handle;
    uint16_t                            service_handle;
    uint8_t                             uuid_type;
    ble_gatts_char_handles_t            tstat_char_handles;
 
} ble_tstat_t;
 
// Function Declarations
 
/**@brief Function for initializing the LED Service.
 *
 * @param[out]  p_led_service  LED Service structure. This structure will have to be supplied by
 *                                the application. It will be initialized by this function, and will later
 *                                be used to identify this particular service instance.
 *
 * @return      NRF_SUCCESS on successful initialization of service, otherwise an error code.
 */
uint32_t ble_tstat_init(ble_tstat_t * p_tstat, const ble_tstat_init_t * p_tstat_init);
 
/**@brief Function for handling the application's BLE stack events.
 *
 * @details This function handles all events from the BLE stack that are of interest to the LED Service.
 *
 * @param[in] p_ble_evt  Event received from the BLE stack.
 * @param[in] p_context  LED Service structure.
 */
void ble_tstat_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context);

uint32_t ble_tstat_on_heat_signal_change(uint16_t conn_handle, ble_tstat_t * p_tstat, uint8_t heatSignal);

#endif
