本文整理汇总了Java中org.fourthline.cling.support.connectionmanager.ConnectionManagerService类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionManagerService类的具体用法?Java ConnectionManagerService怎么用?Java ConnectionManagerService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionManagerService类属于org.fourthline.cling.support.connectionmanager包,在下文中一共展示了ConnectionManagerService类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createServerConnectionManagerService
import org.fourthline.cling.support.connectionmanager.ConnectionManagerService; //导入依赖的package包/类
/**
* creates a ConnectionManagerService.
*
* @return the service
*/
@SuppressWarnings("unchecked")
private LocalService<ConnectionManagerService> createServerConnectionManagerService() {
LocalService<ConnectionManagerService> service = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class);
final ProtocolInfos sourceProtocols = getSourceProtocolInfos();
service.setManager(new DefaultServiceManager<ConnectionManagerService>(service, ConnectionManagerService.class) {
@Override
protected int getLockTimeoutMillis() {
return 1000;
}
@Override
protected ConnectionManagerService createServiceInstance() throws Exception {
return new ConnectionManagerService(sourceProtocols, null);
}
});
return service;
}
示例2: createRendererConnectionManagerService
import org.fourthline.cling.support.connectionmanager.ConnectionManagerService; //导入依赖的package包/类
/**
* creates a ConnectionManagerService.
*
* @return the service
*/
@SuppressWarnings("unchecked")
private LocalService<ConnectionManagerService> createRendererConnectionManagerService() {
LocalService<ConnectionManagerService> service = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class);
final ProtocolInfos sinkProtocols = getSinkProtocolInfos();
service.setManager(new DefaultServiceManager<ConnectionManagerService>(service, ConnectionManagerService.class) {
@Override
protected int getLockTimeoutMillis() {
return 1000;
}
@Override
protected ConnectionManagerService createServiceInstance() throws Exception {
return new ConnectionManagerService(null, sinkProtocols);
}
});
return service;
}
示例3: createDevice
import org.fourthline.cling.support.connectionmanager.ConnectionManagerService; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public static LocalDevice createDevice() throws ValidationException, LocalServiceBindingException, IOException {
DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier("tinyMediaManager"));
DeviceType type = new UDADeviceType("MediaServer", 1);
String hostname = NetworkUtil.getMachineHostname();
if (hostname == null) {
hostname = Upnp.IP;
}
DeviceDetails details = new DeviceDetails("tinyMediaManager (" + hostname + ")",
new ManufacturerDetails("tinyMediaManager", "http://www.tinymediamanager.org/"),
new ModelDetails("tinyMediaManager", "tinyMediaManager - Media Server", ReleaseInfo.getVersion()));
LOGGER.info("Hello, i'm " + identity.getUdn().getIdentifierString());
// Content Directory Service
LocalService cds = new AnnotationLocalServiceBinder().read(ContentDirectoryService.class);
cds.setManager(new DefaultServiceManager<ContentDirectoryService>(cds, ContentDirectoryService.class));
// Connection Manager Service
LocalService<ConnectionManagerService> cms = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class);
cms.setManager(new DefaultServiceManager<>(cms, ConnectionManagerService.class));
return new LocalDevice(identity, type, details, new LocalService[] { cds, cms });
}
示例4: createMediaServerDevice
import org.fourthline.cling.support.connectionmanager.ConnectionManagerService; //导入依赖的package包/类
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);
Icon icon = new Icon("image/png", 512, 512, 32, "logo-512", getClass().getResourceAsStream("logo-512.png"));
LocalService<CustomContentDirectory> contentDirectoryservice = new AnnotationLocalServiceBinder().read(CustomContentDirectory.class);
contentDirectoryservice.setManager(new DefaultServiceManager<CustomContentDirectory>(contentDirectoryservice) {
@Override
protected CustomContentDirectory createServiceInstance() throws Exception {
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() throws Exception {
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});
}
示例5: MediaServer
import org.fourthline.cling.support.connectionmanager.ConnectionManagerService; //导入依赖的package包/类
public MediaServer(final Context context) throws ValidationException, UnknownHostException {
localAddress = getWIFIIpAddress(context);
generateContentTask = new GenerateContentTask();
generateContentTask.execute(context);
udn = new UDN(UUID.randomUUID());
DeviceType type = new UDADeviceType(deviceType, version);
DeviceDetails details = new DeviceDetails(android.os.Build.MODEL,
new ManufacturerDetails(android.os.Build.MANUFACTURER),
new ModelDetails("HPlayer", "HPlayer MediaServer for Android", "v1"));
LocalServiceBinder binder = new AnnotationLocalServiceBinder();
// 文件共享服务
LocalService<ContentDirectoryService> contentDirectoryService
= binder.read(ContentDirectoryService.class);
ServiceManager<ContentDirectoryService> contentDirectoryManger
= new DefaultServiceManager<ContentDirectoryService>(contentDirectoryService) {
@Override
protected ContentDirectoryService createServiceInstance() throws Exception {
return new ContentDirectoryService();
}
};
contentDirectoryService.setManager(contentDirectoryManger);
// 连接管理服务
LocalService<ConnectionManagerService> connectionManagerService
= binder.read(ConnectionManagerService.class);
connectionManagerService.setManager(new DefaultServiceManager<>(
connectionManagerService, ConnectionManagerService.class));
// TODO 添加 AVTransportService
// TODO 添加 AudioRenderingControl
localDevice = new LocalDevice(new DeviceIdentity(udn), type, details,
new LocalService[]{contentDirectoryService, connectionManagerService});
// 启动服务器
try {
nanoHttpServer = new NanoHttpServer(port);
nanoHttpServer.start();
Log.d(TAG, "Started Http Server on port " + port);
} catch (IOException e) {
Log.d(TAG, "Started Http Server on error:" + e.getMessage());
Toast.makeText(context, "启动服务器失败!", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
示例6: createMediaServerDevice
import org.fourthline.cling.support.connectionmanager.ConnectionManagerService; //导入依赖的package包/类
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});
}
示例7: createMediaServerDevice
import org.fourthline.cling.support.connectionmanager.ConnectionManagerService; //导入依赖的package包/类
private LocalDevice createMediaServerDevice() throws Exception {
DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier("FutureSonic"));
DeviceType type = new UDADeviceType("MediaServer", 1);
// TODO: DLNACaps
Version version = versionService.getLocalVersion();
String versionString = version == null ? null : version.toString();
String licenseEmail = "[email protected]"; //settingsService.getLicenseEmail();
String licenseString = licenseEmail == null ? "Unlicensed" : ("Licensed to " + licenseEmail);
DeviceDetails details = new DeviceDetails("FutureSonic Media Streamer", new ManufacturerDetails("FutureSonic"),
new ModelDetails("FutureSonic", licenseString, versionString),
new DLNADoc[]{new DLNADoc("DMS", DLNADoc.Version.V1_5)}, null);
Icon icon = new Icon("image/png", 512, 512, 32, getClass().getResource("futuresonic-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});
}
示例8: createMediaServerDevice
import org.fourthline.cling.support.connectionmanager.ConnectionManagerService; //导入依赖的package包/类
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 = "[email protected]"; //settingsService.getLicenseEmail();
String licenseString = licenseEmail == null ? "Unlicensed" : ("Licensed to " + licenseEmail);
DeviceDetails details = new DeviceDetails("Madsonic Media Streamer", 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("madsonic-512.png"));
@SuppressWarnings("unchecked")
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.
}
}
@SuppressWarnings("unchecked")
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
@SuppressWarnings("unchecked")
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});
}
示例9: createMediaServerDevice
import org.fourthline.cling.support.connectionmanager.ConnectionManagerService; //导入依赖的package包/类
private LocalDevice createMediaServerDevice() throws Exception {
DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier("Madsonic"));
DeviceType type = new UDADeviceType("MediaServer", 1);
// TODO: DLNACaps
Version version = versionService.getLocalVersion();
String versionString = version == null ? null : version.toString();
String licenseEmail = "[email protected]"; //settingsService.getLicenseEmail();
String licenseString = licenseEmail == null ? "Unlicensed" : ("Licensed to " + licenseEmail);
DeviceDetails details = new DeviceDetails("Madsonic Media Streamer", new ManufacturerDetails("Madsonic"),
new ModelDetails("Madsonic", licenseString, versionString),
new DLNADoc[]{new DLNADoc("DMS", DLNADoc.Version.V1_5)}, null);
Icon icon = new Icon("image/png", 512, 512, 32, getClass().getResource("madsonic-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});
}