function parsePtzPresets
parsePtzPresets(xml: string): PtzPreset[]

Reads the saved presets from the reply to a cmd 190 request.

Presets without both an id and a name, which the camera lists for unused slots, are left out.

Examples

Read two presets

import { assertEquals } from "@std/assert";
import { parsePtzPresets } from "@hertzg/reolink-api/protocol/ptz";

const presets = parsePtzPresets(
  "<body><PtzPreset><presetList>" +
    "<preset><id>1</id><name>gate</name></preset>" +
    "<preset><id>2</id><name>porch</name></preset>" +
    "</presetList></PtzPreset></body>",
);

assertEquals(presets, [{ id: 1, name: "gate" }, { id: 2, name: "porch" }]);

Parameters

xml: string

The decrypted reply body.

Return Type

The saved presets, in reply order.

Usage

import { parsePtzPresets } from "protocol/ptz.ts";