public GlsOccupancySensorBaseController(string key, string name, GlsOccupancySensorBase sensor)
            : base(key, name, sensor)
        {
            OccSensor = sensor;

            RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);

            PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue);

            LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue);

            ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue);

            PirSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue);

            PirSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue);

            CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue);

            LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue);

            GraceOccupancyDetectedFeedback = new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue);

            RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue);

            InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue);

            ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue);

            OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent);

            OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(OccSensor_GlsOccupancySensorChange);
        }
Exemple #2
0
        void Init()
        {
            PortGather = new CommunicationGather(Communication, '\x0d');
            PortGather.LineReceived += this.Port_LineReceived;
            CommunicationMonitor     = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, "\x02QPW\x03");         // Query Power

            InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this));
            InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Hdmi, new Action(InputHdmi2), this));

            InputPorts.Add(new RoutingInputPort(RoutingPortNames.DviIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Dvi, new Action(InputDvi1), this));
            InputPorts.Add(new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Composite, new Action(InputVideo1), this));
            InputPorts.Add(new RoutingInputPort(RoutingPortNames.VgaIn, eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Vga, new Action(InputVga), this));


            VolumeLevelFeedback = new IntFeedback(() => { return(_VolumeLevel); });
            MuteFeedback        = new BoolFeedback(() => _IsMuted);

            //    new BoolCueActionPair(CommonBoolCue.Menu, b => { if(b) Send(MenuIrCmd); }),
            //    new BoolCueActionPair(CommonBoolCue.Up, b => { if(b) Send(UpIrCmd); }),
            //    new BoolCueActionPair(CommonBoolCue.Down, b => { if(b) Send(DownIrCmd); }),
            //    new BoolCueActionPair(CommonBoolCue.Left, b => { if(b) Send(LeftIrCmd); }),
            //    new BoolCueActionPair(CommonBoolCue.Right, b => { if(b) Send(RightIrCmd); }),
            //    new BoolCueActionPair(CommonBoolCue.Select, b => { if(b) Send(SelectIrCmd); }),
            //    new BoolCueActionPair(CommonBoolCue.Exit, b => { if(b) Send(ExitIrCmd); }),
            //};
        }
Exemple #3
0
        /// <summary>
        /// Initializes this attribute based on config values and generates subscriptions commands and adds commands to the parent's queue.
        /// </summary>
        public void Initialize(string key, QscDspLevelControlBlockConfig config)
        {
            Key     = string.Format("{0}--{1}", Parent.Key, key);
            Enabled = true;
            DeviceManager.AddDevice(this);
            if (config.IsMic)
            {
                Type = ePdtLevelTypes.microphone;
            }
            else
            {
                Type = ePdtLevelTypes.speaker;
            }

            Debug.Console(2, this, "Adding LevelControl '{0}'", Key);

            this.IsSubscribed = false;

            MuteFeedback = new BoolFeedback(() => _IsMuted);

            VolumeLevelFeedback = new IntFeedback(() => _VolumeLevel);

            VolumeUpRepeatTimer   = new CTimer(VolumeUpRepeat, Timeout.Infinite);
            VolumeDownRepeatTimer = new CTimer(VolumeDownRepeat, Timeout.Infinite);
            LevelCustomName       = config.Label;
            HasMute  = config.HasMute;
            HasLevel = config.HasLevel;
        }
Exemple #4
0
            public ProgramStatusFeedbacks(Program program)
            {
                ProgramInfo = new ProgramInfo(program.Number);

                Program = program;

                ProgramInfo.OperatingState    = Program.OperatingState;
                ProgramInfo.RegistrationState = Program.RegistrationState;

                ProgramStartedFeedback    = new BoolFeedback(() => Program.OperatingState == eProgramOperatingState.Start);
                ProgramStoppedFeedback    = new BoolFeedback(() => Program.OperatingState == eProgramOperatingState.Stop);
                ProgramRegisteredFeedback =
                    new BoolFeedback(() => Program.RegistrationState == eProgramRegistrationState.Register);
                ProgramUnregisteredFeedback =
                    new BoolFeedback(() => Program.RegistrationState == eProgramRegistrationState.Unregister);

                ProgramNameFeedback             = new StringFeedback(() => ProgramInfo.ProgramFile);
                ProgramCompileTimeFeedback      = new StringFeedback(() => ProgramInfo.CompileTime);
                CrestronDataBaseVersionFeedback = new StringFeedback(() => ProgramInfo.CrestronDb);
                EnvironmentVersionFeedback      = new StringFeedback(() => ProgramInfo.Environment);

                AggregatedProgramInfoFeedback = new StringFeedback(() => JsonConvert.SerializeObject(ProgramInfo));

                GetProgramInfo();
            }
