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 transport.sendRequest(
      uri,
      transport
          .securedEnvelope(soap.DeviceManagementRequest.discoveryMode()));

  if (envelope.body.hasFault) {
    throw Exception(envelope.body.fault.toString());
  }

  return GetDiscoveryModeResponse.fromJson(envelope.body.response!)
      .discoveryMode;
}