Reolink camera client over Baichuan, Reolink's own TCP protocol (port 9000).

Logs in, streams the camera's push events (doorbell presses, motion, tamper and AI detections), and controls the camera: siren, privacy mode, snapshots and PTZ. Battery cameras and doorbells without an HTTP API speak only this protocol. The client is environment-agnostic: the caller opens the socket and passes in its streams, and reconnects by building a new client on a new socket.

TCP :9000 ─> nonce (cmd 1) ─> login (cmd 1) ─> AES session key
          ─> subscribe (cmd 31) ─> cmd 33 pushes ─> AlarmEvent stream
          ─> siren (263), privacy mode (574/575), snapshot (109),
             PTZ (18, 19, 190)
          ─> any of the firmware's 225 commands: client.call(COMMANDS.X)
          ─> every push, typed by PUSHES: client.pushes()

Every layer is its own entry point: encoding/header, encoding/cipher, protocol/message, protocol/login, protocol/event, protocol/siren, protocol/privacy, protocol/snapshot, protocol/ptz, protocol/xml, protocol/command, protocol/params, protocol/commands, streams/encode, streams/decode and client.

Examples

Stream doorbell and motion events

import { createClient } from "@hertzg/reolink-api";

const conn = await Deno.connect({ hostname: "192.168.1.10", port: 9000 });
const client = createClient({ readable: conn.readable, writable: conn.writable });

await client.login({ username: "admin", password: "secret" });
const events = await client.subscribe();

for await (const event of events) {
  // { channel: 0, motion: true, visitor: false, tamper: false, ai: ["people"] }
  console.log(event);
}

await client.close();
conn.close();

Read a setting with any command

import { COMMANDS, createClient } from "@hertzg/reolink-api";

const conn = await Deno.connect({ hostname: "192.168.1.10", port: 9000 });
const client = createClient({ readable: conn.readable, writable: conn.writable });

await client.login({ username: "admin", password: "secret" });
const { body } = await client.call(COMMANDS.GET_NTPCFG_V20);
console.log(body.Ntp);

await client.close();
conn.close();

Take a snapshot and sound the siren

import { createClient } from "@hertzg/reolink-api";

const conn = await Deno.connect({ hostname: "192.168.1.10", port: 9000 });
const client = createClient({ readable: conn.readable, writable: conn.writable });

await client.login({ username: "admin", password: "secret" });
await Deno.writeFile("front-door.jpg", await client.snapshot());
await client.playSiren({ times: 2 });

await client.close();
conn.close();

Functions

f
createClient(options: ClientOptions): Client

Creates a Baichuan client over the given connection streams.

Type Aliases

T
AlarmEvent = { channel: number; motion: boolean; visitor: boolean; tamper: boolean; ai: string[]; }

The alarm state of one channel, as the camera pushed it.

T
CallOptions<C extends Command> = { channel?: number; body?: CommandBody<C>; }

Options for Client.call.

T
CallReply<C extends Command> = { body: CommandBody<C>; payload: Uint8Array; }

The reply to Client.call.

T
ChannelOptions = { channel?: number; }

Which camera a request is about.

  • channel: number

    The zero-based channel number. A standalone camera is 0, the default.

T
Client = { login: (options: LoginOptions) => Promise<void>; subscribe: (options?: SubscribeOptions) => Promise<ReadableStream<AlarmEvent>>; playSiren: (options?: ChannelOptions & { times?: number; }) => Promise<void>; startSiren: (options?: ChannelOptions) => Promise<void>; stopSiren: (options?: ChannelOptions) => Promise<void>; privacyMode: (options?: ChannelOptions) => Promise<boolean>; setPrivacyMode: (options: ChannelOptions & { enabled: boolean; }) => Promise<void>; snapshot: (options?: ChannelOptions & { stream?: "main" | "sub"; }) => Promise<Uint8Array>; ptz: (options: ChannelOptions & { command: PtzCommand; speed?: number; }) => Promise<void>; ptzPresets: (options?: ChannelOptions) => Promise<PtzPreset[]>; ptzGoToPreset: (options: ChannelOptions & { id: number; }) => Promise<void>; ptzPosition: (options?: ChannelOptions) => Promise<PtzPosition>; call: <C extends Command>(
command: C,
options?: CallOptions<C>
) => Promise<CallReply<C>>
; pushes: () => ReadableStream<Push>; close: () => Promise<void>; }