Exemple #5
0
        public TesiraDspMeter(string key, TesiraMeterBlockConfig config, TesiraDsp parent)
            : base(config.MeterInstanceTag, string.Empty, config.Index, 0, parent, string.Format(KeyFormatter, parent.Key, key), config.Label, config.BridgeIndex)
        {
            DeviceManager.AddDevice(this);

            Label   = config.Label;
            Enabled = config.Enabled;

            MeterFeedback      = new IntFeedback(Key + "-MeterFeedback", () => _currentMeter);
            SubscribedFeedback = new BoolFeedback(Key + "-SubscribedFeedback", () => IsSubscribed);

            Feedbacks.Add(MeterFeedback);
            Feedbacks.Add(SubscribedFeedback);
            Feedbacks.Add(NameFeedback);

            parent.Feedbacks.AddRange(Feedbacks);

            if (config.MeterData != null)
            {
                var data = config.MeterData;
                _meterMinimum    = data.MeterMimimum;
                _meterMaximum    = data.MeterMaxiumum;
                _defaultPollTime = data.DefaultPollTime;
            }
            else
            {
                _meterMinimum    = MeterMinimumDefault;
                _meterMaximum    = MeterMaximumDefault;
                _defaultPollTime = DefaultPollTimeDefault;
            }

            /*CrestronConsole.AddNewConsoleCommand(s => Subscribe(), "enablemeters", "", ConsoleAccessLevelEnum.AccessOperator);
             * CrestronConsole.AddNewConsoleCommand(s => UnSubscribe(), "disablemeters", "", ConsoleAccessLevelEnum.AccessOperator);*/
        }
Exemple #6
0
        /// <summary>
        /// Constructor for Tesira DSP Dialer
        /// </summary>
        /// <param name="key">Unique Key</param>
        /// <param name="config">Component Config</param>
        /// <param name="parent">Parent Device</param>
        public TesiraDspDialer(string key, TesiraDialerControlBlockConfig config, TesiraDsp parent)
            : base(key, config.DialerInstanceTag, config.ControlStatusInstanceTag, config.Index, config.CallAppearance, parent, config.BridgeIndex)
        {
            Key = string.Format("{0}--Dialer{1}", parent.Key, key);

            Feedbacks = new FeedbackCollection <Feedback>();

            DialStringFeedback     = new StringFeedback(Key + "-DialStringFeedback", () => DialString);
            OffHookFeedback        = new BoolFeedback(Key + "-OffHookFeedback", () => OffHookStatus);
            AutoAnswerFeedback     = new BoolFeedback(Key + "-AutoAnswerFeedback", () => AutoAnswerState);
            DoNotDisturbFeedback   = new BoolFeedback(Key + "-DoNotDisturbFeedback", () => DoNotDisturbState);
            CallerIdNumberFeedback = new StringFeedback(Key + "-CallerIDNumberFeedback", () => CallerIdNumber);
            CallerIdNameFeedback   = new StringFeedback(Key + "-CallerIDNameFeedback", () => CallerIdName);
            IncomingCallFeedback   = new BoolFeedback(Key + "-IncomingCallFeedback", () => IncomingCallState);
            CallStateFeedback      = new IntFeedback(Key + "-CallStateFeedback", () => (int)CallStatusEnum);
            LastDialedFeedback     = new StringFeedback(Key + "-LastDialedFeedback", () => LastDialed);
            NameFeedback           = new StringFeedback(Key + "-NameFeedback", () => Name);
            DisplayNumberFeedback  = new StringFeedback(Key + "-DisplayNumberFeedback", () => DisplayNumber);

            Feedbacks.Add(DialStringFeedback);
            Feedbacks.Add(OffHookFeedback);
            Feedbacks.Add(AutoAnswerFeedback);
            Feedbacks.Add(DoNotDisturbFeedback);
            Feedbacks.Add(CallerIdNumberFeedback);
            Feedbacks.Add(CallerIdNameFeedback);
            Feedbacks.Add(IncomingCallFeedback);
            Feedbacks.Add(CallStateFeedback);
            Feedbacks.Add(LastDialedFeedback);
            Feedbacks.Add(NameFeedback);
            Feedbacks.Add(DisplayNumberFeedback);

            parent.Feedbacks.AddRange(Feedbacks);

            Initialize(key, config);
        }
