Wirepas SDK
poslib.h
Go to the documentation of this file.
1 
6 #ifndef _POSLIB_H_
7 #define _POSLIB_H_
8 
9 
10 #if (APP_LIB_STATE_VERSION > 0x205)
11 //#define DA_SUPPORT
12 #endif
13 
14 
18 #define POS_DESTINATION_ENDPOINT 238
19 #define POS_SOURCE_ENDPOINT 238
20 
24 #define POSLIB_MIN_MEAS_RATE_S 8 /* FixMe: adjust based on testing*/
25 #define POSLIB_MAX_MEAS_RATE_S 86400
26 
30 #define POSLIB_VOLTAGE_SAMPLING_MAX_S 60
31 #define POSLIB_VOLTAGE_FILTER_SAMPLES 30
32 
33 
37 typedef enum
38 {
57 } poslib_ret_e;
58 
62 typedef enum
63 {
70 
74 typedef enum
75 {
79 
83 typedef enum
84 {
85  POSLIB_BLE_OFF = 0, // OFF
86  POSLIB_BLE_ON = 1, // always ON
87  POSLIB_BLE_ON_WHEN_OFFLINE = 2 //activated when outside coverage
89 
93 typedef enum
94 {
104 
108 typedef enum
109 {
114 
115 #define POSLIB_FLAG_EVENT_SUBSCRIBERS_MAX 8
116 
121 typedef enum
122 {
144  POSLIB_FLAG_EVENT_ALL = 511 /* ! Update when adding a new event */
146 
150 typedef enum
151 {
156 
160 typedef struct
161 {
162  int8_t tx_power;
164  uint16_t tx_interval_ms;
166 
170 typedef struct
171 {
176  uint16_t activation_delay_s; //BLE beacons activation delay when outside coverage
178 
182 typedef struct
183 {
184  bool enabled;
185  uint16_t threshold_mg;
186  uint16_t duration_ms;
188 
192 typedef struct
193 {
194  /* mode defined using PosLib_setConfig */
196  /* class defined using PosLib_setConfig */
198  /* defined using PosLib_setConfig. Used for normal PosLib update period */
200  /* defined using PosLib_setConfig. Used when api call PosLib_motion */
202  /* defined using PosLib_setConfig. Used when autoscan mode and stack is offline */
204  /* defined using PosLib_setConfig. Configuration of ble */
206  /* Motion settings*/
209 
213 typedef struct
214 {
215  /* duration for LED to be turned on */
217  /* LED control command sequence */
218  uint8_t led_cmd_seq;
220 
222 typedef struct
223 {
224  uint8_t event_id;
228 
235 
242 
249 
256 
269 
275 
286 
298 
304 
314  uint8_t * id);
315 
320 void PosLib_eventDeregister(uint8_t id);
321 #endif
poslib_ble_mode_config_t::tx_interval_ms
uint16_t tx_interval_ms
Definition: poslib.h:164
POSLIB_FLAG_EVENT_OFLINE
@ POSLIB_FLAG_EVENT_OFLINE
Definition: poslib.h:134
POSLIB_FLAG_EVENT_UPDATE_END
@ POSLIB_FLAG_EVENT_UPDATE_END
Definition: poslib.h:128
poslib_motion_mon_settings_t
position library motion settings.
Definition: poslib.h:182
poslib_settings_t::update_period_static_s
uint32_t update_period_static_s
Definition: poslib.h:199
POSLIB_EDDYSTONE
@ POSLIB_EDDYSTONE
Definition: poslib.h:110
ble_beacon_settings_t::mode
poslib_ble_mode_e mode
Definition: poslib.h:173
POSLIB_FLAG_EVENT_info_t
Definition: poslib.h:222
POSLIB_CLASS_F
@ POSLIB_CLASS_F
Definition: poslib.h:102
poslib_ble_mode_config_t::channels
app_lib_beacon_tx_channels_mask_e channels
Definition: poslib.h:163
poslib_ble_mode_config_t::tx_power
int8_t tx_power
Definition: poslib.h:162
PosLib_motion
poslib_ret_e PosLib_motion(poslib_motion_mode_e mode)
Is used to indicate that the tag is static or dynamic. The update rate used will be adjusted accordin...
POSLIB_FLAG_EVENT_CONFIG_CHANGE
@ POSLIB_FLAG_EVENT_CONFIG_CHANGE
Definition: poslib.h:138
POSLIB_MOTION_STATIC
@ POSLIB_MOTION_STATIC
Definition: poslib.h:76
ble_beacon_settings_t::eddystone
poslib_ble_mode_config_t eddystone
Definition: poslib.h:174
POSLIB_IBEACON
@ POSLIB_IBEACON
Definition: poslib.h:111
PosLib_eventDeregister
void PosLib_eventDeregister(uint8_t id)
Clears a callback for the requested event.
poslib_settings_t::node_mode
poslib_mode_e node_mode
Definition: poslib.h:195
POSLIB_FLAG_EVENT_ONLINE
@ POSLIB_FLAG_EVENT_ONLINE
Definition: poslib.h:136
POS_RET_OK
@ POS_RET_OK
Definition: poslib.h:40
POSLIB_FLAG_EVENT_info_t::nrls_sleep_time_sec
uint32_t nrls_sleep_time_sec
Definition: poslib.h:226
POSLIB_BLE_OFF
@ POSLIB_BLE_OFF
Definition: poslib.h:85
poslib_settings_t::node_class
poslib_class_e node_class
Definition: poslib.h:197
poslib_motion_mode_e
poslib_motion_mode_e
defines the position motion mode.
Definition: poslib.h:74
POSLIB_CLASS_B
@ POSLIB_CLASS_B
Definition: poslib.h:98
POSLIB_FLAG_EVENT_LED_OFF
@ POSLIB_FLAG_EVENT_LED_OFF
Definition: poslib.h:142
poslib_ret_e
poslib_ret_e
Return codes of positioning functions.
Definition: poslib.h:37
PosLib_startOneshot
poslib_ret_e PosLib_startOneshot(void)
Triggers one position update. If PosLib is started the scheduled operation will continue after the on...
POSLIB_CLASS_A
@ POSLIB_CLASS_A
Definition: poslib.h:97
PosLib_setConfig
poslib_ret_e PosLib_setConfig(poslib_settings_t *settings)
Sets PosLib configuration.
POSLIB_CLASS_DEFAULT
@ POSLIB_CLASS_DEFAULT
Definition: poslib.h:96
app_lib_beacon_tx_channels_mask_e
app_lib_beacon_tx_channels_mask_e
Definition: beacon_tx.h:92
poslib_mode_e
poslib_mode_e
defines the device's positioning mode.
Definition: poslib.h:62
POS_RET_INVALID_STATE
@ POS_RET_INVALID_STATE
Definition: poslib.h:42
poslib_ble_mode_e
poslib_ble_mode_e
defines the state (started/stopped) of the BLE beacon sent by PosLib
Definition: poslib.h:83
PosLib_stopPeriodic
poslib_ret_e PosLib_stopPeriodic(void)
Stops the positioning updates.
POSLIB_BLE_ON
@ POSLIB_BLE_ON
Definition: poslib.h:86
POSLIB_MODE_NRLS_TAG
@ POSLIB_MODE_NRLS_TAG
Definition: poslib.h:64
poslib_ble_mode_config_t
defines BLE mode mode configration.
Definition: poslib.h:160
POSLIB_MODE_AUTOSCAN_ANCHOR
@ POSLIB_MODE_AUTOSCAN_ANCHOR
Definition: poslib.h:66
PosLib_getConfig
poslib_ret_e PosLib_getConfig(poslib_settings_t *settings)
Gets PosLib configuration.
POS_RET_EVENT_REG_ERROR
@ POS_RET_EVENT_REG_ERROR
Definition: poslib.h:54
POSLIB_BLE_ON_WHEN_OFFLINE
@ POSLIB_BLE_ON_WHEN_OFFLINE
Definition: poslib.h:87
POSLIB_MOTION_DYNAMIC
@ POSLIB_MOTION_DYNAMIC
Definition: poslib.h:77
poslib_events_e
poslib_events_e
Defines the events triggered by PosLib.
Definition: poslib.h:121
POSLIB_MODE_OPPORTUNISTIC_ANCHOR
@ POSLIB_MODE_OPPORTUNISTIC_ANCHOR
Definition: poslib.h:67
POSLIB_CLASS_C
@ POSLIB_CLASS_C
Definition: poslib.h:99
POSLIB_FLAG_EVENT_info_t::event_id
uint8_t event_id
Definition: poslib.h:224
POSLIB_IDLE
@ POSLIB_IDLE
Definition: poslib.h:153
poslib_settings_t::ble
ble_beacon_settings_t ble
Definition: poslib.h:205
PosLib_status
poslib_status_e PosLib_status(void)
Returns the current status of PosLib.
POS_RET_MOTION_NOT_ENABLED
@ POS_RET_MOTION_NOT_ENABLED
Definition: poslib.h:56
POSLIB_UPDATE_START
@ POSLIB_UPDATE_START
Definition: poslib.h:154
poslib_settings_t::update_period_dynamic_s
uint32_t update_period_dynamic_s
Definition: poslib.h:201
POSLIB_FLAG_EVENT_NONE
@ POSLIB_FLAG_EVENT_NONE
Definition: poslib.h:124
ble_beacon_settings_t::type
poslib_ble_type_e type
Definition: poslib.h:172
poslib_events_listen_info_f
void(* poslib_events_listen_info_f)(POSLIB_FLAG_EVENT_info_t *msg)
Function used with POSLIB_FLAG_EVENT_setCb.
Definition: poslib.h:234
ble_beacon_settings_t::activation_delay_s
uint16_t activation_delay_s
Definition: poslib.h:176
POSLIB_FLAG_EVENT_ALL
@ POSLIB_FLAG_EVENT_ALL
Definition: poslib.h:144
poslib_class_e
poslib_class_e
defines the device's operational class.
Definition: poslib.h:93
poslib_settings_t::motion
poslib_motion_mon_settings_t motion
Definition: poslib.h:207
POS_RET_INVALID_DATA
@ POS_RET_INVALID_DATA
Definition: poslib.h:46
POSLIB_CLASS_NODE_SPECIFIC
@ POSLIB_CLASS_NODE_SPECIFIC
Definition: poslib.h:95
POSLIB_STOPPED
@ POSLIB_STOPPED
Definition: poslib.h:152
POS_RET_NOT_CONFIGURED
@ POS_RET_NOT_CONFIGURED
Definition: poslib.h:52
PosLib_eventRegister
poslib_ret_e PosLib_eventRegister(poslib_events_e event, poslib_events_listen_info_f cb, uint8_t *id)
Register an event subscriber.
POSLIB_MODE_ENDS
@ POSLIB_MODE_ENDS
Definition: poslib.h:68
POSLIB_FLAG_EVENT_info_t::time_hp
app_lib_time_timestamp_hp_t time_hp
Definition: poslib.h:225
poslib_ble_type_e
poslib_ble_type_e
Beacon devices types.
Definition: poslib.h:108
poslib_settings_t
position library settings.
Definition: poslib.h:192
POSLIB_CLASS_E
@ POSLIB_CLASS_E
Definition: poslib.h:101
POSLIB_MODE_AUTOSCAN_TAG
@ POSLIB_MODE_AUTOSCAN_TAG
Definition: poslib.h:65
poslib_events_callback_f
void(* poslib_events_callback_f)(poslib_events_listen_info_f callback)
This callback is used to receive Poslib generated events.
Definition: poslib.h:241
POSLIB_CLASS_D
@ POSLIB_CLASS_D
Definition: poslib.h:100
POSLIB_BEACON_ALL
@ POSLIB_BEACON_ALL
Definition: poslib.h:112
POS_RET_INVALID_PARAM
@ POS_RET_INVALID_PARAM
Definition: poslib.h:44
PosLib_startPeriodic
poslib_ret_e PosLib_startPeriodic(void)
Start the positioning updates according to provided configuration. Calls PosLib initialization functi...
ble_beacon_settings_t::ibeacon
poslib_ble_mode_config_t ibeacon
Definition: poslib.h:175
poslib_settings_t::update_period_offline_s
uint32_t update_period_offline_s
Definition: poslib.h:203
app_lib_time_timestamp_hp_t
uint32_t app_lib_time_timestamp_hp_t
Highest-precision timestamp type available on the platform.
Definition: time.h:41
POSLIB_FLAG_EVENT_UPDATE_START
@ POSLIB_FLAG_EVENT_UPDATE_START
Definition: poslib.h:126
POSLIB_FLAG_EVENT_BLE_STOP
@ POSLIB_FLAG_EVENT_BLE_STOP
Definition: poslib.h:132
POS_RET_LIB_ERROR
@ POS_RET_LIB_ERROR
Definition: poslib.h:48
POSLIB_FLAG_EVENT_BLE_START
@ POSLIB_FLAG_EVENT_BLE_START
Definition: poslib.h:130
poslib_motion_mon_settings_t::enabled
bool enabled
Definition: poslib.h:184
poslib_aux_settings_t::led_on_duration_s
uint16_t led_on_duration_s
Definition: poslib.h:216
POS_RET_INTERNAL_ERROR
@ POS_RET_INTERNAL_ERROR
Definition: poslib.h:50
poslib_aux_settings_t::led_cmd_seq
uint8_t led_cmd_seq
Definition: poslib.h:218
poslib_aux_settings_t
positioning library auxiliary settings
Definition: poslib.h:213
poslib_status_e
poslib_status_e
defines status returned in PosLib_status().
Definition: poslib.h:150
ble_beacon_settings_t
position library ble settings.
Definition: poslib.h:170
poslib_motion_mon_settings_t::threshold_mg
uint16_t threshold_mg
Definition: poslib.h:185
poslib_motion_mon_settings_t::duration_ms
uint16_t duration_ms
Definition: poslib.h:186
POSLIB_FLAG_EVENT_LED_ON
@ POSLIB_FLAG_EVENT_LED_ON
Definition: poslib.h:140