sendCommand method

Future<int> sendCommand(
  1. TelloCommand command
)

Implementation

Future<int> sendCommand(TelloCommand command) async {
  _commandHistory.add(command);

  final data = command.execute();
  if (data.isEmpty || _sendEndpoint == null) return 0;

  final bufferList = utf8.encode(data);
  try {
    return await _sendSocket?.send(bufferList, Endpoint.unicast(InternetAddress(configuration.telloAddress), port: Port(configuration.telloPort))) ?? 0;
  } catch (e) {
    print("Error $e");
    return 0;
  }
}