本文整理汇总了Java中org.fourthline.cling.model.types.UDN类的典型用法代码示例。如果您正苦于以下问题:Java UDN类的具体用法?Java UDN怎么用?Java UDN使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UDN类属于org.fourthline.cling.model.types包,在下文中一共展示了UDN类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onServiceConnected
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(TAG, "onServiceConnected: " + name.flattenToShortString() + ", " + service.toString());
mUpnpService = (AndroidUpnpService) service;
Device device = mUpnpService.getRegistry().getDevice(new UDN(mDeviceUdn), false);
mContentDirectoryService = device.findService(new UDAServiceType("ContentDirectory"));
if (mContentDirectoryService == null) {
throw new IllegalStateException("Unable to find ContentDirectory service for device "
+ mDeviceUdn);
}
mDeviceName = (device.getDetails() != null && device.getDetails().getFriendlyName() != null)
? device.getDetails().getFriendlyName() : device.getDisplayString();
selectContainer(mCurrentContainer);
}
示例2: onCreate
import org.fourthline.cling.model.types.UDN; //导入依赖的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();
}
示例3: createDevice
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
private LocalDevice createDevice()
throws ValidationException, LocalServiceBindingException, IOException {
DeviceIdentity identity =
new DeviceIdentity(
UDN.uniqueSystemIdentifier(SmartApplianceEnabler.class.getSimpleName())
);
DeviceType type = new SmartApplianceEnablerDeviceType();
DeviceDetails details =
new DeviceDetails(
SmartApplianceEnabler.class.getSimpleName(),
new ManufacturerDetails(SmartApplianceEnabler.MANUFACTURER_NAME, URI.create(SmartApplianceEnabler.MANUFACTURER_URI)),
new ModelDetails(
SmartApplianceEnabler.class.getSimpleName(),
SmartApplianceEnabler.DESCRIPTION,
SmartApplianceEnabler.VERSION,
URI.create(SmartApplianceEnabler.MODEL_URI)
)
);
return new LocalDevice(identity, type, details, (Icon) null, (LocalService) null);
}
示例4: sendSearchResponseUDN
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
protected void sendSearchResponseUDN(UDN udn, NetworkAddress activeStreamServer) throws RouterException {
Device device = getUpnpService().getRegistry().getDevice(udn, false);
if (device != null && device instanceof LocalDevice) {
if (isAdvertisementDisabled((LocalDevice)device))
return;
log.fine("Responding to UDN device search: " + udn);
OutgoingSearchResponse message =
new OutgoingSearchResponseUDN(
getInputMessage(),
getDescriptorLocation(activeStreamServer, (LocalDevice) device),
(LocalDevice) device
);
prepareOutgoingSearchResponse(message);
getUpnpService().getRouter().send(message);
}
}
示例5: getRootDeviceUDN
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
public UDN getRootDeviceUDN() {
// This processes the headers as specified in UDA 1.0, tables in section 1.1.12
UpnpHeader<UDN> udnHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, USNRootDeviceHeader.class);
if (udnHeader != null) return udnHeader.getValue();
udnHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, UDNHeader.class);
if (udnHeader != null) return udnHeader.getValue();
UpnpHeader<NamedDeviceType> deviceTypeHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, DeviceUSNHeader.class);
if (deviceTypeHeader != null) return deviceTypeHeader.getValue().getUdn();
UpnpHeader<NamedServiceType> serviceTypeHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, ServiceUSNHeader.class);
if (serviceTypeHeader != null) return serviceTypeHeader.getValue().getUdn();
return null;
}
示例6: getUDN
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
/**
* @return The UDN value after parsing various USN header values, or <code>null</code>.
*/
public UDN getUDN() {
// This processes the headers as specified in UDA 1.0, tables in section 1.1.12
UpnpHeader<UDN> udnHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, USNRootDeviceHeader.class);
if (udnHeader != null) return udnHeader.getValue();
udnHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, UDNHeader.class);
if (udnHeader != null) return udnHeader.getValue();
UpnpHeader<NamedDeviceType> deviceTypeHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, DeviceUSNHeader.class);
if (deviceTypeHeader != null) return deviceTypeHeader.getValue().getUdn();
UpnpHeader<NamedServiceType> serviceTypeHeader = getHeaders().getFirstHeader(UpnpHeader.Type.USN, ServiceUSNHeader.class);
if (serviceTypeHeader != null) return serviceTypeHeader.getValue().getUdn();
return null;
}
示例7: uniqueSystemIdentifier
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
public static UDN uniqueSystemIdentifier(String salt) {
StringBuilder systemSalt = new StringBuilder();
Log.d(TAG, "host:" + BaseApplication.getHostName() + " ip:" + BaseApplication.getHostAddress());
if (null != BaseApplication.getHostName()
&& null != BaseApplication.getHostAddress()) {
systemSalt.append(BaseApplication.getHostName()).append(
BaseApplication.getHostAddress());
}
systemSalt.append(android.os.Build.MODEL);
systemSalt.append(android.os.Build.MANUFACTURER);
try {
byte[] hash = MessageDigest.getInstance("MD5").digest(systemSalt.toString().getBytes());
return new UDN(new UUID(new BigInteger(-1, hash).longValue(), salt.hashCode()));
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
示例8: createDevice
import org.fourthline.cling.model.types.UDN; //导入依赖的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.types.UDN; //导入依赖的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: testRendererGetProtocolInfo
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
public void testRendererGetProtocolInfo(){
waitForService();
LocalDevice rendererDevice = getService().getUpnpClient().getRegistry().getLocalDevice(new UDN(YaaccUpnpServerService.MEDIA_RENDERER_UDN_ID),false);
LocalService connectionService = rendererDevice.findService(new ServiceId(UDAServiceId.DEFAULT_NAMESPACE,"ConnectionManager"));
Action action = connectionService.getAction("GetProtocolInfo");
ActionInvocation<LocalService> actionInvocation = new ActionInvocation<LocalService>(action);
connectionService.getExecutor(action).execute(actionInvocation);
if(actionInvocation.getFailure() != null){
throw new RuntimeException(actionInvocation.getFailure().fillInStackTrace());
}
}
示例11: testServerGetProtocolInfo
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
public void testServerGetProtocolInfo(){
waitForService();
LocalDevice serverDevice = getService().getUpnpClient().getRegistry().getLocalDevice(new UDN(YaaccUpnpServerService.MEDIA_SERVER_UDN_ID),false);
LocalService connectionService = serverDevice.findService(new ServiceId(UDAServiceId.DEFAULT_NAMESPACE,"ConnectionManager"));
Action action = connectionService.getAction("GetProtocolInfo");
ActionInvocation<LocalService> actionInvocation = new ActionInvocation<LocalService>(action);
connectionService.getExecutor(action).execute(actionInvocation);
if(actionInvocation.getFailure() != null){
throw new RuntimeException(actionInvocation.getFailure().fillInStackTrace());
}
}
示例12: getDevice
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
/**
* Returns a registered UpnpDevice.
*
* @return the upnpDevice null if not found
*/
public Device<?, ?, ?> getDevice(String identifier) {
if (LOCAL_UID.equals(identifier)) {
return getLocalDummyDevice();
}
if (isInitialized()) {
return getRegistry().getDevice(new UDN(identifier), true);
}
return null;
}
示例13: getDevice
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
@Override
public Device getDevice(String udnString) {
UDN udn=new UDN(udnString);
Device dev = upnp.getDevice(udn);
return dev;
}
示例14: pushPicture
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
@Override
public void pushPicture(String udnString, String uri, long pictureTimeGap) throws InterruptedException {
UDN udn=new UDN(udnString);
Device device=upnpService.getControlPoint().getRegistry().getDevice(udn, true);
Thread.sleep(1000);
AVTransportHandler.stop(device, upnpService);
Thread.sleep(1000);
AVTransportHandler.setCurrentURI(device, uri, upnpService);
Thread.sleep(1000);
AVTransportHandler.play(device, upnpService);
Thread.sleep(pictureTimeGap);
AVTransportHandler.stop(device, upnpService);
}
示例15: pingOnDevice
import org.fourthline.cling.model.types.UDN; //导入依赖的package包/类
@Override
public void pingOnDevice(String udnString) throws InterruptedException {
UDN udn=new UDN(udnString);
System.out.println("Searching for " + udnString);
upnpService.getControlPoint().search(new UDNHeader(new UDN(udnString)));
Thread.sleep(2000);
Device device=upnpService.getControlPoint().getRegistry().getDevice(udn, true);
if (device!=null)System.out.println("Device found: " + device.getDisplayString());
else System.out.println("Device not found.");
}