当前位置: 首页>>代码示例>>Java>>正文


Java UDN类代码示例

本文整理汇总了Java中org.teleal.cling.model.types.UDN的典型用法代码示例。如果您正苦于以下问题:Java UDN类的具体用法?Java UDN怎么用?Java UDN使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UDN类属于org.teleal.cling.model.types包,在下文中一共展示了UDN类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onServiceConnected

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
/**
 * Registers DeviceListener, adds known devices and starts search if requested.
 */
public void onServiceConnected(ComponentName className, IBinder service) {
	mUpnpService = (AndroidUpnpService) service;
	mUpnpService.getRegistry().addListener(mServerAdapter);
	for (Device<?, ?, ?> d : mUpnpService.getControlPoint().getRegistry().getDevices())
		mServerAdapter.deviceAdded(d);
	mUpnpService.getControlPoint().search();

	if (mRestoreServer != null) {
		mCurrentServer = mUpnpService.getControlPoint().getRegistry()
				.getDevice(new UDN(mRestoreServer.replace("uuid:", "")), false);
		if (mCurrentServer != null) {
			setListAdapter(mFileAdapter);
			// Duplicate the top element because getFiles will remove it.
			mListState.add(mListState.peek());
			getFiles(true);
		}

		getListView().onRestoreInstanceState(mListState.peek());
	}
}
 
开发者ID:Nutomic,项目名称:controldlna,代码行数:24,代码来源:ServerFragment.java

