Repository navigation
Expand file tree
/
Copy pathIntercom.ts
More file actions
71 lines (61 loc) · 2.25 KB
/
Copy pathIntercom.ts
File metadata and controls
71 lines (61 loc) · 2.25 KB
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
70
71
import { SchemaDefinition } from '@sozialhelden/simpl-schema';
import BooleanField from './BooleanField.js';
import { getInteractableSchemaDefinition, Interactable } from './Interactable.js';
import { getLocalizedStringSchemaDefinition, LocalizedString } from './LocalizedString.js';
import {
getPrefixedQuantitySchemaDefinition,
Length,
LengthSchema,
Volume,
VolumeSchema,
} from './Quantity.js';
export const IntercomInteractions = ['ring', 'call', 'hangUp', 'open', 'close', 'identify'] as const;
export type IntercomInteraction = typeof IntercomInteractions[number];
export const IntercomInteractionsSet = new Set(IntercomInteractions);
/**
* Describes a system to communicate over distance, e.g. a door intercom next to a doorbell.
*/
export interface Intercom extends Interactable<IntercomInteraction> {
description?: LocalizedString;
/**
* The ambient noise level when using the intercom.
*/
ambientNoiseLevel?: Volume;
/**
* The height of the top control element of the intercom system.
*/
necessaryGripHeight?: Length;
/**
* `true` if the door has an audio intercom system, `false` if not.
*/
hasAudio?: boolean;
/**
* `true` if intercom system’s audio quality is good enough for understanding speech, `false`
* if not.
*/
audioIsComprehensible?: boolean;
/**
* `true` if the door has a video intercom system, `false` if not.
*/
hasVideoCamera?: boolean;
/**
* `true` if the intercom system has a visual feedback, `false` if not. Visual feedback might be
* a screen or light that displays if a connection is established.
*/
hasVisualFeedbackOnConnection?: boolean;
/**
* `true` if you need to use a key pad to pass this door, `false` if not.
*/
needsKeyPad?: boolean;
}
export const getIntercomSchemaDefinition: () => SchemaDefinition = () => ({
...getLocalizedStringSchemaDefinition('description'),
...getPrefixedQuantitySchemaDefinition('ambientNoiseLevel', VolumeSchema),
...getPrefixedQuantitySchemaDefinition('necessaryGripHeight', LengthSchema),
hasAudio: BooleanField,
audioIsComprehensible: BooleanField,
hasVideoCamera: BooleanField,
hasVisualFeedbackOnConnection: BooleanField,
needsKeyPad: BooleanField,
...getInteractableSchemaDefinition(IntercomInteractionsSet),
});