org.fourthline.cling.support.model.ProtocolInfos Java Examples

The following examples show how to use org.fourthline.cling.support.model.ProtocolInfos. 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: GetProtocolInfo.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void success(ActionInvocation invocation) {
	try {
		ActionArgumentValue sink = invocation.getOutput("Sink");
		ActionArgumentValue source = invocation.getOutput("Source");

		received(invocation,
				sink != null ? new ProtocolInfos(sink.toString()) : null,
				source != null ? new ProtocolInfos(source.toString())
						: null);

	} catch (Exception ex) {
		invocation.setFailure(new ActionException(ErrorCode.ACTION_FAILED,
				"Can't parse ProtocolInfo response: " + ex, ex));
		failure(invocation, null);
	}
}
 
Example #2
Source File: GetProtocolInfo.java    From TVRemoteIME with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void success(ActionInvocation invocation) {
	try {
		ActionArgumentValue sink = invocation.getOutput("Sink");
		ActionArgumentValue source = invocation.getOutput("Source");

		received(invocation,
				sink != null ? new ProtocolInfos(sink.toString()) : null,
				source != null ? new ProtocolInfos(source.toString())
						: null);

	} catch (Exception ex) {
		invocation.setFailure(new ActionException(ErrorCode.ACTION_FAILED,
				"Can't parse ProtocolInfo response: " + ex, ex));
		failure(invocation, null);
	}
}
 
Example #3
Source File: ConnectionManagerService.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public ConnectionManagerService(PropertyChangeSupport propertyChangeSupport,
                                        ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo,
                                        ConnectionInfo... activeConnections) {
    this.propertyChangeSupport =
            propertyChangeSupport == null
                    ? new PropertyChangeSupport(this) : propertyChangeSupport;

    this.sourceProtocolInfo = sourceProtocolInfo;
    this.sinkProtocolInfo = sinkProtocolInfo;

    for (ConnectionInfo activeConnection : activeConnections) {
        this.activeConnections.put(activeConnection.getConnectionID(), activeConnection);
    }
}
 
Example #4
Source File: ConnectionManagerService.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public ConnectionManagerService(PropertyChangeSupport propertyChangeSupport,
                                        ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo,
                                        ConnectionInfo... activeConnections) {
    this.propertyChangeSupport =
            propertyChangeSupport == null
                    ? new PropertyChangeSupport(this) : propertyChangeSupport;

    this.sourceProtocolInfo = sourceProtocolInfo;
    this.sinkProtocolInfo = sinkProtocolInfo;

    for (ConnectionInfo activeConnection : activeConnections) {
        this.activeConnections.put(activeConnection.getConnectionID(), activeConnection);
    }
}
 
Example #5
Source File: UPnPService.java    From subsonic with GNU General Public License v3.0 4 votes vote down vote up
private LocalDevice createMediaServerDevice() throws Exception {

        String serverName = settingsService.getDlnaServerName();
        DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier(serverName));
        DeviceType type = new UDADeviceType("MediaServer", 1);

        // TODO: DLNACaps
        Version version = versionService.getLocalVersion();
        String versionString = version == null ? null : version.toString();
        String licenseEmail = settingsService.getLicenseEmail();
        String licenseString = licenseEmail == null ? "Unlicensed" : ("Licensed to " + licenseEmail);

        DeviceDetails details = new DeviceDetails(serverName, new ManufacturerDetails(serverName),
                new ModelDetails(serverName, licenseString, versionString),
                new DLNADoc[]{new DLNADoc("DMS", DLNADoc.Version.V1_5)}, null);

        Icon icon = new Icon("image/png", 512, 512, 32, getClass().getResource("subsonic-512.png"));

        LocalService<FolderBasedContentDirectory> contentDirectoryservice = new AnnotationLocalServiceBinder().read(FolderBasedContentDirectory.class);
        contentDirectoryservice.setManager(new DefaultServiceManager<FolderBasedContentDirectory>(contentDirectoryservice) {

            @Override
            protected FolderBasedContentDirectory createServiceInstance() throws Exception {
                return folderBasedContentDirectory;
            }
        });

        final ProtocolInfos protocols = new ProtocolInfos();
        for (DLNAProfiles dlnaProfile : DLNAProfiles.values()) {
            if (dlnaProfile == DLNAProfiles.NONE) {
                continue;
            }
            try {
                protocols.add(new DLNAProtocolInfo(dlnaProfile));
            } catch (Exception e) {
                // Silently ignored.
            }
        }

        LocalService<ConnectionManagerService> connetionManagerService = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class);
        connetionManagerService.setManager(new DefaultServiceManager<ConnectionManagerService>(connetionManagerService) {
            @Override
            protected ConnectionManagerService createServiceInstance() throws Exception {
                return new ConnectionManagerService(protocols, null);
            }
        });

        // For compatibility with Microsoft
        LocalService<MSMediaReceiverRegistrarService> receiverService = new AnnotationLocalServiceBinder().read(MSMediaReceiverRegistrarService.class);
        receiverService.setManager(new DefaultServiceManager<MSMediaReceiverRegistrarService>(receiverService, MSMediaReceiverRegistrarService.class));

        return new LocalDevice(identity, type, details, new Icon[]{icon}, new LocalService[]{contentDirectoryservice, connetionManagerService, receiverService});
    }
 
