#ifndef COMPUTE_DISTANCE_H_
#define COMPUTE_DISTANCE_H_

#include <zephyr/types.h>
#include <stddef.h>
#include <stdio.h>
#include <errno.h>
#include <math.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>

#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/uuid.h>
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/sys/byteorder.h>

#define SLEEP_TIME_MS 1000
#define NUM_MEASUREMENTS 5
#define SEUIL_DISTANCE 1.0

void read_conn_rssi(uint16_t handle, int8_t *rssi);
double compute_distance(int rssi);
double get_distance_rssi(struct bt_conn *conn_snapshot);
bool is_device_nearby(struct bt_conn *conn_snapshot);

#endif /* COMPUTE_DISTANCE_H_ */