@camstack/addon-provider-reolink 1.2.29 → 1.2.30

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/addon.js CHANGED
@@ -19732,7 +19732,16 @@ targets: array(object({
19732
19732
  /** A sleeping battery camera: the frame is deliberately stale and will
19733
19733
  * NOT refresh in the background. A surface should say so rather than
19734
19734
  * present it as current. */
19735
- sleeping: boolean()
19735
+ sleeping: boolean(),
19736
+ /** Current device state rendered over the cached frame. State images
19737
+ * remain authoritative even when their photographic background is
19738
+ * old; null means the link must carry a current camera frame. */
19739
+ stateReason: _enum([
19740
+ "disabled",
19741
+ "sleeping",
19742
+ "unreachable",
19743
+ "waking"
19744
+ ]).nullable()
19736
19745
  })))
19737
19746
  },
19738
19747
  status: {
@@ -230916,6 +230925,39 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
230916
230925
  });
230917
230926
  await sleep$1(1500);
230918
230927
  })(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeForStream timeout")), timeoutMs))]);
230928
+ const CONFIRM_TIMEOUT_MS = 1e4;
230929
+ const CONFIRM_POLL_MS = 1e3;
230930
+ const confirmDeadline = Date.now() + CONFIRM_TIMEOUT_MS;
230931
+ let confirmed = false;
230932
+ while (Date.now() < confirmDeadline) {
230933
+ let state = null;
230934
+ try {
230935
+ state = api.getSleepStatus({ channel: this.getChannel() }).state;
230936
+ } catch {
230937
+ state = null;
230938
+ }
230939
+ if (state === "awake") {
230940
+ confirmed = true;
230941
+ break;
230942
+ }
230943
+ await sleep$1(CONFIRM_POLL_MS);
230944
+ }
230945
+ if (confirmed && this.commitSleepState(false, "sleep-poll")) {
230946
+ this.ctx.logger.info("battery wakeForStream: wake confirmed — driving wake transition", {
230947
+ tags: { deviceId: this.id },
230948
+ meta: { confirmMs: Date.now() - startedAt }
230949
+ });
230950
+ this.onWakeTransition("sleep-poll").catch(() => {});
230951
+ } else if (!confirmed) {
230952
+ this.ctx.logger.warn("battery wakeForStream: ACK received but no awake evidence inside the confirm window", {
230953
+ tags: { deviceId: this.id },
230954
+ meta: { confirmTimeoutMs: CONFIRM_TIMEOUT_MS }
230955
+ });
230956
+ return {
230957
+ awoke: false,
230958
+ durationMs: Date.now() - startedAt
230959
+ };
230960
+ }
230919
230961
  return {
230920
230962
  awoke: true,
230921
230963
  durationMs: Date.now() - startedAt
package/dist/addon.mjs CHANGED
@@ -19727,7 +19727,16 @@ targets: array(object({
19727
19727
  /** A sleeping battery camera: the frame is deliberately stale and will
19728
19728
  * NOT refresh in the background. A surface should say so rather than
19729
19729
  * present it as current. */
19730
- sleeping: boolean()
19730
+ sleeping: boolean(),
19731
+ /** Current device state rendered over the cached frame. State images
19732
+ * remain authoritative even when their photographic background is
19733
+ * old; null means the link must carry a current camera frame. */
19734
+ stateReason: _enum([
19735
+ "disabled",
19736
+ "sleeping",
19737
+ "unreachable",
19738
+ "waking"
19739
+ ]).nullable()
19731
19740
  })))
19732
19741
  },
19733
19742
  status: {
@@ -230896,6 +230905,39 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
230896
230905
  });
230897
230906
  await sleep$1(1500);
230898
230907
  })(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeForStream timeout")), timeoutMs))]);
230908
+ const CONFIRM_TIMEOUT_MS = 1e4;
230909
+ const CONFIRM_POLL_MS = 1e3;
230910
+ const confirmDeadline = Date.now() + CONFIRM_TIMEOUT_MS;
230911
+ let confirmed = false;
230912
+ while (Date.now() < confirmDeadline) {
230913
+ let state = null;
230914
+ try {
230915
+ state = api.getSleepStatus({ channel: this.getChannel() }).state;
230916
+ } catch {
230917
+ state = null;
230918
+ }
230919
+ if (state === "awake") {
230920
+ confirmed = true;
230921
+ break;
230922
+ }
230923
+ await sleep$1(CONFIRM_POLL_MS);
230924
+ }
230925
+ if (confirmed && this.commitSleepState(false, "sleep-poll")) {
230926
+ this.ctx.logger.info("battery wakeForStream: wake confirmed — driving wake transition", {
230927
+ tags: { deviceId: this.id },
230928
+ meta: { confirmMs: Date.now() - startedAt }
230929
+ });
230930
+ this.onWakeTransition("sleep-poll").catch(() => {});
230931
+ } else if (!confirmed) {
230932
+ this.ctx.logger.warn("battery wakeForStream: ACK received but no awake evidence inside the confirm window", {
230933
+ tags: { deviceId: this.id },
230934
+ meta: { confirmTimeoutMs: CONFIRM_TIMEOUT_MS }
230935
+ });
230936
+ return {
230937
+ awoke: false,
230938
+ durationMs: Date.now() - startedAt
230939
+ };
230940
+ }
230899
230941
  return {
230900
230942
  awoke: true,
230901
230943
  durationMs: Date.now() - startedAt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.2.29",
3
+ "version": "1.2.30",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",