@mega-yfue/eufy-sdk 0.5.0-beta.71 → 0.5.0-beta.73

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.
@@ -182,6 +182,11 @@ export interface AiDetectFlags {
182
182
  export declare function encodeAiDetectType(flags: AiDetectFlags): number;
183
183
  /** Decode an `ai_detect_type` bitmask → which detection types are on. */
184
184
  export declare function decodeAiDetectType(value: number): AiDetectFlags;
185
+ /**
186
+ * The `ai_detect_type` bitmask from a stored 1298 value: the bare number, or the numeric
187
+ * `ai_detect_type` field of the JSON object form. Answers `undefined` for any other shape.
188
+ */
189
+ declare function decodeAiDetectTypeParam(raw: unknown): number | undefined;
185
190
  /**
186
191
  * Decode a `radar_wd_switch` (2706, loitering) read the way the app does:
187
192
  * `typeof v === "object" ? v.radar_wd_switch : v`. The device may store it as a JSON object
@@ -245,11 +250,15 @@ export declare const MOTION_MEMBERS: {
245
250
  * 1298 holds the detailed AI-type BITMASK (live-observed: `0x30000` enabled-base | type bits, e.g. a
246
251
  * T8425 reads `0x3000f`). Cams also report 1299 (`hbAiDetectType`) but that is a separate, simpler
247
252
  * value (1) — NOT this bitmask, so 1298 is the read/write id.
253
+ *
254
+ * The value arrives in two shapes, both read by the app's 1298 parser: a bare bitmask, or a JSON
255
+ * object carrying the same bitmask as `ai_detect_type` (see {@link decodeAiDetectTypeParam}).
248
256
  */
249
257
  readonly aiDetectType: {
250
258
  readonly param: 1298;
251
- readonly type: "number";
252
- readonly kind: "bitfield";
259
+ readonly type: "string";
260
+ readonly decode: typeof decodeAiDetectTypeParam;
261
+ readonly decodedKind: "bitfield";
253
262
  readonly provenance: "verified";
254
263
  readonly description: string;
255
264
  readonly write: (v: string | number | boolean, ctx: CommandContext) => Command | undefined;
@@ -379,3 +388,4 @@ export declare const MOTION_MEMBERS: {
379
388
  };
380
389
  };
381
390
  export declare const MOTION: CapabilityModule;
391
+ export {};
@@ -113,9 +113,9 @@ export declare class RtcCommandRouter {
113
113
  private stationSession;
114
114
  /**
115
115
  * One bounded bring-up: the session is up when its command channel opens, and it fails, with the
116
- * session closed and every listener gone, when `connect()` throws, the session closes first, or
117
- * {@link CONNECT_TIMEOUT_MS} passes. A single promise, so an early failure cannot leave a second one
118
- * rejecting unheard.
116
+ * session closed and every listener gone, when `connect()` throws, the session closes first (rejecting
117
+ * with the failure that closed it, when it carries one), or {@link CONNECT_TIMEOUT_MS} passes. A single
118
+ * promise, so an early failure cannot leave a second one rejecting unheard.
119
119
  */
120
120
  private bringUp;
121
121
  /**
@@ -15,7 +15,8 @@
15
15
  *
16
16
  * The command data channel is the session: `close` fires once, when the channel closes, the peer fails,
17
17
  * the signalling socket drops or {@link RtcSession.close} is called, even while the peer connection is
18
- * nominally up.
18
+ * nominally up. A peer that cannot be built when the hub grants the relay ends the session there: the
19
+ * failure is emitted as `error` and `close` fires carrying it.
19
20
  *
20
21
  * A session whose peer is a {@link RtcPeerOptions.mediaTrack} peer has no command channel: `close` fires
21
22
  * when the peer fails or closes, and the video track's packets are emitted as `rtp`.
@@ -32,7 +33,8 @@ export interface RtcSessionOptions extends RtcSignalingOptions {
32
33
  }
33
34
  export interface RtcSessionEvents {
34
35
  connected: [];
35
- close: [];
36
+ /** The session ended; `err` is the failure that ended it, when one did. */
37
+ close: [err?: Error];
36
38
  error: [err: Error];
37
39
  /** A reassembled command or notify frame: portal packet bytes + the link type it arrived on. */
38
40
  commandData: [frame: Buffer, linkType: number];
@@ -73,6 +75,8 @@ export declare class RtcSession extends EventEmitter<RtcSessionEvents> {
73
75
  * `connect()` still waiting for the signalling auth is rejected and its timer stopped.
74
76
  */
75
77
  close(): void;
78
+ /** {@link RtcSession.close}, with the failure that ended the session handed to `close` when one did. */
79
+ private shutdown;
76
80
  /**
77
81
  * Trickle one local candidate, or the empty end-of-candidates. The native peer can report one after the
78
82
  * signalling socket has closed, and sending then throws inside a native callback, where the throw can't
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mega-yfue/eufy-sdk",
3
- "version": "0.5.0-beta.71",
3
+ "version": "0.5.0-beta.73",
4
4
  "description": "One typed TypeScript client for the Anker eufy v6 cloud — capability-driven devices, realtime events over P2P/MQTT/push, and live media",
5
5
  "license": "Apache-2.0",
6
6
  "author": "mega-yfue",