| 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
72
73
74
75
76
77
78
79
80
81
82 |
1×
| 'use strict';
module.exports = {
// Ports used by LIFX
LIFX_DEFAULT_PORT: 56700,
LIFX_ANY_PORT: 56800,
// Masks for packet description in packet header
ADDRESSABLE_BIT: 0x1000,
TAGGED_BIT: 0x2000,
ORIGIN_BITS: 0xC000,
PROTOCOL_VERSION_BITS: 0xFFF,
// Masks for response types in packet header
RESPONSE_REQUIRED_BIT: 0x1,
ACK_REQUIRED_BIT: 0x2,
// Protocol version mappings
PROTOCOL_VERSION_CURRENT: 1024,
PROTOCOL_VERSION_1: 1024,
// Packet headers
PACKET_HEADER_SIZE: 36,
PACKET_HEADER_SEQUENCE_MAX: 255, // 8 bit
// HSBK value calculation
HSBK_MINIMUM_KELVIN: 1500,
HSBK_DEFAULT_KELVIN: 3500,
HSBK_MAXIMUM_KELVIN: 9000,
HSBK_MINIMUM_BRIGHTNESS: 0,
HSBK_MAXIMUM_BRIGHTNESS: 100,
HSBK_MINIMUM_SATURATION: 0,
HSBK_MAXIMUM_SATURATION: 100,
HSBK_MINIMUM_HUE: 0,
HSBK_MAXIMUM_HUE: 360,
// RGB value
RGB_MAXIMUM_VALUE: 255,
RGB_MINIMUM_VALUE: 0,
// Infrared values
IR_MINIMUM_BRIGHTNESS: 0,
IR_MAXIMUM_BRIGHTNESS: 100,
// MultiZone device zone index value
ZONE_INDEX_MINIMUM_VALUE: 0,
ZONE_INDEX_MAXIMUM_VALUE: 255,
// Waveform values, order is important here
LIGHT_WAVEFORMS: ['SAW', 'SINE', 'HALF_SINE', 'TRIANGLE', 'PULSE'],
// Multizone Effect Modes, order is important here
MULTIZONE_EFFECTS: ['OFF', 'MOVE'],
// Dirction of a speed effect, indicating whether to go towards or away from the controller, order is important here
MULTIZONE_EFFECTS_MOVE_DIRECTION: ['TOWARDS', 'AWAY'],
// Packet types used by internal sending process
PACKET_TRANSACTION_TYPES: {
ONE_WAY: 0,
REQUEST_RESPONSE: 1
},
// Maps color names to hue and saturation mapping
// Kelvin and brightness are kept the same
COLOR_NAME_HS_VALUES: {
white: { hue: 0, saturation: 0 },
red: { hue: 0, saturation: 100 },
orange: { hue: 35, saturation: 100 },
yellow: { hue: 59, saturation: 100 },
cyan: { hue: 179, saturation: 100 },
green: { hue: 120, saturation: 100 },
blue: { hue: 249, saturation: 100 },
purple: { hue: 279, saturation: 100 },
pink: { hue: 324, saturation: 100 }
},
APPLICATION_REQUEST_VALUES: {
NO_APPLY: 0,
APPLY: 1,
APPLY_ONLY: 2
}
}; |