Cen |
public sealed class CenRfgwEx : RFExGateway
The CenRfgwEx type exposes the following members.
| Name | Description | |
|---|---|---|
| CenRfgwEx | Constructor used to generate a new Ethernet RF EX gateway attached to a controller. |
| Name | Description | |
|---|---|---|
| AttachedDevices |
Property to access the current list of attached devices from this program on the gateway.
(Inherited from GatewayBase) | |
| 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) | |
| ExtenderBatteryLevel |
Reports the battery level of the RF remote.
(Inherited from RFExGateway) | |
| ExtenderBatteryState |
Reports the state of the RF device's battery.
(Inherited from RFExGateway) | |
| ExtenderCresnetMessagesOnFailure |
Extender to report the failed messages sent to an RF device.
(Inherited from RFExGateway) | |
| ExtenderCresnetMessagesOnSuccess |
Extender to report the successful messages set to an RF device.
(Inherited from RFExGateway) | |
| ExtenderLinkState |
Reports the connection status of RF devices.
(Inherited from RFExGateway) | |
| ExtenderSetupInformation |
Gateway setup information.
(Inherited from RFExGateway) | |
| ID |
Property to get the ID of the device.
(Inherited from GenericDevice) | |
| IsInternal |
Flag to indicate if this gateway is internal to the control system.
(Inherited from GatewayBase) | |
| IsOnline |
Property to get the current online state of the device.
(Inherited from GenericDevice) | |
| IsSharable |
Property used to determine if this gateway is sharable.
(Inherited from GatewayBase) | |
| 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) | |
| 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) | |
| 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 | |
|---|---|---|
| Add |
Method to add a device to the list of attached devices.
(Inherited from GatewayBase) | |
| 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) | |
| 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) | |
| Remove |
Method to remove a device from the attached device list.
(Inherited from GatewayBase) | |
| 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) | |
| 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) | |
| OnlineStatusChange |
Event triggered when the Online status of the device changes.
(Inherited from GenericDevice) |
| Name | Description | |
|---|---|---|
| _AttachedDevices |
Internal storage of the devices attached to the gateway.
(Inherited from GatewayBase) |
private static CenRfgwEx _rfGateway; /// Helper function to initialize the rfGateway device and whatever other devices you are connecting to it. public static bool InitializeDevice(CrestronControlSystem controller) { bool returnValue = false; try { // If the controller is not valid (null) return right away. if (controller == null) return returnValue; if (!controller.SupportsEthernet) return returnValue; // Create a new object for the rfGateway connected to the Control System. ->(this) // Device is connected the control system by an IP_ID. // In this example IP_ID 4 is used. // The second parameter, "this" is referring to the ControlSystem class that extends the CrestronControlSystem. // If you are not within the scope of such a class, make sure you have access to it. _rfGateway = new CenRfgwEx(0x04, controller); // IMPORTANT: You must add all devices connected to the rfGateway before you register the device. // Reserve signals for setup info and connected device information. _rfGateway.ExtenderSetupInformation.Use(); // Assign the dimmer, and rfGateway a description. // These descriptions will be used within the IP table constructed by the program on the control system. _rfGateway.Description = "GWEXER Main"; // Initialize our rfGateway's event handlers. EventHandlerSetup(); // We must register the device with the rfGateway, if it fails print to the error log // the reason for the failure. // IMPORTANT: If you wish to add another device paired to the rfGateway, you must // unregister the rfGateway from the controller, create the object for your device // and register once again. if (_rfGateway.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("RF-Gateway cannot be registered: {0}", rfGateway.RegistrationFailureReason); } else { // If everything goes to plan, set the return value to true. // indication that initialization when smoothly. returnValue = true; } } catch (Exception e) { // If anything has an issue, exception will trigger and be logged within your device's error log. ErrorLog.Error("Error Initializing rfGateway or Registering RF Devices: {0}", e.Message); // Mark our return value for failure. returnValue = false; } // Finally, return an indication of the success of the function execution. return returnValue; } /// Initializes all event handlers for the rfGateway. private static void EventHandlerSetup() { if(_rfGateway == null){ ErrorLog.Error("Cannot assign to a null object"); throw new NullReferenceException(); return; } // Listen for a change in the rfGateway's online status. _rfGateway.OnlineStatusChange += new OnlineStatusChangeEventHandler(OnlineStatusChange); // Listener for successful messages sent to the rfGateway. _rfGateway.ExtenderCresnetMessagesOnSuccess.DeviceExtenderSigChange += new DeviceExtenderJoinChangeEventHandler( rfGateway_ExtenderCresnetMessagesOnSuccess_DeviceExtenderSigChange ); // Listener for failed messages sent to the rfGateway. _rfGateway.ExtenderCresnetMessagesOnFailure.DeviceExtenderSigChange += new DeviceExtenderJoinChangeEventHandler( rfGateway_ExtenderCresnetMessagesOnFailure_DeviceExtenderSigChange ); } /// Event handler for all online status changes. /// When the device goes online or offline this event handler will listen for it. static void OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) { if (args.DeviceOnLine) ErrorLog.Notice("{0} is online", currentDevice.Description); else ErrorLog.Notice("{0} is offline", currentDevice.Description); } /// Event handler for IP information being changed on the device. /// Triggered when the device is connected to the control system. /// and whenever else the IP address of the rfGateway changes. static void rfGateway_IpInformationChange(GenericBase currentDevice, ConnectedIpEventArgs args) { ErrorLog.Warn("IP addr: {0} . Connected: {1}", args.DeviceIpAddress, args.Connected); } /// Event handler for Successful messages sent to the rfGateway. static void rfGateway_ExtenderCresnetMessagesOnSuccess_DeviceExtenderSigChange(DeviceExtender currentDeviceExtender, SigEventArgs args) { ErrorLog.Notice("rfGateway: {0} sent message successfully.", rfGateway.Description); } /// Event handler for failed messages sent to the rfGateway. static void rfGateway_ExtenderCresnetMessagesOnFailure_DeviceExtenderSigChange(DeviceExtender currentDeviceExtender, SigEventArgs args) { ErrorLog.Error("rfGateway: {0} message failed.", args.Sig.StringValue); } /// Returns a list of RFDeviceInformation related to each connected RF device to the gateway. /// Important not to add devices to the List as it will not connect the device to the gateway. public static IList[RFDeviceInformation] GetPairedRfDevices() { return rfGateway.ExtenderSetupInformation.AcquiredDevices.AsReadOnly(); } /// Puts the gateway into acquire mode. public static void DeviceAcquireOn() { // set Acquire mode on for the gateway. if (!_rfGateway.ExtenderSetupInformation.AcquireFeedback.BoolValue) _rfGateway.ExtenderSetupInformation.AcquireOn(); } /// Turns acquire mode off on the gateway and registers itself with the controller again again. public static void DeviceAcquireOff() { int deviceCount = rfGateway.ExtenderSetupInformation.AcquiredDevices.Count; // Check to make sure that we are in acquire mode before attempting to turn it off. if (_rfGateway.ExtenderSetupInformation.AcquireFeedback.BoolValue) // Set acquire mode to off for the gateway. _rfGateway.ExtenderSetupInformation.AcquireOff(); // IMPORTANT: You must add all devices connected to the rfGateway before you register the device. // Unless it's an internal gateway, in which case every device has to be registered separately. // Examples of control systems with internal gateways are: MC3, DIN-AP3MEX. if (_rfGateway.ExtenderSetupInformation.AcquiredDevices.Count > deviceCount) // If execution enters this scope, we know that a new device was added when the gateway was in acquire mode. // you must now unregister, add said device, and register the gateway with the control system. }