struct DeviceChain {
_nodes: Vec<DeviceNode>,
_name: String,
locked: bool,
}
Expand description
Represents a device chain, which is a collection of DeviceNode objects. Part of the “Facade” pattern example.
Fields§
§_nodes: Vec<DeviceNode>
The list of DeviceNodes on this device chain.
_name: String
The Name of this device chain.
locked: bool
Whether this device chain is locked for access.
Implementations§
source§impl DeviceChain
impl DeviceChain
sourcepub fn new(name: &str) -> DeviceChain
pub fn new(name: &str) -> DeviceChain
sourcepub fn add_node(&mut self, node: DeviceNode)
pub fn add_node(&mut self, node: DeviceNode)
Helper method to add a DeviceNode to the device chain. DeviceNode objects that are of DEVICECONTROLLER are always inserted as the first device in the device chain, with the assumption there is only one DEVICECONTROLLER in a given device chain (this is not actually enforced, though).
Parameters
-
node
A DeviceNode object to add to the device chain.
sourcepub fn reset_visibility(&mut self)
pub fn reset_visibility(&mut self)
Resets the device chain so that all devices that are not CLdevices are no longer visible in the device chain.
sourcepub fn select_nodes(&mut self, node_select_mask: u32)
pub fn select_nodes(&mut self, node_select_mask: u32)
Make visible one or more devices in the device chain.
Parameters
-
node_select_mask
A bit mask specifying which device or devices to make visible, where bit 0 is the first device, bit 1 is the second, etc. Bit 0 is ignored as the first device is always visible.
sourcepub fn deselect_nodes(&mut self, node_select_mask: u32)
pub fn deselect_nodes(&mut self, node_select_mask: u32)
Make invisible one or more devices in the device chain.
Parameters
- node_select_mask
A bit mask specifying which device or devices to hide, where bit 0 is the first device, bit 1 is the second, etc. Bit 0 is ignored as the first device is always visible.
sourcepub fn get_id_codes_for_visible_nodes(&self) -> Vec<u32>
pub fn get_id_codes_for_visible_nodes(&self) -> Vec<u32>
Retrieve a list of idcodes for all devices that are visible in the device chain.
Returns
Returns an array of unsigned 32-bit integers corresponding to the idcodes of each visible device. The first idcode corresponds to the first visible device.
sourcefn _show_hide_nodes(&mut self, node_select_mask: u32, make_visible: bool)
fn _show_hide_nodes(&mut self, node_select_mask: u32, make_visible: bool)
Helper method to show or hide devices on the device chain.
Parameters
-
node_select_mask
A bit mask where the position of each bit corresponds to a device in the device chain, with bit 0 being the first device, bit 1 being the second device, and so on.
-
make_visible
true if the device is to be made visible on the device chain; otherwise false, the device cannot be seen on the device chain.