Skip to main content

FixtureEngine

Struct FixtureEngine 

Source
pub struct FixtureEngine {
    fixtures: HashMap<String, Fixture>,
    dmx_config: Vec<[ChannelReservation; 512]>,
    receiver: Receiver<FixtureCommand>,
}
Expand description

The core engine managing fixture instances, thread synchronization, and DMX channel reservations.

Fields§

§fixtures: HashMap<String, Fixture>§dmx_config: Vec<[ChannelReservation; 512]>§receiver: Receiver<FixtureCommand>

Implementations§

Source§

impl FixtureEngine

Source

pub fn spawn() -> Result<Receiver<(usize, Vec<Fixture>)>, &'static str>

Spawns the fixture engine actor thread and returns an interface receiver channel for updates.

§Errors

Returns an error if the engine has already been started (preventing multiple instances).

Source

fn run(&mut self, interface_sender: Sender<(usize, Vec<Fixture>)>)

Main event loop processing incoming commands and triggering state notifications.

§Arguments
  • interface_sender - Channel used to broadcast updated fixture lists and universe counts to the runtime.
Source

fn new_fixture( &mut self, name: String, fixture_type_name: String, start_channel: ChannelIndex, start_universe: usize, ) -> Result<(), FixtureError>

Creates and registers a new fixture instance, verifying and reserving its DMX channels.

§Arguments
  • name - Unique name for the fixture instance
  • fixture_type_name - Template name of the registered fixture type
  • start_channel - DMX channel offset within the universe
  • start_universe - Target DMX universe index (0-based)
§Errors
  • FixtureNameAlreadyInUse – if the name is already taken
  • InvalidFixtureType - if fixture_type_name is not registered
  • [ChannelAlreadyInUse] – if required channels overlap with existing
  • ChannelOutOfRange - if any required channel is out of bounds ([MAX_CHANNEL]).
  • [UniverseOutOfRange] - if the fixture is in a non-existent universe
  • [DmxStateDesync] - if the DMX-State and the fixture registry are out of sync
Source

fn move_fixture( &mut self, name: String, new_channel: ChannelIndex, new_universe: usize, ) -> Result<(), FixtureError>

Relocates an existing fixture to a new channel and/or universe.

§Arguments
  • name - Name of the fixture to move
  • new_channel - New starting DMX channel index
  • new_universe - New target DMX universe index (0-based)
§Errors
  • [InvalidFixture] – if the fixture name is not found
  • [ChannelAlreadyInUse] – if the new target channels are blocked
  • ChannelOutOfRange - if the new channel range is out of bounds
  • [UniverseOutOfRange] - if the fixture is in a non-existent universe
  • [DmxStateDesync] - if the DMX-State and the fixture registry are out of sync
Source

fn remove_fixture(&mut self, name: String) -> Result<(), FixtureError>

Removes a fixture instance and frees its associated DMX channel reservations.

§Arguments
  • name - Name of the fixture to remove
§Errors
  • [InvalidFixture] – if the fixture does not exist
  • [UniverseOutOfRange] - if the fixture is in a non-existent universe
  • [DmxStateDesync] - if the DMX-State and the fixture registry are out of sync
Source

fn set_property( &mut self, name: String, property: PropertyType, value: ChannelValue, ) -> Result<(), FixtureError>

Updates a specific property value on an active fixture.

§Arguments
  • name - Name of the target fixture
  • property - Property type to update
  • value - New raw channel value
§Errors
  • [InvalidFixture] – if the fixture is not found
  • MissingProperty – if the fixture lacks the specified property
Source

fn get_fixture_type_from_string( &self, name: String, ) -> Result<String, FixtureError>

Retrieves the fixture type name for a given fixture instance string.

§Arguments
  • name - Name of the fixture instance
§Errors
  • [InvalidFixture] – if no fixture with this name exists
Source

fn ensure_universe_size(&mut self, size: usize)

Ensures that the internal DMX configuration vector has at least the given size (universes).

§Arguments
  • size - Required minimum number of universes
Source

fn remove_reservations( &mut self, fixture: &mut Fixture, ) -> Result<(), FixtureError>

Clears all DMX channel reservations for a specific fixture.

§Arguments
  • fixture - Reference to the fixture instance
§Errors
  • [UniverseOutOfRange] - if the fixture is in a non-existent universe
  • [DmxStateDesync] - if the DMX-State and the fixture registry are out of sync
Source

fn get_dmx_config_for_client(&self) -> DMXConfigForClientState

Generates a snapshot of the current DMX configuration mapped for client subscription updates.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.