getDeviceInformation method

Future<Map<String, String>> getDeviceInformation()

Retrieves the device information (Manufacturer, Model, Serial, etc.).

Implementation

Future<Map<String, String>> getDeviceInformation() async {
  const String body = '<tds:GetDeviceInformation/>';
  final response = await client.soapRequest(body,
      action: 'http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation');

  final document = XmlDocument.parse(response);
  const tdsNs = 'http://www.onvif.org/ver10/device/wsdl';
  final element = document
      .findAllElements('GetDeviceInformationResponse', namespace: tdsNs)
      .first;

  return {
    'Manufacturer': element
        .findElements('Manufacturer', namespace: tdsNs)
        .first
        .innerText,
    'Model': element.findElements('Model', namespace: tdsNs).first.innerText,
    'FirmwareVersion': element
        .findElements('FirmwareVersion', namespace: tdsNs)
        .first
        .innerText,
    'SerialNumber': element
        .findElements('SerialNumber', namespace: tdsNs)
        .first
        .innerText,
    'HardwareId':
        element.findElements('HardwareId', namespace: tdsNs).first.innerText,
  };
}