UNPKG

3.46 kBTypeScriptView Raw
1import type { DataStreamTransportManagement } from "../definitions";
2import { DataStreamConnection, DataStreamServerEvent, GlobalEventHandler, GlobalRequestHandler, Protocols, Topics } from "./DataStreamServer";
3/**
4 * @group HomeKit Data Streams (HDS)
5 */
6export declare const enum DataStreamStatus {
7 SUCCESS = 0,
8 GENERIC_ERROR = 1,
9 BUSY = 2
10}
11/**
12 * @group HomeKit Data Streams (HDS)
13 */
14export declare class DataStreamManagement {
15 private readonly dataStreamServer;
16 private readonly dataStreamTransportManagementService;
17 private readonly supportedDataStreamTransportConfiguration;
18 private lastSetupDataStreamTransportResponse;
19 constructor(service?: DataStreamTransportManagement);
20 destroy(): void;
21 /**
22 * @returns the DataStreamTransportManagement service
23 */
24 getService(): DataStreamTransportManagement;
25 /**
26 * Registers a new event handler to handle incoming event messages.
27 * The handler is only called for a connection if for the give protocol no ProtocolHandler
28 * was registered on the connection level.
29 *
30 * @param protocol - name of the protocol to register the handler for
31 * @param event - name of the event (also referred to as topic. See {@link Topics} for some known ones)
32 * @param handler - function to be called for every occurring event
33 */
34 onEventMessage(protocol: string | Protocols, event: string | Topics, handler: GlobalEventHandler): this;
35 /**
36 * Removes a registered event handler.
37 *
38 * @param protocol - name of the protocol to unregister the handler for
39 * @param event - name of the event (also referred to as topic. See {@link Topics} for some known ones)
40 * @param handler - registered event handler
41 */
42 removeEventHandler(protocol: string | Protocols, event: string | Topics, handler: GlobalEventHandler): this;
43 /**
44 * Registers a new request handler to handle incoming request messages.
45 * The handler is only called for a connection if for the give protocol no ProtocolHandler
46 * was registered on the connection level.
47 *
48 * @param protocol - name of the protocol to register the handler for
49 * @param request - name of the request (also referred to as topic. See {@link Topics} for some known ones)
50 * @param handler - function to be called for every occurring request
51 */
52 onRequestMessage(protocol: string | Protocols, request: string | Topics, handler: GlobalRequestHandler): this;
53 /**
54 * Removes a registered request handler.
55 *
56 * @param protocol - name of the protocol to unregister the handler for
57 * @param request - name of the request (also referred to as topic. See {@link Topics} for some known ones)
58 * @param handler - registered request handler
59 */
60 removeRequestHandler(protocol: string | Protocols, request: string | Topics, handler: GlobalRequestHandler): this;
61 /**
62 * Forwards any event listener for an DataStreamServer event to the DataStreamServer instance
63 *
64 * @param event - the event to register for
65 * @param listener - the event handler
66 */
67 onServerEvent(event: DataStreamServerEvent, listener: (connection: DataStreamConnection) => void): this;
68 private handleSetupDataStreamTransportWrite;
69 private buildSupportedDataStreamTransportConfigurationTLV;
70 private constructService;
71 private setupServiceHandlers;
72}
73//# sourceMappingURL=DataStreamManagement.d.ts.map
\No newline at end of file