1 | import { EventEmitter } from "events";
|
2 | import { Accessory, CameraController, Categories, Controller, ControllerConstructor, LegacyCameraSource, SerializedAccessory, Service, WithUUID } from "hap-nodejs";
|
3 | import { ConstructorArgs } from "hap-nodejs/dist/types";
|
4 | import { PlatformName, PluginIdentifier, PluginName } from "./api";
|
5 | export type UnknownContext = Record<string, any>;
|
6 | export interface SerializedPlatformAccessory<T extends UnknownContext = UnknownContext> extends SerializedAccessory {
|
7 | plugin: PluginName;
|
8 | platform: PlatformName;
|
9 | context: T;
|
10 | }
|
11 | export declare const enum PlatformAccessoryEvent {
|
12 | IDENTIFY = "identify"
|
13 | }
|
14 | export declare interface PlatformAccessory {
|
15 | on(event: "identify", listener: () => void): this;
|
16 | emit(event: "identify"): boolean;
|
17 | }
|
18 | export declare class PlatformAccessory<T extends UnknownContext = UnknownContext> extends EventEmitter {
|
19 | private static injectedAccessory?;
|
20 | _associatedPlugin?: PluginIdentifier;
|
21 | _associatedPlatform?: PlatformName;
|
22 | _associatedHAPAccessory: Accessory;
|
23 | displayName: string;
|
24 | UUID: string;
|
25 | category: Categories;
|
26 | services: Service[];
|
27 | |
28 |
|
29 |
|
30 | reachable: boolean;
|
31 | |
32 |
|
33 |
|
34 | context: T;
|
35 | constructor(displayName: string, uuid: string, category?: Categories);
|
36 | addService(service: Service): Service;
|
37 | addService<S extends typeof Service>(serviceConstructor: S, ...constructorArgs: ConstructorArgs<S>): Service;
|
38 | removeService(service: Service): void;
|
39 | getService<T extends WithUUID<typeof Service>>(name: string | T): Service | undefined;
|
40 | /**
|
41 | *
|
42 | * @param uuid
|
43 | * @param subType
|
44 | * @deprecated use {@link getServiceById} directly
|
45 | */
|
46 | getServiceByUUIDAndSubType<T extends WithUUID<typeof Service>>(uuid: string | T, subType: string): Service | undefined;
|
47 | getServiceById<T extends WithUUID<typeof Service>>(uuid: string | T, subType: string): Service | undefined;
|
48 | |
49 |
|
50 |
|
51 |
|
52 |
|
53 | updateReachability(reachable: boolean): void;
|
54 | |
55 |
|
56 |
|
57 |
|
58 |
|
59 | configureCameraSource(cameraSource: LegacyCameraSource): CameraController;
|
60 | |
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | configureController(controller: Controller | ControllerConstructor): void;
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | removeController(controller: Controller): void;
|
74 | static serialize(accessory: PlatformAccessory): SerializedPlatformAccessory;
|
75 | static deserialize(json: SerializedPlatformAccessory): PlatformAccessory;
|
76 | }
|
77 |
|
\ | No newline at end of file |