]> git.basschouten.com Git - openhab-addons.git/blob
261400917b1950aab11de0f912746701baf09f77
[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.pjlinkdevice.internal.device.command.identification;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.pjlinkdevice.internal.device.PJLinkDevice;
17 import org.openhab.binding.pjlinkdevice.internal.device.command.AbstractCommand;
18 import org.openhab.binding.pjlinkdevice.internal.device.command.ResponseException;
19
20 /**
21  * This command is used for retrieving device information as described in
22  * <a href="https://pjlink.jbmia.or.jp/english/data_cl2/PJLink_5-1.pdf">[PJLinkSpec]</a> chapters:
23  * 4.8. Lamp number/ lighting hour query
24  * 4.10. Projector/Display name query
25  * 4.11. Manufacture name information query
26  * 4.12. Product name information query
27  * 4.13. Other information query
28  * 4.14. Class information query
29  *
30  * @author Nils Schnabel - Initial contribution
31  */
32 @NonNullByDefault
33 public class IdentificationCommand extends AbstractCommand<IdentificationRequest, IdentificationResponse> {
34
35     public enum IdentificationProperty {
36         NAME("NAME"),
37         MANUFACTURER("INF1"),
38         MODEL("INF2"),
39         CLASS("CLSS"),
40         OTHER_INFORMATION("INFO"),
41         LAMP_HOURS("LAMP");
42
43         private String prefix;
44
45         private IdentificationProperty(String prefix) {
46             this.prefix = prefix;
47         }
48
49         public String getPJLinkCommandPrefix() {
50             return this.prefix;
51         }
52     }
53
54     private IdentificationProperty identificationProperty;
55
56     public IdentificationCommand(PJLinkDevice pjLinkDevice, IdentificationProperty identificationProperty) {
57         super(pjLinkDevice);
58         this.identificationProperty = identificationProperty;
59     }
60
61     public IdentificationProperty getIdentificationProperty() {
62         return identificationProperty;
63     }
64
65     @Override
66     protected IdentificationRequest createRequest() {
67         return new IdentificationRequest(this);
68     }
69
70     @Override
71     protected IdentificationResponse parseResponse(String response) throws ResponseException {
72         return new IdentificationResponse(this, response);
73     }
74 }