replyFromVirtualDevice method

void replyFromVirtualDevice(
  1. int seqNr,
  2. UrpResponse response
)

Implementation

void replyFromVirtualDevice(int seqNr, UrpResponse response) {
  final message = UrpMessage(
    header: UrpMessageHeader(
      seqNr: seqNr,
      origin: UrpDeviceIdentifier(
        deviceClass: UrpDeviceClass.urpReader,
        deviceType: _connectedReaderType!,
        id: _connectedReaderAddress!,
      ),
      target: UrpDeviceIdentifier(
        deviceClass: UrpDeviceClass.urpHost,
        id: "host",
      ),
    ),
    response: response,
  );

  final bytes = message.writeToBuffer();
  final length = _int16ToBytes(bytes.length);

  onData(Uint8List.fromList(length + bytes));
}