void DMOutputEnable(string State) { if (State.ToUpper() == "ON") { _DMOutput.DM_Output_Enabled(); } else if (State.ToUpper() == "OFF") { _DMOutput.DM_Output_Disabled(); } else { CrestronConsole.ConsoleCommandResponse("TDMOutputEnable" + _DMOutput.DMOutputPort + " [On|Off]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Changing DM Output to {0}...\n", State.ToUpper()); }
void SourceMute(string State) { if (State.ToUpper() == "ON") { _DMOutput.Source_Mute_On(); } else if (State.ToUpper() == "OFF") { _DMOutput.Source_Mute_Off(); } else { CrestronConsole.ConsoleCommandResponse("TSourceMute" + _DMOutput.DMOutputPort + " [On|Off]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Changing Source Mute to {0}...\n", State.ToUpper()); }
void HDMIForceHDCPEnable(string State) { if (State.ToUpper() == "ON") { _DMOutput.HDMI_Force_HDCP_Enable(); } else if (State.ToUpper() == "OFF") { _DMOutput.HDMI_Force_HDCP_Disable(); } else { CrestronConsole.ConsoleCommandResponse("THDMIForceHDCPEnable" + _DMOutput.DMOutputPort + " [On|Off]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Changing HDMI Force HDCP to {0}...\n", State.ToUpper()); }
void SourceLevelDown(string State) { if (State.ToUpper() == "START") { _DMOutput.Source_Level_Down(true); } else if (State.ToUpper() == "STOP") { _DMOutput.Source_Level_Down(false); } else { CrestronConsole.ConsoleCommandResponse("TSourceLevel" + _DMOutput.DMOutputPort + " [Up|Down]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Lowering Source Level {0}...\n", State.ToUpper()); }
int GetFirstParameterInteger(string value, string MessageHelp) { var commands = value.Split(' '); int Result; try { Result = int.Parse(commands[0]); } catch (Exception) { CrestronConsole.ConsoleCommandResponse(MessageHelp); return(0xfff); } return(Result); }
void MasterVolDown(string State) { if (State.ToUpper() == "START") { _DMOutput.Master_Volume_Down(true); } else if (State.ToUpper() == "STOP") { _DMOutput.Master_Volume_Down(false); } else { CrestronConsole.ConsoleCommandResponse("TMasterVol" + _DMOutput.DMOutputPort + " [Up|Down]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Lowering Master Volume {0}...\n", State.ToUpper()); }
void SetDigitalOutput(string State) { if (State.ToUpper() == "ON") { _IOPort.DigitalOutput = true; } else if (State.ToUpper() == "OFF") { _IOPort.DigitalOutput = false; } else { CrestronConsole.ConsoleCommandResponse("TSetDigOut" + _IOPort.Name + " [ON|OFF]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Changing Output to {0}...\n", State); }
static void ErrorLogStatistics(string State) { if (State.ToUpper() == "START") { _SystemMonitor.ErrorLogStatisicsEnable(); } else if (State.ToUpper() == "STOP") { _SystemMonitor.ErrorLogStatisicsDisable(); } else { CrestronConsole.ConsoleCommandResponse("TErrorLogStatistics [START|STOP]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Changing Error Log Statistics to {0}...\n", State); }
void HDCPChangeSupport(string State) { if (State.ToUpper() == "ON") { _DMInput.HDCP_Support_On(); } else if (State.ToUpper() == "OFF") { _DMInput.HDCP_Support_Off(); } else { CrestronConsole.ConsoleCommandResponse("THDCPSupport" + _DMInput.DMInputPort + " [On|Off]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Changing HDCP Support to {0}...\n", State.ToUpper()); }
static void CPUUtilization(string State) { if (State.ToUpper() == "START") { _SystemMonitor.CPU_UtilizationEnable(); } else if (State.ToUpper() == "STOP") { _SystemMonitor.CPU_UtilizationDisable(); } else { CrestronConsole.ConsoleCommandResponse("TCPUUtilization [START|STOP]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Changing CPU Utiliziation to {0}...\n", State); }
static void Sysmon(string State) { if (State.ToUpper() == "START") { _SystemMonitor.StartSysmon(); } else if (State.ToUpper() == "STOP") { _SystemMonitor.StopSysmon(); } else { CrestronConsole.ConsoleCommandResponse("TSysmon [START|STOP]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Changing System Monitor to {0}...\n", State); }
void PUDisable(string State) { if (State.ToUpper() == "ON") { _IOPort.PullUpResistorDisabled = true; } else if (State.ToUpper() == "OFF") { _IOPort.PullUpResistorDisabled = false; } else { CrestronConsole.ConsoleCommandResponse("TPUDisable" + _IOPort.Name + " [ON|OFF]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Changing Output to {0}...\n", State); }
void MicLevelUp(string State) { if (State.ToUpper() == "START") { _DMOutput.Mic_Level_Up(true); } else if (State.ToUpper() == "STOP") { _DMOutput.Mic_Level_Up(false); } else { CrestronConsole.ConsoleCommandResponse("TMicLevel" + _DMOutput.DMOutputPort + " [Up|Down]"); return; } CrestronConsole.ConsoleCommandResponse("CMD:Raising Mic Level {0}...\n", State.ToUpper()); }
void GetPosts(string number) { switch (number) { case "1": JC.Connect(@"http://jsonplaceholder.typicode.com/posts/1", Convert.ToInt16(number)); break; case "2": JC.Connect(@"http://jsonplaceholder.typicode.com/posts", Convert.ToInt16(number)); break; default: CrestronConsole.ConsoleCommandResponse("Incorrect input, please use 1 for one response and 2 for multiple"); break; } }
static void SocketCommand(string s) { // 0 1 2 //socket command number/key/all param //socket list //socket send 4 ver -v\n if (string.IsNullOrEmpty(s)) { return; } var tokens = s.Split(' '); if (tokens.Length == 0) { return; } var command = tokens[0].ToLower(); if (command == "connect") { } else if (command == "disco") { } else if (command == "list") { CrestronConsole.ConsoleCommandResponse("{0} sockets", Sockets.Count); if (Sockets.Count == 0) { return; } // get the longest key name, for formatting var longestLength = Sockets.Aggregate("", (max, cur) => max.Length > cur.Key.Length ? max : cur.Key).Length; for (int i = 0; i < Sockets.Count; i++) { var sock = Sockets[i]; CrestronConsole.ConsoleCommandResponse("{0} {1} {2} {3}", i, sock.Key, GetSocketType(sock), sock.ClientStatus); } } else if (command == "send") { } }
private void ConsoleRoute(string cmdParameters) { try { var args = cmdParameters.Split(' '); var encoder = Devices.GetByName(args[0]); foreach (var device in Devices.Decoders) { JoinFastSwitched(encoder as ZeeVeeEncoder, device); } } catch (Exception e) { CrestronConsole.ConsoleCommandResponse("Error: {0}", e.Message); } }
public static void Initialize(CrestronControlSystem cs) { AddDeviceEnabled = true; CrestronConsole.AddNewConsoleCommand(ListDeviceCommStatuses, "devcommstatus", "Lists the communication status of all devices", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(ListDeviceFeedbacks, "devfb", "Lists current feedbacks", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(ListDevices, "devlist", "Lists current managed devices", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(DeviceJsonApi.DoDeviceActionWithJson, "devjson", "", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetProperties(s)), "devprops", "", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetMethods(s)), "devmethods", "", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s)), "apimethods", "", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(SimulateComReceiveOnDevice, "devsimreceive", "Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator); }
static void GetStatsState(string State) { if (State == "") { CrestronConsole.ConsoleCommandResponse("STAT State:CIP Statistic: {0}\n\r", _SystemMonitor.CIP_StatisticsEnable_F ? "Enabled" : "Disabled"); CrestronConsole.ConsoleCommandResponse("STAT State:CPU Utilization: {0}\n\r", _SystemMonitor.CPU_UtilizationEnable_F ? "Enabled" : "Disabled"); CrestronConsole.ConsoleCommandResponse("STAT State:Cresnet Statistic: {0}\n\r", _SystemMonitor.CresnetStatisticsEnable_F ? "Enabled" : "Disabled"); CrestronConsole.ConsoleCommandResponse("STAT State:Error Log Statistic: {0}\n\r", _SystemMonitor.ErrorLogStatisticsEnable_F ? "Enabled" : "Disabled"); CrestronConsole.ConsoleCommandResponse("STAT State:Process Statistic: {0}\n\r", _SystemMonitor.ProcessStatisticsEnable_F ? "Enabled" : "Disabled"); CrestronConsole.ConsoleCommandResponse("STAT State:System Monitor: {0}\n\r", _SystemMonitor.SysmonStarted_F ? "Enabled" : "Disabled"); CrestronConsole.ConsoleCommandResponse("STAT State:TCP Statistic: {0}\n\r", _SystemMonitor.TCP_StatisticsEnable_F ? "Enabled" : "Disabled"); } else { CrestronConsole.ConsoleCommandResponse("TGetAllStats"); return; } }
void TestHttpRequest(string s) { { s = s.Trim(); if (string.IsNullOrEmpty(s)) { PrintTestHttpRequestUsage(); return; } var tokens = s.Split(' '); if (tokens.Length < 2) { CrestronConsole.ConsoleCommandResponse("Too few paramaters\r"); PrintTestHttpRequestUsage(); return; } try { var url = tokens[1]; if (tokens[0].ToLower() == "get") { var resp = new HttpClient().Get(url); CrestronConsole.ConsoleCommandResponse("RESPONSE:\r{0}\r\r", resp); } else if (tokens[0].ToLower() == "post") { var resp = new HttpClient().Post(url, new byte[] { }); CrestronConsole.ConsoleCommandResponse("RESPONSE:\r{0}\r\r", resp); } else { CrestronConsole.ConsoleCommandResponse("Only get or post supported\r"); PrintTestHttpRequestUsage(); } } catch (HttpException e) { CrestronConsole.ConsoleCommandResponse("Exception in request:\r"); CrestronConsole.ConsoleCommandResponse("Response URL: {0}\r", e.Response.ResponseUrl); CrestronConsole.ConsoleCommandResponse("Response Error Code: {0}\r", e.Response.Code); CrestronConsole.ConsoleCommandResponse("Response body: {0}\r", e.Response.ContentString); } } }
static double GetFirstParameterDouble(string value, string MessageHelp) { var commands = value.Split(' '); double Result; try { Result = double.Parse(commands[0]); Result = Math.Round(Result, 1); } catch (Exception) { CrestronConsole.ConsoleCommandResponse(MessageHelp); return(0xffff); } return(Result); }
/// <summary> /// Entry point for the program /// </summary> public override void InitializeSystem() { DeterminePlatform(); if (Debug.DoNotLoadOnNextBoot) { CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file", ConsoleAccessLevelEnum.AccessOperator); } // CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => { Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s); }, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => { foreach (var tl in TieLineCollection.Default) { CrestronConsole.ConsoleCommandResponse(" {0}\r", tl); } }, "listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => { CrestronConsole.ConsoleCommandResponse ("Current running configuration. This is the merged system and template configuration"); CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject (ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented)); }, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => { CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" + "System URL: {0}\r" + "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); if (!Debug.DoNotLoadOnNextBoot) { GoWithLoad(); } }
static void GetAllStats(string State) { if (State == "") { CrestronConsole.ConsoleCommandResponse("STAT:CIP CIP_RX_Count_F: {0}\n\r", _SystemMonitor.CIP_RX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP CIP_TotalCount_F: {0}\n\r", _SystemMonitor.CIP_TotalCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP CIP_TX_Count_F: {0}\n\r", _SystemMonitor.CIP_TX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP CPU_Utilization_F: {0}\n\r", _SystemMonitor.CPU_Utilization_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP CresnetRX_Count_F: {0}\n\r", _SystemMonitor.CresnetRX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP CresnetRX_UtilizationCount_F: {0}\n\r", _SystemMonitor.CresnetRX_UtilizationCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP CresnetTotalCount_F: {0}\n\r", _SystemMonitor.CresnetTotalCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP CresnetTotalUtilizationCount_F: {0}\n\r", _SystemMonitor.CresnetTotalUtilizationCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP CresnetTX_Count_F: {0}\n\r", _SystemMonitor.CresnetTX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP CresnetTX_UtilizationCount_F: {0}\n\r", _SystemMonitor.CresnetTX_UtilizationCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP ErrorLogErrorCount_F: {0}\n\r", _SystemMonitor.ErrorLogErrorCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP ErrorLogNoticeCount_F: {0}\n\r", _SystemMonitor.ErrorLogNoticeCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP ErrorLogWarningCount_F: {0}\n\r", _SystemMonitor.ErrorLogWarningCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP HeapFree_F: {0}\n\r", _SystemMonitor.HeapFree_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP HeapFreeMin_F: {0}\n\r", _SystemMonitor.HeapFreeMin_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxCIP_RX_Count_F: {0}\n\r", _SystemMonitor.MaxCIP_RX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxCIP_TotalCount_F: {0}\n\r", _SystemMonitor.MaxCIP_TotalCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxCIP_TX_Count_F: {0}\n\r", _SystemMonitor.MaxCIP_TX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxCPU_Utilization_F: {0}\n\r", _SystemMonitor.MaxCPU_Utilization_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxCresnetRX_Count_F: {0}\n\r", _SystemMonitor.MaxCresnetRX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxCresnetRX_UtilizationCount_F: {0}\n\r", _SystemMonitor.MaxCresnetRX_UtilizationCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxCresnetTotalCount_F: {0}\n\r", _SystemMonitor.MaxCresnetTotalCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxCresnetTotalUtilizationCount_F: {0}\n\r", _SystemMonitor.MaxCresnetTotalUtilizationCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxCresnetTX_Count_F: {0}\n\r", _SystemMonitor.MaxCresnetTX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxCresnetTX_UtilizationCount_F: {0}\n\r", _SystemMonitor.MaxCresnetTX_UtilizationCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxProcesses_F: {0}\n\r", _SystemMonitor.MaxProcesses_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxTCP_RX_Count_F: {0}\n\r", _SystemMonitor.MaxTCP_RX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxTCP_TotalCount_F: {0}\n\r", _SystemMonitor.MaxTCP_TotalCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP MaxTCP_TX_Count_F: {0}\n\r", _SystemMonitor.MaxTCP_TX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP NumProcesses_F: {0}\n\r", _SystemMonitor.NumProcesses_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP TCP_RX_Count_F: {0}\n\r", _SystemMonitor.TCP_RX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP TCP_TotalCount_F: {0}\n\r", _SystemMonitor.TCP_TotalCount_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP TCP_TX_Count_F: {0}\n\r", _SystemMonitor.TCP_TX_Count_F); CrestronConsole.ConsoleCommandResponse("STAT:CIP TotalHeapSpace_F: {0}\n\r", _SystemMonitor.TotalHeapSpace_F); } else { CrestronConsole.ConsoleCommandResponse("TGetAllStats"); return; } }
public void ControlSystemInfo(string parms) { if (parms == "?") { CrestronConsole.ConsoleCommandResponse("CONTROLLERINFO\n\r\tNo parameters needed.\n\r"); } else { CrestronConsole.ConsoleCommandResponse("Controller prompt: {0}\n\r", this.ControllerPrompt); CrestronConsole.ConsoleCommandResponse("Number of serial ports: {0}\n\r", this.NumberOfComPorts); CrestronConsole.ConsoleCommandResponse("Number of IR ports: {0}\n\r", this.NumberOfIROutputPorts); if (this.SupportsRelay) { CrestronConsole.ConsoleCommandResponse("Number of relay ports: {0}\n\r", this.NumberOfRelayPorts); } if (this.SupportsDigitalInput) { CrestronConsole.ConsoleCommandResponse("Number of digital inputs: {0}\n\r", this.NumberOfDigitalInputPorts); } if (this.SupportsVersiport) { CrestronConsole.ConsoleCommandResponse("Number of versiports: {0}\n\r", this.NumberOfVersiPorts); } CrestronConsole.ConsoleCommandResponse("Internal RF Gateway: {0}\n\r", this.SupportsInternalRFGateway ? "YES" : "NO"); // Check if built-in DM switcher if (this.SystemControl != null) { CrestronConsole.ConsoleCommandResponse("System ID: {0}\n\r", this.SystemControl.SystemId); if (this.SupportsSwitcherInputs) { CrestronConsole.ConsoleCommandResponse("Number of switcher inputs: {0}\n\r", this.NumberOfSwitcherInputs); } if (this.SupportsSwitcherOutputs) { CrestronConsole.ConsoleCommandResponse("Number of switcher outputs: {0}\n\r", this.NumberOfSwitcherOutputs); } } } }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="name"></param> /// <param name="config"></param> public MobileControlSystemController(string key, string name, MobileControlConfig config) : base(key, name) { Config = config; SystemUuid = ConfigReader.ConfigObject.SystemUuid; Debug.Console(0, this, "Mobile UI controller initializing for server:{0}", config.ServerUrl); CrestronConsole.AddNewConsoleCommand(AuthorizeSystem, "mobileauth", "Authorizes system to talk to Mobile Control server", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => ShowInfo(), "mobileinfo", "Shows information for current mobile control session", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => { s = s.Trim(); if (!string.IsNullOrEmpty(s)) { HttpDebugEnabled = (s.Trim() != "0"); } CrestronConsole.ConsoleCommandResponse("HTTP Debug {0}", HttpDebugEnabled ? "Enabled" : "Disabled"); }, "mobilehttpdebug", "1 enables more verbose HTTP response debugging", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(TestHttpRequest, "mobilehttprequest", "Tests an HTTP get to URL given", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(PrintActionDictionaryPaths, "mobileshowactionpaths", "Prints the paths in the Action Dictionary", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => ConnectWebsocketClient(), "mobileconnect", "Forces connect of websocket", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => CleanUpWebsocketClient(), "mobiledisco", "Disconnects websocket", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => ParseStreamRx(s), "mobilesimulateaction", "Simulates a message from the server", ConsoleAccessLevelEnum.AccessOperator); CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler); CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler); // Config Messenger var cmKey = Key + "-config"; ConfigMessenger = new ConfigMessenger(cmKey, "/config"); ConfigMessenger.RegisterWithAppServer(this); }
/// <summary> /// Console handler that simulates com port data receive /// </summary> /// <param name="s"></param> public static void SimulateComReceiveOnDevice(string s) { // devcomsim:1 xyzabc var match = Regex.Match(s, @"(\S*)\s*(.*)"); if (match.Groups.Count < 3) { CrestronConsole.ConsoleCommandResponse(" Format: devsimreceive:P <device key> <string to send>"); return; } //Debug.Console(2, "**** {0} - {1} ****", match.Groups[1].Value, match.Groups[2].Value); ComPortController com = GetDeviceForKey(match.Groups[1].Value) as ComPortController; if (com == null) { CrestronConsole.ConsoleCommandResponse("'{0}' is not a comm port device", match.Groups[1].Value); return; } com.SimulateReceive(match.Groups[2].Value); }
// This will end the client's TCP connection with the server by sending a FIN message, or // notify you that the client socket is already disconnected public void Disconnect(string args) { try { if (client != null) { SocketErrorCodes err = client.DisconnectFromServer(); PrintAndLog("Disconnect with error code: " + err); client.Dispose(); client = null; } else { CrestronConsole.ConsoleCommandResponse("Client is already disconnected."); } } catch (Exception e) { PrintAndLog("Error in Disconnect: " + e.Message); } }
public void Init(uint numberOfInputs) { //joinRepo = new JoinTrackerRepo(); joinRepo = new JoinTrackerInMemoryRepo(); joinRepoLog = new JoinTrackerLogRepo(); service = new JoinTrackerService(joinRepo, joinRepoLog, numberOfInputs); try { if (!File.Exists("\\NVRAM\\ServerData\\jointracker.json")) { byte[] emptyArray = new UTF8Encoding(true).GetBytes("[]"); using (var fs = File.Create("\\NVRAM\\ServerData\\jointracker.json")) { fs.Write(emptyArray, 0, emptyArray.Length); } } } catch (Exception e) { CrestronConsole.ConsoleCommandResponse("Error with create server data struct", e.Message); } }
private void TransmitPreset(string param) { string MessageHelp = "TTransmitMessageDMTX" + _ComPort.Name + " message"; var commands = Regex.Matches(param, "\\\".*?\\\"|\\S*"); string Message = ""; try { Message = commands[0].Value.Replace("\"", string.Empty); } catch { CrestronConsole.ConsoleCommandResponse(MessageHelp); } if (Message != "") { CrestronConsole.ConsoleCommandResponse("CMD:Transmitting Message: {0} through Com Port", Message); _ComPort.SendPresetString(Message); } else { CrestronConsole.ConsoleCommandResponse(MessageHelp); } }
void FeatureReport(string message) { string MessageHelp = "TFeatureReport" + _UsbHid.Name + " message"; var commands = Regex.Matches(message, "[0-9A-F\\:]+"); string Message = ""; try { Message = commands[0].Value.Replace("\"", string.Empty); } catch { CrestronConsole.ConsoleCommandResponse(MessageHelp); } if (Message != "") { CrestronConsole.ConsoleCommandResponse("CMD:Sending Feature Report Data: {0} through USB", Message); _UsbHid.Feature_Report(Message); } else { CrestronConsole.ConsoleCommandResponse(MessageHelp); } }
private void GetPresetStatus(string param) { string MessageHelp = "TGetPresetStatusDMTX" + _ComPort.Name + " message"; var commands = Regex.Matches(param, "\\\".*?\\\"|\\S*"); string Message = ""; try { Message = commands[0].Value.Replace("\"", string.Empty); } catch { CrestronConsole.ConsoleCommandResponse(MessageHelp); } if (Message != "") { var status = _ComPort.GetPresetStringStatus(Message); CrestronConsole.ConsoleCommandResponse("CMD:Preset String {0} Status is {1}", Message, status); } else { CrestronConsole.ConsoleCommandResponse(MessageHelp); } }