void Initialize(ControlSystem cs, uint ipid, string projectName, bool traceEnabled) { this.cs = cs; this.TraceEnabled = traceEnabled; this.TraceName = this.GetType().Name; // set defaults state = new UserInterfaceState(); state.page = Page.Home; state.modalPopup = ModalPopup.None; panel = new Tsw760(ipid, cs); // add callbacks panel.OnlineStatusChange += new OnlineStatusChangeEventHandler(PanelOnlineStatusChangeHandler); panel.SigChange += new SigEventHandler(PanelSigChangeHandler); // register panel if (panel.Register() == eDeviceRegistrationUnRegistrationResponse.Success) { Trace("Initialize() panel registered successfully."); } else { Trace("Initialize() panel failed to register."); return; } // load SmartGraphics objects string sgdPath = String.Format("{0}\\{1}.sgd", Directory.GetApplicationDirectory(), projectName); if (File.Exists(sgdPath)) { if (panel.LoadSmartObjects(sgdPath) > 0) { Trace(String.Format("Initialize() loaded {0} SmartObjects.", panel.SmartObjects.Count)); foreach (KeyValuePair <uint, SmartObject> pair in panel.SmartObjects) { pair.Value.SigChange += new SmartObjectSigChangeEventHandler(PanelSmartObjectHandler); } } else { Trace("Initialize() error, couldn't load any SmartObjects!"); } } else { Trace(String.Format("Initialize() error, SGD file: {0}, does not exist.", sgdPath)); } }
/// <summary> /// InitializeSystem - this method gets called after the constructor /// has finished. /// /// Use InitializeSystem to: /// * Start threads /// * Configure ports, such as serial and verisports /// * Start and initialize socket connections /// Send initial device configurations /// /// Please be aware that InitializeSystem needs to exit quickly also; /// if it doesn't exit in time, the SIMPL#Pro program will exit. /// </summary> public override void InitializeSystem() { try { if (myTSW760.Register() == eDeviceRegistrationUnRegistrationResponse.Success) { CrestronConsole.PrintLine("The panel is registered.\r"); CrestronConsole.AddNewConsoleCommand(PanelBrightness, "PanelBrightness", "Set the brightness level of the touch panel. SetPanelBrightness {0-100}.", ConsoleAccessLevelEnum.AccessOperator); PanelBrightness("50"); } if (myDmRmc4k100C.Register() == eDeviceRegistrationUnRegistrationResponse.Success) { CrestronConsole.PrintLine("The roombox is registered.\r"); CrestronConsole.AddNewConsoleCommand(VideoRoute, "VideoRoute", "Route video. 0 Unroutes. VideoRoute {input #} {output #}", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(AudioRoute, "AudioRoute", "Route audio. 0 Unroutes. AudioRoute {input #} {output #}", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(MasterVolume, "MasterVolume", "Set Master Volume level. blank args to show current. MasterVolume {-800 to 100}", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(MasterVolumeMute, "MasterVolumeMute", "Mute Master Volume level. blank args to show current. MasterVolumeMute {ON/OFF}", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(SystemPower, "SystemPower", "Power ON/OFF the system. blank args to show current. SystemPower {ON/OFF}", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(AmpPower, "AmpPower", "Power ON/OFF the Amp. blank args to show current. AmpPower {ON/OFF}", ConsoleAccessLevelEnum.AccessOperator); } } catch (Exception e) { ErrorLog.Error("Error in InitializeSystem: {0}", e.Message); } }
private const uint keypadID = 1; // smart graphic object id public ControlSystem() : base() { Thread.MaxNumberOfUserThreads = 60; if (this.SupportsEthernet) { tsw760 = new Tsw760(0x05, this); string TSW760SgdFilePath = string.Format("{0}\\Passcode.sgd", Directory.GetApplicationDirectory()); if (File.Exists(TSW760SgdFilePath)) { tsw760.LoadSmartObjects(TSW760SgdFilePath); CrestronConsole.PrintLine("[SYSTEM] TSW SGD FOUND!!!"); PasscodeKeypad = tsw760.SmartObjects[keypadID]; } else { CrestronConsole.PrintLine("[SYSTEM] Could not find TSW SGD file. TSW SmartObjects will not work at this time"); } if (tsw760.Register() == eDeviceRegistrationUnRegistrationResponse.Success) { CrestronConsole.PrintLine("[SYSTEM] tsw760 has been registered successfully"); } else { CrestronConsole.PrintLine("[SYSTEM] tsw760 failed registration. Cause: {0}", tsw760.RegistrationFailureReason); } } else { CrestronConsole.PrintLine("[SYSTEM] This processor does not support ethernet, so this program will not run"); } /// set up passcode PIN = new Passcode(); PIN.Init(tsw760, PasscodeKeypad, passcodeChangeButton, passcodeTextField); PIN.debug_enable = true; PIN.SetCallback(PINCodeEntered); }
/// <summary> /// ControlSystem Constructor. Starting point for the SIMPL#Pro program. /// Use the constructor to: /// * Initialize the maximum number of threads (max = 400) /// * Register devices /// * Register event handlers /// * Add Console Commands /// /// Please be aware that the constructor needs to exit quickly; if it doesn't /// exit in time, the SIMPL#Pro program will exit. /// /// You cannot send / receive data in the constructor /// </summary> public ControlSystem() : base() { try { Thread.MaxNumberOfUserThreads = 20; userInterface = new Tsw760(03, this); userInterface.SigChange += new SigEventHandler(userInterface_SigChange); userInterface.Register(); //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); } catch (Exception e) { ErrorLog.Error("Error in the constructor: {0}", e.Message); } }
/// <summary> /// ControlSystem Constructor. Starting point for the SIMPL#Pro program. /// Use the constructor to: /// * Initialize the maximum number of threads (max = 400) /// * Register devices /// * Register event handlers /// * Add Console Commands /// /// Please be aware that the constructor needs to exit quickly; if it doesn't /// exit in time, the SIMPL#Pro program will exit. /// /// You cannot send / receive data in the constructor /// </summary> public ControlSystem() : base() { try { Thread.MaxNumberOfUserThreads = 20; hdmi_switcher = new HDMISwitcher(165, HDMI_SWITCHER_IP, this); userInterface = new Tsw760(03, this); userInterface.SigChange += new SigEventHandler(userInterface_Sigchange); userInterface.Register(); //A4 is 164 in hexidecial notaion lighting = new Glpp1DimFlv3CnPm(164, this); lighting.Register(); comport = ComPorts[1]; comport.Register(); comport.SetComPortSpec(Crestron.SimplSharpPro.ComPort.eComBaudRates.ComspecBaudRate9600, Crestron.SimplSharpPro.ComPort.eComDataBits.ComspecDataBits8, Crestron.SimplSharpPro.ComPort.eComParityType.ComspecParityNone, Crestron.SimplSharpPro.ComPort.eComStopBits.ComspecStopBits1, Crestron.SimplSharpPro.ComPort.eComProtocolType.ComspecProtocolRS232, Crestron.SimplSharpPro.ComPort.eComHardwareHandshakeType.ComspecHardwareHandshakeNone, Crestron.SimplSharpPro.ComPort.eComSoftwareHandshakeType.ComspecSoftwareHandshakeNone, false); //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); } catch (Exception e) { ErrorLog.Error("Error in the constructor: {0}", e.Message); } }
public override void InitializeSystem() { try { if (SupportsSwitcherOutputs) { try { dmVideoRouting = new dmpsVideoRouting(SwitcherInputs, SwitcherOutputs, this.SystemControl as Dmps3SystemControl, SwitcherOutputs[(uint)eDmps3200cOutputs.Hdmi] as Crestron.SimplSharpPro.DM.Cards.Card.Dmps3HdmiOutput, SwitcherInputs[(uint)eDmps3200cInputs.Dm] as Crestron.SimplSharpPro.DM.Cards.Card.Dmps3DmInput); DMOutputChange += new Crestron.SimplSharpPro.DM.DMOutputEventHandler(dmVideoRouting.DMOutputChange); DMSystemChange += new DMSystemEventHandler(dmVideoRouting.DMSystemChange); DMInputChange += new DMInputEventHandler(dmVideoRouting.DMInputChange); dmVideoRouting.DMPSVideoEvent += new dmpsVideoRouting.DMPSVideoOutChangeEventhandler(dmVideoRouting_DMPSVideoEvent); dmVideoRouting.DMPSVideoSyncChange += new dmpsVideoRouting.DMPSVideoSyncChangeEvent(dmVideoRouting_DMPSVideoSyncChange); dmVideoRouting.DMPSDmInputChange += new dmpsVideoRouting.DMPSDmInputChangeEvent(dmVideoRouting_DMPSDmInputChange); dmVideoRouting.DMPSHDMIChange += new dmpsVideoRouting.DMPSHDMiMuteChangeEvene(dmVideoRouting_DMPSHDMIChange); dmAudioControl = new dmpsAudioControls(SwitcherOutputs[(uint)eDmps3200cOutputs.Program] as Crestron.SimplSharpPro.DM.Cards.Card.Dmps3ProgramOutput, SwitcherInputs); DMOutputChange += new DMOutputEventHandler(dmAudioControl.DMOutputChange); dmAudioControl.AudioLevelChange += new dmpsAudioControls.AudioLevelChangeEvent(dmAudioControl_AudioLevelChange); dmAudioControl.AudioSourceChange += new dmpsAudioControls.AudioSourceChangeEvent(dmAudioControl_AudioSourceChange); dmAudioControl.AmpMixerChange += new dmpsAudioControls.AmpMixerChangeEvent(dmAudioControl_AmpMixerChange); dmAudioControl.AmpPowerChange += new dmpsAudioControls.AmpPowerChangeEvent(dmAudioControl_AmpPowerChange); DmTx201C _dmTX201c = new DmTx201C(0x08, SwitcherInputs[(uint)eDmps3200cInputs.Dm] as DMInput); dmTX = new DmpxTS(_dmTX201c); dmTX.DmTXAudioChangeEvent += new DmpxTS.DmTxAudioChangeEventHandler(dmTX_DmTXAudioChangeEvent); dmTX.DmTXVideoChangeEvent += new DmpxTS.DmTxVideoChangeEventHandler(dmTX_DmTXVideoChangeEvent); } catch (Exception e) { CrestronConsole.PrintLine("Error is SwitcherOutputs Constructor is: " + e); } } uiLogic = new TouchPanel(); uiLogic.AnalogChangeEvent += new TouchPanel.AnalogChangeEventHandler(uiLogic_AnalogChangeEvent); uiLogic.DigitalChangeEvent += new TouchPanel.DigitalChangeEventHandler(uiLogic_DigitalChangeEvent); userInterface = new Tsw760(0x03, this); userInterface.SigChange += new SigEventHandler(uiLogic.userInterface_SigChange); userInterface.Register(); CrestronConsole.PrintLine("Touchpanel Registration Feedback is: " + userInterface.Registered); dmGeneralControl = new dmps3200General(this); dmGeneralControl.DMPS3FrontpanelChange += new dmps3200General.DMPS3FrontPanelEventHandler(dmGeneralControl_DMPS3FrontpanelChange); dmGeneralControl.DMPS3PowerEventChange += new dmps3200General.DMPSSystemPowerEventHandler(dmGeneralControl_DMPS3PowerEventChange); dmRelays = new DMPSRelays(this); dmRelays.RelayChangeEvent += new DMPSRelays.RelayChangeEventHandler(dmRelays_RelayChangeEvent); dmIo = new DMPSIOS(this); dmIo.IOChangeEvent += new DMPSIOS.IOChangeEventHandler(dmIo_IOChangeEvent); dmVideoRouting.HDMIMute(true); } catch (Exception e) { ErrorLog.Error("Error in InitializeSystem: {0}", e.Message); } }
public override void InitializeSystem() { try { // List of all Touchscreens in system IList <BasicTriListWithSmartObject> panelList = new List <BasicTriListWithSmartObject>(); Tsw1060 touchScreen1060 = new Tsw1060(0x0C, this); touchScreen1060.Register(); Tsw760 touchScreen760 = new Tsw760(0x0A, this); touchScreen760.Register(); Tsw560 touchScreen560 = new Tsw560(0x0E, this); touchScreen560.Register(); Tsw560P touchScreen560P = new Tsw560P(0x0D, this); touchScreen560P.Register(); CrestronApp mobileApp = new CrestronApp(0x0B, this); mobileApp.ParameterProjectName.Value = "ch5-sample-project"; mobileApp.Register(); panelList.Add(touchScreen1060); panelList.Add(touchScreen760); panelList.Add(touchScreen560); panelList.Add(touchScreen560P); panelList.Add(mobileApp); // --------------------------------------------------------------------------------------------------------------- // Create Contract Instance to program all touchscreens in system. This Contract Reference will globablly program // Lights, Source Selection, and ContactList // --------------------------------------------------------------------------------------------------------------- // Contract Instance var globalContract = new Contract(panelList.ToArray()); // Sample Programming of Lights/Scenes for all Touchscreens var demoLightingLogic = new DemoRoomLogic(globalContract.Room); // Sample Programming of Contact List for all Touchscreens var demoContactListingLogic = new DemoContactListingLogic(globalContract.ContactList); // Sample Programming of Source Selection for all Touchscreens var demoSourceSelectionLogic = new DemoSourceSelectLogic(globalContract.SourceList); // -------------------------------------------------------------------------------------------------------------- // Creating Multiple Contract Instances for each Touchscreen to program VIDEO CAMERA PAGE. // This will allow each Touchscreen Device to independantly play a different video camera. // For example TSW1060 can watch camera 2 while TSW760 can watch camera 1 and so on. // -------------------------------------------------------------------------------------------------------------- //Contract Instance for TSW1060 Touchscreen1060Contract = new Contract(touchScreen1060); Touchscreen1060VideoCamera = new DemoVideoCameraLogic(Touchscreen1060Contract.CameraList); // Contact Instance for TSW760 Touchscreen760Contract = new Contract(touchScreen760); Touchscreen760VideoCamera = new DemoVideoCameraLogic(Touchscreen760Contract.CameraList); // Contact Instance for TSW560 Touchscreen560Contract = new Contract(touchScreen560); Touchscreen560VideoCamera = new DemoVideoCameraLogic(Touchscreen560Contract.CameraList); // Contact Instance for TSW560P Touchscreen560PContract = new Contract(touchScreen560P); Touchscreen560PVideoCamera = new DemoVideoCameraLogic(Touchscreen560PContract.CameraList); // Contact Instance for MobileApp MobileAppContract = new Contract(mobileApp); MobileAppVideoCamera = new DemoVideoCameraLogic(MobileAppContract.CameraList); } catch (Exception e) { ErrorLog.Error("Error in InitializeSystem: {0}", e.Message); } }