本文整理汇总了Java中org.eclipse.smarthome.core.library.types.PlayPauseType类的典型用法代码示例。如果您正苦于以下问题:Java PlayPauseType类的具体用法?Java PlayPauseType怎么用?Java PlayPauseType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayPauseType类属于org.eclipse.smarthome.core.library.types包,在下文中一共展示了PlayPauseType类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleControlCommand
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
private void handleControlCommand(Command command) throws SpeakerException {
if (command instanceof PlayPauseType) {
if (command == PlayPauseType.PLAY) {
speaker.resume();
} else if (command == PlayPauseType.PAUSE) {
speaker.pause();
}
} else if (command instanceof NextPreviousType) {
if (command == NextPreviousType.NEXT) {
speaker.next();
} else if (command == NextPreviousType.PREVIOUS) {
speaker.previous();
}
} else if (command instanceof RewindFastforwardType) {
if (command == RewindFastforwardType.FASTFORWARD) {
changeTrackPosition(bindingProperties.getFastForwardSkipTimeInSec() * 1000);
} else if (command == RewindFastforwardType.REWIND) {
changeTrackPosition(-bindingProperties.getRewindSkipTimeInSec() * 1000);
}
} else {
logger.warn("Unknown control command: {}", command);
}
}
示例2: updatePlayerState
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
@Override
public void updatePlayerState(KodiState state) {
switch (state) {
case Play:
updateState(CHANNEL_CONTROL, PlayPauseType.PLAY);
updateState(CHANNEL_STOP, OnOffType.OFF);
break;
case Pause:
updateState(CHANNEL_CONTROL, PlayPauseType.PAUSE);
updateState(CHANNEL_STOP, OnOffType.OFF);
break;
case Stop:
case End:
updateState(CHANNEL_CONTROL, PlayPauseType.PAUSE);
updateState(CHANNEL_STOP, OnOffType.ON);
break;
case FastForward:
updateState(CHANNEL_CONTROL, RewindFastforwardType.FASTFORWARD);
updateState(CHANNEL_STOP, OnOffType.OFF);
break;
case Rewind:
updateState(CHANNEL_CONTROL, RewindFastforwardType.REWIND);
updateState(CHANNEL_STOP, OnOffType.OFF);
break;
}
}
示例3: convertNetUsbPlayStatus
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
private State convertNetUsbPlayStatus(String data) {
State state = UnDefType.UNDEF;
switch (data.charAt(0)) {
case 'P':
state = PlayPauseType.PLAY;
break;
case 'p':
case 'S':
state = PlayPauseType.PAUSE;
break;
case 'F':
state = RewindFastforwardType.FASTFORWARD;
break;
case 'R':
state = RewindFastforwardType.REWIND;
break;
}
return state;
}
示例4: modeChangeEvent
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
@Override
public synchronized void modeChangeEvent(String mac, String mode) {
updateChannel(mac, CHANNEL_CONTROL, "play".equals(mode) ? PlayPauseType.PLAY : PlayPauseType.PAUSE);
updateChannel(mac, CHANNEL_STOP, mode.equals("stop") ? OnOffType.ON : OnOffType.OFF);
if (isMe(mac)) {
playing = "play".equalsIgnoreCase(mode);
}
}
示例5: currentControl
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
boolean currentControl() {
if (stateMap.containsKey(CHANNEL_CONTROL)) {
return (stateMap.get(CHANNEL_CONTROL).equals(PlayPauseType.PLAY) ? true : false);
} else {
return false;
}
}
示例6: updatePlayState
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
private void updatePlayState(PlayState playState) {
logger.debug("{}: PlayState changed to {}", speaker.getName(), playState);
updateState(PLAY_STATE, new StringType(playState.getState().toString()));
if (playState.getState() == State.PLAYING) {
updateState(CONTROL, PlayPauseType.PLAY);
} else {
updateState(CONTROL, PlayPauseType.PAUSE);
}
}
示例7: updateMediaStatus
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
public void updateMediaStatus(final MediaStatus mediaStatus) {
logger.debug("MEDIA_STATUS {}", mediaStatus);
// In-between songs? It's thinking? It's not doing anything
if (mediaStatus == null) {
callback.updateState(CHANNEL_CURRENT_TIME, UNDEF);
updateMediaInfoStatus(null);
return;
}
switch (mediaStatus.playerState) {
case IDLE:
break;
case PAUSED:
callback.updateState(CHANNEL_CONTROL, PlayPauseType.PAUSE);
break;
case BUFFERING:
case PLAYING:
callback.updateState(CHANNEL_CONTROL, PlayPauseType.PLAY);
break;
default:
logger.debug("Unknown mediaStatus: {}", mediaStatus.playerState);
break;
}
callback.updateState(CHANNEL_CURRENT_TIME, new DecimalType(mediaStatus.currentTime));
// If we're playing, paused or buffering but don't have any MEDIA information don't null everything out.
Media media = mediaStatus.media;
if (media == null &&
(mediaStatus.playerState == PLAYING
|| mediaStatus.playerState == PAUSED
|| mediaStatus.playerState == BUFFERING)) {
return;
}
updateMediaInfoStatus(media);
}
示例8: onReceiveCommand
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
@Override
public void onReceiveCommand(ConnectableDevice device, String channelId, LGWebOSHandler handler, Command command) {
if (device == null) {
return;
}
if (NextPreviousType.NEXT == command) {
if (device.hasCapabilities(PlaylistControl.Next)) {
getPlayListControl(device).next(createDefaultResponseListener());
}
} else if (NextPreviousType.PREVIOUS == command) {
if (device.hasCapabilities(PlaylistControl.Previous)) {
getPlayListControl(device).previous(createDefaultResponseListener());
}
} else if (PlayPauseType.PLAY == command) {
if (device.hasCapabilities(MediaControl.Play)) {
getMediaControl(device).play(createDefaultResponseListener());
}
} else if (PlayPauseType.PAUSE == command) {
if (device.hasCapabilities(MediaControl.Pause)) {
getMediaControl(device).pause(createDefaultResponseListener());
}
} else if (RewindFastforwardType.FASTFORWARD == command) {
if (device.hasCapabilities(MediaControl.FastForward)) {
getMediaControl(device).fastForward(createDefaultResponseListener());
}
} else if (RewindFastforwardType.REWIND == command) {
if (device.hasCapabilities(MediaControl.Rewind)) {
getMediaControl(device).rewind(createDefaultResponseListener());
}
} else {
logger.warn("Only accept NextPreviousType, PlayPauseType, RewindFastforwardType. Type was {}.",
command.getClass());
}
}
示例9: playerStateChangeEvent
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
@Override
public void playerStateChangeEvent(String pid, String event, String command) {
if (pid.equals(this.pid)) {
if (event.equals(STATE)) {
switch (command) {
case PLAY:
updateState(CH_ID_CONTROL, PlayPauseType.PLAY);
player.setState(PLAY);
break;
case PAUSE:
updateState(CH_ID_CONTROL, PlayPauseType.PAUSE);
player.setState(PAUSE);
break;
case STOP:
updateState(CH_ID_CONTROL, PlayPauseType.PAUSE);
player.setState(PAUSE);
break;
}
}
if (event.equals(VOLUME)) {
updateState(CH_ID_VOLUME, PercentType.valueOf(command));
}
if (event.equals(MUTE)) {
if (command != null) {
switch (command) {
case ON:
updateState(CH_ID_MUTE, OnOffType.ON);
break;
case OFF:
updateState(CH_ID_MUTE, OnOffType.OFF);
break;
}
}
}
if (event.equals(CUR_POS)) {
this.updateState(CH_ID_CUR_POS, StringType.valueOf(command));
}
if (event.equals(DURATION)) {
this.updateState(CH_ID_DURATION, StringType.valueOf(command));
player.setDuration(command);
}
}
}
示例10: run
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
@Override
public void run() {
bridge = (HeosBridgeHandler) getBridge().getHandler();
player = heos.getPlayerState(pid);
if (!player.isOnline()) {
setStatusOffline();
bridge.thingStatusOffline(thing.getUID());
return;
}
bridge.thingStatusOnline(thing.getUID());
if (player.getLevel() != null) {
updateState(CH_ID_VOLUME, PercentType.valueOf(player.getLevel()));
}
if (player.getMute().equals(ON)) {
updateState(CH_ID_MUTE, OnOffType.ON);
} else {
updateState(CH_ID_MUTE, OnOffType.OFF);
}
if (player.getState().equals(PLAY)) {
updateState(CH_ID_CONTROL, PlayPauseType.PLAY);
}
if (player.getState().equals(PAUSE) || player.getState().equals(STOP)) {
updateState(CH_ID_CONTROL, PlayPauseType.PAUSE);
}
updateState(CH_ID_SONG, StringType.valueOf(player.getSong()));
updateState(CH_ID_ARTIST, StringType.valueOf(player.getArtist()));
updateState(CH_ID_ALBUM, StringType.valueOf(player.getAlbum()));
updateState(CH_ID_IMAGE_URL, StringType.valueOf(player.getImage_url()));
updateState(CH_ID_STATUS, StringType.valueOf(ONLINE));
updateState(CH_ID_STATION, StringType.valueOf(player.getStation()));
updateState(CH_ID_TYPE, StringType.valueOf(player.getType()));
updateState(CH_ID_CUR_POS, StringType.valueOf("0"));
updateState(CH_ID_DURATION, StringType.valueOf("0"));
updateState(CH_ID_INPUTS, StringType.valueOf("NULL"));
}
示例11: playerStateChangeEvent
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
@Override
public void playerStateChangeEvent(String pid, String event, String command) {
if (this.getThing().getStatus().toString().equals(ThingStatus.UNINITIALIZED)) {
logger.error("Can't Handle Event. Group {} not initialized. Status is: {}", this.getConfig().get(NAME),
this.getThing().getStatus().toString());
return;
}
if (pid.equals(this.gid)) {
if (event.equals(STATE)) {
switch (command) {
case PLAY:
updateState(CH_ID_CONTROL, PlayPauseType.PLAY);
break;
case PAUSE:
updateState(CH_ID_CONTROL, PlayPauseType.PAUSE);
break;
case STOP:
updateState(CH_ID_CONTROL, PlayPauseType.PAUSE);
break;
}
}
if (event.equals(VOLUME)) {
updateState(CH_ID_VOLUME, PercentType.valueOf(command));
}
if (event.equals(MUTE)) {
switch (command) {
case ON:
this.updateState(CH_ID_MUTE, OnOffType.ON);
break;
case OFF:
updateState(CH_ID_MUTE, OnOffType.OFF);
break;
}
}
if (event.equals(CUR_POS)) {
this.updateState(CH_ID_CUR_POS, StringType.valueOf(command));
}
if (event.equals(DURATION)) {
this.updateState(CH_ID_DURATION, StringType.valueOf(command));
}
}
}
示例12: run
import org.eclipse.smarthome.core.library.types.PlayPauseType; //导入依赖的package包/类
@Override
public void run() {
bridge = (HeosBridgeHandler) getBridge().getHandler();
heosGroup = heos.getGroupState(gid);
if (heosGroup.isOnline()
|| !thing.getConfiguration().get(GROUP_MEMBER_HASH).equals(heosGroup.getGroupMemberHash())) {
setStatusOffline();
bridge.thingStatusOffline(thing.getUID());
return;
}
bridge.thingStatusOnline(thing.getUID()); // informs the System about the existing group
HashMap<String, HeosGroup> usedToFillOldGroupMap = new HashMap<>();
usedToFillOldGroupMap.put(heosGroup.getNameHash(), heosGroup);
heos.addHeosGroupToOldGroupMap(usedToFillOldGroupMap);
updateState(CH_ID_UNGROUP, OnOffType.ON);
updateState(CH_ID_VOLUME, PercentType.valueOf(heosGroup.getLevel()));
if (heosGroup.getMute().equals(ON)) {
updateState(CH_ID_MUTE, OnOffType.ON);
} else {
updateState(CH_ID_MUTE, OnOffType.OFF);
}
if (heosGroup.getState().equals(PLAY)) {
updateState(CH_ID_CONTROL, PlayPauseType.PLAY);
}
if (heosGroup.getState().equals(PAUSE) || heosGroup.getState().equals(STOP)) {
updateState(CH_ID_CONTROL, PlayPauseType.PAUSE);
}
updateState(CH_ID_SONG, StringType.valueOf(heosGroup.getSong()));
updateState(CH_ID_ARTIST, StringType.valueOf(heosGroup.getArtist()));
updateState(CH_ID_ALBUM, StringType.valueOf(heosGroup.getAlbum()));
updateState(CH_ID_IMAGE_URL, StringType.valueOf(heosGroup.getImage_url()));
updateState(CH_ID_STATION, StringType.valueOf(heosGroup.getStation()));
updateState(CH_ID_TYPE, StringType.valueOf(heosGroup.getType()));
updateState(CH_ID_CUR_POS, StringType.valueOf("0"));
updateState(CH_ID_DURATION, StringType.valueOf("0"));
updateState(CH_ID_STATUS, StringType.valueOf(ONLINE));
}