use of org.fourthline.cling.support.renderingcontrol.callback.GetVolume in project BeyondUPnP by kevinshine.
the class PlaybackCommand method getVolume.
public static void getVolume(final Handler handler) {
Device device = SystemManager.getInstance().getSelectedDevice();
//Check selected device
if (device == null)
return;
Service rcService = device.findService(SystemManager.RENDERING_CONTROL_SERVICE);
if (rcService != null) {
ControlPoint cp = SystemManager.getInstance().getControlPoint();
cp.execute(new GetVolume(rcService) {
@Override
public void received(ActionInvocation actionInvocation, int currentVolume) {
//Send currentVolume to handler.
Log.i(TAG, "GetVolume:" + currentVolume);
Message msg = Message.obtain(handler, NowplayingFragment.GET_VOLUME_ACTION, currentVolume, 0);
msg.sendToTarget();
}
@Override
public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
Log.e(TAG, "GetVolume failed");
}
});
}
}
Aggregations