Search in sources :

Example 1 with SetVolume

use of org.fourthline.cling.support.renderingcontrol.callback.SetVolume in project BeyondUPnP by kevinshine.

the class PlaybackCommand method setVolume.

public static void setVolume(int newVolume) {
    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 SetVolume(rcService, newVolume) {

            @Override
            public void success(ActionInvocation invocation) {
                Log.i(TAG, "SetVolume success.");
            }

            @Override
            public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
                Log.e(TAG, "SetVolume failure.");
            }
        });
    }
}
Also used : UpnpResponse(org.fourthline.cling.model.message.UpnpResponse) SetVolume(org.fourthline.cling.support.renderingcontrol.callback.SetVolume) Device(org.fourthline.cling.model.meta.Device) ActionInvocation(org.fourthline.cling.model.action.ActionInvocation) Service(org.fourthline.cling.model.meta.Service) ControlPoint(org.fourthline.cling.controlpoint.ControlPoint)

Aggregations

ControlPoint (org.fourthline.cling.controlpoint.ControlPoint)1 ActionInvocation (org.fourthline.cling.model.action.ActionInvocation)1 UpnpResponse (org.fourthline.cling.model.message.UpnpResponse)1 Device (org.fourthline.cling.model.meta.Device)1 Service (org.fourthline.cling.model.meta.Service)1 SetVolume (org.fourthline.cling.support.renderingcontrol.callback.SetVolume)1