org.fourthline.cling.controlpoint.ControlPoint Java Examples

The following examples show how to use org.fourthline.cling.controlpoint.ControlPoint. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SystemService.java    From BeyondUPnP with Apache License 2.0 6 votes vote down vote up
public void setSelectedDevice(Device selectedDevice, ControlPoint controlPoint) {
    if (selectedDevice == mSelectedDevice) return;

    Log.i(TAG, "Change selected device.");
    mSelectedDevice = selectedDevice;
    //End last device's subscriptions
    if (mAVTransportSubscriptionCallback != null) {
        mAVTransportSubscriptionCallback.end();
    }
    //Init Subscriptions
    mAVTransportSubscriptionCallback = new AVTransportSubscriptionCallback(mSelectedDevice.findService(SystemManager.AV_TRANSPORT_SERVICE));
    controlPoint.execute(mAVTransportSubscriptionCallback);

    Intent intent = new Intent(Intents.ACTION_CHANGE_DEVICE);
    sendBroadcast(intent);
}
 
Example #2
Source File: PlaybackCommand.java    From BeyondUPnP with Apache License 2.0 6 votes vote down vote up
public static void play() {
    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 Play(avtService) {
            @Override
            public void success(ActionInvocation invocation) {
                Log.i(TAG, "Play success.");
            }

            @Override
            public void failure(ActionInvocation arg0, UpnpResponse arg1, String arg2) {
                Log.e(TAG, "Play failed");
            }
        });
    }
}
 
Example #3
Source File: DMCControl.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
public void setMute(boolean paramBoolean) {
	try {
		Service localService = this.executeDeviceItem.getDevice()
				.findService(new UDAServiceType("RenderingControl"));
		if (localService != null) {
			ControlPoint localControlPoint = this.upnpService
					.getControlPoint();
			localControlPoint.execute(new SetMuteCalllback(localService,
					paramBoolean, mHandle));
		} else {
			Log.e("null", "null");
		}
	} catch (Exception localException) {
		localException.printStackTrace();
	}
}
 
Example #4
Source File: PortMappingAdd.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
protected PortMappingAdd(Service service, ControlPoint controlPoint, PortMapping portMapping) {
    super(new ActionInvocation(service.getAction("AddPortMapping")), controlPoint);

    this.portMapping = portMapping;

    getActionInvocation().setInput("NewExternalPort", portMapping.getExternalPort());
    getActionInvocation().setInput("NewProtocol", portMapping.getProtocol());
    getActionInvocation().setInput("NewInternalClient", portMapping.getInternalClient());
    getActionInvocation().setInput("NewInternalPort", portMapping.getInternalPort());
    getActionInvocation().setInput("NewLeaseDuration", portMapping.getLeaseDurationSeconds());
    getActionInvocation().setInput("NewEnabled", portMapping.isEnabled());
    if (portMapping.hasRemoteHost())
        getActionInvocation().setInput("NewRemoteHost", portMapping.getRemoteHost());
    if (portMapping.hasDescription())
        getActionInvocation().setInput("NewPortMappingDescription", portMapping.getDescription());

}
 
Example #5
Source File: PlaybackCommand.java    From BeyondUPnP with Apache License 2.0 6 votes vote down vote up
public static void pause() {
    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 Pause(avtService) {
            @Override
            public void success(ActionInvocation invocation) {
                Log.i(TAG, "Pause success.");
            }

            @Override
            public void failure(ActionInvocation arg0, UpnpResponse arg1, String arg2) {
                Log.e(TAG, "Pause failed");
            }
        });
    }
}
 
Example #6
Source File: PlaybackCommand.java    From BeyondUPnP with Apache License 2.0 6 votes vote down vote up
public static void stop() {
    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 Stop(avtService) {
            @Override
            public void success(ActionInvocation invocation) {
                Log.i(TAG, "Stop success.");
            }

            @Override
            public void failure(ActionInvocation arg0, UpnpResponse arg1, String arg2) {
                Log.e(TAG, "Stop failed");
            }
        });
    }
}
 
Example #7
Source File: PlaybackCommand.java    From BeyondUPnP with Apache License 2.0 6 votes vote down vote up
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");
            }
        });
    }
}
 
