/// <summary> /// Log events that refer to errors raised in methods contained in the class Controller.ActuatorController /// </summary> /// <param name="errorLog">represents all possible log types, of type Entities.Enums.ActuatorLog</param> /// <param name="deviceID">identifies actuator, of type int</param> /// <param name="ex">exception object from parent caller, of type System.Exception</param> public void LogActuatorError(Enums.ActuatorLog errorLog, int deviceID = -1, Exception ex = null) { switch (errorLog) { case Enums.ActuatorLog.CloseDevice: Logger.Log.Error("API.close_device(ref deviceID) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.MoveHome: Logger.Log.Error("API.command_home(deviceID) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.MoveLeft: Logger.Log.Error("API.command_left(deviceID) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.MoveToPosition: Logger.Log.Error("API.command_move(deviceID, base.PositionSteps = positionSteps, base.PositionMicrosteps = positionMicrosteps) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.MoveRelatively: Logger.Log.Error("API.command_movr(deviceID, base.DeltaSteps = deltaSteps, base.DeltaMicrosteps = deltaSteps) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.PowerOff: Logger.Log.Error("API.command_power_off(deviceID) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.MoveRight: Logger.Log.Error(" API.command_right(deviceID) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.SoftStop: Logger.Log.Error("API.command_sstp(deviceID) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.HardStop: Logger.Log.Error("API.command_stop(deviceID) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.WaitForStop: Logger.Log.Error("API.command_wait_for_stop(deviceID, base.WaitForStopMs = ms) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.OpenDevice: Logger.Log.Error("API.open_device(deviceName) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; case Enums.ActuatorLog.SetZero: Logger.Log.Error(" API.command_zero(deviceID) failed on device with ID = " + deviceID + ", exception thrown is: " + ex); break; default: break; } }
/// <summary> /// Log events that refer to the execution of methods contained in the class Controller.ActuatorController /// </summary> /// <param name="infoLog">represents all possible log types, of type Entities.Enums.ActuatorLog</param> /// <param name="actuator">object of type Controller.ActuatorController </param> /// <param name="ActuatorLogTiming">defines either start, end, or don't care of the time when event occurs, of type >Entities.Enums.ActuatorLogTiming</param> // Parameters ActuatorController and Enums.ActuatorLogTiming are optional // LogActuatorInfo can be called with either 1, 2, or 3 parameters public void LogActuatorInfo(Enums.ActuatorLog infoLog, ActuatorController actuator = dummyActuator, Enums.ActuatorLogTiming ActuatorLogTiming = Enums.ActuatorLogTiming.DontCare) { //switch (infoLog) //{ // case Enums.ActuatorLog.CloseDevice: // Logger.Log.Info(actuator.DeviceName + " was successfully closed"); // break; // case Enums.ActuatorLog.MoveHome: // if (ActuatorLogTiming == Enums.ActuatorLogTiming.Start) // Logger.Log.Info(actuator.DeviceName + " intends to move to home position (0 steps, 0 microsteps)" + // " with the speed" + " TO BE IMPELMENTED BLYAT"); // else // { // actuator.GetStatus(actuator.DeviceID); // Logger.Log.Info(actuator.DeviceName + " arrived at home position (" + actuator.Status.uCurPosition + " steps and " + // actuator.Status.uCurPosition + " microsteps) with the speed"); // } // break; // case Enums.ActuatorLog.MoveLeft: // Logger.Log.Info(actuator.DeviceName + " started moving continuously left"); // break; // case Enums.ActuatorLog.MoveToPosition: // if (ActuatorLogTiming == Enums.ActuatorLogTiming.Start) // Logger.Log.Info(actuator.DeviceName + " intends to move to position " + actuator.PositionSteps + " steps and " + // actuator.PositionMicrosteps + " microsteps with the speed"); // else // { // actuator.GetStatus(actuator.DeviceID); // Logger.Log.Info(actuator.DeviceName + " arrived at position " + actuator.Status.CurPosition + " steps and " + // actuator.Status.uCurPosition + " microsteps with the speed"); // } // break; // case Enums.ActuatorLog.MoveRelatively: // if (ActuatorLogTiming == Enums.ActuatorLogTiming.Start) // Logger.Log.Info(actuator.DeviceName + " intends to shift by " + actuator.DeltaSteps + " steps and " + // actuator.DeltaMicrosteps + " microsteps with the speed"); // else // { // actuator.GetStatus(actuator.DeviceID); // Logger.Log.Info(actuator.DeviceName + " arrived at position " + actuator.Status.CurPosition + " steps and " + // actuator.Status.uCurPosition + " microsteps with the speed"); // } // break; // case Enums.ActuatorLog.PowerOff: // Logger.Log.Info(actuator.DeviceName + " successfully powered off"); // break; // case Enums.ActuatorLog.MoveRight: // Logger.Log.Info(actuator.DeviceName + " started moving continuously right"); // break; // case Enums.ActuatorLog.SoftStop: // if (ActuatorLogTiming == Enums.ActuatorLogTiming.Start) // Logger.Log.Info(actuator.DeviceName + " intends to soft stop"); // else // { // actuator.GetStatus(actuator.DeviceID); // Logger.Log.Info(actuator.DeviceName + " soft stopped at postion " + actuator.Status.CurPosition + " steps and " + // actuator.Status.uCurPosition + " microsteps "); // } // break; // case Enums.ActuatorLog.HardStop: // if (ActuatorLogTiming == Enums.ActuatorLogTiming.Start) // Logger.Log.Info(actuator.DeviceName + " intends to hard stop"); // else // { // actuator.GetStatus(actuator.DeviceID); // Logger.Log.Info(actuator.DeviceName + " hard stopped at postion" + actuator.Status.CurPosition + " steps and " + // actuator.Status.uCurPosition + " microsteps "); // } // break; // case Enums.ActuatorLog.SetZero: // Logger.Log.Info(actuator.DeviceName + " successfully set its new home (zero) position"); // break; // case Enums.ActuatorLog.WaitForStop: // Logger.Log.Info(actuator.DeviceName + " successfully waited and stopped"); // break; // case Enums.ActuatorLog.OpenDevice: // Logger.Log.Info(actuator.DeviceName + " was successfully opened"); // break; // case Enums.ActuatorLog.NewActuatorInContext: // Logger.Log.Info("Actuator with ID = " + actuator.DeviceID + " and name = " + actuator.DeviceName + " was brought into context"); // break; // default: break; //} }