Example #6
Source File: GetProtocolInfoCallback.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public void received(ActionInvocation paramActionInvocation,
		ProtocolInfos paramProtocolInfos1, ProtocolInfos paramProtocolInfos2) {
	this.handler.sendEmptyMessage(DMCControlMessage.CONNECTIONSUCESSED);
	// TODO

}
 
Example #7
Source File: GetProtocolInfo.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public abstract void received(ActionInvocation actionInvocation,
ProtocolInfos sinkProtocolInfos, ProtocolInfos sourceProtocolInfos);
 
Example #8
Source File: ConnectionManagerService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
synchronized public ProtocolInfos getSinkProtocolInfo() {
    return sinkProtocolInfo;
}
 
Example #9
Source File: ConnectionManagerService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
synchronized public ProtocolInfos getSourceProtocolInfo() {
    return sourceProtocolInfo;
}
 
Example #10
Source File: ConnectionManagerService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public ConnectionManagerService(ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo, ConnectionInfo... activeConnections) {
    this(null, sourceProtocolInfo, sinkProtocolInfo, activeConnections);
}
 
Example #11
Source File: ConnectionManagerService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public ConnectionManagerService(ConnectionInfo... activeConnections) {
    this(null, new ProtocolInfos(), new ProtocolInfos(), activeConnections);
}
 
Example #12
Source File: ConnectionManagerService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a default "active" connection with identifier "0".
 */
public ConnectionManagerService(ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo) {
    this(sourceProtocolInfo, sinkProtocolInfo, new ConnectionInfo());
}
 
Example #13
Source File: AbstractPeeringConnectionManagerService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected AbstractPeeringConnectionManagerService(PropertyChangeSupport propertyChangeSupport,
                                                  ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo,
                                                  ConnectionInfo... activeConnections) {
    super(propertyChangeSupport, sourceProtocolInfo, sinkProtocolInfo, activeConnections);
}
 
Example #14
Source File: AbstractPeeringConnectionManagerService.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected AbstractPeeringConnectionManagerService(ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo,
                                                  ConnectionInfo... activeConnections) {
    super(sourceProtocolInfo, sinkProtocolInfo, activeConnections);
}
 
Example #15
Source File: UPnPService.java    From airsonic-advanced with GNU General Public License v3.0 4 votes vote down vote up
private LocalDevice createMediaServerDevice() throws Exception {

        String serverName = settingsService.getDlnaServerName();
        DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier(serverName));
        DeviceType type = new UDADeviceType("MediaServer", 1);

        // TODO: DLNACaps

        DeviceDetails details = new DeviceDetails(serverName, new ManufacturerDetails(serverName),
                new ModelDetails(serverName),
                new DLNADoc[]{new DLNADoc("DMS", DLNADoc.Version.V1_5)}, null);

        InputStream in = getClass().getResourceAsStream("logo-512.png");
        Icon icon = new Icon("image/png", 512, 512, 32, "logo-512", in);
        FileUtil.closeQuietly(in);

        LocalService<CustomContentDirectory> contentDirectoryservice = new AnnotationLocalServiceBinder().read(CustomContentDirectory.class);
        contentDirectoryservice.setManager(new DefaultServiceManager<CustomContentDirectory>(contentDirectoryservice) {

            @Override
            protected CustomContentDirectory createServiceInstance() {
                return dispatchingContentDirectory;
            }
        });

        final ProtocolInfos protocols = new ProtocolInfos();
        for (DLNAProfiles dlnaProfile : DLNAProfiles.values()) {
            if (dlnaProfile == DLNAProfiles.NONE) {
                continue;
            }
            try {
                protocols.add(new DLNAProtocolInfo(dlnaProfile));
            } catch (Exception e) {
                // Silently ignored.
            }
        }

        LocalService<ConnectionManagerService> connetionManagerService = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class);
        connetionManagerService.setManager(new DefaultServiceManager<ConnectionManagerService>(connetionManagerService) {
            @Override
            protected ConnectionManagerService createServiceInstance() {
                return new ConnectionManagerService(protocols, null);
            }
        });

        // For compatibility with Microsoft
        LocalService<MSMediaReceiverRegistrarService> receiverService = new AnnotationLocalServiceBinder().read(MSMediaReceiverRegistrarService.class);
        receiverService.setManager(new DefaultServiceManager<>(receiverService, MSMediaReceiverRegistrarService.class));

        return new LocalDevice(identity, type, details, new Icon[]{icon}, new LocalService[]{contentDirectoryservice, connetionManagerService, receiverService});
    }
 
