2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.playstation.internal;
15 import java.util.Arrays;
17 import java.util.stream.Collectors;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
23 * Enum of the possible commands.
25 * @author Fredrik Ahlström - Initial contribution
30 BUFFER_SIZE_RSP(0x03),
33 SCREEN_SHOT_REQ(0x08),
34 SCREEN_SHOT_RSP(0x09),
39 OSK_CHANGE_STRING_REQ(0x0e),
40 OSK_CONTROL_REQ(0x10),
41 SERVER_STATUS_RSP(0x12),
43 HTTPD_STATUS_RSP(0x16),
44 SCREEN_STATUS_RSP(0x18),
47 REMOTE_CONTROL_REQ(0x1c),
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);
63 private static final Map<Integer, PS4Command> TAG_MAP = Arrays.stream(PS4Command.values())
64 .collect(Collectors.toMap(command -> command.value, command -> command));
66 public final int value;
68 private PS4Command(int value) {
73 * Get command from value
75 * @param tag the tag string
76 * @return accessoryType or null if not found
78 public static @Nullable PS4Command valueOfTag(int value) {
79 return TAG_MAP.get(value);