Exemple #7
0
        public CameraVisca(string key, string name, IBasicCommunication comm, CameraPropertiesConfig props) :
            base(key, name)
        {
            // Default to all capabilties
            Capabilities = eCameraCapabilities.Pan | eCameraCapabilities.Tilt | eCameraCapabilities.Zoom | eCameraCapabilities.Focus;

            Communication = comm;
            var socket = comm as ISocketStatus;

            if (socket != null)
            {
                // This instance uses IP control
                socket.ConnectionChange += new EventHandler <GenericSocketStatusChageEventArgs>(socket_ConnectionChange);
            }
            else
            {
                // This instance uses RS-232 control
            }
            PortGather = new CommunicationGather(Communication, "\xFF");


            Communication.BytesReceived += new EventHandler <GenericCommMethodReceiveBytesArgs>(Communication_BytesReceived);
            PowerIsOnFeedback            = new BoolFeedback(() => { return(PowerIsOn); });

            if (props.CommunicationMonitorProperties != null)
            {
                CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, props.CommunicationMonitorProperties);
            }
            else
            {
                CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 20000, 120000, 300000, "\x81\x09\x04\x00\xFF");
            }
            DeviceManager.AddDevice(CommunicationMonitor);
        }
Exemple #8
0
        public StatusSignController(string key, string name, GenericBase hardware) : base(key, name, hardware)
        {
            _device = hardware as StatusSign;

            RedLedEnabledFeedback =
                new BoolFeedback(
                    () =>
                    _device.Leds[(uint)StatusSign.Led.eLedColor.Red]
                    .ControlFeedback.BoolValue);
            GreenLedEnabledFeedback =
                new BoolFeedback(
                    () =>
                    _device.Leds[(uint)StatusSign.Led.eLedColor.Green]
                    .ControlFeedback.BoolValue);
            BlueLedEnabledFeedback =
                new BoolFeedback(
                    () =>
                    _device.Leds[(uint)StatusSign.Led.eLedColor.Blue]
                    .ControlFeedback.BoolValue);

            RedLedBrightnessFeedback =
                new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Red].BrightnessFeedback);
            GreenLedBrightnessFeedback =
                new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Green].BrightnessFeedback);
            BlueLedBrightnessFeedback =
                new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Blue].BrightnessFeedback);

            if (_device != null)
            {
                _device.BaseEvent += _device_BaseEvent;
            }
        }
Exemple #9
0
        /// <summary>
        ///  Make a Crestron RMC and put it in here
        /// </summary>
        public DmRmc4kScalerCDspController(string key, string name, DmRmc4kScalerCDsp rmc)
            : base(key, name, rmc)
        {
            Rmc  = rmc;
            DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                        eRoutingPortConnectionType.DmCat, 0, this);
            HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                            eRoutingPortConnectionType.Hdmi, null, this);
            BalancedAudioOut = new RoutingOutputPort(DmPortName.BalancedAudioOut, eRoutingSignalType.Audio,
                                                     eRoutingPortConnectionType.LineAudio, null, this);

            MuteFeedback        = new BoolFeedback(() => false);
            VolumeLevelFeedback = new IntFeedback("MainVolumeLevelFeedback", () =>
                                                  rmc.AudioOutput.VolumeFeedback.UShortValue);

            EdidManufacturerFeedback    = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue);
            EdidNameFeedback            = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue);
            EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
            EdidSerialNumberFeedback    = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);

            VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString());

            Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
            Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;

            // Set Ports for CEC
            HdmiOut.Port = Rmc.HdmiOutput;
        }
