openthread/ot/types/
router_info.rsuse crate::prelude_internal::*;
#[derive(Default, Clone)]
#[repr(transparent)]
pub struct RouterInfo(pub otRouterInfo);
impl_ot_castable!(RouterInfo, otRouterInfo);
impl RouterInfo {
pub fn empty() -> RouterInfo {
Self::default()
}
}
impl std::fmt::Debug for RouterInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut ds = f.debug_struct("RouterInfo");
ds.field("ext_address", &self.get_ext_address());
ds.field("rloc16", &self.get_rloc16());
ds.field("router_id", &self.get_router_id());
ds.field("next_hop", &self.get_next_hop());
ds.field("path_cost", &self.get_path_cost());
ds.field("link_quality_in", &self.get_link_quality_in());
ds.field("link_quality_out", &self.get_link_quality_out());
ds.field("age", &self.get_age());
ds.field("allocated", &self.get_allocated());
ds.field("link_established", &self.get_link_established());
ds.finish()
}
}
impl RouterInfo {
pub fn get_ext_address(&self) -> ExtAddress {
self.0.mExtAddress.into()
}
pub fn get_rloc16(&self) -> u16 {
self.0.mRloc16
}
pub fn get_router_id(&self) -> u8 {
self.0.mRouterId
}
pub fn get_next_hop(&self) -> u8 {
self.0.mNextHop
}
pub fn get_path_cost(&self) -> u8 {
self.0.mPathCost
}
pub fn get_link_quality_in(&self) -> u8 {
self.0.mLinkQualityIn
}
pub fn get_link_quality_out(&self) -> u8 {
self.0.mLinkQualityOut
}
pub fn get_age(&self) -> u8 {
self.0.mAge
}
pub fn get_allocated(&self) -> bool {
self.0.mAllocated()
}
pub fn get_link_established(&self) -> bool {
self.0.mLinkEstablished()
}
}