Files
tello_drone/Tello Drone/DroneComands.cs
2019-09-04 18:36:26 -06:00

30 lines
695 B
C#

using System;
using System.Net;
namespace Tello_Drone
{
public class DroneComands : IDroneCommands
{
private readonly IUdpClientWrapper _udpClient;
public DroneComands(IConsoleLogger consoleLogger)
{
var udpClient = new UdpClientWrapper(consoleLogger);
_udpClient = udpClient;
}
public bool Forward() => SendCommand("Forward");
public bool Reverse() => SendCommand("Reverse");
public bool Up() => SendCommand("Up");
public bool Down() => SendCommand("Down");
private bool SendCommand(string message)
{
return _udpClient.TrySend(message, 1_500);
}
}
}