@mega-yfue/eufy-sdk 0.6.0-beta.18 → 0.6.0-beta.19

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.
@@ -12,44 +12,41 @@ export declare const BIZ_PROTOCOL: {
12
12
  readonly LIVE_PHOTO: 43;
13
13
  };
14
14
  /**
15
- * The channels a map frame can arrive on, by id.
15
+ * The channels a map frame arrives on, by id, as a robot's own frames identify them.
16
16
  *
17
- * **The trap.** Ids 1–10 come from `Metadata.ChanIds` in `stream.proto`, where each *field* names a
18
- * message and each field's *value* is the id the device chose for it. The names below pair each
19
- * channel with its field NUMBER, because that is the numbering the vendor ships and the one a live
20
- * capture shows — but a device announcing a `Metadata` frame is announcing its own numbering, and a
21
- * firmware that renumbers would make this table wrong without making it look wrong. Anything that
22
- * *decodes* a channel's bytes must therefore prefer a device-declared mapping when one has been seen;
23
- * this table is the default to fall back on, not an authority.
17
+ * Each id is paired with the `stream.proto` message whose field layout its frames carry, which is not
18
+ * the field-number order of `Metadata.ChanIds`: the cell plane (`Map`) arrives on 2, its room outline
19
+ * on 4, the room list on 5, the restricted zones on 6, the robot's pose (`DynamicData`) on 7, the map's
20
+ * `MapDescription` on 60 and a whole `MapBackup` on 68. A `Metadata` frame would declare a device's own numbering; none has been seen,
21
+ * so none is read, and this table is the numbering every frame is read by.
24
22
  *
25
- * Channel 0 is the exception and is not in `ChanIds` at all: the app hard-codes it, routing it to a
26
- * scene-data event rather than a map one, and asks for the scene list on it by number. That one is
27
- * fixed.
23
+ * Only channels whose message is identified are listed. A channel whose frames carry too little to
24
+ * identify, or that carries a message nothing here reads, is absent.
25
+ *
26
+ * Channel 0 is not in `ChanIds` at all: the app hard-codes it, routing it to a scene-data event rather
27
+ * than a map one, and asks for the scene list on it by number.
28
28
  */
29
29
  export declare const BIZ_CHANNEL: {
30
30
  /** Scene (room-group) data. Hard-coded in the app, not part of `ChanIds`. */
31
31
  readonly SCENES: 0;
32
- readonly MAP_INFO: 1;
33
- readonly PATH: 2;
34
- readonly ROOM_OUTLINE: 3;
35
- readonly ROOM_PARAMS: 4;
36
- readonly RESTRICTED_ZONE: 5;
37
- readonly DYNAMIC_DATA: 6;
38
- readonly TEMPORARY_DATA: 7;
39
- readonly OBSTACLE_INFO: 8;
40
- readonly MAP_DATA: 9;
41
- readonly CRUISE_DATA: 10;
32
+ readonly MAP_DATA: 2;
33
+ readonly ROOM_OUTLINE: 4;
34
+ readonly ROOM_PARAMS: 5;
35
+ readonly RESTRICTED_ZONE: 6;
36
+ readonly DYNAMIC_DATA: 7;
37
+ readonly MAP_DESCRIPTION: 60;
38
+ readonly MAP_BACKUP: 68;
42
39
  };
43
- /** A channel's name under the default numbering — see the trap in {@link BIZ_CHANNEL}. */
40
+ /** A channel's name under the {@link BIZ_CHANNEL} numbering. */
44
41
  export type BizChannel = keyof typeof BIZ_CHANNEL;
45
42
  /**
46
- * Name a channel id under the default numbering, or `undefined` for an id the vendor's table does not
47
- * list. Not a substitute for a device-declared mapping where one exists.
43
+ * Name a channel id under the {@link BIZ_CHANNEL} numbering, or `undefined` for an id it does not list.
44
+ * Not a substitute for a device-declared mapping where one exists.
48
45
  */
49
46
  export declare function bizChannelName(id: number): BizChannel | undefined;
50
47
  /** One frame off the map stream, unwrapped as far as its bytes but not decoded. */
51
48
  export interface BizMapFrame {
52
- /** Which channel the bytes belong to. Compare against {@link BIZ_CHANNEL}, mindful of its trap. */
49
+ /** Which channel the bytes belong to. Compare against {@link BIZ_CHANNEL}. */
53
50
  readonly channelId: number;
54
51
  /**
55
52
  * The vendor's `clear_type`. Forwarded, not interpreted: the app passes it straight through to its
@@ -62,6 +62,8 @@ export interface P2PRouterDeps {
62
62
  onClose: (stationSn: string) => void;
63
63
  onError: (err: Error) => void;
64
64
  onLevel2Ready: (stationSn: string, cipherId: number) => void;
65
+ /** The station answered on its own session at `atMs` — a PONG or an ACK from the connected peer. */
66
+ onPeerAnswer?: (stationSn: string, atMs: number) => void;
65
67
  /** A raw decoded frame — the client emits the low-level `p2p` event + runs the semantic decode. */
66
68
  onFrame: (stationSn: string, frame: P2PFrame) => void;
67
69
  /**
@@ -95,6 +95,12 @@ export interface P2PFrame extends P2PDataFrameHeader {
95
95
  * the values as device state without any per-capability decoder.
96
96
  */
97
97
  params?: Record<number, string>;
98
+ /**
99
+ * A station's camera-info table, one `param_type → param_value` map per channel it names (255 is the
100
+ * station). Set instead of {@link params} when the station answered on {@link STATION_CHANNEL}, so each
101
+ * channel's state can land on the device attached there.
102
+ */
103
+ channelParams?: Record<number, Record<number, string>>;
98
104
  }
99
105
  /**
100
106
  * A live PPCS session. Internal transport; a host drives cameras through the capability surface.
@@ -134,7 +140,12 @@ export declare class P2PSession extends EventEmitter {
134
140
  private audioStalled;
135
141
  private audioRetransmitTimer?;
136
142
  private lastPongData?;
137
- /** When the selected peer last answered outbound P2P traffic on this connection. */
143
+ /**
144
+ * When the selected peer last answered outbound P2P traffic on this connection.
145
+ *
146
+ * Each answer also emits `peerAnswer` with this time: a PONG or an ACK from the connected address is the
147
+ * station replying on this connection now, which a heartbeat draws every {@link HEARTBEAT_MS}.
148
+ */
138
149
  private lastPeerAt?;
139
150
  /** Whether the silence has already been stated, so it is traced once per connection rather than per read. */
140
151
  private pathStaleTraced;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mega-yfue/eufy-sdk",
3
- "version": "0.6.0-beta.18",
3
+ "version": "0.6.0-beta.19",
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",