Wirepas SDK
poslib_measurement.h File Reference

Header file for the poslib measurement.c. More...

Detailed Description

Header file for the poslib measurement.c.

Definition in file poslib_measurement.h.

Go to the source code of this file.

Functions

bool PosLibMeas_startScan (poslib_scan_ctrl_t *scan_ctrl)
 Starts new scan.
 
bool PosLibMeas_opportunisticScan (bool enable)
 
uint8_t PosLibMeas_getBeaconNum (void)
 Get the number of beacons available.
 
void PosLibMeas_stop (void)
 Stops the measurement module. Callbacks are removed.
 
bool PosLibMeas_getPayload (uint8_t *bytes, uint8_t max_len, uint16_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)
 
void PosLibMeas_clearMeas (void)
 Clears measurement table.
 

Data Structures

struct  poslib_meas_message_header_t
 
struct  poslib_meas_rss_data_t
 RSS measurement structure. More...
 
struct  poslib_meas_record_header_t
 Measurement record header. More...
 
struct  poslib_meas_record_da_t
 
struct  poslib_meas_record_voltage_t
 Voltage record (header + payload) More...
 
struct  poslib_meas_record_node_info_t
 Node info record. More...
 
struct  poslib_scan_ctrl_t
 

Enumerations

enum  poslib_measurements_e {
  POSLIB_MEAS_RSS_SR = 0x00 , POSLIB_MEAS_RSS_HR = 0x01 , POSLIB_MEAS_TIME = 0x02 , POSLIB_MEAS_SPACE = 0x03 ,
  POSLIB_MEAS_VOLTAGE = 0x04 , POSLIB_MEAS_RSS_SR_4BYTE_ADDR = 0x05 , POSLIB_MEAS_NODE_INFO = 0x06 , POSLIB_MEAS_DA = 0x07 ,
  POSLIB_MEAS_RSS_SR_ANCHOR = 0xF0 , POSLIB_MEAS_RSS_SR_ANCHOR_4BYTE_ADDR = 0xF5
}
 defines the device's positioning mode. The type is matched against the WPE proto definition. More...
 
