onMessage method
- WrappedMessage wrapper
Handles a non-heartbeat message, usually containing data or commands.
Implementation
@override
void onMessage(WrappedMessage wrapper) {
// ignore message if not a video message
if (wrapper.name != VideoCommand().messageName) return;
final command = VideoCommand.fromBuffer(wrapper.data);
sendMessage(command); // Echo the request
if (command.details.name == CameraName.ROVER_FRONT) {
// ROVER_FRONT is on the same camera as AUTONOMY_DEPTH
command.details.name = CameraName.AUTONOMY_DEPTH;
}
collection.parent.send(data: command, id: command.details.name);
}