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

Method get_queue

chirpstack/src/api/device.rs:1220–1263  ·  view source on GitHub ↗
(
        &self,
        request: Request<api::GetDeviceQueueItemsRequest>,
    )

Source from the content-addressed store, hash-verified

1218 }
1219
1220 async fn get_queue(
1221 &self,
1222 request: Request<api::GetDeviceQueueItemsRequest>,
1223 ) -> Result<Response<api::GetDeviceQueueItemsResponse>, Status> {
1224 let req = request.get_ref();
1225 let dev_eui = EUI64::from_str(&req.dev_eui).map_err(|e| e.status())?;
1226
1227 self.validator
1228 .validate(
1229 request.extensions(),
1230 validator::ValidateDeviceQueueAccess::new(validator::Flag::List, dev_eui),
1231 )
1232 .await?;
1233
1234 let items = device_queue::get_for_dev_eui(&dev_eui)
1235 .await
1236 .map_err(|e| e.status())?;
1237
1238 let mut resp = Response::new(api::GetDeviceQueueItemsResponse {
1239 total_count: items.len() as u32,
1240 result: items
1241 .iter()
1242 .map(|qi| api::DeviceQueueItem {
1243 id: qi.id.to_string(),
1244 dev_eui: qi.dev_eui.to_string(),
1245 confirmed: qi.confirmed,
1246 f_port: qi.f_port as u32,
1247 data: qi.data.clone(),
1248 object: None,
1249 is_pending: qi.is_pending,
1250 f_cnt_down: qi.f_cnt_down.unwrap_or(0) as u32,
1251 is_encrypted: qi.is_encrypted,
1252 expires_at: qi.expires_at.map(|v| {
1253 let v: std::time::SystemTime = v.into();
1254 v.into()
1255 }),
1256 })
1257 .collect(),
1258 });
1259 resp.metadata_mut()
1260 .insert("x-log-dev_eui", req.dev_eui.parse().unwrap());
1261
1262 Ok(resp)
1263 }
1264
1265 async fn get_next_f_cnt_down(
1266 &self,

Callers 1

test_deviceFunction · 0.80

Calls 8

statusMethod · 0.80
iterMethod · 0.80
to_stringMethod · 0.80
insertMethod · 0.80
unwrapMethod · 0.80
get_for_dev_euiFunction · 0.50
validateMethod · 0.45
intoMethod · 0.45

Tested by 1

test_deviceFunction · 0.64