/**
 * @file app_uwbrange.h
 * @brief Declarations of distance service (app)
 * @version 6.0
 * @date 27/06/2017
 */
 
#ifndef APP_DISTANCE_H__
#define APP_DISTANCE_H__


#include "ble_uwbrange.h"
#include "decawave_app.h"


// timers
uint32_t timers_init	(void);

void start_poll_timer	(void);
void start_blink_timer	(void);
void stop_blink_timer	(void);

void blink_timeout_handler	(void * p_context);
void poll_timeout_handler	(void * p_context);

// Ble service
void uwbrange_service_init			(chConfig_t chConfig);
void set_ble_uwbrange_on_ble_evt	(ble_evt_t *p_ble_evt);
void on_uwbrange_evt				(ble_uwbrange_t * p_uwbrange, ble_uwbrange_evt_t * p_evt);
void uwbrange_measurement_update 	(double distance);

void bas_init(void);
void set_ble_bas_on_ble_evt(ble_evt_t *p_ble_evt);
void battery_level_update (uint8_t value);

// Ranging modes
void GoToRangingMode	(void);
void GoToDiscoveryMode	(void);
void GoToIdleMode		(void);

#endif
