Wirepas SDK
wms_joining.h
Go to the documentation of this file.
1 /* Copyright 2019 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
16 #ifndef APP_LIB_JOINING_H_
17 #define APP_LIB_JOINING_H_
18 
19 #include <stdlib.h>
20 #include <stdint.h>
21 #include <stdbool.h>
22 
23 #include "wms_app.h"
24 #include "wms_settings.h" // For app_lib_settings_net_addr_t and
25  // app_lib_settings_net_channel_t
26 #include "wms_time.h" // For app_lib_time_timestamp_coarse_t
27 
29 #define APP_LIB_JOINING_NAME 0x000a2336
30 
31 
32 #define APP_LIB_JOINING_VERSION 0x200
33 
40 #define APP_LIB_JOINING_MIN_INTERVAL 100
41 
48 #define APP_LIB_JOINING_MAX_INTERVAL 8000
49 
56 #define APP_LIB_JOINING_MIN_TIMEOUT 100
57 
64 #define APP_LIB_JOINING_MAX_TIMEOUT 10000
65 
73 #define APP_LIB_JOINING_MAX_PAYLOAD_NUM_BYTES 64
74 
82 typedef enum
83 {
97 
104 typedef struct
105 {
107  uint32_t interval;
113  int8_t tx_power;
115  uint32_t type;
117  const void * payload;
121 
130 {
137  size_t num_bytes;
139  uint32_t type;
141  uint8_t * payload;
151  int8_t rssi;
153  int8_t tx_power;
154 };
155 
157  app_lib_joining_received_beacon_t;
158 
170  const app_lib_joining_received_beacon_t * beacons,
171  size_t num_beacons);
172 
179 typedef struct
180 {
190  uint32_t timeout;
194  void * buffer;
196  size_t num_bytes;
198 
216  const app_lib_joining_beacon_tx_param_t * param);
217 
223 
243  const app_lib_joining_beacon_rx_param_t * param);
244 
253 
275 
289 
296 
303 
307 typedef struct
308 {
318 
319 #endif /* APP_LIB_JOINING_H_ */
APP_LIB_JOINING_RX_STATUS_STOPPED
@ APP_LIB_JOINING_RX_STATUS_STOPPED
Definition: wms_joining.h:88
app_lib_joining_beacon_rx_param_t::cb
app_lib_joining_beacon_rx_cb_f cb
Definition: wms_joining.h:182
app_lib_settings_net_channel_t
uint8_t app_lib_settings_net_channel_t
Network channel type definition.
Definition: wms_settings.h:60
app_lib_joining_beacon_tx_param_t::interval
uint32_t interval
Definition: wms_joining.h:107
APP_LIB_JOINING_RX_STATUS_INTERRUPTED
@ APP_LIB_JOINING_RX_STATUS_INTERRUPTED
Definition: wms_joining.h:93
app_lib_joining_stop_joining_beacon_rx_f
app_res_e(* app_lib_joining_stop_joining_beacon_rx_f)(void)
Stop receiving joining beacons.
Definition: wms_joining.h:252
app_lib_joining_t::enableRemoteApi
app_lib_joining_enable_remote_api_f enableRemoteApi
Definition: wms_joining.h:315
app_lib_joining_enable_remote_api_f
app_res_e(* app_lib_joining_enable_remote_api_f)(bool enable)
Enable or disable Remote API control for transmitting joining beacons.
Definition: wms_joining.h:295
app_lib_joining_start_joining_beacon_tx_f
app_res_e(* app_lib_joining_start_joining_beacon_tx_f)(const app_lib_joining_beacon_tx_param_t *param)
Start transmitting joining beacons.
Definition: wms_joining.h:215
APP_LIB_JOINING_RX_STATUS_DONE
@ APP_LIB_JOINING_RX_STATUS_DONE
Definition: wms_joining.h:85
app_lib_joining_t::startJoiningBeaconTx
app_lib_joining_start_joining_beacon_tx_f startJoiningBeaconTx
Definition: wms_joining.h:309
app_lib_joining_beacon_tx_param_t::channel
app_lib_settings_net_channel_t channel
Definition: wms_joining.h:111
app_res_e
app_res_e
Definition: wms_app.h:201
app_lib_joining_beacon_tx_param_t::tx_power
int8_t tx_power
Definition: wms_joining.h:113
wms_app.h
wms_settings.h
app_lib_settings_net_addr_t
uint32_t app_lib_settings_net_addr_t
Network address type definition.
Definition: wms_settings.h:53
app_lib_joining_start_joining_process_f
app_res_e(* app_lib_joining_start_joining_process_f)(app_lib_settings_net_addr_t addr, app_lib_settings_net_channel_t channel)
Start the joining process by joining a cluster as a joining member.
Definition: wms_joining.h:272
app_lib_joining_beacon_rx_param_t
Parameters for receiving joining beacons.
Definition: wms_joining.h:179
app_lib_joining_stop_joining_process_f
app_res_e(* app_lib_joining_stop_joining_process_f)(void)
Stop the joining process and restore network address and channel.
Definition: wms_joining.h:288
app_lib_joining_received_beacon_s::payload
uint8_t * payload
Definition: wms_joining.h:141
app_lib_joining_t
List of library functions.
Definition: wms_joining.h:307
app_lib_joining_t::startJoiningBeaconRx
app_lib_joining_start_joining_beacon_rx_f startJoiningBeaconRx
Definition: wms_joining.h:311
app_lib_time_timestamp_coarse_t
uint32_t app_lib_time_timestamp_coarse_t
Coarse timestamp type.
Definition: wms_time.h:50
app_lib_joining_t::stopJoiningBeaconRx
app_lib_joining_stop_joining_beacon_rx_f stopJoiningBeaconRx
Definition: wms_joining.h:312
app_lib_joining_received_beacon_s::time
app_lib_time_timestamp_coarse_t time
Definition: wms_joining.h:145
app_lib_joining_beacon_rx_param_t::max_exec_time_us
uint32_t max_exec_time_us
Definition: wms_joining.h:184
app_lib_joining_beacon_tx_param_t::addr
app_lib_settings_net_addr_t addr
Definition: wms_joining.h:109
app_lib_joining_stop_joining_beacon_tx_f
app_res_e(* app_lib_joining_stop_joining_beacon_tx_f)(void)
Stop transmitting joining beacons.
Definition: wms_joining.h:222
app_lib_joining_received_beacon_s
Received joining beacon.
Definition: wms_joining.h:129
app_lib_joining_beacon_rx_param_t::timeout
uint32_t timeout
Definition: wms_joining.h:190
app_lib_joining_beacon_rx_param_t::buffer
void * buffer
Definition: wms_joining.h:194
APP_LIB_JOINING_RX_STATUS_OUT_OF_SPACE
@ APP_LIB_JOINING_RX_STATUS_OUT_OF_SPACE
Definition: wms_joining.h:95
app_lib_joining_t::startJoiningProcess
app_lib_joining_start_joining_process_f startJoiningProcess
Definition: wms_joining.h:313
app_lib_joining_start_joining_beacon_rx_f
app_res_e(* app_lib_joining_start_joining_beacon_rx_f)(const app_lib_joining_beacon_rx_param_t *param)
Start receiving joining beacons.
Definition: wms_joining.h:242
app_lib_joining_beacon_tx_param_t::payload
const void * payload
Definition: wms_joining.h:117
app_lib_joining_beacon_tx_param_t
Parameters for sending joining beacons.
Definition: wms_joining.h:104
app_lib_joining_received_beacon_s::next
struct app_lib_joining_received_beacon_s * next
Definition: wms_joining.h:132
wms_time.h
app_lib_joining_beacon_tx_param_t::payload_num_bytes
size_t payload_num_bytes
Definition: wms_joining.h:119
app_lib_joining_received_beacon_s::rssi
int8_t rssi
Definition: wms_joining.h:151
app_lib_joining_beacon_rx_cb_f
void(* app_lib_joining_beacon_rx_cb_f)(app_lib_joining_rx_status_e status, const app_lib_joining_received_beacon_t *beacons, size_t num_beacons)
Function type for joining beacon RX callback.
Definition: wms_joining.h:168
app_lib_joining_beacon_tx_param_t::type
uint32_t type
Definition: wms_joining.h:115
app_lib_joining_t::enableProxy
app_lib_joining_enable_proxy_f enableProxy
Definition: wms_joining.h:316
app_lib_joining_beacon_rx_param_t::max_num_beacons
size_t max_num_beacons
Definition: wms_joining.h:192
app_lib_joining_received_beacon_s::num_bytes
size_t num_bytes
Definition: wms_joining.h:137
app_lib_joining_t::stopJoiningBeaconTx
app_lib_joining_stop_joining_beacon_tx_f stopJoiningBeaconTx
Definition: wms_joining.h:310
app_lib_joining_rx_status_e
app_lib_joining_rx_status_e
Status values for beacon reception callback.
Definition: wms_joining.h:82
app_lib_joining_enable_proxy_f
app_res_e(* app_lib_joining_enable_proxy_f)(bool enable)
Enable or disable built-in proxy for handling joining data packets.
Definition: wms_joining.h:302
app_lib_joining_t::stopJoiningProcess
app_lib_joining_stop_joining_process_f stopJoiningProcess
Definition: wms_joining.h:314