1+ /* eslint-disable camelcase */
2+ /*
3+ * Copyright (c) 2020, SmartDeviceLink Consortium, Inc.
4+ * All rights reserved.
5+ *
6+ * Redistribution and use in source and binary forms, with or without
7+ * modification, are permitted provided that the following conditions are met:
8+ *
9+ * Redistributions of source code must retain the above copyright notice, this
10+ * list of conditions and the following disclaimer.
11+ *
12+ * Redistributions in binary form must reproduce the above copyright notice,
13+ * this list of conditions and the following
14+ * disclaimer in the documentation and/or other materials provided with the
15+ * distribution.
16+ *
17+ * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of
18+ * its contributors may be used to endorse or promote products derived
19+ * from this software without specific prior written permission.
20+ *
21+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31+ * POSSIBILITY OF SUCH DAMAGE.
32+ */
33+
34+ import { Enum } from '../../util/Enum.js' ;
35+
36+ /**
37+ * Reflects the status of the ambient light sensor.
38+ * @typedef {Enum } AmbientLightStatus
39+ * @property {Object } _MAP
40+ */
41+ class AmbientLightStatus extends Enum {
42+ /**
43+ * @constructor
44+ */
45+ constructor ( ) {
46+ super ( ) ;
47+ }
48+
49+ /**
50+ * @return {String }
51+ */
52+ static get NIGHT ( ) {
53+ return AmbientLightStatus . _MAP . NIGHT ;
54+ }
55+
56+ /**
57+ * @return {String }
58+ */
59+ static get TWILIGHT_1 ( ) {
60+ return AmbientLightStatus . _MAP . TWILIGHT_1 ;
61+ }
62+
63+ /**
64+ * @return {String }
65+ */
66+ static get TWILIGHT_2 ( ) {
67+ return AmbientLightStatus . _MAP . TWILIGHT_2 ;
68+ }
69+
70+ /**
71+ * @return {String }
72+ */
73+ static get TWILIGHT_3 ( ) {
74+ return AmbientLightStatus . _MAP . TWILIGHT_3 ;
75+ }
76+
77+ /**
78+ * @return {String }
79+ */
80+ static get TWILIGHT_4 ( ) {
81+ return AmbientLightStatus . _MAP . TWILIGHT_4 ;
82+ }
83+
84+ /**
85+ * @return {String }
86+ */
87+ static get DAY ( ) {
88+ return AmbientLightStatus . _MAP . DAY ;
89+ }
90+
91+ /**
92+ * @return {String }
93+ */
94+ static get ALS_UNKNOWN ( ) {
95+ return AmbientLightStatus . _MAP . ALS_UNKNOWN ;
96+ }
97+
98+ /**
99+ * @return {String }
100+ */
101+ static get INVALID ( ) {
102+ return AmbientLightStatus . _MAP . INVALID ;
103+ }
104+
105+ /**
106+ * Get the value for the given enum key
107+ * @param key - A key to find in the map of the subclass
108+ * @return {* } - Returns a value if found, or null if not found
109+ */
110+ static valueForKey ( key ) {
111+ return AmbientLightStatus . _valueForKey ( key , AmbientLightStatus . _MAP ) ;
112+ }
113+
114+ /**
115+ * Get the key for the given enum value
116+ * @param value - A primitive value to find the matching key for in the map of the subclass
117+ * @return {* } - Returns a key if found, or null if not found
118+ */
119+ static keyForValue ( value ) {
120+ return AmbientLightStatus . _keyForValue ( value , AmbientLightStatus . _MAP ) ;
121+ }
122+ }
123+
124+ AmbientLightStatus . _MAP = Object . freeze ( {
125+ 'NIGHT' : 'NIGHT' ,
126+ 'TWILIGHT_1' : 'TWILIGHT_1' ,
127+ 'TWILIGHT_2' : 'TWILIGHT_2' ,
128+ 'TWILIGHT_3' : 'TWILIGHT_3' ,
129+ 'TWILIGHT_4' : 'TWILIGHT_4' ,
130+ 'DAY' : 'DAY' ,
131+ 'ALS_UNKNOWN' : 'UNKNOWN' ,
132+ 'INVALID' : 'INVALID' ,
133+ } ) ;
134+
135+ export { AmbientLightStatus } ;
0 commit comments