onDisconnect method
inherited
Sends a Disconnect
message to the dashboard and sets destination to null
.
Override this function to run custom code when the dashboard disconnects, but be sure to call
super.onDisconnect()
as well. For example, put code to stop the rover from driving in here
to prevent it from crashing when connection is lost.
Implementation
@mustCallSuper
void onDisconnect() {
logger.info("Port $port is disconnected from $destination");
sendMessage(Disconnect(sender: device));
destination = null;
}