public JObject ScanControllers() { JObject response = new JObject(); //Controller Serial Number //Number Of controllers List <WGController> controllers = WGController.ScanNet(Properties.Settings.Default.controllerPort); if (controllers == null) { response["message"] = "No controllers Found"; return(response); } response["message"] = $"{controllers.Count} controllers found"; List <ControllerScanResponse> scanResults = new List <ControllerScanResponse>(); foreach (WGController c in controllers) { scanResults.Add(new ControllerScanResponse(c.Connection.ID, 4)); } response["controllers"] = JToken.FromObject(scanResults); return(response); }
//TODO: Add Support For NonStandard Port Selection public JObject SearchControllers() { JObject response = new JObject(); //Controller Serial Number //Number Of Controllers List <WGController> controllers = WGController.ScanNet(Properties.Settings.Default.controllerPort); if (controllers == null) { response.Add(new JProperty("message", "No controllers Found")); response.Add(new JProperty("controllers", null)); return(response); } response.Add(new JProperty("message", $"{controllers.Count} controllers found")); List <UInt16> serialNumbers = new List <UInt16>(); foreach (WGController c in controllers) { serialNumbers.Add(c.Connection.ID); } response.Add(new JProperty("controllers", serialNumbers)); return(response); }