Example #8
Source File: PortMappingAdd.java    From TVRemoteIME with GNU General Public License v2.0 6 votes vote down vote up
protected PortMappingAdd(Service service, ControlPoint controlPoint, PortMapping portMapping) {
    super(new ActionInvocation(service.getAction("AddPortMapping")), controlPoint);

    this.portMapping = portMapping;

    getActionInvocation().setInput("NewExternalPort", portMapping.getExternalPort());
    getActionInvocation().setInput("NewProtocol", portMapping.getProtocol());
    getActionInvocation().setInput("NewInternalClient", portMapping.getInternalClient());
    getActionInvocation().setInput("NewInternalPort", portMapping.getInternalPort());
    getActionInvocation().setInput("NewLeaseDuration", portMapping.getLeaseDurationSeconds());
    getActionInvocation().setInput("NewEnabled", portMapping.isEnabled());
    if (portMapping.hasRemoteHost())
        getActionInvocation().setInput("NewRemoteHost", portMapping.getRemoteHost());
    if (portMapping.hasDescription())
        getActionInvocation().setInput("NewPortMappingDescription", portMapping.getDescription());

}
 
Example #9
Source File: PortMappingDelete.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
protected PortMappingDelete(Service service, ControlPoint controlPoint, PortMapping portMapping) {
    super(new ActionInvocation(service.getAction("DeletePortMapping")), controlPoint);

    this.portMapping = portMapping;

    getActionInvocation().setInput("NewExternalPort", portMapping.getExternalPort());
    getActionInvocation().setInput("NewProtocol", portMapping.getProtocol());
    if (portMapping.hasRemoteHost())
        getActionInvocation().setInput("NewRemoteHost", portMapping.getRemoteHost());

}
 
Example #10
Source File: PortMappingDelete.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
protected PortMappingDelete(Service service, ControlPoint controlPoint, PortMapping portMapping) {
    super(new ActionInvocation(service.getAction("DeletePortMapping")), controlPoint);

    this.portMapping = portMapping;

    getActionInvocation().setInput("NewExternalPort", portMapping.getExternalPort());
    getActionInvocation().setInput("NewProtocol", portMapping.getProtocol());
    if (portMapping.hasRemoteHost())
        getActionInvocation().setInput("NewRemoteHost", portMapping.getRemoteHost());

}
 
Example #11
Source File: GetProtocolInfoCallback.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public GetProtocolInfoCallback(Service paramService,
		ControlPoint paramControlPoint, String paramString,
		Handler paramHandler) {
	super(paramService, paramControlPoint);
	this.requestPlayMimeType = paramString;
	this.handler = paramHandler;
}
 
Example #12
Source File: PrepareForConnection.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public PrepareForConnection(Service service, ControlPoint controlPoint,
                            ProtocolInfo remoteProtocolInfo, ServiceReference peerConnectionManager,
                            int peerConnectionID, ConnectionInfo.Direction direction) {
    super(new ActionInvocation(service.getAction("PrepareForConnection")), controlPoint);

    getActionInvocation().setInput("RemoteProtocolInfo", remoteProtocolInfo.toString());
    getActionInvocation().setInput("PeerConnectionManager", peerConnectionManager.toString());
    getActionInvocation().setInput("PeerConnectionID", peerConnectionID);
    getActionInvocation().setInput("Direction", direction.toString());
}
 
Example #13
Source File: PrepareForConnection.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public PrepareForConnection(Service service, ControlPoint controlPoint,
                            ProtocolInfo remoteProtocolInfo, ServiceReference peerConnectionManager,
                            int peerConnectionID, ConnectionInfo.Direction direction) {
    super(new ActionInvocation(service.getAction("PrepareForConnection")), controlPoint);

    getActionInvocation().setInput("RemoteProtocolInfo", remoteProtocolInfo.toString());
    getActionInvocation().setInput("PeerConnectionManager", peerConnectionManager.toString());
    getActionInvocation().setInput("PeerConnectionID", peerConnectionID);
    getActionInvocation().setInput("Direction", direction.toString());
}
 
