Click or drag to resize

C2nCbdP Class

Professional Cresnet-based wall-mounted keypad that feature customizable button configurations, auto-dimmable backlit text and enhanced LED feedback.

This class will trigger ButtonStateChange, LightSensorChange, ThresholdStateChange and VersiportChange events.

Inheritance Hierarchy

Namespace: Crestron.SimplSharpPro.Keypads
Assembly: Crestron.SimplSharpPro.Keypads (in Crestron.SimplSharpPro.Keypads.dll) Version: 2.21.121
Syntax
C#
public sealed class C2nCbdP : C2nCbdPBaseWithVersiport

The C2nCbdP type exposes the following members.

Constructors
 NameDescription
Public methodC2nCbdP(UInt32, CrestronControlSystem) Constructor to generate a new C2N-CBD-P Cameo Professional Keypad device connected to Control System.
Public methodC2nCbdP(UInt32, IDeviceBranch) Constructor to generate a new C2N-CBD-P Cameo Professional Keypad device on IDeviceBranch.
Top
Properties
 NameDescription
Public propertyAboveThreshold This input is driven by the AboveThreshold_FB output on the master keypad. This input is only active when EnableExtThreshold is set to true, which signifies that the current button is operating in slave mode. When the input goes true, this sets the backlight to the specified Day level (either custom or preset). When the input goes false, it goes to the specified Night level (custom or preset).
(Inherited from C2nCbdPBase)
Public propertyAboveThresholdFeedback Updated to indicate the level of the ambient light in relation to the threshold. This field is only updated when EnableExtThreshold is set to false.
(Inherited from C2nCbdPBase)
Public propertyBacklightIntensity Property that returns a reference to the BacklightIntensity UShortInputSig.
(Inherited from C2nCbdPBase)
Public propertyBargraphValue Property to get or set the current bargraph value of the device. On the C2niCb this property is the same as the LeftBargraphValue
(Inherited from InetCbdex)
Public propertyBrightnessSettings Returns a BrightnessSettings instance that can be used to get and set brightness settings.
(Inherited from C2nCbdPBase)
Public propertyButton Collection of buttons supported by the device.
(Inherited from KeypadBase)
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 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 propertyEnableExtThreshold When EnableExtThreshold is true, this puts the keypad into slave mode.
(Inherited from C2nCbdPBase)
Public propertyFeedbacks Property to get the collection of feedbacks on the device.
(Inherited from InetCbdex)
Public propertyID Property to get the ID of the device.
(Inherited from GenericDevice)
Public propertyIndicatorIntensity Property to get or set the current intensity of the bargraph on the device.
(Inherited from InetCbdex)
Public propertyIsOnline Property to get the current online state of the device.
(Inherited from GenericDevice)
Public propertyLightSensorValue Updated with the ambient light level. ReportLightLevel must be set to true.
(Inherited from C2nCbdPBase)
Public propertyManualBacklight Enables manual adjustment of the backlight via the BacklightIntensity input for as long as the input is true.
(Inherited from C2nCbdPBase)
Public propertyManualIndicatorIntensity Enables manual adjustment of the LED brightness via the IndicatorIntensity input for as long as the input is true.
(Inherited from C2nCbdPBase)
Public propertyName Get the name of this device.
(Inherited from GenericBase)
Public propertyNumberOfVersiPorts Number of versiports this device supports.
(Inherited from C2nCbdPBaseWithVersiport)
Public propertyParameterBargraphTimeout Sets and gets the BargraphTimeout parameter. Valid values are between 0 to 10 seconds Use the SimplSharpDeviceHelper.SecondsToUShort to convert the time to a ushort value or the SimplSharpDeviceHelper.UShortToSeconds to convert the ushort value to seconds
(Inherited from InetCbdex)
Public propertyParameterDblTapSpeed Returns and sets the time between the end of the first tap and the start of the second tap for a "DblTap" to be recognized. Use the SimplSharpDeviceHelper.SecondsToUShort to convert the seconds to a ushort value or the SimplSharpDeviceHelper.UShortToSeconds to convert the ushort value to seconds.
(Inherited from InetCbdex)
Public propertyParameterHoldTime Returns and sets the time in seconds that a button must be held before it is recognized as a "Hold" instead of a "Tap". Use the SimplSharpDeviceHelper.SecondsToUShort to convert the seconds to a ushort value or the SimplSharpDeviceHelper.UShortToSeconds to convert the ushort value to seconds.
(Inherited from InetCbdex)
Public propertyParameterWaitForDoubleTap Returns and sets the setting that determines whether a "Tap" should be sent immediately on the release of the button, or if the unit should wait until a "DblTap" event occurs.
(Inherited from InetCbdex)
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)
Public propertyReportLightLevel Enables the LightSensorValue property and the LightSensorChange event output to report the current light level for as long as the input is true. When the input is false the light level isn't reported.
(Inherited from C2nCbdPBase)
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)
Public propertyVersiPorts Collection of versiports on the control system.
(Inherited from C2nCbdPBaseWithVersiport)
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 methodCancelActiveBargraph Cancels active bargraph.
(Inherited from InetCbdex)
Public methodDisableBargraph Disables the bargraph functionality.
(Inherited from InetCbdex)
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 methodEnableBargraph Enables the bargraph functionality.
(Inherited from InetCbdex)
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 methodSendParameters This will send the parameters fields (if any) to the device. It allows the parameters to be modified and resent without unregistering and re-registering a device. It requires firmware support on the device. Not Currently implemented. This will throw a NotSupportedException
(Inherited from InetCbdex)
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 eventButtonStateChange Event fired when a button state change was received from the device.
(Inherited from KeypadBase)
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 eventLightSensorChange Event triggered when the LightSensorValue is reported as a percentage from 0% to 100%, as determined by the internal light sensor. ReportLightLevel must be true.
(Inherited from C2nCbdPBase)
Public eventOnlineStatusChange Event triggered when the Online status of the device changes.
(Inherited from GenericDevice)
Public eventThresholdStateChange Event triggered when the C2nCbdPBase reports ambient light is at or below or above the threshold, this event is only raised when EnableExtThreshold is set to false.
(Inherited from C2nCbdPBase)
Top
Fields
 NameDescription
