Skip to main content

openthread/ot/
multi_radio_neighbor_info.rs

1// Copyright 2026 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use crate::prelude_internal::*;
6
7/// Methods from the "Multi Radio Link " group [1]
8///
9/// [1] https://openthread.io/reference/group/api-multi-radio
10pub trait MultiRadioLink {
11    /// Gets the multi radio link information associated with a neighbor with a given Extended Address.
12    fn multi_radio_get_neighbor_info(
13        &self,
14        ext_addr: &ExtAddress,
15    ) -> Result<MultiRadioNeighborInfo>;
16}
17
18impl<T: MultiRadioLink + ot::Boxable> MultiRadioLink for ot::Box<T> {
19    fn multi_radio_get_neighbor_info(
20        &self,
21        ext_addr: &ExtAddress,
22    ) -> Result<MultiRadioNeighborInfo> {
23        self.as_ref().multi_radio_get_neighbor_info(ext_addr)
24    }
25}
26
27impl MultiRadioLink for Instance {
28    fn multi_radio_get_neighbor_info(
29        &self,
30        ext_addr: &ExtAddress,
31    ) -> Result<MultiRadioNeighborInfo> {
32        let mut info = MultiRadioNeighborInfo::default();
33        Error::from(unsafe {
34            otMultiRadioGetNeighborInfo(
35                self.as_ot_ptr(),
36                ext_addr.as_ot_ptr(),
37                info.as_ot_mut_ptr(),
38            )
39        })
40        .into_result()?;
41        Ok(info)
42    }
43}