GNU Radio's LORA Package
loratap.h
Go to the documentation of this file.
1/*
2This file is part of LoRaTap Copyright (C) 2017 Erik de Jong
3
4LoRaTap is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 3 of the License, or
7(at your option) any later version.
8
9LoRaTap is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with LoRaTap. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19
20/*
21 Values are big-endian
22
23 Field details
24 lt_version LoRaTap header version, current version is 0.
25 lt_padding Unused, for boundary alignment.
26 lt_length LoRaTap header length, field used to allow expansion in future versions. Each version can append header parameters.
27 So, whilst parsing, these parameters can be skipped if not defined for older versions by skipping to the offset of lt_length starting from the beginning of the header.
28 channel Channel information
29 rssi RSSI information
30 sync_word Sync word for received packet, value 0x34 is reserved for LoRaWAN packets
31*/
32
33typedef enum sf { SF7=7, SF8, SF9, SF10, SF11, SF12 } sf_t;
34
35typedef struct __attribute__((__packed__)) loratap_channel {
36 uint32_t frequency; /* LoRa frequency (Hz) */
37 uint8_t bandwidth; /* Channel bandwidth (KHz) in 125 KHz steps */
38 uint8_t sf; /* LoRa SF (sf_t) [7, 8, 9, 10, 11, 12] */
40
41typedef struct __attribute__((__packed__)) loratap_rssi {
42 uint8_t packet_rssi; /* LoRa packet RSSI, if snr >= 0 then dBm value is -139 + packet_rssi, otherwise dBm value is -139 + packet_rssi * .25 */
43 uint8_t max_rssi; /* LoRa receiver max RSSI (dBm value is -139 + rssi) */
44 uint8_t current_rssi; /* LoRa receiver current RSSI (dBm value is -139 + rssi) */
45 uint8_t snr; /* LoRa SNR (dB value is (snr[two's complement])/4) */
47
48typedef struct __attribute__((__packed__)) loratap_header {
49 uint8_t lt_version; /* LoRatap header version */
50 uint8_t lt_padding;
51 uint16_t lt_length; /* LoRatap header length */
52 loratap_channel_t channel;
53 loratap_rssi_t rssi;
54 uint8_t sync_word; /* LoRa radio sync word [0x34 = LoRaWAN] */
enum sf sf_t
loratap_channel_t
Definition loratap.h:39
struct __attribute__((__packed__)) loratap_channel
Definition loratap.h:35
sf
Definition loratap.h:33
@ SF12
Definition loratap.h:33
@ SF10
Definition loratap.h:33
@ SF11
Definition loratap.h:33
@ SF8
Definition loratap.h:33
@ SF7
Definition loratap.h:33
@ SF9
Definition loratap.h:33
loratap_header_t
Definition loratap.h:55
loratap_rssi_t
Definition loratap.h:46