getDiscoveryMode method Null safety

Future<String> getDiscoveryMode()

This operation gets the discovery mode of a device. See Section 7.2 for the definition of the different device discovery modes. The device shall support retrieval of the discovery mode setting through the GetDiscoveryMode command.

Implementation

Future<String> getDiscoveryMode() async {
  loggy.debug('getDiscoveryMode');
  final envelope = await Soap.retrieveEnvelope(
      uri, onvif.secureRequest(SoapRequest.discoveryMode()));

  if (envelope.body.discoveryModeResponse == null) throw Exception();

  return envelope.body.discoveryModeResponse!.discoveryMode;
}