Line data Source code
1 0 : /*
2 : * Copyright (c) 2024 A Labs GmbH
3 : * Copyright (c) 2024 tado GmbH
4 : *
5 : * SPDX-License-Identifier: Apache-2.0
6 : */
7 :
8 : #ifndef ZEPHYR_INCLUDE_LORAWAN_EMUL_H_
9 : #define ZEPHYR_INCLUDE_LORAWAN_EMUL_H_
10 :
11 : #include <stdbool.h>
12 : #include <stdint.h>
13 :
14 : #include <zephyr/lorawan/lorawan.h>
15 :
16 : /**
17 : * @brief Defines the emulator uplink callback handler function signature.
18 : *
19 : * @param port LoRaWAN port
20 : * @param len Payload data length
21 : * @param data Pointer to the payload data
22 : */
23 1 : typedef void (*lorawan_uplink_cb_t)(uint8_t port, uint8_t len, const uint8_t *data);
24 :
25 : /**
26 : * @brief Emulate LoRaWAN downlink message
27 : *
28 : * @param port Port message was sent on
29 : * @param data_pending Network server has more downlink packets pending
30 : * @param rssi Received signal strength in dBm
31 : * @param snr Signal to Noise ratio in dBm
32 : * @param len Length of data received, will be 0 for ACKs
33 : * @param data Data received, will be NULL for ACKs
34 : */
35 1 : void lorawan_emul_send_downlink(uint8_t port, bool data_pending, int16_t rssi, int8_t snr,
36 : uint8_t len, const uint8_t *data);
37 :
38 : /**
39 : * @brief Register callback for emulated uplink messages
40 : *
41 : * @param cb Pointer to the uplink callback handler function
42 : */
43 1 : void lorawan_emul_register_uplink_callback(lorawan_uplink_cb_t cb);
44 :
45 : #endif /* ZEPHYR_INCLUDE_LORAWAN_EMUL_H_ */
|