parseAlarmEvents(xml: string): AlarmEvent[]
Reads every <AlarmEvent> from a decrypted cmd 33 push.
Elements other than <AlarmEvent>, such as <DayNightEvent>, are ignored,
and so is an <AlarmEvent> without a <channelId>.
Parse a push with AI detections
Parse a push with AI detections
import { assertEquals } from "@std/assert"; import { parseAlarmEvents } from "@hertzg/reolink-api/protocol/event"; const [event] = parseAlarmEvents( "<body><AlarmEventList><AlarmEvent>" + "<channelId>0</channelId><status>MD</status>" + "<AItype>people,vehicle</AItype>" + "</AlarmEvent></AlarmEventList></body>", ); assertEquals(event.motion, true); assertEquals(event.ai, ["people", "vehicle"]);
One AlarmEvent per <AlarmEvent> element, in document order.