Privacy mode, which Reolink also calls sleep: the camera stops recording and streaming until it is turned off again.
cmd 575, privacyModeXml(true) -> empty status-200 reply cmd 574, no body -> <sleepState><sleep>1</sleep></sleepState>
Both requests address the channel through the message extension.
Turn privacy mode on, then read it back
Turn privacy mode on, then read it back
import { assertEquals, assertStringIncludes } from "@std/assert"; import { parsePrivacyMode, privacyModeXml, } from "@hertzg/reolink-api/protocol/privacy"; assertStringIncludes(privacyModeXml(true), "<sleep>1</sleep>"); assertEquals( parsePrivacyMode("<body><sleepState><sleep>1</sleep></sleepState></body>"), true, );
f
parsePrivacyMode(xml: string): boolean
Reads the privacy mode state from the reply to a cmd 574 request.
f
privacyModeXml(enabled: boolean): string
Builds the body of a request that turns privacy mode on or off.
Usage
import * as mod from "protocol/privacy.ts";