示例2: remoteDeviceAdded

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public void remoteDeviceAdded(Registry registry, RemoteDevice device) {

	// add only Sonos devices
	if (device.getDetails().getManufacturerDetails().getManufacturer()
			.toUpperCase().contains("SONOS")) {

		UDN udn = device.getIdentity().getUdn();
		boolean existingDevice = false;

		logger.info("Found a Sonos device ({}) with UDN {}",device.getDetails().getModelDetails().getModelNumber(),udn);

		// Check if we already received a configuration for this
		// device through the .cfg
		SonosZonePlayer thePlayer = sonosZonePlayerCache.getByUDN(udn.getIdentifierString());

		if (thePlayer == null) {
			// Add device to the cached Configs
			thePlayer = new SonosZonePlayer(udn.getIdentifierString(),self);
			thePlayer.setUdn(udn);

			sonosZonePlayerCache.add(thePlayer);
		}

		thePlayer.setDevice(device);
		thePlayer.setService(upnpService);
		thePlayer.updateCurrentZoneName();

		// add GENA service to capture zonegroup information
		Service service = device.findService(new UDAServiceId(
				"ZoneGroupTopology"));
		SonosSubscriptionCallback callback = new SonosSubscriptionCallback(
				service, interval);
		upnpService.getControlPoint().execute(callback);
	} else {
		logger.debug("A non-Sonos device ({}) is found and will be ignored",device.getDisplayString());
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:39,代码来源:SonosBinding.java

示例3: createDevice

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
LocalDevice createDevice()
            throws ValidationException, LocalServiceBindingException, IOException {

        DeviceIdentity identity =
                new DeviceIdentity(
                        UDN.uniqueSystemIdentifier("CMU Cloudlet Server")
                );

        DeviceType type =
                new UDADeviceType("CloudletServer", 1);

        DeviceDetails details =
                new DeviceDetails(
                        "CMU Cloudlet Service",
                        new ManufacturerDetails("CMU"),
                        new ModelDetails(
                                "Cloudlet V1.0",
                                "A Demo Cloudlet Server",
                                "v1"
                        )
                );

//        Icon icon =new Icon( "image/png", 48, 48, 8, getClass().getResource("icon.png"));

        LocalService<GabrielService> gabrielService = new AnnotationLocalServiceBinder().read(GabrielService.class);

        gabrielService.setManager(
                new DefaultServiceManager(gabrielService, GabrielService.class)
        );

        return new LocalDevice(identity, type, details, gabrielService);

        /* Several services can be bound to the same device:
        return new LocalDevice(
                identity, type, details, icon,
                new LocalService[] {switchPowerService, myOtherService}
        );
        */
        
    }
 
开发者ID:cmusatyalab,项目名称:gabriel,代码行数:41,代码来源:GabrielUPnPServer.java

示例4: connect

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public void connect(DeviceListItem deviceItem) {
	if (transportSubscription != null) {transportSubscription.end();}
	if (renderingSubscription != null) {renderingSubscription.end();}
	if (positionInfoScheduler != null) {positionInfoScheduler.cancel();}

	Device device = registry.getDevice((UDN) deviceItem.getId(), false);
	
	avtService = (RemoteService) device.findService(new UDAServiceId("AVTransport"));
	transportSubscription = new TransportSubscription(avtService, getRenderer());
	controlPoint.execute(transportSubscription);

	rcService = (RemoteService) device.findService(new UDAServiceId("RenderingControl"));
	renderingSubscription = new RenderingSubscription(rcService, getRenderer());
	controlPoint.execute(renderingSubscription);
	
	logger.log(Level.INFO, "Started subscriptions on [" + device.getDetails().getFriendlyName() + "]");
	
	// get position info callback
	GetPositionInfo getPositionInfoAction = new GetPositionInfo(avtService) {
		@Override
		public void failure(ActionInvocation action, UpnpResponse response, String msg) {
			logger.log(Level.WARNING, "Could not get position info: " + msg);
		}
		@Override
		public void received(ActionInvocation invocation, PositionInfo positionInfo) {
			
			Long trackDuration = positionInfo.getTrackDurationSeconds();
			Long trackElapsed = positionInfo.getTrackElapsedSeconds();
			getRenderer().setTrackDuration(trackDuration);
			getRenderer().setTrackElapsed(trackElapsed);
		}
	};
	
	positionInfoScheduler = new Timer();
	TimerTask getPositionInfo = new PositionInfoTask(controlPoint, getPositionInfoAction);
	positionInfoScheduler.schedule(getPositionInfo, 0, 2000);
	
}
 
开发者ID:Douglas6,项目名称:pipoint,代码行数:41,代码来源:DlnaRendererManager.java

示例5: remoteDeviceAdded

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public void remoteDeviceAdded(Registry registry, RemoteDevice device) {

    // add only Sonos devices
    if (device.getDetails().getManufacturerDetails().getManufacturer().toUpperCase().contains("SONOS")) {

        UDN udn = device.getIdentity().getUdn();
        boolean existingDevice = false;

        logger.info("Found a Sonos device ({}) with UDN {}",
                device.getDetails().getModelDetails().getModelNumber(), udn);

        // Check if we already received a configuration for this
        // device through the .cfg
        SonosZonePlayer thePlayer = sonosZonePlayerCache.getByUDN(udn.getIdentifierString());

        if (thePlayer == null) {
            // Add device to the cached Configs
            thePlayer = new SonosZonePlayer(udn.getIdentifierString(), self);
            thePlayer.setUdn(udn);

            sonosZonePlayerCache.add(thePlayer);
        }

        thePlayer.setDevice(device);
        thePlayer.setService(upnpService);
        thePlayer.updateCurrentZoneName();

        // add GENA service to capture zonegroup information
        Service service = device.findService(new UDAServiceId("ZoneGroupTopology"));
        SonosSubscriptionCallback callback = new SonosSubscriptionCallback(service, interval);
        upnpService.getControlPoint().execute(callback);
    } else {
        logger.debug("A non-Sonos device ({}) is found and will be ignored", device.getDisplayString());
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:38,代码来源:SonosBinding.java

示例6: getUdn

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
/**
 * @return the udn
 */
public UDN getUdn() {
	return udn;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:7,代码来源:SonosZonePlayer.java

示例7: setUdn

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
/**
 * @param udn the udn to set
 */
public void setUdn(UDN udn) {
	this.udn = udn;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:7,代码来源:SonosZonePlayer.java

示例8: updated

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public void updated(Dictionary config) throws ConfigurationException {
	if (config != null) {
		Enumeration keys = config.keys();
		while (keys.hasMoreElements()) {

			String key = (String) keys.nextElement();

			// the config-key enumeration contains additional keys that we
			// don't want to process here ...
			if ("service.pid".equals(key)) {
				continue;
			}

			if ("pollingPeriod".equals(key)) {
				pollingPeriod = Integer.parseInt((String) config.get(key));
				logger.debug("Setting polling period to {} ms", pollingPeriod);
				continue;
			}

			Matcher matcher = EXTRACT_SONOS_CONFIG_PATTERN.matcher(key);
			if (!matcher.matches()) {
				logger.debug("given sonos-config-key '"
						+ key + "' does not follow the expected pattern '<sonosId>.<udn>'");
				continue;
			}

			matcher.reset();
			matcher.find();

			String sonosID = matcher.group(1);

			SonosZonePlayer sonosConfig = sonosZonePlayerCache.getById(sonosID);
			if (sonosConfig == null) {
				sonosConfig = new SonosZonePlayer(sonosID,self);
				sonosZonePlayerCache.add(sonosConfig);
			}

			String configKey = matcher.group(2);
			String value = (String) config.get(key);

			if ("udn".equals(configKey)) {
				sonosConfig.setUdn(new UDN(value));
				logger.debug("Add predefined Sonos device with UDN {}", sonosConfig.getUdn());
			} else {
				throw new ConfigurationException(configKey,
						"the given configKey '" + configKey + "' is unknown");
			}
		}
	}

	setProperlyConfigured(true);

}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:55,代码来源:SonosBinding.java

示例9: getUdn

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
public UDN getUdn() {
	return udn;
}
 
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:4,代码来源:MediaServer.java

示例10: getUdn

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
/**
 * @return the udn
 */
public UDN getUdn() {
    return udn;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:7,代码来源:SonosZonePlayer.java

示例11: setUdn

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
/**
 * @param udn the udn to set
 */
public void setUdn(UDN udn) {
    this.udn = udn;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:7,代码来源:SonosZonePlayer.java

示例12: updated

import org.teleal.cling.model.types.UDN; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public void updated(Dictionary config) throws ConfigurationException {
    if (config != null) {
        Enumeration keys = config.keys();
        while (keys.hasMoreElements()) {

            String key = (String) keys.nextElement();

            // the config-key enumeration contains additional keys that we
            // don't want to process here ...
            if ("service.pid".equals(key)) {
                continue;
            }

            if ("pollingPeriod".equals(key)) {
                pollingPeriod = Integer.parseInt((String) config.get(key));
                logger.debug("Setting polling period to {} ms", pollingPeriod);
                continue;
            }

            Matcher matcher = EXTRACT_SONOS_CONFIG_PATTERN.matcher(key);
            if (!matcher.matches()) {
                logger.debug("given sonos-config-key '" + key
                        + "' does not follow the expected pattern '<sonosId>.<udn>'");
                continue;
            }

            matcher.reset();
            matcher.find();

            String sonosID = matcher.group(1);

            SonosZonePlayer sonosConfig = sonosZonePlayerCache.getById(sonosID);
            if (sonosConfig == null) {
                sonosConfig = new SonosZonePlayer(sonosID, self);
                sonosZonePlayerCache.add(sonosConfig);
            }

            String configKey = matcher.group(2);
            String value = (String) config.get(key);

            if ("udn".equals(configKey)) {
                sonosConfig.setUdn(new UDN(value));
                logger.debug("Add predefined Sonos device with UDN {}", sonosConfig.getUdn());
            } else {
                throw new ConfigurationException(configKey, "the given configKey '" + configKey + "' is unknown");
            }
        }
    }

    setProperlyConfigured(true);

}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:55,代码来源:SonosBinding.java


注:本文中的org.teleal.cling.model.types.UDN类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。