Exemple #10
0
        /// <summary>
        /// Intial logic to set up instance
        /// </summary>
        void Init()
        {
            // Will gather to the specified delimiter
            PortGather = new CommunicationGather(Communication, '\x03');
            PortGather.LineReceived += this.Port_LineReceived;

            // Constuct the CommunicationMonitor
            CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, "\x02QPW\x03\x02QMI\x03"); // Query Power

            // Define the input ports
            InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this));
            InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Hdmi, new Action(InputHdmi2), this));
            InputPorts.Add(new RoutingInputPort(RoutingPortNames.DviIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Dvi, new Action(InputDvi1), this));
            InputPorts.Add(new RoutingInputPort(RoutingPortNames.VgaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Vga, new Action(InputVga), this));

            // Define the feedback Funcs
            VolumeLevelFeedback = new IntFeedback(() => { return(_VolumeLevel); });
            MuteFeedback        = new BoolFeedback(() => _IsMuted);
            InputNumberFeedback = new IntFeedback(() => { Debug.Console(2, this, "CHange Input number {0}", InputNumber); return(InputNumber); });

            // Set the warmup time
            WarmupTime = 17000;
        }
Exemple #11
0
        public override bool CustomActivate()
        {
            /*
             * Communication.Connect();
             * CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); };
             * CommunicationMonitor.Start();
             */

            OnlineFeedback       = new BoolFeedback(() => { return(OnlineStatus); });
            CircuitStatus        = new Dictionary <uint, DigitalLoggerCircuit>();
            CircuitNameFeedbacks = new Dictionary <uint, StringFeedback>();
            CircuitIsCritical    = new Dictionary <uint, BoolFeedback>();
            CircuitState         = new Dictionary <uint, BoolFeedback>();
            for (uint i = 0; i < CircuitCount; i++)
            {
                uint circuit = i;
                CircuitStatus[circuit]        = new DigitalLoggerCircuit();
                CircuitNameFeedbacks[circuit] = new StringFeedback(() => {
                    if (CircuitStatus[circuit].name != null)
                    {
                        return(CircuitStatus[circuit].name);
                    }
                    else
                    {
                        return("");
                    }
                });
                CircuitIsCritical[circuit] = new BoolFeedback(() =>
                {
                    if (CircuitStatus.ContainsKey(circuit))
                    {
                        return(CircuitStatus[circuit].critical);
                    }
                    else
                    {
                        return(false);
                    }
                });
                CircuitState[circuit] = new BoolFeedback(() =>
                {
                    if (CircuitStatus.ContainsKey(circuit))
                    {
                        return(CircuitStatus[circuit].state);
                    }
                    else
                    {
                        return(false);
                    }
                });
                PollCircuit(circuit);
            }

            CrestronConsole.AddNewConsoleCommand(SendLine, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
            CrestronConsole.AddNewConsoleCommand(s => Communication.Connect(), "con" + Key, "", ConsoleAccessLevelEnum.AccessOperator);



            return(true);
        }
Exemple #12
0
        /// <summary>
        /// Device Constructor.  Called by BuildDevice
        /// </summary>
        /// <param name="key"></param>
        /// <param name="name"></param>
        /// <param name="config"></param>
        public MockOccupancyDetectorDevice(string key, string name, MockOccupancyDetectorPropertiesConfig config)
            : base(key, name)
        {
            RoomIsOccupiedFeedback = new BoolFeedback(() => IsOccupied);

            CrestronConsole.AddNewConsoleCommand((s) => SetOccupiedStatus(s), "setoccupiedstate",
                                                 "Sets the state of the mock occupancy detector [true/false]", ConsoleAccessLevelEnum.AccessOperator);
        }
        public GenericDigitalInputDevice(string key, DigitalInput inputPort) :
            base(key)
        {
            InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);

            InputPort = inputPort;

            InputPort.StateChange += new DigitalInputEventHandler(InputPort_StateChange);
        }
