Skip to main content

openthread/ot/types/
commissioning_dataset.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/// Functional equivalent of [`otsys::otCommissioningDataset`](crate::otsys::otCommissioningDataset).
8#[derive(Debug, Default, Clone)]
9#[repr(transparent)]
10pub struct CommissioningDataset(pub otCommissioningDataset);
11
12impl_ot_castable!(CommissioningDataset, otCommissioningDataset);
13
14impl CommissioningDataset {
15    /// Whether the Dataset contains any extra unknown sub-TLV.
16    pub fn has_extra_tlv(&self) -> bool {
17        self.0.mHasExtraTlv()
18    }
19
20    /// Whether the Joiner UDP Port is set.
21    pub fn is_joiner_udp_port_set(&self) -> bool {
22        self.0.mIsJoinerUdpPortSet()
23    }
24
25    /// Whether the Border Router RLOC16 is set.
26    pub fn is_locator_set(&self) -> bool {
27        self.0.mIsLocatorSet()
28    }
29
30    /// Whether the Commissioner Session Id is set.
31    pub fn is_session_id_set(&self) -> bool {
32        self.0.mIsSessionIdSet()
33    }
34
35    /// Whether the Steering Data is set.
36    pub fn is_steering_data_set(&self) -> bool {
37        self.0.mIsSteeringDataSet()
38    }
39
40    /// Returns the Joiner UDP Port.
41    pub fn joiner_udp_port(&self) -> u16 {
42        self.0.mJoinerUdpPort
43    }
44
45    /// Returns the Border Router RLOC16.
46    pub fn locator(&self) -> u16 {
47        self.0.mLocator
48    }
49
50    /// Returns the Commissioner Session Id.
51    pub fn session_id(&self) -> u16 {
52        self.0.mSessionId
53    }
54
55    /// Returns the Steering Data.
56    pub fn steering_data(&self) -> &SteeringData {
57        (&self.0.mSteeringData).into()
58    }
59}