2 * Copyright 2017-2018 Gregory Moyer and contributors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.openhab.binding.lametrictime.api.model.enums;
18 import org.openhab.binding.lametrictime.api.model.ApiValue;
20 public enum Sound implements ApiValue
22 BICYCLE(SoundCategory.NOTIFICATIONS),
23 CAR(SoundCategory.NOTIFICATIONS),
24 CASH(SoundCategory.NOTIFICATIONS),
25 CAT(SoundCategory.NOTIFICATIONS),
26 DOG(SoundCategory.NOTIFICATIONS),
27 DOG2(SoundCategory.NOTIFICATIONS),
28 ENERGY(SoundCategory.NOTIFICATIONS),
29 KNOCK_KNOCK(SoundCategory.NOTIFICATIONS, "knock-knock"),
30 LETTER_EMAIL(SoundCategory.NOTIFICATIONS),
31 LOSE1(SoundCategory.NOTIFICATIONS),
32 LOSE2(SoundCategory.NOTIFICATIONS),
33 NEGATIVE1(SoundCategory.NOTIFICATIONS),
34 NEGATIVE2(SoundCategory.NOTIFICATIONS),
35 NEGATIVE3(SoundCategory.NOTIFICATIONS),
36 NEGATIVE4(SoundCategory.NOTIFICATIONS),
37 NEGATIVE5(SoundCategory.NOTIFICATIONS),
38 NOTIFICATION(SoundCategory.NOTIFICATIONS),
39 NOTIFICATION2(SoundCategory.NOTIFICATIONS),
40 NOTIFICATION3(SoundCategory.NOTIFICATIONS),
41 NOTIFICATION4(SoundCategory.NOTIFICATIONS),
42 OPEN_DOOR(SoundCategory.NOTIFICATIONS),
43 POSITIVE1(SoundCategory.NOTIFICATIONS),
44 POSITIVE2(SoundCategory.NOTIFICATIONS),
45 POSITIVE3(SoundCategory.NOTIFICATIONS),
46 POSITIVE4(SoundCategory.NOTIFICATIONS),
47 POSITIVE5(SoundCategory.NOTIFICATIONS),
48 POSITIVE6(SoundCategory.NOTIFICATIONS),
49 STATISTIC(SoundCategory.NOTIFICATIONS),
50 THUNDER(SoundCategory.NOTIFICATIONS),
51 WATER1(SoundCategory.NOTIFICATIONS),
52 WATER2(SoundCategory.NOTIFICATIONS),
53 WIN(SoundCategory.NOTIFICATIONS),
54 WIN2(SoundCategory.NOTIFICATIONS),
55 WIND(SoundCategory.NOTIFICATIONS),
56 WIND_SHORT(SoundCategory.NOTIFICATIONS),
58 ALARM1(SoundCategory.ALARMS),
59 ALARM2(SoundCategory.ALARMS),
60 ALARM3(SoundCategory.ALARMS),
61 ALARM4(SoundCategory.ALARMS),
62 ALARM5(SoundCategory.ALARMS),
63 ALARM6(SoundCategory.ALARMS),
64 ALARM7(SoundCategory.ALARMS),
65 ALARM8(SoundCategory.ALARMS),
66 ALARM9(SoundCategory.ALARMS),
67 ALARM10(SoundCategory.ALARMS),
68 ALARM11(SoundCategory.ALARMS),
69 ALARM12(SoundCategory.ALARMS),
70 ALARM13(SoundCategory.ALARMS);
72 private final SoundCategory category;
73 private final String rawValue;
75 private Sound(SoundCategory category)
80 private Sound(SoundCategory category, String rawValue)
82 this.category = category;
83 this.rawValue = rawValue;
86 public SoundCategory getCategory()
94 return rawValue != null ? rawValue : name().toLowerCase();
97 public static Sound toEnum(String raw)
104 if (KNOCK_KNOCK.rawValue.equals(raw))
111 return valueOf(raw.toUpperCase());
113 catch (IllegalArgumentException e)
115 // not a valid raw string