/// <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.AddNewConsoleCommand(new SimplSharpProConsoleCmdFunction(ConnectSSH), "SSHConnect", "Connect to the SSH server", ConsoleAccessLevelEnum.AccessProgrammer); CrestronConsole.AddNewConsoleCommand(new SimplSharpProConsoleCmdFunction(SendSSHCommand), "SSHCommand", "Send a string as a command to the SSH server", ConsoleAccessLevelEnum.AccessProgrammer); mySshClientDevice = new SSHClientDevice(); mySshClientDevice.myEventToSsp += new CommandEventHandler(mySshClientDevice_myEventToSsp); // Set the number of system and user threads which you want to use in your program . // User threads are created using the CrestronThread class // System threads are used for CTimers/CrestronInvoke/Async Socket operations // 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 Thread.MaxNumberOfUserThreads = 10; }
public ControlSystem() : base() { try { 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); //Console Commands to Trigger Connect and send command CrestronConsole.AddNewConsoleCommand(ConnectSSH, "SSHConnect", "Connect to the SSH server", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(SendSSHCommand, "SSHCommand", "Send a string as a command to the SSH server", ConsoleAccessLevelEnum.AccessOperator); mySSHClientDevice = new SSHClientDevice(); mySSHClientDevice.myEventToSsp += new CommandEventHandler(mySSHClientDevice_myEventToSsp); } catch (Exception e) { ErrorLog.Error("Error in the constructor: {0}", e.Message); } }