List of usage examples for java.lang IllegalStateException getMessage
public String getMessage()
From source file:org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler.java
private void updateGroupCoordinator() { try {//ww w. java 2 s .c o m coordinatorHandler = getHandlerByName(getCoordinator()); } catch (IllegalStateException e) { logger.debug("Cannot update the group coordinator ({})", e.getMessage()); coordinatorHandler = null; } }
From source file:org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler.java
public void playTrack(Command command) { if (command != null && command instanceof DecimalType) { try {//from w ww . j a va 2 s .com ZonePlayerHandler coordinator = getCoordinatorHandler(); String trackNumber = String.valueOf(((DecimalType) command).intValue()); coordinator.setCurrentURI(QUEUE_URI + coordinator.getUDN() + "#0", ""); // seek the track - warning, we do not check if the tracknumber falls in the boundary of the queue coordinator.setPositionTrack(trackNumber); // take the system off mute coordinator.setMute(OnOffType.OFF); // start jammin' coordinator.play(); } catch (IllegalStateException e) { logger.debug("Cannot play track ({})", e.getMessage()); } } }
From source file:org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler.java
public void removeMember(Command command) { if (command != null && command instanceof StringType) { try {/*from w ww . j a v a 2 s .c o m*/ ZonePlayerHandler oldmemberHandler = getHandlerByName(command.toString()); oldmemberHandler.becomeStandAlonePlayer(); SonosEntry entry = new SonosEntry("", "", "", "", "", "", "", QUEUE_URI + oldmemberHandler.getUDN() + "#0"); oldmemberHandler.setCurrentURI(entry); } catch (IllegalStateException e) { logger.debug("Cannot remove group member ({})", e.getMessage()); } } }
From source file:org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler.java
private void setEQ(String eqType, String value) { try {//from w w w . j a v a 2 s. c o m Map<String, String> inputs = new HashMap<String, String>(); inputs.put("InstanceID", "0"); inputs.put("EQType", eqType); inputs.put("DesiredValue", value); Map<String, String> result = service.invokeAction(this, "RenderingControl", "SetEQ", inputs); for (String variable : result.keySet()) { this.onValueReceived(variable, result.get(variable), "RenderingControl"); } } catch (IllegalStateException e) { logger.debug("Cannot handle {} command ({})", eqType, e.getMessage()); } }
From source file:org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler.java
/** * Play a given notification sound/*from w w w .jav a2 s .c om*/ * * @param url in the format of //host/folder/filename.mp3 */ public void playNotificationSoundURI(Command notificationURL) { if (notificationURL != null && notificationURL instanceof StringType) { try { ZonePlayerHandler coordinator = getCoordinatorHandler(); String currentURI = coordinator.getCurrentURI(); if (isPlayingStream(currentURI) || isPlayingRadioStartedByAmazonEcho(currentURI) || isPlayingRadio(currentURI)) { handleRadioStream(currentURI, notificationURL, coordinator); } else if (isPlayingLineIn(currentURI)) { handleLineIn(currentURI, notificationURL, coordinator); } else if (isPlayingQueue(currentURI)) { handleSharedQueue(notificationURL, coordinator); } else if (isPlaylistEmpty(coordinator)) { handleEmptyQueue(notificationURL, coordinator); } synchronized (notificationLock) { notificationLock.notify(); } } catch (IllegalStateException e) { logger.debug("Cannot play sound ({})", e.getMessage()); } } }
From source file:org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler.java
public void playRadio(Command command) { if (command instanceof StringType) { String station = command.toString(); List<SonosEntry> stations = getFavoriteRadios(); SonosEntry theEntry = null;/*from w w w.jav a 2 s . c o m*/ // search for the appropriate radio based on its name (title) for (SonosEntry someStation : stations) { if (someStation.getTitle().equals(station)) { theEntry = someStation; break; } } // set the URI of the group coordinator if (theEntry != null) { try { ZonePlayerHandler coordinator = getCoordinatorHandler(); coordinator.setCurrentURI(theEntry); coordinator.play(); } catch (IllegalStateException e) { logger.debug("Cannot play radio ({})", e.getMessage()); } } else { logger.debug("Radio station '{}' not found", station); } } }
From source file:org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler.java
/** * Play a given url to music in one of the music libraries. * * @param url/* www. ja va 2s. co m*/ * in the format of //host/folder/filename.mp3 */ public void playURI(Command command) { if (command != null && command instanceof StringType) { try { String url = command.toString(); ZonePlayerHandler coordinator = getCoordinatorHandler(); // stop whatever is currently playing coordinator.stop(); coordinator.waitForNotTransportState(STATE_PLAYING); // clear any tracks which are pending in the queue coordinator.removeAllTracksFromQueue(); // add the new track we want to play to the queue // The url will be prefixed with x-file-cifs if it is NOT a http URL if (!url.startsWith("x-") && (!url.startsWith("http"))) { // default to file based url url = FILE_URI + url; } coordinator.addURIToQueue(url, "", 0, true); // set the current playlist to our new queue coordinator.setCurrentURI(QUEUE_URI + coordinator.getUDN() + "#0", ""); // take the system off mute coordinator.setMute(OnOffType.OFF); // start jammin' coordinator.play(); } catch (IllegalStateException e) { logger.debug("Cannot play URI ({})", e.getMessage()); } } }
From source file:org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler.java
/** * Play music from the line-in of the given Player referenced by the given UDN or name * * @param udn or name/*from w w w . j a v a 2s .c o m*/ */ public void playLineIn(Command command) { if (command != null && command instanceof StringType) { try { String remotePlayerName = command.toString(); ZonePlayerHandler coordinatorHandler = getCoordinatorHandler(); ZonePlayerHandler remoteHandler = getHandlerByName(remotePlayerName); // check if player has a line-in connected if (remoteHandler.isAnalogLineInConnected() || remoteHandler.isOpticalLineInConnected()) { // stop whatever is currently playing coordinatorHandler.stop(); // set the URI if (remoteHandler.isAnalogLineInConnected()) { coordinatorHandler.setCurrentURI(ANALOG_LINE_IN_URI + remoteHandler.getUDN(), ""); } else { coordinatorHandler.setCurrentURI(OPTICAL_LINE_IN_URI + remoteHandler.getUDN() + SPDIF, ""); } // take the system off mute coordinatorHandler.setMute(OnOffType.OFF); // start jammin' coordinatorHandler.play(); } else { logger.debug("Line-in of {} is not connected", remoteHandler.getUDN()); } } catch (IllegalStateException e) { logger.debug("Cannot play line-in ({})", e.getMessage()); } } }
From source file:org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler.java
public void setRepeat(Command command) { if ((command != null) && (command instanceof StringType)) { try {/*from w w w. j a v a2 s . c o m*/ ZonePlayerHandler coordinator = getCoordinatorHandler(); switch (command.toString()) { case "ALL": coordinator.updatePlayMode(coordinator.isShuffleActive() ? "SHUFFLE" : "REPEAT_ALL"); break; case "ONE": coordinator.updatePlayMode(coordinator.isShuffleActive() ? "SHUFFLE_REPEAT_ONE" : "REPEAT_ONE"); break; case "OFF": coordinator.updatePlayMode(coordinator.isShuffleActive() ? "SHUFFLE_NOREPEAT" : "NORMAL"); break; default: logger.debug("{}: unexpected repeat command; accepted values are ALL, ONE and OFF", command.toString()); break; } } catch (IllegalStateException e) { logger.debug("Cannot handle repeat command ({})", e.getMessage()); } } }
From source file:org.eclipse.smarthome.binding.sonos.internal.handler.ZonePlayerHandler.java
private void dispatchOnAllGroupMembers(String variable, String value, String service) { if (isCoordinator()) { for (String member : getOtherZoneGroupMembers()) { try { ZonePlayerHandler memberHandler = getHandlerByName(member); if (memberHandler != null && ThingStatus.ONLINE.equals(memberHandler.getThing().getStatus())) { memberHandler.onValueReceived(variable, value, service); }/*from w ww . j av a 2s . c o m*/ } catch (IllegalStateException e) { logger.debug("Cannot update channel for group member ({})", e.getMessage()); } } } }