本文整理汇总了Java中org.fourthline.cling.model.DefaultServiceManager类的典型用法代码示例。如果您正苦于以下问题:Java DefaultServiceManager类的具体用法?Java DefaultServiceManager怎么用?Java DefaultServiceManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultServiceManager类属于org.fourthline.cling.model包,在下文中一共展示了DefaultServiceManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContentDirectoryService
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
/**
* Creates an ContentDirectoryService. The content directory includes all
* Files of the MediaStore.
*
* @return The ContenDiractoryService.
*/
@SuppressWarnings("unchecked")
private LocalService<YaaccContentDirectory> createContentDirectoryService() {
LocalService<YaaccContentDirectory> contentDirectoryService = new AnnotationLocalServiceBinder().read(YaaccContentDirectory.class);
contentDirectoryService.setManager(new DefaultServiceManager<YaaccContentDirectory>(contentDirectoryService, null) {
@Override
protected int getLockTimeoutMillis() {
return 1000;
}
@Override
protected YaaccContentDirectory createServiceInstance() throws Exception {
return new YaaccContentDirectory(getApplicationContext());
}
});
return contentDirectoryService;
}
示例2: createAVTransportService
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
/**
* creates an AVTransportService
*
* @return the service
*/
@SuppressWarnings("unchecked")
private LocalService<YaaccAVTransportService> createAVTransportService() {
LocalService<YaaccAVTransportService> avTransportService = new AnnotationLocalServiceBinder().read(YaaccAVTransportService.class);
avTransportService.setManager(new DefaultServiceManager<YaaccAVTransportService>(avTransportService, null) {
@Override
protected int getLockTimeoutMillis() {
return 1000;
}
@Override
protected YaaccAVTransportService createServiceInstance() throws Exception {
return new YaaccAVTransportService(getUpnpClient());
}
});
return avTransportService;
}
示例3: createRenderingControl
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
private LocalService<AbstractAudioRenderingControl> createRenderingControl() {
LocalService<AbstractAudioRenderingControl> renderingControlService = new AnnotationLocalServiceBinder()
.read(AbstractAudioRenderingControl.class);
renderingControlService.setManager(new DefaultServiceManager<AbstractAudioRenderingControl>(renderingControlService, null) {
@Override
protected int getLockTimeoutMillis() {
return 1000;
}
@Override
protected AbstractAudioRenderingControl createServiceInstance() throws Exception {
return new YaaccAudioRenderingControlService(getUpnpClient());
}
});
return renderingControlService;
}
示例4: createMediaReceiverRegistrarService
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
private LocalService<AbstractMediaReceiverRegistrarService> createMediaReceiverRegistrarService() {
LocalService<AbstractMediaReceiverRegistrarService> service = new AnnotationLocalServiceBinder()
.read(AbstractMediaReceiverRegistrarService.class);
service.setManager(new DefaultServiceManager<AbstractMediaReceiverRegistrarService>(service, null) {
@Override
protected int getLockTimeoutMillis() {
return 1000;
}
@Override
protected AbstractMediaReceiverRegistrarService createServiceInstance() throws Exception {
return new YaaccMediaReceiverRegistrarService(getUpnpClient());
}
});
return service;
}
示例5: createServerConnectionManagerService
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的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;
}
示例6: createRendererConnectionManagerService
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的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;
}
示例7: onCreate
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
//Create LocalDevice
LocalService localService = new AnnotationLocalServiceBinder().read(BeyondContentDirectoryService.class);
localService.setManager(new DefaultServiceManager<>(
localService, BeyondContentDirectoryService.class));
String macAddress = Utils.getMACAddress(Utils.WLAN0);
//Generate UUID by MAC address
UDN udn = UDN.valueOf(UUID.nameUUIDFromBytes(macAddress.getBytes()).toString());
try {
mLocalDevice = new LocalDevice(new DeviceIdentity(udn), new UDADeviceType("MediaServer"),
new DeviceDetails("Local Media Server"), new LocalService[]{localService});
} catch (ValidationException e) {
e.printStackTrace();
}
upnpService.getRegistry().addDevice(mLocalDevice);
//LocalBinder instead of binder
binder = new LocalBinder();
}
示例8: createDevice
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的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 });
}
示例9: MediaServer
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
public MediaServer(InetAddress localAddress, Context ctx) throws ValidationException
{
super(null, port, null, true);
Log.i(TAG, "Creating media server !");
localService = new AnnotationLocalServiceBinder()
.read(ContentDirectoryService.class);
localService.setManager(new DefaultServiceManager<ContentDirectoryService>(
localService, ContentDirectoryService.class));
udn = UDN.valueOf(new UUID(0,10).toString());
this.localAddress = localAddress;
this.ctx = ctx;
createLocalDevice();
ContentDirectoryService contentDirectoryService = (ContentDirectoryService)localService.getManager().getImplementation();
contentDirectoryService.setContext(ctx);
contentDirectoryService.setBaseURL(getAddress());
}
示例10: createContentDirectoryService
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
private LocalService<YaaccContentDirectory> createContentDirectoryService() {
LocalService<YaaccContentDirectory> contentDirectoryService = new AnnotationLocalServiceBinder()
.read(YaaccContentDirectory.class);
contentDirectoryService.setManager(new DefaultServiceManager<YaaccContentDirectory>(
contentDirectoryService, null) {
@Override
protected YaaccContentDirectory createServiceInstance()
throws Exception {
return new YaaccContentDirectory(context);
}
});
return contentDirectoryService;
}
示例11: createDevice
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
LocalDevice createDevice() throws ValidationException, LocalServiceBindingException, IOException {
DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier("SensoryEffectRendererDevice"));
DeviceType type = new UDADeviceType("SensoryEffectRenderer", 1);
DeviceDetails details =
new DeviceDetails(
"LPRM - PlaySEM - Sensory Effect Renderer Device",
new ManufacturerDetails("LPRM"),
new ModelDetails(
"PlaySEM.SERendererDevice.ModelA",
"A remote Sensory Effect Renderer Device. Model A supports Light, Fan and Vibration.",
"v1"
)
);
String iconResource = "br/ufes/inf/lprm/sensoryeffect/renderer/icon.png";
Icon icon = new Icon("image/png", 48, 48, 8, "icon.png", Thread.currentThread().getContextClassLoader().getResourceAsStream(iconResource));
LocalService<SERendererService> seRendererService = new AnnotationLocalServiceBinder().read(SERendererService.class);
seRendererService.setManager(new DefaultServiceManager(seRendererService, SERendererService.class));
try {
return new LocalDevice(identity, type, details, icon, seRendererService);
}
catch (Exception e) {
System.out.print("An exception has occured: " + e.getMessage());
e.printStackTrace();
return null;
}
}
示例12: addServiceToDevice
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
public LocalService<?> addServiceToDevice( Class<?> serviceClass ) {
LocalService newLocalService =
new AnnotationLocalServiceBinder().read(serviceClass);
newLocalService.setManager(
new DefaultServiceManager(
newLocalService, serviceClass
)
);
serviceList.add(newLocalService);
return newLocalService;
}
示例13: createDevice
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
public LocalDevice createDevice( )
throws ValidationException,
LocalServiceBindingException,
IOException {
DeviceIdentity identity = new DeviceIdentity(
UDN.uniqueSystemIdentifier(deviceIdentity));
DeviceType type = new UDADeviceType("BinaryLight", 1);
DeviceDetails details = new DeviceDetails(friendlyName,
new ManufacturerDetails(manufacturerName), new ModelDetails(
modelName, modelDescription, modelNumber));
/*Icon icon = new Icon("image/png", 48, 48, 8, getClass().getResource(
"icon.png"));*/
LocalService switchPowerService = new AnnotationLocalServiceBinder()
.read(implClass);
switchPowerService.setManager(new DefaultServiceManager(
switchPowerService, implClass));
return new LocalDevice(identity, type, details, /*icon,*/
switchPowerService);
/*
* Several services can be bound to the same device: return new
* LocalDevice( identity, type, details, icon, new LocalService[]
* {switchPowerService, myOtherService} );
*/
}
示例14: MediaServer
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的package包/类
public MediaServer(Context context ) throws ValidationException {
mContext = context;
DeviceType type = new UDADeviceType(deviceType, version);
DeviceDetails details = new DeviceDetails(SettingActivity.getDeviceName(context) + " ("
+ android.os.Build.MODEL + ")", new ManufacturerDetails(
android.os.Build.MANUFACTURER), new ModelDetails(android.os.Build.MODEL,
Utils.DMS_DESC, "v1"));
LocalService service = new AnnotationLocalServiceBinder()
.read(ContentDirectoryService.class);
service.setManager(new DefaultServiceManager<ContentDirectoryService>(service,
ContentDirectoryService.class));
udn = UpnpUtil.uniqueSystemIdentifier("msidms");
localDevice = new LocalDevice(new DeviceIdentity(udn), type, details, createDefaultDeviceIcon(), service);
Log.v(LOGTAG, "MediaServer device created: ");
Log.v(LOGTAG, "friendly name: " + details.getFriendlyName());
Log.v(LOGTAG, "manufacturer: " + details.getManufacturerDetails().getManufacturer());
Log.v(LOGTAG, "model: " + details.getModelDetails().getModelName());
// start http server
try {
new HttpServer(PORT);
} catch (IOException ioe) {
System.err.println("Couldn't start server:\n" + ioe);
System.exit(-1);
}
Log.v(LOGTAG, "Started Http Server on port " + PORT);
}
示例15: createMediaServerDevice
import org.fourthline.cling.model.DefaultServiceManager; //导入依赖的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});
}