@mega-yfue/eufy-sdk 0.5.0-beta.2 → 0.5.0-beta.20
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/client/device-registry.d.ts +24 -2
- package/dist/client/eufy-mega.d.ts +20 -6
- package/dist/client/types.d.ts +1 -1
- package/dist/core/contracts.d.ts +46 -23
- package/dist/core/store.d.ts +2 -0
- package/dist/index.js +1581 -84
- package/dist/index.js.map +4 -4
- package/dist/model/capabilities/camera.d.ts +24 -10
- package/dist/model/capabilities/light.d.ts +3 -0
- package/dist/model/capabilities/vacuum-clean.d.ts +19 -13
- package/dist/model/device-family.d.ts +2 -0
- package/dist/model/registry.d.ts +3 -2
- package/dist/model/types.d.ts +6 -0
- package/dist/transport/http/mega-client.d.ts +26 -0
- package/dist/transport/p2p/command-router.d.ts +13 -5
- package/dist/transport/p2p/fmp4.d.ts +6 -1
- package/dist/transport/p2p/live-stream.d.ts +3 -0
- package/dist/transport/p2p/p2p-session.d.ts +7 -2
- package/dist/transport/p2p/talkback.d.ts +21 -10
- package/dist/transport/p2p/video.d.ts +3 -2
- package/dist/transport/rtc/command-router.d.ts +72 -0
- package/dist/transport/rtc/peer.d.ts +93 -0
- package/dist/transport/rtc/portal-packet.d.ts +66 -0
- package/dist/transport/rtc/ptcs-framer.d.ts +85 -0
- package/dist/transport/rtc/scall-sdp.d.ts +42 -0
- package/dist/transport/rtc/session.d.ts +78 -0
- package/dist/transport/rtc/signaling.d.ts +137 -0
- package/package.json +9 -1
|
@@ -16,7 +16,10 @@ export interface DeviceRecord {
|
|
|
16
16
|
deviceType?: number;
|
|
17
17
|
model?: string;
|
|
18
18
|
category?: string;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The app-shown device name: `alias_name` first on a vacuum, `device_name` first otherwise;
|
|
21
|
+
* see {@link CloudRecord.name}.
|
|
22
|
+
*/
|
|
20
23
|
name?: string;
|
|
21
24
|
/** Parent HomeBase serial when attached (topology signal; see {@link CloudRecord.parentSn}). */
|
|
22
25
|
parentSn?: string;
|
|
@@ -92,6 +95,8 @@ export declare class DeviceRegistry {
|
|
|
92
95
|
private overlayRefusalReported;
|
|
93
96
|
/** Per-serial capability cache for {@link capabilitiesForDevice}; `null` = negative hit. */
|
|
94
97
|
private readonly deviceCapsCache;
|
|
98
|
+
/** Per-serial cloud data points of an AIoT robot, joined beneath the params in {@link record} — see {@link loadCloudDps}. */
|
|
99
|
+
private readonly cloudDps;
|
|
95
100
|
/** Per-serial realtime state, keyed by param id in the device's own namespace (see {@link DeviceRecord.dpParams}). */
|
|
96
101
|
private readonly dpParams;
|
|
97
102
|
/** Callers blocked in {@link awaitRealtimeState}, released by the device's first report. */
|
|
@@ -181,9 +186,26 @@ export declare class DeviceRegistry {
|
|
|
181
186
|
* transport stacks own the claim predicate over the record.
|
|
182
187
|
*/
|
|
183
188
|
require(sn: string): EufyDevice;
|
|
189
|
+
/**
|
|
190
|
+
* Hold an AIoT robot's cloud data points: the cloud's last-known value of each one it has reported,
|
|
191
|
+
* from `getDeviceRelationList`'s per-device `dps`.
|
|
192
|
+
*
|
|
193
|
+
* The device list carries only some of a robot's data points, so a point the robot publishes on change
|
|
194
|
+
* alone (its scene list, its schedules, its consumables) has no value until it next reports. The
|
|
195
|
+
* relation list holds every one, for an account the robot is shared with as well as its owner.
|
|
196
|
+
*
|
|
197
|
+
* Kept apart from the device list's params rather than merged into them: those are what a poll diffs,
|
|
198
|
+
* and a diff retires the realtime report for that id, so a cloud value lagging the robot's last report
|
|
199
|
+
* would replace it. {@link record} joins this beneath both halves. A failure keeps what was held.
|
|
200
|
+
*
|
|
201
|
+
* Limited to {@link CLOUD_DPS_MODELS}, the models whose relation-list `dps` are checked to carry the
|
|
202
|
+
* DP numbers their realtime reports use.
|
|
203
|
+
*/
|
|
204
|
+
private loadCloudDps;
|
|
184
205
|
/**
|
|
185
206
|
* Resolve a serial to a {@link DeviceRecord} with current params: starts from the device-list params, then
|
|
186
|
-
* overlays a fresh `get_device_param_list` when that call is available to this account.
|
|
207
|
+
* overlays a fresh `get_device_param_list` when that call is available to this account. An AIoT robot's
|
|
208
|
+
* cloud data points ({@link loadCloudDps}) sit beneath both, filling only ids neither carries.
|
|
187
209
|
*
|
|
188
210
|
* The overlay is **owner-gated** — a shared or member account is refused it for every device, permanently,
|
|
189
211
|
* which {@link OWNER_ONLY_CODE} identifies — so when it is unavailable the device list is the source
|
|
@@ -98,6 +98,8 @@ export declare class EufyMega extends EventEmitter {
|
|
|
98
98
|
private readonly prewarmTiers;
|
|
99
99
|
/** Transport-side owner of the P2P sessions + all wire senders. */
|
|
100
100
|
private readonly p2p;
|
|
101
|
+
/** Transport-side owner of the T9000 station sessions (sibling of {@link p2p}). */
|
|
102
|
+
private readonly rtc;
|
|
101
103
|
/** Transport-side owner of the secure-MQTT ff09 lock/garage command path (sibling of {@link p2p}). */
|
|
102
104
|
private readonly mqtt;
|
|
103
105
|
/** Transport-side owner of the legacy Tuya REST command path for non-AIoT vacuums (G-series). */
|
|
@@ -234,6 +236,11 @@ export declare class EufyMega extends EventEmitter {
|
|
|
234
236
|
*
|
|
235
237
|
* The evidence set is widened, never replaced: the ids come back through the cloud record, and a
|
|
236
238
|
* record that omits a realtime-only id would otherwise un-know it and re-trigger on the next report.
|
|
239
|
+
*
|
|
240
|
+
* The device is re-resolved against the fresh record before binding. A property gated on a
|
|
241
|
+
* realtime-only param enters the schema only once that param is evidence, and the value that made it
|
|
242
|
+
* evidence was stored before the property existed, so the record's realtime params are applied again
|
|
243
|
+
* to land it under the property's name.
|
|
237
244
|
*/
|
|
238
245
|
private rebindReads;
|
|
239
246
|
/** The distinct credential scopes the current MQTT roster needs — no devices on a scope, no connection. */
|
|
@@ -261,6 +268,8 @@ export declare class EufyMega extends EventEmitter {
|
|
|
261
268
|
* only "differs from what was read before", which state already on hand can satisfy spuriously — and the
|
|
262
269
|
* caller that has no expectation is the push path, where the signal itself is the news that a re-read is owed.
|
|
263
270
|
*
|
|
271
|
+
* Only a write's observation throws at the deadline; a push with nothing moved answers `false`.
|
|
272
|
+
*
|
|
264
273
|
* The cloud half is asked for through {@link DeviceRegistry.refreshedList}, never by fetching the account
|
|
265
274
|
* list outright. The fetch is account-wide — one house list plus one device list per house — so a param that
|
|
266
275
|
* never converges would otherwise spend a whole burst of those every iteration of this loop, and concurrent
|
|
@@ -409,8 +418,9 @@ export declare class EufyMega extends EventEmitter {
|
|
|
409
418
|
* The `eufy_life` DP writes (smart lights) are secure-MQTT-only. `aiot-dp` routes to either the
|
|
410
419
|
* Anker AIoT MQTT stack or the legacy Tuya REST router depending on the device's category
|
|
411
420
|
* (`eufy_home_tuya` → Tuya, everything else → MQTT). The capability layer emits a single `aiot-dp`
|
|
412
|
-
* kind and stays transport-agnostic; only the facade sees both sides and decides here.
|
|
413
|
-
*
|
|
421
|
+
* kind and stays transport-agnostic; only the facade sees both sides and decides here. A T9000
|
|
422
|
+
* station and the devices attached to it go over RTC, with an attached device's command refused
|
|
423
|
+
* unless its channel resolves back to it on the station. Everything else is P2P.
|
|
414
424
|
*/
|
|
415
425
|
private routeCommand;
|
|
416
426
|
/**
|
|
@@ -835,11 +845,14 @@ export declare class EufyMega extends EventEmitter {
|
|
|
835
845
|
*/
|
|
836
846
|
setProperty(sn: string, name: string, value: boolean | number | string): Promise<void>;
|
|
837
847
|
/**
|
|
838
|
-
* Restart a HomeBase.
|
|
848
|
+
* Restart a station: a HomeBase, or a camera-family device that is its own station.
|
|
839
849
|
*
|
|
840
|
-
*
|
|
841
|
-
*
|
|
842
|
-
*
|
|
850
|
+
* The restart is `RESTART_HUB` on the station's broadcast channel, so it reaches whatever owns the
|
|
851
|
+
* P2P session. A standalone camera or doorbell owns its own session and is the station it restarts.
|
|
852
|
+
* A camera attached to a HomeBase is not — the same frame would restart its HomeBase — so its serial
|
|
853
|
+
* throws, as does any non-camera serial, rather than doing nothing. The device drops its connection
|
|
854
|
+
* and returns after a minute or two; a HomeBase takes everything behind it offline meanwhile.
|
|
855
|
+
* Verified on real hardware against a HomeBase and a standalone indoor camera.
|
|
843
856
|
*/
|
|
844
857
|
reboot(sn: string): Promise<void>;
|
|
845
858
|
/**
|
|
@@ -857,6 +870,7 @@ export declare class EufyMega extends EventEmitter {
|
|
|
857
870
|
* exactly the reads it has.
|
|
858
871
|
*/
|
|
859
872
|
private fetchDpCatalog;
|
|
873
|
+
/** The {@link CommandContext} for a device, built from `known` when that record is already in hand. */
|
|
860
874
|
private commandContext;
|
|
861
875
|
/**
|
|
862
876
|
* **Generic P2P request/reply query** — sends a `SET_PAYLOAD` sub-command and resolves with the
|
package/dist/client/types.d.ts
CHANGED
package/dist/core/contracts.d.ts
CHANGED
|
@@ -230,7 +230,7 @@ export interface StateConvergenceFailure {
|
|
|
230
230
|
property: string;
|
|
231
231
|
param: number;
|
|
232
232
|
/** The RAW param value the write asked the device to report. */
|
|
233
|
-
expected
|
|
233
|
+
expected: boolean | number | string;
|
|
234
234
|
/** What the param actually read when the deadline passed, absent where the device reported none at all. */
|
|
235
235
|
observed?: boolean | number | string;
|
|
236
236
|
timeoutMs: number;
|
|
@@ -248,7 +248,7 @@ export declare class StateConvergenceError extends Error {
|
|
|
248
248
|
readonly sn: string;
|
|
249
249
|
readonly property: string;
|
|
250
250
|
readonly param: number;
|
|
251
|
-
readonly expected
|
|
251
|
+
readonly expected: boolean | number | string;
|
|
252
252
|
readonly observed?: boolean | number | string;
|
|
253
253
|
readonly timeoutMs: number;
|
|
254
254
|
constructor(failure: StateConvergenceFailure);
|
|
@@ -548,19 +548,30 @@ export interface LiveVideoConfig {
|
|
|
548
548
|
* 7 → `mp4a.40.39`); it fails the stream on anything else.
|
|
549
549
|
*/
|
|
550
550
|
export type AudioCodec = "aac-lc" | "aac-eld" | "g711a";
|
|
551
|
+
/** The codec a camera's speaker plays: `aac-eld` on a camera whose speaker plays it, `aac-lc` otherwise. */
|
|
552
|
+
export type TalkbackCodec = Extract<AudioCodec, "aac-lc" | "aac-eld">;
|
|
551
553
|
/**
|
|
552
554
|
* One audio access unit, carrying the codec the station declared for it.
|
|
553
555
|
*
|
|
554
|
-
* Sample rate and channel count are
|
|
555
|
-
* 16 kHz mono for every audio type rather than reading them
|
|
556
|
-
*
|
|
556
|
+
* Sample rate and channel count are absent for `aac-lc` and `g711a`: they are not on the wire, and the v6 app
|
|
557
|
+
* assumes 16 kHz mono for every audio type rather than reading them. An `aac-lc` frame is one ADTS frame and
|
|
558
|
+
* `g711a` is raw A-law. An `aac-eld` frame is one raw access unit with no transport framing, so it carries the
|
|
559
|
+
* AudioSpecificConfig that decodes it.
|
|
557
560
|
*/
|
|
558
|
-
export
|
|
561
|
+
export type LiveAudioFrame = {
|
|
559
562
|
/** Codec declared in the frame header. */
|
|
560
|
-
codec:
|
|
561
|
-
/**
|
|
563
|
+
codec: "aac-lc" | "g711a";
|
|
564
|
+
/** One ADTS frame for `aac-lc`, raw A-law samples for `g711a`. */
|
|
562
565
|
data: Buffer;
|
|
563
|
-
|
|
566
|
+
config?: undefined;
|
|
567
|
+
} | {
|
|
568
|
+
/** Codec declared in the frame header. */
|
|
569
|
+
codec: "aac-eld";
|
|
570
|
+
/** One raw AAC-ELD access unit. */
|
|
571
|
+
data: Buffer;
|
|
572
|
+
/** AudioSpecificConfig (ISO/IEC 14496-3) that decodes `data`. */
|
|
573
|
+
config: Buffer;
|
|
574
|
+
};
|
|
564
575
|
/**
|
|
565
576
|
* One fragmented-MP4 (CMAF) output unit from the native muxer. `init` (the `ftyp`+`moov` init
|
|
566
577
|
* segment) is present exactly once, on the first fragment; every fragment carries a `moof`+`mdat`
|
|
@@ -868,10 +879,11 @@ export interface MediaProvider {
|
|
|
868
879
|
}): Promise<Record<string, unknown>>;
|
|
869
880
|
}
|
|
870
881
|
/**
|
|
871
|
-
* An encoder that turns raw PCM into AAC-LC frames, supplied by the CALLER. The SDK ships none:
|
|
872
|
-
*
|
|
882
|
+
* An encoder that turns raw PCM into AAC-LC frames, supplied by the CALLER. The SDK ships none: an
|
|
883
|
+
* `aac-lc` speaker plays AAC-LC 16 kHz mono, and every plausible encoder is either a native
|
|
873
884
|
* dependency or an external process, both of which belong to the host rather than to a protocol SDK.
|
|
874
|
-
* It is unnecessary where the audio is already AAC — see {@link TalkbackHandle}.
|
|
885
|
+
* It is unnecessary where the audio is already AAC — see {@link TalkbackHandle}. A camera whose speaker
|
|
886
|
+
* plays `aac-eld` refuses an encoder: a talkback opened with one is rejected before the speaker path opens.
|
|
875
887
|
*
|
|
876
888
|
* `encode` receives 16-bit little-endian mono PCM at 16 kHz and returns whole ADTS frames, zero or
|
|
877
889
|
* more per call (an encoder buffers until it has a full 1024-sample block). `flush` drains a partial
|
|
@@ -886,17 +898,19 @@ export interface AacEncoder {
|
|
|
886
898
|
* A live talkback session: audio pushed from the host to a camera's speaker, the mirror of
|
|
887
899
|
* {@link LiveStreamHandle}'s inbound feed.
|
|
888
900
|
*
|
|
889
|
-
* Audio must be
|
|
890
|
-
* stream at another rate or channel count is rejected rather than resampled (it would otherwise play
|
|
891
|
-
* at the wrong pitch and speed). Feed it either way:
|
|
901
|
+
* Audio must be in the codec the camera's speaker plays, {@link TalkbackHandle.codec}:
|
|
892
902
|
*
|
|
893
|
-
* -
|
|
894
|
-
* stream
|
|
895
|
-
*
|
|
896
|
-
*
|
|
903
|
+
* - **`aac-lc`:** AAC-LC, 16 kHz, mono, in ADTS frames, through `write` / `writable()`. Chunk boundaries are
|
|
904
|
+
* irrelevant; frames are recovered from the stream. With an {@link AacEncoder}, `write` takes 16-bit
|
|
905
|
+
* little-endian mono PCM at 16 kHz instead.
|
|
906
|
+
* - **`aac-eld`:** one raw AAC-ELD access unit with LD-SBR (16 kHz, mono, 512 samples) per `write`, or per
|
|
907
|
+
* object-mode `writable()` write. No encoder applies.
|
|
897
908
|
*
|
|
898
|
-
*
|
|
899
|
-
*
|
|
909
|
+
* An `aac-lc` stream at another rate or channel count is rejected rather than resampled. An `aac-eld` unit longer
|
|
910
|
+
* than the device accepts is refused with an `error`.
|
|
911
|
+
*
|
|
912
|
+
* Frames are **paced** at their own playback rate (64 ms for `aac-lc`, 32 ms for `aac-eld`) rather than flushed as
|
|
913
|
+
* fast as they arrive, so feeding a file plays it at speed instead of overrunning the device. A live source keeps
|
|
900
914
|
* the queue near-empty and is unaffected.
|
|
901
915
|
*
|
|
902
916
|
* @example
|
|
@@ -908,7 +922,16 @@ export interface AacEncoder {
|
|
|
908
922
|
* ```
|
|
909
923
|
*/
|
|
910
924
|
export interface TalkbackHandle {
|
|
911
|
-
/**
|
|
925
|
+
/**
|
|
926
|
+
* The codec this camera's speaker plays: `aac-eld` on a camera whose speaker plays it and whose stream on the same
|
|
927
|
+
* media session carries `aac-eld`, `aac-lc` otherwise, including when that stream carries no audio. It decides
|
|
928
|
+
* what {@link write} and {@link writable} take.
|
|
929
|
+
*/
|
|
930
|
+
readonly codec: TalkbackCodec;
|
|
931
|
+
/**
|
|
932
|
+
* Queue audio: ADTS frames or PCM for `aac-lc`, one access unit per call for `aac-eld`. Partial ADTS frames are
|
|
933
|
+
* held.
|
|
934
|
+
*/
|
|
912
935
|
write(chunk: Buffer): void;
|
|
913
936
|
/**
|
|
914
937
|
* A `node:stream` Writable over {@link write}, for piping a file or an encoder's stdout. Applies
|
|
@@ -931,7 +954,7 @@ export interface TalkbackHandle {
|
|
|
931
954
|
*
|
|
932
955
|
* This deliberately does NOT fire on a merely-empty queue. A realtime source keeps the queue near
|
|
933
956
|
* empty by design, so "queue is empty" arrives after the very first frame and stopping on it would
|
|
934
|
-
* cut the clip to
|
|
957
|
+
* cut the clip to one frame. {@link pending} is the instantaneous depth.
|
|
935
958
|
*/
|
|
936
959
|
on(event: "finished", listener: () => void): this;
|
|
937
960
|
/**
|
package/dist/core/store.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface PersistedSession {
|
|
|
16
16
|
authToken: string;
|
|
17
17
|
geoKey?: string;
|
|
18
18
|
region: RegionShard;
|
|
19
|
+
/** The host `estimate_domain` answered; it names shards the region classification cannot (`ie`). */
|
|
20
|
+
estimatedDomain?: string;
|
|
19
21
|
openudid: string;
|
|
20
22
|
/** This install's reported device model + media user-agent, generated once and reused. */
|
|
21
23
|
phoneModel?: string;
|