ZwRequest<T> constructor

ZwRequest<T>(
  1. Logger logger,
  2. int nodeId,
  3. List<int> data, {
  4. T processResponse(
    1. List<int> data
    )?,
  5. Duration responseTimeout = const Duration(seconds: 5),
  6. Object? resultKey,
  7. Duration resultTimeout = const Duration(seconds: 5),
})

Construct a request to be sent to a device.

If a result is expected as a response then provide processResponse to process that result and optionally specify responseTimeout if other than 5 seconds.

If a result is expected as an unsolicited request from the device following this request, then specify a resultKey and optionally specify resultTimeout if other than 5 seconds. After the node receives and processes the unsolicited request associated with this request, it should call the ZwManager's processedResult(resultKey) to signal that this request is complete.

Implementation

ZwRequest(this.logger, this.nodeId, this.data,
    {this.processResponse,
    this.responseTimeout = const Duration(seconds: 5),
    this.resultKey,
    this.resultTimeout = const Duration(seconds: 5)}) {
  _validate(logger != null, 'missing logger');
  _validate(data != null, 'data must not be null');
  _validate(processResponse == null || responseTimeout != null,
      'must specify responseTimeout with processResponse');
  _validate(resultKey == null || resultTimeout != null,
      'must specify resultTimeout with resultKey');
}