1 | import { MDNSServerOptions, ServiceTxt } from "@homebridge/ciao";
|
2 | import { InterfaceName, IPAddress } from "@homebridge/ciao/lib/NetworkManager";
|
3 | import { EventEmitter } from "events";
|
4 | import { AccessoryInfo } from "./model/AccessoryInfo";
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export declare const enum StatusFlag {
|
12 | NOT_PAIRED = 1,
|
13 | NOT_JOINED_WIFI = 2,
|
14 | PROBLEM_DETECTED = 4
|
15 | }
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | export declare const enum PairingFeatureFlag {
|
23 | SUPPORTS_HARDWARE_AUTHENTICATION = 1,
|
24 | SUPPORTS_SOFTWARE_AUTHENTICATION = 2
|
25 | }
|
26 |
|
27 |
|
28 |
|
29 | export declare const enum AdvertiserEvent {
|
30 | |
31 |
|
32 |
|
33 |
|
34 | UPDATED_NAME = "updated-name"
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 | export declare interface Advertiser {
|
40 | on(event: "updated-name", listener: (name: string) => void): this;
|
41 | emit(event: "updated-name", name: string): boolean;
|
42 | }
|
43 |
|
44 |
|
45 |
|
46 | export interface ServiceNetworkOptions {
|
47 | |
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | restrictedAddresses?: (InterfaceName | IPAddress)[];
|
62 | |
63 |
|
64 |
|
65 |
|
66 |
|
67 | disabledIpv6?: boolean;
|
68 | }
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | export interface Advertiser {
|
77 | initPort(port: number): void;
|
78 | startAdvertising(): Promise<void>;
|
79 | updateAdvertisement(silent?: boolean): void;
|
80 | destroy(): void;
|
81 | }
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | export declare class CiaoAdvertiser extends EventEmitter implements Advertiser {
|
93 | static protocolVersion: string;
|
94 | static protocolVersionService: string;
|
95 | private readonly accessoryInfo;
|
96 | private readonly setupHash;
|
97 | private readonly responder;
|
98 | private readonly advertisedService;
|
99 | constructor(accessoryInfo: AccessoryInfo, responderOptions?: MDNSServerOptions, serviceOptions?: ServiceNetworkOptions);
|
100 | initPort(port: number): void;
|
101 | startAdvertising(): Promise<void>;
|
102 | updateAdvertisement(silent?: boolean): void;
|
103 | destroy(): Promise<void>;
|
104 | static createTxt(accessoryInfo: AccessoryInfo, setupHash: string): ServiceTxt;
|
105 | static computeSetupHash(accessoryInfo: AccessoryInfo): string;
|
106 | static ff(...flags: PairingFeatureFlag[]): number;
|
107 | static sf(...flags: StatusFlag[]): number;
|
108 | }
|
109 | /**
|
110 | * Advertiser base on the legacy "bonjour-hap" library.
|
111 | *
|
112 | * @group Advertiser
|
113 | */
|
114 | export declare class BonjourHAPAdvertiser extends EventEmitter implements Advertiser {
|
115 | private readonly accessoryInfo;
|
116 | private readonly setupHash;
|
117 | private readonly serviceOptions?;
|
118 | private bonjour;
|
119 | private advertisement?;
|
120 | private port?;
|
121 | private destroyed;
|
122 | constructor(accessoryInfo: AccessoryInfo, serviceOptions?: ServiceNetworkOptions);
|
123 | initPort(port: number): void;
|
124 | startAdvertising(): Promise<void>;
|
125 | updateAdvertisement(silent?: boolean): void;
|
126 | destroy(): void;
|
127 | }
|
128 | /**
|
129 | * @group Advertiser
|
130 | */
|
131 | export declare class DBusInvokeError extends Error {
|
132 | readonly errorName: string;
|
133 | constructor(errorObject: {
|
134 | name: string;
|
135 | message: any;
|
136 | });
|
137 | }
|
138 | /**
|
139 | * Advertiser based on the Avahi D-Bus library.
|
140 | * For (very crappy) docs on the interface, see the XML files at: https://github.com/lathiat/avahi/tree/master/avahi-daemon.
|
141 | *
|
142 | * Refer to https://github.com/lathiat/avahi/blob/fd482a74625b8db8547b8cfca3ee3d3c6c721423/avahi-common/defs.h#L120-L155 for a
|
143 | * rough API usage guide of Avahi.
|
144 | *
|
145 | * @group Advertiser
|
146 | */
|
147 | export declare class AvahiAdvertiser extends EventEmitter implements Advertiser {
|
148 | private readonly accessoryInfo;
|
149 | private readonly setupHash;
|
150 | private port?;
|
151 | private bus?;
|
152 | private avahiServerInterface?;
|
153 | private path?;
|
154 | private readonly stateChangeHandler;
|
155 | constructor(accessoryInfo: AccessoryInfo);
|
156 | private createTxt;
|
157 | initPort(port: number): void;
|
158 | startAdvertising(): Promise<void>;
|
159 | /**
|
160 | * Event handler for the `StateChanged` event of the `org.freedesktop.Avahi.Server` DBus interface.
|
161 | *
|
162 | * This is called once the state of the running avahi-daemon changes its running state.
|
163 | * @param state - The state the server changed into {@see AvahiServerState}.
|
164 | */
|
165 | private handleStateChangedEvent;
|
166 | updateAdvertisement(silent?: boolean): Promise<void>;
|
167 | destroy(): Promise<void>;
|
168 | static isAvailable(): Promise<boolean>;
|
169 | private static avahiInvoke;
|
170 | private static avahiInterface;
|
171 | }
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 | export declare class ResolvedAdvertiser extends EventEmitter implements Advertiser {
|
179 | private readonly accessoryInfo;
|
180 | private readonly setupHash;
|
181 | private port?;
|
182 | private bus?;
|
183 | private path?;
|
184 | constructor(accessoryInfo: AccessoryInfo);
|
185 | private createTxt;
|
186 | initPort(port: number): void;
|
187 | startAdvertising(): Promise<void>;
|
188 | updateAdvertisement(silent?: boolean): Promise<void>;
|
189 | private stopAdvertising;
|
190 | destroy(): Promise<void>;
|
191 | static isAvailable(): Promise<boolean>;
|
192 | private static resolvedInvoke;
|
193 | private static managerInvoke;
|
194 | }
|
195 | //# sourceMappingURL=Advertiser.d.ts.map |
\ | No newline at end of file |