public RobotModel(Robot pRobot) { identification = new RobotIdentificationModel(pRobot.Identification); active = Convert.ToString(pRobot.Active); position = new PositionModel(pRobot.Position); speed = pRobot.Speed + " cm/s"; ultrasonic = pRobot.Ultrasonic + " m"; gyro = pRobot.Gyro + " °"; switch ((RobotType)Enum.Parse(typeof(RobotType), pRobot.Identification.Subtype)) { case RobotType.ThreeWheelDrive: imageUrl = "ThreeWheelDrive.png"; break; default: imageUrl = "FleeAndCatch_Logo.png"; break; } }
/// <summary> /// Create an object of an robot for a json command. /// </summary> /// <param name="pId">Id of the robot in communication.</param> public RobotModel(RobotIdentificationModel pIdentification, bool pActive, PositionModel pPosition, double pSpeed, double pUltrasonic, double pGyro) { identification = pIdentification; active = Convert.ToString(pActive); position = pPosition; speed = Convert.ToString(pSpeed) + " cm/s"; ultrasonic = "U: " + Convert.ToString(pUltrasonic) + " m"; gyro = "G: " + Convert.ToString(pGyro) + " °"; switch ((RobotType)Enum.Parse(typeof(RobotType), pIdentification.Subtype)) { case RobotType.ThreeWheelDrive: imageUrl = "ThreeWheelDrive.png"; break; default: imageUrl = "FleeAndCatch_Logo.png"; break; } }