public void Write(Func <string> input) { StringComparer stringComparer = StringComparer.OrdinalIgnoreCase; string command; var module = new WifiModules.DW700(); while (_continueFlag) { var args = input().Split(' '); if (args.Length == 0) { continue; } command = args[0]; if (stringComparer.Equals("q", command)) { Stop(); } else if (command == "0") { var message = module.ResetCommand(); Write(message); } else if (command == "e") { if (args.Length < 2) { continue; } var message = module.NotifyError(int.Parse(args[1])); Write(message); } else if (command == "clean") { if (args.Length < 2) { continue; } var message = module.StartClean(args[1]); Write(message); } } }
private void HandleRequest(string data) { var subs = data.Split(' '); var module = new WifiModules.DW700(); if (subs[0].ToLower() == "error") { var message = module.NotifyError(Convert.ToInt32(subs[1])); _spc.Write(message); } else if (subs[0].ToLower() == "clean") { var message = module.StartClean(subs[1]); _spc.Write(message); } else { return; } ResponseToSender(); }