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 0x20B
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;
342  uint32_t delay;
350  uint8_t flags;
352  uint8_t src_endpoint;
354  uint8_t dest_endpoint;
358  uint8_t hop_limit;
364 
372 typedef struct
373 {
380  uint32_t queue_time;
385  uint8_t src_endpoint;
387  uint8_t dest_endpoint;
389  bool success;
391 
409 
419 typedef void
421 
439 typedef void (*app_lib_data_new_app_config_cb_f)(const uint8_t * bytes,
440  uint8_t seq,
441  uint16_t interval);
442 
482 typedef app_res_e
484 
513 typedef app_res_e
515 
526 typedef app_res_e
529 
530 typedef struct
531 {
539 
540 
557 
578 typedef size_t
580 
607 typedef app_res_e
608  (*app_lib_data_get_num_free_buffers_f)(size_t * num_buffers_p);
609 
626 
651 typedef void
653 
677  (*app_lib_data_read_app_config_f)(uint8_t * bytes,
678  uint8_t * seq,
679  uint16_t * interval);
680 
690 typedef size_t
692 
693 
720 typedef app_res_e
722  uint16_t time);
723 
740 typedef app_res_e
742  uint16_t * time_p);
743 
769  (*app_lib_data_write_app_config_data_f)(const uint8_t * bytes);
770 
797 
803 #define APP_DATA_DISABLE_LOCAL_MULTICAST 0
804 
811 {
816  uint8_t hops_left;
818 
835 typedef app_res_e
837 
843 typedef app_res_e
845 
849 typedef struct
850 {
868 
869 #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:691
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:844
app_lib_data_sent_status_t
Struct to tracking callback function.
Definition: wms_data.h:372
app_lib_data_t::writeDiagnosticInterval
app_lib_data_write_diagnostic_interval_f writeDiagnosticInterval
Definition: wms_data.h:864
app_lib_data_data_size_t::max_data_size
size_t max_data_size
Definition: wms_data.h:533
app_lib_data_t::setDataSentCb
app_lib_data_set_data_sent_cb_f setDataSentCb
Definition: wms_data.h:852
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:652
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:859
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:853
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:439
app_lib_data_to_send_t::tracking_id
app_lib_data_tracking_id_t tracking_id
Definition: wms_data.h:346
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:849
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_set_max_msg_queuing_time_f
app_res_e(* app_lib_data_set_max_msg_queuing_time_f)(app_lib_data_qos_e priority, uint16_t time)
Set maximum queuing time for messages.
Definition: wms_data.h:721
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:530
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:608
APP_LIB_DATA_SEND_RES_RESERVED_ENDPOINT
@ APP_LIB_DATA_SEND_RES_RESERVED_ENDPOINT
Definition: wms_data.h:167
app_lib_data_t::setMaxMsgQueuingTime
app_lib_data_set_max_msg_queuing_time_f setMaxMsgQueuingTime
Definition: wms_data.h:861
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:389
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:858
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:420
app_lib_data_t::getMaxMsgQueuingTime
app_lib_data_get_max_msg_queuing_time_f getMaxMsgQueuingTime
Definition: wms_data.h:862
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:769
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:677
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:866
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:514
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:483
app_lib_data_get_max_msg_queuing_time_f
app_res_e(* app_lib_data_get_max_msg_queuing_time_f)(app_lib_data_qos_e priority, uint16_t *time_p)
Get maximum queuing time of messages.
Definition: wms_data.h:741
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:855
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:579
app_lib_data_t::getNumFreeBuffers
app_lib_data_get_num_free_buffers_f getNumFreeBuffers
Definition: wms_data.h:856
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:854
app_lib_data_t::setLocalMulticastInfo
app_lib_data_set_local_mc_f setLocalMulticastInfo
Definition: wms_data.h:865
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:816
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:857
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:556
app_lib_data_to_send_t::flags
uint8_t flags
Definition: wms_data.h:350
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:625
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:851
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:810
app_lib_data_t::writeAppConfigData
app_lib_data_write_app_config_data_f writeAppConfigData
Definition: wms_data.h:863
app_lib_data_data_size_t::max_fragment_size
size_t max_fragment_size
Definition: wms_data.h:537
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:408
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:796
app_lib_data_sent_status_t::queue_time
uint32_t queue_time
Definition: wms_data.h:380
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:860
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:836
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:528
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:362
app_lib_data_to_send_t::hop_limit
uint8_t hop_limit
Definition: wms_data.h:358
app_lib_data_received_t::tx_power
int8_t tx_power
Definition: wms_data.h:313