nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
ddfs.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef BT_DDFS_H_
8#define BT_DDFS_H_
9
10#include <stdlib.h>
11#include <zephyr/types.h>
12#include <zephyr/bluetooth/conn.h>
13#include <zephyr/bluetooth/uuid.h>
14#include <zephyr/bluetooth/gatt.h>
15
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27#define BT_UUID_DDFS_VAL \
28 BT_UUID_128_ENCODE(0x21490000, 0x494a, 0x4573, 0x98af, 0xf126af76f490)
29
31#define BT_UUID_DDFS_DISTANCE_MEAS_VAL \
32 BT_UUID_128_ENCODE(0x21490001, 0x494a, 0x4573, 0x98af, 0xf126af76f490)
33
35#define BT_UUID_DDFS_AZIMUTH_MEAS_VAL \
36 BT_UUID_128_ENCODE(0x21490002, 0x494a, 0x4573, 0x98af, 0xf126af76f490)
37
39#define BT_UUID_DDFS_ELEVATION_MEAS_VAL \
40 BT_UUID_128_ENCODE(0x21490003, 0x494a, 0x4573, 0x98af, 0xf126af76f490)
41
43#define BT_UUID_DDFS_FEATURE_VAL \
44 BT_UUID_128_ENCODE(0x21490004, 0x494a, 0x4573, 0x98af, 0xf126af76f490)
45
47#define BT_UUID_DDFS_CTRL_POINT_VAL \
48 BT_UUID_128_ENCODE(0x21490005, 0x494a, 0x4573, 0x98af, 0xf126af76f490)
49
50#define BT_UUID_DDFS BT_UUID_DECLARE_128(BT_UUID_DDFS_VAL)
51#define BT_UUID_DDFS_DISTANCE_MEAS BT_UUID_DECLARE_128(BT_UUID_DDFS_DISTANCE_MEAS_VAL)
52#define BT_UUID_DFFS_AZIMUTH_MEAS BT_UUID_DECLARE_128(BT_UUID_DDFS_AZIMUTH_MEAS_VAL)
53#define BT_UUID_DFFS_ELEVATION_MEAS BT_UUID_DECLARE_128(BT_UUID_DDFS_ELEVATION_MEAS_VAL)
54#define BT_UUID_DDFS_FEATURE BT_UUID_DECLARE_128(BT_UUID_DDFS_FEATURE_VAL)
55#define BT_UUID_DFFS_CTRL_POINT BT_UUID_DECLARE_128(BT_UUID_DDFS_CTRL_POINT_VAL)
56
65
82 uint8_t ranging_mode_rtt : 1;
83
85 uint8_t ranging_mode_mcpd : 1;
86};
87
96
98struct bt_ddfs_cb {
106 int (*dm_ranging_mode_set)(uint8_t mode);
107
115 int (*dm_config_read)(struct bt_ddfs_dm_config *config);
116
123 void (*am_notification_config_changed)(bool enabled);
124
131 void (*dm_notification_config_changed)(bool enabled);
132
139 void (*em_notification_config_changed)(bool enabled);
140};
141
146
148 bt_addr_le_t bt_addr;
149
152 union {
153 struct _mcpd {
155 uint16_t ifft;
156
158 uint16_t phase_slope;
159
162
164 uint16_t best;
165
166#ifdef CONFIG_DM_HIGH_PRECISION_CALC
167 /* MCPD: Distance estimate based on advanced algorithms */
168 uint16_t high_precision;
169#endif
171 struct _rtt {
173 uint16_t rtt;
176};
177
182
184 bt_addr_le_t bt_addr;
185
187 uint16_t value;
188};
189
194
196 bt_addr_le_t bt_addr;
197
199 int8_t value;
200};
201
206
208 const struct bt_ddfs_cb *cb;
209};
210
222int bt_ddfs_distance_measurement_notify(struct bt_conn *conn,
223 const struct bt_ddfs_distance_measurement *measurement);
224
236int bt_ddfs_azimuth_measurement_notify(struct bt_conn *conn,
237 const struct bt_ddfs_azimuth_measurement *measurement);
238
251 const struct bt_ddfs_elevation_measurement *measurement);
252
260int bt_ddfs_init(const struct bt_ddfs_init_params *init);
261
262#ifdef __cplusplus
263}
264#endif
265
270#endif /* BT_DDFS_H_ */
int bt_ddfs_distance_measurement_notify(struct bt_conn *conn, const struct bt_ddfs_distance_measurement *measurement)
Function for sending Distance Measurement value.
int bt_ddfs_azimuth_measurement_notify(struct bt_conn *conn, const struct bt_ddfs_azimuth_measurement *measurement)
Function for sending Azimuth Measurement value.
int bt_ddfs_init(const struct bt_ddfs_init_params *init)
Function for initializing the Direction and Distance Finding Service.
bt_ddfs_dm_ranging_mode
Definition ddfs.h:58
@ BT_DDFS_DM_RANGING_MODE_RTT
Definition ddfs.h:60
@ BT_DDFS_DM_RANGING_MODE_MCPD
Definition ddfs.h:63
bt_ddfs_quality
Definition ddfs.h:67
@ BT_DDFS_QUALITY_OK
Definition ddfs.h:69
@ BT_DDFS_QUALITY_POOR
Definition ddfs.h:72
@ BT_DDFS_QUALITY_NONE
Definition ddfs.h:78
@ BT_DDFS_QUALITY_DO_NOT_USE
Definition ddfs.h:75
int bt_ddfs_elevation_measurement_notify(struct bt_conn *conn, const struct bt_ddfs_elevation_measurement *measurement)
Function for sending Elevation Measurement value.
bt_addr_le_t bt_addr
Definition ddfs.h:184
enum bt_ddfs_quality quality
Definition ddfs.h:181
uint16_t value
Definition ddfs.h:187
Structure of azimuth measurement results.
Definition ddfs.h:179
int(* dm_config_read)(struct bt_ddfs_dm_config *config)
Indicates that the configuration for Distance Measurement is read.
Definition ddfs.h:115
void(* am_notification_config_changed)(bool enabled)
Azimuth Measurement state callback.
Definition ddfs.h:123
void(* dm_notification_config_changed)(bool enabled)
Distance Measurement state callback.
Definition ddfs.h:131
int(* dm_ranging_mode_set)(uint8_t mode)
Indicates that the ranging mode for Distance Measurement is set.
Definition ddfs.h:106
void(* em_notification_config_changed)(bool enabled)
Elevation Measurement state callback.
Definition ddfs.h:139
Pointers to the callback functions for service events.
Definition ddfs.h:98
struct bt_ddfs_distance_measurement::@173::_mcpd mcpd
uint16_t phase_slope
Definition ddfs.h:158
uint16_t rtt
Definition ddfs.h:173
uint16_t ifft
Definition ddfs.h:155
union bt_ddfs_distance_measurement::@173 dist_estimates
bt_addr_le_t bt_addr
Definition ddfs.h:148
uint16_t rssi_openspace
Definition ddfs.h:161
enum bt_ddfs_quality quality
Definition ddfs.h:145
enum bt_ddfs_dm_ranging_mode ranging_mode
Definition ddfs.h:151
uint16_t best
Definition ddfs.h:164
Structure of distance measurement results.
Definition ddfs.h:143
enum bt_ddfs_dm_ranging_mode mode
Definition ddfs.h:91
bool high_precision
Definition ddfs.h:94
Distance Measurement configuration parameters.
Definition ddfs.h:89
enum bt_ddfs_quality quality
Definition ddfs.h:193
int8_t value
Definition ddfs.h:199
bt_addr_le_t bt_addr
Definition ddfs.h:196
Structure of elevation measurement results.
Definition ddfs.h:191
uint8_t ranging_mode_rtt
Definition ddfs.h:82
uint8_t ranging_mode_mcpd
Definition ddfs.h:85
Definition ddfs.h:80
struct bt_ddfs_features dm_features
Definition ddfs.h:205
const struct bt_ddfs_cb * cb
Definition ddfs.h:208
Direction and Distance Finding Service initialization parameters.
Definition ddfs.h:203