Wirepas SDK
poslib_measurement.h
Go to the documentation of this file.
1 
7 #ifndef _POSLIB_MEASUREMENT_H_
8 #define _POSLIB_MEASUREMENT_H_
9 
15 typedef enum
16 {
33 
35 #define MAX_PAYLOAD 102
36 
38 #define MAX_BEACONS 14
39 
40 #define NODE_ADDRESS_LENGTH 4
41 #define DEFAULT_MEASUREMENT_TYPE_TAG POSLIB_MEAS_RSS_SR_4BYTE_ADDR
42 #define DEFAULT_MEASUREMENT_TYPE_ANCHOR POSLIB_MEAS_RSS_SR_ANCHOR_4BYTE_ADDR
43 
44 
46 #define PACKED_STRUCT struct __attribute__((__packed__))
47 
49 {
50  uint16_t sequence;
52 
57 {
58  uint32_t address;
59  uint8_t norm_rss;
61 
66 {
67  uint8_t type;
68  uint8_t length;
70 
72 {
74  uint32_t node_addr;
76 
81 {
83  uint16_t voltage;
85 
87 #define POSLIB_NODE_INFO_FEATURES_VERSION 1
88 
91 typedef enum
92 {
106 
111 {
113  uint32_t update_s;
115  uint32_t features;
117  uint8_t node_mode;
119  uint8_t node_class;
121 
122 typedef enum
123 {
126 
127 typedef struct poslib_measurement
128 {
130  uint32_t max_duration_ms; //maximum scan duration [ms], (if 0 then scan default time is used)
131 } poslib_scan_ctrl_t;
132 
133 
139 bool PosLibMeas_startScan(poslib_scan_ctrl_t * scan_ctrl);
140 
141 bool PosLibMeas_opportunisticScan(bool enable);
142 
147 uint8_t PosLibMeas_getBeaconNum(void);
148 
152 void PosLibMeas_stop(void);
153 
154 bool PosLibMeas_getPayload(uint8_t * bytes, uint8_t max_len, uint8_t sequence,
155  poslib_measurements_e meas_type, bool add_voltage,
156  poslib_meas_record_node_info_t * node_info,
157  uint8_t * bytes_len, uint8_t * num_meas);
158 
164 void PosLibMeas_clearMeas(void);
165 #endif
poslib_meas_record_node_info_t::features
uint32_t features
Definition: poslib_measurement.h:115
POSLIB_NODE_INFO_FLAG_EDDYSTONE_ON
@ POSLIB_NODE_INFO_FLAG_EDDYSTONE_ON
Definition: poslib_measurement.h:100
poslib_measurement
Definition: poslib_measurement.h:127
poslib_meas_record_node_info_t::node_class
uint8_t node_class
Definition: poslib_measurement.h:119
PACKED_STRUCT
#define PACKED_STRUCT
Definition: poslib_measurement.h:46
poslib_meas_record_voltage_t::voltage
uint16_t voltage
Definition: poslib_measurement.h:83
poslib_meas_record_header_t
Measurement record header.
Definition: poslib_measurement.h:65
poslib_meas_message_header_t
Definition: poslib_measurement.h:48
POSLIB_MEAS_VOLTAGE
@ POSLIB_MEAS_VOLTAGE
Definition: poslib_measurement.h:22
POSLIB_MEAS_TIME
@ POSLIB_MEAS_TIME
Definition: poslib_measurement.h:20
poslib_node_info_features_e
poslib_node_info_features_e
Node active features (.
Definition: poslib_measurement.h:91
POSLIB_MEAS_RSS_SR_ANCHOR
@ POSLIB_MEAS_RSS_SR_ANCHOR
Definition: poslib_measurement.h:30
POSLIB_NODE_INFO_FLAG_IBEACON_ON
@ POSLIB_NODE_INFO_FLAG_IBEACON_ON
Definition: poslib_measurement.h:102
poslib_measurement::mode
poslib_scan_mode_e mode
Definition: poslib_measurement.h:129
poslib_meas_record_node_info_t::node_mode
uint8_t node_mode
Definition: poslib_measurement.h:117
poslib_meas_record_da_t::node_addr
uint32_t node_addr
Definition: poslib_measurement.h:74
POSLIB_NODE_INFO_FLAG_MOTION_EN
@ POSLIB_NODE_INFO_FLAG_MOTION_EN
Definition: poslib_measurement.h:96
POSLIB_MEAS_RSS_HR
@ POSLIB_MEAS_RSS_HR
Definition: poslib_measurement.h:19
PosLibMeas_getBeaconNum
uint8_t PosLibMeas_getBeaconNum(void)
Get the number of beacons available.
POSLIB_MEAS_SPACE
@ POSLIB_MEAS_SPACE
Definition: poslib_measurement.h:21
poslib_meas_record_voltage_t
Voltage record (header + payload)
Definition: poslib_measurement.h:80
POSLIB_NODE_INFO_FLAG_MBCN_ON
@ POSLIB_NODE_INFO_FLAG_MBCN_ON
Definition: poslib_measurement.h:104
poslib_scan_mode_e
poslib_scan_mode_e
Definition: poslib_measurement.h:122
PosLibMeas_clearMeas
void PosLibMeas_clearMeas(void)
Clears measurement table.
PosLibMeas_startScan
bool PosLibMeas_startScan(poslib_scan_ctrl_t *scan_ctrl)
Starts new scan.
POSLIB_NODE_INFO_FLAG_IS_STATIC
@ POSLIB_NODE_INFO_FLAG_IS_STATIC
Definition: poslib_measurement.h:98
poslib_meas_record_header_t::length
uint8_t length
Definition: poslib_measurement.h:68
poslib_meas_rss_data_t::norm_rss
uint8_t norm_rss
Definition: poslib_measurement.h:59
poslib_meas_rss_data_t
RSS measurement structure.
Definition: poslib_measurement.h:56
poslib_meas_record_da_t
Definition: poslib_measurement.h:71
poslib_measurements_e
poslib_measurements_e
defines the device's positioning mode. The type is matched against the WPE proto definition.
Definition: poslib_measurement.h:15
POSLIB_MEAS_RSS_SR_4BYTE_ADDR
@ POSLIB_MEAS_RSS_SR_4BYTE_ADDR
Definition: poslib_measurement.h:23
POSLIB_MEAS_RSS_SR_ANCHOR_4BYTE_ADDR
@ POSLIB_MEAS_RSS_SR_ANCHOR_4BYTE_ADDR
Definition: poslib_measurement.h:31
PosLibMeas_opportunisticScan
bool PosLibMeas_opportunisticScan(bool enable)
POSLIB_MEAS_NODE_INFO
@ POSLIB_MEAS_NODE_INFO
Definition: poslib_measurement.h:24
poslib_meas_rss_data_t::address
uint32_t address
Definition: poslib_measurement.h:58
poslib_meas_record_node_info_t
Node info record.
Definition: poslib_measurement.h:110
SCAN_MODE_STANDARD
@ SCAN_MODE_STANDARD
Definition: poslib_measurement.h:124
poslib_measurement::max_duration_ms
uint32_t max_duration_ms
Definition: poslib_measurement.h:130
POSLIB_MEAS_RSS_SR
@ POSLIB_MEAS_RSS_SR
Definition: poslib_measurement.h:18
POSLIB_MEAS_DA
@ POSLIB_MEAS_DA
Definition: poslib_measurement.h:25
POSLIB_NODE_INFO_MASK_VERSION
@ POSLIB_NODE_INFO_MASK_VERSION
Definition: poslib_measurement.h:94
PosLibMeas_stop
void PosLibMeas_stop(void)
Stops the measurement module. Callbacks are removed.
PosLibMeas_getPayload
bool PosLibMeas_getPayload(uint8_t *bytes, uint8_t max_len, uint8_t sequence, poslib_measurements_e meas_type, bool add_voltage, poslib_meas_record_node_info_t *node_info, uint8_t *bytes_len, uint8_t *num_meas)
poslib_meas_record_da_t::header
poslib_meas_record_header_t header
Definition: poslib_measurement.h:73
poslib_meas_record_header_t::type
uint8_t type
Definition: poslib_measurement.h:67
poslib_meas_record_node_info_t::update_s
uint32_t update_s
Definition: poslib_measurement.h:113
poslib_meas_message_header_t::sequence
uint16_t sequence
Definition: poslib_measurement.h:50