pub struct ColorObject { /* private fields */ }Expand description
BACnet Color object (type 63).
Holds a colour as CIE 1931 xy coordinates, each 0.0 to 1.0. It isn’t commandable: Present_Value takes a write with no priority array.
Color_Command takes a BACnetColorCommand whose operation is
FADE_TO_COLOR or STOP (see set_color_command)
and carries it out (#1474). FADE_TO_COLOR sets Present_Value to the target
at once and fades Tracking_Value to it from where it stands, over the
command’s fade time or Default_Fade_Time, with In_Progress FADE_ACTIVE
until it arrives. STOP ends the fade there, and Present_Value takes the
colour it reached. A Present_Value write halts a fade too, then moves to
the new colour as Transition says: at once for NONE, or a fade over
Default_Fade_Time for FADE.
Fades run on the monotonic clock the database binds; the server’s
monotonic task samples Tracking_Value for COV as it moves and ends the
fade on time. With no clock bound they wait on advance_time_internal.
Cloning copies served state into an in-memory object. Tags persistence and pending saves remain solely with the original; cloning or dropping the copy never saves, corrects, settles, or waits on the original writer.
Implementations§
Source§impl ColorObject
impl ColorObject
Sourcepub fn new(instance: u32, name: impl Into<String>) -> Result<Self, Error>
pub fn new(instance: u32, name: impl Into<String>) -> Result<Self, Error>
Create a Color object at D65 white (x 0.3127, y 0.3290), which is also its Default_Color.
Default_Fade_Time starts at 100 ms, the shortest the addendum allows, as Lighting Output’s does, and Transition at NONE.
Sourcepub fn with_output_persistence(
self,
persistence: Arc<dyn ColorOutputPersistence>,
) -> Result<Self, Error>
pub fn with_output_persistence( self, persistence: Arc<dyn ColorOutputPersistence>, ) -> Result<Self, Error>
Keep Present_Value in persistence (#1526), and take the colour it
saved for this object, if any, as Present_Value. Call it right after
building the object, before anything writes Present_Value.
The object then saves each new Present_Value on its own writer
thread; a change doesn’t wait for its save, and a save that fails is
logged and tried again (see ColorOutputPersistence). With
Default_Color (0, 0), the device’s start keeps the saved colour
(Clause 12.X.8).
Fails with storage’s error when what it holds can’t be loaded, and when it holds a colour temperature or a coordinate outside 0.0 to 1.0.
Sourcepub fn output_restored(&self) -> bool
pub fn output_restored(&self) -> bool
Whether Present_Value came back from storage
(with_output_persistence).
Sourcepub fn output_save_counters(&self) -> Option<ColorOutputSaveCounters>
pub fn output_save_counters(&self) -> Option<ColorOutputSaveCounters>
The Present_Value save counters, shared with the object, or None
without storage. Take them before the object joins a database.
Sourcepub fn wait_for_output_saves(&self)
pub fn wait_for_output_saves(&self)
Block until the Present_Value saves queued so far have run. Dropping the object waits for them too.
Sourcepub fn default_color(&self) -> BACnetXyColor
pub fn default_color(&self) -> BACnetXyColor
Default_Color: the colour the device’s start drives the output to, or (0, 0) to keep the colour from before the restart.
Sourcepub fn set_default_color(&mut self, color: BACnetXyColor) -> Result<(), Error>
pub fn set_default_color(&mut self, color: BACnetXyColor) -> Result<(), Error>
Set Default_Color, as a WriteProperty of it would. (0, 0) is taken like any other colour and keeps the saved colour at the device’s start (Clause 12.X.8). A coordinate outside 0.0 to 1.0, or NaN, is refused with VALUE_OUT_OF_RANGE.
Sourcepub fn start_output(&mut self)
pub fn start_output(&mut self)
Drive the output as the device’s start does (#1526); the server calls this for every Color object in the database as it starts. An application running the object without a server, or adding it to a server already running, calls it itself.
A non-zero Default_Color becomes Present_Value at once, whatever was set before the start, with no fade, since the addendum gives the start no transition. With Default_Color (0, 0) the output keeps, in order: the colour restored from storage; else a colour set before the start; else nothing, and In_Progress reads NOT_CONTROLLED until a Present_Value or Color_Command write drives it (Clauses 12.X.4 and 12.X.8). Values set before the start are configuration, since no peer can write until then, so a first boot and later ones agree.
It is safe to call again, as an in-process restart would: the second call keeps the current colour for a zero default, since the restored one was taken by the first.
Sourcepub fn set_value_source_tracking(&mut self, enabled: bool)
pub fn set_value_source_tracking(&mut self, enabled: bool)
Track Value_Source (Clause 19.5, #1552), provisioned before registration as the audit policy is.
On, the object serves Value_Source: the writer of the last
Present_Value write, or of the last Color_Command that set
Present_Value, which alone may then correct it. Such a write must
name its writer (write_property_from, as the server’s network and
local writes do); one without is refused with WRITE_ACCESS_DENIED.
The typed setters name none, so after one Value_Source reads NONE.
Build with application-owned Tags storage. Saved Tags override configured
Tags only while set_profile provisions the row. Loaded data must satisfy
the normal Tags rules and the opt-in 1 MiB snapshot limit.
Sourcepub fn wait_for_tag_saves(&self)
pub fn wait_for_tag_saves(&self)
Wait for queued save attempts to finish. This is not a success receipt; writes report their own save outcomes. Unstaged local writes block.
Sourcepub fn set_profile(&mut self, profile: ObjectProfile) -> Result<(), Error>
pub fn set_profile(&mut self, profile: ObjectProfile) -> Result<(), Error>
Provision the optional Tags, Profile_Location and Profile_Name rows
before registration (#1553; see ObjectProfile). Tags takes
writes; the profile rows are read-only over the network. A profile
that fails ObjectProfile::check is refused and changes nothing.
Sourcepub fn set_audit_policy(&mut self, policy: ObjectAuditPolicy)
pub fn set_audit_policy(&mut self, policy: ObjectAuditPolicy)
Provision the optional Audit_Level and Auditable_Operations rows before registration, as an Analog or Binary Value’s are (#1525).
A field left None keeps its row out of the object; a present row is
writable, and a DEFAULT level inherits the selected Audit Reporter’s.
The object has no commandable property for Audit_Priority_Filter to
filter, and Table 12-X doesn’t list it, so a priority filter in
policy is left out. Provisioning doesn’t install or enable a
Reporter.
Sourcepub fn set_present_value(&mut self, color: BACnetXyColor) -> Result<(), Error>
pub fn set_present_value(&mut self, color: BACnetXyColor) -> Result<(), Error>
Set Present_Value, as a WriteProperty of the colour would.
A coordinate outside 0.0 to 1.0, or NaN, is refused with
VALUE_OUT_OF_RANGE and changes nothing (Clause 12.X.4). Otherwise a
fade in progress is halted, and the output moves to color as
Transition says.
Sourcepub fn color_command(&self) -> BACnetColorCommand
pub fn color_command(&self) -> BACnetColorCommand
The last command written to Color_Command, or operation NONE with no other field before any write.
Sourcepub fn set_color_command(
&mut self,
command: BACnetColorCommand,
) -> Result<(), Error>
pub fn set_color_command( &mut self, command: BACnetColorCommand, ) -> Result<(), Error>
Set Color_Command and carry the command out, as a WriteProperty of the encoded command would.
The command is checked against the Color object’s table of colour commands (Addendum 135-2020ca, Table 12-X2): only FADE_TO_COLOR and STOP are taken. FADE_TO_COLOR needs a target colour with both coordinates 0.0 to 1.0, and a fade time, when it carries one, of 100 to 86,400,000 ms. Fields the operation doesn’t use are kept unchecked. A refusal is VALUE_OUT_OF_RANGE and leaves the object unchanged.
Trait Implementations§
Source§impl BACnetObject for ColorObject
impl BACnetObject for ColorObject
Source§fn object_identifier(&self) -> ObjectIdentifier
fn object_identifier(&self) -> ObjectIdentifier
Source§fn object_name(&self) -> &str
fn object_name(&self) -> &str
Source§fn read_property(
&self,
property: PropertyIdentifier,
array_index: Option<u32>,
) -> Result<PropertyValue, Error>
fn read_property( &self, property: PropertyIdentifier, array_index: Option<u32>, ) -> Result<PropertyValue, Error>
Source§fn write_property(
&mut self,
property: PropertyIdentifier,
array_index: Option<u32>,
value: PropertyValue,
priority: Option<u8>,
) -> Result<(), Error>
fn write_property( &mut self, property: PropertyIdentifier, array_index: Option<u32>, value: PropertyValue, priority: Option<u8>, ) -> Result<(), Error>
Source§fn write_property_from(
&mut self,
property: PropertyIdentifier,
array_index: Option<u32>,
value: PropertyValue,
priority: Option<u8>,
origin: &CommandOrigin,
) -> Result<(), Error>
fn write_property_from( &mut self, property: PropertyIdentifier, array_index: Option<u32>, value: PropertyValue, priority: Option<u8>, origin: &CommandOrigin, ) -> Result<(), Error>
Source§fn property_metadata(&self) -> Cow<'_, [PropertyMetadata]>
fn property_metadata(&self) -> Cow<'_, [PropertyMetadata]>
Source§fn property_list(&self) -> Cow<'static, [PropertyIdentifier]>
fn property_list(&self) -> Cow<'static, [PropertyIdentifier]>
Source§fn supports_cov(&self) -> bool
fn supports_cov(&self) -> bool
Source§fn is_writable_property(&self, property: PropertyIdentifier) -> bool
fn is_writable_property(&self, property: PropertyIdentifier) -> bool
property for this object. Read moreSource§fn is_array_property(&self, property: PropertyIdentifier) -> bool
fn is_array_property(&self, property: PropertyIdentifier) -> bool
property accepts an array index on this object. Read moreSource§fn is_list_property(&self, property: PropertyIdentifier) -> bool
fn is_list_property(&self, property: PropertyIdentifier) -> bool
property is a BACnetLIST on this object. Read moreSource§fn is_createable(&self) -> bool
fn is_createable(&self) -> bool
Source§fn creation_only_properties(&self) -> &'static [PropertyIdentifier]
fn creation_only_properties(&self) -> &'static [PropertyIdentifier]
Source§fn initialize_property(
&mut self,
_property: PropertyIdentifier,
_value: PropertyValue,
) -> Result<(), Error>
fn initialize_property( &mut self, _property: PropertyIdentifier, _value: PropertyValue, ) -> Result<(), Error>
Self::creation_only_properties, written whole. Read moreSource§fn is_deleteable(&self) -> bool
fn is_deleteable(&self) -> bool
Source§fn required_properties(&self) -> Cow<'static, [PropertyIdentifier]>
fn required_properties(&self) -> Cow<'static, [PropertyIdentifier]>
Source§fn supports_subscribe_cov_property(&self) -> bool
fn supports_subscribe_cov_property(&self) -> bool
Source§fn supports_cov_property(&self, property: PropertyIdentifier) -> bool
fn supports_cov_property(&self, property: PropertyIdentifier) -> bool
Source§fn cov_increment(&self) -> Option<f64>
fn cov_increment(&self) -> Option<f64>
Source§fn cov_reported_properties(&self) -> &'static [CovReportedProperty]
fn cov_reported_properties(&self) -> &'static [CovReportedProperty]
Source§fn set_overridden(&mut self, _overridden: bool)
fn set_overridden(&mut self, _overridden: bool)
Source§fn evaluate_intrinsic_reporting(&mut self) -> Option<TransitionOutcome>
fn evaluate_intrinsic_reporting(&mut self) -> Option<TransitionOutcome>
Source§fn tick_intrinsic_reporting(&mut self) -> Option<TransitionOutcome>
fn tick_intrinsic_reporting(&mut self) -> Option<TransitionOutcome>
Time_Delay countdown for a pending transition. Read moreSource§fn tick_schedule(
&mut self,
_today: SpecificDate,
_time: Time,
_calendar_active: &dyn Fn(ObjectIdentifier) -> bool,
) -> Option<ScheduleWrite>
fn tick_schedule( &mut self, _today: SpecificDate, _time: Time, _calendar_active: &dyn Fn(ObjectIdentifier) -> bool, ) -> Option<ScheduleWrite>
Source§fn take_owed_schedule_writes(&mut self) -> Vec<ScheduleWrite>
fn take_owed_schedule_writes(&mut self) -> Vec<ScheduleWrite>
Source§fn complete_schedule_write(
&mut self,
_write: &ScheduleWrite,
_outcomes: &[ScheduleTargetOutcome],
) -> bool
fn complete_schedule_write( &mut self, _write: &ScheduleWrite, _outcomes: &[ScheduleTargetOutcome], ) -> bool
write, one of this schedule’s writes:
outcomes holds one entry per member of write.references, in order. Read moreSource§fn retry_refusals_naming(
&self,
_target: ObjectIdentifier,
) -> Option<ScheduleWrite>
fn retry_refusals_naming( &self, _target: ObjectIdentifier, ) -> Option<ScheduleWrite>
retry of the current value to the
references whose last write was refused and that name target, an
object just added to the database (#1440), so the refusal can clear
without waiting for the next pass. None when no such refusal
stands, or when the pass itself would retry nothing: out of service,
outside Effective_Period, or with a NULL Present_Value. Only
meaningful for Schedule objects; default returns None.Source§fn acknowledge_alarm(
&mut self,
_transition_bit: EventTransitionBits,
) -> Result<(), Error>
fn acknowledge_alarm( &mut self, _transition_bit: EventTransitionBits, ) -> Result<(), Error>
transition_bit flags in acked_transitions.
Returns Ok(()) if the object supports event detection, Err otherwise.Source§fn apply_life_safety_operation(
&mut self,
_operation: LifeSafetyOperation,
) -> Result<LifeSafetyOperationOutcome, Error>
fn apply_life_safety_operation( &mut self, _operation: LifeSafetyOperation, ) -> Result<LifeSafetyOperationOutcome, Error>
Source§fn set_life_safety_operation_expected_internal(
&mut self,
_operation: LifeSafetyOperation,
) -> Result<(), Error>
fn set_life_safety_operation_expected_internal( &mut self, _operation: LifeSafetyOperation, ) -> Result<(), Error>
Source§fn set_event_state_internal(&mut self, _state: EventState) -> Result<(), Error>
fn set_event_state_internal(&mut self, _state: EventState) -> Result<(), Error>
Event_State transition. Read moreSource§fn enrollment_eval_state_internal(&self) -> Option<EventEnrollmentEvalState>
fn enrollment_eval_state_internal(&self) -> Option<EventEnrollmentEvalState>
Source§fn set_enrollment_eval_state_internal(
&mut self,
_state: EventEnrollmentEvalState,
) -> Result<(), Error>
fn set_enrollment_eval_state_internal( &mut self, _state: EventEnrollmentEvalState, ) -> Result<(), Error>
Source§fn enrollment_eval_source_internal(
&self,
) -> Option<Option<EventEnrollmentMonitoredSource>>
fn enrollment_eval_source_internal( &self, ) -> Option<Option<EventEnrollmentMonitoredSource>>
Source§fn set_enrollment_eval_source_internal(
&mut self,
_source: Option<EventEnrollmentMonitoredSource>,
) -> Result<(), Error>
fn set_enrollment_eval_source_internal( &mut self, _source: Option<EventEnrollmentMonitoredSource>, ) -> Result<(), Error>
Source§fn set_acked_transitions_internal(
&mut self,
_transition_bit: EventTransitionBits,
_acknowledged: bool,
) -> Result<(), Error>
fn set_acked_transitions_internal( &mut self, _transition_bit: EventTransitionBits, _acknowledged: bool, ) -> Result<(), Error>
Acked_Transitions bit on a received event-state
transition. Read moreSource§fn evaluate_reliability_internal(
&mut self,
) -> Result<ReliabilityEvaluation, Error>
fn evaluate_reliability_internal( &mut self, ) -> Result<ReliabilityEvaluation, Error>
Reliability. Read moreSource§fn set_reliability_internal(
&mut self,
_reliability: Reliability,
) -> Result<(), Error>
fn set_reliability_internal( &mut self, _reliability: Reliability, ) -> Result<(), Error>
Reliability value. Read moreSource§fn set_present_value_internal(
&mut self,
_value: PropertyValue,
) -> Result<(), Error>
fn set_present_value_internal( &mut self, _value: PropertyValue, ) -> Result<(), Error>
Present_Value supplied by the local application. Read moreSource§fn set_present_value_from_internal(
&mut self,
value: PropertyValue,
_origin: &CommandOrigin,
) -> Result<(), Error>
fn set_present_value_from_internal( &mut self, value: PropertyValue, _origin: &CommandOrigin, ) -> Result<(), Error>
Source§fn set_tracking_value_internal(
&mut self,
_value: PropertyValue,
) -> Result<(), Error>
fn set_tracking_value_internal( &mut self, _value: PropertyValue, ) -> Result<(), Error>
Tracking_Value the local application derived. Read moreSource§fn report_access_input_internal(
&mut self,
_input: AccessControlInput,
) -> Result<(), Error>
fn report_access_input_internal( &mut self, _input: AccessControlInput, ) -> Result<(), Error>
AccessControlInput. Read more