mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-06-17 06:48:24 +00:00
Fix mixing of Class-B _k
vs _periodicity
.
In the UI the k value (LoRaWAN < 1.0.4) was used as periodicity (LoRaWAN 1.0.4). This renames the `_nb_k` fields to `_periodicity` to align with the LoRaWAN 1.0.4 spec and updates the backend code to use this value as periodicity as defined by the LoRaWAN 1.0.4 spec. Fixes #670.
This commit is contained in:
10
api/proto/api/device_profile.proto
vendored
10
api/proto/api/device_profile.proto
vendored
@ -240,11 +240,15 @@ message DeviceProfile {
|
|||||||
// from the device (if requested).
|
// from the device (if requested).
|
||||||
uint32 class_b_timeout = 16;
|
uint32 class_b_timeout = 16;
|
||||||
|
|
||||||
// Class-B ping-slots per beacon period.
|
// Class-B ping-slot periodicity.
|
||||||
// Valid options are: 0 - 7.
|
// Valid options are: 0 - 7.
|
||||||
//
|
//
|
||||||
// The actual number of ping-slots per beacon period equals to 2^k.
|
// Number of ping-slots per beacon-period:
|
||||||
uint32 class_b_ping_slot_nb_k = 17;
|
// pingNb = 2^(7-periodicity)
|
||||||
|
//
|
||||||
|
// Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec
|
||||||
|
// Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec
|
||||||
|
uint32 class_b_ping_slot_periodicity = 17;
|
||||||
|
|
||||||
// Class-B ping-slot DR.
|
// Class-B ping-slot DR.
|
||||||
uint32 class_b_ping_slot_dr = 18;
|
uint32 class_b_ping_slot_dr = 18;
|
||||||
|
10
api/proto/api/device_profile_template.proto
vendored
10
api/proto/api/device_profile_template.proto
vendored
@ -117,11 +117,15 @@ message DeviceProfileTemplate {
|
|||||||
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
|
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
|
||||||
uint32 class_b_timeout = 18;
|
uint32 class_b_timeout = 18;
|
||||||
|
|
||||||
// Class-B ping-slots per beacon period.
|
// Class-B ping-slot periodicity (only for Class-B).
|
||||||
// Valid options are: 0 - 7.
|
// Valid options are: 0 - 7.
|
||||||
//
|
//
|
||||||
// The actual number of ping-slots per beacon period equals to 2^k.
|
// Number of ping-slots per beacon-period:
|
||||||
uint32 class_b_ping_slot_nb_k = 19;
|
// pingNb = 2^(7-periodicity)
|
||||||
|
//
|
||||||
|
// Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec
|
||||||
|
// Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec
|
||||||
|
uint32 class_b_ping_slot_periodicity = 19;
|
||||||
|
|
||||||
// Class-B ping-slot DR.
|
// Class-B ping-slot DR.
|
||||||
uint32 class_b_ping_slot_dr = 20;
|
uint32 class_b_ping_slot_dr = 20;
|
||||||
|
9
api/proto/api/fuota.proto
vendored
9
api/proto/api/fuota.proto
vendored
@ -104,7 +104,14 @@ message FuotaDeployment {
|
|||||||
uint32 multicast_dr = 7;
|
uint32 multicast_dr = 7;
|
||||||
|
|
||||||
// Multicast ping-slot period (Class-B only).
|
// Multicast ping-slot period (Class-B only).
|
||||||
uint32 multicast_class_b_ping_slot_nb_k = 8;
|
// Valid options are: 0 - 7.
|
||||||
|
//
|
||||||
|
// Number of ping-slots per beacon-period:
|
||||||
|
// pingNb = 2^(7-periodicity)
|
||||||
|
//
|
||||||
|
// Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec
|
||||||
|
// Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec
|
||||||
|
uint32 multicast_class_b_ping_slot_periodicity = 8;
|
||||||
|
|
||||||
// Multicast frequency (Hz).
|
// Multicast frequency (Hz).
|
||||||
uint32 multicast_frequency = 9;
|
uint32 multicast_frequency = 9;
|
||||||
|
16
api/proto/api/multicast_group.proto
vendored
16
api/proto/api/multicast_group.proto
vendored
@ -165,15 +165,15 @@ message MulticastGroup {
|
|||||||
// Frequency (Hz).
|
// Frequency (Hz).
|
||||||
uint32 frequency = 11;
|
uint32 frequency = 11;
|
||||||
|
|
||||||
// Ping-slot period (only for Class-B).
|
// Class-B ping-slot periodicity (only for Class-B).
|
||||||
// Deprecated: use class_b_ping_slot_nb_k.
|
// Valid options are: 0 - 7.
|
||||||
uint32 class_b_ping_slot_period = 12;
|
|
||||||
|
|
||||||
// Class-B ping-slots per beacon period (only for Class-B).
|
|
||||||
// Valid options are: 0 - 7;
|
|
||||||
//
|
//
|
||||||
// The actual number of ping-slots per beacon period equals to 2^k.
|
// Number of ping-slots per beacon-period:
|
||||||
uint32 class_b_ping_slot_nb_k = 14;
|
// pingNb = 2^(7-periodicity)
|
||||||
|
//
|
||||||
|
// Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec
|
||||||
|
// Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec
|
||||||
|
uint32 class_b_ping_slot_periodicity = 14;
|
||||||
|
|
||||||
// Scheduling type (only for Class-C).
|
// Scheduling type (only for Class-C).
|
||||||
MulticastGroupSchedulingType class_c_scheduling_type = 13;
|
MulticastGroupSchedulingType class_c_scheduling_type = 13;
|
||||||
|
@ -240,11 +240,15 @@ message DeviceProfile {
|
|||||||
// from the device (if requested).
|
// from the device (if requested).
|
||||||
uint32 class_b_timeout = 16;
|
uint32 class_b_timeout = 16;
|
||||||
|
|
||||||
// Class-B ping-slots per beacon period.
|
// Class-B ping-slot periodicity.
|
||||||
// Valid options are: 0 - 7.
|
// Valid options are: 0 - 7.
|
||||||
//
|
//
|
||||||
// The actual number of ping-slots per beacon period equals to 2^k.
|
// Number of ping-slots per beacon-period:
|
||||||
uint32 class_b_ping_slot_nb_k = 17;
|
// pingNb = 2^(7-periodicity)
|
||||||
|
//
|
||||||
|
// Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec
|
||||||
|
// Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec
|
||||||
|
uint32 class_b_ping_slot_periodicity = 17;
|
||||||
|
|
||||||
// Class-B ping-slot DR.
|
// Class-B ping-slot DR.
|
||||||
uint32 class_b_ping_slot_dr = 18;
|
uint32 class_b_ping_slot_dr = 18;
|
||||||
|
@ -117,11 +117,15 @@ message DeviceProfileTemplate {
|
|||||||
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
|
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
|
||||||
uint32 class_b_timeout = 18;
|
uint32 class_b_timeout = 18;
|
||||||
|
|
||||||
// Class-B ping-slots per beacon period.
|
// Class-B ping-slot periodicity (only for Class-B).
|
||||||
// Valid options are: 0 - 7.
|
// Valid options are: 0 - 7.
|
||||||
//
|
//
|
||||||
// The actual number of ping-slots per beacon period equals to 2^k.
|
// Number of ping-slots per beacon-period:
|
||||||
uint32 class_b_ping_slot_nb_k = 19;
|
// pingNb = 2^(7-periodicity)
|
||||||
|
//
|
||||||
|
// Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec
|
||||||
|
// Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec
|
||||||
|
uint32 class_b_ping_slot_periodicity = 19;
|
||||||
|
|
||||||
// Class-B ping-slot DR.
|
// Class-B ping-slot DR.
|
||||||
uint32 class_b_ping_slot_dr = 20;
|
uint32 class_b_ping_slot_dr = 20;
|
||||||
|
9
api/rust/proto/chirpstack/api/fuota.proto
vendored
9
api/rust/proto/chirpstack/api/fuota.proto
vendored
@ -104,7 +104,14 @@ message FuotaDeployment {
|
|||||||
uint32 multicast_dr = 7;
|
uint32 multicast_dr = 7;
|
||||||
|
|
||||||
// Multicast ping-slot period (Class-B only).
|
// Multicast ping-slot period (Class-B only).
|
||||||
uint32 multicast_class_b_ping_slot_nb_k = 8;
|
// Valid options are: 0 - 7.
|
||||||
|
//
|
||||||
|
// Number of ping-slots per beacon-period:
|
||||||
|
// pingNb = 2^(7-periodicity)
|
||||||
|
//
|
||||||
|
// Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec
|
||||||
|
// Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec
|
||||||
|
uint32 multicast_class_b_ping_slot_periodicity = 8;
|
||||||
|
|
||||||
// Multicast frequency (Hz).
|
// Multicast frequency (Hz).
|
||||||
uint32 multicast_frequency = 9;
|
uint32 multicast_frequency = 9;
|
||||||
|
@ -165,15 +165,15 @@ message MulticastGroup {
|
|||||||
// Frequency (Hz).
|
// Frequency (Hz).
|
||||||
uint32 frequency = 11;
|
uint32 frequency = 11;
|
||||||
|
|
||||||
// Ping-slot period (only for Class-B).
|
// Class-B ping-slot periodicity (only for Class-B).
|
||||||
// Deprecated: use class_b_ping_slot_nb_k.
|
// Valid options are: 0 - 7.
|
||||||
uint32 class_b_ping_slot_period = 12;
|
|
||||||
|
|
||||||
// Class-B ping-slots per beacon period (only for Class-B).
|
|
||||||
// Valid options are: 0 - 7;
|
|
||||||
//
|
//
|
||||||
// The actual number of ping-slots per beacon period equals to 2^k.
|
// Number of ping-slots per beacon-period:
|
||||||
uint32 class_b_ping_slot_nb_k = 14;
|
// pingNb = 2^(7-periodicity)
|
||||||
|
//
|
||||||
|
// Periodicity: 0 = 128 ping-slots per beacon period = ~ every 1 sec
|
||||||
|
// Periodicity: 7 = 1 ping-slot per beacon period = ~ every 128 sec
|
||||||
|
uint32 class_b_ping_slot_periodicity = 14;
|
||||||
|
|
||||||
// Scheduling type (only for Class-C).
|
// Scheduling type (only for Class-C).
|
||||||
MulticastGroupSchedulingType class_c_scheduling_type = 13;
|
MulticastGroupSchedulingType class_c_scheduling_type = 13;
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
alter table fuota_deployment
|
||||||
|
rename column multicast_class_b_ping_slot_periodicity to multicast_class_b_ping_slot_nb_k;
|
||||||
|
|
||||||
|
alter table multicast_group
|
||||||
|
rename column class_b_ping_slot_periodicity to class_b_ping_slot_nb_k;
|
||||||
|
|
||||||
|
alter table device_profile_template
|
||||||
|
rename column class_b_ping_slot_periodicity to class_b_ping_slot_nb_k;
|
@ -0,0 +1,8 @@
|
|||||||
|
alter table device_profile_template
|
||||||
|
rename column class_b_ping_slot_nb_k to class_b_ping_slot_periodicity;
|
||||||
|
|
||||||
|
alter table multicast_group
|
||||||
|
rename column class_b_ping_slot_nb_k to class_b_ping_slot_periodicity;
|
||||||
|
|
||||||
|
alter table fuota_deployment
|
||||||
|
rename column multicast_class_b_ping_slot_nb_k to multicast_class_b_ping_slot_periodicity;
|
@ -0,0 +1,8 @@
|
|||||||
|
alter table fuota_deployment
|
||||||
|
rename column multicast_class_b_ping_slot_periodicity to multicast_class_b_ping_slot_nb_k;
|
||||||
|
|
||||||
|
alter table multicast_group
|
||||||
|
rename column class_b_ping_slot_periodicity to class_b_ping_slot_nb_k;
|
||||||
|
|
||||||
|
alter table device_profile_template
|
||||||
|
rename column class_b_ping_slot_periodicity to class_b_ping_slot_nb_k;
|
@ -0,0 +1,8 @@
|
|||||||
|
alter table device_profile_template
|
||||||
|
rename column class_b_ping_slot_nb_k to class_b_ping_slot_periodicity;
|
||||||
|
|
||||||
|
alter table multicast_group
|
||||||
|
rename column class_b_ping_slot_nb_k to class_b_ping_slot_periodicity;
|
||||||
|
|
||||||
|
alter table fuota_deployment
|
||||||
|
rename column multicast_class_b_ping_slot_nb_k to multicast_class_b_ping_slot_periodicity;
|
@ -94,7 +94,7 @@ impl DeviceProfileService for DeviceProfile {
|
|||||||
class_b_params: if req_dp.supports_class_b {
|
class_b_params: if req_dp.supports_class_b {
|
||||||
Some(fields::ClassBParams {
|
Some(fields::ClassBParams {
|
||||||
timeout: req_dp.class_b_timeout as u16,
|
timeout: req_dp.class_b_timeout as u16,
|
||||||
ping_slot_nb_k: req_dp.class_b_ping_slot_nb_k as u8,
|
ping_slot_periodicity: req_dp.class_b_ping_slot_periodicity as u8,
|
||||||
ping_slot_dr: req_dp.class_b_ping_slot_dr as u8,
|
ping_slot_dr: req_dp.class_b_ping_slot_dr as u8,
|
||||||
ping_slot_freq: req_dp.class_b_ping_slot_freq,
|
ping_slot_freq: req_dp.class_b_ping_slot_freq,
|
||||||
})
|
})
|
||||||
@ -205,7 +205,7 @@ impl DeviceProfileService for DeviceProfile {
|
|||||||
supports_class_b: dp.supports_class_b,
|
supports_class_b: dp.supports_class_b,
|
||||||
supports_class_c: dp.supports_class_c,
|
supports_class_c: dp.supports_class_c,
|
||||||
class_b_timeout: class_b_params.timeout as u32,
|
class_b_timeout: class_b_params.timeout as u32,
|
||||||
class_b_ping_slot_nb_k: class_b_params.ping_slot_nb_k as u32,
|
class_b_ping_slot_periodicity: class_b_params.ping_slot_periodicity as u32,
|
||||||
class_b_ping_slot_dr: class_b_params.ping_slot_dr as u32,
|
class_b_ping_slot_dr: class_b_params.ping_slot_dr as u32,
|
||||||
class_b_ping_slot_freq: class_b_params.ping_slot_freq as u32,
|
class_b_ping_slot_freq: class_b_params.ping_slot_freq as u32,
|
||||||
class_c_timeout: class_c_params.timeout as u32,
|
class_c_timeout: class_c_params.timeout as u32,
|
||||||
@ -350,7 +350,7 @@ impl DeviceProfileService for DeviceProfile {
|
|||||||
class_b_params: if req_dp.supports_class_b {
|
class_b_params: if req_dp.supports_class_b {
|
||||||
Some(fields::ClassBParams {
|
Some(fields::ClassBParams {
|
||||||
timeout: req_dp.class_b_timeout as u16,
|
timeout: req_dp.class_b_timeout as u16,
|
||||||
ping_slot_nb_k: req_dp.class_b_ping_slot_nb_k as u8,
|
ping_slot_periodicity: req_dp.class_b_ping_slot_periodicity as u8,
|
||||||
ping_slot_dr: req_dp.class_b_ping_slot_dr as u8,
|
ping_slot_dr: req_dp.class_b_ping_slot_dr as u8,
|
||||||
ping_slot_freq: req_dp.class_b_ping_slot_freq,
|
ping_slot_freq: req_dp.class_b_ping_slot_freq,
|
||||||
})
|
})
|
||||||
|
@ -60,7 +60,7 @@ impl DeviceProfileTemplateService for DeviceProfileTemplate {
|
|||||||
supports_class_b: req_dp.supports_class_b,
|
supports_class_b: req_dp.supports_class_b,
|
||||||
supports_class_c: req_dp.supports_class_c,
|
supports_class_c: req_dp.supports_class_c,
|
||||||
class_b_timeout: req_dp.class_b_timeout as i32,
|
class_b_timeout: req_dp.class_b_timeout as i32,
|
||||||
class_b_ping_slot_nb_k: req_dp.class_b_ping_slot_nb_k as i32,
|
class_b_ping_slot_periodicity: req_dp.class_b_ping_slot_periodicity as i32,
|
||||||
class_b_ping_slot_dr: req_dp.class_b_ping_slot_dr as i16,
|
class_b_ping_slot_dr: req_dp.class_b_ping_slot_dr as i16,
|
||||||
class_b_ping_slot_freq: req_dp.class_b_ping_slot_freq as i64,
|
class_b_ping_slot_freq: req_dp.class_b_ping_slot_freq as i64,
|
||||||
class_c_timeout: req_dp.class_c_timeout as i32,
|
class_c_timeout: req_dp.class_c_timeout as i32,
|
||||||
@ -132,7 +132,7 @@ impl DeviceProfileTemplateService for DeviceProfileTemplate {
|
|||||||
supports_class_b: dp.supports_class_b,
|
supports_class_b: dp.supports_class_b,
|
||||||
supports_class_c: dp.supports_class_c,
|
supports_class_c: dp.supports_class_c,
|
||||||
class_b_timeout: dp.class_b_timeout as u32,
|
class_b_timeout: dp.class_b_timeout as u32,
|
||||||
class_b_ping_slot_nb_k: dp.class_b_ping_slot_nb_k as u32,
|
class_b_ping_slot_periodicity: dp.class_b_ping_slot_periodicity as u32,
|
||||||
class_b_ping_slot_dr: dp.class_b_ping_slot_dr as u32,
|
class_b_ping_slot_dr: dp.class_b_ping_slot_dr as u32,
|
||||||
class_b_ping_slot_freq: dp.class_b_ping_slot_freq as u32,
|
class_b_ping_slot_freq: dp.class_b_ping_slot_freq as u32,
|
||||||
class_c_timeout: dp.class_c_timeout as u32,
|
class_c_timeout: dp.class_c_timeout as u32,
|
||||||
@ -201,7 +201,7 @@ impl DeviceProfileTemplateService for DeviceProfileTemplate {
|
|||||||
supports_class_b: req_dp.supports_class_b,
|
supports_class_b: req_dp.supports_class_b,
|
||||||
supports_class_c: req_dp.supports_class_c,
|
supports_class_c: req_dp.supports_class_c,
|
||||||
class_b_timeout: req_dp.class_b_timeout as i32,
|
class_b_timeout: req_dp.class_b_timeout as i32,
|
||||||
class_b_ping_slot_nb_k: req_dp.class_b_ping_slot_nb_k as i32,
|
class_b_ping_slot_periodicity: req_dp.class_b_ping_slot_periodicity as i32,
|
||||||
class_b_ping_slot_dr: req_dp.class_b_ping_slot_dr as i16,
|
class_b_ping_slot_dr: req_dp.class_b_ping_slot_dr as i16,
|
||||||
class_b_ping_slot_freq: req_dp.class_b_ping_slot_freq as i64,
|
class_b_ping_slot_freq: req_dp.class_b_ping_slot_freq as i64,
|
||||||
class_c_timeout: req_dp.class_c_timeout as i32,
|
class_c_timeout: req_dp.class_c_timeout as i32,
|
||||||
|
@ -63,7 +63,8 @@ impl FuotaService for Fuota {
|
|||||||
.multicast_class_c_scheduling_type()
|
.multicast_class_c_scheduling_type()
|
||||||
.from_proto(),
|
.from_proto(),
|
||||||
multicast_dr: req_dp.multicast_dr as i16,
|
multicast_dr: req_dp.multicast_dr as i16,
|
||||||
multicast_class_b_ping_slot_nb_k: req_dp.multicast_class_b_ping_slot_nb_k as i16,
|
multicast_class_b_ping_slot_periodicity: req_dp.multicast_class_b_ping_slot_periodicity
|
||||||
|
as i16,
|
||||||
multicast_frequency: req_dp.multicast_frequency as i64,
|
multicast_frequency: req_dp.multicast_frequency as i64,
|
||||||
multicast_timeout: req_dp.multicast_timeout as i16,
|
multicast_timeout: req_dp.multicast_timeout as i16,
|
||||||
unicast_max_retry_count: req_dp.unicast_max_retry_count as i16,
|
unicast_max_retry_count: req_dp.unicast_max_retry_count as i16,
|
||||||
@ -138,7 +139,8 @@ impl FuotaService for Fuota {
|
|||||||
.to_proto()
|
.to_proto()
|
||||||
.into(),
|
.into(),
|
||||||
multicast_dr: dp.multicast_dr as u32,
|
multicast_dr: dp.multicast_dr as u32,
|
||||||
multicast_class_b_ping_slot_nb_k: dp.multicast_class_b_ping_slot_nb_k as u32,
|
multicast_class_b_ping_slot_periodicity: dp.multicast_class_b_ping_slot_periodicity
|
||||||
|
as u32,
|
||||||
multicast_frequency: dp.multicast_frequency as u32,
|
multicast_frequency: dp.multicast_frequency as u32,
|
||||||
multicast_timeout: dp.multicast_timeout as u32,
|
multicast_timeout: dp.multicast_timeout as u32,
|
||||||
unicast_max_retry_count: dp.unicast_max_retry_count as u32,
|
unicast_max_retry_count: dp.unicast_max_retry_count as u32,
|
||||||
@ -217,7 +219,8 @@ impl FuotaService for Fuota {
|
|||||||
.multicast_class_c_scheduling_type()
|
.multicast_class_c_scheduling_type()
|
||||||
.from_proto(),
|
.from_proto(),
|
||||||
multicast_dr: req_dp.multicast_dr as i16,
|
multicast_dr: req_dp.multicast_dr as i16,
|
||||||
multicast_class_b_ping_slot_nb_k: req_dp.multicast_class_b_ping_slot_nb_k as i16,
|
multicast_class_b_ping_slot_periodicity: req_dp.multicast_class_b_ping_slot_periodicity
|
||||||
|
as i16,
|
||||||
multicast_frequency: req_dp.multicast_frequency as i64,
|
multicast_frequency: req_dp.multicast_frequency as i64,
|
||||||
multicast_timeout: req_dp.multicast_timeout as i16,
|
multicast_timeout: req_dp.multicast_timeout as i16,
|
||||||
unicast_max_retry_count: req_dp.unicast_max_retry_count as i16,
|
unicast_max_retry_count: req_dp.unicast_max_retry_count as i16,
|
||||||
|
@ -61,14 +61,7 @@ impl MulticastGroupService for MulticastGroup {
|
|||||||
.to_string(),
|
.to_string(),
|
||||||
dr: req_mg.dr as i16,
|
dr: req_mg.dr as i16,
|
||||||
frequency: req_mg.frequency as i64,
|
frequency: req_mg.frequency as i64,
|
||||||
class_b_ping_slot_nb_k: if req_mg.class_b_ping_slot_period != 0 {
|
class_b_ping_slot_periodicity: req_mg.class_b_ping_slot_periodicity as i16,
|
||||||
// For backwards compatibility.
|
|
||||||
(req_mg.class_b_ping_slot_period / 32)
|
|
||||||
.checked_ilog2()
|
|
||||||
.unwrap_or_default()
|
|
||||||
} else {
|
|
||||||
req_mg.class_b_ping_slot_nb_k
|
|
||||||
} as i16,
|
|
||||||
class_c_scheduling_type: req_mg.class_c_scheduling_type().from_proto(),
|
class_c_scheduling_type: req_mg.class_c_scheduling_type().from_proto(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
@ -121,8 +114,7 @@ impl MulticastGroupService for MulticastGroup {
|
|||||||
.into(),
|
.into(),
|
||||||
dr: mg.dr as u32,
|
dr: mg.dr as u32,
|
||||||
frequency: mg.frequency as u32,
|
frequency: mg.frequency as u32,
|
||||||
class_b_ping_slot_period: (1 << (mg.class_b_ping_slot_nb_k as u32)) * 32,
|
class_b_ping_slot_periodicity: mg.class_b_ping_slot_periodicity as u32,
|
||||||
class_b_ping_slot_nb_k: mg.class_b_ping_slot_nb_k as u32,
|
|
||||||
class_c_scheduling_type: mg.class_c_scheduling_type.to_proto().into(),
|
class_c_scheduling_type: mg.class_c_scheduling_type.to_proto().into(),
|
||||||
}),
|
}),
|
||||||
created_at: Some(helpers::datetime_to_prost_timestamp(&mg.created_at)),
|
created_at: Some(helpers::datetime_to_prost_timestamp(&mg.created_at)),
|
||||||
@ -168,14 +160,7 @@ impl MulticastGroupService for MulticastGroup {
|
|||||||
.to_string(),
|
.to_string(),
|
||||||
dr: req_mg.dr as i16,
|
dr: req_mg.dr as i16,
|
||||||
frequency: req_mg.frequency as i64,
|
frequency: req_mg.frequency as i64,
|
||||||
class_b_ping_slot_nb_k: if req_mg.class_b_ping_slot_period != 0 {
|
class_b_ping_slot_periodicity: req_mg.class_b_ping_slot_periodicity as i16,
|
||||||
// For backwards compatibility.
|
|
||||||
(req_mg.class_b_ping_slot_period / 32)
|
|
||||||
.checked_ilog2()
|
|
||||||
.unwrap_or_default()
|
|
||||||
} else {
|
|
||||||
req_mg.class_b_ping_slot_nb_k
|
|
||||||
} as i16,
|
|
||||||
class_c_scheduling_type: req_mg.class_c_scheduling_type().from_proto(),
|
class_c_scheduling_type: req_mg.class_c_scheduling_type().from_proto(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -606,7 +591,7 @@ pub mod test {
|
|||||||
group_type: api::MulticastGroupType::ClassC.into(),
|
group_type: api::MulticastGroupType::ClassC.into(),
|
||||||
dr: 3,
|
dr: 3,
|
||||||
frequency: 868300000,
|
frequency: 868300000,
|
||||||
class_b_ping_slot_nb_k: 1,
|
class_b_ping_slot_periodicity: 1,
|
||||||
class_c_scheduling_type: api::MulticastGroupSchedulingType::GpsTime.into(),
|
class_c_scheduling_type: api::MulticastGroupSchedulingType::GpsTime.into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
@ -636,8 +621,7 @@ pub mod test {
|
|||||||
group_type: api::MulticastGroupType::ClassC.into(),
|
group_type: api::MulticastGroupType::ClassC.into(),
|
||||||
dr: 3,
|
dr: 3,
|
||||||
frequency: 868300000,
|
frequency: 868300000,
|
||||||
class_b_ping_slot_nb_k: 1,
|
class_b_ping_slot_periodicity: 1,
|
||||||
class_b_ping_slot_period: 64,
|
|
||||||
class_c_scheduling_type: api::MulticastGroupSchedulingType::GpsTime.into(),
|
class_c_scheduling_type: api::MulticastGroupSchedulingType::GpsTime.into(),
|
||||||
}),
|
}),
|
||||||
get_resp.get_ref().multicast_group
|
get_resp.get_ref().multicast_group
|
||||||
@ -659,8 +643,7 @@ pub mod test {
|
|||||||
group_type: api::MulticastGroupType::ClassB.into(),
|
group_type: api::MulticastGroupType::ClassB.into(),
|
||||||
dr: 2,
|
dr: 2,
|
||||||
frequency: 868200000,
|
frequency: 868200000,
|
||||||
class_b_ping_slot_nb_k: 2,
|
class_b_ping_slot_periodicity: 2,
|
||||||
class_b_ping_slot_period: 0,
|
|
||||||
class_c_scheduling_type: api::MulticastGroupSchedulingType::Delay.into(),
|
class_c_scheduling_type: api::MulticastGroupSchedulingType::Delay.into(),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@ -688,8 +671,7 @@ pub mod test {
|
|||||||
group_type: api::MulticastGroupType::ClassB.into(),
|
group_type: api::MulticastGroupType::ClassB.into(),
|
||||||
dr: 2,
|
dr: 2,
|
||||||
frequency: 868200000,
|
frequency: 868200000,
|
||||||
class_b_ping_slot_nb_k: 2,
|
class_b_ping_slot_periodicity: 2,
|
||||||
class_b_ping_slot_period: 128,
|
|
||||||
class_c_scheduling_type: api::MulticastGroupSchedulingType::Delay.into(),
|
class_c_scheduling_type: api::MulticastGroupSchedulingType::Delay.into(),
|
||||||
}),
|
}),
|
||||||
get_resp.get_ref().multicast_group
|
get_resp.get_ref().multicast_group
|
||||||
|
@ -149,7 +149,9 @@ impl Flow {
|
|||||||
group_type: self.fuota_deployment.multicast_group_type.clone(),
|
group_type: self.fuota_deployment.multicast_group_type.clone(),
|
||||||
frequency: self.fuota_deployment.multicast_frequency,
|
frequency: self.fuota_deployment.multicast_frequency,
|
||||||
dr: self.fuota_deployment.multicast_dr,
|
dr: self.fuota_deployment.multicast_dr,
|
||||||
class_b_ping_slot_nb_k: self.fuota_deployment.multicast_class_b_ping_slot_nb_k,
|
class_b_ping_slot_periodicity: self
|
||||||
|
.fuota_deployment
|
||||||
|
.multicast_class_b_ping_slot_periodicity,
|
||||||
class_c_scheduling_type: self.fuota_deployment.multicast_class_c_scheduling_type,
|
class_c_scheduling_type: self.fuota_deployment.multicast_class_c_scheduling_type,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -577,7 +579,7 @@ impl Flow {
|
|||||||
time_out_periodicity:
|
time_out_periodicity:
|
||||||
multicastsetup::v1::McClassBSessionReqPayloadTimeOutPeriodicity {
|
multicastsetup::v1::McClassBSessionReqPayloadTimeOutPeriodicity {
|
||||||
time_out: self.fuota_deployment.multicast_timeout as u8,
|
time_out: self.fuota_deployment.multicast_timeout as u8,
|
||||||
periodicity: self.fuota_deployment.multicast_class_b_ping_slot_nb_k
|
periodicity: self.fuota_deployment.multicast_class_b_ping_slot_periodicity
|
||||||
as u8,
|
as u8,
|
||||||
},
|
},
|
||||||
dl_frequ: self.fuota_deployment.multicast_frequency as u32,
|
dl_frequ: self.fuota_deployment.multicast_frequency as u32,
|
||||||
@ -619,7 +621,7 @@ impl Flow {
|
|||||||
time_out_periodicity:
|
time_out_periodicity:
|
||||||
multicastsetup::v2::McClassBSessionReqPayloadTimeOutPeriodicity {
|
multicastsetup::v2::McClassBSessionReqPayloadTimeOutPeriodicity {
|
||||||
time_out: self.fuota_deployment.multicast_timeout as u8,
|
time_out: self.fuota_deployment.multicast_timeout as u8,
|
||||||
periodicity: self.fuota_deployment.multicast_class_b_ping_slot_nb_k
|
periodicity: self.fuota_deployment.multicast_class_b_ping_slot_periodicity
|
||||||
as u8,
|
as u8,
|
||||||
},
|
},
|
||||||
dl_frequ: self.fuota_deployment.multicast_frequency as u32,
|
dl_frequ: self.fuota_deployment.multicast_frequency as u32,
|
||||||
|
@ -265,7 +265,7 @@ async fn import_device(
|
|||||||
supports_class_b: prof.supports_class_b,
|
supports_class_b: prof.supports_class_b,
|
||||||
supports_class_c: prof.supports_class_c,
|
supports_class_c: prof.supports_class_c,
|
||||||
class_b_timeout: prof.class_b_timeout as i32,
|
class_b_timeout: prof.class_b_timeout as i32,
|
||||||
class_b_ping_slot_nb_k: match prof.ping_slot_period {
|
class_b_ping_slot_periodicity: match prof.ping_slot_period {
|
||||||
128 => 7,
|
128 => 7,
|
||||||
64 => 6,
|
64 => 6,
|
||||||
32 => 5,
|
32 => 5,
|
||||||
|
@ -94,7 +94,7 @@ pub struct ProfileAbp {
|
|||||||
#[derive(Default, Deserialize)]
|
#[derive(Default, Deserialize)]
|
||||||
pub struct ProfileClassB {
|
pub struct ProfileClassB {
|
||||||
pub timeout_secs: usize,
|
pub timeout_secs: usize,
|
||||||
pub ping_slot_nb_k: usize,
|
pub ping_slot_periodicity: usize,
|
||||||
pub ping_slot_dr: usize,
|
pub ping_slot_dr: usize,
|
||||||
pub ping_slot_freq: usize,
|
pub ping_slot_freq: usize,
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ async fn handle_profile(
|
|||||||
supports_class_b: profile_conf.profile.supports_class_b,
|
supports_class_b: profile_conf.profile.supports_class_b,
|
||||||
supports_class_c: profile_conf.profile.supports_class_c,
|
supports_class_c: profile_conf.profile.supports_class_c,
|
||||||
class_b_timeout: profile_conf.profile.class_b.timeout_secs as i32,
|
class_b_timeout: profile_conf.profile.class_b.timeout_secs as i32,
|
||||||
class_b_ping_slot_nb_k: profile_conf.profile.class_b.ping_slot_nb_k as i32,
|
class_b_ping_slot_periodicity: profile_conf.profile.class_b.ping_slot_periodicity as i32,
|
||||||
class_b_ping_slot_dr: profile_conf.profile.class_b.ping_slot_dr as i16,
|
class_b_ping_slot_dr: profile_conf.profile.class_b.ping_slot_dr as i16,
|
||||||
class_b_ping_slot_freq: profile_conf.profile.class_b.ping_slot_freq as i64,
|
class_b_ping_slot_freq: profile_conf.profile.class_b.ping_slot_freq as i64,
|
||||||
class_c_timeout: profile_conf.profile.class_c.timeout_secs as i32,
|
class_c_timeout: profile_conf.profile.class_c.timeout_secs as i32,
|
||||||
|
@ -80,7 +80,7 @@ pub mod test {
|
|||||||
class_b_params: Some(fields::ClassBParams {
|
class_b_params: Some(fields::ClassBParams {
|
||||||
ping_slot_dr: 2,
|
ping_slot_dr: 2,
|
||||||
ping_slot_freq: 868100000,
|
ping_slot_freq: 868100000,
|
||||||
ping_slot_nb_k: 1,
|
ping_slot_periodicity: 6,
|
||||||
timeout: 0,
|
timeout: 0,
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -110,7 +110,7 @@ impl DeviceProfile {
|
|||||||
if let Some(class_b_params) = &self.class_b_params {
|
if let Some(class_b_params) = &self.class_b_params {
|
||||||
ds.class_b_ping_slot_dr = class_b_params.ping_slot_dr as u32;
|
ds.class_b_ping_slot_dr = class_b_params.ping_slot_dr as u32;
|
||||||
ds.class_b_ping_slot_freq = class_b_params.ping_slot_freq;
|
ds.class_b_ping_slot_freq = class_b_params.ping_slot_freq;
|
||||||
ds.class_b_ping_slot_nb = 1 << class_b_params.ping_slot_nb_k as u32;
|
ds.class_b_ping_slot_nb = 1 << (7 - class_b_params.ping_slot_periodicity) as u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(relay_params) = &self.relay_params {
|
if let Some(relay_params) = &self.relay_params {
|
||||||
|
@ -37,7 +37,7 @@ pub struct DeviceProfileTemplate {
|
|||||||
pub supports_class_b: bool,
|
pub supports_class_b: bool,
|
||||||
pub supports_class_c: bool,
|
pub supports_class_c: bool,
|
||||||
pub class_b_timeout: i32,
|
pub class_b_timeout: i32,
|
||||||
pub class_b_ping_slot_nb_k: i32,
|
pub class_b_ping_slot_periodicity: i32,
|
||||||
pub class_b_ping_slot_dr: i16,
|
pub class_b_ping_slot_dr: i16,
|
||||||
pub class_b_ping_slot_freq: i64,
|
pub class_b_ping_slot_freq: i64,
|
||||||
pub class_c_timeout: i32,
|
pub class_c_timeout: i32,
|
||||||
@ -100,7 +100,7 @@ impl Default for DeviceProfileTemplate {
|
|||||||
supports_class_b: false,
|
supports_class_b: false,
|
||||||
supports_class_c: false,
|
supports_class_c: false,
|
||||||
class_b_timeout: 0,
|
class_b_timeout: 0,
|
||||||
class_b_ping_slot_nb_k: 0,
|
class_b_ping_slot_periodicity: 0,
|
||||||
class_b_ping_slot_dr: 0,
|
class_b_ping_slot_dr: 0,
|
||||||
class_b_ping_slot_freq: 0,
|
class_b_ping_slot_freq: 0,
|
||||||
class_c_timeout: 0,
|
class_c_timeout: 0,
|
||||||
@ -169,7 +169,8 @@ pub async fn upsert(dp: DeviceProfileTemplate) -> Result<DeviceProfileTemplate,
|
|||||||
device_profile_template::supports_class_b.eq(&dp.supports_class_b),
|
device_profile_template::supports_class_b.eq(&dp.supports_class_b),
|
||||||
device_profile_template::supports_class_c.eq(&dp.supports_class_c),
|
device_profile_template::supports_class_c.eq(&dp.supports_class_c),
|
||||||
device_profile_template::class_b_timeout.eq(&dp.class_b_timeout),
|
device_profile_template::class_b_timeout.eq(&dp.class_b_timeout),
|
||||||
device_profile_template::class_b_ping_slot_nb_k.eq(&dp.class_b_ping_slot_nb_k),
|
device_profile_template::class_b_ping_slot_periodicity
|
||||||
|
.eq(&dp.class_b_ping_slot_periodicity),
|
||||||
device_profile_template::class_b_ping_slot_dr.eq(&dp.class_b_ping_slot_dr),
|
device_profile_template::class_b_ping_slot_dr.eq(&dp.class_b_ping_slot_dr),
|
||||||
device_profile_template::class_b_ping_slot_freq.eq(&dp.class_b_ping_slot_freq),
|
device_profile_template::class_b_ping_slot_freq.eq(&dp.class_b_ping_slot_freq),
|
||||||
device_profile_template::class_c_timeout.eq(&dp.class_c_timeout),
|
device_profile_template::class_c_timeout.eq(&dp.class_c_timeout),
|
||||||
@ -224,7 +225,8 @@ pub async fn update(dp: DeviceProfileTemplate) -> Result<DeviceProfileTemplate,
|
|||||||
device_profile_template::supports_class_b.eq(&dp.supports_class_b),
|
device_profile_template::supports_class_b.eq(&dp.supports_class_b),
|
||||||
device_profile_template::supports_class_c.eq(&dp.supports_class_c),
|
device_profile_template::supports_class_c.eq(&dp.supports_class_c),
|
||||||
device_profile_template::class_b_timeout.eq(&dp.class_b_timeout),
|
device_profile_template::class_b_timeout.eq(&dp.class_b_timeout),
|
||||||
device_profile_template::class_b_ping_slot_nb_k.eq(&dp.class_b_ping_slot_nb_k),
|
device_profile_template::class_b_ping_slot_periodicity
|
||||||
|
.eq(&dp.class_b_ping_slot_periodicity),
|
||||||
device_profile_template::class_b_ping_slot_dr.eq(&dp.class_b_ping_slot_dr),
|
device_profile_template::class_b_ping_slot_dr.eq(&dp.class_b_ping_slot_dr),
|
||||||
device_profile_template::class_b_ping_slot_freq.eq(&dp.class_b_ping_slot_freq),
|
device_profile_template::class_b_ping_slot_freq.eq(&dp.class_b_ping_slot_freq),
|
||||||
device_profile_template::class_c_timeout.eq(&dp.class_c_timeout),
|
device_profile_template::class_c_timeout.eq(&dp.class_c_timeout),
|
||||||
|
@ -61,7 +61,8 @@ impl serialize::ToSql<Text, Sqlite> for AbpParams {
|
|||||||
#[cfg_attr(feature = "sqlite", diesel(sql_type = Text))]
|
#[cfg_attr(feature = "sqlite", diesel(sql_type = Text))]
|
||||||
pub struct ClassBParams {
|
pub struct ClassBParams {
|
||||||
pub timeout: u16,
|
pub timeout: u16,
|
||||||
pub ping_slot_nb_k: u8,
|
#[serde(alias = "ping_slot_nb_k")]
|
||||||
|
pub ping_slot_periodicity: u8,
|
||||||
pub ping_slot_dr: u8,
|
pub ping_slot_dr: u8,
|
||||||
pub ping_slot_freq: u32,
|
pub ping_slot_freq: u32,
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ pub struct FuotaDeployment {
|
|||||||
pub multicast_group_type: String,
|
pub multicast_group_type: String,
|
||||||
pub multicast_class_c_scheduling_type: fields::MulticastGroupSchedulingType,
|
pub multicast_class_c_scheduling_type: fields::MulticastGroupSchedulingType,
|
||||||
pub multicast_dr: i16,
|
pub multicast_dr: i16,
|
||||||
pub multicast_class_b_ping_slot_nb_k: i16,
|
pub multicast_class_b_ping_slot_periodicity: i16,
|
||||||
pub multicast_frequency: i64,
|
pub multicast_frequency: i64,
|
||||||
pub multicast_timeout: i16,
|
pub multicast_timeout: i16,
|
||||||
pub multicast_session_start: Option<DateTime<Utc>>,
|
pub multicast_session_start: Option<DateTime<Utc>>,
|
||||||
@ -68,7 +68,7 @@ impl Default for FuotaDeployment {
|
|||||||
multicast_group_type: "".into(),
|
multicast_group_type: "".into(),
|
||||||
multicast_class_c_scheduling_type: fields::MulticastGroupSchedulingType::DELAY,
|
multicast_class_c_scheduling_type: fields::MulticastGroupSchedulingType::DELAY,
|
||||||
multicast_dr: 0,
|
multicast_dr: 0,
|
||||||
multicast_class_b_ping_slot_nb_k: 0,
|
multicast_class_b_ping_slot_periodicity: 0,
|
||||||
multicast_frequency: 0,
|
multicast_frequency: 0,
|
||||||
multicast_timeout: 0,
|
multicast_timeout: 0,
|
||||||
multicast_session_start: None,
|
multicast_session_start: None,
|
||||||
@ -222,8 +222,8 @@ pub async fn update_deployment(d: FuotaDeployment) -> Result<FuotaDeployment, Er
|
|||||||
fuota_deployment::multicast_class_c_scheduling_type
|
fuota_deployment::multicast_class_c_scheduling_type
|
||||||
.eq(&d.multicast_class_c_scheduling_type),
|
.eq(&d.multicast_class_c_scheduling_type),
|
||||||
fuota_deployment::multicast_dr.eq(&d.multicast_dr),
|
fuota_deployment::multicast_dr.eq(&d.multicast_dr),
|
||||||
fuota_deployment::multicast_class_b_ping_slot_nb_k
|
fuota_deployment::multicast_class_b_ping_slot_periodicity
|
||||||
.eq(&d.multicast_class_b_ping_slot_nb_k),
|
.eq(&d.multicast_class_b_ping_slot_periodicity),
|
||||||
fuota_deployment::multicast_frequency.eq(&d.multicast_frequency),
|
fuota_deployment::multicast_frequency.eq(&d.multicast_frequency),
|
||||||
fuota_deployment::multicast_timeout.eq(&d.multicast_timeout),
|
fuota_deployment::multicast_timeout.eq(&d.multicast_timeout),
|
||||||
fuota_deployment::multicast_session_start.eq(&d.multicast_session_start),
|
fuota_deployment::multicast_session_start.eq(&d.multicast_session_start),
|
||||||
@ -765,7 +765,7 @@ pub fn get_multicast_timeout(d: &FuotaDeployment) -> Result<usize> {
|
|||||||
match d.multicast_group_type.as_ref() {
|
match d.multicast_group_type.as_ref() {
|
||||||
"B" => {
|
"B" => {
|
||||||
// Calculate number of ping-slots per beacon period.
|
// Calculate number of ping-slots per beacon period.
|
||||||
let nb_ping_slots = 1 << (d.multicast_class_b_ping_slot_nb_k as usize);
|
let nb_ping_slots = 1 << (7 - d.multicast_class_b_ping_slot_periodicity as usize);
|
||||||
|
|
||||||
// Calculate number of beacon-periods needed.
|
// Calculate number of beacon-periods needed.
|
||||||
// One beacon period is added as the first ping-slot might be in the next beacon-period.
|
// One beacon period is added as the first ping-slot might be in the next beacon-period.
|
||||||
@ -1221,7 +1221,7 @@ mod test {
|
|||||||
name: "Class-B - 1 / beacon period - 15 fragments".into(),
|
name: "Class-B - 1 / beacon period - 15 fragments".into(),
|
||||||
deployment: FuotaDeployment {
|
deployment: FuotaDeployment {
|
||||||
multicast_group_type: "B".into(),
|
multicast_group_type: "B".into(),
|
||||||
multicast_class_b_ping_slot_nb_k: 0,
|
multicast_class_b_ping_slot_periodicity: 7,
|
||||||
fragmentation_fragment_size: 10,
|
fragmentation_fragment_size: 10,
|
||||||
fragmentation_redundancy_percentage: 50,
|
fragmentation_redundancy_percentage: 50,
|
||||||
payload: vec![0; 100],
|
payload: vec![0; 100],
|
||||||
@ -1234,7 +1234,7 @@ mod test {
|
|||||||
name: "Class-B - 1 / beacon period - 16 fragments".into(),
|
name: "Class-B - 1 / beacon period - 16 fragments".into(),
|
||||||
deployment: FuotaDeployment {
|
deployment: FuotaDeployment {
|
||||||
multicast_group_type: "B".into(),
|
multicast_group_type: "B".into(),
|
||||||
multicast_class_b_ping_slot_nb_k: 0,
|
multicast_class_b_ping_slot_periodicity: 7,
|
||||||
fragmentation_fragment_size: 10,
|
fragmentation_fragment_size: 10,
|
||||||
fragmentation_redundancy_percentage: 60,
|
fragmentation_redundancy_percentage: 60,
|
||||||
payload: vec![0; 100],
|
payload: vec![0; 100],
|
||||||
@ -1247,7 +1247,7 @@ mod test {
|
|||||||
name: "Class-B - 16 / beacon period - 16 fragments".into(),
|
name: "Class-B - 16 / beacon period - 16 fragments".into(),
|
||||||
deployment: FuotaDeployment {
|
deployment: FuotaDeployment {
|
||||||
multicast_group_type: "B".into(),
|
multicast_group_type: "B".into(),
|
||||||
multicast_class_b_ping_slot_nb_k: 4,
|
multicast_class_b_ping_slot_periodicity: 3,
|
||||||
fragmentation_fragment_size: 10,
|
fragmentation_fragment_size: 10,
|
||||||
fragmentation_redundancy_percentage: 60,
|
fragmentation_redundancy_percentage: 60,
|
||||||
payload: vec![0; 100],
|
payload: vec![0; 100],
|
||||||
@ -1260,7 +1260,7 @@ mod test {
|
|||||||
name: "Class-B - 16 / beacon period - 17 fragments".into(),
|
name: "Class-B - 16 / beacon period - 17 fragments".into(),
|
||||||
deployment: FuotaDeployment {
|
deployment: FuotaDeployment {
|
||||||
multicast_group_type: "B".into(),
|
multicast_group_type: "B".into(),
|
||||||
multicast_class_b_ping_slot_nb_k: 4,
|
multicast_class_b_ping_slot_periodicity: 3,
|
||||||
fragmentation_fragment_size: 10,
|
fragmentation_fragment_size: 10,
|
||||||
fragmentation_redundancy_percentage: 70,
|
fragmentation_redundancy_percentage: 70,
|
||||||
payload: vec![0; 100],
|
payload: vec![0; 100],
|
||||||
|
@ -619,7 +619,7 @@ pub mod test {
|
|||||||
group_type: "C".into(),
|
group_type: "C".into(),
|
||||||
dr: 1,
|
dr: 1,
|
||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
class_b_ping_slot_nb_k: 1,
|
class_b_ping_slot_periodicity: 1,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
|
@ -33,7 +33,7 @@ pub struct MulticastGroup {
|
|||||||
pub group_type: String,
|
pub group_type: String,
|
||||||
pub dr: i16,
|
pub dr: i16,
|
||||||
pub frequency: i64,
|
pub frequency: i64,
|
||||||
pub class_b_ping_slot_nb_k: i16,
|
pub class_b_ping_slot_periodicity: i16,
|
||||||
pub class_c_scheduling_type: fields::MulticastGroupSchedulingType,
|
pub class_c_scheduling_type: fields::MulticastGroupSchedulingType,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ impl Default for MulticastGroup {
|
|||||||
group_type: "".into(),
|
group_type: "".into(),
|
||||||
dr: 0,
|
dr: 0,
|
||||||
frequency: 0,
|
frequency: 0,
|
||||||
class_b_ping_slot_nb_k: 0,
|
class_b_ping_slot_periodicity: 0,
|
||||||
class_c_scheduling_type: fields::MulticastGroupSchedulingType::DELAY,
|
class_c_scheduling_type: fields::MulticastGroupSchedulingType::DELAY,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ pub async fn update(mg: MulticastGroup) -> Result<MulticastGroup, Error> {
|
|||||||
multicast_group::group_type.eq(&mg.group_type),
|
multicast_group::group_type.eq(&mg.group_type),
|
||||||
multicast_group::dr.eq(&mg.dr),
|
multicast_group::dr.eq(&mg.dr),
|
||||||
multicast_group::frequency.eq(&mg.frequency),
|
multicast_group::frequency.eq(&mg.frequency),
|
||||||
multicast_group::class_b_ping_slot_nb_k.eq(&mg.class_b_ping_slot_nb_k),
|
multicast_group::class_b_ping_slot_periodicity.eq(&mg.class_b_ping_slot_periodicity),
|
||||||
multicast_group::class_c_scheduling_type.eq(&mg.class_c_scheduling_type),
|
multicast_group::class_c_scheduling_type.eq(&mg.class_c_scheduling_type),
|
||||||
))
|
))
|
||||||
.get_result(&mut get_async_db_conn().await?)
|
.get_result(&mut get_async_db_conn().await?)
|
||||||
@ -429,7 +429,7 @@ pub async fn enqueue(
|
|||||||
match mg.group_type.as_ref() {
|
match mg.group_type.as_ref() {
|
||||||
"B" => {
|
"B" => {
|
||||||
// get ping nb
|
// get ping nb
|
||||||
let ping_nb = 1 << mg.class_b_ping_slot_nb_k as usize;
|
let ping_nb = 1 << (7 - mg.class_b_ping_slot_periodicity) as usize;
|
||||||
|
|
||||||
// get max. gps epoch time.
|
// get max. gps epoch time.
|
||||||
let res: Option<i64> =
|
let res: Option<i64> =
|
||||||
@ -746,7 +746,7 @@ pub mod test {
|
|||||||
group_type: "C".into(),
|
group_type: "C".into(),
|
||||||
dr: 1,
|
dr: 1,
|
||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
class_b_ping_slot_nb_k: 1,
|
class_b_ping_slot_periodicity: 1,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -759,7 +759,7 @@ pub mod test {
|
|||||||
// update
|
// update
|
||||||
mg.name = "test-mg-updated".into();
|
mg.name = "test-mg-updated".into();
|
||||||
mg.group_type = "B".into();
|
mg.group_type = "B".into();
|
||||||
mg.class_b_ping_slot_nb_k = 4;
|
mg.class_b_ping_slot_periodicity = 4;
|
||||||
mg = update(mg).await.unwrap();
|
mg = update(mg).await.unwrap();
|
||||||
let mg_get = get(&mg.id.into()).await.unwrap();
|
let mg_get = get(&mg.id.into()).await.unwrap();
|
||||||
assert_eq!(mg, mg_get);
|
assert_eq!(mg, mg_get);
|
||||||
@ -884,7 +884,7 @@ pub mod test {
|
|||||||
group_type: "C".into(),
|
group_type: "C".into(),
|
||||||
dr: 1,
|
dr: 1,
|
||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
class_b_ping_slot_nb_k: 1,
|
class_b_ping_slot_periodicity: 1,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -942,7 +942,7 @@ pub mod test {
|
|||||||
group_type: "C".into(),
|
group_type: "C".into(),
|
||||||
dr: 1,
|
dr: 1,
|
||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
class_b_ping_slot_nb_k: 1,
|
class_b_ping_slot_periodicity: 1,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -1002,7 +1002,7 @@ pub mod test {
|
|||||||
group_type: "C".into(),
|
group_type: "C".into(),
|
||||||
dr: 1,
|
dr: 1,
|
||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
class_b_ping_slot_nb_k: 1,
|
class_b_ping_slot_periodicity: 1,
|
||||||
class_c_scheduling_type: fields::MulticastGroupSchedulingType::DELAY,
|
class_c_scheduling_type: fields::MulticastGroupSchedulingType::DELAY,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
|
@ -153,7 +153,7 @@ diesel::table! {
|
|||||||
supports_class_b -> Bool,
|
supports_class_b -> Bool,
|
||||||
supports_class_c -> Bool,
|
supports_class_c -> Bool,
|
||||||
class_b_timeout -> Int4,
|
class_b_timeout -> Int4,
|
||||||
class_b_ping_slot_nb_k -> Int4,
|
class_b_ping_slot_periodicity -> Int4,
|
||||||
class_b_ping_slot_dr -> Int2,
|
class_b_ping_slot_dr -> Int2,
|
||||||
class_b_ping_slot_freq -> Int8,
|
class_b_ping_slot_freq -> Int8,
|
||||||
class_c_timeout -> Int4,
|
class_c_timeout -> Int4,
|
||||||
@ -201,7 +201,7 @@ diesel::table! {
|
|||||||
#[max_length = 20]
|
#[max_length = 20]
|
||||||
multicast_class_c_scheduling_type -> Varchar,
|
multicast_class_c_scheduling_type -> Varchar,
|
||||||
multicast_dr -> Int2,
|
multicast_dr -> Int2,
|
||||||
multicast_class_b_ping_slot_nb_k -> Int2,
|
multicast_class_b_ping_slot_periodicity -> Int2,
|
||||||
multicast_frequency -> Int8,
|
multicast_frequency -> Int8,
|
||||||
multicast_timeout -> Int2,
|
multicast_timeout -> Int2,
|
||||||
multicast_session_start -> Nullable<Timestamptz>,
|
multicast_session_start -> Nullable<Timestamptz>,
|
||||||
@ -295,7 +295,7 @@ diesel::table! {
|
|||||||
group_type -> Bpchar,
|
group_type -> Bpchar,
|
||||||
dr -> Int2,
|
dr -> Int2,
|
||||||
frequency -> Int8,
|
frequency -> Int8,
|
||||||
class_b_ping_slot_nb_k -> Int2,
|
class_b_ping_slot_periodicity -> Int2,
|
||||||
#[max_length = 20]
|
#[max_length = 20]
|
||||||
class_c_scheduling_type -> Varchar,
|
class_c_scheduling_type -> Varchar,
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ diesel::table! {
|
|||||||
supports_class_b -> Bool,
|
supports_class_b -> Bool,
|
||||||
supports_class_c -> Bool,
|
supports_class_c -> Bool,
|
||||||
class_b_timeout -> Integer,
|
class_b_timeout -> Integer,
|
||||||
class_b_ping_slot_nb_k -> Integer,
|
class_b_ping_slot_periodicity -> Integer,
|
||||||
class_b_ping_slot_dr -> SmallInt,
|
class_b_ping_slot_dr -> SmallInt,
|
||||||
class_b_ping_slot_freq -> BigInt,
|
class_b_ping_slot_freq -> BigInt,
|
||||||
class_c_timeout -> Integer,
|
class_c_timeout -> Integer,
|
||||||
@ -178,7 +178,7 @@ diesel::table! {
|
|||||||
multicast_group_type -> Text,
|
multicast_group_type -> Text,
|
||||||
multicast_class_c_scheduling_type -> Text,
|
multicast_class_c_scheduling_type -> Text,
|
||||||
multicast_dr -> SmallInt,
|
multicast_dr -> SmallInt,
|
||||||
multicast_class_b_ping_slot_nb_k -> SmallInt,
|
multicast_class_b_ping_slot_periodicity -> SmallInt,
|
||||||
multicast_frequency -> BigInt,
|
multicast_frequency -> BigInt,
|
||||||
multicast_timeout -> SmallInt,
|
multicast_timeout -> SmallInt,
|
||||||
multicast_session_start -> Nullable<TimestamptzSqlite>,
|
multicast_session_start -> Nullable<TimestamptzSqlite>,
|
||||||
@ -266,7 +266,7 @@ diesel::table! {
|
|||||||
group_type -> Text,
|
group_type -> Text,
|
||||||
dr -> SmallInt,
|
dr -> SmallInt,
|
||||||
frequency -> BigInt,
|
frequency -> BigInt,
|
||||||
class_b_ping_slot_nb_k -> SmallInt,
|
class_b_ping_slot_periodicity -> SmallInt,
|
||||||
class_c_scheduling_type -> Text,
|
class_c_scheduling_type -> Text,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ async fn test_multicast() {
|
|||||||
group_type: "C".into(),
|
group_type: "C".into(),
|
||||||
dr: 3,
|
dr: 3,
|
||||||
frequency: 868300000,
|
frequency: 868300000,
|
||||||
class_b_ping_slot_nb_k: 0,
|
class_b_ping_slot_periodicity: 0,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
|
@ -70,7 +70,7 @@ function DeviceProfileTemplateForm(props: IProps) {
|
|||||||
// class-b
|
// class-b
|
||||||
dp.setSupportsClassB(v.supportsClassB);
|
dp.setSupportsClassB(v.supportsClassB);
|
||||||
dp.setClassBTimeout(v.classBTimeout);
|
dp.setClassBTimeout(v.classBTimeout);
|
||||||
dp.setClassBPingSlotNbK(v.classBPingSlotNbK);
|
dp.setClassBPingSlotPeriodicity(v.classBPingSlotPeriodicity);
|
||||||
dp.setClassBPingSlotDr(v.classBPingSlotDr);
|
dp.setClassBPingSlotDr(v.classBPingSlotDr);
|
||||||
dp.setClassBPingSlotFreq(v.classBPingSlotFreq);
|
dp.setClassBPingSlotFreq(v.classBPingSlotFreq);
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ function DeviceProfileTemplateForm(props: IProps) {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label="Class-B ping-slot periodicity"
|
label="Class-B ping-slot periodicity"
|
||||||
tooltip="This value must match the ping-slot periodicity of the device. Please refer to the device documentation."
|
tooltip="This value must match the ping-slot periodicity of the device. Please refer to the device documentation."
|
||||||
name="classBPingSlotNbK"
|
name="classBPingSlotPeriodicity"
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -259,7 +259,7 @@ function DeviceProfileForm(props: IProps) {
|
|||||||
// class-b
|
// class-b
|
||||||
dp.setSupportsClassB(v.supportsClassB);
|
dp.setSupportsClassB(v.supportsClassB);
|
||||||
dp.setClassBTimeout(v.classBTimeout);
|
dp.setClassBTimeout(v.classBTimeout);
|
||||||
dp.setClassBPingSlotNbK(v.classBPingSlotNbK);
|
dp.setClassBPingSlotPeriodicity(v.classBPingSlotPeriodicity);
|
||||||
dp.setClassBPingSlotDr(v.classBPingSlotDr);
|
dp.setClassBPingSlotDr(v.classBPingSlotDr);
|
||||||
dp.setClassBPingSlotFreq(v.classBPingSlotFreq);
|
dp.setClassBPingSlotFreq(v.classBPingSlotFreq);
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ function DeviceProfileForm(props: IProps) {
|
|||||||
supportsClassC: dp.getSupportsClassC(),
|
supportsClassC: dp.getSupportsClassC(),
|
||||||
classCTimeout: dp.getClassCTimeout(),
|
classCTimeout: dp.getClassCTimeout(),
|
||||||
classBTimeout: dp.getClassBTimeout(),
|
classBTimeout: dp.getClassBTimeout(),
|
||||||
classBPingSlotNbK: dp.getClassBPingSlotNbK(),
|
classBPingSlotPeriodicity: dp.getClassBPingSlotPeriodicity(),
|
||||||
classBPingSlotDr: dp.getClassBPingSlotDr(),
|
classBPingSlotDr: dp.getClassBPingSlotDr(),
|
||||||
classBPingSlotFreq: dp.getClassBPingSlotFreq(),
|
classBPingSlotFreq: dp.getClassBPingSlotFreq(),
|
||||||
abpRx1Delay: dp.getAbpRx1Delay(),
|
abpRx1Delay: dp.getAbpRx1Delay(),
|
||||||
@ -662,7 +662,7 @@ function DeviceProfileForm(props: IProps) {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label="Class-B ping-slot periodicity"
|
label="Class-B ping-slot periodicity"
|
||||||
tooltip="This value must match the ping-slot periodicity of the device. Please refer to the device documentation."
|
tooltip="This value must match the ping-slot periodicity of the device. Please refer to the device documentation."
|
||||||
name="classBPingSlotNbK"
|
name="classBPingSlotPeriodicity"
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -67,7 +67,7 @@ function FuotaDeploymentForm(props: IProps) {
|
|||||||
d.setDeviceProfileId(v.deviceProfileId);
|
d.setDeviceProfileId(v.deviceProfileId);
|
||||||
d.setUnicastMaxRetryCount(v.unicastMaxRetryCount);
|
d.setUnicastMaxRetryCount(v.unicastMaxRetryCount);
|
||||||
d.setMulticastGroupType(v.multicastGroupType);
|
d.setMulticastGroupType(v.multicastGroupType);
|
||||||
d.setMulticastClassBPingSlotNbK(v.multicastClassBPingSlotNbK);
|
d.setMulticastClassBPingSlotPeriodicity(v.multicastClassBPingSlotPeriodicity);
|
||||||
d.setMulticastClassCSchedulingType(v.multicastClassCSchedulingType);
|
d.setMulticastClassCSchedulingType(v.multicastClassCSchedulingType);
|
||||||
d.setMulticastDr(v.multicastDr);
|
d.setMulticastDr(v.multicastDr);
|
||||||
d.setMulticastFrequency(v.multicastFrequency);
|
d.setMulticastFrequency(v.multicastFrequency);
|
||||||
@ -199,7 +199,7 @@ function FuotaDeploymentForm(props: IProps) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
<Form.Item label="Class-B ping-slot periodicity" name="multicastClassBPingSlotNbK">
|
<Form.Item label="Class-B ping-slot periodicity" name="multicastClassBPingSlotPeriodicity">
|
||||||
<Select disabled={!isMulticastClassB || props.disabled}>
|
<Select disabled={!isMulticastClassB || props.disabled}>
|
||||||
<Select.Option value={0}>Every second</Select.Option>
|
<Select.Option value={0}>Every second</Select.Option>
|
||||||
<Select.Option value={1}>Every 2 seconds</Select.Option>
|
<Select.Option value={1}>Every 2 seconds</Select.Option>
|
||||||
|
@ -47,7 +47,7 @@ function MulticastGroupForm(props: IProps) {
|
|||||||
mg.setFrequency(v.frequency);
|
mg.setFrequency(v.frequency);
|
||||||
mg.setRegion(v.region);
|
mg.setRegion(v.region);
|
||||||
mg.setGroupType(v.groupType);
|
mg.setGroupType(v.groupType);
|
||||||
mg.setClassBPingSlotNbK(v.classBPingSlotNbK);
|
mg.setClassBPingSlotPeriodicity(v.classBPingSlotPeriodicity);
|
||||||
mg.setClassCSchedulingType(v.classCSchedulingType);
|
mg.setClassCSchedulingType(v.classCSchedulingType);
|
||||||
|
|
||||||
props.onFinish(mg);
|
props.onFinish(mg);
|
||||||
@ -146,7 +146,7 @@ function MulticastGroupForm(props: IProps) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
<Form.Item label="Class-B ping-slot periodicity" name="classBPingSlotNbK">
|
<Form.Item label="Class-B ping-slot periodicity" name="classBPingSlotPeriodicity">
|
||||||
<Select disabled={!selectPingSlotPeriod || props.disabled}>
|
<Select disabled={!selectPingSlotPeriod || props.disabled}>
|
||||||
<Select.Option value={0}>Every second</Select.Option>
|
<Select.Option value={0}>Every second</Select.Option>
|
||||||
<Select.Option value={1}>Every 2 seconds</Select.Option>
|
<Select.Option value={1}>Every 2 seconds</Select.Option>
|
||||||
|
Reference in New Issue
Block a user