Example #14
Source File: AndroidUpnpServiceImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public ControlPoint getControlPoint() {
    return upnpService.getControlPoint();
}
 
Example #15
Source File: GetCurrentConnectionInfo.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected GetCurrentConnectionInfo(Service service, ControlPoint controlPoint, int connectionID) {
       super(new ActionInvocation(service.getAction("GetCurrentConnectionInfo")), controlPoint);
	getActionInvocation().setInput("ConnectionID", connectionID);
}
 
Example #16
Source File: ConnectionComplete.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected ConnectionComplete(Service service, ControlPoint controlPoint, int connectionID) {
       super(new ActionInvocation(service.getAction("ConnectionComplete")), controlPoint);
	getActionInvocation().setInput("ConnectionID", connectionID);
}
 
Example #17
Source File: GetProtocolInfo.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected GetProtocolInfo(Service service, ControlPoint controlPoint) {
	super(new ActionInvocation(service.getAction("GetProtocolInfo")),
			controlPoint);
}
 
Example #18
Source File: Pause.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected Pause(ActionInvocation actionInvocation, ControlPoint controlPoint) {
    super(actionInvocation, controlPoint);
}
 
Example #19
Source File: SystemManager.java    From BeyondUPnP with Apache License 2.0 4 votes vote down vote up
public ControlPoint getControlPoint() {
    return mUpnpService.getControlPoint();
}
 
Example #20
Source File: UpnpServiceImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected ControlPoint createControlPoint(ProtocolFactory protocolFactory, Registry registry) {
    return new ControlPointImpl(getConfiguration(), protocolFactory, registry);
}
 
Example #21
Source File: UpnpServiceImpl.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public ControlPoint getControlPoint() {
    return controlPoint;
}
 
Example #22
Source File: CurrentConnectionInfoCallback.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public CurrentConnectionInfoCallback(Service paramService, ControlPoint paramControlPoint,
        int paramInt) {
    super(paramService, paramControlPoint, paramInt);
}
 
Example #23
Source File: DLNAController.java    From Popeens-DSub with GNU General Public License v3.0 4 votes vote down vote up
public DLNAController(DownloadService downloadService, ControlPoint controlPoint, DLNADevice device) {
	super(downloadService);
	this.controlPoint = controlPoint;
	this.device = device;
	nextSupported = true;
}
 
Example #24
Source File: ClingRouter.java    From portmapper with GNU General Public License v3.0 4 votes vote down vote up
public ClingRouter(final RemoteService service, final Registry registry, final ControlPoint controlPoint) {
    super(getName(service));
    this.service = service;
    this.registry = registry;
    actionService = new ActionService(service, controlPoint);
}
 
Example #25
Source File: ActionService.java    From portmapper with GNU General Public License v3.0 4 votes vote down vote up
public ActionService(final RemoteService remoteService, final ControlPoint controlPoint) {
    this.remoteService = remoteService;
    this.controlPoint = controlPoint;
}
 
Example #26
Source File: ManagedUpnpService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
@Override
public ControlPoint getControlPoint() {
    return controlPointInstance.get();
}
 
Example #27
Source File: ManagedUpnpService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ControlPoint getControlPoint() {
    return controlPointInstance.get();
}
 
Example #28
Source File: AbstractPeeringConnectionManagerService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Close the connection with the peer, remove the connection details.
 */
synchronized public void closeConnectionWithPeer(ControlPoint controlPoint,
                                                 Service peerService,
                                                 int connectionID) throws ActionException {
    closeConnectionWithPeer(controlPoint, peerService, getCurrentConnectionInfo(connectionID));
}
 
Example #29
Source File: GetProtocolInfo.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
protected GetProtocolInfo(Service service, ControlPoint controlPoint) {
	super(new ActionInvocation(service.getAction("GetProtocolInfo")),
			controlPoint);
}
 
Example #30
Source File: ConnectionComplete.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
protected ConnectionComplete(Service service, ControlPoint controlPoint, int connectionID) {
       super(new ActionInvocation(service.getAction("ConnectionComplete")), controlPoint);
	getActionInvocation().setInput("ConnectionID", connectionID);
}