Compare commits

...

29 Commits

Author SHA1 Message Date
84a1c6e1be Bump version to 4.0.0 2022-09-14 09:43:05 +01:00
a43ef72fb2 Fix chart tooltip date format. 2022-09-13 10:15:21 +01:00
331f4bce40 Fix "Error converting from js 'float' into type 'i32'" error. 2022-09-12 12:28:23 +01:00
90c5af20df Update encodeDownlink code template. 2022-09-12 11:52:51 +01:00
b0e61b50d2 Remove old commented-out code. 2022-09-12 11:48:59 +01:00
0fc548d6b4 Fix object > data error in template.
Closes #39.
2022-09-10 12:42:50 +01:00
62f981fefe Use trust_store instead of ca_path. (#37) 2022-09-10 12:32:01 +01:00
cba8da2d05 Bump version to 4.0.0-rc.4 2022-09-05 22:47:47 +01:00
97a235cc80 Remove duplicate code.
This is already handled by the filter_mac_commands function.
2022-09-05 22:38:48 +01:00
8a4b537645 Fix filtering on mac-command conflict and error count. 2022-09-05 14:07:16 +01:00
32889d7052 Make UI proxy work within Compose for development. 2022-09-01 14:50:46 +01:00
4dd441e85d Cleanup DevEUI from DevAddr > DevEUI set, if DS does not exist. 2022-08-31 11:13:51 +01:00
0fa40717e8 Add missing CN470 configuration.
Closes #36.
2022-08-31 09:48:55 +01:00
7e6552df5e Fix missing Kafka key. 2022-08-31 08:49:53 +01:00
4f08f7ddcb Add user_id filter when listing tenants with global API key. (#34) 2022-08-31 08:48:11 +01:00
0a5c38d322 Also log txack errors for mac-only downlinks. 2022-08-30 14:02:21 +01:00
3cf05e8fb9 Fix passive-roaming tx ack and save device-session order.
We first need to save the device-session and then handle the tx ack, as
else we are overwriting the frame-counter increment.
2022-08-26 12:54:46 +01:00
46bc4d6038 Use rf_region_encode module for rf_region in ULMetaData. 2022-08-25 10:43:36 +01:00
75f67f8c5c Use default for Description and do not serialize if empty. 2022-08-25 09:52:54 +01:00
ca2961c7b6 Bump version to 4.0.0-rc.3 2022-08-23 08:59:05 +01:00
63b0af6cf3 Remove owning_ref indirect dep by updating prometheus-client.
The owning_ref crate has a vulnerable. The updated prometheus-client no
longer uses owning_ref as a dependency.
2022-08-22 10:54:33 +01:00
d97da8ed50 Fix c > 64 to c >= 64 typo in channel-mask calculation.
Depending the channel-configuration, this would send three LinkADRReq
mac-commands while the same configuration could be send to the device in
two LinkADRReq mac-commands.
2022-08-21 21:48:27 +01:00
3b297ef221 Replace env. variables in config by localhost for .deb and .rpm
The env. variables are used such that the same configuration can be used
for Docker images, .deb and .rpm packages. However, if installing .deb
or .rpm packages, this can be confusing as executing 'chirpstack -c
/etc/chirpstack' will fail because these environment variables are only
available when using systemctl to start the ChirpStack process
(configured in the .service configuration file).
2022-08-21 21:44:36 +01:00
e917f8ea49 Remove default CA and MQTT cert gen. on install.
In case of mult-server deployments, this can be confusing as each VM
generates different certificate files by default, where all instances
must share the same certificate (or at least CA certificate + key).
The other issue is that the MQTT broker certificate must contain the
correct hostname, which can (most of the times) not automatically be
retrieved. Documentation to generate these certificates can be found
here:

https://www.chirpstack.io/docs/guides/mosquitto-tls-configuration.html
2022-08-21 19:56:49 +01:00
424306ab41 Update cpufeatures crate. This fixes an incorrect avx2 check.
In some scenarios, this check returned true while the avx2 extension was
not available (e.g. QEMU emulated CPU).

See for more details: https://github.com/RustCrypto/hashes/pull/386.
2022-08-18 11:37:03 +01:00
613f4562a2 Add config option to allow unknown gateways. 2022-08-18 10:27:55 +01:00
bf6df9c845 Fix shadowing of rx_info and setting location.
The rx_info value was shadowed, and because of this the location was set
on the cloned value, not the original value, making the location set
useless.
2022-08-14 13:49:00 +01:00
d4337b10ab Bump version to 4.0.0-rc.2 2022-08-11 12:04:21 +01:00
77dc247f66 Fix mac_version -> mac_version().
The first returns the Protobuf integer, the second the generated enum
type. The big difference is that the first .to_string() would convert
the Protobuf integer to the same but then as String type, where the
latter returns something like '1.0.3' which is provided by the
fmt::Display trait implementation by ChirpStack.
2022-08-11 11:38:43 +01:00
60 changed files with 3394 additions and 195 deletions

6
.gitignore vendored
View File

@ -13,11 +13,7 @@
**/target
# Certificates
/chirpstack/configuration/certs/*.crt
/chirpstack/configuration/certs/*.key
/chirpstack/configuration/certs/*.trust
/chirpstack/configuration/certs/*.pem
/chirpstack/configuration/certs/*.csr
/chirpstack/configuration/certs/*
/chirpstack/configuration/private_*.toml
# UI

37
Cargo.lock generated
View File

@ -635,7 +635,7 @@ dependencies = [
[[package]]
name = "backend"
version = "4.0.0-rc.1"
version = "4.0.0"
dependencies = [
"aes-kw",
"anyhow",
@ -879,7 +879,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chirpstack"
version = "4.0.0-rc.1"
version = "4.0.0"
dependencies = [
"aes 0.7.5",
"anyhow",
@ -958,7 +958,7 @@ dependencies = [
[[package]]
name = "chirpstack_api"
version = "4.0.0-rc.1"
version = "4.0.0"
dependencies = [
"hex",
"pbjson",
@ -1118,9 +1118,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
name = "cpufeatures"
version = "0.2.2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b"
checksum = "1079fb8528d9f9c888b1e8aa651e6e079ade467323d58f75faf1d30b1808f540"
dependencies = [
"libc",
]
@ -2222,7 +2222,7 @@ dependencies = [
[[package]]
name = "lrwn"
version = "4.0.0-rc.1"
version = "4.0.0"
dependencies = [
"aes 0.7.5",
"anyhow",
@ -2582,15 +2582,6 @@ version = "6.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "648001efe5d5c0102d8cea768e348da85d90af8ba91f0bea908f157951493cd4"
[[package]]
name = "owning_ref"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce"
dependencies = [
"stable_deref_trait",
]
[[package]]
name = "p12"
version = "0.6.3"
@ -2953,21 +2944,21 @@ dependencies = [
[[package]]
name = "prometheus-client"
version = "0.16.0"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac1abe0255c04d15f571427a2d1e00099016506cf3297b53853acd2b7eb87825"
checksum = "3c473049631c233933d6286c88bbb7be30e62ec534cf99a9ae0079211f7fa603"
dependencies = [
"dtoa 1.0.2",
"itoa 1.0.2",
"owning_ref",
"parking_lot",
"prometheus-client-derive-text-encode",
]
[[package]]
name = "prometheus-client-derive-text-encode"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652"
checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd"
dependencies = [
"proc-macro2",
"quote",
@ -3803,12 +3794,6 @@ dependencies = [
"lock_api",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "string_cache"
version = "0.8.4"

View File

@ -30,11 +30,11 @@ build-ui:
# Enters the devshell for ChirpStack development.
devshell:
docker-compose run --rm --service-ports chirpstack bash
docker-compose run --rm --service-ports --name chirpstack chirpstack bash
# Enters the devshell for ChirpStack UI development.
devshell-ui:
docker-compose run --rm --service-ports chirpstack-ui bash
docker-compose run --rm --service-ports --name chirpstack-ui chirpstack-ui bash
# Runs the tests
test:

View File

@ -1,6 +1,6 @@
{
"name": "@chirpstack/chirpstack-api-grpc-web",
"version": "4.0.0-rc.1",
"version": "4.0.0",
"description": "Chirpstack gRPC-web API",
"license": "MIT",
"devDependencies": {

2
api/js/package.json vendored
View File

@ -1,6 +1,6 @@
{
"name": "@chirpstack/chirpstack-api",
"version": "4.0.0-rc.1",
"version": "4.0.0",
"description": "Chirpstack JS and TS API",
"license": "MIT",
"devDependencies": {

View File

@ -189,6 +189,10 @@ message ListTenantsRequest {
// If set, the given string will be used to search on name.
string search = 3;
// If set, filters the result set to the tenants of the user.
// Only global API keys are able to filter by this field.
string user_id = 4;
}
message ListTenantsResponse {

View File

@ -189,6 +189,10 @@ message ListTenantsRequest {
// If set, the given string will be used to search on name.
string search = 3;
// If set, filters the result set to the tenants of the user.
// Only global API keys are able to filter by this field.
string user_id = 4;
}
message ListTenantsResponse {

View File

@ -18,7 +18,7 @@ CLASSIFIERS = [
setup(
name='chirpstack-api',
version = "4.0.0-rc.1",
version = "4.0.0",
url='https://github.com/brocaar/chirpstack-api',
author='Orne Brocaar',
author_email='info@brocaar.com',

2
api/rust/Cargo.lock generated vendored
View File

@ -121,7 +121,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chirpstack_api"
version = "4.0.0-test.18"
version = "4.0.0-rc.2"
dependencies = [
"hex",
"pbjson",

2
api/rust/Cargo.toml vendored
View File

@ -1,7 +1,7 @@
[package]
name = "chirpstack_api"
description = "ChirpStack Protobuf / gRPC API definitions."
version = "4.0.0-rc.1"
version = "4.0.0"
authors = ["Orne Brocaar <info@brocaar.com>"]
license = "MIT"
homepage = "https://www.chirpstack.io"

View File

@ -189,6 +189,10 @@ message ListTenantsRequest {
// If set, the given string will be used to search on name.
string search = 3;
// If set, filters the result set to the tenants of the user.
// Only global API keys are able to filter by this field.
string user_id = 4;
}
message ListTenantsResponse {

View File

@ -1,6 +1,6 @@
[package]
name = "backend"
version = "4.0.0-rc.1"
version = "4.0.0"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2018"
publish = false

View File

@ -528,7 +528,11 @@ pub struct BasePayloadResult {
pub struct ResultPayload {
#[serde(rename = "ResultCode")]
pub result_code: ResultCode,
#[serde(rename = "Description")]
#[serde(
default,
rename = "Description",
skip_serializing_if = "String::is_empty"
)]
pub description: String,
}
@ -938,7 +942,12 @@ pub struct ULMetaData {
pub f_ns_ul_token: Vec<u8>,
#[serde(rename = "RecvTime")]
pub recv_time: DateTime<Utc>,
#[serde(default, rename = "RFRegion", skip_serializing_if = "String::is_empty")]
#[serde(
default,
rename = "RFRegion",
with = "rf_region_encode",
skip_serializing_if = "String::is_empty"
)]
pub rf_region: String,
#[serde(rename = "GWCnt")]
pub gw_cnt: Option<usize>,

View File

@ -1,4 +0,0 @@
[Service]
Environment="MQTT_BROKER_HOST=localhost"
Environment="POSTGRESQL_HOST=localhost"
Environment="REDIS_HOST=localhost"

View File

@ -23,6 +23,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
rm -rf %{buildroot}
mkdir -p %{buildroot}
cp -a * %{buildroot}
sed -i "s/\$MQTT_BROKER_HOST/localhost/" %{buildroot}/etc/chirpstack/*.toml
sed -i "s/\$POSTGRESQL_HOST/localhost/" %{buildroot}/etc/chirpstack/*.toml
sed -i "s/\$REDIS_HOST/localhost/" %{buildroot}/etc/chirpstack/*.toml
%clean
rm -rf %{buildroot}
@ -32,4 +35,3 @@ rm -rf %{buildroot}
%{_bindir}/*
/lib/systemd/system/chirpstack.service
%config /etc/chirpstack/*
%config /etc/systemd/system/chirpstack.service.d/*

View File

@ -3,7 +3,7 @@ name = "chirpstack"
description = "ChirpStack is an open-source LoRaWAN(TM) Network Server"
repository = "https://github.com/chirpstack/chirpstack"
homepage="https://www.chirpstack.io/"
version = "4.0.0-rc.1"
version = "4.0.0"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2021"
publish = false
@ -107,7 +107,7 @@ base64 = "0.13"
async-recursion = "1.0"
regex = "1"
petgraph = "0.6"
prometheus-client = "0.16"
prometheus-client = "0.18"
pin-project = "1.0"
# Development and testing
@ -120,13 +120,8 @@ bytes = "1.1"
assets = [
["target/release/chirpstack", "usr/bin/", "755"],
["configuration/*.toml", "etc/chirpstack/", "640"],
["configuration/certs/*.json", "etc/chirpstack/certs", "640"],
["debian/environment.conf", "etc/systemd/system/chirpstack.service.d/environment.conf", "640"],
]
conf-files = [
"/etc/chirpstack/certs/ca-config.json",
"/etc/chirpstack/certs/ca-csr.json",
"/etc/chirpstack/certs/mqtt-server.json",
"/etc/chirpstack/chirpstack.toml",
"/etc/chirpstack/region_as923.toml",
"/etc/chirpstack/region_as923_2.toml",
@ -156,7 +151,6 @@ conf-files = [
"/etc/chirpstack/region_us915_6.toml",
"/etc/chirpstack/region_us915_7.toml",
]
depends = "$auto, golang-cfssl"
suggests = "postgresql, mosquitto, redis"
maintainer-scripts = "debian/"
systemd-units = { enable = true }
@ -167,7 +161,6 @@ package = "chirpstack"
[package.metadata.rpm.files]
"configuration/" = { path = "/etc/chirpstack/" }
"chirpstack.service" = { path = "/lib/systemd/system/chirpstack.service" }
"chirpstack.env" = { path = "/etc/systemd/system/chirpstack.service.d/environment" }
[package.metadata.rpm.cargo]
buildflags = ["--release"]

View File

@ -111,14 +111,8 @@ test:
test-lrwn:
cd ../lrwn && make test
test-server: debug-amd64 configuration/certs/ca.pem
test-server: debug-amd64
../target/debug/chirpstack -c ./configuration
dbshell:
psql -h postgres -U chirpstack chirpstack
configuration/certs/ca.pem:
cfssl gencert -initca configuration/certs/ca-csr.json | cfssljson -bare configuration/certs/ca
configuration/certs/mqtt-server.pem: configuration/certs/ca.pem
cfssl gencert -ca configuration/certs/ca.pem -ca-key configuration/certs/ca-key.pem -config configuration/certs/ca-config.json -profile server configuration/certs/mqtt-server.json | cfssljson -bare configuration/certs/mqtt-server

View File

@ -1,17 +0,0 @@
{
"signing": {
"default": {
"expiry": "8760h"
},
"profiles": {
"server": {
"expiry": "8760h",
"usages": [
"signing",
"key encipherment",
"server auth"
]
}
}
}
}

View File

@ -1,7 +0,0 @@
{
"CN": "ChirpStack CA",
"key": {
"algo": "rsa",
"size": 4096
}
}

View File

@ -1,10 +0,0 @@
{
"CN": "mqtt-broker",
"hosts": [
"*"
],
"key": {
"algo": "rsa",
"size": 4096
}
}

View File

@ -70,6 +70,7 @@
"as923_3",
"as923_4",
"au915_0",
"cn470_10",
"cn779",
"eu433",
"eu868",
@ -97,19 +98,9 @@
secret="you-must-replace-this"
[gateway]
client_cert_lifetime="365days"
ca_cert="configuration/certs/ca.pem"
ca_key="configuration/certs/ca-key.pem"
[integration]
enabled=["mqtt"]
[integration.mqtt]
server="tcp://$MQTT_BROKER_HOST:1883/"
json=true
[integration.mqtt.client]
client_cert_lifetime="365days"
ca_cert="configuration/certs/ca.pem"
ca_key="configuration/certs/ca-key.pem"

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 0-7).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_0"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_0/gateway/+/event/+"
# Command topic template.
command_topic="cn470_0/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=470300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=470500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=470700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=470900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=471100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=471300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=471500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=471700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[0, 1, 2, 3, 4, 5, 6, 7]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 8-15).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_1"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_1/gateway/+/event/+"
# Command topic template.
command_topic="cn470_1/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=471900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=472100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=472300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=472500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=472700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=472900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=473100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=473300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[8, 9, 10, 11, 12, 13, 14, 15]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 80-87).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_10"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_10/gateway/+/event/+"
# Command topic template.
command_topic="cn470_10/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=486300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=486500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=486700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=486900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=487100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=487300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=487500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=487700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[80, 81, 82, 83, 84, 85, 86, 87]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 88-95).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_11"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_11/gateway/+/event/+"
# Command topic template.
command_topic="cn470_11/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=487900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=488100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=488300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=488500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=488700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=488900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=489100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=489300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[88, 89, 90, 91, 92, 93, 94, 95]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 16-23).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_2"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_2/gateway/+/event/+"
# Command topic template.
command_topic="cn470_2/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=473500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=473700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=473900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=474100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=474300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=474500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=474700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=474900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[16, 17, 18, 19, 20, 21, 22, 23]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 24-31).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_3"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_3/gateway/+/event/+"
# Command topic template.
command_topic="cn470_3/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=475100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=475300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=475500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=475700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=475900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=476100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=476300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=476500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[24, 25, 26, 27, 28, 29, 30, 31]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 32-39).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_4"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_4/gateway/+/event/+"
# Command topic template.
command_topic="cn470_4/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=476700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=476900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=477100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=477300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=477500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=477700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=477900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=478100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[32, 33, 34, 35, 36, 37, 38, 39]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 40-47).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_5"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_5/gateway/+/event/+"
# Command topic template.
command_topic="cn470_5/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=478300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=478500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=478700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=478900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=479100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=479300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=479500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=479700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[40, 41, 42, 43, 44, 45, 46, 47]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 48-55).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_6"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_6/gateway/+/event/+"
# Command topic template.
command_topic="cn470_6/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=479900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=480100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=480300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=480500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=480700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=480900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=481100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=481300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[48, 49, 50, 51, 52, 53, 54, 55]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 56-63).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_7"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_7/gateway/+/event/+"
# Command topic template.
command_topic="cn470_7/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=481500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=481700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=481900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=482100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=482300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=482500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=482700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=482900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[56, 57, 58, 59, 60, 61, 62, 63]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 64-71).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_8"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_8/gateway/+/event/+"
# Command topic template.
command_topic="cn470_8/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=483100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=483300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=483500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=483700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=483900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=484100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=484300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=484500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[64, 65, 66, 67, 68, 69, 70, 71]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -0,0 +1,237 @@
# This file contains an example CN470 example (channels 72-79).
[[regions]]
# Name is an use-defined identifier for this region.
name="cn470_9"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="CN470"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Event topic template.
event_topic="cn470_9/gateway/+/event/+"
# Command topic template.
command_topic="cn470_9/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
[[regions.gateway.channels]]
frequency=484700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=484900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=485100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=485300000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=485500000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=485700000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=485900000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
[[regions.gateway.channels]]
frequency=486100000
bandwidth=125000
modulation="LORA"
spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=0
# RX2 frequency (Hz)
rx2_frequency=505300000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Enabled uplink channels.
#
# Use this when ony a sub-set of the by default enabled channels are being
# used. For example when only using the first 8 channels of the US band.
# Note: when left blank / empty array, all channels will be enabled.
enabled_uplink_channels=[72, 73, 74, 75, 76, 77, 78, 79]
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0

View File

@ -1,4 +0,0 @@
[Service]
Environment="MQTT_BROKER_HOST=localhost"
Environment="POSTGRESQL_HOST=localhost"
Environment="REDIS_HOST=localhost"

View File

@ -3,18 +3,11 @@
# Set config-file permissions
chown -R chirpstack:chirpstack /etc/chirpstack
chmod 750 /etc/chirpstack
chmod 750 /etc/chirpstack/certs
chmod 640 /etc/chirpstack/*.toml
# Generate certificates
CERTROOT=/etc/chirpstack/certs
if [ ! -f $CERTROOT/ca.pem ]; then
cfssl gencert -initca $CERTROOT/ca-csr.json | cfssljson -bare $CERTROOT/ca
fi
if [ ! -f $CERTROOT/mqtt-server.pem ]; then
cfssl gencert -ca $CERTROOT/ca.pem -ca-key $CERTROOT/ca-key.pem -config $CERTROOT/ca-config.json -profile server $CERTROOT/mqtt-server.json | cfssljson -bare $CERTROOT/mqtt-server
fi
# Set environment variables to localhost
sed -i "s/\$MQTT_BROKER_HOST/localhost/" /etc/chirpstack/*.toml
sed -i "s/\$POSTGRESQL_HOST/localhost/" /etc/chirpstack/*.toml
sed -i "s/\$REDIS_HOST/localhost/" /etc/chirpstack/*.toml
#DEBHELPER#

View File

@ -172,8 +172,13 @@ impl TenantService for Tenant {
}
}
AuthID::Key(_) => {
// Nothing to do as the validator function already validated that the
// Nothing else to do as the validator function already validated that the
// API key must be a global admin key.
if !req.user_id.is_empty() {
let user_id = Uuid::from_str(&req.user_id).map_err(|e| e.status())?;
filters.user_id = Some(user_id);
}
}
_ => {
// this should never happen
@ -492,6 +497,7 @@ pub mod test {
search: "update".into(),
offset: 0,
limit: 10,
user_id: "".into(),
};
let mut list_req = Request::new(list_req);
list_req.extensions_mut().insert(AuthID::User(u.id.clone()));

View File

@ -104,6 +104,12 @@ pub fn run() {
# This defines how long (after generating) the certificate remains valid.
client_cert_lifetime="{{ gateway.client_cert_lifetime }}"
# Allow unknown gateways.
#
# If set to true, then uplinks received from gateways not configured in
# ChirpStack will be allowed.
allow_unknown_gateways={{ gateway.allow_unknown_gateways }}
# Network related configuration.
[network]

View File

@ -170,7 +170,11 @@ pub async fn encode(
}
}
let v: Vec<u8> = res.get("bytes")?;
// Directly into u8 can result into the following error:
// Error converting from js 'float' into type 'i32'
let v: Vec<f64> = res.get("bytes")?;
let v: Vec<u8> = v.iter().map(|v| *v as u8).collect();
Ok(v)
})
}

View File

@ -89,52 +89,10 @@ pub async fn struct_to_binary(
Ok(match codec {
Codec::NONE => Vec::new(),
Codec::CAYENNE_LPP => cayenne_lpp::encode(obj).context("CayenneLpp encode")?,
Codec::JS => js::encode(f_port, variables, encoder_config, obj)
.await
.context("JavaScript encoder")?,
Codec::JS => js::encode(f_port, variables, encoder_config, obj).await?,
})
}
/*
pub fn get_data_keys(s: &pbjson_types::Struct) -> Vec<String> {
let mut out: Vec<String> = Vec::new();
for (k, v) in &s.fields {
out.extend_from_slice(&_get_data_keys(k, v));
}
out
}
fn _get_data_keys(prefix: &str, v: &pbjson_types::Value) -> Vec<String> {
match &v.kind {
None => vec![prefix.to_string()],
Some(v) => match v {
pbjson_types::value::Kind::NullValue(_)
| pbjson_types::value::Kind::NumberValue(_)
| pbjson_types::value::Kind::StringValue(_)
| pbjson_types::value::Kind::BoolValue(_) => {
vec![prefix.to_string()]
}
pbjson_types::value::Kind::StructValue(v) => {
let mut out: Vec<String> = Vec::new();
for (k, v) in &v.fields {
out.extend_from_slice(&_get_data_keys(&format!("{}_{}", prefix, k), v));
}
out
}
pbjson_types::value::Kind::ListValue(v) => {
let mut out: Vec<String> = Vec::new();
for (i, v) in v.values.iter().enumerate() {
out.extend_from_slice(&_get_data_keys(&format!("{}_{}", prefix, i), v));
}
out
}
},
}
}
*/
pub fn get_measurements(s: &pbjson_types::Struct) -> HashMap<String, pbjson_types::value::Kind> {
let mut out: HashMap<String, pbjson_types::value::Kind> = HashMap::new();

View File

@ -132,6 +132,7 @@ pub struct Gateway {
pub client_cert_lifetime: Duration,
pub ca_cert: String,
pub ca_key: String,
pub allow_unknown_gateways: bool,
}
impl Default for Gateway {
@ -140,6 +141,7 @@ impl Default for Gateway {
client_cert_lifetime: Duration::from_secs(60 * 60 * 24 * 365),
ca_cert: "".to_string(),
ca_key: "".to_string(),
allow_unknown_gateways: false,
}
}
}

View File

@ -142,16 +142,16 @@ impl Data {
ctx.update_device_queue_item().await?;
ctx.save_downlink_frame().await?;
if ctx._is_roaming() {
ctx.save_device_session().await?;
ctx.send_downlink_frame_passive_roaming().await?;
ctx.handle_passive_roaming_tx_ack().await?;
} else {
// Some mac-commands set their state (e.g. last requested) to the device-session.
ctx.save_device_session().await?;
ctx.send_downlink_frame().await?;
}
}
// Some mac-commands set their state (e.g. last requested) to the device-session.
ctx.save_device_session().await?;
Ok(())
}
@ -389,6 +389,8 @@ impl Data {
self._set_rx_parameters().await?;
self._set_tx_parameters().await?;
self.mac_commands = filter_mac_commands(&self.device_session, &self.mac_commands);
Ok(())
}
@ -820,6 +822,7 @@ impl Data {
// Note: this must come before ADR!
async fn _request_channel_mask_reconfiguration(&mut self) -> Result<()> {
trace!("Requesting channel-mask reconfiguration");
let enabled_uplink_channel_indices: Vec<usize> = self
.device_session
.enabled_uplink_channel_indices
@ -1421,3 +1424,233 @@ impl Data {
Ok(false)
}
}
fn filter_mac_commands(
device_session: &internal::DeviceSession,
mac_commands: &[lrwn::MACCommandSet],
) -> Vec<lrwn::MACCommandSet> {
let incompatible_macs: HashMap<lrwn::CID, Vec<lrwn::CID>> = [
(lrwn::CID::NewChannelReq, vec![lrwn::CID::LinkADRReq]),
(lrwn::CID::LinkADRReq, vec![lrwn::CID::NewChannelReq]),
]
.iter()
.cloned()
.collect();
let mut filtered_mac_commands: Vec<lrwn::MACCommandSet> = Vec::new();
'outer: for mac_command_set in mac_commands {
for mac_command in &**mac_command_set {
// Check if it doesn't exceed the max error error count.
if device_session
.mac_command_error_count
.get(&(mac_command.cid().byte() as u32))
.cloned()
.unwrap_or_default()
> 1
{
continue 'outer;
}
// Check if there aren't any conflicting mac-commands.
if let Some(incompatible_cids) = incompatible_macs.get(&mac_command.cid()) {
for mac_command_set in &filtered_mac_commands {
for mac_command in &**mac_command_set {
if incompatible_cids.contains(&mac_command.cid()) {
continue 'outer;
}
}
}
}
}
filtered_mac_commands.push(mac_command_set.clone());
}
filtered_mac_commands
}
#[cfg(test)]
mod test {
use super::*;
struct Test {
device_session: internal::DeviceSession,
mac_commands: Vec<lrwn::MACCommandSet>,
expected_mac_commands: Vec<lrwn::MACCommandSet>,
}
#[test]
fn test_filter_mac_commands() {
let tests = vec![
// No mac-commands set.
Test {
device_session: internal::DeviceSession {
..Default::default()
},
mac_commands: Vec::new(),
expected_mac_commands: Vec::new(),
},
// One LinkADRReq, no errors.
Test {
device_session: internal::DeviceSession {
mac_command_error_count: [(lrwn::CID::LinkADRReq.byte() as u32, 0)]
.iter()
.cloned()
.collect(),
..Default::default()
},
mac_commands: vec![lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::LinkADRReq(lrwn::LinkADRReqPayload {
dr: 0,
tx_power: 0,
ch_mask: lrwn::ChMask::new([false; 16]),
redundancy: lrwn::Redundancy {
ch_mask_cntl: 0,
nb_rep: 0,
},
}),
])],
expected_mac_commands: vec![lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::LinkADRReq(lrwn::LinkADRReqPayload {
dr: 0,
tx_power: 0,
ch_mask: lrwn::ChMask::new([false; 16]),
redundancy: lrwn::Redundancy {
ch_mask_cntl: 0,
nb_rep: 0,
},
}),
])],
},
// One LinkADRReq, 0 errors (HashMap contains the CID, but count = 0).
Test {
device_session: internal::DeviceSession {
mac_command_error_count: [(lrwn::CID::LinkADRReq.byte() as u32, 0)]
.iter()
.cloned()
.collect(),
..Default::default()
},
mac_commands: vec![lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::LinkADRReq(lrwn::LinkADRReqPayload {
dr: 0,
tx_power: 0,
ch_mask: lrwn::ChMask::new([false; 16]),
redundancy: lrwn::Redundancy {
ch_mask_cntl: 0,
nb_rep: 0,
},
}),
])],
expected_mac_commands: vec![lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::LinkADRReq(lrwn::LinkADRReqPayload {
dr: 0,
tx_power: 0,
ch_mask: lrwn::ChMask::new([false; 16]),
redundancy: lrwn::Redundancy {
ch_mask_cntl: 0,
nb_rep: 0,
},
}),
])],
},
// One LinkADRReq, exceeding error count.
Test {
device_session: internal::DeviceSession {
mac_command_error_count: [(lrwn::CID::LinkADRReq.byte() as u32, 2)]
.iter()
.cloned()
.collect(),
..Default::default()
},
mac_commands: vec![lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::LinkADRReq(lrwn::LinkADRReqPayload {
dr: 0,
tx_power: 0,
ch_mask: lrwn::ChMask::new([false; 16]),
redundancy: lrwn::Redundancy {
ch_mask_cntl: 0,
nb_rep: 0,
},
}),
])],
expected_mac_commands: Vec::new(),
},
// NewChannelReq + LinkADRReq
Test {
device_session: Default::default(),
mac_commands: vec![
lrwn::MACCommandSet::new(vec![lrwn::MACCommand::NewChannelReq(
lrwn::NewChannelReqPayload {
ch_index: 3,
freq: 867100000,
min_dr: 0,
max_dr: 5,
},
)]),
lrwn::MACCommandSet::new(vec![lrwn::MACCommand::LinkADRReq(
lrwn::LinkADRReqPayload {
dr: 0,
tx_power: 0,
ch_mask: lrwn::ChMask::new([false; 16]),
redundancy: lrwn::Redundancy {
ch_mask_cntl: 0,
nb_rep: 0,
},
},
)]),
],
expected_mac_commands: vec![lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::NewChannelReq(lrwn::NewChannelReqPayload {
ch_index: 3,
freq: 867100000,
min_dr: 0,
max_dr: 5,
}),
])],
},
// LinkADRReq + NewChannelReq (this order should never happen)
Test {
device_session: Default::default(),
mac_commands: vec![
lrwn::MACCommandSet::new(vec![lrwn::MACCommand::LinkADRReq(
lrwn::LinkADRReqPayload {
dr: 0,
tx_power: 0,
ch_mask: lrwn::ChMask::new([false; 16]),
redundancy: lrwn::Redundancy {
ch_mask_cntl: 0,
nb_rep: 0,
},
},
)]),
lrwn::MACCommandSet::new(vec![lrwn::MACCommand::NewChannelReq(
lrwn::NewChannelReqPayload {
ch_index: 3,
freq: 867100000,
min_dr: 0,
max_dr: 5,
},
)]),
],
expected_mac_commands: vec![lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::LinkADRReq(lrwn::LinkADRReqPayload {
dr: 0,
tx_power: 0,
ch_mask: lrwn::ChMask::new([false; 16]),
redundancy: lrwn::Redundancy {
ch_mask_cntl: 0,
nb_rep: 0,
},
}),
])],
},
];
for test in &tests {
let out = filter_mac_commands(&test.device_session, &test.mac_commands);
assert_eq!(test.expected_mac_commands, out);
}
}
}

