init method
override
Initializes the connection to the device.
Implementation
@override
Future<bool> init() async {
_commands = collection.videoServer.messages.onMessage<VideoCommand>(
name: VideoCommand().messageName,
constructor: VideoCommand.fromBuffer,
callback: _handleCommand,
);
parent.init();
_data = parent.stream.listen(onData);
for (final name in CameraName.values) {
switch (name) {
case CameraName.CAMERA_NAME_UNDEFINED: continue;
case CameraName.AUTONOMY_DEPTH:
final details = getRealsenseDetails(name);
final isolate = RealSenseIsolate(details: details);
await parent.spawn(isolate);
// All other cameras share the same logic, even future cameras
default: // ignore: no_default_cases
final details = getDefaultDetails(name);
final isolate = OpenCVCameraIsolate(details: details);
await parent.spawn(isolate);
}
}
return true;
}