Example #16
Source File: UPnPService.java    From airsonic with GNU General Public License v3.0 4 votes vote down vote up
private LocalDevice createMediaServerDevice() throws Exception {

        String serverName = settingsService.getDlnaServerName();
        DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier(serverName));
        DeviceType type = new UDADeviceType("MediaServer", 1);

        // TODO: DLNACaps

        DeviceDetails details = new DeviceDetails(serverName, new ManufacturerDetails(serverName),
                new ModelDetails(serverName),
                new DLNADoc[]{new DLNADoc("DMS", DLNADoc.Version.V1_5)}, null);

        InputStream in = getClass().getResourceAsStream("logo-512.png");
        Icon icon = new Icon("image/png", 512, 512, 32, "logo-512", in);
        FileUtil.closeQuietly(in);

        LocalService<CustomContentDirectory> contentDirectoryservice = new AnnotationLocalServiceBinder().read(CustomContentDirectory.class);
        contentDirectoryservice.setManager(new DefaultServiceManager<CustomContentDirectory>(contentDirectoryservice) {

            @Override
            protected CustomContentDirectory createServiceInstance() {
                return dispatchingContentDirectory;
            }
        });

        final ProtocolInfos protocols = new ProtocolInfos();
        for (DLNAProfiles dlnaProfile : DLNAProfiles.values()) {
            if (dlnaProfile == DLNAProfiles.NONE) {
                continue;
            }
            try {
                protocols.add(new DLNAProtocolInfo(dlnaProfile));
            } catch (Exception e) {
                // Silently ignored.
            }
        }

        LocalService<ConnectionManagerService> connetionManagerService = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class);
        connetionManagerService.setManager(new DefaultServiceManager<ConnectionManagerService>(connetionManagerService) {
            @Override
            protected ConnectionManagerService createServiceInstance() {
                return new ConnectionManagerService(protocols, null);
            }
        });

        // For compatibility with Microsoft
        LocalService<MSMediaReceiverRegistrarService> receiverService = new AnnotationLocalServiceBinder().read(MSMediaReceiverRegistrarService.class);
        receiverService.setManager(new DefaultServiceManager<>(receiverService, MSMediaReceiverRegistrarService.class));

        return new LocalDevice(identity, type, details, new Icon[]{icon}, new LocalService[]{contentDirectoryservice, connetionManagerService, receiverService});
    }
 
Example #17
Source File: GetProtocolInfo.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public abstract void received(ActionInvocation actionInvocation,
ProtocolInfos sinkProtocolInfos, ProtocolInfos sourceProtocolInfos);
 
Example #18
Source File: ConnectionManagerService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
synchronized public ProtocolInfos getSinkProtocolInfo() {
    return sinkProtocolInfo;
}
 
Example #19
Source File: ConnectionManagerService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
synchronized public ProtocolInfos getSourceProtocolInfo() {
    return sourceProtocolInfo;
}
 
Example #20
Source File: ConnectionManagerService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public ConnectionManagerService(ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo, ConnectionInfo... activeConnections) {
    this(null, sourceProtocolInfo, sinkProtocolInfo, activeConnections);
}
 
Example #21
Source File: ConnectionManagerService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public ConnectionManagerService(ConnectionInfo... activeConnections) {
    this(null, new ProtocolInfos(), new ProtocolInfos(), activeConnections);
}
 
Example #22
Source File: ConnectionManagerService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a default "active" connection with identifier "0".
 */
public ConnectionManagerService(ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo) {
    this(sourceProtocolInfo, sinkProtocolInfo, new ConnectionInfo());
}
 
Example #23
Source File: AbstractPeeringConnectionManagerService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
protected AbstractPeeringConnectionManagerService(PropertyChangeSupport propertyChangeSupport,
                                                  ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo,
                                                  ConnectionInfo... activeConnections) {
    super(propertyChangeSupport, sourceProtocolInfo, sinkProtocolInfo, activeConnections);
}
 
Example #24
Source File: AbstractPeeringConnectionManagerService.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
protected AbstractPeeringConnectionManagerService(ProtocolInfos sourceProtocolInfo, ProtocolInfos sinkProtocolInfo,
                                                  ConnectionInfo... activeConnections) {
    super(sourceProtocolInfo, sinkProtocolInfo, activeConnections);
}