]> git.basschouten.com Git - openhab-addons.git/blob
b49f12dc6d8f84c1209808405c044d7260f53af4
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.lgtvserial.internal.protocol.serial.commands;
14
15 import org.openhab.binding.lgtvserial.internal.protocol.serial.LGSerialCommand;
16 import org.openhab.binding.lgtvserial.internal.protocol.serial.LGSerialResponseListener;
17 import org.openhab.core.thing.ChannelUID;
18
19 /**
20  * This class is used to convert a channel id to it's corresponding class command.
21  *
22  * @author Richard Lavoie - Initial contribution
23  *
24  */
25 public class CommandFactory {
26
27     public static LGSerialCommand createCommandFor(ChannelUID channel, LGSerialResponseListener listener) {
28         int setId = listener.getSetID();
29         String name = channel.getId();
30         switch (name) {
31             case "3d":
32                 return new LG3DCommand(setId);
33             case "3d-extended":
34                 return new LG3DExtendedCommand(setId);
35             case "aspect-ratio":
36                 return new AspectRatioCommand(setId);
37             case "auto-sleep":
38                 return new AutoSleepCommand(setId);
39             case "auto-volume":
40                 return new AutoVolumeCommand(setId);
41             case "backlight":
42                 return new BacklightCommand(setId);
43             case "balance":
44                 return new BalanceCommand(setId);
45             case "bass":
46                 return new BassCommand(setId);
47             case "brightness":
48                 return new BrightnessCommand(setId);
49             case "color":
50                 return new ColorCommand(setId);
51             case "color-temperature":
52                 return new ColorTemperatureCommand(setId);
53             case "color-temperature2":
54                 return new ColorTemperature2Command(setId);
55             case "contrast":
56                 return new ContrastCommand(setId);
57             case "dpm":
58                 return new DPMCommand(setId);
59             case "elapsed-time":
60                 return new ElapsedTimeCommand(setId);
61             case "energy-saving":
62                 return new EnergySavingCommand(setId);
63             case "fan-fault-check":
64                 return new FanFaultCheckCommand(setId);
65             case "h-position":
66                 return new HPositionCommand(setId);
67             case "h-size":
68                 return new HSizeCommand(setId);
69             case "input":
70                 return new InputSelectCommand(setId);
71             case "input2":
72                 return new InputSelect2Command(setId);
73             case "ir-key-code":
74                 return new IRKeyCodeCommand(setId);
75             case "ism-method":
76                 return new ISMMethodCommand(setId);
77             case "lamp-fault-check":
78                 return new LampFaultCheckCommand(setId);
79             case "natural-mode":
80                 return new NaturalModeCommand(setId);
81             case "osd-language":
82                 return new OSDLanguageCommand(setId);
83             case "osd-select":
84                 return new OSDSelectCommand(setId);
85             case "picture-mode":
86                 return new PictureModeCommand(setId);
87             case "power":
88                 return new PowerCommand(setId);
89             case "power-indicator":
90                 return new PowerIndicatorCommand(setId);
91             case "power-saving":
92                 return new PowerSavingCommand(setId);
93             case "raw":
94                 return new RawCommand();
95             case "screen-mute":
96                 return new ScreenMuteCommand(setId);
97             case "serial-number":
98                 return new SerialNoCommand(setId);
99             case "sharpness":
100                 return new SharpnessCommand(setId);
101             case "sleep-time":
102                 return new SleepTimeCommand(setId);
103             case "software-version":
104                 return new SoftwareVersionCommand(setId);
105             case "sound-mode":
106                 return new SoundModeCommand(setId);
107             case "speaker":
108                 return new SpeakerCommand(setId);
109             case "temperature-value":
110                 return new TemperatureValueCommand(setId);
111             case "tile":
112                 return new TileCommand(setId);
113             case "tile-h-position":
114                 return new TileHPositionCommand(setId);
115             case "tile-h-size":
116                 return new TileHSizeCommand(setId);
117             case "tile-id-set":
118                 return new TileIdSetCommand(setId);
119             case "tile-v-position":
120                 return new TileVPositionCommand(setId);
121             case "tile-v-size":
122                 return new TileVSizeCommand(setId);
123             case "time":
124                 return new TimeCommand(setId);
125             case "tint":
126                 return new TintCommand(setId);
127             case "treble":
128                 return new TrebleCommand(setId);
129             case "volume":
130                 return new VolumeCommand(setId);
131             case "volume-mute":
132                 return new VolumeMuteCommand(setId);
133             case "v-position":
134                 return new VPositionCommand(setId);
135             case "v-size":
136                 return new VSizeCommand(setId);
137         }
138         return null;
139     }
140 }