/// <summary> /// Deprecated. Thread used to check for the disconnection of actuators during runtime /// </summary> /// <param name="obj"></param> /// <param name="e"></param> // TO DO - CHANGE void bgWorkerPollForActuatorsChanged(object obj, ProgressChangedEventArgs e) { Actuators.EnumerateActuators(); // If new actuator detected if (Actuators.Count < Actuators.GetDeviceCountNoOverwrite()) { //gWorkerErrorPolling.CancelAsync(); Actuators = new Actuators(); Actuators.InitializeActuators(); API.open_device(API.get_device_name(API.enumerate_devices(0, ""), 0)); Actuators.EnumerateActuators(); // Update new device count and get list index value int newIndex = Actuators.GetDeviceCount() - 1; // Add to list new actuator Actuators.List.Add(new ActuatorController(newIndex)); // Get new actuator's name Actuators.List[newIndex].DeviceName = Actuators.List[newIndex].GetDeviceName(Actuators.ActuatorEnumeration, newIndex); // Get new actuator's ID & open Actuators.List[newIndex].DeviceID = Actuators.List[newIndex].OpenDevice(Actuators.List[newIndex].DeviceName); // Get all of its info Actuators.List[newIndex].GetActuatorInformation(Actuators.List[newIndex].DeviceID); // Close new actuator Actuators.List[newIndex].CloseDevice(ref newIndex); //actuators.ProcessNewActuator(); //bgWorkerErrorPolling.RunWorkerAsync(); // Update UI somehow } }
/// <summary> /// Deprecated /// </summary> /// <returns></returns> // TO DELETE public int GetNewActuatorCount() { return(Actuators.GetDeviceCount()); }