private void input(String source) { Status status = powerOn(); while (!status.getInput().equals(source)) { post(XMLYamaha.input(source)); sleep(1); status = getStatus(); } }
private Status powerOn() { Status status = getStatus(); while (status == null || !status.isPowerOn()) { post(powerOnXml()); sleep(1); status = getStatus(); } return status; }
private void station(int station) { input("NET RADIO"); Status status = getStatus(); while (status.getRadioMenuLevel() == null) { sleep(1); status = getStatus(); } if (status.getRadioMenuLevel() == 1) { post(radioListItem(1)); sleep(2); } post(radioListItem(station)); }
private void volume(VolumeOperation op, Integer dB) { Status status = getStatus(); if (status != null) { switch (op) { case DOWN: int newVol = status.getVolume() - 50; post(volumeXml(newVol)); break; case UP: newVol = status.getVolume() + 50; post(volumeXml(newVol)); break; case MUTE: post(muteXml()); break; case SET: post(volumeXml(-dB * 10)); break; } } }