/** * Sets (activates or deactivates) the speakers as defined in the given list. * * @param speakers all speakers to read the active flag from */ public void setSpeakers(List<Speaker> speakers) { try { Log.d(TAG, "setSpeakers() requesting..."); String idsString = ""; boolean first = true; // The list of speakers to activate is a comma-separated string with // the hex versions of the speakers' IDs for (Speaker speaker : speakers) { if (speaker.isActive()) { if (!first) { idsString += ","; } else { first = false; } idsString += speaker.getIdAsHex(); } } String url = String.format( "%s/ctrl-int/1/setspeakers?speaker-id=%s&session-id=%s", session.getRequestBase(), idsString, session.sessionId); RequestHelper.request(url, false); } catch (Exception e) { Log.e(TAG, "Could not set speakers: ", e); } }