Search in sources :

Example 1 with GetPositionInfo

use of org.fourthline.cling.support.avtransport.callback.GetPositionInfo in project BeyondUPnP by kevinshine.

the class PlaybackCommand method getPositionInfo.

public static void getPositionInfo(final Handler handler) {
    Device device = SystemManager.getInstance().getSelectedDevice();
    //Check selected device
    if (device == null)
        return;
    Service avtService = device.findService(SystemManager.AV_TRANSPORT_SERVICE);
    if (avtService != null) {
        ControlPoint cp = SystemManager.getInstance().getControlPoint();
        cp.execute(new GetPositionInfo(avtService) {

            @Override
            public void received(ActionInvocation invocation, PositionInfo positionInfo) {
                Message msg = Message.obtain(handler, NowplayingFragment.GET_POSITION_INFO_ACTION);
                msg.obj = positionInfo;
                msg.sendToTarget();
            }

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

Aggregations

Message (android.os.Message)1 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 GetPositionInfo (org.fourthline.cling.support.avtransport.callback.GetPositionInfo)1 PositionInfo (org.fourthline.cling.support.model.PositionInfo)1