Compare commits

..

10 Commits

Author SHA1 Message Date
2fc762d932 Bump version to 4.11.1 2025-02-10 11:41:05 +00:00
24333f8b5d Bump version to 4.11.1-test.2 2025-02-10 11:10:11 +00:00
99239a82d4 Revert from sqlite-interactive to sqlite. 2025-02-10 10:56:48 +00:00
317c1cb14d Update dev-dependencies to shell.nix. 2025-02-10 10:27:22 +00:00
2e0d034a6b Bump version to 4.11.1 2025-02-07 15:56:39 +00:00
fb59f541b1 Fix ns_time + setting of JSON flag.
These lines were accidentally removed by 922a83597f8aaed089f5c6ed610d20c5aaa91102
when removing the metadata keys as part of the region refactor.
2025-02-03 12:46:04 +00:00
f6374f00f8 Bump version to 4.11.1-test.1 2025-01-30 19:37:17 +00:00
32a9aadbae Re-use http clients within integrations.
This reduces CPU load, especially in case when HTTPS is being used
as connections will be pooled by the http client.
2025-01-30 19:17:44 +00:00
99613014ad Return LinkCheckAns with margin=0 for non-LoRa modulations. 2025-01-22 09:09:27 +00:00
8cb2d4f383 Bump version to 4.11.0 2025-01-15 12:13:04 +00:00
28 changed files with 227 additions and 102 deletions

12
Cargo.lock generated
View File

