/
types.ts
69 lines (64 loc) · 1.93 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
export type Nullable<T> = T | null;
export type WithUUID<T> = T & { UUID: string };
/**
* {@see Partial} but allowing null as a value.
*/
export type PartialAllowingNull<T> = {
[P in keyof T]?: T[P] | null;
}
/**
* Type of the constructor arguments of the provided constructor type.
*/
export type ConstructorArgs<C> = C extends new (...args: infer A) => any ? A : never; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* UUID string uniquely identifying every HAP connection.
*/
export type SessionIdentifier = string;
/**
* Defines a mac address.
* Must have a format like 'XX:XX:XX:XX:XX:XX' with XX being a valid hexadecimal string
*/
export type MacAddress = string;
/**
* Defines a pincode for the HAP accessory.
* Must have a format like "XXX-XX-XXX".
*/
export type HAPPincode = string;
export type InterfaceName = string;
export type IPv4Address = string;
export type IPv6Address = string;
export type IPAddress = IPv4Address | IPv6Address;
export type NodeCallback<T> = (err: Nullable<Error> | undefined, data?: T) => void;
export type VoidCallback = (err?: Nullable<Error>) => void;
export type PrimitiveTypes = string | number | boolean;
export type CharacteristicValue = PrimitiveTypes | PrimitiveTypes[] | { [key: string]: PrimitiveTypes };
/**
* @deprecated replaced by {@link AudioStreamingCodec}
*/
export type AudioCodec = {
samplerate: number;
type: string;
}
/**
* @deprecated replaced by {@link H264CodecParameters}
*/
export type VideoCodec = {
levels: number[];
profiles: number[];
}
/**
* @deprecated replaced by {@link AudioStreamingOptions}
*/
export type StreamAudioParams = {
comfort_noise: boolean;
// noinspection JSDeprecatedSymbols
codecs: AudioCodec[];
};
/**
* @deprecated replaced by {@link VideoStreamingOptions}
*/
export type StreamVideoParams = {
// noinspection JSDeprecatedSymbols
codec?: VideoCodec;
resolutions: [number, number, number][]; // width, height, framerate
};