Skip to content

Commit 0a68d55

Browse files
committed
Implement preamble and no_crc fields.
1 parent 59b2233 commit 0a68d55

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ edition = "2021"
99
publish = false
1010

1111
[dependencies]
12-
chirpstack_api = { version = "4.5", default-features = false }
12+
chirpstack_api = { version = "4.6.0-test.1", default-features = false }
1313
serde_json = "1.0"
1414
zmq = "0.10"
1515
clap = { version = "4.4", default-features = false, features = [

src/structs.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl RxPk {
239239
};
240240

241241
Ok(RxPk {
242-
time: match &rx_info.time {
242+
time: match &rx_info.gw_time {
243243
Some(v) => match TryInto::<SystemTime>::try_into(v.clone()) {
244244
Ok(v) => v.into(),
245245
Err(_) => Utc::now(),
@@ -561,7 +561,9 @@ impl TxPk {
561561
}
562562
.into(),
563563
polarization_inversion: self.ipol.unwrap_or(true),
564-
..Default::default()
564+
preamble: self.prea.map(|v| v as u32).unwrap_or_default(),
565+
no_crc: self.ncrc.unwrap_or_default(),
566+
code_rate_legacy: "".into(),
565567
})
566568
}
567569
_ => {
@@ -703,7 +705,7 @@ mod tests {
703705
fn test_push_data_rxpk_lora() {
704706
let rx_info = gw::UplinkRxInfo {
705707
gateway_id: "0102030405060708".into(),
706-
time: Some(SystemTime::UNIX_EPOCH.try_into().unwrap()),
708+
gw_time: Some(SystemTime::UNIX_EPOCH.try_into().unwrap()),
707709
time_since_gps_epoch: Some(Duration::from_secs(1).try_into().unwrap()),
708710
rssi: -160,
709711
snr: 5.5,
@@ -762,7 +764,7 @@ mod tests {
762764
fn test_push_data_rxpk_fsk() {
763765
let rx_info = gw::UplinkRxInfo {
764766
gateway_id: "0102030405060708".into(),
765-
time: Some(SystemTime::UNIX_EPOCH.try_into().unwrap()),
767+
gw_time: Some(SystemTime::UNIX_EPOCH.try_into().unwrap()),
766768
time_since_gps_epoch: Some(Duration::from_secs(1).try_into().unwrap()),
767769
rssi: -160,
768770
channel: 1,

0 commit comments

Comments
 (0)