Class StatusControl
[Obfuscation(Exclude = true, ApplyToMembers = true)]
[Serializable]
public class StatusControl
Inheritance
Inherited Members
Namespace: HomeSeer.PluginSdk.Devices.Controls
Assembly: PluginSdk.dll
A control associated with a feature on a HomeSeer system. Formerly referred to as a VSPair.
This defines a control that will be available for a user to interact with.
Remarks
Legacy VSPairs used to be able to be defined as either status-only, control-only, or both, but this is no longer allowed. All StatusControls are considered both, and a StatusGraphic will override the DisplayedStatus on the feature if it is configured for the feature's current Value.
If you are looking to add a status-only control to a feature, create a StatusGraphic instead.
Constructors
View SourceStatusControl(EControlType)
Initialize a new StatusControl of the specified type
Declaration
public StatusControl(EControlType type)
Parameters
Type | Name | Description |
---|---|---|
EControlType | type | The EControlType of the control |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if an invalid type is specified |
Fields
View Source_controlStates
Declaration
List<string> _controlStates
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> |
_controlType
Declaration
EControlType _controlType
Field Value
Type | Description |
---|---|
EControlType |
_controlUse
Declaration
EControlUse _controlUse
Field Value
Type | Description |
---|---|
EControlUse |
_flags
Declaration
uint _flags
Field Value
Type | Description |
---|---|
System.UInt32 |
_isRange
Declaration
bool _isRange
Field Value
Type | Description |
---|---|
System.Boolean |
_label
Declaration
string _label
Field Value
Type | Description |
---|---|
System.String |
_location
Declaration
ControlLocation _location
Field Value
Type | Description |
---|---|
ControlLocation |
_targetRange
Declaration
ValueRange _targetRange
Field Value
Type | Description |
---|---|
ValueRange |
_targetValue
Declaration
double _targetValue
Field Value
Type | Description |
---|---|
System.Double |
Properties
View SourceColumn
The column that the StatusControl is located at
Declaration
public int Column { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ControlStates
The possible states available for users to set this control to.
This is only used when the ControlType is set to TextSelectList
Declaration
public List<string> ControlStates { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> |
ControlType
The style the control is displayed as to users
Declaration
public EControlType ControlType { get; set; }
Property Value
Type | Description |
---|---|
EControlType |
See Also
View SourceControlUse
What the StatusControl is used for. See EControlUse for more information.
Declaration
public EControlUse ControlUse { get; set; }
Property Value
Type | Description |
---|---|
EControlUse |
See Also
View SourceHasAdditionalData
Whether the StatusControl label includes additional data tokens to be replaced by strings in AdditionalStatusData
Declaration
public bool HasAdditionalData { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsInvalidStatusTarget
Whether the StatusControl should be available as a status target for events and other platform integrations
Declaration
public bool IsInvalidStatusTarget { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | FALSE if the StatusControl is a valid status target, TRUE if it is not. |
See Also
View SourceIsRange
Whether the StatusControl targets a range of values or a single value.
Settings this to TRUE will cause the TargetValue field to be ignored in favor of the TargetRange
Declaration
public bool IsRange { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Label
The text displayed on the control.
Unless overridden by a Label associated with the same feature, this text is used as the status for the corresponding value.
Declaration
public string Label { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Location
The location of the StatusControl when displayed to users
Declaration
public ControlLocation Location { get; set; }
Property Value
Type | Description |
---|---|
ControlLocation |
See Also
View SourceRow
The row that the StatusControl is located at
Declaration
public int Row { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TargetRange
The range of values that the StatusControl targets.
If IsRange is FALSE then this is ignored in favor of TargetValue
Declaration
public ValueRange TargetRange { get; set; }
Property Value
Type | Description |
---|---|
ValueRange |
See Also
View SourceTargetValue
The value this StatusControl targets.
If IsRange is TRUE then this is ignored in favor of TargetRange
Declaration
public double TargetValue { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Width
The number of columns the StatusControl occupies
Declaration
public int Width { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
View SourceAddFlag(EControlFlag)
Add the specified EControlFlag to the StatusControl
Declaration
void AddFlag(EControlFlag controlFlag)
Parameters
Type | Name | Description |
---|---|---|
EControlFlag | controlFlag | The EControlFlag to add |
ClearFlags()
Clear all EControlFlags on the StatusControl.
Declaration
void ClearFlags()
ContainsFlag(EControlFlag)
Determine if the StatusControl contains the specified EControlFlag
Declaration
bool ContainsFlag(EControlFlag controlFlag)
Parameters
Type | Name | Description |
---|---|---|
EControlFlag | controlFlag | The EControlFlag to look for |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if the StatusControl contains the EControlFlag, FALSE if it does not. |
CreateControlEvent(Int32)
Create a ControlEvent from this StatusControl for a given devRef
.
This uses the TargetValue for the ControlValue
Declaration
public ControlEvent CreateControlEvent(int devRef)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | devRef |
Returns
Type | Description |
---|---|
ControlEvent |
CreateControlEvent(Int32, Double)
Create a ControlEvent from this StatusControl for a given
value
and devRef
.
Declaration
public ControlEvent CreateControlEvent(int devRef, double value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | devRef | |
System.Double | value |
Returns
Type | Description |
---|---|
ControlEvent |
Remarks
Use this when the StatusControl is a range and a specific value must by chosen within that range.
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown when the |
Equals(Object)
Compare this object with another to see if they are equal
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to compare |
Returns
Type | Description |
---|---|
System.Boolean | true if they are equal, false if they are not |
Overrides
GetHashCode()
Get the hash code
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code based on the Min of TargetRange if IsRange is true or TargetValue if it is false. |
Overrides
GetLabelForValue(Double, String[])
Get the label for the specified value correctly formatted according to the StatusControl's configuration
Declaration
public string GetLabelForValue(double value, string[] additionalData = null)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | The value to get the label for |
System.String[] | additionalData | Additional data to include in the status label that replaces any tokens from GetAdditionalDataToken(Int32) included in the status. |
Returns
Type | Description |
---|---|
System.String | The value as a string formatted according to the TargetRange configuration. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown when the value is not targeted by the StatusControl |
IsValueInRange(Double)
Determine if a specified value is targeted by the StatusControl"/>
Declaration
public bool IsValueInRange(double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | The value to check |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if the value is targeted by the StatusControl, FALSE if it is not |
RemoveFlag(EControlFlag)
Remove the specified EControlFlag from the StatusControl
Declaration
void RemoveFlag(EControlFlag controlFlag)
Parameters
Type | Name | Description |
---|---|---|
EControlFlag | controlFlag | The EControlFlag to remove |
ReplaceAdditionalData(String, String[])
Declaration
string ReplaceAdditionalData(string label, string[] additionalData)
Parameters
Type | Name | Description |
---|---|---|
System.String | label | |
System.String[] | additionalData |
Returns
Type | Description |
---|---|
System.String |
TryGetLabelForValue(out String, Double, String[])
Try to get the label for the specified value correctly formatted according to the StatusControl's configuration.
Declaration
public bool TryGetLabelForValue(out string label, double value, string[] additionalData = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | label | The string variable the label will be written to |
System.Double | value | The value to get the label for |
System.String[] | additionalData | Additional data to include in the status label that replaces any tokens from GetAdditionalDataToken(Int32) included in the status. |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if a label is available for the StatusControl, FALSE if the value is not valid for this StatusControl or there is no label defined. |