public TestDMRmc4KZ100C(DM_RMC_4KZ_100_C DM_RMC_4KZ_100_C) { _DM_RMC_4KZ_100_C = DM_RMC_4KZ_100_C; if (_DM_RMC_4KZ_100_C.C2I_DMRMC100_4KZ_IR2 != null) { _IROutputPort = _DM_RMC_4KZ_100_C.C2I_DMRMC100_4KZ_IR2; StartIRTest(); } if (_DM_RMC_4KZ_100_C.Com01 != null) { _ComPort = _DM_RMC_4KZ_100_C.Com01; StartComPortTest(); } if (_DM_RMC_4KZ_100_C.CEC_DM_In != null) { _CECDMDevice = _DM_RMC_4KZ_100_C.CEC_DM_In; StartCECDMTest(); } if (_DM_RMC_4KZ_100_C.CEC_HDMI_Out != null) { _CECHDCPDevice = _DM_RMC_4KZ_100_C.CEC_HDMI_Out; StartCECHDMITest(); } if (_DM_RMC_4KZ_100_C.HDCP_HDMI_Out != null) { _HDMIOutputHDCP = _DM_RMC_4KZ_100_C.HDCP_HDMI_Out; StartHDCPTest(); } }
public ILiveMovie(CrestronControlSystem system) { this.controlSystem = system; this.comLight = new ILiveComPort(this.controlSystem.ComPorts[1]); this.comLight.Register(); this.comProjector = new ILiveComPort(this.controlSystem.ComPorts[2]); this.comProjector.Register(); this.relayPower = this.controlSystem.RelayPorts[1]; this.relayGolf = this.controlSystem.RelayPorts[2]; this.irTV = this.controlSystem.IROutputPorts[1]; this.irAV = this.controlSystem.IROutputPorts[2]; this.irBlueray = this.controlSystem.IROutputPorts[3]; this.irTV.LoadIRDriver(""); isin6 = new ILiveIsinRelay(comLight); this.tpc5 = new ILiveTPC5(comLight); // port = new UDPClient("192.168.188.22", 6004, 8004); // port.NetDataReceived += new NetDataReceivedEventHandler(port_NetDataReceived); // port.Connect(); // bigvivitek = new ILiveVivitek(port); }
/// <summary> /// Send bytes to IR serial port to prevent issues with encoding of non ascii strings /// </summary> /// <param name="port">IROutputPort to extend</param> /// <param name="bytes">Byte array to send</param> /// <param name="count">Count ot bytes from array</param> public static void SendSerialData(this IROutputPort port, byte[] bytes, int count) { var str = string.Empty; for (var i = 0; i < count; i++) { str = str + (char)bytes[i]; } port.SendSerialData(str); }
public SamsungMDCDisplayOneWaySerial(string name, int displayID, IROutputPort irPort) { this.Name = name; this.DisplayID = displayID; IRPort = irPort; IRPort.SetIRSerialSpec(eIRSerialBaudRates.ComspecBaudRate9600, eIRSerialDataBits.ComspecDataBits8, eIRSerialParityType.ComspecParityNone, eIRSerialStopBits.ComspecStopBits1, Encoding.ASCII); }
public DM_RMC_4K_100_C_1G(ICardInputOutputType SwitcherOutput) { DMOutput _DMOutput = SwitcherOutput as DMOutput; _DmRmc4K100C1G = new DmRmc4K100C1G(_DMOutput); IR = _DmRmc4K100C1G.IROutputPorts[1]; Com01 = new RS232OnlyTwoWaySerialDriver(_DmRmc4K100C1G.ComPorts[1]); HDMI_Out = new CECDevice(_DmRmc4K100C1G.StreamCec); Name = _DmRmc4K100C1G.Name; }
public void PrintIRDeviceFunctions(IROutputPort myIR) { foreach (String s in myIR.AvailableStandardIRCmds()) { CrestronConsole.PrintLine("AppleTV Std: {0}", s); } foreach (String s in myIR.AvailableIRCmds()) { CrestronConsole.PrintLine("AppleTV Available: {0}", s); } }
public DM_RMC_4KZ_100_C(ICardInputOutputType SwitcherOutput) { DMOutput _DMOutput = SwitcherOutput as DMOutput; _DmRmc4kz100C = new DmRmc4kz100C(_DMOutput); C2I_DMRMC100_4KZ_IR2 = _DmRmc4kz100C.IROutputPorts[1]; Com01 = new DMPS3TwoWaySerialDriver(_DmRmc4kz100C.ComPorts[1]); CEC_DM_In = new CECDevice(_DmRmc4kz100C.DmInputStreamCec); CEC_HDMI_Out = new CECDevice(_DmRmc4kz100C.HdmiOutput.StreamCec); HDCP_HDMI_Out = new HDMIOutputHDCP(_DmRmc4kz100C.HdmiOutput); }
//constructor public ControlSystem() : base() { string DeviceType = this.ControllerPrompt; if (DeviceType != "CP3" && DeviceType != "CP3N") { ErrorLog.Error("This program is for a CP3 or CP3N Control System"); ErrorLog.Error("Terminating Execution"); throw new NotSupportedException(); } try { #region Onboard Devices //CP3 onboard devices //Slot-02.Slot2.1 Ethernet_Information = AdapterInformation.GetAdapterInformation(); //Slot-03.Slot-01 Com01 = new TwoWaySerialDriver(this.ComPorts[1]); //Slot-03.Slot-02 Com02 = new RS232OnlyTwoWaySerialDriver(this.ComPorts[2]); //Slot-03.Slot-03 Com03 = new RS232OnlyTwoWaySerialDriver(this.ComPorts[3]); //Slot-04 C2I_CP3_IO8 = IOs8AnalogInputCard.GetIO8AnalogInputCard(VersiPorts); //Slot-05 C2I_CP3_RY8 = Relays8Card.GetRelay8Card(RelayPorts); //Slot-06 Port-01 IR1 = this.IROutputPorts[1]; //Slot-06 Port-02 IR2 = this.IROutputPorts[2]; //Slot-07 C2I_CP3_SYSTEMMONITOR = System_Monitor.GetSystemMonitor(); //Slot-07.Slot-01 C2I_CP3_SYSTEMCONTROL = System_Control.GetSystemControl(); //Slot-7.Slot-02 C2I_CP3_SYSTEMINFORMATION = System_Information.GetSystemInformation(); //Slot-10.Slot-01 C2I_USB_HID = new USBPort(UsbHids[1]); #endregion //Single Port examples: //IOPort8 = new IOPort(VersiPorts[8]); //Relay8 = new SingleRelay(RelayPorts[8]); Thread.MaxNumberOfUserThreads = 20; } catch (Exception e) { ErrorLog.Error("Error in the constructor: {0}", e.Message); } }
/// <summary> /// Constructor for IrDevice base class. If a null port is provided, this class will /// still function without trying to talk to a port. /// </summary> public IrOutputPortController(string key, IROutputPort port, string irDriverFilepath) : base(key) { //if (port == null) throw new ArgumentNullException("port"); IrPort = port; if (port == null) { Debug.Console(0, this, "WARNING No valid IR Port assigned to controller. IR will not function"); return; } LoadDriver(irDriverFilepath); }
public ILiveORMA(IROutputPort smart) { this.irORMA51 = smart;//书房空调 string file = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory() + "\\IR\\OMAR51.ir"; try { uint i = irORMA51.LoadIRDriver(file); // ILiveDebug.WriteLine("dirver"+i); } catch (Exception ex) { ILiveDebug.Instance.WriteLine(ex.Message); } }
public MovieAPI(CP3Smart smartexe) { this.relayBedRoomScreenUp = smartexe.relayBedRoomScreenUp; this.relayBedRoomScreenDown = smartexe.relayBedRoomScreenDown; this.irBedRoom = smartexe.myIROutputPort2; try { irBedRoom.LoadIRDriver(Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory() + "\\IR\\OnkyoRecv.ir"); irBedRoom.LoadIRDriver(Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory() + "\\IR\\LG.ir"); } catch (Exception ex) { ILiveDebug.Instance.WriteLine(ex.Message); } }
public static void Start(IROutputPort IROutputPort) { if (IROutputPort == null) { return; } _IROutputPort = IROutputPort; _IROutputPort.SetIRSerialSpec(eIRSerialBaudRates.ComspecBaudRate9600, eIRSerialDataBits.ComspecDataBits8, eIRSerialParityType.ComspecParityNone, eIRSerialStopBits.ComspecStopBits1, Encoding.ASCII); CrestronConsole.AddNewConsoleCommand(SendIRSerial, "TSendIRSerial", "Sends Serial Hello ", ConsoleAccessLevelEnum.AccessOperator); }
public ClinateAPI(CP3Smart smart) { this.irStudyRoom = smart.myIROutputPort5; //书房空调 this.irLiving = smart.myIROutputPort6; //客厅空调 string file = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory() + "\\IR\\songxia.ir"; // ILiveDebug.WriteLine(file); try { uint i = irStudyRoom.LoadIRDriver(file); uint j = irLiving.LoadIRDriver(file); // ILiveDebug.WriteLine("dirver"+i); } catch (Exception ex) { ILiveDebug.Instance.WriteLine(ex.Message); } }
public static void Start(IROutputPort IROutputPort) { if (IROutputPort == null) { return; } _IROutputPort = IROutputPort; string AcerIRFileName = string.Format("{0}\\IRFiles\\ACER WIL-8458MA.ir", Directory.GetApplicationDirectory()); AcerIRFileId = LoadIRDiver(AcerIRFileName); string AdcomIRFileName = string.Format("{0}\\IRFiles\\adcom_gdd_1.ir", Directory.GetApplicationDirectory()); AdcomIRFileId = LoadIRDiver(AdcomIRFileName); CrestronConsole.AddNewConsoleCommand(SendAcerCommand, "TSendAcerIR", "Sends Acer Left Click Command ", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(SendAdcomCommand, "TSendAdcomIR", "Sends Acer Left Click Command ", ConsoleAccessLevelEnum.AccessOperator); }
public TestDMTx4K100C1G(DM_TX_4K_100_C_1G DM_TX_4K_100_C_1G) { _DM_TX_4K_100_C_1G = DM_TX_4K_100_C_1G; if (_DM_TX_4K_100_C_1G.IR != null) { _IROutputPort = _DM_TX_4K_100_C_1G.IR; StartIRTest(); } if (_DM_TX_4K_100_C_1G.Com01 != null) { _ComPort = _DM_TX_4K_100_C_1G.Com01; StartComPortTest(); } if (_DM_TX_4K_100_C_1G.HDMI_In != null) { _CECDevice = _DM_TX_4K_100_C_1G.HDMI_In; StartCECTest(); } }
public void PressUp_Pressed(uint i) { if (GV.MyControlSystem.SupportsVersiport && GV.MyControlSystem.NumberOfVersiPorts >= i) { Versiport myVersiport = GV.MyControlSystem.VersiPorts[i]; myVersiport.DigitalOut = true; } if (GV.MyControlSystem.SupportsIROut && GV.MyControlSystem.NumberOfIROutputPorts >= 1) { IROutputPort myIRPort = GV.MyControlSystem.IROutputPorts[1]; myIRPort.Press("UP_ARROW"); } if (GV.MyControlSystem.SupportsComPort && GV.MyControlSystem.NumberOfComPorts >= i) { ComPort myComPort = GV.MyControlSystem.ComPorts[i]; myComPort.Send("Test transmition, please ignore"); } }
public TestDMRmc4KZ100C1G(DM_RMC_4K_100_C_1G DM_RMC_4KZ_100_C_1G) { _DM_RMC_4KZ_100_C_1G = DM_RMC_4KZ_100_C_1G; if (_DM_RMC_4KZ_100_C_1G.IR != null) { _IROutputPort = _DM_RMC_4KZ_100_C_1G.IR; StartIRTest(); } if (_DM_RMC_4KZ_100_C_1G.Com01 != null) { _ComPort = _DM_RMC_4KZ_100_C_1G.Com01; StartComPortTest(); } if (_DM_RMC_4KZ_100_C_1G.HDMI_Out != null) { _CECDevice = _DM_RMC_4KZ_100_C_1G.HDMI_Out; StartCECTest(); } }
public void PressUp_Released(uint i) { if (GV.MyControlSystem.SupportsVersiport && GV.MyControlSystem.NumberOfVersiPorts >= i) { Versiport myVersiport = GV.MyControlSystem.VersiPorts[i]; myVersiport.DigitalOut = false; } if (GV.MyControlSystem.SupportsIROut && GV.MyControlSystem.NumberOfIROutputPorts >= 1) { IROutputPort myIRPort = GV.MyControlSystem.IROutputPorts[1]; myIRPort.Release(); } if (GV.MyControlSystem.SupportsComPort && GV.MyControlSystem.NumberOfComPorts >= i) { ComPort myComPort = GV.MyControlSystem.ComPorts[i]; myComPort.Send(" "); } }
public void PressDn_Pressed(uint i) { if (GV.MyControlSystem.SupportsVersiport && GV.MyControlSystem.NumberOfVersiPorts >= i) { Versiport myVersiport = GV.MyControlSystem.VersiPorts[i]; myVersiport.DigitalOut = true; } if (GV.MyControlSystem.SupportsIROut && GV.MyControlSystem.NumberOfIROutputPorts >= 1) { IROutputPort myIRPort = GV.MyControlSystem.IROutputPorts[1]; myIRPort.Press("DN_ARROW"); } if (GV.MyControlSystem.SupportsComPort && GV.MyControlSystem.NumberOfComPorts >= i) { ComPort myComPort = GV.MyControlSystem.ComPorts[i]; myComPort.Send("\n"); } }
public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath) : base(key, name) { IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath); DeviceManager.AddDevice(IrPort); PowerIsOnFeedback.OutputChange += (o, a) => { Debug.Console(2, this, "Power on={0}", _PowerIsOn); if (_PowerIsOn) { StartWarmingTimer(); } else { StartCoolingTimer(); } }; IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp); IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown); InputPorts.AddRange(new RoutingPortCollection <RoutingInputPort> { new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false), new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false), new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false), new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false), new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false), new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false), new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false), }); }
public AppleTV(IROutputPort irPort) { _irPort = irPort; if (!File.Exists(IRFilePath)) { Debug.WriteWarn("Apple TV IR File not found. Looking for file in resources..."); var assembly = Assembly.GetExecutingAssembly(); var stream = assembly.GetManifestResourceStream(GetType().GetCType(), @"Apple_AppleTV_3rd_Generation.ir"); using (var fileStream = File.Create(IRFilePath)) { var buffer = new byte[8 * 1024]; int len; while ((len = stream.Read(buffer, 0, buffer.Length)) > 0) { fileStream.Write(buffer, 0, len); } fileStream.Close(); } Debug.WriteSuccess("Apple TV IR file saved to", IRFilePath); } var irDriverId = _irPort.LoadIRDriver(IRFilePath); #if DEBUG CrestronConsole.PrintLine("Created Apple TV source control using IR port {0}", _irPort.ID); CrestronConsole.PrintLine("Following IR Commands are available:"); uint count = 0; foreach (var irCommandName in _irPort.AvailableIRCmds(irDriverId)) { CrestronConsole.PrintLine(" - {0} [{1}]", irCommandName, count); count++; } #endif }
/// <summary> /// Constructor of the Control System Class. Make sure the constructor always exists. /// If it doesn't exit, the code will not run on your 3-Series processor. /// </summary> public ControlSystem() : base() { CrestronConsole.PrintLine("Hello World - Program SIMPL#Pro LinckATLSIMPLSharpPro started ..."); // Set the number of threads which you want to use in your program - At this point the threads cannot be created but we should // define the max number of threads which we will use in the system. // the right number depends on your project; do not make this number unnecessarily large try { Thread.MaxNumberOfUserThreads = 20; //Subscribe to the controller events (System, Program, and Etherent) CrestronEnvironment.SystemEventHandler += new SystemEventHandler(ControlSystem_ControllerSystemEventHandler); CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(ControlSystem_ControllerProgramEventHandler); CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(ControlSystem_ControllerEthernetEventHandler); CrestronConsole.AddNewConsoleCommand(UpperCase, "ToUpper", "Replies to strings un Upper case", ConsoleAccessLevelEnum.AccessOperator); var returnVar = CrestronCresnetHelper.Query(); if (returnVar == CrestronCresnetHelper.eCresnetDiscoveryReturnValues.Success) { foreach (var item in CrestronCresnetHelper.DiscoveredElementsList) { CrestronConsole.PrintLine("Found Item: {0}, {1}", item.CresnetId, item.DeviceModel); } } } catch (Exception e) { ErrorLog.Error("Error in constructor: {0}", e.Message); } // Reghister Keypad if (this.SupportsCresnet) { myKeypad = new C2nCbdP(0x25, this); myKeypad.ButtonStateChange += new ButtonEventHandler(myKeypad_ButtonStateChange); if (myKeypad.Register() != eDeviceRegistrationUnRegistrationResponse.Success) ErrorLog.Error("myKeypad failed registration. Cause: {0}", myKeypad.RegistrationFailureReason); } // Register all devices which the program wants to use // Check if device supports Ethernet if (this.SupportsEthernet) { myXpanel = new XpanelForSmartGraphics(0xA5, this); // Register the Xpanel on IPID 0xA5 // Register a single eventhandler for all three UIs. This guarantees that they all operate // the same way. myXpanel.SigChange += new SigEventHandler(MySigChangeHandler); // Register the devices for usage. This should happen after the // eventhandler registration, to ensure no data is missed. if (myXpanel.Register() != eDeviceRegistrationUnRegistrationResponse.Success) ErrorLog.Error("MyXpanel failed registration. Cause: {0}", myXpanel.RegistrationFailureReason); } // Load IR DriverC:\Users\paul\Documents\GitHubWin10\SIMPLSharp\LinckATLSIMPLSharpPro\LinckATLSIMPLSharpPro\Properties\ControlSystem.cfg myIROutputDevice = IROutputPorts[1]; myIROutputDevice.LoadIRDriver(String.Format(@"{0}\IR\Samsung_LNS4051.ir", Directory.GetApplicationDirectory())); return; }
public void RegisterDevices() { #region 注册串口 if (this.controlSystem.SupportsComPort) { comSMS = this.controlSystem.ComPorts[3]; //comSMS.SerialDataReceived += new ComPortDataReceivedEvent(comSMS_SerialDataReceived); if (comSMS.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("COM Port couldn't be registered. Cause: {0}", comSMS.DeviceRegistrationFailureReason); } if (comSMS.Registered) { comSMS.SetComPortSpec(ComPort.eComBaudRates.ComspecBaudRate9600, ComPort.eComDataBits.ComspecDataBits8, ComPort.eComParityType.ComspecParityNone, ComPort.eComStopBits.ComspecStopBits1, ComPort.eComProtocolType.ComspecProtocolRS232, ComPort.eComHardwareHandshakeType.ComspecHardwareHandshakeNone, ComPort.eComSoftwareHandshakeType.ComspecSoftwareHandshakeNone, false); } } #endregion #region 注册红外 if (this.controlSystem.SupportsIROut) { this.myIROutputPort1 = this.controlSystem.IROutputPorts[1]; this.myIROutputPort2 = this.controlSystem.IROutputPorts[2]; this.myIROutputPort3 = this.controlSystem.IROutputPorts[3]; this.myIROutputPort4 = this.controlSystem.IROutputPorts[4]; this.myIROutputPort5 = this.controlSystem.IROutputPorts[5]; this.myIROutputPort6 = this.controlSystem.IROutputPorts[6]; this.myIROutputPort7 = this.controlSystem.IROutputPorts[7]; this.myIROutputPort8 = this.controlSystem.IROutputPorts[8]; } #endregion #region 注册继电器 relayBedRoomScreenUp = this.controlSystem.RelayPorts[1]; relayBedRoomScreenUp.StateChange += new RelayEventHandler(relayBedRoomScreenUp_StateChange); if (relayBedRoomScreenUp.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Relay Port couldn't be registered. Cause: {0}", relayBedRoomScreenUp.DeviceRegistrationFailureReason); } relayBedRoomScreenDown = this.controlSystem.RelayPorts[2]; relayBedRoomScreenDown.StateChange += new RelayEventHandler(relayBedRoomScreenDown_StateChange); if (relayBedRoomScreenDown.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Relay Port couldn't be registered. Cause: {0}", relayBedRoomScreenDown.DeviceRegistrationFailureReason); } relayStudyRoomDoor = this.controlSystem.RelayPorts[3]; relayStudyRoomDoor.StateChange += new RelayEventHandler(relayStudyRoomDoor_StateChange); if (relayStudyRoomDoor.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Relay Port couldn't be registered. Cause: {0}", relayStudyRoomDoor.DeviceRegistrationFailureReason); } #endregion }
public ControlSystem() : base() { TestControlSystemType.isDMPS4K150C(this, "This program is for a DMPS4K150 Control System"); try { Thread.MaxNumberOfUserThreads = 20; #region Assigning SIMPL like classes //This clases are created to mimic the modules find in SIMPL //Slot-01 Com01 = new DMPS3TwoWaySerialDriver(this.ComPorts[1]); //Slot-02 IRIn1 = this.IROutputPorts[1]; //Slot-03 Digtal_Inputs = DigitalInputs2Card.GetSlot2DigitalInputs(this.DigitalInputPorts); //Slot-04 Relays = Relays2Card.GetRelay2Card(this.RelayPorts); //Slot-07.Slot01 Ethernet_Information = AdapterInformation.GetAdapterInformation(); //Slot-08.Slot-01 DeviceControl = DMPS4K150C_DeviceControl.GetDMPS4K150C_DeviceControl(this); //Slot-08.Slot-02 AVControl = DMPS4K150C_AVControl.GetDMPS4K150C_AVControl(this); //Slot-08.Slot-02.Slot-01.Slot-01 Mic1 = DMPS4K150C_Mic1.GetDMPS4K150C_Mic(this); //Slot-08.Slot-02.Slot-02.Slot-01 VGA1 = DMPS4K150C_VGA_Input.GetVGAInput(this, eDmps34K150CInputs.Vga1); //Slot-08.Slot-02.Slot-02.Slot-02 VGA2 = DMPS4K150C_VGA_Input.GetVGAInput(this, eDmps34K150CInputs.Vga2); //Slot-08.Slot-02.Slot-02.Slot-03 VGA3 = DMPS4K150C_VGA_Input.GetVGAInput(this, eDmps34K150CInputs.Vga3); //Slot-08.Slot-02.Slot-02.Slot-04 VGA4 = DMPS4K150C_VGA_Input.GetVGAInput(this, eDmps34K150CInputs.Vga4); //Slot-08.Slot-02.Slot-02.Slot-05 HDMI1 = DMPS4K150C_HDMI_Input.GetHDMIInput(this, eDmps34K150CInputs.Hdmi1); //Slot-08.Slot-02.Slot-02.Slot-06 HDMI2 = DMPS4K150C_HDMI_Input.GetHDMIInput(this, eDmps34K150CInputs.Hdmi2); //Slot-08.Slot-02.Slot-02.Slot-07 HDMI3 = DMPS4K150C_HDMI_Input.GetHDMIInput(this, eDmps34K150CInputs.Hdmi3); //Slot-08.Slot-02.Slot-02.Slot-08 HDMI4 = DMPS4K150C_HDMI_Input.GetHDMIInput(this, eDmps34K150CInputs.Hdmi4); //Slot-08.Slot-02.Slot-02.Slot-09 DM1 = DMPS4K150C_DM_Input.GetDMInput(this, eDmps34K150CInputs.Dm1); //Slot-08.Slot-02.Slot-02.Slot-10 DM2 = DMPS4K150C_DM_Input.GetDMInput(this, eDmps34K150CInputs.Dm2); //Slot-08.Slot-02.Slot-03.Slot-01 AnalogAudioOutput = DMPS4K150C_AnalogAudioOutput.GetDMPS4K150C_Mic(this); //Slot-08.Slot-02.Slot-03.Slot-02 DM1Out = DMPS4K150C_DM_Output.GetDMOutput(this, eDmps34K150COutputs.DmHdmiAnalogOutput); //Slot-09.Slot-01 TT_1XX = new ConnectItDevice(new Tt1xx(this, 1)); //Slot-11.Slot-01 C2I_USB_HID1 = new USBPort(this.UsbHids[1]); //Slot-11.Slot-02 C2I_USB_HID2 = new USBPort(this.UsbHids[2]); //Slot-11.Slot-03 C2I_USB_HID3 = new USBPort(this.UsbHids[3]); //Slot-11.Slot-04 C2I_USB_HID4 = new USBPort(this.UsbHids[4]); //Slot-12 System_Monitor = System_Monitor.GetSystemMonitor(); //Slot-12.Slot-01 System_Control = System_Control.GetSystemControl(); //Slot-12.Slot-02 SystemInformation = System_Information.GetSystemInformation(); #endregion #region Enpoints var DMTransmitter1 = this.SwitcherInputs[(uint)eDmps34K150CInputs.Dm1] as DMInput; Transmitter1 = new DM_TX_4K_100_C_1G(DMTransmitter1); var DMReciver = this.SwitcherOutputs[(uint)eDmps34K150COutputs.DmHdmiAnalogOutput] as DMOutput; Receiver1 = new DM_RMC_4K_100_C_1G(DMReciver); #endregion } catch (Exception e) { ErrorLog.Error("Error in the constructor: {0}", e.Message); } }
private Thread rxHandler; // thread for com port public ControlSystem() : base() { try { GV.MyControlSystem = this; // To Access ControlSystem (this) outside of ControlSystem Classs Thread.MaxNumberOfUserThreads = 20; //Subscribe to the controller events (System, Program, and Ethernet) CrestronEnvironment.SystemEventHandler += new SystemEventHandler(ControlSystem_ControllerSystemEventHandler); CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(ControlSystem_ControllerProgramEventHandler); CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(ControlSystem_ControllerEthernetEventHandler); #region Keypad if (this.SupportsCresnet) { myKeypad = new C2nCbdP(0x25, this); myKeypad.ButtonStateChange += new ButtonEventHandler(myKeypad_ButtonStateChange); if (myKeypad.NumberOfVersiPorts > 0) { for (uint i = 1; i <= myKeypad.NumberOfVersiPorts; i++) { myKeypad.VersiPorts[i].SetVersiportConfiguration(eVersiportConfiguration.DigitalInput); myKeypad.VersiPorts[i].VersiportChange += new VersiportEventHandler(ControlSystem_VersiportChange); } } if (myKeypad.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("myKeypad failed registration. Cause: {0}", myKeypad.RegistrationFailureReason); myKeypad.ButtonStateChange -= new ButtonEventHandler(myKeypad_ButtonStateChange); } else { myKeypad.Button[1].Name = eButtonName.Up; myKeypad.Button[2].Name = eButtonName.Down; } // List all the cresnet devices - note: Query might not work for duplicate devices PllHelperClass.DisplayCresnetDevices(); } #endregion #region IR CrestronConsole.PrintLine("IR Check"); if (this.SupportsIROut) { CrestronConsole.PrintLine("if this.SupportsIROut"); if (ControllerIROutputSlot.Register() != eDeviceRegistrationUnRegistrationResponse.Success) ErrorLog.Error("Error Registering IR Slot {0}", ControllerIROutputSlot.DeviceRegistrationFailureReason); else { // IROutputPorts[1].LoadIRDriver(String.Format(@"{0}\IR\AppleTV.ir", Directory.GetApplicationDirectory())); IROutputPorts[1].LoadIRDriver(@"\NVRAM\AppleTV.ir"); foreach (String s in IROutputPorts[1].AvailableStandardIRCmds()) { CrestronConsole.PrintLine("AppleTV Std: {0}", s); } foreach (String s in IROutputPorts[1].AvailableIRCmds()) { CrestronConsole.PrintLine("AppleTV Available: {0}", s); } myIRPort1 = IROutputPorts[1]; } } #endregion #region Versiports CrestronConsole.PrintLine("IR Check"); if (this.SupportsVersiport) { CrestronConsole.PrintLine("if this.SupportsVersiport"); for (uint i = 1; i <= 2; i++) { if (this.VersiPorts[i].Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Error Registering Versiport {0}", this.VersiPorts[i].DeviceRegistrationFailureReason); } else this.VersiPorts[i].SetVersiportConfiguration(eVersiportConfiguration.DigitalOutput); } } #endregion #region ComPorts if (this.SupportsComPort) { for (uint i = 1; i <= 2; i++) { this.ComPorts[i].SerialDataReceived += new ComPortDataReceivedEvent(ControlSystem_SerialDataReceived); if (this.ComPorts[i].Register() != eDeviceRegistrationUnRegistrationResponse.Success) ErrorLog.Error("Error registering omport {0}", this.ComPorts[i].DeviceRegistrationFailureReason); else { this.ComPorts[i].SetComPortSpec(ComPort.eComBaudRates.ComspecBaudRate19200, ComPort.eComDataBits.ComspecDataBits8, ComPort.eComParityType.ComspecParityNone, ComPort.eComStopBits.ComspecStopBits1, ComPort.eComProtocolType.ComspecProtocolRS232, ComPort.eComHardwareHandshakeType.ComspecHardwareHandshakeNone, ComPort.eComSoftwareHandshakeType.ComspecSoftwareHandshakeNone, false); } } } #endregion } catch (Exception e) { ErrorLog.Error("Error in the constructor: {0}", e.Message); } }
public void BReadFile(Button btn) { IROutputPort myIR = GV.MyControlSystem.IROutputPorts[1]; ReadFile(); }
/// <summary> /// Constructor of the Control System Class. Make sure the constructor always exists. /// If it doesn't exit, the code will not run on your 3-Series processor. /// </summary> public ControlSystem() : base() { CrestronConsole.PrintLine("Hello World - Program SIMPL#Pro LinckATLSIMPLSharpPro started ..."); // Set the number of threads which you want to use in your program - At this point the threads cannot be created but we should // define the max number of threads which we will use in the system. // the right number depends on your project; do not make this number unnecessarily large try { Thread.MaxNumberOfUserThreads = 20; //Subscribe to the controller events (System, Program, and Etherent) CrestronEnvironment.SystemEventHandler += new SystemEventHandler(ControlSystem_ControllerSystemEventHandler); CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(ControlSystem_ControllerProgramEventHandler); CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(ControlSystem_ControllerEthernetEventHandler); CrestronConsole.AddNewConsoleCommand(UpperCase, "ToUpper", "Replies to strings un Upper case", ConsoleAccessLevelEnum.AccessOperator); var returnVar = CrestronCresnetHelper.Query(); if (returnVar == CrestronCresnetHelper.eCresnetDiscoveryReturnValues.Success) { foreach (var item in CrestronCresnetHelper.DiscoveredElementsList) { CrestronConsole.PrintLine("Found Item: {0}, {1}", item.CresnetId, item.DeviceModel); } } } catch (Exception e) { ErrorLog.Error("Error in constructor: {0}", e.Message); } // Reghister Keypad if (this.SupportsCresnet) { myKeypad = new C2nCbdP(0x25, this); myKeypad.ButtonStateChange += new ButtonEventHandler(myKeypad_ButtonStateChange); if (myKeypad.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("myKeypad failed registration. Cause: {0}", myKeypad.RegistrationFailureReason); } } // Register all devices which the program wants to use // Check if device supports Ethernet if (this.SupportsEthernet) { myXpanel = new XpanelForSmartGraphics(0xA5, this); // Register the Xpanel on IPID 0xA5 // Register a single eventhandler for all three UIs. This guarantees that they all operate // the same way. myXpanel.SigChange += new SigEventHandler(MySigChangeHandler); // Register the devices for usage. This should happen after the // eventhandler registration, to ensure no data is missed. if (myXpanel.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("MyXpanel failed registration. Cause: {0}", myXpanel.RegistrationFailureReason); } } // Load IR DriverC:\Users\paul\Documents\GitHubWin10\SIMPLSharp\LinckATLSIMPLSharpPro\LinckATLSIMPLSharpPro\Properties\ControlSystem.cfg myIROutputDevice = IROutputPorts[1]; myIROutputDevice.LoadIRDriver(String.Format(@"{0}\IR\Samsung_LNS4051.ir", Directory.GetApplicationDirectory())); return; }
public MusicPlayer(IROutputPort port) { this.port = port; }
public ControlSystem() : base() { try { Thread.MaxNumberOfUserThreads = 20; //Hello World Crestron Console CrestronConsole.AddNewConsoleCommand(HelloPrinting, "HelloWorld", "Prints Hello & the text that follows", ConsoleAccessLevelEnum.AccessOperator); //Subscribe to the controller events (System, Program, and Ethernet) CrestronEnvironment.SystemEventHandler += new SystemEventHandler(ControlSystem_ControllerSystemEventHandler); CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(ControlSystem_ControllerProgramEventHandler); CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(ControlSystem_ControllerEthernetEventHandler); CrestronConsole.PrintLine("DefaultConstructor Complete"); //Hello World #region Keypad if (this.SupportsCresnet) //Make sure the system has CresNet { myKeypad = new C2nCbdP(0x25, this); myKeypad.ButtonStateChange += new ButtonEventHandler(myKeypad_ButtonStateChange); if (myKeypad.NumberOfVersiPorts > 0) //VersiPort addtion { for (uint i = 1; i < 2; i++) { myKeypad.VersiPorts[i].SetVersiportConfiguration(eVersiportConfiguration.DigitalInput); myKeypad.VersiPorts[i].VersiportChange += new VersiportEventHandler(ControlSystem_VersiportChange); } } if (myKeypad.Register() != eDeviceRegistrationUnRegistrationResponse.Success) // Hello World Keypad { ErrorLog.Error("Error Registering Keypad on ID 0x25: {0}", myKeypad.RegistrationFailureReason); } else { myKeypad.Button[1].Name = eButtonName.Up; myKeypad.Button[2].Name = eButtonName.Down; } } #endregion #region KeypadWithQuery //Define Keypad with Device Query if (this.SupportsCresnet) { var QueryResponse = CrestronCresnetHelper.Query(); if (QueryResponse == CrestronCresnetHelper.eCresnetDiscoveryReturnValues.Success) { //foreach (CrestronCresnetHelper.DiscoveredDeviceElement Item in CrestronCresnetHelper.DiscoveredElementsList) //Gets a little long so we do the var in instead and it works it out foreach (var Item in CrestronCresnetHelper.DiscoveredElementsList) { if (Item.DeviceModel.ToUpper().Contains("C2N-CBD")) { if (myKeypad == null) //Check to make sure we have not done created it already. { myKeypad = new C2nCbdP(Item.CresnetId, this); myKeypad.ButtonStateChange += new ButtonEventHandler(myKeypad_ButtonStateChange); if (myKeypad.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Error Registering Keypad: {0}", myKeypad.RegistrationFailureReason); myKeypad = null; } } } } } } #endregion #region IR if (this.SupportsIROut) { if (ControllerIROutputSlot.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Error Registering IR Slot: {0}", ControllerIROutputSlot.DeviceRegistrationFailureReason); } else { myPort = IROutputPorts[1]; myPort.LoadIRDriver(@"\NVRAM\AppleTV.ir"); foreach (string s in myPort.AvailableStandardIRCmds()) { CrestronConsole.PrintLine("AppleTV Std: {0}", s); } foreach (string s in myPort.AvailableIRCmds()) { CrestronConsole.PrintLine("AppleTV Std: {0}", s); } } } #endregion #region VersiPort if (this.SupportsVersiport) { for (uint i = 1; i <= 2; i++) { if (this.VersiPorts[i].Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Error Registering Versiport 1: {0}", this.VersiPorts[i].DeviceRegistrationFailureReason); } else { this.VersiPorts[i].SetVersiportConfiguration(eVersiportConfiguration.DigitalOutput); } } } #endregion #region ComPorts if (this.SupportsComPort) { for (uint i = 1; i <= 2; i++) { this.ComPorts[i].SerialDataReceived += new ComPortDataReceivedEvent(ControlSystem_SerialDataReceived); if (this.ComPorts[i].Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Error Registering ComPort{0}: {1}", i, ComPorts[i].DeviceRegistrationFailureReason); } else { this.ComPorts[i].SetComPortSpec(ComPort.eComBaudRates.ComspecBaudRate19200, ComPort.eComDataBits.ComspecDataBits8, ComPort.eComParityType.ComspecParityNone, ComPort.eComStopBits.ComspecStopBits1, ComPort.eComProtocolType.ComspecProtocolRS232, ComPort.eComHardwareHandshakeType.ComspecHardwareHandshakeNone, ComPort.eComSoftwareHandshakeType.ComspecSoftwareHandshakeNone, false); } } } #endregion1 #region Touchpanel if (this.SupportsEthernet) { myPanel = new XpanelForSmartGraphics(0x03, this); myPanel.SigChange += new SigEventHandler(myPanel_SigChange); if (myPanel.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Error in Registering xPanel: {0}", myPanel.RegistrationFailureReason); } else { myPanel.LoadSmartObjects(@"\NVRAM\xpnl.sgd"); CrestronConsole.PrintLine("Loaded SmartObjects: {0}", myPanel.SmartObjects.Count); foreach (KeyValuePair <uint, SmartObject> mySmartObject in myPanel.SmartObjects) { mySmartObject.Value.SigChange += new SmartObjectSigChangeEventHandler(Value_SigChange); } MySigGroup = CreateSigGroup(1, eSigType.String); MySigGroup.Add(myPanel.StringInput[1]); MySigGroup.Add(myPanel.StringInput[2]); } } #endregion #region EISC if (this.SupportsEthernet) { myEISC = new EthernetIntersystemCommunications(0x04, "127.0.0.2", this); myEISC.SigChange += new SigEventHandler(myEISC_SigChange); if (myEISC.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("Error in Registering EISC: {0}", myEISC.RegistrationFailureReason); } else { myEISC.SigChange -= myEISC_SigChange; } } #endregion } catch (Exception e) { ErrorLog.Error("Error in the constructor: {0}", e.Message); } }
public Music8250(IROutputPort port) { this.port = port; }