MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / update_deployment

Method update_deployment

chirpstack/src/api/fuota.rs:187–266  ·  view source on GitHub ↗
(
        &self,
        request: Request<api::UpdateFuotaDeploymentRequest>,
    )

Source from the content-addressed store, hash-verified

185 }
186
187 async fn update_deployment(
188 &self,
189 request: Request<api::UpdateFuotaDeploymentRequest>,
190 ) -> Result<Response<()>, Status> {
191 let req_dp = match &request.get_ref().deployment {
192 Some(v) => v,
193 None => {
194 return Err(Status::invalid_argument("deployment is missing"));
195 }
196 };
197
198 let id = Uuid::from_str(&req_dp.id).map_err(|e| e.status())?;
199 let app_id = Uuid::from_str(&req_dp.application_id).map_err(|e| e.status())?;
200 let dp_id = Uuid::from_str(&req_dp.device_profile_id).map_err(|e| e.status())?;
201
202 self.validator
203 .validate(
204 request.extensions(),
205 validator::ValidateFuotaDeploymentAccess::new(validator::Flag::Update, dp_id),
206 )
207 .await?;
208
209 let d = fuota::get_deployment(id).await.map_err(|e| e.status())?;
210 if d.started_at.is_some() {
211 return Err(Status::failed_precondition(
212 "FUOTA deployment has already started",
213 ));
214 }
215
216 let mut dp = fuota::FuotaDeployment {
217 id: id.into(),
218 name: req_dp.name.clone(),
219 application_id: app_id.into(),
220 device_profile_id: dp_id.into(),
221 multicast_group_type: match req_dp.multicast_group_type() {
222 api::MulticastGroupType::ClassB => "B",
223 api::MulticastGroupType::ClassC => "C",
224 }
225 .to_string(),
226 multicast_class_c_scheduling_type: req_dp
227 .multicast_class_c_scheduling_type()
228 .from_proto(),
229 multicast_dr: req_dp.multicast_dr as i16,
230 multicast_class_b_ping_slot_periodicity: req_dp.multicast_class_b_ping_slot_periodicity
231 as i16,
232 multicast_frequency: req_dp.multicast_frequency as i64,
233 multicast_timeout: req_dp.multicast_timeout as i16,
234 unicast_max_retry_count: req_dp.unicast_max_retry_count as i16,
235 fragmentation_fragment_size: req_dp.fragmentation_fragment_size as i16,
236 fragmentation_redundancy_percentage: req_dp.fragmentation_redundancy_percentage as i16,
237 fragmentation_session_index: req_dp.fragmentation_session_index as i16,
238 fragmentation_matrix: req_dp.fragmentation_matrix as i16,
239 fragmentation_block_ack_delay: req_dp.fragmentation_block_ack_delay as i16,
240 fragmentation_descriptor: req_dp.fragmentation_descriptor.clone(),
241 request_fragmentation_session_status: req_dp
242 .request_fragmentation_session_status()
243 .from_proto(),
244 payload: req_dp.payload.clone(),

Callers 1

test_fuotaFunction · 0.80

Calls 11

get_deploymentFunction · 0.85
get_max_fragment_sizeFunction · 0.85
get_multicast_timeoutFunction · 0.85
update_deploymentFunction · 0.85
statusMethod · 0.80
to_stringMethod · 0.80
from_protoMethod · 0.80
insertMethod · 0.80
unwrapMethod · 0.80
validateMethod · 0.45
intoMethod · 0.45

Tested by 1

test_fuotaFunction · 0.64