Exemplo n.º 1
0
        void FusionStateChange(FusionBase device, FusionStateEventArgs args)
        {
            switch (args.EventId)
            {
            case FusionEventIds.SystemPowerOnReceivedEventId:
                Trace("FusionStateChange() system power on event received.");
                break;

            case FusionEventIds.SystemPowerOffReceivedEventId:
                Trace("FusionStateChange() system power off event received.");
                break;

            default:
                Trace("FusionStateChange() unhandled event received: " + args.EventId);
                break;
            }
        }
Exemplo n.º 2
0
        void FusionRoom_FusionStateChange(FusionBase device, FusionStateEventArgs args)
        {
            switch (args.EventId)
            {
            case FusionEventIds.SystemPowerOffReceivedEventId:
                if (this.FusionRoom.SystemPowerOff.OutputSig.BoolValue)
                {
                    this.Room.FusionSystemPowerRequest(false);
                }
                break;

            case FusionEventIds.SystemPowerOnReceivedEventId:
                if (this.FusionRoom.SystemPowerOn.OutputSig.BoolValue)
                {
                    this.Room.FusionSystemPowerRequest(true);
                }
                break;
            }
        }
Exemplo n.º 3
0
        private void OnFusionStateChange(FusionBase device, FusionStateEventArgs args)
        {
            var fusion = device as FusionRoom;

            if (fusion == null)
            {
                return;
            }

            switch (args.EventId)
            {
            case FusionEventIds.SystemPowerOffReceivedEventId:
                if (fusion.SystemPowerOff.OutputSig.BoolValue)
                {
                    FusionRequestedPowerOff();
                }
                break;

            case FusionEventIds.SystemPowerOnReceivedEventId:
                if (fusion.SystemPowerOn.OutputSig.BoolValue)
                {
                    FusionRequestedPowerOn();
                }
                break;

            case FusionEventIds.DisplayPowerOffReceivedEventId:
                if (fusion.DisplayPowerOff.OutputSig.BoolValue)
                {
                    FusionRequestedDisplaysOff();
                }
                break;

            case FusionEventIds.DisplayPowerOnReceivedEventId:
                if (fusion.DisplayPowerOn.OutputSig.BoolValue)
                {
                    FusionRequestedDisplaysOn();
                }
                break;
            }
        }
        /// <summary>
        /// Method to handle attribute changes on the FusionRoom object. This will be called for the default attributes, and any custom ones added using the FusionRoom.AddSig() method.
        /// </summary>
        /// <param name="device">Reference to the FusionRoom object raising this event.</param>
        /// <param name="args">Information about the event being raised.</param>
        void myRoom_FusionStateChange(FusionBase device, FusionStateEventArgs args)
        {
            // determine what type of event is being raised
            switch (args.EventId)
            {
                #region custom sigs (attributes)
            case FusionEventIds.UserConfiguredStringSigChangeEventId:
                var incomingStringSig = (StringSigData)args.UserConfiguredSigDetail;

                switch (incomingStringSig.Number)
                {
                // there are no user string sigs in this program, but this is how you would trap them
                default:
                    break;
                }
                break;

            case FusionEventIds.UserConfiguredUShortSigChangeEventId:
                var incomingUshortSig = (UShortSigData)args.UserConfiguredSigDetail;

                switch (incomingUshortSig.Number)
                {
                case 1:
                    CrestronConsole.PrintLine("Received a new Ushort value from fusion: {0}", incomingUshortSig.OutputSig.UShortValue);
                    break;

                default:
                    break;
                }
                break;

            case FusionEventIds.UserConfiguredBoolSigChangeEventId:
                var incomingBoolSig = (BooleanSigData)args.UserConfiguredSigDetail;

                if (incomingBoolSig.OutputSig.BoolValue)
                {
                    // determine which user bool sig is raising this event
                    switch (incomingBoolSig.Number)
                    {
                    case 1:
                        CrestronConsole.PrintLine("Received bool sig change from fusion!");
                        break;

                    default:
                        break;
                    }
                }

                break;
                #endregion

                #region System Power Events
            case FusionEventIds.SystemPowerOffReceivedEventId:
                // you need to add the following line to all fusion digital / bool sigs
                // when you send a digital from fusion will pulse the property on the Fusion room object (FALSE > TRUE, then TRUE > FALSE)
                // omitting this line will cause this code to be called twice
                if (myRoom.SystemPowerOff.OutputSig.BoolValue)
                {
                    // do what ever needs to happen when the sig is set
                    SetSystemPower(false);
                }
                break;

            case FusionEventIds.SystemPowerOnReceivedEventId:
                // you need to add the following line to all fusion digital / bool sigs
                // when you send a digital from fusion will pulse the property on the Fusion room object (FALSE > TRUE, then TRUE > FALSE)
                // omitting this line will cause this code to be called twice
                if (myRoom.SystemPowerOn.OutputSig.BoolValue)
                {
                    // do what ever needs to happen when the sig is set
                    SetSystemPower(true);
                }
                break;
                #endregion

                #region Display Power Events
            case FusionEventIds.DisplayPowerOnReceivedEventId:
                // you need to add the following line to all fusion digital / bool sigs
                // when you send a digital from fusion will pulse the property on the Fusion room object (FALSE > TRUE, then TRUE > FALSE)
                // omitting this line will cause this code to be called twice
                if (myRoom.DisplayPowerOn.OutputSig.BoolValue)
                {
                    // do what ever needs to happen when the sig is set
                    SetDisplayPower(true);
                }
                break;

            case FusionEventIds.DisplayPowerOffReceivedEventId:
                // you need to add the following line to all fusion digital / bool sigs
                // when you send a digital from fusion will pulse the property on the Fusion room object (FALSE > TRUE, then TRUE > FALSE)
                // omitting this line will cause this code to be called twice
                if (myRoom.DisplayPowerOff.OutputSig.BoolValue)
                {
                    // do what ever needs to happen when the sig is set
                    SetDisplayPower(false);
                }
                break;
                #endregion

                #region other possible events to explore
            case FusionEventIds.AuthenticateFailedReceivedEventId:
            case FusionEventIds.AuthenticateSucceededReceivedEventId:
            case FusionEventIds.BroadcastMessageReceivedEventId:
            case FusionEventIds.BroadcastMessageTypeReceivedEventId:
            case FusionEventIds.GroupMembershipRequestReceivedEventId:
            case FusionEventIds.HelpMessageReceivedEventId:
            case FusionEventIds.TextMessageFromRoomReceivedEventId:
                #endregion
            default:
                break;
            }
        }