Exemple #14
0
        // Add requirements for Dialer functionality

        public QscDspDialer(QscDialerConfig Config, QscDsp parent)
        {
            Tags                 = Config;
            Parent               = parent;
            DialStringFeedback   = new StringFeedback(() => { return(DialString); });
            OffHookFeedback      = new BoolFeedback(() => { return(OffHook); });
            AutoAnswerFeedback   = new BoolFeedback(() => { return(AutoAnswerState); });
            DoNotDisturbFeedback = new BoolFeedback(() => { return(DoNotDisturbState); });
        }
        /// <summary>
        /// Initializes this attribute based on config values and generates subscriptions commands and adds commands to the parent's queue.
        /// </summary>
        /// <param name="config">Configuration Object</param>
        private void Initialize(TesiraRoomCombinerBlockConfig config)
        {
            if (config.Enabled)
            {
                DeviceManager.AddDevice(this);
            }

            Debug.Console(2, this, "Adding RoomCombiner '{0}'", Key);

            IsSubscribed = false;

            HasMute                     = config.HasMute;
            HasLevel                    = config.HasLevel;
            UseAbsoluteValue            = config.UseAbsoluteValue;
            Enabled                     = config.Enabled;
            Permissions                 = config.Permissions;
            IncrementAmount             = config.IncrementAmount;
            AutomaticUnmuteOnVolumeUp   = config.UnmuteOnVolChange;
            _volumeUpRepeatTimer        = new CTimer((o) => VolumeUpRepeat(), Timeout.Infinite);
            _volumeDownRepeatTimer      = new CTimer((o) => VolumeDownRepeat(), Timeout.Infinite);
            _volumeUpRepeatDelayTimer   = new CTimer((o) => VolumeUpRepeatDelay(), Timeout.Infinite);
            _volumeDownRepeatDelayTimer = new CTimer((o) => VolumeDownRepeatDelay(), Timeout.Infinite);

            _pollTimer = new CTimer((o) => DoPoll(), Timeout.Infinite);


            if (HasMute && HasLevel)
            {
                ControlType = 0;
            }
            else if (!HasMute && HasLevel)
            {
                ControlType = 1;
            }

            else if (HasMute && !HasLevel)
            {
                ControlType = 2;
            }

            MuteFeedback    = new BoolFeedback(Key + "-MuteFeedback", () => OutIsMuted);
            VisibleFeedback = new BoolFeedback(Key + "-VisibleFeedback", () => Enabled);

            RoomGroupFeedback   = new IntFeedback(Key + "-RoomGroupFeedback", () => RoomGroup);
            VolumeLevelFeedback = new IntFeedback(Key + "-LevelFeedback", () => OutVolumeLevel);
            ControlTypeFeedback = new IntFeedback(Key + "-ControlTypeFeedback", () => ControlType);
            PermissionsFeedback = new IntFeedback(Key + "-PermissionsFeedback", () => Permissions);

            Feedbacks.Add(MuteFeedback);
            Feedbacks.Add(VolumeLevelFeedback);
            Feedbacks.Add(NameFeedback);
            Feedbacks.Add(VisibleFeedback);
            Feedbacks.Add(ControlTypeFeedback);
            Feedbacks.Add(PermissionsFeedback);

            Parent.Feedbacks.AddRange(Feedbacks);
        }
Exemple #16
0
 /// <summary>
 /// Private constructor. Use GetDevice factory method
 /// </summary>
 /// <param name="key"></param>
 /// <param name="name"></param>
 /// <param name="shade"></param>
 CrestronBasicShadesController(string key, string name, ShadeWithBasicSettings shade) :
     base(key, name, shade)
 {
     Shade                 = shade;
     IsStoppedFeedback     = new BoolFeedback(() => Shade.IsStopped.BoolValue);
     PositionFeedback      = new IntFeedback(() => Shade.PositionFeedback.UShortValue);
     ShadeIsOpenFeedback   = new BoolFeedback(() => Shade.IsFullyOpened.BoolValue);
     ShadeIsClosedFeedback = new BoolFeedback(() => shade.IsFullyClosed.BoolValue);
 }
Exemple #17
0
        public GenericRelayDevice(string key, Relay relay) :
            base(key)
        {
            OutputIsOnFeedback = new BoolFeedback(new Func <bool>(() => RelayOutput.State));

            RelayOutput = relay;
            RelayOutput.Register();

            RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange);
        }
