(qi: multicast::MulticastGroupQueueItem)
| 259 | } |
| 260 | |
| 261 | pub async fn enqueue(qi: multicast::MulticastGroupQueueItem) -> Result<u32> { |
| 262 | // Try first to get configured gateways for multicast-group. |
| 263 | let mut gateway_ids = multicast::get_gateway_ids(&qi.multicast_group_id).await?; |
| 264 | |
| 265 | // Fallback to automatic gateway-set detection. |
| 266 | if gateway_ids.is_empty() { |
| 267 | // get deveuis for multicast-group |
| 268 | let dev_euis = multicast::get_dev_euis(&qi.multicast_group_id).await?; |
| 269 | |
| 270 | // get gateway history |
| 271 | let dev_gw_history = device::get_gateway_history_for_dev_euis(&dev_euis).await?; |
| 272 | |
| 273 | // get minimum gateway set to cover all devices |
| 274 | gateway_ids = get_minimum_gateway_set(&dev_gw_history)?; |
| 275 | } |
| 276 | |
| 277 | // Enqueue multicast downlink for the given gw set. |
| 278 | let (_, f_cnt) = multicast::enqueue(qi, &gateway_ids).await?; |
| 279 | Ok(f_cnt) |
| 280 | } |
| 281 | |
| 282 | fn get_minimum_gateway_set( |
| 283 | dev_gw_history: &HashMap<EUI64, Vec<internal::GatewayRxInfoHistory>>, |
nothing calls this directly
no test coverage detected