예제 #1
0
        public CrestronConnectedDisplay(string name, uint ipId, CrestronControlSystem controlSystem)
        {
            Display            = new RoomViewConnectedDisplay(ipId, controlSystem);
            Display.BaseEvent += new BaseEventHandler(Display_BaseEvent);

            if (Display.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
            {
                ErrorLog.Error("Could not register CrestronConnectedDisplay with IP ID {0}", ipId.ToString("X2"));
            }

            this.Name = name;
        }
예제 #2
0
        /// <summary>
        /// Builds and returns an instance of CCDisplayDevice
        /// </summary>
        /// <param name="dc">device configuration</param>
        /// <returns>plugin device or null</returns>
        /// <remarks>
        /// The example provided below takes the device key, name, properties config and the comms device created.
        /// Modify the EssetnialsPlugingDeviceTemplate constructor as needed to meet the requirements of the plugin device.
        /// </remarks>
        /// <seealso cref="PepperDash.Core.eControlMethod"/>
        public override EssentialsDevice BuildDevice(DeviceConfig dc)
        {
            Debug.Console(1, "[{0}] Factory Attempting to create new device from type: {1}", dc.Key, dc.Type);

            // get the plugin device properties configuration object & check for null
            var propertiesConfig = dc.Properties.ToObject <RVCDisplayConfig>();

            if (propertiesConfig == null)
            {
                Debug.Console(0, "[{0}] Factory: failed to read properties config for {1}", dc.Key, dc.Name);
                return(null);
            }

            var display = new RoomViewConnectedDisplay(propertiesConfig.Control.IpIdInt, Global.ControlSystem);

            return(new RVCDisplayDevice(dc.Key, dc.Name, propertiesConfig, display));
        }
예제 #3
0
        public CrestronConnectedDisplay(uint ipId, CrestronControlSystem controlSystem, string name) : base(name)
        {
            _display = new RoomViewConnectedDisplay(ipId, controlSystem)
            {
                Description = name
            };

            _display.OnlineStatusChange += DisplayOnOnlineStatusChange;

            IpIdFactory.Block(ipId, IpIdFactory.DeviceType.Other);

            _display.BaseEvent += DisplayOnBaseEvent;
            var result = _display.Register();

            if (result != eDeviceRegistrationUnRegistrationResponse.Success)
            {
                CloudLog.Error("Error trying to register device {0} with Id {1}, {2}", _display.GetType().Name, ipId,
                               result);
            }
        }
예제 #4
0
        /// <summary>
        /// CCDDisplay Plugin device constructor for ISerialComport transport
        /// </summary>
        /// <param name="key"></param>
        /// <param name="name"></param>
        /// <param name="config"></param>
        /// <param name="display">Loaded and initialized instance of CCD Display driver instance</param>
        public RVCDisplayDevice(string key, string name, RVCDisplayConfig config, RoomViewConnectedDisplay display)
            : base(key, name)
        {
            Debug.Console(0, this, "Constructing new {0} instance", name);

            _config  = config;
            _display = display;

            StatusFeedback = new IntFeedback(() => (int)CommunicationMonitor.Status);
            Feedbacks.Add(StatusFeedback);

            VolumeLevelFeedback = new IntFeedback(() => { return((int)_display.VolumeFeedback.UShortValue); });
            MuteFeedback        = new BoolFeedback(() => _display.MuteOnFeedback.BoolValue);
            Feedbacks.Add(VolumeLevelFeedback);
            Feedbacks.Add(MuteFeedback);

            CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, _display, 12000, 30000);

            for (uint i = 1; i <= _display.SourceSelectFeedbackSigs.Count; i++)
            {
                string sourceName = "input" + i.ToString();
                /// CompactFramework fix for inline Actions and using iterator variables
                uint             sourceIndex = i;
                RoutingInputPort inputPort   = new RoutingInputPort(sourceName, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, new Action(() => _display.SourceSelectSigs[sourceIndex].BoolValue = true), this)
                {
                    FeedbackMatchObject = sourceIndex
                };
                _display.SourceSelectSigs[sourceIndex].UserObject = inputPort;
                InputPorts.Add(inputPort);
            }

            CrestronConsole.AddNewConsoleCommand((s) =>
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Driver Information:");
                sb.AppendFormat("\tDevice ID:        {0}\r\n", _display.DeviceIdStringFeedback.StringValue);
                sb.AppendFormat("\tFirmware:         {0}\r\n", _display.FirmwareVersionFeedback.StringValue);
                sb.AppendFormat("\tName:             {0}\r\n", _display.ProjectorNameFeedback.StringValue);
                sb.AppendFormat("\tDescription:      {0}\r\n", _display.Description);
                sb.AppendFormat("\tStatus:           {0}\r\n", _display.StatusMessageFeedback.StringValue);
                sb.AppendFormat("\tLamp:             {0}\r\n", _display.LampHoursFeedback.UShortValue);
                sb.AppendFormat("\tLamp (text):      {0}\r\n", _display.LampHoursTextFeedback.StringValue);

                CrestronConsole.ConsoleCommandResponse("{0}", sb.ToString());
            },
                                                 Key + "INFO", "Print Driver Info", ConsoleAccessLevelEnum.AccessOperator);

            CrestronConsole.AddNewConsoleCommand((s) =>
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("State:");
                sb.AppendFormat("\tName:             {0}\r\n", _display.Name);
                sb.AppendFormat("\tID:               {0}\r\n", _display.ID);
                sb.AppendFormat("\tOnline:           {0}\r\n", _display.IsOnline?"Online":"Offline");
                sb.AppendFormat("\tPower:            {0}\r\n", _display.PowerOnFeedback.BoolValue?"ON":"OFF");
                sb.AppendFormat("\tCooling:          {0}\r\n", _display.CoolingDownFeedback.BoolValue ? "ON" : "OFF");
                sb.AppendFormat("\tWarming:          {0}\r\n", _display.WarmingUpFeedback.BoolValue ? "ON" : "OFF");
                sb.AppendFormat("\tMute:             {0}\r\n", _display.MuteOnFeedback.BoolValue ? "ON" : "OFF");
                sb.AppendFormat("\tVolume:           {0}\r\n", _display.VolumeFeedback.UShortValue);
                sb.AppendFormat("\tLamp:             {0}\r\n", _display.LampHoursFeedback.UShortValue);

                CrestronConsole.ConsoleCommandResponse("{0}", sb.ToString());
            },
                                                 Key + "STATE", "Print display state", ConsoleAccessLevelEnum.AccessOperator);

            CrestronConsole.AddNewConsoleCommand((s) =>
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("Current Input:  {0}\r\n", _display.CurrentSourceFeedback.StringValue);
                sb.AppendFormat("Inputs:\r\n");
                for (uint i = 1; i <= _display.SourceSelectFeedbackSigs.Count; i++)
                {
                    string sourceName = _display.SourceNameTextFeedbackSigs[i].StringValue;
                    if (String.IsNullOrEmpty(sourceName) || String.IsNullOrEmpty(sourceName.Trim()))
                    {
                        break;
                    }
                    sb.AppendFormat("\t{0}: {1}\r\n", sourceName, _display.SourceSelectFeedbackSigs[i].BoolValue ? "ON" : "");
                }

                CrestronConsole.ConsoleCommandResponse(sb.ToString());
            },
                                                 Key + "INPUTS", "Display Driver Inputs", ConsoleAccessLevelEnum.AccessOperator);

            CrestronConsole.AddNewConsoleCommand((s) =>
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("Input Ports:\r\n");
                foreach (var inputPort in InputPorts)
                {
                    //uint sourceSelectIndex = _display.SourceSelectSigs.FirstOrDefault<BoolInputSig>(sig => sig.UserObject == inputPort).Number;
                    uint sourceSelectIndex = 0;
                    for (uint i = 1; i <= _display.SourceSelectSigs.Count; i++)
                    {
                        if (_display.SourceSelectSigs[i].UserObject == inputPort)
                        {
                            sourceSelectIndex = i;
                            break;
                        }
                    }
                    sb.AppendFormat("\t{0}: {1}\r\n", inputPort.Key, _display.SourceNameTextFeedbackSigs[sourceSelectIndex].StringValue);
                }

                CrestronConsole.ConsoleCommandResponse(sb.ToString());
            },
                                                 Key + "ROUTINGPORTS", "Display Driver Routing Ports", ConsoleAccessLevelEnum.AccessOperator);
        }