mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-04-08 20:04:19 +00:00
Fix cargo clippy feedback.
This commit is contained in:
parent
5ce35eef5e
commit
849d27f148
chirpstack-integration/src
chirpstack/src
api
applayer
cmd
downlink
integration
maccommand
storage
stream
test
lrwn/src
@ -203,7 +203,7 @@ impl Integration {
|
||||
|
||||
for stream_key in &srr.keys {
|
||||
for stream_id in &stream_key.ids {
|
||||
redis::cmd("XACK")
|
||||
let _: () = redis::cmd("XACK")
|
||||
.arg(&key)
|
||||
.arg(&self.consumer_group)
|
||||
.arg(&stream_id.id)
|
||||
|
@ -2010,7 +2010,7 @@ pub mod test {
|
||||
let mut create_req = Request::new(create_req);
|
||||
create_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let create_resp = service.create(create_req).await.unwrap();
|
||||
let create_resp = create_resp.get_ref();
|
||||
|
||||
@ -2021,7 +2021,7 @@ pub mod test {
|
||||
let mut get_req = Request::new(get_req);
|
||||
get_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let get_resp = service.get(get_req).await.unwrap();
|
||||
assert_eq!(
|
||||
Some(api::Application {
|
||||
@ -2045,7 +2045,7 @@ pub mod test {
|
||||
let mut up_req = Request::new(up_req);
|
||||
up_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let _ = service.update(up_req).await.unwrap();
|
||||
|
||||
//get
|
||||
@ -2055,7 +2055,7 @@ pub mod test {
|
||||
let mut get_req = Request::new(get_req);
|
||||
get_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let get_resp = service.get(get_req).await.unwrap();
|
||||
assert_eq!(
|
||||
Some(api::Application {
|
||||
@ -2077,7 +2077,7 @@ pub mod test {
|
||||
let mut list_req = Request::new(list_req);
|
||||
list_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let list_resp = service.list(list_req).await.unwrap();
|
||||
assert_eq!(1, list_resp.get_ref().total_count);
|
||||
assert_eq!(1, list_resp.get_ref().result.len());
|
||||
@ -2089,7 +2089,7 @@ pub mod test {
|
||||
let mut del_req = Request::new(del_req);
|
||||
del_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let _ = service.delete(del_req).await.unwrap();
|
||||
|
||||
let del_req = api::DeleteApplicationRequest {
|
||||
@ -2098,7 +2098,7 @@ pub mod test {
|
||||
let mut del_req = Request::new(del_req);
|
||||
del_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let del_resp = service.delete(del_req).await;
|
||||
assert!(del_resp.is_err());
|
||||
}
|
||||
|
@ -2483,7 +2483,7 @@ pub mod test {
|
||||
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_user.id.into(),
|
||||
user_id: tenant_user.id,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
@ -2491,7 +2491,7 @@ pub mod test {
|
||||
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_admin.id.into(),
|
||||
user_id: tenant_admin.id,
|
||||
is_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -2727,7 +2727,7 @@ pub mod test {
|
||||
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_admin.id.into(),
|
||||
user_id: tenant_admin.id,
|
||||
is_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -2735,21 +2735,21 @@ pub mod test {
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_user.id.into(),
|
||||
user_id: tenant_user.id,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
user_id: tenant_user.id.into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_user.id,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_user_other.id.into(),
|
||||
user_id: tenant_user_other.id,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
@ -3091,7 +3091,7 @@ pub mod test {
|
||||
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_admin.id.into(),
|
||||
user_id: tenant_admin.id,
|
||||
is_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -3099,7 +3099,7 @@ pub mod test {
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_device_admin.id.into(),
|
||||
user_id: tenant_device_admin.id,
|
||||
is_device_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -3107,7 +3107,7 @@ pub mod test {
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_gateway_admin.id.into(),
|
||||
user_id: tenant_gateway_admin.id,
|
||||
is_gateway_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -3115,7 +3115,7 @@ pub mod test {
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_user.id.into(),
|
||||
user_id: tenant_user.id,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
@ -3538,7 +3538,7 @@ pub mod test {
|
||||
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_admin.id.into(),
|
||||
user_id: tenant_admin.id,
|
||||
is_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -3546,7 +3546,7 @@ pub mod test {
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_device_admin.id.into(),
|
||||
user_id: tenant_device_admin.id,
|
||||
is_device_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -3554,7 +3554,7 @@ pub mod test {
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_gateway_admin.id.into(),
|
||||
user_id: tenant_gateway_admin.id,
|
||||
is_gateway_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -3562,7 +3562,7 @@ pub mod test {
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_user.id.into(),
|
||||
user_id: tenant_user.id,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
@ -3840,32 +3840,32 @@ pub mod test {
|
||||
.await;
|
||||
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
user_id: tenant_admin.id.into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_admin.id,
|
||||
is_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
user_id: tenant_device_admin.id.into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_device_admin.id,
|
||||
is_device_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
user_id: tenant_gateway_admin.id.into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_gateway_admin.id,
|
||||
is_gateway_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
user_id: tenant_user.id.into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_user.id,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
@ -4093,8 +4093,8 @@ pub mod test {
|
||||
.await;
|
||||
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
user_id: tenant_user.id.into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_user.id,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
@ -4237,7 +4237,7 @@ pub mod test {
|
||||
let gw_api_key_tenant = gateway::create(gateway::Gateway {
|
||||
name: "test-gw-tenant".into(),
|
||||
gateway_id: EUI64::from_str("0202030405060708").unwrap(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
@ -4245,7 +4245,7 @@ pub mod test {
|
||||
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_admin.id.into(),
|
||||
user_id: tenant_admin.id,
|
||||
is_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -4253,7 +4253,7 @@ pub mod test {
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_gateway_admin.id.into(),
|
||||
user_id: tenant_gateway_admin.id,
|
||||
is_gateway_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
@ -4261,7 +4261,7 @@ pub mod test {
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: tenant_a.id,
|
||||
user_id: tenant_user.id.into(),
|
||||
user_id: tenant_user.id,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
@ -4513,32 +4513,32 @@ pub mod test {
|
||||
.await;
|
||||
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
user_id: tenant_admin.id.into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_admin.id,
|
||||
is_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
user_id: tenant_device_admin.id.into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_device_admin.id,
|
||||
is_device_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
user_id: tenant_gateway_admin.id.into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_gateway_admin.id,
|
||||
is_gateway_admin: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
user_id: tenant_user.id.into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_user.id,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
@ -4901,7 +4901,7 @@ pub mod test {
|
||||
.await
|
||||
.unwrap();
|
||||
tenant::add_user(tenant::TenantUser {
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap().into(),
|
||||
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||
user_id: tenant_device_admin.id,
|
||||
is_device_admin: true,
|
||||
..Default::default()
|
||||
|
@ -88,7 +88,7 @@ impl DeviceProfileService for DeviceProfile {
|
||||
rx1_delay: req_dp.abp_rx1_delay as u8,
|
||||
rx1_dr_offset: req_dp.abp_rx1_dr_offset as u8,
|
||||
rx2_dr: req_dp.abp_rx2_dr as u8,
|
||||
rx2_freq: req_dp.abp_rx2_freq as u32,
|
||||
rx2_freq: req_dp.abp_rx2_freq,
|
||||
})
|
||||
},
|
||||
class_b_params: if req_dp.supports_class_b {
|
||||
@ -96,7 +96,7 @@ impl DeviceProfileService for DeviceProfile {
|
||||
timeout: req_dp.class_b_timeout as u16,
|
||||
ping_slot_nb_k: req_dp.class_b_ping_slot_nb_k as u8,
|
||||
ping_slot_dr: req_dp.class_b_ping_slot_dr as u8,
|
||||
ping_slot_freq: req_dp.class_b_ping_slot_freq as u32,
|
||||
ping_slot_freq: req_dp.class_b_ping_slot_freq,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
@ -116,7 +116,7 @@ impl DeviceProfileService for DeviceProfile {
|
||||
relay_enabled: req_dp.relay_enabled,
|
||||
relay_cad_periodicity: req_dp.relay_cad_periodicity as u8,
|
||||
default_channel_index: req_dp.relay_default_channel_index as u8,
|
||||
second_channel_freq: req_dp.relay_second_channel_freq as u32,
|
||||
second_channel_freq: req_dp.relay_second_channel_freq,
|
||||
second_channel_dr: req_dp.relay_second_channel_dr as u8,
|
||||
second_channel_ack_offset: req_dp.relay_second_channel_ack_offset as u8,
|
||||
ed_activation_mode: req_dp.relay_ed_activation_mode().from_proto(),
|
||||
@ -344,7 +344,7 @@ impl DeviceProfileService for DeviceProfile {
|
||||
rx1_delay: req_dp.abp_rx1_delay as u8,
|
||||
rx1_dr_offset: req_dp.abp_rx1_dr_offset as u8,
|
||||
rx2_dr: req_dp.abp_rx2_dr as u8,
|
||||
rx2_freq: req_dp.abp_rx2_freq as u32,
|
||||
rx2_freq: req_dp.abp_rx2_freq,
|
||||
})
|
||||
},
|
||||
class_b_params: if req_dp.supports_class_b {
|
||||
@ -352,7 +352,7 @@ impl DeviceProfileService for DeviceProfile {
|
||||
timeout: req_dp.class_b_timeout as u16,
|
||||
ping_slot_nb_k: req_dp.class_b_ping_slot_nb_k as u8,
|
||||
ping_slot_dr: req_dp.class_b_ping_slot_dr as u8,
|
||||
ping_slot_freq: req_dp.class_b_ping_slot_freq as u32,
|
||||
ping_slot_freq: req_dp.class_b_ping_slot_freq,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
@ -372,7 +372,7 @@ impl DeviceProfileService for DeviceProfile {
|
||||
relay_enabled: req_dp.relay_enabled,
|
||||
relay_cad_periodicity: req_dp.relay_cad_periodicity as u8,
|
||||
default_channel_index: req_dp.relay_default_channel_index as u8,
|
||||
second_channel_freq: req_dp.relay_second_channel_freq as u32,
|
||||
second_channel_freq: req_dp.relay_second_channel_freq,
|
||||
second_channel_dr: req_dp.relay_second_channel_dr as u8,
|
||||
second_channel_ack_offset: req_dp.relay_second_channel_ack_offset as u8,
|
||||
ed_activation_mode: req_dp.relay_ed_activation_mode().from_proto(),
|
||||
@ -406,7 +406,6 @@ impl DeviceProfileService for DeviceProfile {
|
||||
ts004_f_port: app_layer_params.ts004_f_port as u8,
|
||||
ts005_version: app_layer_params.ts005_version().from_proto(),
|
||||
ts005_f_port: app_layer_params.ts005_f_port as u8,
|
||||
..Default::default()
|
||||
}
|
||||
},
|
||||
..Default::default()
|
||||
|
@ -50,9 +50,9 @@ impl ToStatus for storage::error::Error {
|
||||
storage::error::Error::ValidatorValidate(_) => {
|
||||
Status::new(Code::InvalidArgument, format!("{:#}", self))
|
||||
}
|
||||
storage::error::Error::MultiError(errors) => {
|
||||
storage::error::Error::Multi(errors) => {
|
||||
let errors = errors
|
||||
.into_iter()
|
||||
.iter()
|
||||
.map(|e| e.to_string())
|
||||
.collect::<Vec<String>>()
|
||||
.join(", ");
|
||||
|
@ -346,11 +346,11 @@ impl FuotaService for Fuota {
|
||||
started_at: d
|
||||
.started_at
|
||||
.as_ref()
|
||||
.map(|ts| helpers::datetime_to_prost_timestamp(ts)),
|
||||
.map(helpers::datetime_to_prost_timestamp),
|
||||
completed_at: d
|
||||
.completed_at
|
||||
.as_ref()
|
||||
.map(|ts| helpers::datetime_to_prost_timestamp(ts)),
|
||||
.map(helpers::datetime_to_prost_timestamp),
|
||||
name: d.name.clone(),
|
||||
})
|
||||
.collect(),
|
||||
@ -462,23 +462,23 @@ impl FuotaService for Fuota {
|
||||
completed_at: d
|
||||
.completed_at
|
||||
.as_ref()
|
||||
.map(|ts| helpers::datetime_to_prost_timestamp(ts)),
|
||||
.map(helpers::datetime_to_prost_timestamp),
|
||||
mc_group_setup_completed_at: d
|
||||
.mc_group_setup_completed_at
|
||||
.as_ref()
|
||||
.map(|ts| helpers::datetime_to_prost_timestamp(ts)),
|
||||
.map(helpers::datetime_to_prost_timestamp),
|
||||
mc_session_completed_at: d
|
||||
.mc_session_completed_at
|
||||
.as_ref()
|
||||
.map(|ts| helpers::datetime_to_prost_timestamp(ts)),
|
||||
.map(helpers::datetime_to_prost_timestamp),
|
||||
frag_session_setup_completed_at: d
|
||||
.frag_session_setup_completed_at
|
||||
.as_ref()
|
||||
.map(|ts| helpers::datetime_to_prost_timestamp(ts)),
|
||||
.map(helpers::datetime_to_prost_timestamp),
|
||||
frag_status_completed_at: d
|
||||
.frag_status_completed_at
|
||||
.as_ref()
|
||||
.map(|ts| helpers::datetime_to_prost_timestamp(ts)),
|
||||
.map(helpers::datetime_to_prost_timestamp),
|
||||
error_msg: d.error_msg.clone(),
|
||||
})
|
||||
.collect(),
|
||||
@ -624,7 +624,7 @@ impl FuotaService for Fuota {
|
||||
completed_at: j
|
||||
.completed_at
|
||||
.as_ref()
|
||||
.map(|ts| helpers::datetime_to_prost_timestamp(ts)),
|
||||
.map(helpers::datetime_to_prost_timestamp),
|
||||
max_retry_count: j.max_retry_count as u32,
|
||||
attempt_count: j.attempt_count as u32,
|
||||
scheduler_run_after: Some(helpers::datetime_to_prost_timestamp(
|
||||
|
@ -1036,7 +1036,7 @@ pub mod test {
|
||||
let mut create_req = Request::new(create_req);
|
||||
create_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let _ = service.create(create_req).await.unwrap();
|
||||
|
||||
// get
|
||||
@ -1046,7 +1046,7 @@ pub mod test {
|
||||
let mut get_req = Request::new(get_req);
|
||||
get_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let get_resp = service.get(get_req).await.unwrap();
|
||||
assert_eq!(
|
||||
Some(api::Gateway {
|
||||
@ -1082,7 +1082,7 @@ pub mod test {
|
||||
let mut up_req = Request::new(up_req);
|
||||
up_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let _ = service.update(up_req).await.unwrap();
|
||||
|
||||
// get
|
||||
@ -1092,7 +1092,7 @@ pub mod test {
|
||||
let mut get_req = Request::new(get_req);
|
||||
get_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let get_resp = service.get(get_req).await.unwrap();
|
||||
assert_eq!(
|
||||
Some(api::Gateway {
|
||||
@ -1121,7 +1121,7 @@ pub mod test {
|
||||
let mut list_req = Request::new(list_req);
|
||||
list_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let list_resp = service.list(list_req).await.unwrap();
|
||||
assert_eq!(1, list_resp.get_ref().total_count);
|
||||
assert_eq!(1, list_resp.get_ref().result.len());
|
||||
@ -1133,7 +1133,7 @@ pub mod test {
|
||||
let mut del_req = Request::new(del_req);
|
||||
del_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let _ = service.delete(del_req).await.unwrap();
|
||||
|
||||
let del_req = api::DeleteGatewayRequest {
|
||||
@ -1142,7 +1142,7 @@ pub mod test {
|
||||
let mut del_req = Request::new(del_req);
|
||||
del_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let del_resp = service.delete(del_req).await;
|
||||
assert!(del_resp.is_err());
|
||||
}
|
||||
@ -1220,7 +1220,7 @@ pub mod test {
|
||||
let mut stats_req = Request::new(stats_req);
|
||||
stats_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let stats_resp = service.get_metrics(stats_req).await.unwrap();
|
||||
let stats_resp = stats_resp.get_ref();
|
||||
assert_eq!(
|
||||
|
@ -484,7 +484,7 @@ pub mod test {
|
||||
let mut create_req = Request::new(create_req);
|
||||
create_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let create_resp = service.create(create_req).await.unwrap();
|
||||
|
||||
// get
|
||||
@ -494,7 +494,7 @@ pub mod test {
|
||||
let mut get_req = Request::new(get_req);
|
||||
get_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let get_resp = service.get(get_req).await.unwrap();
|
||||
assert_eq!(
|
||||
Some(api::Tenant {
|
||||
@ -524,7 +524,7 @@ pub mod test {
|
||||
let mut up_req = Request::new(up_req);
|
||||
up_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let _ = service.update(up_req).await.unwrap();
|
||||
|
||||
// get
|
||||
@ -534,7 +534,7 @@ pub mod test {
|
||||
let mut get_req = Request::new(get_req);
|
||||
get_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let get_resp = service.get(get_req).await.unwrap();
|
||||
assert_eq!(
|
||||
Some(api::Tenant {
|
||||
@ -559,7 +559,7 @@ pub mod test {
|
||||
let mut list_req = Request::new(list_req);
|
||||
list_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let list_resp = service.list(list_req).await.unwrap();
|
||||
assert_eq!(1, list_resp.get_ref().total_count);
|
||||
assert_eq!(1, list_resp.get_ref().result.len());
|
||||
@ -571,7 +571,7 @@ pub mod test {
|
||||
let mut del_req = Request::new(del_req);
|
||||
del_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let _ = service.delete(del_req).await.unwrap();
|
||||
|
||||
let del_req = api::DeleteTenantRequest {
|
||||
@ -580,7 +580,7 @@ pub mod test {
|
||||
let mut del_req = Request::new(del_req);
|
||||
del_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let del_resp = service.delete(del_req).await;
|
||||
assert!(del_resp.is_err());
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ pub mod test {
|
||||
let mut create_req = Request::new(create_req);
|
||||
create_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let create_resp = service.create(create_req).await.unwrap();
|
||||
|
||||
// get
|
||||
@ -304,7 +304,7 @@ pub mod test {
|
||||
let mut get_req = Request::new(get_req);
|
||||
get_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let get_resp = service.get(get_req).await.unwrap();
|
||||
assert_eq!(
|
||||
Some(api::User {
|
||||
@ -332,7 +332,7 @@ pub mod test {
|
||||
let mut up_req = Request::new(up_req);
|
||||
up_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let _ = service.update(up_req).await.unwrap();
|
||||
|
||||
// get
|
||||
@ -342,7 +342,7 @@ pub mod test {
|
||||
let mut get_req = Request::new(get_req);
|
||||
get_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let get_resp = service.get(get_req).await.unwrap();
|
||||
assert_eq!(
|
||||
Some(api::User {
|
||||
@ -364,7 +364,7 @@ pub mod test {
|
||||
let mut up_req = Request::new(up_req);
|
||||
up_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let _ = service.update_password(up_req).await.unwrap();
|
||||
|
||||
// list
|
||||
@ -375,7 +375,7 @@ pub mod test {
|
||||
let mut list_req = Request::new(list_req);
|
||||
list_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let list_resp = service.list(list_req).await.unwrap();
|
||||
// * Admin from migrations
|
||||
// * User that we created for auth
|
||||
@ -390,7 +390,7 @@ pub mod test {
|
||||
let mut del_req = Request::new(del_req);
|
||||
del_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let _ = service.delete(del_req).await.unwrap();
|
||||
|
||||
let del_req = api::DeleteUserRequest {
|
||||
@ -399,7 +399,7 @@ pub mod test {
|
||||
let mut del_req = Request::new(del_req);
|
||||
del_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let del_resp = service.delete(del_req).await;
|
||||
assert!(del_resp.is_err());
|
||||
|
||||
@ -409,7 +409,7 @@ pub mod test {
|
||||
let mut del_req = Request::new(del_req);
|
||||
del_req
|
||||
.extensions_mut()
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id).clone()));
|
||||
.insert(AuthID::User(Into::<uuid::Uuid>::into(u.id)));
|
||||
let del_resp = service.delete(del_req).await;
|
||||
assert!(del_resp.is_err());
|
||||
}
|
||||
|
@ -33,11 +33,8 @@ async fn handle_uplink_v100(
|
||||
) -> Result<()> {
|
||||
let pl = clocksync::v1::Payload::from_slice(true, data)?;
|
||||
|
||||
match pl {
|
||||
clocksync::v1::Payload::AppTimeReq(pl) => {
|
||||
handle_v1_app_time_req(dev, dp, rx_info, pl).await?
|
||||
}
|
||||
_ => {}
|
||||
if let clocksync::v1::Payload::AppTimeReq(pl) = pl {
|
||||
handle_v1_app_time_req(dev, dp, rx_info, pl).await?
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -51,11 +48,8 @@ async fn handle_uplink_v200(
|
||||
) -> Result<()> {
|
||||
let pl = clocksync::v2::Payload::from_slice(true, data)?;
|
||||
|
||||
match pl {
|
||||
clocksync::v2::Payload::AppTimeReq(pl) => {
|
||||
handle_v2_app_time_req(dev, dp, rx_info, pl).await?
|
||||
}
|
||||
_ => {}
|
||||
if let clocksync::v2::Payload::AppTimeReq(pl) = pl {
|
||||
handle_v2_app_time_req(dev, dp, rx_info, pl).await?
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -181,7 +175,7 @@ mod test {
|
||||
Test {
|
||||
name: "device synced".into(),
|
||||
rx_info: gw::UplinkRxInfo {
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).try_into().unwrap()),
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).into()),
|
||||
..Default::default()
|
||||
},
|
||||
req: clocksync::v1::AppTimeReqPayload {
|
||||
@ -196,7 +190,7 @@ mod test {
|
||||
Test {
|
||||
name: "device synced - ans required".into(),
|
||||
rx_info: gw::UplinkRxInfo {
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).try_into().unwrap()),
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).into()),
|
||||
..Default::default()
|
||||
},
|
||||
req: clocksync::v1::AppTimeReqPayload {
|
||||
@ -214,7 +208,7 @@ mod test {
|
||||
Test {
|
||||
name: "device not synced (positive correction)".into(),
|
||||
rx_info: gw::UplinkRxInfo {
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).try_into().unwrap()),
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).into()),
|
||||
..Default::default()
|
||||
},
|
||||
req: clocksync::v1::AppTimeReqPayload {
|
||||
@ -232,7 +226,7 @@ mod test {
|
||||
Test {
|
||||
name: "device not synced (negative correction)".into(),
|
||||
rx_info: gw::UplinkRxInfo {
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1200).try_into().unwrap()),
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1200).into()),
|
||||
..Default::default()
|
||||
},
|
||||
req: clocksync::v1::AppTimeReqPayload {
|
||||
@ -330,7 +324,7 @@ mod test {
|
||||
Test {
|
||||
name: "device synced".into(),
|
||||
rx_info: gw::UplinkRxInfo {
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).try_into().unwrap()),
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).into()),
|
||||
..Default::default()
|
||||
},
|
||||
req: clocksync::v2::AppTimeReqPayload {
|
||||
@ -345,7 +339,7 @@ mod test {
|
||||
Test {
|
||||
name: "device synced - ans required".into(),
|
||||
rx_info: gw::UplinkRxInfo {
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).try_into().unwrap()),
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).into()),
|
||||
..Default::default()
|
||||
},
|
||||
req: clocksync::v2::AppTimeReqPayload {
|
||||
@ -363,7 +357,7 @@ mod test {
|
||||
Test {
|
||||
name: "device not synced (positive correction)".into(),
|
||||
rx_info: gw::UplinkRxInfo {
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).try_into().unwrap()),
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1234).into()),
|
||||
..Default::default()
|
||||
},
|
||||
req: clocksync::v2::AppTimeReqPayload {
|
||||
@ -381,7 +375,7 @@ mod test {
|
||||
Test {
|
||||
name: "device not synced (negative correction)".into(),
|
||||
rx_info: gw::UplinkRxInfo {
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1200).try_into().unwrap()),
|
||||
time_since_gps_epoch: Some(Duration::from_secs(1200).into()),
|
||||
..Default::default()
|
||||
},
|
||||
req: clocksync::v2::AppTimeReqPayload {
|
||||
|
@ -514,7 +514,7 @@ impl Flow {
|
||||
FuotaJob::Enqueue,
|
||||
self.fuota_deployment
|
||||
.multicast_session_start
|
||||
.unwrap_or_else(|| Utc::now()),
|
||||
.unwrap_or_else(Utc::now),
|
||||
)));
|
||||
}
|
||||
|
||||
@ -671,7 +671,7 @@ impl Flow {
|
||||
FuotaJob::Enqueue,
|
||||
self.fuota_deployment
|
||||
.multicast_session_start
|
||||
.unwrap_or_else(|| Utc::now()),
|
||||
.unwrap_or_else(Utc::now),
|
||||
)))
|
||||
}
|
||||
}
|
||||
@ -770,7 +770,7 @@ impl Flow {
|
||||
FuotaJob::DeleteMcGroup,
|
||||
self.fuota_deployment
|
||||
.multicast_session_end
|
||||
.unwrap_or_else(|| Utc::now()),
|
||||
.unwrap_or_else(Utc::now),
|
||||
))),
|
||||
RequestFragmentationSessionStatus::AfterFragEnqueue => {
|
||||
Ok(Some((FuotaJob::FragStatus, Utc::now())))
|
||||
@ -779,7 +779,7 @@ impl Flow {
|
||||
FuotaJob::FragStatus,
|
||||
self.fuota_deployment
|
||||
.multicast_session_end
|
||||
.unwrap_or_else(|| Utc::now()),
|
||||
.unwrap_or_else(Utc::now),
|
||||
))),
|
||||
}
|
||||
}
|
||||
@ -866,7 +866,7 @@ impl Flow {
|
||||
FuotaJob::DeleteMcGroup,
|
||||
self.fuota_deployment
|
||||
.multicast_session_end
|
||||
.unwrap_or_else(|| Utc::now()),
|
||||
.unwrap_or_else(Utc::now),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
@ -1000,7 +1000,7 @@ pub fn run() {
|
||||
let conf = config::get();
|
||||
println!(
|
||||
"{}",
|
||||
reg.render_template(&template, &conf)
|
||||
reg.render_template(template, &conf)
|
||||
.expect("render configfile error")
|
||||
);
|
||||
}
|
||||
|
@ -1827,20 +1827,19 @@ impl Data {
|
||||
let set = lrwn::MACCommandSet::new(vec![lrwn::MACCommand::ConfigureFwdLimitReq(
|
||||
lrwn::ConfigureFwdLimitReqPayload {
|
||||
reload_rate: lrwn::FwdLimitReloadRatePL {
|
||||
overall_reload_rate: relay_params.relay_overall_limit_reload_rate as u8,
|
||||
overall_reload_rate: relay_params.relay_overall_limit_reload_rate,
|
||||
global_uplink_reload_rate: relay_params
|
||||
.relay_global_uplink_limit_reload_rate
|
||||
as u8,
|
||||
notify_reload_rate: relay_params.relay_notify_limit_reload_rate as u8,
|
||||
join_req_reload_rate: relay_params.relay_join_req_limit_reload_rate as u8,
|
||||
.relay_global_uplink_limit_reload_rate,
|
||||
notify_reload_rate: relay_params.relay_notify_limit_reload_rate,
|
||||
join_req_reload_rate: relay_params.relay_join_req_limit_reload_rate,
|
||||
reset_limit_counter: lrwn::ResetLimitCounter::NoChange,
|
||||
},
|
||||
load_capacity: lrwn::FwdLimitLoadCapacityPL {
|
||||
overall_limit_size: relay_params.relay_overall_limit_bucket_size as u8,
|
||||
global_uplink_limit_size: relay_params.relay_global_uplink_limit_bucket_size
|
||||
as u8,
|
||||
notify_limit_size: relay_params.relay_notify_limit_bucket_size as u8,
|
||||
join_req_limit_size: relay_params.relay_join_req_limit_bucket_size as u8,
|
||||
overall_limit_size: relay_params.relay_overall_limit_bucket_size,
|
||||
global_uplink_limit_size: relay_params
|
||||
.relay_global_uplink_limit_bucket_size,
|
||||
notify_limit_size: relay_params.relay_notify_limit_bucket_size,
|
||||
join_req_limit_size: relay_params.relay_join_req_limit_bucket_size,
|
||||
},
|
||||
},
|
||||
)]);
|
||||
@ -2052,7 +2051,7 @@ impl Data {
|
||||
if relay.enabled != relay_params.relay_enabled
|
||||
|| relay.cad_periodicity != relay_params.relay_cad_periodicity as u32
|
||||
|| relay.default_channel_index != relay_params.default_channel_index as u32
|
||||
|| relay.second_channel_freq != relay_params.second_channel_freq as u32
|
||||
|| relay.second_channel_freq != relay_params.second_channel_freq
|
||||
|| relay.second_channel_dr != relay_params.second_channel_dr as u32
|
||||
|| relay.second_channel_ack_offset != relay_params.second_channel_ack_offset as u32
|
||||
{
|
||||
@ -2063,17 +2062,17 @@ impl Data {
|
||||
true => 1,
|
||||
false => 0,
|
||||
},
|
||||
cad_periodicity: relay_params.relay_cad_periodicity as u8,
|
||||
default_ch_idx: relay_params.default_channel_index as u8,
|
||||
cad_periodicity: relay_params.relay_cad_periodicity,
|
||||
default_ch_idx: relay_params.default_channel_index,
|
||||
second_ch_idx: if relay_params.second_channel_freq > 0 {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
},
|
||||
second_ch_dr: relay_params.second_channel_dr as u8,
|
||||
second_ch_ack_offset: relay_params.second_channel_ack_offset as u8,
|
||||
second_ch_dr: relay_params.second_channel_dr,
|
||||
second_ch_ack_offset: relay_params.second_channel_ack_offset,
|
||||
},
|
||||
second_ch_freq: relay_params.second_channel_freq as u32,
|
||||
second_ch_freq: relay_params.second_channel_freq,
|
||||
},
|
||||
)]);
|
||||
mac_command::set_pending(&dev_eui, lrwn::CID::RelayConfReq, &set).await?;
|
||||
@ -2102,7 +2101,7 @@ impl Data {
|
||||
if relay.ed_activation_mode != relay_params.ed_activation_mode.to_u8() as u32
|
||||
|| relay.ed_smart_enable_level != relay_params.ed_smart_enable_level as u32
|
||||
|| relay.ed_back_off != relay_params.ed_back_off as u32
|
||||
|| relay.second_channel_freq != relay_params.second_channel_freq as u32
|
||||
|| relay.second_channel_freq != relay_params.second_channel_freq
|
||||
|| relay.second_channel_dr != relay_params.second_channel_dr as u32
|
||||
|| relay.second_channel_ack_offset != relay_params.second_channel_ack_offset as u32
|
||||
{
|
||||
@ -2110,19 +2109,19 @@ impl Data {
|
||||
lrwn::EndDeviceConfReqPayload {
|
||||
activation_relay_mode: lrwn::ActivationRelayMode {
|
||||
relay_mode_activation: relay_params.ed_activation_mode,
|
||||
smart_enable_level: relay_params.ed_smart_enable_level as u8,
|
||||
smart_enable_level: relay_params.ed_smart_enable_level,
|
||||
},
|
||||
channel_settings_ed: lrwn::ChannelSettingsED {
|
||||
second_ch_ack_offset: relay_params.second_channel_ack_offset as u8,
|
||||
second_ch_dr: relay_params.second_channel_dr as u8,
|
||||
second_ch_ack_offset: relay_params.second_channel_ack_offset,
|
||||
second_ch_dr: relay_params.second_channel_dr,
|
||||
second_ch_idx: if relay_params.second_channel_freq > 0 {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
},
|
||||
backoff: relay_params.ed_back_off as u8,
|
||||
backoff: relay_params.ed_back_off,
|
||||
},
|
||||
second_ch_freq: relay_params.second_channel_freq as u32,
|
||||
second_ch_freq: relay_params.second_channel_freq,
|
||||
},
|
||||
)]);
|
||||
mac_command::set_pending(&dev_eui, lrwn::CID::EndDeviceConfReq, &set).await?;
|
||||
|
@ -128,7 +128,7 @@ impl<'a> Integration<'a> {
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<'a> IntegrationTrait for Integration<'a> {
|
||||
impl IntegrationTrait for Integration<'_> {
|
||||
async fn uplink_event(
|
||||
&self,
|
||||
_vars: &HashMap<String, String>,
|
||||
|
@ -107,7 +107,7 @@ impl<'a> Integration<'a> {
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<'a> IntegrationTrait for Integration<'a> {
|
||||
impl IntegrationTrait for Integration<'_> {
|
||||
async fn uplink_event(
|
||||
&self,
|
||||
_vars: &HashMap<String, String>,
|
||||
|
@ -539,7 +539,7 @@ impl<'de> Deserialize<'de> for Eui64Wrapper {
|
||||
|
||||
struct Eui64WrapperVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for Eui64WrapperVisitor {
|
||||
impl Visitor<'_> for Eui64WrapperVisitor {
|
||||
type Value = Eui64Wrapper;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
@ -33,7 +33,7 @@ pub mod update_uplink_list;
|
||||
// This returns the mac-commands which must be sent back to the device as response and a bool
|
||||
// indicating if a downlink must be sent. For some mac-commands, no mac-command answer is required,
|
||||
// but the device expects a downlink as confirmation, even if the downlink frame is empty.
|
||||
pub async fn handle_uplink<'a>(
|
||||
pub async fn handle_uplink(
|
||||
uplink_frame_set: &UplinkFrameSet,
|
||||
cmds: &lrwn::MACCommandSet,
|
||||
tenant: &tenant::Tenant,
|
||||
|
@ -109,7 +109,7 @@ impl DeviceProfile {
|
||||
|
||||
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_freq = class_b_params.ping_slot_freq as u32;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ impl DeviceProfile {
|
||||
ds.rx1_delay = abp_params.rx1_delay as u32;
|
||||
ds.rx1_dr_offset = abp_params.rx1_dr_offset as u32;
|
||||
ds.rx2_dr = abp_params.rx2_dr as u32;
|
||||
ds.rx2_frequency = abp_params.rx2_freq as u32;
|
||||
ds.rx2_frequency = abp_params.rx2_freq;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ pub enum Error {
|
||||
NotAllowed(String),
|
||||
|
||||
#[error("Multiple errors")]
|
||||
MultiError(Vec<Error>),
|
||||
Multi(Vec<Error>),
|
||||
|
||||
#[error(transparent)]
|
||||
Diesel(#[from] diesel::result::Error),
|
||||
|
@ -10,18 +10,11 @@ use serde::{Deserialize, Serialize};
|
||||
#[cfg_attr(feature = "postgres", diesel(sql_type = Jsonb))]
|
||||
#[cfg_attr(feature = "sqlite", diesel(sql_type = Text))]
|
||||
#[serde(default)]
|
||||
#[derive(Default)]
|
||||
pub struct AppLayerParams {
|
||||
pub ts004_session_cnt: [u16; 4],
|
||||
}
|
||||
|
||||
impl Default for AppLayerParams {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
ts004_session_cnt: [0, 0, 0, 0],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "postgres")]
|
||||
impl deserialize::FromSql<Jsonb, Pg> for AppLayerParams {
|
||||
fn from_sql(value: <Pg as Backend>::RawValue<'_>) -> deserialize::Result<Self> {
|
||||
@ -33,7 +26,7 @@ impl deserialize::FromSql<Jsonb, Pg> for AppLayerParams {
|
||||
#[cfg(feature = "postgres")]
|
||||
impl serialize::ToSql<Jsonb, Pg> for AppLayerParams {
|
||||
fn to_sql<'b>(&'b self, out: &mut serialize::Output<'b, '_, Pg>) -> serialize::Result {
|
||||
let value = serde_json::to_value(&self)?;
|
||||
let value = serde_json::to_value(self)?;
|
||||
<serde_json::Value as serialize::ToSql<Jsonb, Pg>>::to_sql(&value, &mut out.reborrow())
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ impl deserialize::FromSql<Jsonb, Pg> for AbpParams {
|
||||
#[cfg(feature = "postgres")]
|
||||
impl serialize::ToSql<Jsonb, Pg> for AbpParams {
|
||||
fn to_sql<'b>(&'b self, out: &mut serialize::Output<'b, '_, Pg>) -> serialize::Result {
|
||||
let value = serde_json::to_value(&self)?;
|
||||
let value = serde_json::to_value(self)?;
|
||||
<serde_json::Value as serialize::ToSql<Jsonb, Pg>>::to_sql(&value, &mut out.reborrow())
|
||||
}
|
||||
}
|
||||
@ -77,7 +77,7 @@ impl deserialize::FromSql<Jsonb, Pg> for ClassBParams {
|
||||
#[cfg(feature = "postgres")]
|
||||
impl serialize::ToSql<Jsonb, Pg> for ClassBParams {
|
||||
fn to_sql<'b>(&'b self, out: &mut serialize::Output<'b, '_, Pg>) -> serialize::Result {
|
||||
let value = serde_json::to_value(&self)?;
|
||||
let value = serde_json::to_value(self)?;
|
||||
<serde_json::Value as serialize::ToSql<Jsonb, Pg>>::to_sql(&value, &mut out.reborrow())
|
||||
}
|
||||
}
|
||||
@ -122,7 +122,7 @@ impl deserialize::FromSql<Jsonb, Pg> for ClassCParams {
|
||||
#[cfg(feature = "postgres")]
|
||||
impl serialize::ToSql<Jsonb, Pg> for ClassCParams {
|
||||
fn to_sql<'b>(&'b self, out: &mut serialize::Output<'b, '_, Pg>) -> serialize::Result {
|
||||
let value = serde_json::to_value(&self)?;
|
||||
let value = serde_json::to_value(self)?;
|
||||
<serde_json::Value as serialize::ToSql<Jsonb, Pg>>::to_sql(&value, &mut out.reborrow())
|
||||
}
|
||||
}
|
||||
@ -189,7 +189,7 @@ impl deserialize::FromSql<Jsonb, Pg> for RelayParams {
|
||||
#[cfg(feature = "postgres")]
|
||||
impl serialize::ToSql<Jsonb, Pg> for RelayParams {
|
||||
fn to_sql<'b>(&'b self, out: &mut serialize::Output<'b, '_, Pg>) -> serialize::Result {
|
||||
let value = serde_json::to_value(&self)?;
|
||||
let value = serde_json::to_value(self)?;
|
||||
<serde_json::Value as serialize::ToSql<Jsonb, Pg>>::to_sql(&value, &mut out.reborrow())
|
||||
}
|
||||
}
|
||||
@ -263,14 +263,9 @@ impl Default for AppLayerParams {
|
||||
|
||||
impl AppLayerParams {
|
||||
pub fn is_app_layer_f_port(&self, f_port: u8) -> bool {
|
||||
if (self.ts003_version.is_some() && self.ts003_f_port == f_port)
|
||||
(self.ts003_version.is_some() && self.ts003_f_port == f_port)
|
||||
|| (self.ts004_version.is_some() && self.ts004_f_port == f_port)
|
||||
|| (self.ts005_version.is_some() && self.ts005_f_port == f_port)
|
||||
{
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,7 +280,7 @@ impl deserialize::FromSql<Jsonb, Pg> for AppLayerParams {
|
||||
#[cfg(feature = "postgres")]
|
||||
impl serialize::ToSql<Jsonb, Pg> for AppLayerParams {
|
||||
fn to_sql<'b>(&'b self, out: &mut serialize::Output<'b, '_, Pg>) -> serialize::Result {
|
||||
let value = serde_json::to_value(&self)?;
|
||||
let value = serde_json::to_value(self)?;
|
||||
<serde_json::Value as serialize::ToSql<Jsonb, Pg>>::to_sql(&value, &mut out.reborrow())
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ pub async fn add_devices(fuota_deployment_id: Uuid, dev_euis: Vec<EUI64>) -> Res
|
||||
if errors.is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::MultiError(errors))
|
||||
Err(Error::Multi(errors))
|
||||
}
|
||||
}
|
||||
|
||||
@ -552,7 +552,7 @@ pub async fn add_gateways(fuota_deployment_id: Uuid, gateway_ids: Vec<EUI64>) ->
|
||||
if errors.is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::MultiError(errors))
|
||||
Err(Error::Multi(errors))
|
||||
}
|
||||
}
|
||||
|
||||
@ -789,7 +789,7 @@ pub fn get_multicast_timeout(d: &FuotaDeployment) -> Result<usize> {
|
||||
conf.network.scheduler.multicast_class_c_margin.as_secs() as usize;
|
||||
|
||||
// Multiply by the number of fragments (+1 for additional margin).
|
||||
let mc_class_c_duration_secs = mc_class_c_margin_secs * (total_fragments + 1 as usize);
|
||||
let mc_class_c_duration_secs = mc_class_c_margin_secs * (total_fragments + 1);
|
||||
|
||||
// Calculate the timeout value. In case of Class-C, timeout is defined as seconds,
|
||||
// where the number of seconds is 2^timeout.
|
||||
|
@ -1012,7 +1012,7 @@ pub mod test {
|
||||
// invalid f_port
|
||||
assert!(enqueue(
|
||||
MulticastGroupQueueItem {
|
||||
multicast_group_id: mg.id.into(),
|
||||
multicast_group_id: mg.id,
|
||||
gateway_id: gw.gateway_id,
|
||||
f_cnt: 1,
|
||||
f_port: 0,
|
||||
@ -1026,7 +1026,7 @@ pub mod test {
|
||||
|
||||
assert!(enqueue(
|
||||
MulticastGroupQueueItem {
|
||||
multicast_group_id: mg.id.into(),
|
||||
multicast_group_id: mg.id,
|
||||
gateway_id: gw.gateway_id,
|
||||
f_cnt: 1,
|
||||
f_port: 256,
|
||||
@ -1041,7 +1041,7 @@ pub mod test {
|
||||
// Enqueue (Class-C) (delay)
|
||||
let (ids, f_cnt) = enqueue(
|
||||
MulticastGroupQueueItem {
|
||||
multicast_group_id: mg.id.into(),
|
||||
multicast_group_id: mg.id,
|
||||
gateway_id: gw.gateway_id,
|
||||
f_cnt: 1,
|
||||
f_port: 2,
|
||||
@ -1071,7 +1071,7 @@ pub mod test {
|
||||
let mut mg = update(mg).await.unwrap();
|
||||
let (ids, f_cnt) = enqueue(
|
||||
MulticastGroupQueueItem {
|
||||
multicast_group_id: mg.id.into(),
|
||||
multicast_group_id: mg.id,
|
||||
gateway_id: gw.gateway_id,
|
||||
f_cnt: 1,
|
||||
f_port: 2,
|
||||
@ -1098,7 +1098,7 @@ pub mod test {
|
||||
let mg = update(mg).await.unwrap();
|
||||
let (ids, f_cnt) = enqueue(
|
||||
MulticastGroupQueueItem {
|
||||
multicast_group_id: mg.id.into(),
|
||||
multicast_group_id: mg.id,
|
||||
gateway_id: gw.gateway_id,
|
||||
f_cnt: 1,
|
||||
f_port: 2,
|
||||
|
@ -449,8 +449,8 @@ pub mod test {
|
||||
let _d = device::create(device::Device {
|
||||
dev_eui: EUI64::from_str("0203040506070809").unwrap(),
|
||||
name: "test-device".into(),
|
||||
application_id: a.id.clone(),
|
||||
device_profile_id: dp.id.clone(),
|
||||
application_id: a.id,
|
||||
device_profile_id: dp.id,
|
||||
tags: build_tags(&[("common_tag", "value"), ("mytag", "dev_value")]),
|
||||
..Default::default()
|
||||
})
|
||||
|
@ -379,7 +379,7 @@ pub mod test {
|
||||
|
||||
let tu = TenantUser {
|
||||
tenant_id: t.id,
|
||||
user_id: user.id.into(),
|
||||
user_id: user.id,
|
||||
is_admin: true,
|
||||
..Default::default()
|
||||
};
|
||||
@ -480,7 +480,7 @@ pub mod test {
|
||||
|
||||
let tu = TenantUser {
|
||||
tenant_id: t.id,
|
||||
user_id: user.id.into(),
|
||||
user_id: user.id,
|
||||
is_admin: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
@ -14,7 +14,6 @@ use crate::storage::{get_async_redis_conn, redis_key};
|
||||
use chirpstack_api::{api, integration};
|
||||
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
|
||||
pub async fn log_event_for_device(typ: &str, dev_eui: &str, b: &[u8]) -> Result<()> {
|
||||
let conf = config::get();
|
||||
|
||||
|
@ -150,7 +150,7 @@ async fn test_fns_uplink() {
|
||||
// Simulate uplink
|
||||
uplink::handle_uplink(
|
||||
CommonName::EU868,
|
||||
"eu868".into(),
|
||||
"eu868",
|
||||
Uuid::new_v4(),
|
||||
gw::UplinkFrameSet {
|
||||
phy_payload: data_phy.to_vec().unwrap(),
|
||||
|
@ -5558,7 +5558,7 @@ async fn run_test(t: &Test) {
|
||||
|
||||
uplink::handle_uplink(
|
||||
CommonName::EU868,
|
||||
"eu868".into(),
|
||||
"eu868",
|
||||
Uuid::new_v4(),
|
||||
gw::UplinkFrameSet {
|
||||
phy_payload: t.phy_payload.to_vec().unwrap(),
|
||||
|
@ -462,7 +462,7 @@ async fn run_uplink_test(t: &UplinkTest) {
|
||||
|
||||
uplink::handle_uplink(
|
||||
CommonName::EU868,
|
||||
"eu868".into(),
|
||||
"eu868",
|
||||
Uuid::new_v4(),
|
||||
gw::UplinkFrameSet {
|
||||
phy_payload: t.phy_payload.to_vec().unwrap(),
|
||||
|
@ -367,7 +367,7 @@ async fn run_test(t: &Test) {
|
||||
|
||||
uplink::handle_uplink(
|
||||
CommonName::EU868,
|
||||
"eu868".into(),
|
||||
"eu868",
|
||||
Uuid::new_v4(),
|
||||
gw::UplinkFrameSet {
|
||||
phy_payload: t.phy_payload.to_vec().unwrap(),
|
||||
|
@ -190,7 +190,7 @@ async fn test_fns() {
|
||||
// Simulate uplink
|
||||
uplink::handle_uplink(
|
||||
CommonName::EU868,
|
||||
"eu868".into(),
|
||||
"eu868",
|
||||
Uuid::new_v4(),
|
||||
gw::UplinkFrameSet {
|
||||
phy_payload: jr_phy.to_vec().unwrap(),
|
||||
|
@ -1250,7 +1250,7 @@ async fn run_test(t: &Test) {
|
||||
|
||||
uplink::handle_uplink(
|
||||
CommonName::EU868,
|
||||
"eu868".into(),
|
||||
"eu868",
|
||||
Uuid::new_v4(),
|
||||
gw::UplinkFrameSet {
|
||||
phy_payload: t.phy_payload.to_vec().unwrap(),
|
||||
|
@ -821,7 +821,7 @@ async fn run_test(t: &Test) {
|
||||
|
||||
uplink::handle_uplink(
|
||||
CommonName::EU868,
|
||||
"eu868".into(),
|
||||
"eu868",
|
||||
Uuid::new_v4(),
|
||||
gw::UplinkFrameSet {
|
||||
phy_payload: t.phy_payload.to_vec().unwrap(),
|
||||
|
@ -220,7 +220,7 @@ async fn test_lorawan_10() {
|
||||
|
||||
uplink::handle_uplink(
|
||||
CommonName::EU868,
|
||||
"eu868".into(),
|
||||
"eu868",
|
||||
Uuid::new_v4(),
|
||||
gw::UplinkFrameSet {
|
||||
phy_payload: phy_relay_jr.to_vec().unwrap(),
|
||||
@ -293,8 +293,7 @@ async fn test_lorawan_10() {
|
||||
nb_trans: 1,
|
||||
region_config_id: "eu868".to_string(),
|
||||
..Default::default()
|
||||
}
|
||||
.into(),
|
||||
},
|
||||
),
|
||||
assert::downlink_frame(gw::DownlinkFrame {
|
||||
items: vec![
|
||||
|
@ -95,7 +95,7 @@ impl<'de> Deserialize<'de> for AES128Key {
|
||||
struct Aes128KeyVisitor;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
impl<'de> Visitor<'de> for Aes128KeyVisitor {
|
||||
impl Visitor<'_> for Aes128KeyVisitor {
|
||||
type Value = AES128Key;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
@ -266,7 +266,7 @@ impl PayloadCodec for FragSessionSetupReqPayload {
|
||||
mc_group_bit_mask: {
|
||||
let mut mask = [false; 4];
|
||||
for (i, v) in mask.iter_mut().enumerate() {
|
||||
*v = b[0] & 1 << i != 0;
|
||||
*v = b[0] & (1 << i) != 0;
|
||||
}
|
||||
mask
|
||||
},
|
||||
|
@ -302,7 +302,7 @@ impl PayloadCodec for FragSessionSetupReqPayload {
|
||||
mc_group_bit_mask: {
|
||||
let mut mask = [false; 4];
|
||||
for (i, v) in mask.iter_mut().enumerate() {
|
||||
*v = b[0] & 1 << i != 0;
|
||||
*v = b[0] & (1 << i) != 0;
|
||||
}
|
||||
mask
|
||||
},
|
||||
|
@ -92,7 +92,7 @@ impl<'de> Deserialize<'de> for DevAddrPrefix {
|
||||
struct DevAddrPrefixVisitor;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
impl<'de> Visitor<'de> for DevAddrPrefixVisitor {
|
||||
impl Visitor<'_> for DevAddrPrefixVisitor {
|
||||
type Value = DevAddrPrefix;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
@ -103,7 +103,7 @@ impl<'de> Deserialize<'de> for EUI64 {
|
||||
struct Eui64Visitor;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
impl<'de> Visitor<'de> for Eui64Visitor {
|
||||
impl Visitor<'_> for Eui64Visitor {
|
||||
type Value = EUI64;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
@ -251,7 +251,7 @@ impl<'de> Deserialize<'de> for EUI64Prefix {
|
||||
struct EUI64PrefixVisitor;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
impl<'de> Visitor<'de> for EUI64PrefixVisitor {
|
||||
impl Visitor<'_> for EUI64PrefixVisitor {
|
||||
type Value = EUI64Prefix;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
@ -1910,7 +1910,7 @@ impl ChannelSettingsED {
|
||||
ChannelSettingsED {
|
||||
second_ch_ack_offset: b[0] & 0x07,
|
||||
second_ch_dr: (b[0] & 0x78) >> 3,
|
||||
second_ch_idx: (b[0] & 0x80) >> 7 | (b[1] & 0x01) << 1,
|
||||
second_ch_idx: ((b[0] & 0x80) >> 7) | ((b[1] & 0x01) << 1),
|
||||
backoff: (b[1] & 0x7e) >> 1,
|
||||
}
|
||||
}
|
||||
@ -2419,7 +2419,7 @@ impl PowerLevel {
|
||||
let wor_snr = (wor_snr + 20) 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]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ impl<'de> Deserialize<'de> for NetID {
|
||||
struct NetIdVisitor;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
impl<'de> Visitor<'de> for NetIdVisitor {
|
||||
impl Visitor<'_> for NetIdVisitor {
|
||||
type Value = NetID;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
@ -892,7 +892,7 @@ impl Region for Configuration {
|
||||
min_dr
|
||||
} else {
|
||||
dr as u8
|
||||
} as u8;
|
||||
};
|
||||
|
||||
Ok(if dr > 5 { 5 } else { dr })
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ impl UplinkMetadata {
|
||||
let snr = (snr + 20) 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])
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user