enum  poslib_node_info_features_e {
  POSLIB_NODE_INFO_MASK_VERSION = 0x0000000F , POSLIB_NODE_INFO_FLAG_MOTION_EN = 0x00000010 , POSLIB_NODE_INFO_FLAG_IS_STATIC = 0x000000020 , POSLIB_NODE_INFO_FLAG_EDDYSTONE_ON = 0x00000040 ,
  POSLIB_NODE_INFO_FLAG_IBEACON_ON = 0x00000080 , POSLIB_NODE_INFO_FLAG_MBCN_ON = 0x00000100
}
 Node active features (. More...
 
enum  poslib_scan_mode_e { SCAN_MODE_STANDARD = 1 }
 

Macros

#define MAX_PAYLOAD   102
 
#define MAX_BEACONS   14
 
#define NODE_ADDRESS_LENGTH   4
 
#define DEFAULT_MEASUREMENT_TYPE_TAG   POSLIB_MEAS_RSS_SR_4BYTE_ADDR
 
#define DEFAULT_MEASUREMENT_TYPE_ANCHOR   POSLIB_MEAS_RSS_SR_ANCHOR_4BYTE_ADDR
 
#define PACKED_STRUCT   struct __attribute__((__packed__))
 
#define POSLIB_NODE_INFO_FEATURES_VERSION   1
 

Function Documentation

◆ PosLibMeas_clearMeas()

void PosLibMeas_clearMeas ( void  )

Clears measurement table.

Parameters
void
Returns
void

◆ PosLibMeas_getBeaconNum()

uint8_t PosLibMeas_getBeaconNum ( void  )

Get the number of beacons available.

Note
This shall be called after scan end.
Returns
Returns the number of beacons stored in the measurement table.

◆ PosLibMeas_getPayload()

bool PosLibMeas_getPayload ( uint8_t *  bytes,
uint8_t  max_len,
uint16_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 
)

◆ PosLibMeas_opportunisticScan()

bool PosLibMeas_opportunisticScan ( bool  enable)

◆ PosLibMeas_startScan()

bool PosLibMeas_startScan ( poslib_scan_ctrl_t *  scan_ctrl)

Starts new scan.

Parameters
Positioning_startScanThe poslib settings defined

◆ PosLibMeas_stop()

void PosLibMeas_stop ( void  )

Stops the measurement module. Callbacks are removed.


Data Structure Documentation

◆ poslib_meas_message_header_t

struct poslib_meas_message_header_t

Definition at line 48 of file poslib_measurement.h.

Data Fields
uint16_t sequence

◆ poslib_meas_rss_data_t

struct poslib_meas_rss_data_t

RSS measurement structure.

Definition at line 56 of file poslib_measurement.h.

Data Fields
uint32_t address
uint8_t norm_rss

◆ poslib_meas_record_header_t

struct poslib_meas_record_header_t

Measurement record header.

Definition at line 65 of file poslib_measurement.h.

Data Fields
uint8_t length
uint8_t type

◆ poslib_meas_record_da_t

struct poslib_meas_record_da_t

Definition at line 71 of file poslib_measurement.h.

Data Fields
poslib_meas_record_header_t header
uint32_t node_addr

◆ poslib_meas_record_voltage_t

struct poslib_meas_record_voltage_t

Voltage record (header + payload)

Definition at line 80 of file poslib_measurement.h.

Data Fields
poslib_meas_record_header_t header
uint16_t voltage

◆ poslib_meas_record_node_info_t

struct poslib_meas_record_node_info_t

Node info record.

Definition at line 110 of file poslib_measurement.h.

Data Fields
uint32_t features

node positioning mode

uint8_t node_class
uint8_t node_mode

node positioning class

uint32_t update_s

< next expected update node active features

◆ poslib_scan_ctrl_t

struct poslib_scan_ctrl_t

Definition at line 127 of file poslib_measurement.h.

Data Fields
uint32_t max_duration_ms
poslib_scan_mode_e mode

Enumeration Type Documentation

◆ poslib_measurements_e

defines the device's positioning mode. The type is matched against the WPE proto definition.

Enumerator
POSLIB_MEAS_RSS_SR 

0x00 - 0x6F : range reserved for Wirepas

POSLIB_MEAS_RSS_HR 
POSLIB_MEAS_TIME 
POSLIB_MEAS_SPACE 
POSLIB_MEAS_VOLTAGE 
POSLIB_MEAS_RSS_SR_4BYTE_ADDR 
POSLIB_MEAS_NODE_INFO 
POSLIB_MEAS_DA 
POSLIB_MEAS_RSS_SR_ANCHOR 

0x70 - 0xEF : range reserved for customer Please notify Wirepas if a custom record ID is used by your customised positoning app 0xF0 - 0xFF : range reserved for Wirepas

POSLIB_MEAS_RSS_SR_ANCHOR_4BYTE_ADDR 

Definition at line 15 of file poslib_measurement.h.

16{
18 POSLIB_MEAS_RSS_SR = 0x00,
19 POSLIB_MEAS_RSS_HR = 0x01,
20 POSLIB_MEAS_TIME = 0x02,
21 POSLIB_MEAS_SPACE = 0x03,
25 POSLIB_MEAS_DA = 0x07,
poslib_measurements_e
defines the device's positioning mode. The type is matched against the WPE proto definition.
@ POSLIB_MEAS_DA
@ POSLIB_MEAS_VOLTAGE
@ POSLIB_MEAS_RSS_SR_4BYTE_ADDR
@ POSLIB_MEAS_RSS_SR
@ POSLIB_MEAS_SPACE
@ POSLIB_MEAS_NODE_INFO
@ POSLIB_MEAS_RSS_SR_ANCHOR_4BYTE_ADDR
@ POSLIB_MEAS_RSS_HR
@ POSLIB_MEAS_TIME
@ POSLIB_MEAS_RSS_SR_ANCHOR

◆ poslib_node_info_features_e

Node active features (.

Note
this is a bit )
Enumerator
POSLIB_NODE_INFO_MASK_VERSION 

Features flags version mask Motion enabled - valid from ver 0

POSLIB_NODE_INFO_FLAG_MOTION_EN 

node was static since last measurement - valid from ver 0

POSLIB_NODE_INFO_FLAG_IS_STATIC 

Eddystone BLE beacon active - valid from ver 0

POSLIB_NODE_INFO_FLAG_EDDYSTONE_ON 

iBeacon BLE beacon active - valid from ver 0

POSLIB_NODE_INFO_FLAG_IBEACON_ON 

Mini-beacon active - valid from ver 1

POSLIB_NODE_INFO_FLAG_MBCN_ON 

Definition at line 91 of file poslib_measurement.h.

92{
poslib_node_info_features_e
Node active features (.
@ POSLIB_NODE_INFO_MASK_VERSION
@ POSLIB_NODE_INFO_FLAG_IS_STATIC
@ POSLIB_NODE_INFO_FLAG_IBEACON_ON
@ POSLIB_NODE_INFO_FLAG_MBCN_ON
@ POSLIB_NODE_INFO_FLAG_EDDYSTONE_ON
@ POSLIB_NODE_INFO_FLAG_MOTION_EN

◆ poslib_scan_mode_e

Enumerator
SCAN_MODE_STANDARD 

Definition at line 122 of file poslib_measurement.h.

123{
poslib_scan_mode_e
@ SCAN_MODE_STANDARD

Macro Definition Documentation

◆ DEFAULT_MEASUREMENT_TYPE_ANCHOR

#define DEFAULT_MEASUREMENT_TYPE_ANCHOR   POSLIB_MEAS_RSS_SR_ANCHOR_4BYTE_ADDR

Definition at line 42 of file poslib_measurement.h.

◆ DEFAULT_MEASUREMENT_TYPE_TAG

#define DEFAULT_MEASUREMENT_TYPE_TAG   POSLIB_MEAS_RSS_SR_4BYTE_ADDR

Definition at line 41 of file poslib_measurement.h.

◆ MAX_BEACONS

#define MAX_BEACONS   14

limited by maximum payload size

Definition at line 38 of file poslib_measurement.h.

◆ MAX_PAYLOAD

#define MAX_PAYLOAD   102

2.4 profile - limited by internal memory

Definition at line 35 of file poslib_measurement.h.

◆ NODE_ADDRESS_LENGTH

#define NODE_ADDRESS_LENGTH   4

node address length in bytes

Definition at line 40 of file poslib_measurement.h.

◆ PACKED_STRUCT

#define PACKED_STRUCT   struct __attribute__((__packed__))

Definitions of positioning measurement message. !Note all structure definitions shall be packed

Definition at line 46 of file poslib_measurement.h.

◆ POSLIB_NODE_INFO_FEATURES_VERSION

#define POSLIB_NODE_INFO_FEATURES_VERSION   1

Defines the feature flags version, to be incremented when new flags are added

Definition at line 87 of file poslib_measurement.h.