A Baichuan client bound to one connection.

T
Command<P extends readonly AnyXmlParam[] = readonly AnyXmlParam[]> = { id: number; name: string; params: P; firmware: readonly Firmware[]; }

A Baichuan command: its id, firmware name, and parameter elements.

  • firmware: readonly Firmware[]

    The firmware builds known to register the command, empty when unknown. Registration does not promise that a given device answers it.

  • id: number

    The command id sent in the message header.

  • name: string

    The name the firmware's dispatch table gives the command.

  • params: P

    The parameter elements the command's bodies may carry.

T
CommandBody<C extends Command> = [P in C["params"][number] in keyof P["name"]]?: XmlParamValue<P>

The body of a Command, request or reply: each of its parameters by element name, all optional.

T
Commands = { HEART_BEAT_V20: Command<readonly [heartBeat]>; LOGIN: Command<
readonly [
loginUser,
loginNet,
ipcVersionList,
deviceInfo,
streamInfoList,
loginErrInfo,
accessInfo
]
>
; LOGOUT: Command<readonly [loginUser]>; START_PREVIEW: Command<readonly [preview]>; STOP_PREVIEW: Command<readonly [preview]>; START_REPLAY: Command<readonly [fileInfoList]>; STOP_REPLAY: Command<readonly [fileInfoList]>; DOWNLOAD_V20: Command<readonly [fileInfoList]>; DOWNLOAD_STOP_V20: Command<readonly [fileInfoList]>; GET_TALK_ABILITY: Command<readonly [talkAbility]>; TALK_CLOSE_V20: Command<readonly []>; FILE_INFO: Command<readonly [fileInfoList]>; SEARCH_OPEN: Command<readonly [fileInfoList]>; SEARCH_FILE: Command<readonly [fileInfoList]>; SEARCH_CLOSE: Command<readonly [fileInfoList]>; PTZ_CONTROL_V20: Command<readonly [ptzControl]>; PTZ_PRESET_V20: Command<readonly [ptzPreset]>; PTZ_CRUISE_V20: Command<readonly [ptzCruise]>; REBOOT_V20: Command<readonly []>; SETVEDIOPARAM_V20: Command<readonly [videoInput, inputAdvanceCfg]>; GETVEDIOPARAM_V20: Command<readonly [videoInput, inputAdvanceCfg]>; START_ALARM_REPORT: Command<readonly []>; SET_NETPORT_CFG_V20: Command<
readonly [
serverPort,
httpPort,
rtspPort,
onvifPort,
httpsPort,
rtmpPort
]
>
; GET_NETPORT_CFG_V20: Command<
readonly [
serverPort,
httpPort,
rtspPort,
onvifPort,
httpsPort,
rtmpPort
]
>
; GET_NTPCFG_V20: Command<readonly [ntp]>; SET_NTPCFG_V20: Command<readonly [ntp]>; GET_DDNSCFG_V20: Command<readonly [ddns]>; SET_DDNSCFG_V20: Command<readonly [ddns]>; GET_EMAILCFG_V20: Command<readonly [email]>; SET_EMAILCFG_V20: Command<readonly [email]>; GET_OSD_CFG_V20: Command<readonly [osdChannelName, osdDatetime]>; SET_OSD_CFG_V20: Command<readonly [osdChannelName, osdDatetime]>; GET_MD_CFG_V20: Command<readonly [md]>; SET_MD_CFG_V20: Command<readonly [md]>; GET_SHELTER_CFG_V20: Command<readonly [shelter]>; SET_SHELTER_CFG_V20: Command<readonly [shelter]>; GET_RECORD_V20: Command<readonly [recordCfg]>; SET_RECORD_V20: Command<readonly [recordCfg]>; GET_COMPRESSIONCFG_V20: Command<readonly [compression]>; SET_COMPRESSIONCFG_V20: Command<readonly [compression]>; GET_USERCFG_V20: Command<readonly [abilitySuppport, userList]>; SET_USERCFG_V20: Command<readonly [userList]>; GET_PTZCRUISE_V20: Command<readonly [ptzCruise]>; EXPORT_CFG_V20: Command<readonly [configFileInfo]>; UPDATE_DEVICE: Command<readonly [configFileInfo, paramDataV20]>; GET_FTPCFG_V20: Command<readonly [ftp]>; SET_FTPCFG_V20: Command<readonly [ftp]>; GET_FTPTASK_V20: Command<readonly [ftpTask]>; SET_FTPTASK_V20: Command<readonly [ftpTask]>; GET_LOCAL_LINK_V20: Command<readonly [dhcp, autoDns, ip, dns]>; SET_LOCAL_LINK_V20: Command<readonly [dhcp, autoDns, ip, dns]>; GET_VERSION_V20: Command<readonly [versionInfo]>; GET_RECSCHEDULE_V20: Command<readonly [record]>; SET_RECSCHEDULE_V20: Command<readonly [record]>; GET_LINK_TYPE: Command<readonly [linkType]>; GET_UPNPSTATE_V20: Command<readonly [upnp]>; SET_UPNPSTATE_V20: Command<readonly [upnp]>; SET_RESTORE_V20: Command<readonly [restore]>; SET_AUTO_REBOOT_CFG_V20: Command<readonly [autoReboot]>; GET_AUTO_REBOOT_CFG_V20: Command<readonly [autoReboot]>; GET_HDD_CFG_V20: Command<readonly [hddInfoList]>; INIT_HDD_V20: Command<readonly [hddInitList]>; GET_SYSGENERAL_CFG_V20: Command<readonly [systemGeneral, norm]>; SET_SYSGENERAL_CFG_V20: Command<readonly [systemGeneral, norm]>; GET_DST_CFG_V20: Command<readonly [dst]>; SET_DST_CFG_V20: Command<readonly [dst]>; SNAP_V20: Command<readonly [snap]>; GET_DEF_OSD_CFG_V20: Command<readonly [osdChannelName, osdDatetime]>; GET_DEF_INPUT_CFG_V20: Command<readonly [videoInput, shelter]>; GET_DEF_ENC_CFG_V20: Command<readonly [compression]>; GET_DEF_MD_CFG_V20: Command<readonly [md]>; GET_UID_CFG_V20: Command<readonly [uid]>; GET_WIFI_SIGNAL_V20: Command<readonly [wifiSignal]>; GET_WIFI_INFO_V20: Command<readonly [wifi]>; SET_WIFI_INFO_V20: Command<readonly [wifi]>; GET_USER_ONLINE_V20: Command<readonly [onlineUserList]>; SET_USER_ONLINE_V20: Command<readonly [onlineUserList]>; INFO_PERFORMANCE_V20: Command<readonly [performanceInfo]>; REPLAY_SEEK: Command<readonly [replaySeek]>; PUSH_ADD_V20: Command<readonly [pushInfo, pushRspInfo]>; PUSH_DEL_V20: Command<readonly [pushInfo]>; GET_DEF_ISP_CFG_V20: Command<readonly [inputAdvanceCfg, videoInput]>; EMAIL_TEST_V20: Command<readonly [email]>; GET_DAY_RECORD: Command<readonly [dayRecords]>; DOWNLOAD_CUT_V20: Command<readonly [fileInfoList]>; DOWNLOAD_CUT_STOP_V20: Command<readonly []>; GET_ENC_CAPABILITY_V20: Command<readonly [streamInfoList]>; GET_ABILITY: Command<readonly [abilityInfo]>; CGI_GET_POWER_LINE_FREQUENCY: Command<readonly [inputAdvanceCfg, powerLineFrequency]>; CGI_SET_POWER_LINE_FREQUENCY: Command<readonly [inputAdvanceCfg]>; CGI_GET_EXPOSURE: Command<readonly [inputAdvanceCfg, exposureCfg]>; CGI_SET_EXPOSURE: Command<readonly [inputAdvanceCfg]>; CGI_GET_SHUTTER: Command<readonly [inputAdvanceCfg, shutter]>; CGI_SET_SHUTTER: Command<readonly [inputAdvanceCfg]>; CGI_GET_GAIN: Command<readonly [inputAdvanceCfg, gain]>; CGI_SET_GAIN: Command<readonly [inputAdvanceCfg]>; CGI_GET_SCENE: Command<readonly [inputAdvanceCfg, scene]>; CGI_SET_SCENE: Command<readonly [inputAdvanceCfg]>; CGI_GET_DAY_NIGHT_MODE: Command<readonly [inputAdvanceCfg, dayNightMode]>; CGI_SET_DAY_NIGHT_MODE: Command<readonly [inputAdvanceCfg]>; CGI_GET_IRCUT_MODE: Command<readonly [inputAdvanceCfg, ircutMode]>; CGI_SET_IRCUT_MODE: Command<readonly [inputAdvanceCfg]>; CGI_GET_BLC: Command<readonly [inputAdvanceCfg, blc]>; CGI_SET_BLC: Command<readonly [inputAdvanceCfg]>; CGI_GET_MIRROR: Command<readonly [inputAdvanceCfg, mirror]>; CGI_SET_MIRROR: Command<readonly [inputAdvanceCfg]>; CGI_GET_FLIP: Command<readonly [inputAdvanceCfg, flip]>; CGI_SET_FLIP: Command<readonly [inputAdvanceCfg]>; IFRAME_REQUEST: Command<readonly [requestIframe]>; GET_PTZ_PRESET_V20: Command<readonly [ptzPreset]>; ONLINE_UPDATE_V20: Command<readonly [onlineUpdate]>; START_ALARM_REPORT_192: Command<readonly []>; FTP_TEST_V20: Command<readonly [ftp, ftpTestResult]>; UPDATE_CFG_GET_V20: Command<readonly [autoUpdate]>; UPDATE_CFG_SET_V20: Command<readonly [autoUpdate]>; GET_ONLINE_NEW_FW_V20: Command<readonly [onlineNewFirmwareInfo]>; GET_SCAN_AP_V20: Command<readonly [scanAp]>; GET_SUPPORT: Command<readonly [support]>; WIFI_TEST_V20: Command<readonly [wifi]>; TALK_OPEN_V20: Command<readonly [talkConfig]>; TALK_FDX_STREAM_V20: Command<readonly [paramDataV20]>; GET_LED_STATE_V20: Command<readonly [ledState]>; SET_LED_STATE_V20: Command<readonly [ledState]>; GET_PTOP_CFG_V20: Command<readonly [ptop]>; SET_PTOP_CFG_V20: Command<readonly [ptop]>; GET_RF_CFG_V20: Command<readonly [rfAlarmCfg]>; SET_RF_CFG_V20: Command<readonly [rfAlarmCfg]>; SET_EMAILTASK_V20: Command<readonly [emailTask]>; GET_EMAILTASK_V20: Command<readonly [emailTask]>; SET_PUSHTASK_V20: Command<readonly [pushTask]>; GET_PUSHTASK_V20: Command<readonly [pushTask]>; GET_AUTO_FOCUS_V20: Command<readonly [autoFocus]>; SET_AUTO_FOCUS_V20: Command<readonly [autoFocus]>; GET_ONLINE_UPDATE_STATE: Command<readonly [upgradeState]>; GET_CROP_V20: Command<readonly [crop]>; SET_CROP_V20: Command<readonly [crop]>; CROP_SNAP_V20: Command<readonly [cropSnap, cropSnapReply]>; SET_AUDIOTASK_V20: Command<readonly [audioTask]>; GET_AUDIOTASK_V20: Command<readonly [audioTask]>; SET_DEVICE_SLEEP: Command<readonly []>; SET_CLOUD_TASK_V20: Command<readonly [cloudTask]>; GET_CLOUD_TASK_V20: Command<readonly [cloudTask]>; GET_BAT_INFO_V20: Command<readonly [chargeBatteryInfo, batteryInfo]>; GET_4GNET_INFO: Command<readonly [net3g4gInfo]>; GET_4GMODULE_INFO: Command<readonly [net3g4gModuleInfo]>; GET_BATTERY_REMAIN_V20: Command<readonly [batteryRemainList]>; GET_AUDIO_INFO_V20: Command<readonly [audioFileInfo]>; IMPORT_AUDIO_V20: Command<readonly [audioFileInfo, paramDataV20]>; SAVE_AUDIO_V20: Command<readonly [audioFileInfo]>; PLAY_AUDIO_V20: Command<readonly [audioPlayInfo]>; GET_AUDIO_CFG_V20: Command<readonly [audioCfg]>; SET_AUDIO_CFG_V20: Command<readonly [audioCfg]>; MUTE_AUDIO_V20: Command<readonly [muteAudio]>; GET_AUDIO_ENCODE_ABILITY_V20: Command<readonly [audioEncodeAbility]>; NEW_GET_CLOUD_BIND_INFO_V20: Command<readonly [cloudBindInfo]>; NEW_BIND_CLOUD_V20: Command<readonly [bindCloud]>; GET_CLOUD_CFG_V20: Command<readonly [cloudUploadCfg]>; SET_CLOUD_CFG_V20: Command<readonly [cloudUploadCfg]>; START_FIND_ALARM_VIDEO_V20: Command<readonly [findAlarmVideo]>; DO_FIND_ALARM_VIDEO_V20: Command<readonly [findAlarmVideo, alarmVideoInfo]>; STOP_FIND_ALARM_VIDEO_V20: Command<readonly [findAlarmVideo]>; BIND_NAS: Command<readonly [bindUnbindNas]>; UNBIND_NAS: Command<readonly [bindUnbindNas]>; GET_BIND_INFO_V20: Command<readonly [bindNasInfoList]>; GET_CLOUD_LOGIN_V20: Command<readonly [cloudLoginKey]>; SET_CLOUD_LOGIN_V20: Command<readonly [cloudLoginKey]>; SET_GOP_V20: Command<readonly [gopCfg]>; SET_TIME_V20: Command<readonly [timeCfg]>; SET_FLOODLIGHT_STATUS: Command<readonly [floodlightManual]>; GET_FLOODLIGHT_TASK: Command<readonly [floodlightTask]>; SET_FLOODLIGHT_TASK: Command<readonly [floodlightTask]>; GET_ZOOM_FOCUS_INFO_V20: Command<readonly [zoomFocusInfo, ptzZoomFocus]>; GET_ZOOM_FOCUS_INFO_V20_295: Command<readonly [startZoomFocus]>; GET_DAY_NIGHT_THRESHOLD_V20: Command<readonly [dayNightThreshold]>; SET_DAY_NIGHT_THRESHOLD_V20: Command<readonly [dayNightThreshold]>; COVER_PREVIEW: Command<readonly [coverPreview]>; GET_AI_CFG: Command<readonly [aiCfg]>; SET_AI_CFG: Command<readonly [aiCfg]>; GET_NAS_CFG: Command<readonly [nasUploadCfg]>; SET_NAS_CFG: Command<readonly [nasUploadCfg]>; GET_TIMELAPSE_CFG_V20: Command<readonly [timelapseCfg]>; SET_TIMELAPSE_CFG_V20: Command<readonly [timelapseCfg]>; GET_TIMELAPSE_TASK_V20: Command<readonly [timelapseTasks]>; GET_TIMELAPSE_DATE_V20: Command<readonly [timelapseDateTbl]>; GET_TIMELAPSE_OPEN_V20: Command<readonly [timelapseFileSearch]>; GET_TIMELAPSE_NEXT_V20: Command<readonly [timelapseFileSearch]>; GET_TIMELAPSE_CLOSE_V20: Command<readonly [timelapseFileSearch]>; GET_TIMELAPSE_FILE_COVER_V20: Command<readonly [timelapseCover]>; GET_TIMELAPSE_DOWNLOAD_V20: Command<readonly [timelapseDownload]>; GET_TIMELAPSE_DLD_STOP_V20: Command<readonly []>; GET_TIMELAPSE_DELETE_V20: Command<readonly [timelapseTaskDel]>; GET_TIMELAPSE_FILE_DEL_V20: Command<readonly [timelapseFileDel]>; SET_GUARD_V20: Command<readonly [ptzGuard]>; GET_GUARD_V20: Command<readonly [ptzGuard]>; GET_PTZ_AUTO_TEST_V20: Command<readonly [ptzAutoTest]>; PTZ_AUTO_TEST_V20: Command<readonly []>; GET_AI_DETECT_CFG_V20: Command<readonly [aiDetectCfg]>; SET_AI_DETECT_CFG_V20: Command<readonly [aiDetectCfg]>; GET_DEF_AI_DETECT_CFG_V20: Command<readonly [aiDetectCfg]>; SET_ALARM_AREA_V20: Command<readonly [alarmArea]>; GET_SMT_PLAY_URL_V20: Command<readonly [smtPlayUrl, smtPlayUrlReply]>; GET_AUDIO_FILE_INFO_LIST_V20: Command<readonly [audioFileInfoList]>; DELETE_AUDIO_FILE_V20: Command<readonly [audioFileInfo]>; PLAY_ALARM_ALERTOR_V20: Command<readonly [audioFileInfo]>; STOP_ALARM_ALERTOR_V20: Command<readonly []>; GET_NETWORK_DIAGNOSIS_DATA_V20: Command<readonly [networkDiagnosisData]>; PUSH_TEST_V20: Command<readonly [pushTestResult]>; GET_AI_TRACK_DATA_V20: Command<readonly [aiTrackData]>; GET_PUSH_CFG_V20: Command<readonly [pushCfg]>; SET_PUSH_CFG_V20: Command<readonly [pushCfg]>; CLOUD_TEST_V20: Command<readonly [cloudTestResult]>; SET_AUDIO_FILE_INFO_LIST_V20: Command<readonly [audioFileInfoList]>; START_REPLAY_BY_TM: Command<readonly [replayByTimeV2]>; STOP_REPLAY_BY_TM: Command<readonly [replayByTimeV2]>; SEEK_REPLAY_BY_TM: Command<readonly [replaySeekV2]>; BIND_IOT_V20: Command<readonly [iotBindUnBind]>; UNBIND_IOT_V20: Command<readonly [iotBindUnBind]>; GET_BIND_IOT_INFO_V20: Command<readonly [iotBindInfoList]>; GET_IOT_ACTION_V20: Command<readonly [iotAction, iotActionList]>; SET_IOT_ACTION_V20: Command<readonly [iotAction]>; EXPORT_AUDIO_V20: Command<readonly [audioFileInfo]>; IMPORT_IMAGE_V20: Command<readonly [imageFileInfo, paramDataV20]>; EXPORT_IMAGE_V20: Command<readonly [imageFileInfo]>; GET_AUTO_REPLY: Command<readonly [autoReply]>; SET_AUTO_REPLY: Command<readonly [autoReply]>; GET_PTZ_CUR_POS_V20: Command<readonly [ptzCurPos]>; GET_AI_TRACK_LIMIT_V20: Command<readonly [trackLimit]>; SET_AI_TRACK_LIMIT_V20: Command<readonly [trackLimit]>; GET_AI_TRACK_TASK_V20: Command<readonly [trackSchedule]>; SET_AI_TRACK_TASK_V20: Command<readonly [trackSchedule]>; PTZ_3D_LOCATION_V20: Command<readonly [ptz3DLocation]>; GET_AF_ALGORITHM_V20: Command<readonly [afAlgorithm]>; SET_AF_ALGORITHM_V20: Command<readonly [afAlgorithm]>; GET_HTTPS_CERT_INFO: Command<readonly [certificateInfo]>; SET_HTTPS_CERT_INFO: Command<readonly [certificateInfo]>; DINGDONG_CTRL: Command<readonly [dingdongCtrl]>; DINGDONG_LIST_GET: Command<readonly [dingdongList]>; DINGDONG_DEV_OPT: Command<readonly [dingdongDeviceOpt]>; DINGDONG_CFG_GET: Command<readonly [dingdongCfg]>; DINGDONG_CFG_SET: Command<readonly [dingdongCfg]>; AUTH_MODE_CODE_GET: Command<readonly [authInfo]>; GET_SHARED_USER_CFG: Command<readonly [accessUserList]>; SET_SHARED_USER_CFG: Command<readonly [accessUserList]>; SYNC_SSID: Command<readonly [syncSsid]>; GET_CLIENT_ID: Command<readonly [pushClientId]>; CREATE_PUSH_LISTENER: Command<readonly [pushCreateListener]>; SYNC_CLIENT_LIST: Command<readonly []>; GET_CLIENT_STATE: Command<readonly [pushClientState]>; GET_SLEEP_STATE: Command<readonly [sleepState]>; SET_SLEEP_STATE: Command<readonly [sleepState]>; NET_GET_FREQ_CORRECT_RESULT: Command<readonly [freqCorrectResult]>; GET_DINGDONG_SILENT_MODE: Command<readonly [dingdongSilentMode]>; SET_DINGDONG_SILENT_MODE: Command<readonly [dingdongSilentMode]>; INSTANT_PLAY_AUDIO: Command<readonly [audioFileInfo, paramDataV20]>; SET_ANSWER_EVENT: Command<readonly [answerEvent]>; DELETE_RECORD_FILE: Command<readonly [deleteRecordFile]>; SET_AI_YUV_STREAM_CFG: Command<readonly [aiyuvCfg]>; }