@ -611,7 +611,7 @@ dependencies = [
[[package]]
name = "backend"
version = "4.11.0-test.2"
version = "4.11.1"
dependencies = [
"aes-kw",
"anyhow",
@ -813,7 +813,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "chirpstack"
version = "4.11.0-test.2"
version = "4.11.1"
dependencies = [
"aes",
"anyhow",
@ -907,7 +907,7 @@ dependencies = [
[[package]]
name = "chirpstack_api"
version = "4.11.0-test.2"
version = "4.11.1"
dependencies = [
"hex",
"pbjson",
@ -924,7 +924,7 @@ dependencies = [
[[package]]
name = "chirpstack_integration"
version = "4.11.0-test.2"
version = "4.11.1"
dependencies = [
"anyhow",
"async-trait",
@ -2668,7 +2668,7 @@ dependencies = [
[[package]]
name = "lrwn"
version = "4.11.0-test.2"
version = "4.11.1"
dependencies = [
"aes",
"anyhow",
@ -2682,7 +2682,7 @@ dependencies = [
[[package]]
name = "lrwn_filters"
version = "4.11.0-test.2"
version = "4.11.1"
dependencies = [
"hex",
"lrwn",

View File

@ -6,11 +6,10 @@ dist:
cd chirpstack && make dist
# Install dev dependencies
# TODO: test latest cargo-deb and move it to shell.nix.
dev-dependencies:
cargo install cross --version 0.2.5
cargo install diesel_cli --version 2.2.1 --no-default-features --features postgres,sqlite
cargo install cargo-deb --version 1.43.1
cargo install cargo-generate-rpm --version 0.12.1
cargo install cargo-deb --version 1.43.1 --locked
cargo install cargo-generate-rpm --version 0.12.1 --locked
# Set the versions
version:

View File

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

View File

@ -8,7 +8,7 @@ plugins {
}
group = "io.chirpstack"
version = "4.11.0-test.2"
version = "4.11.1"
repositories {
mavenCentral()

2
api/js/package.json vendored
View File

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

View File

@ -9,7 +9,7 @@ plugins {
}
group = "io.chirpstack"
version = "4.11.0-test.2"
version = "4.11.1"
repositories {
mavenCentral()

View File

@ -3,7 +3,7 @@
"description": "Chirpstack PHP API",
"license": "MIT",
"type": "library",
"version": "4.11.0-test.2",
"version": "4.11.1",
"require": {
"php": ">=7.0.0",
"grpc/grpc": "^v1.57.0",

View File

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

2
api/rust/Cargo.toml vendored
View File

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

View File

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

View File

@ -3,13 +3,13 @@
description = "Library for building external ChirpStack integrations"
homepage = "https://www.chirpstack.io/"
license = "MIT"
version = "4.11.0-test.2"
version = "4.11.1"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2021"
repository = "https://github.com/chirpstack/chirpstack"
[dependencies]
chirpstack_api = { path = "../api/rust", version = "4.11.0-test.2" }
chirpstack_api = { path = "../api/rust", version = "4.11.1" }
redis = { version = "0.27", features = [
"cluster-async",
"tokio-rustls-comp",

View File

@ -3,7 +3,7 @@
description = "ChirpStack is an open-source LoRaWAN(TM) Network Server"
repository = "https://github.com/chirpstack/chirpstack"
homepage = "https://www.chirpstack.io/"
version = "4.11.0-test.2"
version = "4.11.1"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2021"
publish = false

View File

@ -5,6 +5,7 @@ use std::time::Duration;
use anyhow::Result;
use async_trait::async_trait;
use chrono::Utc;
use handlebars::Handlebars;
use prometheus_client::encoding::EncodeLabelSet;
use prometheus_client::metrics::counter::Counter;
@ -359,6 +360,11 @@ async fn message_callback(
event.v4_migrate();
}
if let Some(rx_info) = &mut event.rx_info {
set_gateway_json(&rx_info.gateway_id, json);
rx_info.ns_time = Some(Utc::now().into());
}
tokio::spawn(uplink::deduplicate_uplink(
region_common_name,
region_config_id.to_string(),

View File

@ -1,9 +1,12 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
use async_trait::async_trait;
use base64::{engine::general_purpose, Engine as _};
use prost::Message;
use reqwest::Client;
use tracing::{info, trace};
use super::Integration as IntegrationTrait;
@ -11,13 +14,25 @@ use crate::storage::application::AwsSnsConfiguration;
use chirpstack_api::api::Encoding;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
json: bool,
access_key_id: String,
secret_access_key: String,
region: String,
topic_arn: String,
client: reqwest::Client,
}
impl Integration {
@ -35,7 +50,6 @@ impl Integration {
access_key_id: conf.access_key_id.clone(),
secret_access_key: conf.secret_access_key.clone(),
region: conf.region.clone(),
client: reqwest::Client::new(),
})
}
@ -97,7 +111,7 @@ impl Integration {
headers.insert(reqwest::header::AUTHORIZATION, s.parse()?);
self.client
get_client()
.post(url)
.headers(headers)
.body(body)

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use anyhow::Result;
@ -16,8 +17,20 @@ use crate::storage::application::AzureServiceBusConfiguration;
use chirpstack_api::api::Encoding;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
timeout: Duration,
json: bool,
uri: String,
key_name: String,
@ -31,7 +44,6 @@ impl Integration {
let kv = parse_connection_string(&conf.connection_string);
Ok(Integration {
timeout: Duration::from_secs(5),
json: match Encoding::try_from(conf.encoding)
.map_err(|_| anyhow!("Invalid encoding"))?
{
@ -65,7 +77,6 @@ impl Integration {
&(SystemTime::now() + Duration::from_secs(60 * 5)),
)?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(AUTHORIZATION, token.parse()?);
@ -89,7 +100,7 @@ impl Integration {
);
info!(event = %event, dev_eui = %dev_eui, "Publishing event");
let res = client
let res = get_client()
.post(format!("{}/messages", self.uri))
.body(pl.to_string())
.headers(headers)
@ -307,7 +318,6 @@ pub mod test {
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
json: true,
uri: server.url(""),
key_name: "key-name".to_string(),

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::{Context, Result};
@ -16,12 +17,24 @@ use crate::storage::application::GcpPubSubConfiguration;
use chirpstack_api::api::Encoding;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
json: bool,
project_id: String,
topic_name: String,
service_account: gcp_auth::CustomServiceAccount,
timeout: Duration,
}
#[derive(Serialize)]
@ -57,7 +70,6 @@ impl Integration {
project_id: conf.project_id.clone(),
topic_name: conf.topic_name.clone(),
service_account,
timeout: Duration::from_secs(5),
})
}
@ -93,7 +105,6 @@ impl Integration {
.await
.context("Get GCP bearer token")?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(
@ -101,7 +112,7 @@ impl Integration {
format!("Bearer {}", token.as_str()).parse().unwrap(),
);
let res = client
let res = get_client()
.post(format!(
"https://pubsub.googleapis.com/v1/{}:publish",
topic

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -12,8 +13,20 @@ use super::Integration as IntegrationTrait;
use crate::storage::application::HttpConfiguration;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
timeout: Duration,
endpoints: Vec<String>,
headers: HashMap<String, String>,
json: bool,
@ -24,7 +37,6 @@ impl Integration {
trace!("Initializing http integration");
Integration {
timeout: Duration::from_secs(5),
headers: conf.headers.clone(),
json: conf.json,
endpoints: conf
@ -36,7 +48,6 @@ impl Integration {
}
async fn post_event(&self, event: &str, b: Vec<u8>) -> Result<()> {
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
for (k, v) in &self.headers {
@ -51,7 +62,7 @@ impl Integration {
for url in &self.endpoints {
info!(event = %event, url = %url, "Posting event");
let res = client
let res = get_client()
.post(url)
.body(b.clone())
.query(&[("event", event)])
@ -214,7 +225,6 @@ pub mod test {
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
endpoints: vec![server.url("/")],
headers: [("Foo".to_string(), "Bar".to_string())]
.iter()

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -13,6 +14,19 @@ use crate::codec;
use crate::storage::application::IftttConfiguration;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
#[derive(Serialize, Deserialize)]
struct Values {
#[serde(skip_serializing_if = "String::is_empty")]
@ -63,12 +77,16 @@ impl Integration {
format!("{}/trigger/{}/with/key/{}", self.server, event, self.key)
};
let client = Client::builder().timeout(Duration::from_secs(5)).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
info!(event = %event, "Sending event to IFTTT");
let res = client.post(url).json(&v).headers(headers).send().await?;
let res = get_client()
.post(url)
.json(&v)
.headers(headers)
.send()
.await?;
match res.error_for_status() {
Ok(_) => Ok(()),
Err(e) => {

View File

@ -1,5 +1,6 @@
use std::collections::HashMap;
use std::fmt;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -13,8 +14,20 @@ use crate::storage::application::InfluxDbConfiguration;
use chirpstack_api::api::{InfluxDbPrecision, InfluxDbVersion};
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
timeout: Duration,
endpoint: String,
version: InfluxDbVersion,
@ -36,7 +49,6 @@ impl Integration {
trace!("Initializing InfluxDB integration");
Ok(Integration {
timeout: Duration::from_secs(5),
endpoint: conf.endpoint.clone(),
version: InfluxDbVersion::try_from(conf.version)
.map_err(|_| anyhow!("Invalid version"))?,
@ -66,8 +78,6 @@ impl Integration {
measurements.sort();
let body = measurements.join("\n");
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "text/plain".parse().unwrap());
if self.version == InfluxDbVersion::Influxdb2 {
@ -87,7 +97,7 @@ impl Integration {
}
}
let mut req = client
let mut req = get_client()
.post(&self.endpoint)
.body(body)
.query(&query)
@ -477,7 +487,6 @@ pub mod test {
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
endpoint: server.url("/write"),
version: InfluxDbVersion::Influxdb1,
db: "testdb".into(),
@ -832,7 +841,6 @@ device_uplink,application_name=test-app,dev_eui=0102030405060708,device_name=tes
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
endpoint: server.url("/write"),
version: InfluxDbVersion::Influxdb2,
db: "".into(),

View File

@ -1,4 +1,5 @@
use std::fmt;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -13,6 +14,19 @@ use crate::gpstime::ToGpsTime;
use crate::uplink::helpers;
use lrwn::EUI64;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
#[derive(Error, Debug)]
pub enum Error {
#[error("No location")]
@ -25,7 +39,6 @@ pub enum Error {
pub struct ApiClient {
uri: String,
token: String,
timeout: Duration,
}
impl ApiClient {
@ -33,7 +46,6 @@ impl ApiClient {
ApiClient {
uri: uri.to_string(),
token: token.to_string(),
timeout: Duration::from_secs(5),
}
}
@ -117,7 +129,6 @@ impl ApiClient {
pub async fn uplink_send(&self, req: &UplinkRequest) -> Result<UplinkResponse> {
let endpoint = format!("{}/api/v1/device/send", self.uri);
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(
@ -125,7 +136,7 @@ impl ApiClient {
self.token.parse()?,
);
let res = client
let res = get_client()
.post(endpoint)
.headers(headers)
.json(req)
@ -138,7 +149,6 @@ impl ApiClient {
async fn request(&self, endpoint: &str, body: &str) -> Result<Response> {
let endpoint = format!("{}{}", self.uri, endpoint);
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(
@ -146,7 +156,7 @@ impl ApiClient {
self.token.parse()?,
);
let res = client
let res = get_client()
.post(endpoint)
.body(body.to_string())
.headers(headers)
@ -160,7 +170,6 @@ impl ApiClient {
async fn v3_request(&self, endpoint: &str, body: &str) -> Result<V3Response> {
let endpoint = format!("{}{}", self.uri, endpoint);
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(
@ -168,7 +177,7 @@ impl ApiClient {
self.token.parse()?,
);
let res = client
let res = get_client()
.post(endpoint)
.body(body.to_string())
.headers(headers)

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -13,6 +14,19 @@ use super::Integration as IntegrationTrait;
use crate::storage::application::MyDevicesConfiguration;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
#[derive(Serialize)]
struct UplinkPayload {
#[serde(rename = "correlationID")]
@ -88,7 +102,6 @@ struct Location {
}
pub struct Integration {
timeout: Duration,
endpoint: String,
}
@ -96,7 +109,6 @@ impl Integration {
pub fn new(conf: &MyDevicesConfiguration) -> Integration {
trace!("Initializing myDevices integration");
Integration {
timeout: Duration::from_secs(5),
endpoint: conf.endpoint.clone(),
}
}
@ -120,11 +132,10 @@ impl IntegrationTrait for Integration {
let pl = UplinkPayload::from_uplink_event(pl);
let b = serde_json::to_string(&pl)?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
let req = client
let req = get_client()
.post(&self.endpoint)
.body(b)
.headers(headers)
@ -204,7 +215,6 @@ pub mod test {
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
endpoint: server.url("/"),
};

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -12,8 +13,20 @@ use super::Integration as IntegrationTrait;
use crate::storage::application::PilotThingsConfiguration;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
timeout: Duration,
server: String,
token: String,
}
@ -23,7 +36,6 @@ impl Integration {
trace!("Initializing Pilot Things integration");
Integration {
timeout: Duration::from_secs(5),
server: conf.server.clone(),
token: conf.token.clone(),
}
@ -45,11 +57,10 @@ impl IntegrationTrait for Integration {
let pl = UplinkPayload::from_uplink_event(pl);
let b = serde_json::to_string(&pl)?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
let res = client
let res = get_client()
.post(endpoint)
.body(b)
.query(&[("token", self.token.clone())])
@ -182,7 +193,6 @@ pub mod test {
let server = MockServer::start();
let i = Integration {
timeout: Duration::from_secs(5),
server: server.url(""),
token: "foo-token".into(),
};

View File

@ -1,4 +1,5 @@
use std::collections::{BTreeMap, HashMap};
use std::sync::OnceLock;
use std::time::Duration;
use anyhow::Result;
@ -12,9 +13,21 @@ use super::Integration as IntegrationTrait;
use crate::storage::application::ThingsBoardConfiguration;
use chirpstack_api::integration;
static CLIENT: OnceLock<Client> = OnceLock::new();
fn get_client() -> Client {
CLIENT
.get_or_init(|| {
Client::builder()
.timeout(Duration::from_secs(5))
.build()
.unwrap()
})
.clone()
}
pub struct Integration {
server: String,
timeout: Duration,
}
impl Integration {
@ -22,7 +35,6 @@ impl Integration {
trace!("Initializing ThingsBoard integration");
Integration {
timeout: Duration::from_secs(5),
server: conf.server.clone(),
}
}
@ -39,11 +51,10 @@ impl Integration {
let endpoint = format!("{}/api/v1/{}/attributes", self.server, access_token);
let b = serde_json::to_string(&attributes)?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
let res = client
let res = get_client()
.post(endpoint)
.body(b)
.headers(headers)
@ -65,11 +76,10 @@ impl Integration {
let endpoint = format!("{}/api/v1/{}/telemetry", self.server, access_token);
let b = serde_json::to_string(&telemetry)?;
let client = Client::builder().timeout(self.timeout).build()?;
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
let res = client
let res = get_client()
.post(endpoint)
.body(b)
.headers(headers)
@ -323,7 +333,6 @@ pub mod test {
let i = Integration {
server: server.url(""),
timeout: Duration::from_secs(5),
};
let mut vars: HashMap<String, String> = HashMap::new();

View File

@ -27,31 +27,40 @@ pub fn handle(
.as_ref()
.ok_or_else(|| anyhow!("parameters can not be None"))?;
if let gw::modulation::Parameters::Lora(pl) = mod_params {
let required_snr = config::get_required_snr_for_sf(pl.spreading_factor as u8)?;
let mut max_snr: f32 = 0.0;
// For non-LoRa modulations, the margin will be set to 0, as it can not be calculated.
// This way, at least the gw_cnt can be provided and the end-device is able to confirm
// it is still connected.
let margin = match mod_params {
gw::modulation::Parameters::Lora(pl) => {
let required_snr = config::get_required_snr_for_sf(pl.spreading_factor as u8)?;
let mut max_snr: f32 = 0.0;
for (i, rx_info) in ufs.rx_info_set.iter().enumerate() {
if i == 0 || rx_info.snr > max_snr {
max_snr = rx_info.snr;
for (i, rx_info) in ufs.rx_info_set.iter().enumerate() {
if i == 0 || rx_info.snr > max_snr {
max_snr = rx_info.snr;
}
}
let margin = max_snr - required_snr;
if margin < 0.0 {
0.0
} else {
margin
}
}
let mut margin = max_snr - required_snr;
if margin < 0.0 {
margin = 0.0;
_ => {
warn!("Modulation does not provide margin to LinkCheckReq");
0.0
}
};
return Ok(Some(lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::LinkCheckAns(lrwn::LinkCheckAnsPayload {
margin: margin as u8,
gw_cnt: ufs.rx_info_set.len() as u8,
}),
])));
}
warn!("Unsupported modulation for LinkCheckReq");
Ok(None)
// We always return a LinkCheckAns, even
Ok(Some(lrwn::MACCommandSet::new(vec![
lrwn::MACCommand::LinkCheckAns(lrwn::LinkCheckAnsPayload {
margin: margin as u8,
gw_cnt: ufs.rx_info_set.len() as u8,
}),
])))
}
#[cfg(test)]

View File

@ -3,7 +3,7 @@
description = "Library for filtering LoRaWAN payloads on DevAddr and JoinEUIs prefixes"
homepage = "https://www.chirpstack.io/"
license = "MIT"
version = "4.11.0-test.2"
version = "4.11.1"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2021"
repository = "https://github.com/chirpstack/chirpstack"

View File

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

View File

@ -7,19 +7,21 @@ pkgs.mkShell {
buildInputs = [
pkgs.cacert
pkgs.rustup
pkgs.protobuf
pkgs.perl
pkgs.cmake
pkgs.clang
pkgs.postgresql # needed to build the diesel cli utility
pkgs.protobuf # api
pkgs.go # go api
pkgs.nodejs # js api + ui
pkgs.yarn
pkgs.protoc-gen-grpc-web # grpc-web api
pkgs.protoc-gen-go # go api
pkgs.protoc-gen-go-grpc
pkgs.protoc-gen-go-grpc # go api
pkgs.protoc-gen-grpc-web # grpc-web api
pkgs.nodejs # js api + ui
pkgs.yarn # ui
pkgs.openssl
pkgs.sqlite
pkgs.sqlite # sqlite binary + library for diesel
pkgs.postgresql # psql binary + library for diesel
pkgs.cargo-cross # cross-compiling
pkgs.diesel-cli # diesel cli
];
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = "-I${pkgs.llvmPackages.libclang.lib}/lib/clang/${pkgs.llvmPackages.libclang.version}/include";

View File

@ -1,6 +1,6 @@
{
"name": "chirpstack-ui",
"version": "4.11.0-test.2",
"version": "4.11.1",
"private": true,
"type": "module",
"scripts": {