Mp |
This class will trigger LightSensorChange, ShaftEncoderChange and ButtonStateChange events.
public class MpB20 : MpBBase
The MpB20 type exposes the following members.
| Name | Description | |
|---|---|---|
| BargraphValue |
Property to set the value of the 5-segment bargraph, as follows:
0% = No segment illuminated
1% - 20% = Segment 1 ON
21% - 40% = Segments 1 and 2 ON
41% - 60% = Segments 1-3 ON
61% - 80% = Segments 1-4 ON
81% - 100% = Segments 1-5 ON
Use PercentToUshort(Single) to convert
the percentage to a ushort value or UshortToPercent(UInt16) to convert
the ushort value to percentage.
(Inherited from MpBBase) | |
| Button |
Collection of buttons supported by the device.
(Inherited from KeypadBase) | |
| ConnectedIpList |
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) | |
| Description |
Get/Set the description of this device.
(Inherited from GenericBase) | |
| Disposed |
Property to indicate if the device has been disposed.
(Inherited from GenericDevice) | |
| Down |
Get the Button object corresponding to the Down button for this MpB20 device.
The ButtonStateChange event will trigger with Down and eButtonState. | |
| Enter |
Get the Button object corresponding to the Enter button for this MpB20 device.
The ButtonStateChange event will trigger with Enter and eButtonState. | |
| Feedbacks |
Property to get the collection of feedbacks on the device.
(Inherited from KeypadBase) | |
| ID |
Property to get the ID of the device.
(Inherited from GenericDevice) | |
| IndicatorIntensity |
Property to set the brightness level of the bargraph.
Use PercentToUshort(Single) to convert
the percentage to a ushort value or UshortToPercent(UInt16) to convert
the ushort value to percentage.
(Inherited from MpBBase) | |
| IRInputPort |
IR input port on the device.
Valid IRIDs range from 0x00 to 0x3F.
(Inherited from MpBBase) | |
| IsOnline |
Property to get the current online state of the device.
(Inherited from GenericDevice) | |
| Left |
Get the Button object corresponding to the Left button for this MpB20 device.
The ButtonStateChange event will trigger with Left and eButtonState. | |
| LightSensorValue |
Property to report the ambient light level detected by the internal photo sensor.
The LightSensorChange event will trigger with UShort and LightSensorValue. Use PercentToUshort(Single) to convert the percentage to a ushort value or UshortToPercent(UInt16) to convert the ushort value to percentage.(Inherited from MpBBase) | |
| MpBShaftEncoder |
Shaft Encoder object for MpBBase.
(Inherited from MpBBase) | |
| Name |
Get the name of this device.
(Inherited from GenericBase) | |
| Parent |
The parent that a given object was added to.
(Inherited from GenericBase) | |
| Registerable |
Property to indicate that this device can be registered.
(Inherited from GenericDevice) | |
| Registered |
Property to get the current registration state of the device.
(Inherited from GenericDevice) | |
| RegistrationFailureReason |
Property to get the Registration Failure Reason, this will match the return value from the call to register.
(Inherited from GenericDevice) | |
| Right |
Get the Button object corresponding to the Right button for this MpB20 device.
The ButtonStateChange event will trigger with Right and eButtonState. | |
| RowBacklightBrightness |
Property to set the backlight brightness level of the corresponding row, where Row 1 is the top
row and Row 3 is the bottom row. The backlight illuminates the labels over each button.
Use PercentToUshort(Single) to convert
the percentage to a ushort value or UshortToPercent(UInt16) to convert
the ushort value to percentage.
(Inherited from MpBBase) | |
| RowIndicatorBrightness |
Property to set the brightness level of the corresponding row of LED indicators, where Row 1 is
the top row and Row 3 is the bottom row.
Use PercentToUshort(Single) to convert
the percentage to a ushort value or UshortToPercent(UInt16) to convert
the ushort value to percentage.
(Inherited from MpBBase) | |
| SIMPLDeviceImplementation |
Internal protected member used for actual device control.
(Inherited from GenericDevice) | |
| Type |
Property to determine to type of device this is.
(Inherited from GenericDevice) | |
| UnRegistrationFailureReason |
Property to get the Unregistration Failure Reason, this will match the return value from the call to unregister.
(Inherited from GenericDevice) | |
| Up |
Get the Button object corresponding to the Up button for this MpB20 device.
The ButtonStateChange event will trigger with Up and eButtonState. | |
| UserSpecifiedObject |
Can be assigned anything that user wants.
(Inherited from GenericBase) | |
| XioEndpointStubSIMPLDevice |
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) |
| Name | Description | |
|---|---|---|
| Dispose |
Clean up of resources.
(Inherited from GenericBase) | |
| Dispose(Boolean) |
Method to perform the actual disposing of the device.
(Inherited from GenericDevice) | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
| Finalize |
Destructor of the device.
(Inherited from GenericDevice) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object) | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) | |
| OnBaseEvent(Int32) |
Protected member used to fire the BaseEvent with the default extended information.
(Inherited from GenericBase) | |
| OnBaseEvent(Int32, UInt16) |
Protected member used to fine the BaseEvent with extended event information.
(Inherited from GenericBase) | |
| Register |
Register this device with the system.
(Inherited from GenericDevice) | |
| ToString |
Return the name of the device.
(Inherited from GenericDevice) | |
| UnRegister |
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) |
| Name | Description | |
|---|---|---|
| BaseEvent |
Generic base event, triggered when the there are no other handlers available
for a specific EventID.
(Inherited from GenericBase) | |
| ButtonStateChange |
Event fired when a button state change was received from the device.
(Inherited from KeypadBase) | |
| IpInformationChange |
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) | |
| LightSensorChange |
Event triggered when the ambient light level as a percentage from 0% to 100% is reported as determined by the internal light sensor.
(Inherited from MpBBase) | |
| OnlineStatusChange |
Event triggered when the Online status of the device changes.
(Inherited from GenericDevice) |
| Name | Description | |
|---|---|---|
| _Buttons |
Collection that contains button objects.
(Inherited from KeypadBase) |
MpB20 mpB20Keypad; public ControlSystem() : base() { CrestronConsole.AddNewConsoleCommand(CreateDevice, "createDevice", "", ConsoleAccessLevelEnum.AccessAdministrator); CrestronConsole.AddNewConsoleCommand(SetBargraph, "setBargraph", "", ConsoleAccessLevelEnum.AccessAdministrator); CrestronConsole.AddNewConsoleCommand(SetBargraphBrightness, "SetBargraphBrightness", "", ConsoleAccessLevelEnum.AccessAdministrator); CrestronConsole.AddNewConsoleCommand(SetFeedbackHigh, "setFeedbackHigh", "", ConsoleAccessLevelEnum.AccessAdministrator); CrestronConsole.AddNewConsoleCommand(SetFeedbackLow, "setFeedbackLow", "", ConsoleAccessLevelEnum.AccessAdministrator); Thread.MaxNumberOfUserThreads = 100; } // Method to create the MP-B20 device. void CreateDevice(String arg) { try { mpB20Keypad = new MpB20(0x18, this); mpB20Keypad.ButtonStateChange += MpB20KeypadButtonStateChange; mpB20Keypad.MpBShaftEncoder.ShaftEncoderChange += MpBShaftEncoder_ShaftEncoderChange; mpB20Keypad.LightSensorChange += MpBx0SigChangeEventHandler; var registrationResponse = mpB20Keypad.Register(); PrintData(String.Format("Registration response: {0}", registrationResponse)); } catch (Exception e) { PrintData(String.Format("Exception CreateDevice {0}", e)); } } // Method to handle the Shaft Encoder State change Events of the MP-B20 device. void MpBShaftEncoder_ShaftEncoderChange(ShaftEncoder sender, ShaftEncoderEventArgs args) { if (args.MovedClockwiseFeedback) { PrintData("Knob moved clockwise."); } else if (args.MovedCounterClockwiseFeedback) { PrintData("Knob moved counter clockwise."); } PrintData(String.Format("Knob location acceleration {0} no acceleration {1}", args.OutputWithAccelerationFeedback, args.OutputNoAccelerationFeedback)); PrintShaftLocation(); } // Method to print the shaft location for the MP-B20 device. void PrintShaftLocation() { PrintData(String.Format("Knob location acceleration {0} no acceleration {1}", SimplSharpDeviceHelper.UshortToPercent(mpB20Keypad.MpBShaftEncoder.KnobAccelerationFeedback.UShortValue), SimplSharpDeviceHelper.UshortToPercent(mpB20Keypad.MpBShaftEncoder.KnobNoAccelerationFeedback.UShortValue))); } // Method to handle the Button state change events for MP-B20. void MpB20KeypadButtonStateChange(GenericBase device, ButtonEventArgs args) { PrintData(String.Format("MpB20 button {0} \r\n" + " at location " + " horizontal {1} vertical {2} " + "" + "now {3}.", args.Button.Number, args.Button.HorizontalLocation, args.Button.VerticalLocation, args.NewButtonState)); PrintData(String.Format("State of button sig {0} on object with ID {1}: {2}", args.Button.Number, device.ID, mpB20Keypad.Button[args.Button.Number])); } // Method to set the corresponding feedback state to 'true'. void SetFeedbackHigh(String arg) { mpB20Keypad.Feedbacks[ushort.Parse(arg)].State = true; } // Method to set the corresponding feedback state to 'false'. void SetFeedbackLow(String arg) { mpB20Keypad.Feedbacks[ushort.Parse(arg)].State = false; } // Method to print the current bargraph value of the MP-B20 device. void PrintBargraphData() { PrintData(String.Format("Bargraph now at: {0}", SimplSharpDeviceHelper.UshortToPercent(mpB20Keypad.BargraphValue.UShortValue))); } // Method to set the bargraph value of the MP-B20 device. void SetBargraph(String arg) { ushort settingTo = ushort.Parse(arg); PrintData(String.Format("Setting bargraph to {0}", settingTo)); mpB20Keypad.BargraphValue.UShortValue = settingTo; PrintBargraphData(); } // Method to set the bargraph brightness of the MP-B20 device. void SetBargraphBrightness(String arg) { ushort settingTo = ushort.Parse(arg); PrintData(String.Format("Setting bargraph brightness to {0}", settingTo)); mpB20Keypad.IndicatorIntensity.UShortValue = settingTo; } // Method to handle the Sig change event handler for Sensor value changes on the MP-B20 device. static void MpBx0SigChangeEventHandler(GenericBase device, AmbientLightSensorEventArgs args) { CrestronConsole.PrintLine("Sensor Value Feedback Event occurred value is {0}", args.SensorValue); } // Method to print data passes as argument. void PrintData(String arg) { CrestronConsole.PrintLine(arg); }