Protected field_Buttons Collection that contains button objects.
(Inherited from KeypadBase)
Top
Example
C#
static C2nCbdP myKeypad;
   public ControlSystemC2nCbdP()
   {
       //Register console commands
       CrestronConsole.AddNewConsoleCommand(CreateDeviceCmd, "CreateDevice", "This is a C2N-CBD-P CreateDevice command", ConsoleAccessLevelEnum.AccessOperator);
       CrestronConsole.AddNewConsoleCommand(DisableBargraphCmd, "DisableBargraph", "This is a C2N-CBD-P DisableBargraph command", ConsoleAccessLevelEnum.AccessOperator);
       CrestronConsole.AddNewConsoleCommand(EnableBargraphCmd, "EnableBargraph", "This is a C2N-CBD-P EnableBargraph command", ConsoleAccessLevelEnum.AccessOperator);
       CrestronConsole.AddNewConsoleCommand(CancelBargraphCmd, "CancelBargraph", "This is a C2N-CBD-P CancelBargraph command", ConsoleAccessLevelEnum.AccessOperator);
       CrestronConsole.AddNewConsoleCommand(AutoBackLightPresetcmd, "AutoBackLightPreset", "This is a C2N-CBD-P AutoBackLightPreset command", ConsoleAccessLevelEnum.AccessOperator);
       CrestronConsole.AddNewConsoleCommand(LightSensorValueCmd, "LightSensorValue", "This is a C2N-CBD-P LightSensorValue command", ConsoleAccessLevelEnum.AccessOperator);
       CrestronConsole.AddNewConsoleCommand(CustomDayNightThresholdCmd, "CustomDayNightThreshold", "This is a C2N-CBD-P CustomDayNightThreshold command", ConsoleAccessLevelEnum.AccessOperator);
       CrestronConsole.AddNewConsoleCommand(SetCustomDayLightIntensityCmd, "SetCustomDayL", "This is a C2N-CBD-P SetBacklightIntensity command", ConsoleAccessLevelEnum.AccessOperator);
       CrestronConsole.AddNewConsoleCommand(GetIndicatorIntensityCmd, "GetIndicatorIntensity", "This is a C2N-CBD-P GetIndicatorIntensity command", ConsoleAccessLevelEnum.AccessOperator);
       CrestronConsole.AddNewConsoleCommand(SetIndicatorIntensityCmd, "SetIndicatorIntensity", "This is a C2N-CBD-P SetIndicatorIntensity command", ConsoleAccessLevelEnum.AccessOperator);
       CrestronConsole.AddNewConsoleCommand(SetBargraphValueCmd, "SetBargraphValue", "This is a C2N-CBD-P SetBargraphValueCmd command", ConsoleAccessLevelEnum.AccessOperator);

       CrestronConsole.AddNewConsoleCommand(RunAllCmdsCmd, "RunAll", "This is a C2N-CBD-P RunAll command", ConsoleAccessLevelEnum.AccessOperator);
   }

   // Method to create the C2N-CBD-P device and register it with the control system
   public void CreateDeviceCmd(String args)
   {
       // Initialize the C2N-CBD-P device for Cresnet Communication
       myKeypad = new C2nCbdP(0x03, this);

       myKeypad.BaseEvent += MyKeypadCameMyKeypadEventHandler;
       myKeypad.ButtonStateChange += MyKeypadButtonChange;
       myKeypad.LightSensorChange += MyKeypadLightSensorChange;
       myKeypad.ThresholdStateChange += MyKeypadThresholdStateChange;
       myKeypad.VersiPorts[1].VersiportChange += C2nCbdPVersiportStateChange_EventHandler;
       myKeypad.VersiPorts[2].VersiportChange += C2nCbdPVersiportStateChange_EventHandler;

       // Register the C2N-CBD-P Cameo Professional Keypad with the Control system
       myKeypad.Register();

       if (myKeypad.Registered)
       {
           CrestronConsole.ConsoleCommandResponse("{0} device successfully registered\r\n", myKeypad.ToString());
       }
   }

   // Method to set the bar graph value.
   public void SetBargraphValueCmd(String args)
   {
       myKeypad.BargraphValue.UShortValue = SimplSharpDeviceHelper.PercentToUshort(Convert.ToUInt16(args));
   }

   // Method to set the custom daylight intensity parameter value.
   public void SetCustomDayLightIntensityCmd(String args)
   {
       myKeypad.BrightnessSettings.ParameterCustomDayBacklight = SimplSharpDeviceHelper.PercentToUshort(Convert.ToUInt16(args));
   }

   // Method to set the custom nightlight intensity parameter value.
   public void SetCustomNightlightIntensityCmd(String args)
   {
       myKeypad.BrightnessSettings.ParameterCustomNightBacklight = SimplSharpDeviceHelper.PercentToUshort(Convert.ToUInt16(args));
   }

   // Method to set the autobacklight preset parameter.
   // for setting it to InetBrightnessSettings.eAutoBacklightPreset.CustomSettings: AutoBackLightPreset 1
   public void AutoBackLightPresetcmd(String args)
   {
       myKeypad.BrightnessSettings.ParameterAutoBacklightPreset = (InetBrightnessSettings.eAutoBacklightPreset)(Convert.ToUInt16(args) -1);
   }

   // Method to set the custom day night threshold parameter value.
   public void CustomDayNightThresholdCmd(String args)
   {
       myKeypad.BrightnessSettings.ParameterCustomDayNightThreshold = SimplSharpDeviceHelper.PercentToUshort(Convert.ToUInt16(args));
   }

   // Method to print the indicator intensity parameter value.
   public void GetIndicatorIntensityCmd(String args)
   {
       CrestronConsole.ConsoleCommandResponse("IndicatorIntensity% is {0}\r\n", SimplSharpDeviceHelper.UshortToPercent(myKeypad.IndicatorIntensity.UShortValue));
   }

   // Method to set the indicator intensity parameter value.
   public void SetIndicatorIntensityCmd(String args)
   {
       myKeypad.IndicatorIntensity.UShortValue = SimplSharpDeviceHelper.PercentToUshort(Convert.ToUInt16(args));
       CrestronConsole.ConsoleCommandResponse("IndicatorIntensity% is set to {0}\r\n", SimplSharpDeviceHelper.UshortToPercent(myKeypad.IndicatorIntensity.UShortValue));
   }

   // Method to print the light sensor value.
   public void LightSensorValueCmd(String args)
   {
       CrestronConsole.Print("Light Sensor Value: {0}\r\n", myKeypad.LightSensorValue);
   }

   // Method to disable the bar graph.
   public void DisableBargraphCmd(String args)
   {
       myKeypad.DisableBargraph();
   }

   // Method to enable the bar graph.
   public void EnableBargraphCmd(String args)
   {
       myKeypad.EnableBargraph();
   }

   // Method to cancel the bar graph.
   public void CancelBargraphCmd(String args)
   {
       myKeypad.CancelActiveBargraph();
   }


   // Method to handle sig change events for C2N-CBD-P Cameo Professional Keypad.
   static private void MyKeypadCameMyKeypadEventHandler(GenericBase device, BaseEventArgs args)
   {
       if (args.EventId > 0)
       {
           CrestronConsole.PrintLine("Base Event {0} received\r\n", args.EventId);
       }
   }

   // Sig callback for handling C2N-CBD-P button events.
   static void MyKeypadButtonChange(GenericBase currentDevice, ButtonEventArgs args)
   {
       for (uint i = 1; i <= 8; i++)
       {
           if (args.Button.Number == myKeypad.Button[i].Number)
           {
               //This means Bool "sig" changed on the C2nCbdP
               //Just print some information for now.
               CrestronConsole.PrintLine("Button{0}'s state is {1}\r\n", i, args.Button.State);
           }
       }
   }

   // Sig callback for handling C2N-CBD-P Light Sensor change events.
   static void MyKeypadLightSensorChange(GenericBase device, AmbientLightSensorEventArgs args)
   {
       CrestronConsole.Print("AmbientLightSensor event received, value is : {0}\r\n", args.SensorValue);

       if (myKeypad.ManualIndicatorIntensity.BoolValue == false)
       {
           if (myKeypad.LightSensorValue == 0)
           {
               myKeypad.IndicatorIntensity.UShortValue = myKeypad.BrightnessSettings.ParameterMinAutoIndicatorIntensity;
           }
           else if (myKeypad.LightSensorValue >= 65535u)
           {
               myKeypad.IndicatorIntensity.UShortValue = myKeypad.BrightnessSettings.ParameterMaxAutoIndicatorIntensity;
           }
           else
           {
               myKeypad.IndicatorIntensity.UShortValue = Convert.ToUInt16(65535u - myKeypad.LightSensorValue);
           }
           CrestronConsole.Print("IndicatorIntensity set to {0}\r\n", myKeypad.IndicatorIntensity.UShortValue);
       }
   }

   // Sig callback for handling C2N-CBD-P Threshold State change events.
   static void MyKeypadThresholdStateChange(object obj, ThresholdEventArgs args)
   {
       switch (args.ThresholdStatus)
       {
           case eThresholdStatus.AboveThreshold:
               CrestronConsole.Print("Threshold event {0} received\r\n", args.ThresholdStatus);
               if (myKeypad.ManualBacklight.BoolValue == false)
               {
                   if (myKeypad.BrightnessSettings.ParameterAutoBacklightPreset ==
                       InetBrightnessSettings.eAutoBacklightPreset.CustomSettings)
                   {
                       myKeypad.BacklightIntensity.UShortValue = myKeypad.BrightnessSettings.ParameterCustomDayBacklight;
                       CrestronConsole.Print("BacklightIntensity set to {0}\r\n", myKeypad.BacklightIntensity.UShortValue);
                   }
                   else
                   {
                       switch (myKeypad.BrightnessSettings.ParameterAutoBacklightPreset)
                       {
                           case InetBrightnessSettings.eAutoBacklightPreset.White:
                           case InetBrightnessSettings.eAutoBacklightPreset.Almond:
                           case InetBrightnessSettings.eAutoBacklightPreset.Gray:
                           case InetBrightnessSettings.eAutoBacklightPreset.DarkAlmond:
                           case InetBrightnessSettings.eAutoBacklightPreset.Dusk:
                           case InetBrightnessSettings.eAutoBacklightPreset.Ivory:
                           case InetBrightnessSettings.eAutoBacklightPreset.Latte:
                           case InetBrightnessSettings.eAutoBacklightPreset.Brown:
                           case InetBrightnessSettings.eAutoBacklightPreset.Black:
                               myKeypad.BacklightIntensity.UShortValue = SimplSharpDeviceHelper.PercentToUshort(0);
                               CrestronConsole.Print("BacklightIntensity set to {0}\r\n", myKeypad.BacklightIntensity.UShortValue);
                               break;
                       }
                 }
               }
               break;

           case eThresholdStatus.AtOrBelowThreshold:
               CrestronConsole.Print("Threshold event {0} received\r\n", args.ThresholdStatus);
               if (myKeypad.ManualBacklight.BoolValue == false)
               {
                   if (myKeypad.BrightnessSettings.ParameterAutoBacklightPreset ==
                       InetBrightnessSettings.eAutoBacklightPreset.CustomSettings)
                   {
                       myKeypad.BacklightIntensity.UShortValue =
                           myKeypad.BrightnessSettings.ParameterCustomNightBacklight;
                   }
                   else
                   {
                       switch (myKeypad.BrightnessSettings.ParameterAutoBacklightPreset)
                       {
                           case InetBrightnessSettings.eAutoBacklightPreset.White:
                           case InetBrightnessSettings.eAutoBacklightPreset.Almond:
                           case InetBrightnessSettings.eAutoBacklightPreset.Gray:
                           case InetBrightnessSettings.eAutoBacklightPreset.DarkAlmond:
                           case InetBrightnessSettings.eAutoBacklightPreset.Dusk:
                           case InetBrightnessSettings.eAutoBacklightPreset.Ivory:
                           case InetBrightnessSettings.eAutoBacklightPreset.Latte:
                               myKeypad.BacklightIntensity.UShortValue = SimplSharpDeviceHelper.PercentToUshort(25);
                               break;
                           case InetBrightnessSettings.eAutoBacklightPreset.Brown:
                           case InetBrightnessSettings.eAutoBacklightPreset.Black:
                               myKeypad.BacklightIntensity.UShortValue = SimplSharpDeviceHelper.PercentToUshort(15);
                               break;
                       }
                   }
                   CrestronConsole.Print("BacklightIntensity set to {0}\r\n", myKeypad.BacklightIntensity.UShortValue);
               }
               break;

           default:
               CrestronConsole.Print("Invalid Threshold event {0} received\r\n", args.ThresholdStatus);
               break;
       }
   }

   // Sig callback for handling C2N-CBD-P Versiport State change events.
   static void C2nCbdPVersiportStateChange_EventHandler(Versiport vport, VersiportEventArgs args)
  {
       switch (args.Event)
       {
           case eVersiportEvent.AnalogInChange:
               CrestronConsole.Print("AnalogInChange event for Versiport{0} received\r\n", vport.ID);
               break;

           case eVersiportEvent.DigitalInChange:
               CrestronConsole.Print("DigitalInChange event for Versiport{0} received\r\n", vport.ID);
               break;
       }
   }

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also