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

Method create_mc_group

chirpstack/src/applayer/fuota/flow.rs:105–161  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

103 }
104
105 async fn create_mc_group(&mut self) -> Result<Option<(FuotaJob, DateTime<Utc>)>> {
106 // If this job fails, then there is no need to execute the others.
107 if self.job.attempt_count > self.job.max_retry_count {
108 return Ok(None);
109 }
110
111 info!("Creating multicast-group for FUOTA deployment");
112 self.job.attempt_count += 1;
113
114 // Get McAppSKey + McNwkSKey.
115 let (mc_app_s_key, mc_nwk_s_key) = match self.device_profile.app_layer_params.ts005_version
116 {
117 Some(Ts005Version::V100) => (
118 multicastsetup::v1::get_mc_app_s_key(
119 self.fuota_deployment.multicast_key,
120 self.fuota_deployment.multicast_addr,
121 )?,
122 multicastsetup::v1::get_mc_net_s_key(
123 self.fuota_deployment.multicast_key,
124 self.fuota_deployment.multicast_addr,
125 )?,
126 ),
127 Some(Ts005Version::V200) => (
128 multicastsetup::v2::get_mc_app_s_key(
129 self.fuota_deployment.multicast_key,
130 self.fuota_deployment.multicast_addr,
131 )?,
132 multicastsetup::v2::get_mc_net_s_key(
133 self.fuota_deployment.multicast_key,
134 self.fuota_deployment.multicast_addr,
135 )?,
136 ),
137 None => return Err(anyhow!("Device-profile does not support TS005")),
138 };
139
140 let _ = multicast::create(multicast::MulticastGroup {
141 id: self.fuota_deployment.id,
142 application_id: self.fuota_deployment.application_id,
143 name: format!("fuota-{}", self.fuota_deployment.id),
144 region: self.device_profile.region,
145 mc_addr: self.fuota_deployment.multicast_addr,
146 mc_nwk_s_key,
147 mc_app_s_key,
148 f_cnt: 0,
149 group_type: self.fuota_deployment.multicast_group_type.clone(),
150 frequency: self.fuota_deployment.multicast_frequency,
151 dr: self.fuota_deployment.multicast_dr,
152 class_b_ping_slot_periodicity: self
153 .fuota_deployment
154 .multicast_class_b_ping_slot_periodicity,
155 class_c_scheduling_type: self.fuota_deployment.multicast_class_c_scheduling_type,
156 ..Default::default()
157 })
158 .await?;
159
160 Ok(Some((FuotaJob::AddDevsToMcGroup, Utc::now())))
161 }
162

Callers 1

dispatchMethod · 0.80

Calls 3

get_mc_app_s_keyFunction · 0.50
get_mc_net_s_keyFunction · 0.50
createFunction · 0.50

Tested by

no test coverage detected