validateTransportOptions static method

void validateTransportOptions(
  1. Set<LSLTransportOptions> options,
  2. LSLStreamInfo streamInfo
)

Validates a transport-option set against a stream's channel format.

Throws: ArgumentError for combinations liblsl does not support.

Implementation

static void validateTransportOptions(
  Set<LSLTransportOptions> options,
  LSLStreamInfo streamInfo,
) {
  if (options.contains(LSLTransportOptions.syncBlocking) &&
      streamInfo.channelFormat == LSLChannelFormat.string) {
    throw ArgumentError(
      'LSLTransportOptions.syncBlocking is incompatible with '
      'string/variable-length channel formats',
    );
  }
  if (options.contains(LSLTransportOptions.bufsizeInSamples) &&
      options.contains(LSLTransportOptions.bufsizeInThousandths)) {
    throw ArgumentError(
      'bufsizeInSamples and bufsizeInThousandths are mutually exclusive '
      'interpretations of maxBuffer',
    );
  }
}