Struct Device

Source
pub struct Device<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Device<'a>

Source

pub fn add_card(&self, card: Card) -> Result<()>

Add a Card to the Device.

Source

pub fn add_task(&self, task: Task) -> Result<()>

Add a Task to the system.

Source

pub fn clear_cards(&self) -> Result<()>

Remove all Cards from the Device.

Source

pub fn clear_tasks(&self) -> Result<()>

Remove all Tasks from the Device.

Source

pub fn clear_time_profiles(&self) -> Result<()>

Remove all TimeProfiles from the Device.

Source

pub fn delete_card(&self, number: u32) -> Result<()>

Remove a Card from the Device.

Source

pub fn get_card_by_id(&self, id: u32) -> Result<Card>

Get a specific Card by its ID.

Source

pub fn get_card_by_index(&self, index: u32) -> Result<Card>

Get a specific Card by its index.

Source

pub fn get_cards(&self) -> Result<u32>

Get the number of Cards from the Device.

Source

pub fn get_config(&self) -> Result<DeviceConfig>

Get a DeviceConfig for a the Device.

Source

pub fn get_door_control(&self, door: u8) -> Result<DoorControl>

Get a DoorControl for a specific door. Note that doors are addressed 1-4, not 0-3.

Source

pub fn get_event(&self, index: u32) -> Result<Event>

Get an Event by its index.

Source

pub fn get_event_index(&self) -> Result<u32>

Get the event index the Device

Source

pub fn get_listener(&self) -> Result<SocketAddr>

Get what listener (IP:PORT) is set on the Device. This is where the the Device will send Status messages to over UDP.

Source

pub fn get_status(&self) -> Result<Status>

Get the Status of the Device.

Source

pub fn get_time(&self) -> Result<NaiveDateTime>

Get the current time of the Device.

Source

pub fn get_time_profile(&self, profile_id: u8) -> Result<TimeProfile>

Get the TimeProfile by ID.

Source

pub fn open_door(&self, door: u8) -> Result<()>

Open a door. Note that doors are addressed 1-4, not 0-3.

Source

pub fn refresh_task_list(&self) -> Result<()>

Refresh the task list of the Device.

Source

pub fn set_door_control_state( &self, door: u8, state: DoorControl, ) -> Result<DoorControl>

Set the DoorControl for a specific door. Note that the delay is in seconds and can maximally be 255.

Source

pub fn set_event_index(&self, index: u32) -> Result<()>

Set the event index the Device will use.

Source

pub fn set_listener(&self, address: Ipv4Addr, port: u16) -> Result<()>

Set the listener (IP:PORT) the Device will use to send Status messages to over UDP.

Source

pub fn set_network_config( &self, address: Ipv4Addr, subnet: Ipv4Addr, gateway: Ipv4Addr, ) -> Result<()>

Set IP address, subnet mask and gateway for the Device.

Source

pub fn enable_record_special_events(&self, enable: bool) -> Result<()>

Enable the recording of special events.

Source

pub fn set_time(&self, datetime: NaiveDateTime) -> Result<NaiveDateTime>

Set the local time of the Device.

Source

pub fn add_or_update_time_profile(&self, profile: TimeProfile) -> Result<()>

Add or update new TimeProfile to the Device.

Trait Implementations§

Source§

impl<'a> Debug for Device<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Device<'a>

§

impl<'a> RefUnwindSafe for Device<'a>

§

impl<'a> Send for Device<'a>

§

impl<'a> Sync for Device<'a>

§

impl<'a> Unpin for Device<'a>

§

impl<'a> UnwindSafe for Device<'a>

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.