Search Results for

    Show / Hide Table of Contents

    Class DeviceFactory

    • C#
    • Visual Basic
    public class DeviceFactory
    Public Class DeviceFactory
    Inheritance
    System.Object
    DeviceFactory
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: HomeSeer.PluginSdk.Devices
    Assembly: PluginSdk.dll


    Factory class for defining new HsDevices for HomeSeer


    Fields

    View Source

    _device

    Declaration
    • C#
    • Visual Basic
    HsDevice _device
    _device As HsDevice
    Field Value
    Type Description
    HsDevice
    View Source

    _features

    Declaration
    • C#
    • Visual Basic
    List<HsFeature> _features
    _features As List(Of HsFeature)
    Field Value
    Type Description
    System.Collections.Generic.List<HsFeature>

    Methods

    View Source

    AsType(EDeviceType, Int32)

    Set the TypeInfo's Type and SubType

    Declaration
    • C#
    • Visual Basic
    public DeviceFactory AsType(EDeviceType deviceType, int deviceSubType)
    Public Function AsType(deviceType As EDeviceType, deviceSubType As Integer) As DeviceFactory
    Parameters
    Type Name Description
    EDeviceType deviceType

    The EDeviceType used to describe the device

    System.Int32 deviceSubType

    The SubType of the device. Use the int value of the appropriate SubType enum in HomeSeer.PluginSdk.Devices.Identification

    Returns
    Type Description
    DeviceFactory

    The DeviceFactory with an updated TypeInfo

    Remarks

    The ApiType is always set to Device for devices

    View Source

    CreateDevice(String)

    Prepare a new device definition

    Declaration
    • C#
    • Visual Basic
    public static DeviceFactory CreateDevice(string pluginId)
    Public Shared Function CreateDevice(pluginId As String) As DeviceFactory
    Parameters
    Type Name Description
    System.String pluginId

    The Id of the plugin that owns the new device

    Returns
    Type Description
    DeviceFactory

    A DeviceFactory containing information about the new device

    View Source

    PrepareForHs()

    Prepare the data to be sent to HS for processing.

    Declaration
    • C#
    • Visual Basic
    public NewDeviceData PrepareForHs()
    Public Function PrepareForHs As NewDeviceData
    Returns
    Type Description
    NewDeviceData

    A NewDeviceData bundle for HS to use to create a device.

    View Source

    WithAddress(String)

    Add an Address to the device

    Declaration
    • C#
    • Visual Basic
    public DeviceFactory WithAddress(string address)
    Public Function WithAddress(address As String) As DeviceFactory
    Parameters
    Type Name Description
    System.String address

    The string to set the address to

    Returns
    Type Description
    DeviceFactory

    The DeviceFactory with the updated address value

    View Source

    WithExtraData(PlugExtraData)

    Set the PlugExtraData on the device

    Declaration
    • C#
    • Visual Basic
    public DeviceFactory WithExtraData(PlugExtraData extraData)
    Public Function WithExtraData(extraData As PlugExtraData) As DeviceFactory
    Parameters
    Type Name Description
    PlugExtraData extraData

    PlugExtraData to add to the device

    Returns
    Type Description
    DeviceFactory

    The DeviceFactory with the updated PlugExtraData value

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when extraData is null

    View Source

    WithFeature(FeatureFactory)

    Add a HsFeature to the new HsDevice

    Declaration
    • C#
    • Visual Basic
    public DeviceFactory WithFeature(FeatureFactory feature)
    Public Function WithFeature(feature As FeatureFactory) As DeviceFactory
    Parameters
    Type Name Description
    FeatureFactory feature

    A FeatureFactory describing the new HsFeature

    Returns
    Type Description
    DeviceFactory

    The DeviceFactory with the new HsFeature definition included

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown if the FeatureFactory provided is invalid

    View Source

    WithLocation(String)

    Set the Location property on the device.

    Declaration
    • C#
    • Visual Basic
    public DeviceFactory WithLocation(string location)
    Public Function WithLocation(location As String) As DeviceFactory
    Parameters
    Type Name Description
    System.String location

    The location to set on the device

    Returns
    Type Description
    DeviceFactory

    The DeviceFactory updated with the specified location

    Remarks

    Null or whitespace strings will be converted to empty strings ""

    View Source

    WithLocation2(String)

    Set the Location2 property on the device.

    Declaration
    • C#
    • Visual Basic
    public DeviceFactory WithLocation2(string location2)
    Public Function WithLocation2(location2 As String) As DeviceFactory
    Parameters
    Type Name Description
    System.String location2

    The location2 to set on the device

    Returns
    Type Description
    DeviceFactory

    The DeviceFactory updated with the specified location2

    Remarks

    Null or whitespace strings will be converted to empty strings ""

    View Source

    WithMiscFlags(EMiscFlag[])

    Add EMiscFlags to the device

    Declaration
    • C#
    • Visual Basic
    public DeviceFactory WithMiscFlags(params EMiscFlag[] miscFlags)
    Public Function WithMiscFlags(ParamArray miscFlags As EMiscFlag()) As DeviceFactory
    Parameters
    Type Name Description
    EMiscFlag[] miscFlags

    A collection of EMiscFlags to add to the device

    Returns
    Type Description
    DeviceFactory

    The DeviceFactory with the specified flags added

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when miscFlags is null or an empty list

    View Source

    WithName(String)

    Set the Name of the device

    Declaration
    • C#
    • Visual Basic
    public DeviceFactory WithName(string name)
    Public Function WithName(name As String) As DeviceFactory
    Parameters
    Type Name Description
    System.String name

    The name of the device. It must not be blank or whitespace

    Returns
    Type Description
    DeviceFactory

    The DeviceFactory with the updated name value

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when the specified name is null or whitespace

    View Source

    WithoutMiscFlags(EMiscFlag[])

    Remove a EMiscFlag from the device

    Declaration
    • C#
    • Visual Basic
    public DeviceFactory WithoutMiscFlags(params EMiscFlag[] miscFlags)
    Public Function WithoutMiscFlags(ParamArray miscFlags As EMiscFlag()) As DeviceFactory
    Parameters
    Type Name Description
    EMiscFlag[] miscFlags

    EMiscFlag(s) to remove

    Returns
    Type Description
    DeviceFactory

    The DeviceFactory updated by removing the specified EMiscFlag(s)

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when no miscFlags are specified

    • View Source
    In This Article
    Back to top HomeSeer Technologies