setup method
Implementation
Future<Tello> setup() async {
try {
if (_receiveSocket != null || _sendSocket != null) {
await destroy();
}
// setup the endpoint configurations: InternetAddress(configuration.telloAddress),
_sendEndpoint = Endpoint.any(port: Port(configuration.telloPort));
_receiveEndpoint = Endpoint.loopback(port: Port(configuration.receivePort));
// bind
_sendSocket = await UDP.bind(_sendEndpoint!);
final result = await sendCommand(StartupCommand());
print("Command: $result");
_receiveSocket = await UDP.bind(_receiveEndpoint!);
} catch (e) {
print("Error in setup: $e");
}
return this;
}