Click or drag to resize

C2nSdc Class

The C2nSdc module operates two bi-directional motors (labeled Shade 1 and Shade 2) that control shades and drapes. This will fire the"BaseEvent" with the event Id's defined in ShadeDrapeControllerEventIds.
Inheritance Hierarchy

Namespace: Crestron.SimplSharpPro.Shades
Assembly: Crestron.SimplSharpPro.Shades (in Crestron.SimplSharpPro.Shades.dll) Version: 2.21.121
Syntax
C#
public sealed class C2nSdc : C2nSxcBaseClass

The C2nSdc type exposes the following members.

Constructors
 NameDescription
Public methodC2nSdc(UInt32, CrestronControlSystem) Constructor to generate a new C2nSdcDc that resides on the cresnet bus for the specified control system.
Public methodC2nSdc(UInt32, IDeviceBranch) Constructor to generate a new C2nSdc that resides on the specified IDeviceBranch.
Top
Properties
 NameDescription
Public propertyConnectedIpList A property containing the list of the ConnectedIpInformation objects which contain information about the devices that are connected to this IP ID. This property is only valid for an ethernet device. If this is not an ethernet device, then this property will return null. If this is an ethernet device, the list will be non-null. It will be empty if no devices are connected. The order of items in this list is not guaranteed.
(Inherited from GenericDevice)
Public propertyControllers Collection of Shade/Drape controllers on the device. This will fire the "BaseEvent" with the event Id specified in ShadeDrapeControllerEventIds and the index is the controller number in Controllers
(Inherited from C2nSxcBaseClass)
Public propertyCode exampleDescription Get/Set the description of this device.
(Inherited from GenericBase)
Public propertyDisposed Property to indicate if the device has been disposed.
(Inherited from GenericDevice)
Public propertyID Property to get the ID of the device.
(Inherited from GenericDevice)
Public propertyIsOnline Property to get the current online state of the device.
(Inherited from GenericDevice)
Public propertyName Get the name of this device.
(Inherited from GenericBase)
Public propertyParent The parent that a given object was added to.
(Inherited from GenericBase)
Public propertyRegisterable Property to indicate that this device can be registered.
(Inherited from GenericDevice)
Public propertyRegistered Property to get the current registration state of the device.
(Inherited from GenericDevice)
Public propertyRegistrationFailureReason Property to get the Registration Failure Reason, this will match the return value from the call to register.
(Inherited from GenericDevice)
Protected propertySIMPLDeviceImplementation Internal protected member used for actual device control.
(Inherited from GenericDevice)
Public propertyType Property to determine to type of device this is.
(Inherited from GenericDevice)
Public propertyUnRegistrationFailureReason Property to get the Unregistration Failure Reason, this will match the return value from the call to unregister.
(Inherited from GenericDevice)
Public propertyUserSpecifiedObject Can be assigned anything that user wants.
(Inherited from GenericBase)
Protected propertyXioEndpointStubSIMPLDevice The SIMPL "stub" Device that the XiO Director creates for an endpoint to send the 1C/0E to the correct place in hierarchy.
(Inherited from GenericDevice)
Top
Methods
 NameDescription
Public methodDispose Clean up of resources.
(Inherited from GenericBase)
Protected methodDispose(Boolean) Method to perform the actual disposing of the device.
(Inherited from GenericDevice)
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalize Destructor of the device.
(Inherited from GenericDevice)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodOnBaseEvent(Int32) Protected member used to fire the BaseEvent with the default extended information.
(Inherited from GenericBase)
Protected methodOnBaseEvent(Int32, UInt16) Protected member used to fine the BaseEvent with extended event information.
(Inherited from GenericBase)
Public methodRegister Register this device with the system.
(Inherited from GenericDevice)
Public methodToString Return the name of the device.
(Inherited from GenericDevice)
Public methodUnRegister Unregister this device with the system. This function can not be called from the device's own SigChange event handler.

On successful unregistration, if this device supports the OnlineStatusChange event, it will trigger indicating the device when offline.


(Inherited from GenericDevice)
Top
Events
 NameDescription
Public eventBaseEvent Generic base event, triggered when the there are no other handlers available for a specific EventID.
(Inherited from GenericBase)
Public eventIpInformationChange Event that tells what IP Address is connected/disconnected from an IP ID for a non-UDP device. This is only valid for an Ethernet device. An exception will be thrown if it is not.
(Inherited from GenericDevice)
Public eventOnlineStatusChange Event triggered when the Online status of the device changes.
(Inherited from GenericDevice)
Top
Fields
 NameDescription
Public fieldNumberOfControllers Indicates number of controllers on the device
(Inherited from C2nSxcBaseClass)
Top
Example
This is an example of how to instantiate and use the C2nSdc device. The same construct will apply for the C2nSdcDc device
C#
// Instantiate the device
mySdcDevice = new C2nSdc(0xE, this);
// Add the event handlers
mySdcDevice.BaseEvent += new BaseEventHandler(myDevice_BaseEvent);
mySdcDevice.OnlineStatusChange += new OnlineStatusChangeEventHandler(myDevice_OnlineStatusChange);

// Register the device
mySdcDevice.Register();

// Online Status Change event handler
void myDevice_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
    CrestronConsole.PrintLine(" Device named {0} is now {1} \r\n", currentDevice.ToString(), args.DeviceOnLine);
    if (currentDevice.IsOnline)
    {
        // Close the shades/drapes
        mySdcDevice.Controllers[1].Close();
        mySdcDevice.Controllers[2].Close();

        // open the shades/drapes
        mySdcDevice.Controllers[1].Open();
        mySdcDevice.Controllers[2].Open();

        // Stop the shades/drapes
        mySdcDevice.Controllers[1].Stop();
        mySdcDevice.Controllers[2].Stop();

        // Set the MAX time if supported
        if (mySdcDevice.Controllers[1].MaxTime != CrestronControlSystem.NullUShortInputSig)
        {
            mySdcDevice.Controllers[1].MaxTime.UShortValue = 105;
        }

        // Set the lockout time to be 0.02 seconds
        if (mySdcDevice.Controllers[2].LockOutTime != CrestronControlSystem.NullUShortInputSig)
        {
            mySdcDevice.Controllers[2].LockOutTime.UShortValue = 20;
        }
    }
}         

// Base event handler
void myDevice_BaseEvent(GenericBase device, BaseEventArgs args)
{
    // Args.Index is the controller number.
    CrestronConsole.PrintLine(" Base event fired on device {0} with {1} and index {2} \r\n", device.Name, args.EventId, args.Index);

    switch (args.EventId)
    {
        case ShadeDrapeControllerEventIds.LastDirCloseFeedbackEventId:
             CrestronConsole.PrintLine(" Value for LastDirCloseFeedback is {0} \r\n", mySdcDevice.Controllers[(uint)args.Index].LastDirCloseFeedback.BoolValue);
            break;
        case ShadeDrapeControllerEventIds.LastDirOpenFeedbackEventId
             CrestronConsole.PrintLine(" Value for LastDirOpenFeedback is {0} \r\n", mySdcDevice.Controllers[(uint)args.Index].LastDirOpenFeedback.BoolValue);
            break;
        case ShadeDrapeControllerEventIds.MovingFeedbackEventId:
            CrestronConsole.PrintLine(" Value for MovingFeedback is {0} \r\n", mySdcDevice.Controllers[(uint)args.Index].MovingFeedback.BoolValue);
            break;
        case ShadeDrapeControllerEventIds.NotPresentEventId:
            break;
        case ShadeDrapeControllerEventIds.PositionFeedbackEventId:
            break;
    }
}

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also