]> git.basschouten.com Git - openhab-addons.git/blob
fee3fe251900acbce7e05b065d6acf839d2d4a63
[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.playstation.internal;
14
15 import java.util.Arrays;
16 import java.util.Map;
17 import java.util.stream.Collectors;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
21
22 /**
23  * Enum of the possible commands.
24  *
25  * @author Fredrik Ahlström - Initial contribution
26  */
27 @NonNullByDefault
28 enum PS4Command {
29     UNKNOWN1_REQ(0x02),
30     BUFFER_SIZE_RSP(0x03),
31     BYEBYE_REQ(0x04),
32     LOGIN_RSP(0x07),
33     SCREEN_SHOT_REQ(0x08),
34     SCREEN_SHOT_RSP(0x09),
35     APP_START_REQ(0x0a),
36     APP_START_RSP(0x0b),
37     OSK_START_REQ(0x0c),
38     OSK_START_RSP(0x0d),
39     OSK_CHANGE_STRING_REQ(0x0e),
40     OSK_CONTROL_REQ(0x10),
41     SERVER_STATUS_RSP(0x12),
42     STATUS_REQ(0x14),
43     HTTPD_STATUS_RSP(0x16),
44     SCREEN_STATUS_RSP(0x18),
45     STANDBY_REQ(0x1a),
46     STANDBY_RSP(0x1b),
47     REMOTE_CONTROL_REQ(0x1c),
48     LOGIN_REQ(0x1e),
49     HANDSHAKE_REQ(0x20),
50     LOGOUT_REQ(0x22),
51     LOGOUT_RSP(0x23),
52     APP_START2_REQ(0x24),
53     APP_START2_RSP(0x25),
54     CLIENT_IDENTITY_REQ(0x26),
55     COMMENT_VIEWER_START_REQ(0x2a),
56     COMMENT_VIEWER_START_RESULT(0x2b),
57     COMMENT_VIEWER_NEW_COMMENT(0x2c),
58     COMMENT_VIEWER_NEW_COMMENT2(0x2e),
59     COMMENT_VIEWER_EVENT(0x30),
60     COMMENT_VIEWER_SEND(0x32),
61     HELLO_REQ(0x6f636370);
62
63     private static final Map<Integer, PS4Command> TAG_MAP = Arrays.stream(PS4Command.values())
64             .collect(Collectors.toMap(command -> command.value, command -> command));
65
66     public final int value;
67
68     private PS4Command(int value) {
69         this.value = value;
70     }
71
72     /**
73      * Get command from value
74      *
75      * @param tag the tag string
76      * @return accessoryType or null if not found
77      */
78     public static @Nullable PS4Command valueOfTag(int value) {
79         return TAG_MAP.get(value);
80     }
81 }