Search Results for

    Show / Hide Table of Contents

    Class AbstractTriggerType2

    • C#
    • Visual Basic
    public abstract class AbstractTriggerType2 : AbstractTriggerType
    Public MustInherit Class AbstractTriggerType2
        Inherits AbstractTriggerType
    Inheritance
    System.Object
    AbstractTriggerType
    AbstractTriggerType2
    Inherited Members
    AbstractTriggerType.LogDebug
    AbstractTriggerType.TriggerListener
    AbstractTriggerType.Id
    AbstractTriggerType.EventRef
    AbstractTriggerType.Data
    AbstractTriggerType.Name
    AbstractTriggerType.CanBeCondition
    AbstractTriggerType.SubTriggerCount
    AbstractTriggerType.SelectedSubTriggerIndex
    AbstractTriggerType._inData
    AbstractTriggerType.PageId
    AbstractTriggerType.ConfigPage
    AbstractTriggerType.SubTriggerTypeNames
    AbstractTriggerType._id
    AbstractTriggerType._eventRef
    AbstractTriggerType._data
    AbstractTriggerType._configPage
    AbstractTriggerType._selectedSubTriggerIndex
    AbstractTriggerType.GetName()
    AbstractTriggerType.GetSubTriggerName(Int32)
    AbstractTriggerType.IsFullyConfigured()
    AbstractTriggerType.OnEditTrigger(Page)
    AbstractTriggerType.OnConfigItemUpdate(AbstractView)
    AbstractTriggerType.GetPrettyString()
    AbstractTriggerType.IsTriggerTrue(Boolean)
    AbstractTriggerType.ReferencesDeviceOrFeature(Int32)
    AbstractTriggerType.ToHtml()
    AbstractTriggerType.ProcessPostData(Dictionary<String, String>)
    AbstractTriggerType.ConvertLegacyData(Byte[])
    AbstractTriggerType.InflateTriggerFromData()
    AbstractTriggerType.Equals(Object)
    AbstractTriggerType.GetHashCode()
    System.Object.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: HomeSeer.PluginSdk.Events
    Assembly: PluginSdk.dll


    The base implementation of a plugin trigger type available for users to select in HomeSeer

    The difference between AbstractTriggerType2 and AbstractTriggerType, is that with AbstractTriggerType2 only a collection of view Id/Value pairs is stored in database whereas with AbstractTriggerType the whole ConfigPage is stored. This allows the plugin to build the views in OnInstantiateTrigger(Dictionary<String, String>) every time a trigger is instantiated.

    Inherit from this class to define your own trigger types and store them in your plugin's TriggerTypeCollection


    Constructors

    View Source

    AbstractTriggerType2()

    Initialize a new, unconfigured AbstractTriggerType2

    This is called through reflection by the TriggerTypeCollection class if a class that derives from this type is added to its list.

    Declaration
    • C#
    • Visual Basic
    protected AbstractTriggerType2()
    Protected Sub New
    View Source

    AbstractTriggerType2(TrigActInfo, TriggerTypeCollection.ITriggerTypeListener, Boolean)

    Initialize a new AbstractTriggerType2 from a TrigActInfo and with the specified listener, and logDebug flag. The byte array in trigInfo will be automatically parsed to a collection of view Id/Value pairs, and OnInstantiateTrigger(Dictionary<String, String>) will be called.

    This is called through reflection by the TriggerTypeCollection class if a class that derives from this type is added to its list.

    You MUST implement one of these constructor signatures in any class that derives from AbstractTriggerType2

    Declaration
    • C#
    • Visual Basic
    protected AbstractTriggerType2(TrigActInfo trigInfo, TriggerTypeCollection.ITriggerTypeListener listener, bool logDebug = false)
    Protected Sub New(trigInfo As TrigActInfo, listener As TriggerTypeCollection.ITriggerTypeListener, logDebug As Boolean = False)
    Parameters
    Type Name Description
    TrigActInfo trigInfo

    The TrigActInfo containing all the trigger information

    TriggerTypeCollection.ITriggerTypeListener listener

    The listener that facilitates the communication with AbstractPlugin

    System.Boolean logDebug

    If true debug messages will be written to the console

    View Source

    AbstractTriggerType2(Int32, Int32, Int32, Byte[], TriggerTypeCollection.ITriggerTypeListener)

    Initialize a new AbstractTriggerType2 with the specified ID, Event Ref, Data byte array and listener. The byte array will be automatically parsed to a collection of view Id/Value pairs, and OnInstantiateTrigger(Dictionary<String, String>) will be called.

    This is called through reflection by the TriggerTypeCollection class if a class that derives from this type is added to its list.

    You MUST implement one of these constructor signatures in any class that derives from AbstractTriggerType2

    Declaration
    • C#
    • Visual Basic
    protected AbstractTriggerType2(int id, int eventRef, int selectedSubTriggerIndex, byte[] dataIn, TriggerTypeCollection.ITriggerTypeListener listener)
    Protected Sub New(id As Integer, eventRef As Integer, selectedSubTriggerIndex As Integer, dataIn As Byte(), listener As TriggerTypeCollection.ITriggerTypeListener)
    Parameters
    Type Name Description
    System.Int32 id

    The unique ID of this trigger in HomeSeer

    System.Int32 eventRef

    The event reference ID that this trigger is associated with in HomeSeer

    System.Int32 selectedSubTriggerIndex

    The 0 based index of the sub-trigger type selected for this trigger

    System.Byte[] dataIn

    A byte array containing the definition for a Page

    TriggerTypeCollection.ITriggerTypeListener listener

    The listener that facilitates the communication with AbstractPlugin

    View Source

    AbstractTriggerType2(Int32, Int32, Int32, Byte[], TriggerTypeCollection.ITriggerTypeListener, Boolean)

    Initialize a new AbstractTriggerType2 with the specified ID, Event Ref, Data byte array, listener, and logDebug flag. The byte array will be automatically parsed to a collection of view Id/Value pairs, and OnInstantiateTrigger(Dictionary<String, String>) will be called.

    This is called through reflection by the TriggerTypeCollection class if a class that derives from this type is added to its list.

    You MUST implement one of these constructor signatures in any class that derives from AbstractTriggerType2

    Declaration
    • C#
    • Visual Basic
    protected AbstractTriggerType2(int id, int eventRef, int selectedSubTriggerIndex, byte[] dataIn, TriggerTypeCollection.ITriggerTypeListener listener, bool logDebug = false)
    Protected Sub New(id As Integer, eventRef As Integer, selectedSubTriggerIndex As Integer, dataIn As Byte(), listener As TriggerTypeCollection.ITriggerTypeListener, logDebug As Boolean = False)
    Parameters
    Type Name Description
    System.Int32 id

    The unique ID of this trigger in HomeSeer

    System.Int32 eventRef

    The event reference ID that this trigger is associated with in HomeSeer

    System.Int32 selectedSubTriggerIndex

    The 0 based index of the sub-trigger type selected for this trigger

    System.Byte[] dataIn

    A byte array containing the definition for a Page

    TriggerTypeCollection.ITriggerTypeListener listener

    The listener that facilitates the communication with AbstractPlugin

    System.Boolean logDebug

    If true debug messages will be written to the console

    Methods

    View Source

    GetData()

    Declaration
    • C#
    • Visual Basic
    override byte[] GetData()
    Overrides Function GetData As Byte()
    Returns
    Type Description
    System.Byte[]
    Overrides
    AbstractTriggerType.GetData()
    View Source

    OnInstantiateTrigger(Dictionary<String, String>)

    Called when a trigger of this type is being instantiated. Create the ConfigPage according to the values passed as parameters. If no value is passed it means it's a new trigger, so initialize the ConfigPage to the trigger's starting state so users can begin configuring it.

    Any JUI view added to the ConfigPage must use a unique ID as it will be displayed on an event page that could also be housing HTML from other plugins. It is recommended to use the PageId as a prefix for all views added to ensure that their IDs are unique.

    View Id/Value pairs containing the existing values for this trigger
    Declaration
    • C#
    • Visual Basic
    protected abstract void OnInstantiateTrigger(Dictionary<string, string> viewIdValuePairs)
    Protected MustOverride Sub OnInstantiateTrigger(viewIdValuePairs As Dictionary(Of String, String))
    Parameters
    Type Name Description
    System.Collections.Generic.Dictionary<System.String, System.String> viewIdValuePairs
    View Source

    OnNewTrigger()

    Called when a new trigger of this type is being created. Initialize the ConfigPage to the trigger's starting state so users can begin configuring it.

    You must create a new Page with a unique ID provided by PageId and be of the type EventTrigger. Any JUI view added to the ConfigPage must use a unique ID as it will be displayed on an event page that could also be housing HTML from other plugins. It is recommended to use the PageId as a prefix for all views added to ensure that their IDs are unique.

    If no page is set, a blank page will be auto initialized.

    Declaration
    • C#
    • Visual Basic
    protected override void OnNewTrigger()
    Protected Overrides Sub OnNewTrigger
    Overrides
    AbstractTriggerType.OnNewTrigger()
    Remarks

    With AbstractTriggerType2 there is no need to override this method. OnInstantiateTrigger(Dictionary<String, String>) will be called instead, with an empty Dictionary as parameter.

    View Source

    ProcessData(Byte[])

    Declaration
    • C#
    • Visual Basic
    override byte[] ProcessData(byte[] inData)
    Overrides Function ProcessData(inData As Byte()) As Byte()
    Parameters
    Type Name Description
    System.Byte[] inData
    Returns
    Type Description
    System.Byte[]
    Overrides
    AbstractTriggerType.ProcessData(Byte[])
    • View Source
    In This Article
    Back to top HomeSeer Technologies