Make it explicit that tx power is in EIRP + fixes.

Historically, the tx power was defined as ERP. The Semtech UDP Packet
Forwarder protocol was never explicit if the "powe" field was in ERP or
EIRP. However, as the antenna gain in the Semtech UDP Packet Forwarder
is documented as dBi and is deducted from the "powe" field, this means
that "powe" is in EIRP.

This commit corrects all values to EIRP, to make sure that if the
antenna gain is properly configured (which should be), that the correct
rf_power is used by the gateway.
This commit is contained in:
Orne Brocaar
2023-10-12 15:36:11 +01:00
parent 89a44dcf6b
commit 5e63c5efe0
57 changed files with 98 additions and 82 deletions

View File

@ -368,7 +368,7 @@ message DownlinkTxInfoLegacy {
// TX frequency (in Hz). // TX frequency (in Hz).
uint32 frequency = 5; uint32 frequency = 5;
// TX power (in dBm). // TX power (in dBm EIRP).
int32 power = 6; int32 power = 6;
// Modulation. // Modulation.
@ -411,7 +411,7 @@ message DownlinkTxInfo {
// TX frequency (in Hz). // TX frequency (in Hz).
uint32 frequency = 1; uint32 frequency = 1;
// TX power (in dBm). // TX power (in dBm EIRP).
int32 power = 2; int32 power = 2;
// Modulation. // Modulation.

View File

@ -153,7 +153,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -153,7 +153,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -153,7 +153,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -153,7 +153,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -189,7 +189,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -159,7 +159,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -159,7 +159,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -201,7 +201,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -159,7 +159,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -159,7 +159,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -159,7 +159,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -153,7 +153,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -195,7 +195,7 @@
# try to schedule the downlink in RX2, failing that it will try RX1. # try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm) # Downlink TX Power (in dBm EIRP)
# #
# When set to -1, the downlink TX Power from the configured band will # When set to -1, the downlink TX Power from the configured band will
# be used. # be used.

View File

@ -2046,7 +2046,9 @@ impl Data {
if self.network_conf.downlink_tx_power != -1 { if self.network_conf.downlink_tx_power != -1 {
tx_info.power = self.network_conf.downlink_tx_power; tx_info.power = self.network_conf.downlink_tx_power;
} else { } else {
tx_info.power = self.region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = self
.region_conf
.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
} }
// set timestamp // set timestamp
@ -2111,7 +2113,9 @@ impl Data {
if self.network_conf.downlink_tx_power != -1 { if self.network_conf.downlink_tx_power != -1 {
tx_info.power = self.network_conf.downlink_tx_power; tx_info.power = self.network_conf.downlink_tx_power;
} else { } else {
tx_info.power = self.region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = self
.region_conf
.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
} }
// set timestamp // set timestamp
@ -2189,7 +2193,9 @@ impl Data {
if self.network_conf.downlink_tx_power != -1 { if self.network_conf.downlink_tx_power != -1 {
tx_info.power = self.network_conf.downlink_tx_power; tx_info.power = self.network_conf.downlink_tx_power;
} else { } else {
tx_info.power = self.region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = self
.region_conf
.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
} }
// set timestamp // set timestamp
@ -2257,7 +2263,9 @@ impl Data {
if self.network_conf.downlink_tx_power != -1 { if self.network_conf.downlink_tx_power != -1 {
tx_info.power = self.network_conf.downlink_tx_power; tx_info.power = self.network_conf.downlink_tx_power;
} else { } else {
tx_info.power = self.region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = self
.region_conf
.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
} }
// set timestamp // set timestamp
@ -2338,7 +2346,9 @@ impl Data {
if self.network_conf.downlink_tx_power != -1 { if self.network_conf.downlink_tx_power != -1 {
tx_info.power = self.network_conf.downlink_tx_power; tx_info.power = self.network_conf.downlink_tx_power;
} else { } else {
tx_info.power = self.region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = self
.region_conf
.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
} }
// set timing // set timing
@ -2448,7 +2458,7 @@ impl Data {
let tx_power_rx1 = if self.network_conf.downlink_tx_power != -1 { let tx_power_rx1 = if self.network_conf.downlink_tx_power != -1 {
self.network_conf.downlink_tx_power self.network_conf.downlink_tx_power
} else { } else {
self.region_conf.get_downlink_tx_power( self.region_conf.get_downlink_tx_power_eirp(
self.region_conf.get_rx1_frequency_for_uplink_frequency( self.region_conf.get_rx1_frequency_for_uplink_frequency(
self.uplink_frame_set.as_ref().unwrap().tx_info.frequency, self.uplink_frame_set.as_ref().unwrap().tx_info.frequency,
)?, )?,
@ -2459,7 +2469,7 @@ impl Data {
self.network_conf.downlink_tx_power self.network_conf.downlink_tx_power
} else { } else {
self.region_conf self.region_conf
.get_downlink_tx_power(self.device_session.rx2_frequency) .get_downlink_tx_power_eirp(self.device_session.rx2_frequency)
as i32 as i32
}; };

View File

@ -93,7 +93,7 @@ impl Data {
..Default::default() ..Default::default()
}; };
tx_info.power = region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = region_conf.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
let rx1_dr = region_conf.get_data_rate(self.dl_meta_data.data_rate_1.unwrap())?; let rx1_dr = region_conf.get_data_rate(self.dl_meta_data.data_rate_1.unwrap())?;
helpers::set_tx_info_data_rate(&mut tx_info, &rx1_dr)?; helpers::set_tx_info_data_rate(&mut tx_info, &rx1_dr)?;
@ -125,7 +125,7 @@ impl Data {
..Default::default() ..Default::default()
}; };
tx_info.power = region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = region_conf.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
let rx2_dr = region_conf.get_data_rate(self.dl_meta_data.data_rate_2.unwrap())?; let rx2_dr = region_conf.get_data_rate(self.dl_meta_data.data_rate_2.unwrap())?;
helpers::set_tx_info_data_rate(&mut tx_info, &rx2_dr)?; helpers::set_tx_info_data_rate(&mut tx_info, &rx2_dr)?;

View File

@ -256,7 +256,9 @@ impl JoinAccept<'_> {
if self.network_conf.downlink_tx_power != -1 { if self.network_conf.downlink_tx_power != -1 {
tx_info.power = self.network_conf.downlink_tx_power; tx_info.power = self.network_conf.downlink_tx_power;
} else { } else {
tx_info.power = self.region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = self
.region_conf
.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
} }
// Set timestamp. // Set timestamp.
@ -313,7 +315,9 @@ impl JoinAccept<'_> {
if self.network_conf.downlink_tx_power != -1 { if self.network_conf.downlink_tx_power != -1 {
tx_info.power = self.network_conf.downlink_tx_power; tx_info.power = self.network_conf.downlink_tx_power;
} else { } else {
tx_info.power = self.region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = self
.region_conf
.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
} }
// Set timestamp. // Set timestamp.
@ -365,7 +369,9 @@ impl JoinAccept<'_> {
if self.network_conf.downlink_tx_power != -1 { if self.network_conf.downlink_tx_power != -1 {
tx_info.power = self.network_conf.downlink_tx_power; tx_info.power = self.network_conf.downlink_tx_power;
} else { } else {
tx_info.power = self.region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = self
.region_conf
.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
} }
// Set timestamp. // Set timestamp.
@ -416,7 +422,9 @@ impl JoinAccept<'_> {
if self.network_conf.downlink_tx_power != -1 { if self.network_conf.downlink_tx_power != -1 {
tx_info.power = self.network_conf.downlink_tx_power; tx_info.power = self.network_conf.downlink_tx_power;
} else { } else {
tx_info.power = self.region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = self
.region_conf
.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
} }
// Set timestamp. // Set timestamp.

View File

@ -136,7 +136,7 @@ impl Multicast {
if network_conf.downlink_tx_power != -1 { if network_conf.downlink_tx_power != -1 {
tx_info.power = network_conf.downlink_tx_power; tx_info.power = network_conf.downlink_tx_power;
} else { } else {
tx_info.power = region_conf.get_downlink_tx_power(tx_info.frequency) as i32; tx_info.power = region_conf.get_downlink_tx_power_eirp(tx_info.frequency) as i32;
} }
match self.multicast_group_queue_item.emit_at_time_since_gps_epoch { match self.multicast_group_queue_item.emit_at_time_since_gps_epoch {

View File

@ -148,7 +148,7 @@ impl PassiveRoamingDownlink {
power: if self.network_conf.downlink_tx_power != -1 { power: if self.network_conf.downlink_tx_power != -1 {
self.network_conf.downlink_tx_power self.network_conf.downlink_tx_power
} else { } else {
self.region_conf.get_downlink_tx_power(dl_freq_1) as i32 self.region_conf.get_downlink_tx_power_eirp(dl_freq_1) as i32
}, },
..Default::default() ..Default::default()
}; };
@ -190,7 +190,7 @@ impl PassiveRoamingDownlink {
power: if self.network_conf.downlink_tx_power != -1 { power: if self.network_conf.downlink_tx_power != -1 {
self.network_conf.downlink_tx_power self.network_conf.downlink_tx_power
} else { } else {
self.region_conf.get_downlink_tx_power(dl_freq_2) as i32 self.region_conf.get_downlink_tx_power_eirp(dl_freq_2) as i32
}, },
..Default::default() ..Default::default()
}; };

View File

@ -844,8 +844,8 @@ impl Region for Configuration {
Ok(923400000 - self.freq_offset) Ok(923400000 - self.freq_offset)
} }
fn get_downlink_tx_power(&self, _freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, _frequency: u32) -> isize {
14 16
} }
fn get_defaults(&self) -> Defaults { fn get_defaults(&self) -> Defaults {

View File

@ -992,8 +992,8 @@ impl Region for Configuration {
Ok(self.base.downlink_channels[down_channel].frequency) Ok(self.base.downlink_channels[down_channel].frequency)
} }
fn get_downlink_tx_power(&self, _freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, _frequency: u32) -> isize {
27 30
} }
fn get_defaults(&self) -> Defaults { fn get_defaults(&self) -> Defaults {

View File

@ -462,8 +462,8 @@ impl Region for Configuration {
Ok(beacon_freqs[down_channel]) Ok(beacon_freqs[down_channel])
} }
fn get_downlink_tx_power(&self, _freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, _frequency: u32) -> isize {
14 19
} }
fn get_defaults(&self) -> Defaults { fn get_defaults(&self) -> Defaults {

View File

@ -440,8 +440,8 @@ impl Region for Configuration {
Ok(785000000) Ok(785000000)
} }
fn get_downlink_tx_power(&self, _freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, _frequency: u32) -> isize {
10 12
} }
fn get_defaults(&self) -> Defaults { fn get_defaults(&self) -> Defaults {

View File

@ -484,8 +484,8 @@ impl Region for Configuration {
Ok(434665000) Ok(434665000)
} }
fn get_downlink_tx_power(&self, _freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, _frequency: u32) -> isize {
10 12
} }
fn get_defaults(&self) -> Defaults { fn get_defaults(&self) -> Defaults {

View File

@ -601,15 +601,13 @@ impl Region for Configuration {
Ok(869525000) Ok(869525000)
} }
fn get_downlink_tx_power(&self, freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, freq: u32) -> isize {
// NOTE: as there are currently no further boundary checks on the frequency, this check is sufficient.
// TODO: However, there should be some mechanism, that checks the frequency for compliance to regulations.
if (863000000..869200000).contains(&freq) { if (863000000..869200000).contains(&freq) {
14 //25mW 16
} else if (869400000..869650000).contains(&freq) { } else if (869400000..869650000).contains(&freq) {
27 //500mW 29
} else { } else {
14 // Default case 16
} }
} }

View File

@ -390,8 +390,8 @@ impl Region for Configuration {
Ok(866550000) Ok(866550000)
} }
fn get_downlink_tx_power(&self, _freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, _frequency: u32) -> isize {
27 30
} }
fn get_defaults(&self) -> Defaults { fn get_defaults(&self) -> Defaults {

View File

@ -266,7 +266,7 @@ impl Region for Configuration {
Ok(2424000000) Ok(2424000000)
} }
fn get_downlink_tx_power(&self, _freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, _frequency: u32) -> isize {
10 10
} }

View File

@ -362,7 +362,7 @@ impl Region for Configuration {
Ok(923100000) Ok(923100000)
} }
fn get_downlink_tx_power(&self, _freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, _frequency: u32) -> isize {
23 23
} }

View File

@ -447,7 +447,7 @@ pub trait Region {
/// Returns the TX power for downlink transmissions using the given frequency. /// Returns the TX power for downlink transmissions using the given frequency.
/// Depending the band, it could return different values for different frequencies. /// Depending the band, it could return different values for different frequencies.
fn get_downlink_tx_power(&self, frequency: u32) -> isize; fn get_downlink_tx_power_eirp(&self, frequency: u32) -> isize;
/// Returns the defaults. /// Returns the defaults.
fn get_defaults(&self) -> Defaults; fn get_defaults(&self) -> Defaults;

View File

@ -340,8 +340,8 @@ impl Region for Configuration {
Ok(868900000) Ok(868900000)
} }
fn get_downlink_tx_power(&self, _freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, _frequency: u32) -> isize {
14 16
} }
fn get_defaults(&self) -> Defaults { fn get_defaults(&self) -> Defaults {

View File

@ -680,8 +680,8 @@ impl Region for Configuration {
Ok(self.base.downlink_channels[down_channel].frequency) Ok(self.base.downlink_channels[down_channel].frequency)
} }
fn get_downlink_tx_power(&self, _freq: u32) -> isize { fn get_downlink_tx_power_eirp(&self, _frequency: u32) -> isize {
20 21
} }
fn get_defaults(&self) -> Defaults { fn get_defaults(&self) -> Defaults {