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.lgwebos.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.lgwebos.internal.handler.LGWebOSHandler;
17 import org.openhab.binding.lgwebos.internal.handler.core.CommandConfirmation;
18 import org.openhab.core.library.types.PlayPauseType;
19 import org.openhab.core.library.types.RewindFastforwardType;
20 import org.openhab.core.types.Command;
21 import org.openhab.core.types.RefreshType;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
26 * Handles commands of a Player Item.
29 * @author Sebastian Prehn - Initial contribution
32 public class MediaControlPlayer extends BaseChannelHandler<CommandConfirmation> {
33 private final Logger logger = LoggerFactory.getLogger(MediaControlPlayer.class);
36 public void onReceiveCommand(String channelId, LGWebOSHandler handler, Command command) {
37 if (RefreshType.REFRESH == command) {
39 } else if (PlayPauseType.PLAY == command) {
40 handler.getSocket().play(getDefaultResponseListener());
41 } else if (PlayPauseType.PAUSE == command) {
42 handler.getSocket().pause(getDefaultResponseListener());
43 } else if (RewindFastforwardType.FASTFORWARD == command) {
44 handler.getSocket().fastForward(getDefaultResponseListener());
45 } else if (RewindFastforwardType.REWIND == command) {
46 handler.getSocket().rewind(getDefaultResponseListener());
48 logger.info("Only accept PlayPauseType, RewindFastforwardType, RefreshType. Type was {}.",
53 // TODO: playstatesubscription