Wirepas SDK
wms_data.h
Go to the documentation of this file.
1 /* Copyright 2017 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
19 #ifndef APP_LIB_DATA_H_
20 #define APP_LIB_DATA_H_
21 
22 #include <stdlib.h>
23 #include <stdint.h>
24 #include <stdbool.h>
25 
26 #include "wms_app.h"
27 
29 #define APP_LIB_DATA_NAME 0x0003f161
30 
31 
32 #define APP_LIB_DATA_VERSION 0x20E
33 
52 typedef uint16_t app_lib_data_tracking_id_t;
53 
60 #define APP_LIB_DATA_NO_TRACKING_ID (app_lib_data_tracking_id_t)(-1)
61 
75 #define APP_LIB_DATA_MAX_APP_CONFIG_NUM_BYTES 80
76 
85 typedef enum
86 {
93 
97 typedef enum
98 {
136 
141 typedef enum
142 {
180 
188 typedef enum
189 {
202 
210 typedef enum
211 {
228 
236 typedef enum
237 {
251 
252 
263 #define APP_LIB_DATA_RX_HOPS_UNDETERMINED 0
264 
268 typedef struct
269 {
271  uint16_t packet_id;
273  uint16_t fragment_offset;
277 
285 typedef struct
286 {
288  const uint8_t * bytes;
290  size_t num_bytes;
296  uint32_t delay;
300  uint8_t src_endpoint;
302  uint8_t dest_endpoint;
304  uint8_t hops;
315  int8_t tx_power;
319  int8_t rssi;
323  uint32_t delay_hp;
329 
333 typedef struct
334 {
336  const uint8_t * bytes;
338  size_t num_bytes;
348  uint8_t flags;
350  uint8_t src_endpoint;
352  uint8_t dest_endpoint;
356  uint8_t hop_limit;
362 
370 typedef struct
371 {
378  uint32_t queue_time;
383  uint8_t src_endpoint;
385  uint8_t dest_endpoint;
387  bool success;
389 
407 
417 typedef void
419 
437 typedef void (*app_lib_data_new_app_config_cb_f)(const uint8_t * bytes,
438  uint8_t seq,
439  uint16_t interval);
440 
480 typedef app_res_e
482 
511 typedef app_res_e
513 
524 typedef app_res_e
527 
528 typedef struct
529 {
537 
538 
555 
576 typedef size_t
578 
605 typedef app_res_e
606  (*app_lib_data_get_num_free_buffers_f)(size_t * num_buffers_p);
607 
624 
649 typedef void
651 
675  (*app_lib_data_read_app_config_f)(uint8_t * bytes,
676  uint8_t * seq,
677  uint16_t * interval);
678 
688 typedef size_t
690 
691 
717  (*app_lib_data_write_app_config_data_f)(const uint8_t * bytes);
718 
745 
751 #define APP_DATA_DISABLE_LOCAL_MULTICAST 0
752 
759 {
764  uint8_t hops_left;
766 
783 typedef app_res_e
785 
791 typedef app_res_e
793 
797 typedef struct
798 {
814 
815 #endif /* APP_LIB_DATA_H_ */
app_lib_data_get_app_config_num_bytes_f
size_t(* app_lib_data_get_app_config_num_bytes_f)(void)
Get size of appconfig "app config".
Definition: wms_data.h:689
APP_LIB_DATA_SEND_RES_OUT_OF_MEMORY
@ APP_LIB_DATA_SEND_RES_OUT_OF_MEMORY
Definition: wms_data.h:152
APP_LIB_DATA_SEND_FLAG_TRACK
@ APP_LIB_DATA_SEND_FLAG_TRACK
Definition: wms_data.h:104
app_lib_data_set_fragmented_mode_f
app_res_e(* app_lib_data_set_fragmented_mode_f)(const app_lib_data_fragmented_mode_e mode)
Set the fragmentation behavior for RX packets.
Definition: wms_data.h:792
app_lib_data_sent_status_t
Struct to tracking callback function.
Definition: wms_data.h:370
app_lib_data_t::writeDiagnosticInterval
app_lib_data_write_diagnostic_interval_f writeDiagnosticInterval
Definition: wms_data.h:810
app_lib_data_data_size_t::max_data_size
size_t max_data_size
Definition: wms_data.h:531
app_lib_data_t::setDataSentCb
app_lib_data_set_data_sent_cb_f setDataSentCb
Definition: wms_data.h:800
app_lib_data_received_t::rssi
int8_t rssi
Definition: wms_data.h:319
app_lib_data_allow_reception_f
void(* app_lib_data_allow_reception_f)(bool allow)
Allow or block reception The application may temporarily tell the stack to not call the reception dat...
Definition: wms_data.h:650
app_lib_data_send_res_e
app_lib_data_send_res_e
A result code returned from lib_data->sendData().
Definition: wms_data.h:141
APP_LIB_DATA_APP_CONFIG_RES_INVALID_ROLE
@ APP_LIB_DATA_APP_CONFIG_RES_INVALID_ROLE
Definition: wms_data.h:215
app_lib_data_qos_e
app_lib_data_qos_e
Data quality of service class. Used when sending and receiving data packets.
Definition: wms_data.h:85
app_lib_data_t::readAppConfig
app_lib_data_read_app_config_f readAppConfig
Definition: wms_data.h:807
APP_LIB_DATA_APP_CONFIG_RES_INVALID_SEQ
@ APP_LIB_DATA_APP_CONFIG_RES_INVALID_SEQ
Definition: wms_data.h:220
app_lib_data_t::setNewAppConfigCb
app_lib_data_set_new_app_config_cb_f setNewAppConfigCb
Definition: wms_data.h:801
APP_LIB_DATA_SEND_FLAG_UNACK_CSMA_CA
@ APP_LIB_DATA_SEND_FLAG_UNACK_CSMA_CA
Definition: wms_data.h:124
APP_LIB_DATA_SEND_NW_CH_ONLY
@ APP_LIB_DATA_SEND_NW_CH_ONLY
Definition: wms_data.h:131
app_lib_data_new_app_config_cb_f
void(* app_lib_data_new_app_config_cb_f)(const uint8_t *bytes, uint8_t seq, uint16_t interval)
Type of the new app config callback function.
Definition: wms_data.h:437
app_lib_data_to_send_t::tracking_id
app_lib_data_tracking_id_t tracking_id
Definition: wms_data.h:344
app_res_e
app_res_e
Definition: wms_app.h:201
APP_LIB_DATA_SEND_RES_INVALID_QOS
@ APP_LIB_DATA_SEND_RES_INVALID_QOS
Definition: wms_data.h:148
app_lib_data_received_t::src_endpoint
uint8_t src_endpoint
Definition: wms_data.h:300
APP_LIB_DATA_SEND_FLAG_NONE
@ APP_LIB_DATA_SEND_FLAG_NONE
Definition: wms_data.h:100
app_lib_data_received_t::dest_address
app_addr_t dest_address
Definition: wms_data.h:308
APP_LIB_DATA_APP_CONFIG_RES_INVALID_NULL_POINTER
@ APP_LIB_DATA_APP_CONFIG_RES_INVALID_NULL_POINTER
Definition: wms_data.h:224
APP_LIB_DATA_SEND_RES_INVALID_DEST_ADDRESS
@ APP_LIB_DATA_SEND_RES_INVALID_DEST_ADDRESS
Definition: wms_data.h:157
app_lib_data_t
List of library services.
Definition: wms_data.h:797
wms_app.h
app_lib_data_app_config_res_e
app_lib_data_app_config_res_e
Result of the app config.
Definition: wms_data.h:210
app_lib_data_received_t::num_bytes
size_t num_bytes
Definition: wms_data.h:290
app_lib_data_data_size_t
Definition: wms_data.h:528
APP_LIB_DATA_RECEIVE_RES_HANDLED
@ APP_LIB_DATA_RECEIVE_RES_HANDLED
Definition: wms_data.h:192
app_lib_data_get_num_free_buffers_f
app_res_e(* app_lib_data_get_num_free_buffers_f)(size_t *num_buffers_p)
Get number of currently available buffers.
Definition: wms_data.h:606
APP_LIB_DATA_SEND_RES_RESERVED_ENDPOINT
@ APP_LIB_DATA_SEND_RES_RESERVED_ENDPOINT
Definition: wms_data.h:167
app_lib_data_received_t::src_address
app_addr_t src_address
Definition: wms_data.h:292
APP_LIB_DATA_SEND_RES_INVALID_FRAGMENT_INFO
@ APP_LIB_DATA_SEND_RES_INVALID_FRAGMENT_INFO
Definition: wms_data.h:178
app_lib_data_sent_status_t::success
bool success
Definition: wms_data.h:387
app_lib_data_send_flags_e
app_lib_data_send_flags_e
Flags to use with lib_data->sendData().
Definition: wms_data.h:97
APP_LIB_DATA_SEND_FRAGMENTED_PACKET
@ APP_LIB_DATA_SEND_FRAGMENTED_PACKET
Definition: wms_data.h:134
app_lib_data_t::allowReception
app_lib_data_allow_reception_f allowReception
Definition: wms_data.h:806
APP_LIB_DATA_SEND_RES_OUT_OF_TRACKING_IDS
@ APP_LIB_DATA_SEND_RES_OUT_OF_TRACKING_IDS
Definition: wms_data.h:162
APP_LIB_DATA_SEND_RES_INVALID_HOP_LIMIT
@ APP_LIB_DATA_SEND_RES_INVALID_HOP_LIMIT
Definition: wms_data.h:174
app_lib_data_data_sent_cb_f
void(* app_lib_data_data_sent_cb_f)(const app_lib_data_sent_status_t *status)
Sent packet tracking callback.
Definition: wms_data.h:418
app_lib_data_write_app_config_data_f
app_lib_data_app_config_res_e(* app_lib_data_write_app_config_data_f)(const uint8_t *bytes)
Write appconfig "app config DATA".
Definition: wms_data.h:717
app_lib_data_read_app_config_f
app_lib_data_app_config_res_e(* app_lib_data_read_app_config_f)(uint8_t *bytes, uint8_t *seq, uint16_t *interval)
Read appconfig "app config".
Definition: wms_data.h:675
APP_LIB_DATA_SEND_RES_INVALID_TRACKING_ID
@ APP_LIB_DATA_SEND_RES_INVALID_TRACKING_ID
Definition: wms_data.h:164
app_lib_data_receive_res_e
app_lib_data_receive_res_e
Return value of data reception callback.
Definition: wms_data.h:188
app_lib_data_t::setFragmentMode
app_lib_data_set_fragmented_mode_f setFragmentMode
Definition: wms_data.h:812
app_lib_data_received_t::dest_endpoint
uint8_t dest_endpoint
Definition: wms_data.h:302
app_lib_data_set_data_sent_cb_f
app_res_e(* app_lib_data_set_data_sent_cb_f)(app_lib_data_data_sent_cb_f cb)
Set data sent tracking callback.
Definition: wms_data.h:512
APP_LIB_DATA_SEND_RES_ACCESS_DENIED
@ APP_LIB_DATA_SEND_RES_ACCESS_DENIED
Definition: wms_data.h:172
APP_LIB_DATA_RECEIVE_RES_NO_SPACE
@ APP_LIB_DATA_RECEIVE_RES_NO_SPACE
Definition: wms_data.h:200
APP_LIB_DATA_SEND_RES_INVALID_STACK_STATE
@ APP_LIB_DATA_SEND_RES_INVALID_STACK_STATE
Definition: wms_data.h:146
app_lib_data_set_data_received_cb_f
app_res_e(* app_lib_data_set_data_received_cb_f)(app_lib_data_data_received_cb_f cb)
Set data reception callback.
Definition: wms_data.h:481
APP_LIB_DATA_APP_CONFIG_RES_INVALID_APP_CONFIG
@ APP_LIB_DATA_APP_CONFIG_RES_INVALID_APP_CONFIG
Definition: wms_data.h:218
app_lib_data_to_send_t
A struct for lib_data->sendData().
Definition: wms_data.h:333
app_lib_data_received_t::fragment_info
app_lib_data_fragment_t * fragment_info
Definition: wms_data.h:327
app_lib_data_t::getNumBuffers
app_lib_data_get_num_buffers_f getNumBuffers
Definition: wms_data.h:803
app_lib_data_get_num_buffers_f
size_t(* app_lib_data_get_num_buffers_f)(void)
Get total number of packet buffers.
Definition: wms_data.h:577
app_lib_data_t::getNumFreeBuffers
app_lib_data_get_num_free_buffers_f getNumFreeBuffers
Definition: wms_data.h:804
APP_LIB_DATA_SEND_RES_INVALID_FLAGS
@ APP_LIB_DATA_SEND_RES_INVALID_FLAGS
Definition: wms_data.h:150
app_lib_data_t::getDataMaxNumBytes
app_lib_data_get_data_max_num_bytes_f getDataMaxNumBytes
Definition: wms_data.h:802
app_lib_data_t::setLocalMulticastInfo
app_lib_data_set_local_mc_f setLocalMulticastInfo
Definition: wms_data.h:811
APP_LIB_DATA_QOS_HIGH
@ APP_LIB_DATA_QOS_HIGH
Definition: wms_data.h:91
APP_LIB_DATA_APP_CONFIG_RES_OUT_OF_MEMORY
@ APP_LIB_DATA_APP_CONFIG_RES_OUT_OF_MEMORY
Definition: wms_data.h:226
app_lib_data_received_t::hops
uint8_t hops
Definition: wms_data.h:304
app_lib_data_local_mc_info_t::hops_left
uint8_t hops_left
Amount of hops left set when multicast packet goes out of target multicast group.
Definition: wms_data.h:764
APP_LIB_DATA_SEND_SET_HOP_LIMITING
@ APP_LIB_DATA_SEND_SET_HOP_LIMITING
Definition: wms_data.h:116
app_lib_data_received_t
Struct passed to data reception callback functions.
Definition: wms_data.h:285
app_lib_data_fragment_t
Fragmentation information.
Definition: wms_data.h:268
app_addr_t
uint32_t app_addr_t
Definition: wms_app.h:228
app_lib_data_t::sendData
app_lib_data_send_data_f sendData
Definition: wms_data.h:805
app_lib_data_fragment_t::fragment_offset
uint16_t fragment_offset
Definition: wms_data.h:273
app_lib_data_fragmented_mode_e
app_lib_data_fragmented_mode_e
Fragmentation mode. Use to specify if reassembly is done by stack or by application itself.
Definition: wms_data.h:236
app_lib_data_get_data_max_num_bytes_f
app_lib_data_data_size_t(* app_lib_data_get_data_max_num_bytes_f)(void)
Return the maximum number of bytes per data packet or data segment.
Definition: wms_data.h:554
app_lib_data_to_send_t::flags
uint8_t flags
Definition: wms_data.h:348
app_lib_data_received_t::mac_src_address
app_addr_t mac_src_address
Definition: wms_data.h:311
APP_LIB_DATA_FRAGMENTED_MODE_ENABLED
@ APP_LIB_DATA_FRAGMENTED_MODE_ENABLED
Definition: wms_data.h:241
app_lib_data_received_t::qos
app_lib_data_qos_e qos
Definition: wms_data.h:298
app_lib_data_received_t::delay_hp
uint32_t delay_hp
Definition: wms_data.h:323
app_lib_data_send_data_f
app_lib_data_send_res_e(* app_lib_data_send_data_f)(const app_lib_data_to_send_t *data)
Send data.
Definition: wms_data.h:623
APP_LIB_DATA_APP_CONFIG_RES_INVALID_INTERVAL
@ APP_LIB_DATA_APP_CONFIG_RES_INVALID_INTERVAL
Definition: wms_data.h:222
app_lib_data_t::setDataReceivedCb
app_lib_data_set_data_received_cb_f setDataReceivedCb
Definition: wms_data.h:799
APP_LIB_DATA_SEND_RES_UNINITIALIZED
@ APP_LIB_DATA_SEND_RES_UNINITIALIZED
Definition: wms_data.h:176
APP_LIB_DATA_RECEIVE_RES_NOT_FOR_APP
@ APP_LIB_DATA_RECEIVE_RES_NOT_FOR_APP
Definition: wms_data.h:195
APP_LIB_DATA_SEND_RES_SUCCESS
@ APP_LIB_DATA_SEND_RES_SUCCESS
Definition: wms_data.h:144
app_lib_data_fragment_t::last_fragment
bool last_fragment
Definition: wms_data.h:275
app_lib_data_local_mc_info_t
Information on setting local multicast functionality. To be used with service lib_data->setLocalMulti...
Definition: wms_data.h:758
app_lib_data_t::writeAppConfigData
app_lib_data_write_app_config_data_f writeAppConfigData
Definition: wms_data.h:809
app_lib_data_data_size_t::max_fragment_size
size_t max_fragment_size
Definition: wms_data.h:535
APP_LIB_DATA_SEND_RES_INVALID_NUM_BYTES
@ APP_LIB_DATA_SEND_RES_INVALID_NUM_BYTES
Definition: wms_data.h:159
app_lib_data_data_received_cb_f
app_lib_data_receive_res_e(* app_lib_data_data_received_cb_f)(const app_lib_data_received_t *data)
Data reception callback.
Definition: wms_data.h:406
app_lib_data_received_t::bytes
const uint8_t * bytes
Definition: wms_data.h:288
app_lib_data_write_diagnostic_interval_f
app_lib_data_app_config_res_e(* app_lib_data_write_diagnostic_interval_f)(uint16_t interval)
Write appconfig "Diagnostic interval".
Definition: wms_data.h:744
app_lib_data_sent_status_t::queue_time
uint32_t queue_time
Definition: wms_data.h:378
app_lib_data_fragment_t::packet_id
uint16_t packet_id
Definition: wms_data.h:271
app_lib_data_t::getAppConfigNumBytes
app_lib_data_get_app_config_num_bytes_f getAppConfigNumBytes
Definition: wms_data.h:808
APP_LIB_DATA_QOS_NORMAL
@ APP_LIB_DATA_QOS_NORMAL
Definition: wms_data.h:88
APP_LIB_DATA_APP_CONFIG_RES_SUCCESS
@ APP_LIB_DATA_APP_CONFIG_RES_SUCCESS
Definition: wms_data.h:213
app_lib_data_tracking_id_t
uint16_t app_lib_data_tracking_id_t
Type of tracking ID for data packets.
Definition: wms_data.h:52
app_lib_data_set_local_mc_f
app_res_e(* app_lib_data_set_local_mc_f)(const app_lib_data_local_mc_info_t *info)
Set local multicast functionality.
Definition: wms_data.h:784
app_lib_data_received_t::delay
uint32_t delay
Definition: wms_data.h:296
app_lib_data_set_new_app_config_cb_f
app_res_e(* app_lib_data_set_new_app_config_cb_f)(app_lib_data_new_app_config_cb_f cb)
Set the callback function to be called when new appconfig "app config data" is received.
Definition: wms_data.h:526
APP_LIB_DATA_FRAGMENTED_MODE_DISABLED
@ APP_LIB_DATA_FRAGMENTED_MODE_DISABLED
Definition: wms_data.h:249
app_lib_data_to_send_t::fragment_info
app_lib_data_fragment_t fragment_info
Definition: wms_data.h:360
app_lib_data_to_send_t::hop_limit
uint8_t hop_limit
Definition: wms_data.h:356
app_lib_data_received_t::tx_power
int8_t tx_power
Definition: wms_data.h:315