public static RobotCommandArgs ParseCommands(string Command) { // Data MUST be in the format: [leftwheel],[rightwheel] // Allow errors to bubble for now. we're proof of concept stage. // Eventually we'll want to return Key-Value Pairs; RobotCommandArgs res = new RobotCommandArgs(); char[] delimiters = { ',' }; string[] speeds = Command.Split(delimiters); for (int i = 0; i <= 1; i++) { switch (i) { case 0: res.LeftWheelSpeed = int.Parse(speeds[i]); break; case 1: res.RightWheelSpeed = int.Parse(speeds[i]); break; } } return res; }
public static string ParseCommands(RobotCommandArgs args) { string ret = string.Format("{0},{1}", args.LeftWheelSpeed.ToString(), args.RightWheelSpeed.ToString()); return ret; }
/// <summary> /// /// </summary> /// <param name="command"></param> /// <returns></returns> public async Task<RobotResponseArgs> SendCommandToRobotAsync(RobotCommandArgs command) { throw new NotImplementedException(); }
/// <summary> /// /// </summary> /// <param name="command"></param> /// <returns></returns> public string SendCommandToRobot(RobotCommandArgs command) { // Create a new Socket and send our command return ""; }