Bump version to 4.7.0

This commit is contained in:
Orne Brocaar
2024-03-13 10:00:37 +00:00
parent c815c6be88
commit 8c875c3bf1
43 changed files with 75 additions and 93 deletions

10
Cargo.lock generated
View File

@ -570,7 +570,7 @@ dependencies = [
[[package]] [[package]]
name = "backend" name = "backend"
version = "4.7.0-test.4" version = "4.7.0"
dependencies = [ dependencies = [
"aes-kw", "aes-kw",
"anyhow", "anyhow",
@ -787,7 +787,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chirpstack" name = "chirpstack"
version = "4.7.0-test.4" version = "4.7.0"
dependencies = [ dependencies = [
"aes", "aes",
"anyhow", "anyhow",
@ -874,7 +874,7 @@ dependencies = [
[[package]] [[package]]
name = "chirpstack_api" name = "chirpstack_api"
version = "4.7.0-test.4" version = "4.7.0"
dependencies = [ dependencies = [
"diesel", "diesel",
"hex", "hex",
@ -2434,7 +2434,7 @@ dependencies = [
[[package]] [[package]]
name = "lrwn" name = "lrwn"
version = "4.7.0-test.4" version = "4.7.0"
dependencies = [ dependencies = [
"aes", "aes",
"anyhow", "anyhow",
@ -2448,7 +2448,7 @@ dependencies = [
[[package]] [[package]]
name = "lrwn_filters" name = "lrwn_filters"
version = "4.7.0-test.4" version = "4.7.0"
dependencies = [ dependencies = [
"hex", "hex",
"lrwn", "lrwn",

View File

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

View File

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

2
api/js/package.json vendored
View File

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

View File

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

View File

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

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

@ -178,7 +178,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chirpstack_api" name = "chirpstack_api"
version = "4.7.0-test.4" version = "4.7.0"
dependencies = [ dependencies = [
"diesel", "diesel",
"hex", "hex",

2
api/rust/Cargo.toml vendored
View File

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

View File

@ -2,13 +2,12 @@ include!(concat!(env!("OUT_DIR"), "/internal/internal.rs"));
#[cfg(feature = "json")] #[cfg(feature = "json")]
include!(concat!(env!("OUT_DIR"), "/internal/internal.serde.rs")); include!(concat!(env!("OUT_DIR"), "/internal/internal.serde.rs"));
#[cfg(feature = "diesel")]
use std::io::Cursor;
#[cfg(feature = "diesel")] #[cfg(feature = "diesel")]
use diesel::{backend::Backend, deserialize, serialize, sql_types::Binary}; use diesel::{backend::Backend, deserialize, serialize, sql_types::Binary};
#[cfg(feature = "diesel")] #[cfg(feature = "diesel")]
use prost::Message; use prost::Message;
#[cfg(feature = "diesel")]
use std::io::Cursor;
impl DeviceSession { impl DeviceSession {
pub fn get_a_f_cnt_down(&self) -> u32 { pub fn get_a_f_cnt_down(&self) -> u32 {
@ -49,10 +48,10 @@ impl serialize::ToSql<Binary, diesel::pg::Pg> for DeviceSession
where where
[u8]: serialize::ToSql<Binary, diesel::pg::Pg>, [u8]: serialize::ToSql<Binary, diesel::pg::Pg>,
{ {
fn to_sql<'b>(&self, out: &mut serialize::Output<'b, '_, diesel::pg::Pg>) -> serialize::Result { fn to_sql(&self, out: &mut serialize::Output<'_, '_, diesel::pg::Pg>) -> serialize::Result {
<[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql( <[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql(
&self.encode_to_vec(), &self.encode_to_vec(),
&mut out.reborrow(), &mut out.reborrow(),
) )
} }
} }

View File

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

View File

@ -423,8 +423,9 @@ impl Client {
} }
} }
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Copy, Clone)] #[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug, Copy, Clone)]
pub enum MessageType { pub enum MessageType {
#[default]
JoinReq, JoinReq,
JoinAns, JoinAns,
RejoinReq, RejoinReq,
@ -441,14 +442,9 @@ pub enum MessageType {
XmitDataAns, XmitDataAns,
} }
impl Default for MessageType { #[derive(Default, Serialize, Deserialize, PartialEq, Eq, Debug, Copy, Clone)]
fn default() -> Self {
MessageType::JoinReq
}
}
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Copy, Clone)]
pub enum ResultCode { pub enum ResultCode {
#[default]
Success, Success,
MICFailed, MICFailed,
JoinReqFailed, JoinReqFailed,
@ -471,12 +467,6 @@ pub enum ResultCode {
Other, Other,
} }
impl Default for ResultCode {
fn default() -> Self {
ResultCode::Success
}
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Copy, Clone)] #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Copy, Clone)]
pub enum RatePolicy { pub enum RatePolicy {
Drop, Drop,

View File

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

View File

@ -1736,7 +1736,7 @@ impl ApplicationService for Application {
application::IftttConfiguration { application::IftttConfiguration {
key: req_int.key.clone(), key: req_int.key.clone(),
uplink_values: [ uplink_values: [
req_int.uplink_values.get(0).cloned().unwrap_or_default(), req_int.uplink_values.first().cloned().unwrap_or_default(),
req_int.uplink_values.get(1).cloned().unwrap_or_default(), req_int.uplink_values.get(1).cloned().unwrap_or_default(),
], ],
arbitrary_json: req_int.arbitrary_json, arbitrary_json: req_int.arbitrary_json,
@ -1820,7 +1820,7 @@ impl ApplicationService for Application {
application::IftttConfiguration { application::IftttConfiguration {
key: req_int.key.clone(), key: req_int.key.clone(),
uplink_values: [ uplink_values: [
req_int.uplink_values.get(0).cloned().unwrap_or_default(), req_int.uplink_values.first().cloned().unwrap_or_default(),
req_int.uplink_values.get(1).cloned().unwrap_or_default(), req_int.uplink_values.get(1).cloned().unwrap_or_default(),
], ],
arbitrary_json: req_int.arbitrary_json, arbitrary_json: req_int.arbitrary_json,

View File

@ -104,7 +104,7 @@ pub async fn _handle_request(bp: BasePayload, b: Vec<u8>) -> http::Response<hype
} }
}; };
match joinserver::get(sender_id) { match joinserver::get(sender_id).await {
Ok(v) => v, Ok(v) => v,
Err(_) => { Err(_) => {
warn!("Unknown SenderID"); warn!("Unknown SenderID");

View File

@ -1,6 +1,7 @@
use std::sync::{Arc, RwLock}; use std::sync::Arc;
use anyhow::Result; use anyhow::Result;
use tokio::sync::RwLock;
use tracing::info; use tracing::info;
use crate::{config, stream}; use crate::{config, stream};
@ -15,7 +16,7 @@ pub async fn setup() -> Result<()> {
info!("Setting up Join Server clients"); info!("Setting up Join Server clients");
let conf = config::get(); let conf = config::get();
let mut clients_w = CLIENTS.write().unwrap(); let mut clients_w = CLIENTS.write().await;
*clients_w = vec![]; *clients_w = vec![];
for js in &conf.join_server.servers { for js in &conf.join_server.servers {
@ -38,8 +39,8 @@ pub async fn setup() -> Result<()> {
Ok(()) Ok(())
} }
pub fn get(join_eui: EUI64) -> Result<Arc<Client>> { pub async fn get(join_eui: EUI64) -> Result<Arc<Client>> {
let clients_r = CLIENTS.read().unwrap(); let clients_r = CLIENTS.read().await;
for client in clients_r.iter() { for client in clients_r.iter() {
if client.0.matches(join_eui) { if client.0.matches(join_eui) {
return Ok(client.1.clone()); return Ok(client.1.clone());
@ -53,7 +54,7 @@ pub fn get(join_eui: EUI64) -> Result<Arc<Client>> {
} }
#[cfg(test)] #[cfg(test)]
pub fn reset() { pub async fn reset() {
let mut clients_w = CLIENTS.write().unwrap(); let mut clients_w = CLIENTS.write().await;
*clients_w = vec![]; *clients_w = vec![];
} }

View File

@ -51,7 +51,7 @@ async fn get_ca_cert(ca_cert_file: &str, ca_key_file: &str) -> Result<Certificat
let params = CertificateParams::from_ca_cert_pem(&ca_cert_s, ca_key) let params = CertificateParams::from_ca_cert_pem(&ca_cert_s, ca_key)
.context("Parse gateway CA certificate")?; .context("Parse gateway CA certificate")?;
Ok(Certificate::from_params(params).context("Init Certificate struct")?) Certificate::from_params(params).context("Init Certificate struct")
} }
// This returns the CA, certificate and private-key as PEM encoded strings. // This returns the CA, certificate and private-key as PEM encoded strings.

View File

@ -623,7 +623,7 @@ impl Data {
let ds = self.device.get_device_session()?; let ds = self.device.get_device_session()?;
self.mac_commands = filter_mac_commands(&ds, &self.mac_commands); self.mac_commands = filter_mac_commands(ds, &self.mac_commands);
Ok(()) Ok(())
} }

View File

@ -38,8 +38,7 @@ pub async fn get_geoloc_buffer(
let rx_info: Vec<gw::UplinkRxInfo> = uplink let rx_info: Vec<gw::UplinkRxInfo> = uplink
.rx_info .rx_info
.iter() .iter()
.cloned() .filter(|&rx_info| {
.filter(|rx_info| {
let ts: DateTime<Utc> = match &rx_info.gw_time { let ts: DateTime<Utc> = match &rx_info.gw_time {
None => { None => {
return false; return false;
@ -55,6 +54,7 @@ pub async fn get_geoloc_buffer(
// The interval between now and then must be smaller than the TTL // The interval between now and then must be smaller than the TTL
(ts - Utc::now()) < ttl (ts - Utc::now()) < ttl
}) })
.cloned()
.collect(); .collect();
if rx_info.len() > 3 { if rx_info.len() > 3 {

View File

@ -134,7 +134,7 @@ impl<'a> Integration<'a> {
command: r"(?P<command>[\w]+)".to_string(), command: r"(?P<command>[\w]+)".to_string(),
}, },
)?)?, )?)?,
qos: qos, qos,
json: conf.json, json: conf.json,
client, client,
templates, templates,

View File

@ -119,7 +119,7 @@ pub async fn save(name: &str, record: &Record) -> Result<()> {
.unwrap(), .unwrap(),
}; };
let key = get_key(&name, a, ts); let key = get_key(name, a, ts);
for (k, v) in &record.metrics { for (k, v) in &record.metrics {
// Passing a reference to hincr will return a runtime error. // Passing a reference to hincr will return a runtime error.

View File

@ -119,7 +119,7 @@ pub async fn get_by_email_and_pw(email: &str, pw: &str) -> Result<User, Error> {
} }
}; };
if verify_password(&pw, &u.password_hash) { if verify_password(pw, &u.password_hash) {
return Ok(u); return Ok(u);
} }

View File

@ -112,7 +112,7 @@ async fn handle_stream(
k: &str, k: &str,
v: &redis::Value, v: &redis::Value,
) -> Result<()> { ) -> Result<()> {
match k.as_ref() { match k {
"up" => { "up" => {
trace!(key = %k, id = %stream_id, "Event-log received from stream"); trace!(key = %k, id = %stream_id, "Event-log received from stream");
if let redis::Value::Data(b) = v { if let redis::Value::Data(b) = v {

View File

@ -276,7 +276,7 @@ async fn handle_stream(
k: &str, k: &str,
v: &redis::Value, v: &redis::Value,
) -> Result<()> { ) -> Result<()> {
match k.as_ref() { match k {
"up" => { "up" => {
trace!(key = %k, id = %stream_id, "Frame-log received from stream"); trace!(key = %k, id = %stream_id, "Frame-log received from stream");
if let redis::Value::Data(b) = v { if let redis::Value::Data(b) = v {

View File

@ -167,7 +167,7 @@ async fn test_fns_uplink() {
sns_pr_start_req_mock.assert(); sns_pr_start_req_mock.assert();
sns_pr_start_req_mock.delete(); sns_pr_start_req_mock.delete();
joinserver::reset(); joinserver::reset().await;
} }
#[tokio::test] #[tokio::test]

View File

@ -246,7 +246,7 @@ async fn test_fns() {
})() })()
.await; .await;
joinserver::reset(); joinserver::reset().await;
} }
#[tokio::test] #[tokio::test]
@ -430,7 +430,7 @@ async fn test_sns() {
pr_start_ans pr_start_ans
); );
joinserver::reset(); joinserver::reset().await;
} }
#[tokio::test] #[tokio::test]
@ -588,5 +588,5 @@ async fn test_sns_roaming_not_allowed() {
pr_start_ans pr_start_ans
); );
joinserver::reset(); joinserver::reset().await;
} }

View File

@ -215,7 +215,7 @@ impl Data {
let mac = if let lrwn::Payload::MACPayload(pl) = &self.phy_payload.payload { let mac = if let lrwn::Payload::MACPayload(pl) = &self.phy_payload.payload {
pl pl
} else { } else {
return Err(Error::AnyhowError(anyhow!("Expected MacPayload"))); return Err(Error::Anyhow(anyhow!("Expected MacPayload")));
}; };
if roaming::is_roaming_dev_addr(mac.fhdr.devaddr) { if roaming::is_roaming_dev_addr(mac.fhdr.devaddr) {
@ -234,7 +234,7 @@ impl Data {
let dev_addr = if let lrwn::Payload::MACPayload(pl) = &self.phy_payload.payload { let dev_addr = if let lrwn::Payload::MACPayload(pl) = &self.phy_payload.payload {
pl.fhdr.devaddr pl.fhdr.devaddr
} else { } else {
return Err(Error::AnyhowError(anyhow!("No MacPayload in PhyPayload"))); return Err(Error::Anyhow(anyhow!("No MacPayload in PhyPayload")));
}; };
match device::get_for_phypayload_and_incr_f_cnt_up( match device::get_for_phypayload_and_incr_f_cnt_up(
@ -277,7 +277,7 @@ impl Data {
return Err(Error::Abort); return Err(Error::Abort);
} }
_ => { _ => {
return Err(Error::AnyhowError( return Err(Error::Anyhow(
anyhow::Error::new(e).context("Get device-session"), anyhow::Error::new(e).context("Get device-session"),
)); ));
} }
@ -295,7 +295,7 @@ impl Data {
let dev_addr = if let lrwn::Payload::MACPayload(pl) = &self.phy_payload.payload { let dev_addr = if let lrwn::Payload::MACPayload(pl) = &self.phy_payload.payload {
pl.fhdr.devaddr pl.fhdr.devaddr
} else { } else {
return Err(Error::AnyhowError(anyhow!("No MacPayload in PhyPayload"))); return Err(Error::Anyhow(anyhow!("No MacPayload in PhyPayload")));
}; };
let dr = relay_ctx.req.metadata.dr; let dr = relay_ctx.req.metadata.dr;
@ -334,7 +334,7 @@ impl Data {
return Err(Error::Abort); return Err(Error::Abort);
} }
_ => { _ => {
return Err(Error::AnyhowError( return Err(Error::Anyhow(
anyhow::Error::new(e).context("Get device-session"), anyhow::Error::new(e).context("Get device-session"),
)); ));
} }

View File

@ -9,5 +9,5 @@ pub enum Error {
RoamingIsNotAllowed, RoamingIsNotAllowed,
#[error(transparent)] #[error(transparent)]
AnyhowError(#[from] anyhow::Error), Anyhow(#[from] anyhow::Error),
} }

View File

@ -136,8 +136,8 @@ pub fn get_time_since_gps_epoch_chrono(rx_info: &[gw::UplinkRxInfo]) -> Option<c
pub fn get_start_location(rx_info: &[gw::UplinkRxInfo]) -> Option<common::Location> { pub fn get_start_location(rx_info: &[gw::UplinkRxInfo]) -> Option<common::Location> {
let mut with_loc: Vec<gw::UplinkRxInfo> = rx_info let mut with_loc: Vec<gw::UplinkRxInfo> = rx_info
.iter() .iter()
.filter(|&i| i.location.is_some())
.cloned() .cloned()
.filter(|i| i.location.is_some())
.collect(); .collect();
with_loc.sort_by(|a, b| a.snr.partial_cmp(&b.snr).unwrap()); with_loc.sort_by(|a, b| a.snr.partial_cmp(&b.snr).unwrap());
with_loc with_loc

View File

@ -258,7 +258,7 @@ impl JoinRequest {
if self.device_keys.is_none() { if self.device_keys.is_none() {
trace!(join_eui = %jr.join_eui, "Getting Join Server client"); trace!(join_eui = %jr.join_eui, "Getting Join Server client");
self.js_client = Some(joinserver::get(jr.join_eui)?); self.js_client = Some(joinserver::get(jr.join_eui).await?);
} }
Ok(()) Ok(())

View File

@ -58,7 +58,7 @@ impl JoinRequest {
trace!("Getting home netid"); trace!("Getting home netid");
trace!(join_eui = %self.join_request.join_eui, "Trying to get join-server client"); trace!(join_eui = %self.join_request.join_eui, "Trying to get join-server client");
let js_client = joinserver::get(self.join_request.join_eui)?; let js_client = joinserver::get(self.join_request.join_eui).await?;
let mut home_ns_req = backend::HomeNSReqPayload { let mut home_ns_req = backend::HomeNSReqPayload {
dev_eui: self.join_request.dev_eui.to_vec(), dev_eui: self.join_request.dev_eui.to_vec(),

View File

@ -162,7 +162,7 @@ impl JoinRequest {
if self.device_keys.is_none() { if self.device_keys.is_none() {
trace!(join_eui = %jr.join_eui, "Getting Join Server client"); trace!(join_eui = %jr.join_eui, "Getting Join Server client");
self.js_client = Some(joinserver::get(jr.join_eui)?); self.js_client = Some(joinserver::get(jr.join_eui).await?);
} }
Ok(()) Ok(())

View File

@ -248,7 +248,7 @@ async fn deduplicate_put(
async fn deduplicate_collect(key: &str) -> Result<gw::UplinkFrameSet> { async fn deduplicate_collect(key: &str) -> Result<gw::UplinkFrameSet> {
let items_b: Vec<Vec<u8>> = { let items_b: Vec<Vec<u8>> = {
redis::cmd("SMEMBERS") redis::cmd("SMEMBERS")
.arg(&key) .arg(key)
.query_async(&mut get_async_redis_conn().await?) .query_async(&mut get_async_redis_conn().await?)
.await .await
.context("Deduplication collect")? .context("Deduplication collect")?
@ -285,7 +285,7 @@ async fn deduplicate_collect(key: &str) -> Result<gw::UplinkFrameSet> {
pub async fn handle_uplink(deduplication_id: Uuid, uplink: gw::UplinkFrameSet) -> Result<()> { pub async fn handle_uplink(deduplication_id: Uuid, uplink: gw::UplinkFrameSet) -> Result<()> {
let rx_info = &uplink let rx_info = &uplink
.rx_info .rx_info
.get(0) .first()
.context("Unable to get first item from rx_info")?; .context("Unable to get first item from rx_info")?;
let region_config_id = rx_info let region_config_id = rx_info

View File

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

View File

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

View File

@ -130,7 +130,7 @@ impl serialize::ToSql<Binary, diesel::pg::Pg> for AES128Key
where where
[u8]: serialize::ToSql<Binary, diesel::pg::Pg>, [u8]: serialize::ToSql<Binary, diesel::pg::Pg>,
{ {
fn to_sql<'b>(&self, out: &mut serialize::Output<'b, '_, diesel::pg::Pg>) -> serialize::Result { fn to_sql(&self, out: &mut serialize::Output<'_, '_, diesel::pg::Pg>) -> serialize::Result {
<[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql( <[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql(
&self.to_bytes(), &self.to_bytes(),
&mut out.reborrow(), &mut out.reborrow(),

View File

@ -273,7 +273,7 @@ impl serialize::ToSql<Binary, diesel::pg::Pg> for DevAddr
where where
[u8]: serialize::ToSql<Binary, diesel::pg::Pg>, [u8]: serialize::ToSql<Binary, diesel::pg::Pg>,
{ {
fn to_sql<'b>(&self, out: &mut serialize::Output<'b, '_, diesel::pg::Pg>) -> serialize::Result { fn to_sql(&self, out: &mut serialize::Output<'_, '_, diesel::pg::Pg>) -> serialize::Result {
<[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql( <[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql(
&self.to_be_bytes(), &self.to_be_bytes(),
&mut out.reborrow(), &mut out.reborrow(),

View File

@ -138,7 +138,7 @@ impl serialize::ToSql<Binary, diesel::pg::Pg> for EUI64
where where
[u8]: serialize::ToSql<Binary, diesel::pg::Pg>, [u8]: serialize::ToSql<Binary, diesel::pg::Pg>,
{ {
fn to_sql<'b>(&self, out: &mut serialize::Output<'b, '_, diesel::pg::Pg>) -> serialize::Result { fn to_sql(&self, out: &mut serialize::Output<'_, '_, diesel::pg::Pg>) -> serialize::Result {
<[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql( <[u8] as serialize::ToSql<Binary, diesel::pg::Pg>>::to_sql(
&self.to_be_bytes(), &self.to_be_bytes(),
&mut out.reborrow(), &mut out.reborrow(),
@ -197,7 +197,7 @@ impl FromStr for EUI64Prefix {
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let s = s.to_string(); let s = s.to_string();
let mut size: u64 = 64; let mut size: u64 = 64;
let parts: Vec<&str> = s.split("/").collect(); let parts: Vec<&str> = s.split('/').collect();
if parts.len() == 2 { if parts.len() == 2 {
size = parts[1].parse().map_err(|_| Error::EUI64PrefixFormat)?; size = parts[1].parse().map_err(|_| Error::EUI64PrefixFormat)?;
} }

View File

@ -1891,7 +1891,7 @@ impl serialize::ToSql<SmallInt, diesel::pg::Pg> for RelayModeActivation
where where
i16: serialize::ToSql<SmallInt, diesel::pg::Pg>, i16: serialize::ToSql<SmallInt, diesel::pg::Pg>,
{ {
fn to_sql<'b>(&self, out: &mut serialize::Output<'b, '_, diesel::pg::Pg>) -> serialize::Result { fn to_sql(&self, out: &mut serialize::Output<'_, '_, diesel::pg::Pg>) -> serialize::Result {
let i = self.to_u8() as i16; let i = self.to_u8() as i16;
<i16 as serialize::ToSql<SmallInt, diesel::pg::Pg>>::to_sql(&i, &mut out.reborrow()) <i16 as serialize::ToSql<SmallInt, diesel::pg::Pg>>::to_sql(&i, &mut out.reborrow())
} }
@ -2191,7 +2191,7 @@ impl PayloadCodec for UpdateUplinkListReqPayload {
let mut b = [0; 26]; let mut b = [0; 26];
cur.read_exact(&mut b)?; cur.read_exact(&mut b)?;
return Ok(UpdateUplinkListReqPayload { Ok(UpdateUplinkListReqPayload {
uplink_list_idx: b[0] & 0x0f, uplink_list_idx: b[0] & 0x0f,
uplink_limit: UplinkLimitPL::from_u8(b[1]), uplink_limit: UplinkLimitPL::from_u8(b[1]),
dev_addr: crate::DevAddr::from_le_bytes({ dev_addr: crate::DevAddr::from_le_bytes({
@ -2209,7 +2209,7 @@ impl PayloadCodec for UpdateUplinkListReqPayload {
bb.copy_from_slice(&b[10..26]); bb.copy_from_slice(&b[10..26]);
bb bb
}), }),
}); })
} }
fn encode(&self) -> Result<Vec<u8>> { fn encode(&self) -> Result<Vec<u8>> {
@ -2432,7 +2432,7 @@ impl PowerLevel {
pub fn from_bytes(b: [u8; 2]) -> Self { pub fn from_bytes(b: [u8; 2]) -> Self {
PowerLevel { PowerLevel {
wor_snr: (b[0] & 0x1f) as isize - 20, wor_snr: (b[0] & 0x1f) as isize - 20,
wor_rssi: -1 * ((b[0] >> 5) | ((b[1] & 0x0f) << 3)) as isize - 15, wor_rssi: -(((b[0] >> 5) | ((b[1] & 0x0f) << 3)) as isize) - 15,
} }
} }
@ -2456,7 +2456,7 @@ impl PowerLevel {
// Encode values // Encode values
let wor_snr = (wor_snr + 20) as u8; let wor_snr = (wor_snr + 20) as u8;
let wor_rssi = ((wor_rssi as isize + 15) * -1) as u8; let wor_rssi = -(wor_rssi + 15) as u8;
[wor_snr | wor_rssi << 5, wor_rssi >> 3] [wor_snr | wor_rssi << 5, wor_rssi >> 3]
} }

View File

@ -54,7 +54,7 @@ impl NetID {
match self.netid_type() { match self.netid_type() {
0 | 1 => self.get_id(6), 0 | 1 => self.get_id(6),
2 => self.get_id(9), 2 => self.get_id(9),
3 | 4 | 5 | 6 | 7 => self.get_id(21), 3..=7 => self.get_id(21),
_ => vec![], _ => vec![],
} }
} }

View File

@ -1176,11 +1176,7 @@ impl Region for Configuration {
for pl in pls { for pl in pls {
if pl.redundancy.ch_mask_cntl == 6 || pl.redundancy.ch_mask_cntl == 7 { if pl.redundancy.ch_mask_cntl == 6 || pl.redundancy.ch_mask_cntl == 7 {
for cm in ch_mask.iter_mut().take(64) { for cm in ch_mask.iter_mut().take(64) {
if pl.redundancy.ch_mask_cntl == 6 { *cm = pl.redundancy.ch_mask_cntl == 6;
*cm = true;
} else {
*cm = false;
}
} }
for (i, cm) in pl.ch_mask.into_iter().enumerate() { for (i, cm) in pl.ch_mask.into_iter().enumerate() {

View File

@ -864,11 +864,7 @@ impl Region for Configuration {
for pl in pls { for pl in pls {
if pl.redundancy.ch_mask_cntl == 6 || pl.redundancy.ch_mask_cntl == 7 { if pl.redundancy.ch_mask_cntl == 6 || pl.redundancy.ch_mask_cntl == 7 {
for cm in ch_mask.iter_mut().take(64) { for cm in ch_mask.iter_mut().take(64) {
if pl.redundancy.ch_mask_cntl == 6 { *cm = pl.redundancy.ch_mask_cntl == 6;
*cm = true;
} else {
*cm = false;
}
} }
for (i, cm) in pl.ch_mask.into_iter().enumerate() { for (i, cm) in pl.ch_mask.into_iter().enumerate() {

View File

@ -19,7 +19,7 @@ impl UplinkMetadata {
UplinkMetadata { UplinkMetadata {
dr: b[0] & 0x0f, dr: b[0] & 0x0f,
snr: ((b[0] >> 4) | ((b[1] & 0x01) << 4)) as isize - 20, snr: ((b[0] >> 4) | ((b[1] & 0x01) << 4)) as isize - 20,
rssi: -1 * (b[1] >> 1) as isize - 15, rssi: -((b[1] >> 1) as isize) - 15,
wor_channel: b[2] & 0x03, wor_channel: b[2] & 0x03,
} }
} }
@ -52,7 +52,7 @@ impl UplinkMetadata {
// Encode values // Encode values
let snr = (snr + 20) as u8; let snr = (snr + 20) as u8;
let rssi = ((rssi as isize + 15) * -1) as u8; let rssi = -(rssi + 15) as u8;
Ok([self.dr | snr << 4, snr >> 4 | rssi << 1, self.wor_channel]) Ok([self.dr | snr << 4, snr >> 4 | rssi << 1, self.wor_channel])
} }
@ -97,7 +97,7 @@ pub struct ForwardDownlinkReq {
impl ForwardDownlinkReq { impl ForwardDownlinkReq {
pub fn from_slice(b: &[u8]) -> Result<Self> { pub fn from_slice(b: &[u8]) -> Result<Self> {
Ok(ForwardDownlinkReq { Ok(ForwardDownlinkReq {
payload: Box::new(PhyPayload::from_slice(&b)?), payload: Box::new(PhyPayload::from_slice(b)?),
}) })
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "chirpstack-ui", "name": "chirpstack-ui",
"version": "4.7.0-test.4", "version": "4.7.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@ant-design/colors": "^7.0.0", "@ant-design/colors": "^7.0.0",