Exemple #18
0
 public Laptop(string key, string name)
     : base(key, name)
 {
     IconName           = "Laptop";
     HasPowerOnFeedback = new BoolFeedback("HasPowerFeedback",
                                           () => this.GetVideoStatuses() != VideoStatusOutputs.NoStatus);
     OutputPorts = new RoutingPortCollection <RoutingOutputPort>();
     OutputPorts.Add(AnyVideoOut = new RoutingOutputPort(RoutingPortNames.AnyOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                         eRoutingPortConnectionType.None, 0, this));
 }
        /// <summary>
        /// Constructor for Tesira DSP Matrix Mixer Component
        /// </summary>
        /// <param name="key">Unique Key for Component</param>
        /// <param name="config">Config Object for Component</param>
        /// <param name="parent">Parent object of Component</param>
        public TesiraDspCrosspointState(string key, TesiraCrosspointStateBlockConfig config, TesiraDsp parent)
            : base(config.MatrixInstanceTag, string.Empty, config.Index1, config.Index2, parent, string.Format(KeyFormatter, parent.Key, key), config.Label, config.BridgeIndex)
        {
            Label   = config.Label;
            Enabled = config.Enabled;

            CrosspointStateFeedback = new BoolFeedback(Key + "-CrosspointStateFeedback", () => _state);

            Feedbacks.Add(CrosspointStateFeedback);
            Feedbacks.Add(NameFeedback);
            parent.Feedbacks.AddRange(Feedbacks);
        }
Exemple #20
0
        public override bool CustomActivate()
        {
            Communication.Connect();
            CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); };
            CommunicationMonitor.Start();

            OnlineFeedback = new BoolFeedback(() => { return(OnlineStatus); });
            PresetFeedback = new IntFeedback(() => { return(CurrentPreset); });

            CrestronConsole.AddNewConsoleCommand(SendLine, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
            CrestronConsole.AddNewConsoleCommand(s => Communication.Connect(), "con" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
            return(true);
        }
Exemple #21
0
        public AirMediaController(string key, string name, AmX00 device, DeviceConfig dc, AirMediaPropertiesConfig props)
            : base(key, name, device)
        {
            AirMedia = device;

            DeviceConfig = dc;

            PropertiesConfig = props;

            InputPorts  = new RoutingPortCollection <RoutingInputPort>();
            OutputPorts = new RoutingPortCollection <RoutingOutputPort>();

            InputPorts.Add(new RoutingInputPort(DmPortName.Osd, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this));

            InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this));

            InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this));

            InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this));

            if (AirMedia is Am300)
            {
                InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                    eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), this));
            }

            AirMedia.AirMedia.AirMediaChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(AirMedia_AirMediaChange);

            IsInSessionFeedback            = new BoolFeedback(new Func <bool>(() => AirMedia.AirMedia.StatusFeedback.UShortValue == 0));
            ErrorFeedback                  = new IntFeedback(new Func <int>(() => AirMedia.AirMedia.ErrorFeedback.UShortValue));
            NumberOfUsersConnectedFeedback = new IntFeedback(new Func <int>(() => AirMedia.AirMedia.NumberOfUsersConnectedFeedback.UShortValue));
            LoginCodeFeedback              = new IntFeedback(new Func <int>(() => AirMedia.AirMedia.LoginCodeFeedback.UShortValue));
            ConnectionAddressFeedback      = new StringFeedback(new Func <string>(() => AirMedia.AirMedia.ConnectionAddressFeedback.StringValue));
            HostnameFeedback               = new StringFeedback(new Func <string>(() => AirMedia.AirMedia.HostNameFeedback.StringValue));

            // TODO: Figure out if we can actually get the TSID/Serial
            SerialNumberFeedback = new StringFeedback(new Func <string>(() => "unknown"));

            AirMedia.DisplayControl.DisplayControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(DisplayControl_DisplayControlChange);

            VideoOutFeedback = new IntFeedback(new Func <int>(() => Convert.ToInt16(AirMedia.DisplayControl.VideoOutFeedback)));
            AutomaticInputRoutingEnabledFeedback = new BoolFeedback(new Func <bool>(() => AirMedia.DisplayControl.EnableAutomaticRoutingFeedback.BoolValue));

            AirMedia.HdmiIn.StreamChange += new Crestron.SimplSharpPro.DeviceSupport.StreamEventHandler(HdmiIn_StreamChange);

            HdmiVideoSyncDetectedFeedback = new BoolFeedback(new Func <bool>(() => AirMedia.HdmiIn.SyncDetectedFeedback.BoolValue));
        }
