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 0x20D
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 {
226 
234 typedef enum
235 {
249 
250 
261 #define APP_LIB_DATA_RX_HOPS_UNDETERMINED 0
262 
266 typedef struct
267 {
269  uint16_t packet_id;
271  uint16_t fragment_offset;
275 
283 typedef struct
284 {
286  const uint8_t * bytes;
288  size_t num_bytes;
294  uint32_t delay;
298  uint8_t src_endpoint;
300  uint8_t dest_endpoint;
302  uint8_t hops;
313  int8_t tx_power;
317  int8_t rssi;
321  uint32_t delay_hp;
327 
331 typedef struct
332 {
334  const uint8_t * bytes;
336  size_t num_bytes;
346  uint8_t flags;
348  uint8_t src_endpoint;
350  uint8_t dest_endpoint;
354  uint8_t hop_limit;
360 
368 typedef struct
369 {
376  uint32_t queue_time;
381  uint8_t src_endpoint;
383  uint8_t dest_endpoint;
385  bool success;
387 
405 
415 typedef void
417 
435 typedef void (*app_lib_data_new_app_config_cb_f)(const uint8_t * bytes,
436  uint8_t seq,
437  uint16_t interval);
438 
478 typedef app_res_e
480 
509 typedef app_res_e
511 
522 typedef app_res_e
525 
526 typedef struct
527 {
535 
536 
553 
574 typedef size_t
576 
603 typedef app_res_e
604  (*app_lib_data_get_num_free_buffers_f)(size_t * num_buffers_p);
605 
622 
647 typedef void
649 
673  (*app_lib_data_read_app_config_f)(uint8_t * bytes,
674  uint8_t * seq,
675  uint16_t * interval);
676 
686 typedef size_t
688 
689 
715  (*app_lib_data_write_app_config_data_f)(const uint8_t * bytes);
716 
743 
749 #define APP_DATA_DISABLE_LOCAL_MULTICAST 0
750 
757 {
762  uint8_t hops_left;
764 
781 typedef app_res_e
783 
789 typedef app_res_e
791 
795 typedef struct
796 {
812 
813 #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 app config.
Definition: wms_data.h:687
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:790
app_lib_data_sent_status_t
Struct to tracking callback function.
Definition: wms_data.h:368
app_lib_data_t::writeDiagnosticInterval
app_lib_data_write_diagnostic_interval_f writeDiagnosticInterval
Definition: wms_data.h:808
app_lib_data_data_size_t::max_data_size
size_t max_data_size
Definition: wms_data.h:529
app_lib_data_t::setDataSentCb
app_lib_data_set_data_sent_cb_f setDataSentCb
Definition: wms_data.h:798
app_lib_data_received_t::rssi
int8_t rssi
Definition: wms_data.h:317
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:648
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:805
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:799
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:435
app_lib_data_to_send_t::tracking_id
app_lib_data_tracking_id_t tracking_id
Definition: wms_data.h:342
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:298
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:306
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:795
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:288
app_lib_data_data_size_t
Definition: wms_data.h:526
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:604
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:290
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:385
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:804
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:416
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 app config DATA.
Definition: wms_data.h:715
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 app config.
Definition: wms_data.h:673
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:810
app_lib_data_received_t::dest_endpoint
uint8_t dest_endpoint
Definition: wms_data.h:300
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:510
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:479
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:331
app_lib_data_received_t::fragment_info
app_lib_data_fragment_t * fragment_info
Definition: wms_data.h:325
app_lib_data_t::getNumBuffers
app_lib_data_get_num_buffers_f getNumBuffers
Definition: wms_data.h:801
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:575
app_lib_data_t::getNumFreeBuffers
app_lib_data_get_num_free_buffers_f getNumFreeBuffers
Definition: wms_data.h:802
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:800
app_lib_data_t::setLocalMulticastInfo
app_lib_data_set_local_mc_f setLocalMulticastInfo
Definition: wms_data.h:809
APP_LIB_DATA_QOS_HIGH
@ APP_LIB_DATA_QOS_HIGH
Definition: wms_data.h:91
app_lib_data_received_t::hops
uint8_t hops
Definition: wms_data.h:302
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:762
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:283
app_lib_data_fragment_t
Fragmentation information.
Definition: wms_data.h:266
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:803
app_lib_data_fragment_t::fragment_offset
uint16_t fragment_offset
Definition: wms_data.h:271
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:234
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:552
app_lib_data_to_send_t::flags
uint8_t flags
Definition: wms_data.h:346
app_lib_data_received_t::mac_src_address
app_addr_t mac_src_address
Definition: wms_data.h:309
APP_LIB_DATA_FRAGMENTED_MODE_ENABLED
@ APP_LIB_DATA_FRAGMENTED_MODE_ENABLED
Definition: wms_data.h:239
app_lib_data_received_t::qos
app_lib_data_qos_e qos
Definition: wms_data.h:296
app_lib_data_received_t::delay_hp
uint32_t delay_hp
Definition: wms_data.h:321
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:621
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:797
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:273
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:756
app_lib_data_t::writeAppConfigData
app_lib_data_write_app_config_data_f writeAppConfigData
Definition: wms_data.h:807
app_lib_data_data_size_t::max_fragment_size
size_t max_fragment_size
Definition: wms_data.h:533
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:404
app_lib_data_received_t::bytes
const uint8_t * bytes
Definition: wms_data.h:286
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 Diagnostic interval.
Definition: wms_data.h:742
app_lib_data_sent_status_t::queue_time
uint32_t queue_time
Definition: wms_data.h:376
app_lib_data_fragment_t::packet_id
uint16_t packet_id
Definition: wms_data.h:269
app_lib_data_t::getAppConfigNumBytes
app_lib_data_get_app_config_num_bytes_f getAppConfigNumBytes
Definition: wms_data.h:806
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:782
app_lib_data_received_t::delay
uint32_t delay
Definition: wms_data.h:294
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 app config data is received.
Definition: wms_data.h:524
APP_LIB_DATA_FRAGMENTED_MODE_DISABLED
@ APP_LIB_DATA_FRAGMENTED_MODE_DISABLED
Definition: wms_data.h:247
app_lib_data_to_send_t::fragment_info
app_lib_data_fragment_t fragment_info
Definition: wms_data.h:358
app_lib_data_to_send_t::hop_limit
uint8_t hop_limit
Definition: wms_data.h:354
app_lib_data_received_t::tx_power
int8_t tx_power
Definition: wms_data.h:313