View File

@ -70,7 +70,7 @@ impl TxAck {
ctx.decode_phy_payload()?;
if ctx.is_error() {
if ctx.is_application_payload() {
if ctx.is_application_payload() || ctx.is_mac_only_downlink() {
ctx.get_device().await?;
ctx.get_device_profile().await?;
ctx.get_application().await?;
@ -262,7 +262,7 @@ impl TxAck {
let mut ds = self.device_session.as_mut().unwrap();
if ds.mac_version.to_string().starts_with("1.0") {
if ds.mac_version().to_string().starts_with("1.0") {
ds.n_f_cnt_down += 1;
} else {
ds.a_f_cnt_down += 1;

View File

@ -157,7 +157,7 @@ impl<'a> MqttBackend<'a> {
if !conf.ca_cert.is_empty() {
ssl_opts_b
.ca_path(&conf.ca_cert)
.trust_store(&conf.ca_cert)
.context("Failed to set gateway ca_cert")?;
}

View File

@ -62,6 +62,10 @@ pub async fn setup() -> Result<()> {
.await
.context("Setup AMQP integration")?,
)),
"kafka" => integrations.push(Box::new(
kafka::Integration::new(&conf.integration.kafka)
.context("Setup Kafka integration")?,
)),
_ => {
return Err(anyhow!("Unexpected integration: {}", name));
}

View File

@ -4,7 +4,7 @@ use std::io::Cursor;
use anyhow::{Context, Result};
use prost::Message;
use tokio::task;
use tracing::{info, trace, warn};
use tracing::{error, info, trace};
use super::error::Error;
use super::{get_redis_conn, redis_key};
@ -324,16 +324,40 @@ async fn get_dev_euis_for_dev_addr(dev_addr: DevAddr) -> Result<Vec<EUI64>> {
.await?
}
async fn remove_dev_eui_from_dev_addr_set(dev_addr: DevAddr, dev_eui: EUI64) -> Result<()> {
task::spawn_blocking({
let dev_addr = dev_addr;
let dev_eui = dev_eui;
move || -> Result<()> {
let key = redis_key(format!("devaddr:{{{}}}", dev_addr));
let mut c = get_redis_conn()?;
redis::cmd("SREM")
.arg(key)
.arg(&dev_eui.to_be_bytes())
.query(&mut *c)?;
Ok(())
}
})
.await?
}
async fn get_for_dev_addr(dev_addr: DevAddr) -> Result<Vec<internal::DeviceSession>> {
trace!(dev_addr = %dev_addr, "Getting device-session for DevAddr");
let dev_euis = get_dev_euis_for_dev_addr(dev_addr).await?;
let mut out = Vec::new();
for dev_eui in &dev_euis {
let ds = match get(dev_eui).await {
for dev_eui in dev_euis {
let ds = match get(&dev_eui).await {
Ok(v) => v,
Err(e) => {
warn!(dev_addr = %dev_addr, dev_eui = %dev_eui, error = %e, "Get device-session for DevAddr error");
if let Error::NotFound(_) = e {
if let Err(e) = remove_dev_eui_from_dev_addr_set(dev_addr, dev_eui).await {
error!(dev_addr = %dev_addr, dev_eui = %dev_eui, error = %e, "Remove DevEUI from DevAddr->DevEUI set error");
}
} else {
error!(dev_addr = %dev_addr, dev_eui = %dev_eui, error = %e, "Get device-session for DevEUI error");
}
continue;
}
};
@ -667,4 +691,49 @@ pub mod test {
}
}
}
#[tokio::test]
async fn test_get_for_dev_addr() {
let _guard = test::prepare().await;
let dev_eui_1 = EUI64::from_be_bytes([1, 1, 1, 1, 1, 1, 1, 1]);
let dev_eui_2 = EUI64::from_be_bytes([2, 2, 2, 2, 2, 2, 2, 2]);
let dev_addr = DevAddr::from_be_bytes([1, 2, 3, 4]);
let ds_1 = internal::DeviceSession {
dev_addr: dev_addr.to_vec(),
dev_eui: dev_eui_1.to_vec(),
..Default::default()
};
let ds_2 = internal::DeviceSession {
dev_addr: dev_addr.to_vec(),
dev_eui: dev_eui_2.to_vec(),
..Default::default()
};
save(&ds_1).await.unwrap();
save(&ds_2).await.unwrap();
let dss = get_for_dev_addr(dev_addr).await.unwrap();
assert_eq!(2, dss.len());
let dev_euis = get_dev_euis_for_dev_addr(dev_addr).await.unwrap();
assert_eq!(2, dev_euis.len());
// At this point there is still a 'dangling' pointer from DevAddr->DevEUI.
delete(&dev_eui_2).await.unwrap();
let dev_euis = get_dev_euis_for_dev_addr(dev_addr).await.unwrap();
assert_eq!(2, dev_euis.len());
// This should only return one device-session.
let dss = get_for_dev_addr(dev_addr).await.unwrap();
assert_eq!(1, dss.len());
assert_eq!(dev_eui_1.to_vec(), dss[0].dev_eui);
// 'dangling' DevAddr->DevEUI pointers have been cleaned up.
let dev_euis = get_dev_euis_for_dev_addr(dev_addr).await.unwrap();
assert_eq!(1, dev_euis.len());
assert_eq!(dev_eui_1, dev_euis[0]);
}
}

View File

@ -429,6 +429,18 @@ pub mod test {
let t_get = get(&t.id).await.unwrap();
assert_eq!(t, t_get);
// add tenant user for filter by user_id test
let user = create_user().await;
let tu = TenantUser {
tenant_id: t.id,
user_id: user.id,
is_admin: true,
..Default::default()
};
add_user(tu).await.unwrap();
// get_count and list
let tests = vec![
FilterTest {
@ -481,6 +493,16 @@ pub mod test {
limit: 10,
offset: 10,
},
FilterTest {
filter: Filters {
user_id: Some(user.id),
search: None,
},
ts: vec![&t],
count: 1,
limit: 10,
offset: 0,
},
];
for tst in tests {
let count = get_count(&tst.filter).await.unwrap() as usize;

View File

@ -60,6 +60,12 @@ async fn test_fns_uplink() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
time: Some(recv_time.into()),
location: Some(common::Location {
latitude: 0.0,
longitude: 0.0,
altitude: 0.0,
..Default::default()
}),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");

View File

@ -98,6 +98,7 @@ async fn test_gateway_filtering() {
let mut rx_info_a = gw::UplinkRxInfo {
gateway_id: gw_a.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info_a.set_metadata_string("region_name", "eu868");
@ -105,6 +106,7 @@ async fn test_gateway_filtering() {
let mut rx_info_b = gw::UplinkRxInfo {
gateway_id: gw_b.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info_b.set_metadata_string("region_name", "eu868");
@ -247,6 +249,7 @@ async fn test_lorawan_10_errors() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -426,6 +429,7 @@ async fn test_lorawan_11_errors() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -575,6 +579,7 @@ async fn test_lorawan_10_skip_f_cnt() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -763,6 +768,7 @@ async fn test_lorawan_10_device_disabled() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -881,6 +887,7 @@ async fn test_lorawan_10_uplink() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -1495,6 +1502,7 @@ async fn test_lorawan_11_uplink() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -1728,6 +1736,7 @@ async fn test_lorawan_10_rx_delay() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -1936,6 +1945,7 @@ async fn test_lorawan_10_mac_commands() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -2300,6 +2310,7 @@ async fn test_lorawan_11_mac_commands() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -2489,6 +2500,7 @@ async fn test_lorawan_10_device_queue() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -2957,6 +2969,7 @@ async fn test_lorawan_11_device_queue() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -3429,6 +3442,7 @@ async fn test_lorawan_10_adr() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -4266,6 +4280,7 @@ async fn test_lorawan_10_device_status_request() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -4524,6 +4539,7 @@ async fn test_lorawan_11_receive_window_selection() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");

View File

@ -67,6 +67,7 @@ async fn test_fns() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
time: Some(recv_time.into()),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -327,6 +328,7 @@ async fn test_sns() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: "0302030405060708".to_string(),
time: Some(recv_time.into()),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");

View File

@ -106,6 +106,7 @@ async fn test_gateway_filtering() {
let mut rx_info_a = gw::UplinkRxInfo {
gateway_id: gw_a.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info_a.set_metadata_string("region_name", "eu868");
@ -113,6 +114,7 @@ async fn test_gateway_filtering() {
let mut rx_info_b = gw::UplinkRxInfo {
gateway_id: gw_b.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info_b.set_metadata_string("region_name", "eu868");
@ -267,6 +269,7 @@ async fn test_lorawan_10() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");
@ -910,6 +913,7 @@ async fn test_lorawan_11() {
let mut rx_info = gw::UplinkRxInfo {
gateway_id: gw.gateway_id.to_string(),
location: Some(Default::default()),
..Default::default()
};
rx_info.set_metadata_string("region_name", "eu868");

View File

@ -13,7 +13,7 @@ use uuid::Uuid;
use crate::config;
use crate::framelog;
use crate::storage::{gateway, get_redis_conn, redis_key};
use crate::storage::{error::Error as StorageError, gateway, get_redis_conn, redis_key};
use chirpstack_api::{api, common, gw};
use lrwn::region::CommonName;
use lrwn::{MType, PhyPayload, EUI64};
@ -304,11 +304,19 @@ pub async fn handle_uplink(deduplication_id: Uuid, uplink: gw::UplinkFrameSet) -
}
async fn update_gateway_metadata(ufs: &mut UplinkFrameSet) -> Result<()> {
let conf = config::get();
for rx_info in &mut ufs.rx_info_set {
let gw_id = EUI64::from_str(&rx_info.gateway_id)?;
let gw_meta = match gateway::get_meta(&gw_id).await {
Ok(v) => v,
Err(e) => {
if conf.gateway.allow_unknown_gateways {
if let StorageError::NotFound(_) = e {
ufs.gateway_private_map.insert(gw_id, false);
continue;
}
}
error!(
gateway_id = gw_id.to_string().as_str(),
error = format!("{}", e).as_str(),
@ -318,7 +326,6 @@ async fn update_gateway_metadata(ufs: &mut UplinkFrameSet) -> Result<()> {
}
};
let mut rx_info = rx_info.clone();
rx_info.location = Some(common::Location {
latitude: gw_meta.latitude,
longitude: gw_meta.longitude,

View File

@ -3,7 +3,7 @@ name = "lrwn"
description = "Library for encoding / decoding LoRaWAN frames."
homepage = "https://www.chirpstack.io"
license = "MIT"
version = "4.0.0-rc.1"
version = "4.0.0"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2018"
repository = "https://github.com/chirpstack/chirpstack"

View File

@ -1107,7 +1107,7 @@ impl Region for Configuration {
// use the ChMask of the first LinkADRReqPayload, besides
// turning off all 125 kHz this payload contains the ChMask
// for the last block of channels.
if c > 64 {
if c >= 64 {
out[0].ch_mask.set(c % 16, true);
continue;
}
@ -1419,11 +1419,11 @@ pub mod test {
expected_uplink_channels: c.get_uplink_channel_indices(),
expected_link_adr_req_payloads: vec![],
},
// Only activate 0 - 7.
// Only activate 0 - 7 + 64.
Test {
device_channels: c.get_uplink_channel_indices(),
enabled_channels: vec![0, 1, 2, 3, 4, 5, 6, 7],
expected_uplink_channels: vec![0, 1, 2, 3, 4, 5, 6, 7],
enabled_channels: vec![0, 1, 2, 3, 4, 5, 6, 7, 64],
expected_uplink_channels: vec![0, 1, 2, 3, 4, 5, 6, 7, 64],
expected_link_adr_req_payloads: vec![
LinkADRReqPayload {
dr: 0,
@ -1432,7 +1432,10 @@ pub mod test {
ch_mask_cntl: 7,
nb_rep: 0,
},
ch_mask: ChMask::new([false; 16]),
ch_mask: ChMask::new([
true, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false,
]),
},
LinkADRReqPayload {
dr: 0,
@ -1448,6 +1451,42 @@ pub mod test {
},
],
},
// Only activate 0 - 15 + 64 & 65.
Test {
device_channels: c.get_uplink_channel_indices(),
enabled_channels: vec![
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 64, 65,
],
expected_uplink_channels: vec![
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 64, 65,
],
expected_link_adr_req_payloads: vec![
LinkADRReqPayload {
dr: 0,
tx_power: 0,
redundancy: Redundancy {
ch_mask_cntl: 7,
nb_rep: 0,
},
ch_mask: ChMask::new([
true, true, false, false, false, false, false, false, false, false,
false, false, false, false, false, false,
]),
},
LinkADRReqPayload {
dr: 0,
tx_power: 0,
redundancy: Redundancy {
ch_mask_cntl: 0,
nb_rep: 0,
},
ch_mask: ChMask::new([
true, true, true, true, true, true, true, true, true, true, true, true,
true, true, true, true,
]),
},
],
},
];
for tst in &tests {

View File

@ -797,7 +797,7 @@ impl Region for Configuration {
// use the ChMask of the first LinkADRReqPayload, besides
// turning off all 125 kHz this payload contains the ChMask
// for the last block of channels.
if c > 64 {
if c >= 64 {
out[0].ch_mask.set(c % 16, true);
continue;
}
@ -1111,11 +1111,11 @@ pub mod test {
expected_uplink_channels: c.get_uplink_channel_indices(),
expected_link_adr_req_payloads: vec![],
},
// Only activate 0 - 7.
// Only activate 0 - 7 + 64.
Test {
device_channels: c.get_uplink_channel_indices(),
enabled_channels: vec![0, 1, 2, 3, 4, 5, 6, 7],
expected_uplink_channels: vec![0, 1, 2, 3, 4, 5, 6, 7],
enabled_channels: vec![0, 1, 2, 3, 4, 5, 6, 7, 64],
expected_uplink_channels: vec![0, 1, 2, 3, 4, 5, 6, 7, 64],
expected_link_adr_req_payloads: vec![
LinkADRReqPayload {
dr: 0,
@ -1124,7 +1124,10 @@ pub mod test {
ch_mask_cntl: 7,
nb_rep: 0,
},
ch_mask: ChMask::new([false; 16]),
ch_mask: ChMask::new([
true, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false,
]),
},
LinkADRReqPayload {
dr: 0,
@ -1140,6 +1143,42 @@ pub mod test {
},
],
},
// Only activate 0 - 15 + 64 & 65.
Test {
device_channels: c.get_uplink_channel_indices(),
enabled_channels: vec![
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 64, 65,
],
expected_uplink_channels: vec![
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 64, 65,
],
expected_link_adr_req_payloads: vec![
LinkADRReqPayload {
dr: 0,
tx_power: 0,
redundancy: Redundancy {
ch_mask_cntl: 7,
nb_rep: 0,
},
ch_mask: ChMask::new([
true, true, false, false, false, false, false, false, false, false,
false, false, false, false, false, false,
]),
},
LinkADRReqPayload {
dr: 0,
tx_power: 0,
redundancy: Redundancy {
ch_mask_cntl: 0,
nb_rep: 0,
},
ch_mask: ChMask::new([
true, true, true, true, true, true, true, true, true, true, true, true,
true, true, true, true,
]),
},
],
},
];
for tst in &tests {

View File

@ -1,6 +1,6 @@
{
"name": "chirpstack-ui",
"version": "4.0.0-rc.1",
"version": "4.0.0",
"private": true,
"dependencies": {
"@ant-design/colors": "^6.0.0",
@ -68,7 +68,7 @@
"not dead",
"not op_mini all"
],
"proxy": "http://127.0.0.1:8080/",
"proxy": "http://chirpstack:8080/",
"devDependencies": {
"husky": "^7.0.4",
"prettier": "^2.6.2"

View File

@ -17,10 +17,13 @@ interface IProps {
class MetricChart extends Component<IProps> {
render() {
let unit: TimeUnit = "hour";
let tooltipFormat = "LT";
if (this.props.aggregation === Aggregation.DAY) {
unit = "day";
tooltipFormat = "MMM Do";
} else if (this.props.aggregation === Aggregation.MONTH) {
unit = "month";
tooltipFormat = "MMM YYYY";
}
const animation: false = false;
@ -41,6 +44,7 @@ class MetricChart extends Component<IProps> {
type: "time" as const,
time: {
unit: unit,
tooltipFormat: tooltipFormat,
},
},
},

View File

@ -34,7 +34,7 @@ class CreateDeviceProfileTemplate extends Component<RouteComponentProps> {
// - data = Object representing the decoded payload.
function decodeUplink(input) {
return {
object: {
data: {
temp: 22.5
}
};
@ -50,7 +50,7 @@ function decodeUplink(input) {
// - bytes = Byte array containing the downlink payload.
function encodeDownlink(input) {
return {
data: [225, 230, 255, 0]
bytes: [225, 230, 255, 0]
};
}
`;

View File

@ -59,7 +59,7 @@ function decodeUplink(input) {
// - bytes = Byte array containing the downlink payload.
function encodeDownlink(input) {
return {
data: [225, 230, 255, 0]
bytes: [225, 230, 255, 0]
};
}
`;

View File

@ -469,6 +469,7 @@ class DeviceProfileForm extends Component<IProps, IState> {
<Select.Option value={Region.AS923_3}>AS923-3</Select.Option>
<Select.Option value={Region.AS923_4}>AS923-4</Select.Option>
<Select.Option value={Region.AU915}>AU915</Select.Option>
<Select.Option value={Region.CN470}>CN470</Select.Option>
<Select.Option value={Region.CN779}>CN779</Select.Option>
<Select.Option value={Region.EU433}>EU433</Select.Option>
<Select.Option value={Region.EU868}>EU868</Select.Option>

View File

@ -1881,7 +1881,7 @@
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@chirpstack/chirpstack-api-grpc-web@file:../api/grpc-web":
version "4.0.0-rc.1"
version "4.0.0-rc.4"
dependencies:
"@types/google-protobuf" "^3.15.2"
google-protobuf "^3.17.3"