Exemple #22
0
        /// <summary>
        /// Constructor for StateControl Component
        /// </summary>
        /// <param name="key">Unique Key for Component</param>
        /// <param name="config">Config Object for Component</param>
        /// <param name="parent">Component Parent Object</param>
        public TesiraDspStateControl(string key, TesiraStateControlBlockConfig config, TesiraDsp parent)
            : base(config.StateInstanceTag, String.Empty, config.Index, 0, parent, string.Format(KeyFormatter, parent.Key, key), config.Label, config.BridgeIndex)
        {
            Debug.Console(2, this, "New State Instance Tag = {0}", config.StateInstanceTag);
            Debug.Console(2, this, "Starting State {0} Initialize", key);

            StateFeedback = new BoolFeedback(Key + "-StateFeedback", () => _state);

            Feedbacks.Add(StateFeedback);
            Feedbacks.Add(NameFeedback);
            parent.Feedbacks.AddRange(Feedbacks);

            Initialize(config);
        }
        public GenericVersiportDigitalInputDevice(string key, Versiport inputPort, IOPortConfig props) :
            base(key)
        {
            InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
            InputPort          = inputPort;
            InputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalInput);
            if (props.DisablePullUpResistor)
            {
                InputPort.DisablePullUpResistor = true;
            }
            InputPort.VersiportChange += new VersiportEventHandler(InputPort_VersiportChange);

            Debug.Console(1, this, "Created GenericVersiportDigitalInputDevice on port '{0}'.  DisablePullUpResistor: '{1}'", props.PortNumber, InputPort.DisablePullUpResistor);
        }
Exemple #24
0
        /// <summary>
        ///
        /// </summary>
        public MockVC(DeviceConfig config)
            : base(config)
        {
            PropertiesConfig = JsonConvert.DeserializeObject <VideoCodec.MockVcPropertiesConfig>(config.Properties.ToString());

            CodecInfo = new MockCodecInfo();

            // Get favoritesw
            if (PropertiesConfig.Favorites != null)
            {
                CallFavorites           = new CodecCallFavorites();
                CallFavorites.Favorites = PropertiesConfig.Favorites;
            }

            DirectoryBrowseHistory = new List <CodecDirectory>();

            // Debug helpers
            MuteFeedback.OutputChange            += (o, a) => Debug.Console(1, this, "Mute={0}", _IsMuted);
            PrivacyModeIsOnFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Privacy={0}", _PrivacyModeIsOn);
            SharingSourceFeedback.OutputChange   += (o, a) => Debug.Console(1, this, "SharingSource={0}", _SharingSource);
            VolumeLevelFeedback.OutputChange     += (o, a) => Debug.Console(1, this, "Volume={0}", _VolumeLevel);

            CurrentDirectoryResultIsNotDirectoryRoot = new BoolFeedback(() => DirectoryBrowseHistory.Count > 0);

            CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate();

            CodecOsdIn = new RoutingInputPort(RoutingPortNames.CodecOsd, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 0, this);
            InputPorts.Add(CodecOsdIn);
            HdmiIn1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 1, this);
            InputPorts.Add(HdmiIn1);
            HdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2, this);
            InputPorts.Add(HdmiIn2);
            HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null, this);
            OutputPorts.Add(HdmiOut);

            CallHistory = new CodecCallHistory();
            for (int i = 0; i < 10; i++)
            {
                var call = new CodecCallHistory.CallHistoryEntry();
                call.Name   = "Call " + i;
                call.Number = i + "@call.com";
                CallHistory.RecentCalls.Add(call);
            }
            // eventually fire history event here

            SetupCameras();

            SetIsReady();
        }
