windowsDiscovery method

Future<void> windowsDiscovery(
  1. Duration duration
)

Implementation

Future<void> windowsDiscovery(Duration duration) async {
  final data = calloc<_OnvifDiscoveryData>();

  final probeMessageData =
      Transport.probe(Uuid().v4()).toXmlString().toNativeUtf8();

  final devices = _discovery(data, probeMessageData, duration.inMilliseconds);

  for (var index = 0; index < devices; index++) {
    var envelope = Envelope.fromXml(
        Pointer.fromAddress(data.address + index * 8192)
            .cast<Utf8>()
            .toDartString());

    onvifDevices
        .addAll(ProbeMatches.fromJson(envelope.body.response!).probeMatches);
  }

  malloc.free(probeMessageData);
  calloc.free(data);
}