@apocaliss92/nodelink-js 0.4.12 → 0.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -34,7 +34,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  function bcHeaderHasPayloadOffset(messageClass) {
35
35
  return messageClass === BC_CLASS_MODERN_24 || messageClass === BC_CLASS_MODERN_24_ALT || messageClass === BC_CLASS_FILE_DOWNLOAD;
36
36
  }
37
- var BC_TCP_DEFAULT_PORT, BC_MAGIC, BC_MAGIC_REV, BC_XML_KEY, BC_AES_IV, BC_CLASS_LEGACY, BC_CLASS_MODERN_20, BC_CLASS_MODERN_24, BC_CLASS_MODERN_24_ALT, BC_CLASS_FILE_DOWNLOAD, BC_CMD_ID_LOGIN, BC_CMD_ID_LOGOUT, BC_CMD_ID_VIDEO, BC_CMD_ID_VIDEO_STOP, BC_CMD_ID_FILE_INFO_LIST_REPLAY, BC_CMD_ID_FILE_INFO_LIST_STOP, BC_CMD_ID_FILE_INFO_LIST_DL_VIDEO, BC_CMD_ID_FILE_INFO_LIST_DOWNLOAD, BC_CMD_ID_FILE_INFO_LIST_OPEN, BC_CMD_ID_FILE_INFO_LIST_GET, BC_CMD_ID_FILE_INFO_LIST_CLOSE, BC_CMD_ID_FIND_REC_VIDEO_OPEN, BC_CMD_ID_FIND_REC_VIDEO_GET, BC_CMD_ID_FIND_REC_VIDEO_CLOSE, BC_CMD_ID_COVER_PREVIEW, BC_CMD_ID_COVER_STANDALONE_458, BC_CMD_ID_COVER_STANDALONE_459, BC_CMD_ID_COVER_STANDALONE_460, BC_CMD_ID_COVER_STANDALONE_461, BC_CMD_ID_COVER_STANDALONE_462, BC_CMD_ID_COVER_RESPONSE, BC_CMD_ID_TALK_ABILITY, BC_CMD_ID_TALK_RESET, BC_CMD_ID_TALK_CONFIG, BC_CMD_ID_TALK, BC_CMD_ID_PTZ_CONTROL, BC_CMD_ID_PTZ_CONTROL_PRESET, BC_CMD_ID_GET_PTZ_PRESET, BC_CMD_ID_GET_PTZ_POSITION, BC_CMD_ID_GET_ZOOM_FOCUS, BC_CMD_ID_SET_ZOOM_FOCUS, BC_CMD_ID_GET_BATTERY_INFO_LIST, BC_CMD_ID_GET_BATTERY_INFO, BC_CMD_ID_UDP_KEEP_ALIVE, BC_CMD_ID_GET_PIR_INFO, BC_CMD_ID_SET_PIR_INFO, BC_CMD_ID_GET_MOTION_ALARM, BC_CMD_ID_SET_MOTION_ALARM, BC_CMD_ID_ALARM_EVENT_LIST, BC_CMD_ID_GET_AI_ALARM, BC_CMD_ID_SET_AI_ALARM, BC_CMD_ID_GET_AUDIO_ALARM, BC_CMD_ID_AUDIO_ALARM_PLAY, BC_CMD_ID_GET_WHITE_LED, BC_CMD_ID_SET_WHITE_LED_STATE, BC_CMD_ID_SET_WHITE_LED_TASK, BC_CMD_ID_FLOODLIGHT_STATUS_LIST, BC_CMD_ID_ABILITY_INFO, BC_CMD_ID_SUPPORT, BC_CMD_ID_PING, BC_CMD_ID_CHANNEL_INFO_ALL, BC_CMD_ID_GET_OSD_DATETIME, BC_CMD_ID_SET_OSD_DATETIME, BC_CMD_ID_GET_RECORD_CFG, BC_CMD_ID_GET_ABILITY_SUPPORT, BC_CMD_ID_GET_FTP_TASK, BC_CMD_ID_GET_VERSION_INFO, BC_CMD_ID_GET_RECORD, BC_CMD_ID_GET_HDD_INFO_LIST, BC_CMD_ID_GET_WIFI_SIGNAL, BC_CMD_ID_GET_WIFI, BC_CMD_ID_GET_ONLINE_USER_LIST, BC_CMD_ID_GET_DAY_RECORDS, BC_CMD_ID_GET_STREAM_INFO_LIST, BC_CMD_ID_GET_LED_STATE, BC_CMD_ID_GET_EMAIL_TASK, BC_CMD_ID_GET_AUDIO_TASK, BC_CMD_ID_GET_AUDIO_CFG, BC_CMD_ID_GET_DAY_NIGHT_THRESHOLD, BC_CMD_ID_GET_TIMELAPSE_CFG, BC_CMD_ID_GET_AI_DENOISE, BC_CMD_ID_GET_KIT_AP_CFG, BC_CMD_ID_GET_REC_ENC_CFG, BC_CMD_ID_GET_ACCESS_USER_LIST, BC_CMD_ID_GET_SLEEP_STATE, BC_CMD_ID_GET_VIDEO_INPUT, BC_CMD_ID_GET_SYSTEM_GENERAL, BC_CMD_ID_GET_SUPPORT, BC_CMD_ID_GET_AI_CFG, BC_CMD_ID_SET_AI_CFG, BC_CMD_ID_GET_SIREN_STATUS, BC_CMD_ID_SET_AUDIO_TASK, BC_CMD_ID_SET_VIDEO_INPUT, BC_CMD_ID_SET_DAY_NIGHT_THRESHOLD, BC_CMD_ID_GET_ENC, BC_CMD_ID_SET_ENC, BC_CMD_ID_GET_PRIVACY_MASK, BC_CMD_ID_SET_PRIVACY_MASK, BC_CMD_ID_SET_AI_DENOISE, BC_CMD_ID_SET_LED_STATE, BC_CMD_ID_SET_AUDIO_CFG, BC_CMD_ID_SET_RECORD, BC_CMD_ID_SET_RECORD_CFG, BC_CMD_ID_SET_EMAIL_TASK, BC_CMD_ID_GET_PUSH_TASK, BC_CMD_ID_SET_PUSH_TASK, BC_CMD_ID_GET_AUTO_FOCUS, BC_CMD_ID_SET_AUTO_FOCUS, BC_CMD_ID_CMD_123, BC_CMD_ID_CMD_209, BC_CMD_ID_CMD_265, BC_CMD_ID_CMD_440, BC_CMD_ID_PUSH_VIDEO_INPUT, BC_CMD_ID_PUSH_SERIAL, BC_CMD_ID_PUSH_NET_INFO, BC_CMD_ID_PUSH_DINGDONG_LIST, BC_CMD_ID_PUSH_SLEEP_STATUS, BC_CMD_ID_PUSH_COORDINATE_POINT_LIST, BC_CMD_ID_DING_DONG_CTRL, BC_CMD_ID_GET_DING_DONG_LIST, BC_CMD_ID_DING_DONG_OPT, BC_CMD_ID_GET_DING_DONG_CFG, BC_CMD_ID_SET_DING_DONG_CFG, BC_CMD_ID_QUICK_REPLY_PLAY, BC_CMD_ID_GET_DING_DONG_SILENT, BC_CMD_ID_SET_DING_DONG_SILENT;
37
+ var BC_TCP_DEFAULT_PORT, BC_MAGIC, BC_MAGIC_REV, BC_XML_KEY, BC_AES_IV, BC_CLASS_LEGACY, BC_CLASS_MODERN_20, BC_CLASS_MODERN_24, BC_CLASS_MODERN_24_ALT, BC_CLASS_FILE_DOWNLOAD, BC_CMD_ID_LOGIN, BC_CMD_ID_LOGOUT, BC_CMD_ID_VIDEO, BC_CMD_ID_VIDEO_STOP, BC_CMD_ID_FILE_INFO_LIST_REPLAY, BC_CMD_ID_FILE_INFO_LIST_STOP, BC_CMD_ID_FILE_INFO_LIST_DL_VIDEO, BC_CMD_ID_FILE_INFO_LIST_DOWNLOAD, BC_CMD_ID_FILE_INFO_LIST_OPEN, BC_CMD_ID_FILE_INFO_LIST_GET, BC_CMD_ID_FILE_INFO_LIST_CLOSE, BC_CMD_ID_FIND_REC_VIDEO_OPEN, BC_CMD_ID_FIND_REC_VIDEO_GET, BC_CMD_ID_FIND_REC_VIDEO_CLOSE, BC_CMD_ID_COVER_PREVIEW, BC_CMD_ID_COVER_STANDALONE_458, BC_CMD_ID_COVER_STANDALONE_459, BC_CMD_ID_COVER_STANDALONE_460, BC_CMD_ID_COVER_STANDALONE_461, BC_CMD_ID_COVER_STANDALONE_462, BC_CMD_ID_COVER_RESPONSE, BC_CMD_ID_TALK_ABILITY, BC_CMD_ID_TALK_RESET, BC_CMD_ID_TALK_CONFIG, BC_CMD_ID_TALK, BC_CMD_ID_PTZ_CONTROL, BC_CMD_ID_PTZ_CONTROL_PRESET, BC_CMD_ID_GET_PTZ_PRESET, BC_CMD_ID_GET_PTZ_POSITION, BC_CMD_ID_GET_ZOOM_FOCUS, BC_CMD_ID_SET_ZOOM_FOCUS, BC_CMD_ID_GET_BATTERY_INFO_LIST, BC_CMD_ID_GET_BATTERY_INFO, BC_CMD_ID_UDP_KEEP_ALIVE, BC_CMD_ID_GET_PIR_INFO, BC_CMD_ID_SET_PIR_INFO, BC_CMD_ID_GET_MOTION_ALARM, BC_CMD_ID_SET_MOTION_ALARM, BC_CMD_ID_ALARM_EVENT_LIST, BC_CMD_ID_GET_AI_ALARM, BC_CMD_ID_SET_AI_ALARM, BC_CMD_ID_GET_AUDIO_ALARM, BC_CMD_ID_AUDIO_ALARM_PLAY, BC_CMD_ID_GET_WHITE_LED, BC_CMD_ID_SET_WHITE_LED_STATE, BC_CMD_ID_SET_WHITE_LED_TASK, BC_CMD_ID_FLOODLIGHT_STATUS_LIST, BC_CMD_ID_ABILITY_INFO, BC_CMD_ID_SUPPORT, BC_CMD_ID_PING, BC_CMD_ID_CHANNEL_INFO_ALL, BC_CMD_ID_GET_OSD_DATETIME, BC_CMD_ID_SET_OSD_DATETIME, BC_CMD_ID_GET_RECORD_CFG, BC_CMD_ID_GET_ABILITY_SUPPORT, BC_CMD_ID_GET_FTP_TASK, BC_CMD_ID_GET_VERSION_INFO, BC_CMD_ID_GET_RECORD, BC_CMD_ID_GET_HDD_INFO_LIST, BC_CMD_ID_GET_WIFI_SIGNAL, BC_CMD_ID_GET_WIFI, BC_CMD_ID_GET_ONLINE_USER_LIST, BC_CMD_ID_GET_DAY_RECORDS, BC_CMD_ID_GET_STREAM_INFO_LIST, BC_CMD_ID_GET_LED_STATE, BC_CMD_ID_GET_EMAIL_TASK, BC_CMD_ID_GET_AUDIO_TASK, BC_CMD_ID_GET_AUDIO_CFG, BC_CMD_ID_GET_DAY_NIGHT_THRESHOLD, BC_CMD_ID_GET_TIMELAPSE_CFG, BC_CMD_ID_GET_AI_DENOISE, BC_CMD_ID_GET_KIT_AP_CFG, BC_CMD_ID_GET_REC_ENC_CFG, BC_CMD_ID_GET_ACCESS_USER_LIST, BC_CMD_ID_GET_SLEEP_STATE, BC_CMD_ID_GET_VIDEO_INPUT, BC_CMD_ID_GET_SYSTEM_GENERAL, BC_CMD_ID_GET_SUPPORT, BC_CMD_ID_GET_AI_CFG, BC_CMD_ID_SET_AI_CFG, BC_CMD_ID_GET_SIREN_STATUS, BC_CMD_ID_SET_AUDIO_TASK, BC_CMD_ID_SET_VIDEO_INPUT, BC_CMD_ID_SET_DAY_NIGHT_THRESHOLD, BC_CMD_ID_GET_ENC, BC_CMD_ID_SET_ENC, BC_CMD_ID_GET_PRIVACY_MASK, BC_CMD_ID_SET_PRIVACY_MASK, BC_CMD_ID_SET_AI_DENOISE, BC_CMD_ID_SET_LED_STATE, BC_CMD_ID_SET_AUDIO_CFG, BC_CMD_ID_SET_RECORD, BC_CMD_ID_SET_RECORD_CFG, BC_CMD_ID_SET_EMAIL_TASK, BC_CMD_ID_GET_PUSH_TASK, BC_CMD_ID_SET_PUSH_TASK, BC_CMD_ID_GET_AUTO_FOCUS, BC_CMD_ID_SET_AUTO_FOCUS, BC_CMD_ID_GET_EMAIL, BC_CMD_ID_SET_EMAIL, BC_CMD_ID_TEST_EMAIL, BC_CMD_ID_GET_NTP, BC_CMD_ID_SET_NTP, BC_CMD_ID_SET_SYSTEM_GENERAL, BC_CMD_ID_GET_DST, BC_CMD_ID_SET_DST, BC_CMD_ID_GET_AUTO_REBOOT, BC_CMD_ID_SET_AUTO_REBOOT, BC_CMD_ID_CMD_123, BC_CMD_ID_CMD_209, BC_CMD_ID_CMD_265, BC_CMD_ID_CMD_440, BC_CMD_ID_PUSH_VIDEO_INPUT, BC_CMD_ID_PUSH_SERIAL, BC_CMD_ID_PUSH_NET_INFO, BC_CMD_ID_PUSH_DINGDONG_LIST, BC_CMD_ID_PUSH_SLEEP_STATUS, BC_CMD_ID_PUSH_COORDINATE_POINT_LIST, BC_CMD_ID_DING_DONG_CTRL, BC_CMD_ID_GET_DING_DONG_LIST, BC_CMD_ID_DING_DONG_OPT, BC_CMD_ID_GET_DING_DONG_CFG, BC_CMD_ID_SET_DING_DONG_CFG, BC_CMD_ID_QUICK_REPLY_PLAY, BC_CMD_ID_GET_DING_DONG_SILENT, BC_CMD_ID_SET_DING_DONG_SILENT;
38
38
  var init_constants = __esm({
39
39
  "src/protocol/constants.ts"() {
40
40
  "use strict";
@@ -155,6 +155,16 @@ var init_constants = __esm({
155
155
  BC_CMD_ID_SET_PUSH_TASK = 218;
156
156
  BC_CMD_ID_GET_AUTO_FOCUS = 224;
157
157
  BC_CMD_ID_SET_AUTO_FOCUS = 225;
158
+ BC_CMD_ID_GET_EMAIL = 42;
159
+ BC_CMD_ID_SET_EMAIL = 43;
160
+ BC_CMD_ID_TEST_EMAIL = 141;
161
+ BC_CMD_ID_GET_NTP = 38;
162
+ BC_CMD_ID_SET_NTP = 39;
163
+ BC_CMD_ID_SET_SYSTEM_GENERAL = 105;
164
+ BC_CMD_ID_GET_DST = 106;
165
+ BC_CMD_ID_SET_DST = 107;
166
+ BC_CMD_ID_GET_AUTO_REBOOT = 101;
167
+ BC_CMD_ID_SET_AUTO_REBOOT = 100;
158
168
  BC_CMD_ID_CMD_123 = 123;
159
169
  BC_CMD_ID_CMD_209 = 209;
160
170
  BC_CMD_ID_CMD_265 = 265;
@@ -8117,6 +8127,7 @@ __export(index_exports, {
8117
8127
  BC_CMD_ID_GET_AUDIO_CFG: () => BC_CMD_ID_GET_AUDIO_CFG,
8118
8128
  BC_CMD_ID_GET_AUDIO_TASK: () => BC_CMD_ID_GET_AUDIO_TASK,
8119
8129
  BC_CMD_ID_GET_AUTO_FOCUS: () => BC_CMD_ID_GET_AUTO_FOCUS,
8130
+ BC_CMD_ID_GET_AUTO_REBOOT: () => BC_CMD_ID_GET_AUTO_REBOOT,
8120
8131
  BC_CMD_ID_GET_BATTERY_INFO: () => BC_CMD_ID_GET_BATTERY_INFO,
8121
8132
  BC_CMD_ID_GET_BATTERY_INFO_LIST: () => BC_CMD_ID_GET_BATTERY_INFO_LIST,
8122
8133
  BC_CMD_ID_GET_DAY_NIGHT_THRESHOLD: () => BC_CMD_ID_GET_DAY_NIGHT_THRESHOLD,
@@ -8124,6 +8135,8 @@ __export(index_exports, {
8124
8135
  BC_CMD_ID_GET_DING_DONG_CFG: () => BC_CMD_ID_GET_DING_DONG_CFG,
8125
8136
  BC_CMD_ID_GET_DING_DONG_LIST: () => BC_CMD_ID_GET_DING_DONG_LIST,
8126
8137
  BC_CMD_ID_GET_DING_DONG_SILENT: () => BC_CMD_ID_GET_DING_DONG_SILENT,
8138
+ BC_CMD_ID_GET_DST: () => BC_CMD_ID_GET_DST,
8139
+ BC_CMD_ID_GET_EMAIL: () => BC_CMD_ID_GET_EMAIL,
8127
8140
  BC_CMD_ID_GET_EMAIL_TASK: () => BC_CMD_ID_GET_EMAIL_TASK,
8128
8141
  BC_CMD_ID_GET_ENC: () => BC_CMD_ID_GET_ENC,
8129
8142
  BC_CMD_ID_GET_FTP_TASK: () => BC_CMD_ID_GET_FTP_TASK,
@@ -8131,6 +8144,7 @@ __export(index_exports, {
8131
8144
  BC_CMD_ID_GET_KIT_AP_CFG: () => BC_CMD_ID_GET_KIT_AP_CFG,
8132
8145
  BC_CMD_ID_GET_LED_STATE: () => BC_CMD_ID_GET_LED_STATE,
8133
8146
  BC_CMD_ID_GET_MOTION_ALARM: () => BC_CMD_ID_GET_MOTION_ALARM,
8147
+ BC_CMD_ID_GET_NTP: () => BC_CMD_ID_GET_NTP,
8134
8148
  BC_CMD_ID_GET_ONLINE_USER_LIST: () => BC_CMD_ID_GET_ONLINE_USER_LIST,
8135
8149
  BC_CMD_ID_GET_OSD_DATETIME: () => BC_CMD_ID_GET_OSD_DATETIME,
8136
8150
  BC_CMD_ID_GET_PIR_INFO: () => BC_CMD_ID_GET_PIR_INFO,
@@ -8171,19 +8185,24 @@ __export(index_exports, {
8171
8185
  BC_CMD_ID_SET_AUDIO_CFG: () => BC_CMD_ID_SET_AUDIO_CFG,
8172
8186
  BC_CMD_ID_SET_AUDIO_TASK: () => BC_CMD_ID_SET_AUDIO_TASK,
8173
8187
  BC_CMD_ID_SET_AUTO_FOCUS: () => BC_CMD_ID_SET_AUTO_FOCUS,
8188
+ BC_CMD_ID_SET_AUTO_REBOOT: () => BC_CMD_ID_SET_AUTO_REBOOT,
8174
8189
  BC_CMD_ID_SET_DAY_NIGHT_THRESHOLD: () => BC_CMD_ID_SET_DAY_NIGHT_THRESHOLD,
8175
8190
  BC_CMD_ID_SET_DING_DONG_CFG: () => BC_CMD_ID_SET_DING_DONG_CFG,
8176
8191
  BC_CMD_ID_SET_DING_DONG_SILENT: () => BC_CMD_ID_SET_DING_DONG_SILENT,
8192
+ BC_CMD_ID_SET_DST: () => BC_CMD_ID_SET_DST,
8193
+ BC_CMD_ID_SET_EMAIL: () => BC_CMD_ID_SET_EMAIL,
8177
8194
  BC_CMD_ID_SET_EMAIL_TASK: () => BC_CMD_ID_SET_EMAIL_TASK,
8178
8195
  BC_CMD_ID_SET_ENC: () => BC_CMD_ID_SET_ENC,
8179
8196
  BC_CMD_ID_SET_LED_STATE: () => BC_CMD_ID_SET_LED_STATE,
8180
8197
  BC_CMD_ID_SET_MOTION_ALARM: () => BC_CMD_ID_SET_MOTION_ALARM,
8198
+ BC_CMD_ID_SET_NTP: () => BC_CMD_ID_SET_NTP,
8181
8199
  BC_CMD_ID_SET_OSD_DATETIME: () => BC_CMD_ID_SET_OSD_DATETIME,
8182
8200
  BC_CMD_ID_SET_PIR_INFO: () => BC_CMD_ID_SET_PIR_INFO,
8183
8201
  BC_CMD_ID_SET_PRIVACY_MASK: () => BC_CMD_ID_SET_PRIVACY_MASK,
8184
8202
  BC_CMD_ID_SET_PUSH_TASK: () => BC_CMD_ID_SET_PUSH_TASK,
8185
8203
  BC_CMD_ID_SET_RECORD: () => BC_CMD_ID_SET_RECORD,
8186
8204
  BC_CMD_ID_SET_RECORD_CFG: () => BC_CMD_ID_SET_RECORD_CFG,
8205
+ BC_CMD_ID_SET_SYSTEM_GENERAL: () => BC_CMD_ID_SET_SYSTEM_GENERAL,
8187
8206
  BC_CMD_ID_SET_VIDEO_INPUT: () => BC_CMD_ID_SET_VIDEO_INPUT,
8188
8207
  BC_CMD_ID_SET_WHITE_LED_STATE: () => BC_CMD_ID_SET_WHITE_LED_STATE,
8189
8208
  BC_CMD_ID_SET_WHITE_LED_TASK: () => BC_CMD_ID_SET_WHITE_LED_TASK,
@@ -8193,6 +8212,7 @@ __export(index_exports, {
8193
8212
  BC_CMD_ID_TALK_ABILITY: () => BC_CMD_ID_TALK_ABILITY,
8194
8213
  BC_CMD_ID_TALK_CONFIG: () => BC_CMD_ID_TALK_CONFIG,
8195
8214
  BC_CMD_ID_TALK_RESET: () => BC_CMD_ID_TALK_RESET,
8215
+ BC_CMD_ID_TEST_EMAIL: () => BC_CMD_ID_TEST_EMAIL,
8196
8216
  BC_CMD_ID_UDP_KEEP_ALIVE: () => BC_CMD_ID_UDP_KEEP_ALIVE,
8197
8217
  BC_CMD_ID_VIDEO: () => BC_CMD_ID_VIDEO,
8198
8218
  BC_CMD_ID_VIDEO_STOP: () => BC_CMD_ID_VIDEO_STOP,
@@ -16302,6 +16322,309 @@ function parseXmlFragmentToJson(xml) {
16302
16322
  return parsed.root;
16303
16323
  }
16304
16324
 
16325
+ // src/reolink/baichuan/utils/email.ts
16326
+ init_xml();
16327
+ var parseInt01 = (text) => {
16328
+ if (text === void 0) return void 0;
16329
+ return text.trim() === "1" ? 1 : 0;
16330
+ };
16331
+ var parseNumberSafe = (text) => {
16332
+ if (text === void 0) return void 0;
16333
+ const n = Number(text);
16334
+ return Number.isFinite(n) ? n : void 0;
16335
+ };
16336
+ var VALID_ATTACHMENT_TYPES = [
16337
+ "picture",
16338
+ "video",
16339
+ "none"
16340
+ ];
16341
+ var VALID_TEXT_TYPES = ["withText", "noText"];
16342
+ var normalizeAttachmentType = (text) => {
16343
+ const t = (text ?? "").trim();
16344
+ return VALID_ATTACHMENT_TYPES.includes(t) ? t : "picture";
16345
+ };
16346
+ var normalizeTextType = (text) => {
16347
+ const t = (text ?? "").trim();
16348
+ return VALID_TEXT_TYPES.includes(t) ? t : "withText";
16349
+ };
16350
+ function parseEmailConfigFromXml(xml) {
16351
+ const cfg = {
16352
+ smtpServer: getXmlText(xml, "smtpServer") ?? "",
16353
+ userName: getXmlText(xml, "userName") ?? "",
16354
+ password: getXmlText(xml, "password") ?? "",
16355
+ address1: getXmlText(xml, "address1") ?? "",
16356
+ address2: getXmlText(xml, "address2") ?? "",
16357
+ address3: getXmlText(xml, "address3") ?? "",
16358
+ smtpPort: parseNumberSafe(getXmlText(xml, "smtpPort")) ?? 0,
16359
+ sendNickname: getXmlText(xml, "sendNickname") ?? "",
16360
+ attachment: parseInt01(getXmlText(xml, "attachment")) ?? 0,
16361
+ attachmentType: normalizeAttachmentType(getXmlText(xml, "attachmentType")),
16362
+ textType: normalizeTextType(getXmlText(xml, "textType")),
16363
+ ssl: parseInt01(getXmlText(xml, "ssl")) ?? 0,
16364
+ interval: parseNumberSafe(getXmlText(xml, "interval")) ?? 30
16365
+ };
16366
+ const senderMaxLen = parseNumberSafe(getXmlText(xml, "senderMaxLen"));
16367
+ if (senderMaxLen !== void 0) cfg.senderMaxLen = senderMaxLen;
16368
+ const pwdMaxLen = parseNumberSafe(getXmlText(xml, "pwdMaxLen"));
16369
+ if (pwdMaxLen !== void 0) cfg.pwdMaxLen = pwdMaxLen;
16370
+ const ability = parseNumberSafe(getXmlText(xml, "emailAttachAbility"));
16371
+ if (ability !== void 0) cfg.emailAttachAbility = ability;
16372
+ return cfg;
16373
+ }
16374
+ function buildSetEmailXml(current, patch) {
16375
+ const merged = { ...current, ...patch };
16376
+ return ensureXmlHeader(
16377
+ `<body><Email version="1.1"><smtpServer>${xmlEscape(merged.smtpServer)}</smtpServer><userName>${xmlEscape(merged.userName)}</userName><password>${xmlEscape(merged.password)}</password><address1>${xmlEscape(merged.address1)}</address1><address2>${xmlEscape(merged.address2)}</address2><address3>${xmlEscape(merged.address3)}</address3><smtpPort>${merged.smtpPort}</smtpPort><sendNickname>${xmlEscape(merged.sendNickname)}</sendNickname><attachment>${merged.attachment}</attachment><attachmentType>${merged.attachmentType}</attachmentType><textType>${merged.textType}</textType><ssl>${merged.ssl}</ssl><interval>${merged.interval}</interval></Email></body>`
16378
+ );
16379
+ }
16380
+ function parseEmailTaskFromXml(xml) {
16381
+ const channelId = parseNumberSafe(getXmlText(xml, "channelId")) ?? 0;
16382
+ const enable = parseInt01(getXmlText(xml, "enable")) ?? 0;
16383
+ const items = [];
16384
+ const itemRe = /<item>([\s\S]*?)<\/item>/g;
16385
+ let match;
16386
+ while ((match = itemRe.exec(xml)) !== null) {
16387
+ const block = match[1] ?? "";
16388
+ items.push({
16389
+ type: getXmlText(block, "type") ?? "none",
16390
+ valueTable: getXmlText(block, "valueTable") ?? ""
16391
+ });
16392
+ }
16393
+ return { channelId, enable, typeScheduleList: items };
16394
+ }
16395
+ function buildEmailScheduleValueTable(spec) {
16396
+ if (spec.kind === "always") return "1".repeat(168);
16397
+ const grid = new Array(168).fill("0");
16398
+ if (spec.kind === "never") return grid.join("");
16399
+ for (const w of spec.windows) {
16400
+ const startH = Math.max(0, Math.min(24, w.startHour));
16401
+ const endH = Math.max(startH, Math.min(24, w.endHour));
16402
+ for (const d of w.days) {
16403
+ if (d < 0 || d > 6) continue;
16404
+ for (let h = startH; h < endH; h++) {
16405
+ grid[d * 24 + h] = "1";
16406
+ }
16407
+ }
16408
+ }
16409
+ return grid.join("");
16410
+ }
16411
+ function buildSetEmailTaskXml(task) {
16412
+ const items = task.typeScheduleList.map(
16413
+ (item) => `<item><type>${xmlEscape(item.type)}</type><valueTable>${xmlEscape(item.valueTable)}</valueTable></item>`
16414
+ ).join("");
16415
+ return ensureXmlHeader(
16416
+ `<body><EmailTask version="1.1"><channelId>${task.channelId}</channelId><enable>${task.enable}</enable><typeScheduleList>${items}</typeScheduleList></EmailTask></body>`
16417
+ );
16418
+ }
16419
+
16420
+ // src/reolink/baichuan/utils/ntp.ts
16421
+ init_xml();
16422
+ var parseNumberSafe2 = (text) => {
16423
+ if (text === void 0) return void 0;
16424
+ const n = Number(text);
16425
+ return Number.isFinite(n) ? n : void 0;
16426
+ };
16427
+ var parseInt012 = (text) => {
16428
+ if (text === void 0) return void 0;
16429
+ return text.trim() === "1" ? 1 : 0;
16430
+ };
16431
+ function parseNtpConfigFromXml(xml) {
16432
+ return {
16433
+ enable: parseInt012(getXmlText(xml, "enable")) ?? 0,
16434
+ server: getXmlText(xml, "server") ?? "",
16435
+ synchronizeInterval: parseNumberSafe2(getXmlText(xml, "synchronizeInterval")) ?? 1440,
16436
+ port: parseNumberSafe2(getXmlText(xml, "port")) ?? 123
16437
+ };
16438
+ }
16439
+ function buildSetNtpXml(current, patch) {
16440
+ const merged = { ...current, ...patch };
16441
+ return ensureXmlHeader(
16442
+ `<body><Ntp version="1.1"><enable>${merged.enable}</enable><server>${xmlEscape(merged.server)}</server><synchronizeInterval>${merged.synchronizeInterval}</synchronizeInterval><port>${merged.port}</port></Ntp></body>`
16443
+ );
16444
+ }
16445
+
16446
+ // src/reolink/baichuan/utils/dst.ts
16447
+ init_xml();
16448
+ var parseNumberSafe3 = (text) => {
16449
+ if (text === void 0) return void 0;
16450
+ const n = Number(text);
16451
+ return Number.isFinite(n) ? n : void 0;
16452
+ };
16453
+ var parseInt013 = (text) => {
16454
+ if (text === void 0) return void 0;
16455
+ return text.trim() === "1" ? 1 : 0;
16456
+ };
16457
+ var VALID_WEEKDAYS = [
16458
+ "Sunday",
16459
+ "Monday",
16460
+ "Tuesday",
16461
+ "Wednesday",
16462
+ "Thursday",
16463
+ "Friday",
16464
+ "Saturday"
16465
+ ];
16466
+ var normalizeWeekday = (text) => {
16467
+ const t = (text ?? "").trim();
16468
+ return VALID_WEEKDAYS.includes(t) ? t : "Sunday";
16469
+ };
16470
+ function parseDstConfigFromXml(xml) {
16471
+ const cfg = {
16472
+ enable: parseInt013(getXmlText(xml, "enable")) ?? 0,
16473
+ offset: parseNumberSafe3(getXmlText(xml, "offset")) ?? 1,
16474
+ startMonth: parseNumberSafe3(getXmlText(xml, "startMonth")) ?? 3,
16475
+ startWeekIndex: parseNumberSafe3(getXmlText(xml, "startWeekIndex")) ?? 5,
16476
+ startWeekday: normalizeWeekday(getXmlText(xml, "startWeekday")),
16477
+ startHour: parseNumberSafe3(getXmlText(xml, "startHour")) ?? 2,
16478
+ startMinute: parseNumberSafe3(getXmlText(xml, "startMinute")) ?? 0,
16479
+ startSecond: parseNumberSafe3(getXmlText(xml, "startSecond")) ?? 0,
16480
+ endMonth: parseNumberSafe3(getXmlText(xml, "endMonth")) ?? 10,
16481
+ endWeekIndex: parseNumberSafe3(getXmlText(xml, "endWeekIndex")) ?? 4,
16482
+ endWeekday: normalizeWeekday(getXmlText(xml, "endWeekday")),
16483
+ endHour: parseNumberSafe3(getXmlText(xml, "endHour")) ?? 3,
16484
+ endMinute: parseNumberSafe3(getXmlText(xml, "endMinute")) ?? 0,
16485
+ endSecond: parseNumberSafe3(getXmlText(xml, "endSecond")) ?? 0
16486
+ };
16487
+ const version = parseNumberSafe3(getXmlText(xml, "version"));
16488
+ if (version !== void 0) cfg.version = version;
16489
+ return cfg;
16490
+ }
16491
+ function buildSetDstXml(current, patch) {
16492
+ const merged = { ...current, ...patch };
16493
+ return ensureXmlHeader(
16494
+ `<body><Dst version="1.1"><enable>${merged.enable}</enable><offset>${merged.offset}</offset><startMonth>${merged.startMonth}</startMonth><startWeekIndex>${merged.startWeekIndex}</startWeekIndex><startWeekday>${xmlEscape(merged.startWeekday)}</startWeekday><startHour>${merged.startHour}</startHour><startMinute>${merged.startMinute}</startMinute><startSecond>${merged.startSecond}</startSecond><endMonth>${merged.endMonth}</endMonth><endWeekIndex>${merged.endWeekIndex}</endWeekIndex><endWeekday>${xmlEscape(merged.endWeekday)}</endWeekday><endHour>${merged.endHour}</endHour><endMinute>${merged.endMinute}</endMinute><endSecond>${merged.endSecond}</endSecond></Dst></body>`
16495
+ );
16496
+ }
16497
+
16498
+ // src/reolink/baichuan/utils/autoReboot.ts
16499
+ init_xml();
16500
+ var parseNumberSafe4 = (text) => {
16501
+ if (text === void 0) return void 0;
16502
+ const n = Number(text);
16503
+ return Number.isFinite(n) ? n : void 0;
16504
+ };
16505
+ var parseInt014 = (text) => {
16506
+ if (text === void 0) return void 0;
16507
+ return text.trim() === "1" ? 1 : 0;
16508
+ };
16509
+ var VALID_WEEKDAYS2 = [
16510
+ "Sunday",
16511
+ "Monday",
16512
+ "Tuesday",
16513
+ "Wednesday",
16514
+ "Thursday",
16515
+ "Friday",
16516
+ "Saturday",
16517
+ "everyday"
16518
+ ];
16519
+ var normalizeWeekday2 = (text) => {
16520
+ const t = (text ?? "").trim();
16521
+ return VALID_WEEKDAYS2.includes(t) ? t : "Sunday";
16522
+ };
16523
+ function parseAutoRebootFromXml(xml) {
16524
+ return {
16525
+ enable: parseInt014(getXmlText(xml, "enable")) ?? 0,
16526
+ weekDay: normalizeWeekday2(getXmlText(xml, "weekDay")),
16527
+ hour: parseNumberSafe4(getXmlText(xml, "hour")) ?? 0,
16528
+ minute: parseNumberSafe4(getXmlText(xml, "minute")) ?? 0,
16529
+ second: parseNumberSafe4(getXmlText(xml, "second")) ?? 0
16530
+ };
16531
+ }
16532
+ function buildSetAutoRebootXml(current, patch) {
16533
+ const merged = { ...current, ...patch };
16534
+ return ensureXmlHeader(
16535
+ `<body><AutoReboot version="1.1"><enable>${merged.enable}</enable><weekDay>${xmlEscape(merged.weekDay)}</weekDay><hour>${merged.hour}</hour><minute>${merged.minute}</minute><second>${merged.second}</second></AutoReboot></body>`
16536
+ );
16537
+ }
16538
+
16539
+ // src/reolink/baichuan/utils/systemGeneral.ts
16540
+ init_xml();
16541
+ var parseNumberSafe5 = (text) => {
16542
+ if (text === void 0) return void 0;
16543
+ const n = Number(text);
16544
+ return Number.isFinite(n) ? n : void 0;
16545
+ };
16546
+ var parseInt015 = (text) => {
16547
+ if (text === void 0) return void 0;
16548
+ return text.trim() === "1" ? 1 : 0;
16549
+ };
16550
+ var VALID_OSD_FORMATS = ["DMY", "MDY", "YMD"];
16551
+ var normalizeOsdFormat = (text) => {
16552
+ const t = (text ?? "").trim();
16553
+ return VALID_OSD_FORMATS.includes(t) ? t : "YMD";
16554
+ };
16555
+ function parseSystemGeneralFromXml(xml) {
16556
+ return {
16557
+ timeZone: parseNumberSafe5(getXmlText(xml, "timeZone")) ?? 0,
16558
+ osdFormat: normalizeOsdFormat(getXmlText(xml, "osdFormat")),
16559
+ year: parseNumberSafe5(getXmlText(xml, "year")) ?? 0,
16560
+ month: parseNumberSafe5(getXmlText(xml, "month")) ?? 0,
16561
+ day: parseNumberSafe5(getXmlText(xml, "day")) ?? 0,
16562
+ hour: parseNumberSafe5(getXmlText(xml, "hour")) ?? 0,
16563
+ minute: parseNumberSafe5(getXmlText(xml, "minute")) ?? 0,
16564
+ second: parseNumberSafe5(getXmlText(xml, "second")) ?? 0,
16565
+ deviceId: parseNumberSafe5(getXmlText(xml, "deviceId")) ?? 0,
16566
+ timeFormat: parseInt015(getXmlText(xml, "timeFormat")) ?? 0,
16567
+ language: getXmlText(xml, "language") ?? "English",
16568
+ deviceName: getXmlText(xml, "deviceName") ?? "",
16569
+ loginLock: parseInt015(getXmlText(xml, "loginLock")) ?? 0,
16570
+ lockTime: parseNumberSafe5(getXmlText(xml, "lockTime")) ?? 0,
16571
+ allowedTimes: parseNumberSafe5(getXmlText(xml, "allowedTimes")) ?? 0,
16572
+ isDst: parseInt015(getXmlText(xml, "isDst")) ?? 0
16573
+ };
16574
+ }
16575
+ function buildSetSystemGeneralXml(patch) {
16576
+ const parts = [];
16577
+ const isDeviceNameOnly = patch.deviceName !== void 0 && patch.timeZone === void 0 && patch.osdFormat === void 0 && patch.timeFormat === void 0 && patch.language === void 0 && patch.loginLock === void 0 && patch.lockTime === void 0 && patch.allowedTimes === void 0 && patch.manualTime === void 0;
16578
+ if (isDeviceNameOnly) {
16579
+ parts.push("<year>0</year>");
16580
+ parts.push(`<deviceName>${xmlEscape(patch.deviceName)}</deviceName>`);
16581
+ parts.push("<deviceNameOnly>1</deviceNameOnly>");
16582
+ } else if (patch.manualTime !== void 0) {
16583
+ const mt = patch.manualTime;
16584
+ if (patch.timeZone !== void 0)
16585
+ parts.push(`<timeZone>${patch.timeZone}</timeZone>`);
16586
+ if (patch.osdFormat !== void 0)
16587
+ parts.push(`<osdFormat>${patch.osdFormat}</osdFormat>`);
16588
+ parts.push(`<year>${mt.year}</year>`);
16589
+ parts.push(`<month>${mt.month}</month>`);
16590
+ parts.push(`<day>${mt.day}</day>`);
16591
+ parts.push(`<hour>${mt.hour}</hour>`);
16592
+ parts.push(`<minute>${mt.minute}</minute>`);
16593
+ parts.push(`<second>${mt.second}</second>`);
16594
+ if (patch.timeFormat !== void 0)
16595
+ parts.push(`<timeFormat>${patch.timeFormat}</timeFormat>`);
16596
+ if (patch.language !== void 0)
16597
+ parts.push(`<language>${xmlEscape(patch.language)}</language>`);
16598
+ if (patch.deviceName !== void 0)
16599
+ parts.push(`<deviceName>${xmlEscape(patch.deviceName)}</deviceName>`);
16600
+ if (patch.loginLock !== void 0)
16601
+ parts.push(`<loginLock>${patch.loginLock}</loginLock>`);
16602
+ if (patch.lockTime !== void 0)
16603
+ parts.push(`<lockTime>${patch.lockTime}</lockTime>`);
16604
+ if (patch.allowedTimes !== void 0)
16605
+ parts.push(`<allowedTimes>${patch.allowedTimes}</allowedTimes>`);
16606
+ } else {
16607
+ if (patch.timeZone !== void 0)
16608
+ parts.push(`<timeZone>${patch.timeZone}</timeZone>`);
16609
+ if (patch.osdFormat !== void 0)
16610
+ parts.push(`<osdFormat>${patch.osdFormat}</osdFormat>`);
16611
+ if (patch.timeFormat !== void 0)
16612
+ parts.push(`<timeFormat>${patch.timeFormat}</timeFormat>`);
16613
+ if (patch.language !== void 0)
16614
+ parts.push(`<language>${xmlEscape(patch.language)}</language>`);
16615
+ if (patch.loginLock !== void 0)
16616
+ parts.push(`<loginLock>${patch.loginLock}</loginLock>`);
16617
+ if (patch.lockTime !== void 0)
16618
+ parts.push(`<lockTime>${patch.lockTime}</lockTime>`);
16619
+ if (patch.allowedTimes !== void 0)
16620
+ parts.push(`<allowedTimes>${patch.allowedTimes}</allowedTimes>`);
16621
+ parts.push("<year>0</year>");
16622
+ }
16623
+ return ensureXmlHeader(
16624
+ `<body><SystemGeneral version="1.1">${parts.join("")}</SystemGeneral></body>`
16625
+ );
16626
+ }
16627
+
16305
16628
  // src/reolink/baichuan/ReolinkBaichuanApi.ts
16306
16629
  var import_jimp = require("jimp");
16307
16630
  init_ReolinkCgiApi();
@@ -28430,7 +28753,279 @@ ${xml}`
28430
28753
  ...channel != null ? { channel } : {},
28431
28754
  ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28432
28755
  });
28433
- return parseXmlFragmentToJson(xml);
28756
+ return parseEmailTaskFromXml(xml);
28757
+ }
28758
+ /**
28759
+ * SetEmailTask via Baichuan (cmdId=216). Updates the email alarm schedule
28760
+ * (per-event-type 7×24 valueTable + master enable).
28761
+ *
28762
+ * Reolink expects the FULL `typeScheduleList` — pass the array from a prior
28763
+ * GET and only flip the entries you care about. Slots you don't track must
28764
+ * be sent back unchanged to avoid the camera dropping them.
28765
+ */
28766
+ async setEmailTask(channel, task, options) {
28767
+ const ch = this.normalizeChannel(channel);
28768
+ const payloadXml = buildSetEmailTaskXml({ ...task, channelId: ch });
28769
+ await this.sendXml({
28770
+ cmdId: BC_CMD_ID_SET_EMAIL_TASK,
28771
+ channel: ch,
28772
+ payloadXml,
28773
+ ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28774
+ });
28775
+ }
28776
+ /**
28777
+ * Convenience wrapper that patches the schedule of one or more trigger
28778
+ * types on the camera's EmailTask without touching the others.
28779
+ *
28780
+ * Pass a high-level schedule spec (`always` / `never` / explicit windows)
28781
+ * and the trigger types it should apply to. The method:
28782
+ *
28783
+ * 1. Reads the current EmailTask via GET (so we keep every existing slot).
28784
+ * 2. Builds the new `valueTable` once from `schedule`.
28785
+ * 3. Replaces the `valueTable` of every matching `type` in the list.
28786
+ * 4. Appends entries for any requested type not already present.
28787
+ * 5. Writes the merged list back via SET.
28788
+ *
28789
+ * Returns the list of types that were actually touched.
28790
+ */
28791
+ async patchEmailSchedule(channel, spec, options) {
28792
+ const current = await this.getEmailTask(channel, options);
28793
+ const newValueTable = buildEmailScheduleValueTable(spec.schedule);
28794
+ const targetSet = new Set(spec.types);
28795
+ const touched = [];
28796
+ const updatedList = current.typeScheduleList.map((item) => {
28797
+ if (targetSet.has(item.type)) {
28798
+ touched.push(item.type);
28799
+ return { ...item, valueTable: newValueTable };
28800
+ }
28801
+ return item;
28802
+ });
28803
+ for (const t of spec.types) {
28804
+ if (!current.typeScheduleList.some((item) => item.type === t)) {
28805
+ updatedList.push({ type: t, valueTable: newValueTable });
28806
+ touched.push(t);
28807
+ }
28808
+ }
28809
+ await this.setEmailTask(
28810
+ channel,
28811
+ {
28812
+ channelId: current.channelId,
28813
+ enable: spec.enable ?? current.enable,
28814
+ typeScheduleList: updatedList
28815
+ },
28816
+ options
28817
+ );
28818
+ return { touchedTypes: touched };
28819
+ }
28820
+ // ====================================================================
28821
+ // Email server (cmdId 42/43/141), NTP (38/39), DST (106/107),
28822
+ // SystemGeneral SET (105), AutoReboot (100/101).
28823
+ // Schemas derived from Reolink Client pcap (2026-05-16).
28824
+ // ====================================================================
28825
+ /**
28826
+ * Read the SMTP email configuration (cmdId=42). Returns the full `<Email>`
28827
+ * block including capability hints (`senderMaxLen`, `pwdMaxLen`,
28828
+ * `emailAttachAbility`).
28829
+ */
28830
+ async getEmail(options) {
28831
+ const xml = await this.sendXml({
28832
+ cmdId: BC_CMD_ID_GET_EMAIL,
28833
+ ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28834
+ });
28835
+ return parseEmailConfigFromXml(xml);
28836
+ }
28837
+ /**
28838
+ * Patch the SMTP email configuration (cmdId=43). Reads the current config
28839
+ * first then merges the patch — Reolink rejects partial `<Email>` blocks.
28840
+ */
28841
+ async setEmail(patch, options) {
28842
+ const current = await this.getEmail(options);
28843
+ const payloadXml = buildSetEmailXml(current, patch);
28844
+ await this.sendXml({
28845
+ cmdId: BC_CMD_ID_SET_EMAIL,
28846
+ payloadXml,
28847
+ ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28848
+ });
28849
+ }
28850
+ /**
28851
+ * Send a test email using either the current config or an override patch
28852
+ * (cmdId=141). Returns true when the camera reports 200 (test succeeded),
28853
+ * false when it reports 482 (test failed — server unreachable / bad creds).
28854
+ * Other non-200 codes propagate as exceptions via `sendXml`.
28855
+ */
28856
+ async testEmail(patch, options) {
28857
+ const current = await this.getEmail(options);
28858
+ const payloadXml = buildSetEmailXml(current, patch ?? {});
28859
+ const timeoutMs = options?.timeoutMs ?? 6e4;
28860
+ try {
28861
+ await this.sendXml({
28862
+ cmdId: BC_CMD_ID_TEST_EMAIL,
28863
+ payloadXml,
28864
+ timeoutMs
28865
+ });
28866
+ return true;
28867
+ } catch (err) {
28868
+ const msg = err instanceof Error ? err.message : String(err);
28869
+ if (msg.includes("response_code 482") || msg.includes("response_code=482")) {
28870
+ return false;
28871
+ }
28872
+ throw err;
28873
+ }
28874
+ }
28875
+ /**
28876
+ * Read the NTP server configuration (cmdId=38).
28877
+ */
28878
+ async getNtp(options) {
28879
+ const xml = await this.sendXml({
28880
+ cmdId: BC_CMD_ID_GET_NTP,
28881
+ ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28882
+ });
28883
+ return parseNtpConfigFromXml(xml);
28884
+ }
28885
+ /**
28886
+ * Patch the NTP server configuration (cmdId=39). Reads the current state
28887
+ * first and merges the patch — Reolink rejects partial `<Ntp>` blocks.
28888
+ */
28889
+ async setNtp(patch, options) {
28890
+ const current = await this.getNtp(options);
28891
+ const payloadXml = buildSetNtpXml(current, patch);
28892
+ await this.sendXml({
28893
+ cmdId: BC_CMD_ID_SET_NTP,
28894
+ payloadXml,
28895
+ ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28896
+ });
28897
+ }
28898
+ /**
28899
+ * Patch SystemGeneral (cmdId=105). Supports partial payloads: include only
28900
+ * the fields you want to change. By default the builder emits `<year>0</year>`
28901
+ * as the "do not set manual clock" marker; pass `manualTime` to actually
28902
+ * set the date/time. Setting only `deviceName` automatically uses the
28903
+ * Reolink Client's `deviceNameOnly=1` shape.
28904
+ */
28905
+ async setSystemGeneral(patch, options) {
28906
+ const payloadXml = buildSetSystemGeneralXml(patch);
28907
+ await this.sendXml({
28908
+ cmdId: BC_CMD_ID_SET_SYSTEM_GENERAL,
28909
+ payloadXml,
28910
+ ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28911
+ });
28912
+ }
28913
+ /**
28914
+ * Read the Daylight Saving Time configuration (cmdId=106).
28915
+ */
28916
+ async getDst(options) {
28917
+ const xml = await this.sendXml({
28918
+ cmdId: BC_CMD_ID_GET_DST,
28919
+ ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28920
+ });
28921
+ return parseDstConfigFromXml(xml);
28922
+ }
28923
+ /**
28924
+ * Patch the DST configuration (cmdId=107). Reads the current state first
28925
+ * and merges the patch.
28926
+ */
28927
+ async setDst(patch, options) {
28928
+ const current = await this.getDst(options);
28929
+ const payloadXml = buildSetDstXml(current, patch);
28930
+ await this.sendXml({
28931
+ cmdId: BC_CMD_ID_SET_DST,
28932
+ payloadXml,
28933
+ ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28934
+ });
28935
+ }
28936
+ /**
28937
+ * Read the auto-reboot schedule (cmdId=101).
28938
+ */
28939
+ async getAutoReboot(options) {
28940
+ const xml = await this.sendXml({
28941
+ cmdId: BC_CMD_ID_GET_AUTO_REBOOT,
28942
+ ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28943
+ });
28944
+ return parseAutoRebootFromXml(xml);
28945
+ }
28946
+ /**
28947
+ * Patch the auto-reboot schedule (cmdId=100).
28948
+ */
28949
+ async setAutoReboot(patch, options) {
28950
+ const current = await this.getAutoReboot(options);
28951
+ const payloadXml = buildSetAutoRebootXml(current, patch);
28952
+ await this.sendXml({
28953
+ cmdId: BC_CMD_ID_SET_AUTO_REBOOT,
28954
+ payloadXml,
28955
+ ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28956
+ });
28957
+ }
28958
+ /**
28959
+ * High-level helper that configures the camera to deliver motion alerts via
28960
+ * SMTP to the local nodelink manager. Orchestrates `setEmail` + `setEmailTask`
28961
+ * in a single call so UI code can offer "auto-configure" without juggling
28962
+ * the underlying commands.
28963
+ *
28964
+ * Pass `runTest: true` to also send a test email (cmdId=141). Returns a
28965
+ * structured result describing each leg of the flow so the caller can show
28966
+ * granular feedback.
28967
+ *
28968
+ * @param params Auto-configuration parameters
28969
+ * @param channel Logical channel (default 0). Used for the EmailTask SET.
28970
+ */
28971
+ async setupEmailPushToManager(params, channel, options) {
28972
+ const port = params.managerPort ?? 2525;
28973
+ const domain = params.domain ?? "nodelink.local";
28974
+ const recipient = `${params.recipientLocalPart}@${domain}`;
28975
+ const triggers = params.triggerTypes ?? ["MD", "people", "vehicle"];
28976
+ const attachmentType = params.attachmentType ?? "picture";
28977
+ const interval = params.interval ?? 30;
28978
+ const emailPatch = {
28979
+ smtpServer: params.managerHost,
28980
+ smtpPort: port,
28981
+ userName: params.authUsername ?? recipient,
28982
+ password: params.authPassword ?? "",
28983
+ address1: recipient,
28984
+ address2: "",
28985
+ address3: "",
28986
+ sendNickname: params.sendNickname ?? params.recipientLocalPart,
28987
+ attachment: attachmentType === "none" ? 0 : 1,
28988
+ attachmentType,
28989
+ textType: "withText",
28990
+ ssl: 0,
28991
+ interval
28992
+ };
28993
+ await this.setEmail(emailPatch, options);
28994
+ const fullWeekOn = "1".repeat(168);
28995
+ const current = await this.getEmailTask(channel, options);
28996
+ const triggerSet = new Set(triggers);
28997
+ const touched = [];
28998
+ const updatedList = current.typeScheduleList.map((item) => {
28999
+ if (triggerSet.has(item.type)) {
29000
+ touched.push(item.type);
29001
+ return { ...item, valueTable: fullWeekOn };
29002
+ }
29003
+ return item;
29004
+ });
29005
+ for (const t of triggers) {
29006
+ if (!current.typeScheduleList.some((item) => item.type === t)) {
29007
+ updatedList.push({ type: t, valueTable: fullWeekOn });
29008
+ touched.push(t);
29009
+ }
29010
+ }
29011
+ await this.setEmailTask(
29012
+ channel,
29013
+ {
29014
+ channelId: current.channelId,
29015
+ enable: 1,
29016
+ typeScheduleList: updatedList
29017
+ },
29018
+ options
29019
+ );
29020
+ const result = {
29021
+ setEmail: { applied: true },
29022
+ setEmailTask: { applied: true, touchedTypes: touched }
29023
+ };
29024
+ if (params.runTest) {
29025
+ const ok = await this.testEmail(emailPatch, options);
29026
+ result.testEmail = { success: ok };
29027
+ }
29028
+ return result;
28434
29029
  }
28435
29030
  /**
28436
29031
  * Get siren-on-motion state via AudioTask (cmdId=232).
@@ -28699,7 +29294,7 @@ ${xml}`
28699
29294
  cmdId: BC_CMD_ID_GET_SYSTEM_GENERAL,
28700
29295
  ...options?.timeoutMs != null ? { timeoutMs: options.timeoutMs } : {}
28701
29296
  });
28702
- return parseXmlFragmentToJson(xml);
29297
+ return parseSystemGeneralFromXml(xml);
28703
29298
  }
28704
29299
  /**
28705
29300
  * Get device support/capability flags.
@@ -39567,6 +40162,7 @@ function base64DecodeToBytes(b64) {
39567
40162
  BC_CMD_ID_GET_AUDIO_CFG,
39568
40163
  BC_CMD_ID_GET_AUDIO_TASK,
39569
40164
  BC_CMD_ID_GET_AUTO_FOCUS,
40165
+ BC_CMD_ID_GET_AUTO_REBOOT,
39570
40166
  BC_CMD_ID_GET_BATTERY_INFO,
39571
40167
  BC_CMD_ID_GET_BATTERY_INFO_LIST,
39572
40168
  BC_CMD_ID_GET_DAY_NIGHT_THRESHOLD,
@@ -39574,6 +40170,8 @@ function base64DecodeToBytes(b64) {
39574
40170
  BC_CMD_ID_GET_DING_DONG_CFG,
39575
40171
  BC_CMD_ID_GET_DING_DONG_LIST,
39576
40172
  BC_CMD_ID_GET_DING_DONG_SILENT,
40173
+ BC_CMD_ID_GET_DST,
40174
+ BC_CMD_ID_GET_EMAIL,
39577
40175
  BC_CMD_ID_GET_EMAIL_TASK,
39578
40176
  BC_CMD_ID_GET_ENC,
39579
40177
  BC_CMD_ID_GET_FTP_TASK,
@@ -39581,6 +40179,7 @@ function base64DecodeToBytes(b64) {
39581
40179
  BC_CMD_ID_GET_KIT_AP_CFG,
39582
40180
  BC_CMD_ID_GET_LED_STATE,
39583
40181
  BC_CMD_ID_GET_MOTION_ALARM,
40182
+ BC_CMD_ID_GET_NTP,
39584
40183
  BC_CMD_ID_GET_ONLINE_USER_LIST,
39585
40184
  BC_CMD_ID_GET_OSD_DATETIME,
39586
40185
  BC_CMD_ID_GET_PIR_INFO,
@@ -39621,19 +40220,24 @@ function base64DecodeToBytes(b64) {
39621
40220
  BC_CMD_ID_SET_AUDIO_CFG,
39622
40221
  BC_CMD_ID_SET_AUDIO_TASK,
39623
40222
  BC_CMD_ID_SET_AUTO_FOCUS,
40223
+ BC_CMD_ID_SET_AUTO_REBOOT,
39624
40224
  BC_CMD_ID_SET_DAY_NIGHT_THRESHOLD,
39625
40225
  BC_CMD_ID_SET_DING_DONG_CFG,
39626
40226
  BC_CMD_ID_SET_DING_DONG_SILENT,
40227
+ BC_CMD_ID_SET_DST,
40228
+ BC_CMD_ID_SET_EMAIL,
39627
40229
  BC_CMD_ID_SET_EMAIL_TASK,
39628
40230
  BC_CMD_ID_SET_ENC,
39629
40231
  BC_CMD_ID_SET_LED_STATE,
39630
40232
  BC_CMD_ID_SET_MOTION_ALARM,
40233
+ BC_CMD_ID_SET_NTP,
39631
40234
  BC_CMD_ID_SET_OSD_DATETIME,
39632
40235
  BC_CMD_ID_SET_PIR_INFO,
39633
40236
  BC_CMD_ID_SET_PRIVACY_MASK,
39634
40237
  BC_CMD_ID_SET_PUSH_TASK,
39635
40238
  BC_CMD_ID_SET_RECORD,
39636
40239
  BC_CMD_ID_SET_RECORD_CFG,
40240
+ BC_CMD_ID_SET_SYSTEM_GENERAL,
39637
40241
  BC_CMD_ID_SET_VIDEO_INPUT,
39638
40242
  BC_CMD_ID_SET_WHITE_LED_STATE,
39639
40243
  BC_CMD_ID_SET_WHITE_LED_TASK,
@@ -39643,6 +40247,7 @@ function base64DecodeToBytes(b64) {
39643
40247
  BC_CMD_ID_TALK_ABILITY,
39644
40248
  BC_CMD_ID_TALK_CONFIG,
39645
40249
  BC_CMD_ID_TALK_RESET,
40250
+ BC_CMD_ID_TEST_EMAIL,
39646
40251
  BC_CMD_ID_UDP_KEEP_ALIVE,
39647
40252
  BC_CMD_ID_VIDEO,
39648
40253
  BC_CMD_ID_VIDEO_STOP,