Exemple #25
0
        public CenOdtOccupancySensorBaseController(string key, string name, CenOdtCPoe sensor)
            : base(key, name, sensor)
        {
            OccSensor = sensor;

            RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);

            PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PassiveInfraredSensorEnabledFeedback.BoolValue);

            LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue);

            ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue);

            PirSensitivityInVacantStateFeedback = new IntFeedback(() => (int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback);

            PirSensitivityInOccupiedStateFeedback = new IntFeedback(() => (int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback);

            CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue);

            RemoteTimeoutFeedback = new IntFeedback(() => OccSensor.RemoteTimeout.UShortValue);

            GraceOccupancyDetectedFeedback = new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue);

            RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedFeedback.BoolValue);

            InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue);

            //ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ex.UShortValue);

            AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue);

            OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue);

            UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UltrasonicSensorSideAEnabledFeedback.BoolValue);

            UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UltrasonicSensorSideBEnabledFeedback.BoolValue);

            RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedByPassiveInfraredSensorFeedback.BoolValue);

            RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedByUltrasonicSensorFeedback.BoolValue);

            UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback);

            UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback);

            OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent);

            OccSensor.CenOccupancySensorChange += new GenericEventHandler(OccSensor_CenOccupancySensorChange);
        }
        public VideoCodecBase(DeviceConfig config)
            : base(config)
        {
            StandbyIsOnFeedback        = new BoolFeedback(StandbyIsOnFeedbackFunc);
            PrivacyModeIsOnFeedback    = new BoolFeedback(PrivacyModeIsOnFeedbackFunc);
            VolumeLevelFeedback        = new IntFeedback(VolumeLevelFeedbackFunc);
            MuteFeedback               = new BoolFeedback(MuteFeedbackFunc);
            SharingSourceFeedback      = new StringFeedback(SharingSourceFeedbackFunc);
            SharingContentIsOnFeedback = new BoolFeedback(SharingContentIsOnFeedbackFunc);

            InputPorts  = new RoutingPortCollection <RoutingInputPort>();
            OutputPorts = new RoutingPortCollection <RoutingOutputPort>();

            ActiveCalls = new List <CodecActiveCallItem>();
        }
        public EtcScene(EtcSceneConfig config, etc parent)
        {
            _Parent = parent;

            enabled   = config.enabled;
            sceneName = config.sceneName;
            space     = config.spaceName;
            fadeTime  = config.fadeTime;

            devPollTimer  = new CommandTimer();
            SceneFeedback = new BoolFeedback(() => _SceneFb);

            Debug.Console(2, "Scene name: {0}", config.sceneName);

            initialize();
        }
        void Init()
        {
            WarmupTime   = 10000;
            CooldownTime = 8000;

            CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 2000, 120000, 300000, StatusGet);
            DeviceManager.AddDevice(CommunicationMonitor);

            VolumeIncrementer = new ActionIncrementer(655, 0, 65535, 800, 80,
                                                      v => SetVolume((ushort)v),
                                                      () => _LastVolumeSent);

            AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                     eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this), 0x21);

            AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn1PC, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                     eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1PC), this), 0x22);

            AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                     eRoutingPortConnectionType.Hdmi, new Action(InputHdmi2), this), 0x23);

            AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn2PC, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                     eRoutingPortConnectionType.Hdmi, new Action(InputHdmi2PC), this), 0x24);

            AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                     eRoutingPortConnectionType.Hdmi, new Action(InputHdmi3), this), 0x32);

            AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.DisplayPortIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                     eRoutingPortConnectionType.DisplayPort, new Action(InputDisplayPort1), this), 0x25);

            AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.DviIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                     eRoutingPortConnectionType.Dvi, new Action(InputDvi1), this), 0x18);

            AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                     eRoutingPortConnectionType.Composite, new Action(InputVideo1), this), 0x08);

            AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.RgbIn1, eRoutingSignalType.Video,
                                                     eRoutingPortConnectionType.Vga, new Action(InputRgb1), this), 0x14);

            AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.RgbIn2, eRoutingSignalType.Video,
                                                     eRoutingPortConnectionType.Rgb, new Action(new Action(InputRgb2)), this), 0x1E);

            VolumeLevelFeedback = new IntFeedback(() => { return(_VolumeLevelForSig); });
            MuteFeedback        = new BoolFeedback(() => _IsMuted);

            StatusGet();
        }
Exemple #29
0
        public GlsOdtOccupancySensorController(string key, string name, GlsOdtCCn sensor)
            : base(key, name, sensor)
        {
            OccSensor = sensor;

            AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue);

            OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue);

            UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UsAEnabledFeedback.BoolValue);

            UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UsBEnabledFeedback.BoolValue);

            UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInVacantStateFeedback.UShortValue);

            UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue);
        }
        /// <summary>
        /// Initializes this attribute based on config values and generates subscriptions commands and adds commands to the parent's queue.
        /// </summary>
        public void Initialize(string key, string label, bool hasMute, bool hasLevel)
        {
            Key = string.Format("{0}--{1}", Parent.Key, key);

            DeviceManager.AddDevice(this);

            Debug.Console(2, this, "Adding LevelControl '{0}'", Key);

            this.IsSubscribed = false;

            MuteFeedback = new BoolFeedback(() => _IsMuted);

            VolumeLevelFeedback = new IntFeedback(() => _VolumeLevel);

            HasMute  = hasMute;
            HasLevel = hasLevel;
        }