The firmware request commands, keyed by name.

T
LoginOptions = { username: string; password: string; }

Camera credentials for Client.login.

T
PtzPosition = { pan: number; tilt: number; }

Where the camera points, in the camera's own motor units.

T
PtzPreset = { id: number; name: string; }

A saved PTZ position.

T
Pushes = { ALARM_EVENT_REPORT: Command<readonly [alarmEventList]>; VIDEO_INPUT_CHANGE_REPORT: Command<readonly [videoInput]>; SERIAL_CHANGE_REPORT: Command<readonly [serial]>; BATTERY_CAMERA_HEARTBEAT: Command<readonly []>; BATTERY_STATUS_REPORT: Command<readonly [batteryList]>; MOBILE_NETWORK_REPORT: Command<readonly [net3g4gInfo]>; FLOODLIGHT_STATUS_REPORT: Command<readonly [floodlightStatusList]>; CHIME_SCAN_REPORT: Command<readonly [dingdongList]>; SLEEP_STATUS_REPORT: Command<readonly [sleepStatus]>; }

The messages the firmware pushes unasked, keyed by a descriptive name.

T
SubscribeOptions = { keepAliveMs?: number; }

Options for Client.subscribe.

  • keepAliveMs: number

    How long the connection may stay silent before the client pings the camera, in milliseconds. If a second interval passes with nothing from the camera, the event stream errors. Defaults to 30_000.

Variables

v
COMMANDS: Commands

The firmware request commands, for Client.call.

v
PTZ_COMMAND: { STOP: string; LEFT: string; RIGHT: string; UP: string; DOWN: string; LEFT_UP: string; LEFT_DOWN: string; RIGHT_UP: string; RIGHT_DOWN: string; ZOOM_IN: string; ZOOM_OUT: string; AUTO: string; }

PTZ commands for ptzControlXml. A move keeps going until STOP.

v
PUSHES: Pushes

The messages the firmware pushes unasked. Names are descriptive: the firmware dispatch tables only list requests.