本文整理汇总了Java中org.cybergarage.upnp.ControlPoint.search方法的典型用法代码示例。如果您正苦于以下问题:Java ControlPoint.search方法的具体用法?Java ControlPoint.search怎么用?Java ControlPoint.search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cybergarage.upnp.ControlPoint
的用法示例。
在下文中一共展示了ControlPoint.search方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.cybergarage.upnp.ControlPoint; //导入方法依赖的package包/类
/**
* Dumps out device info in semi-HTML format
*/
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.setProperty(PROP_ADVANCED, "true");
I2PAppContext ctx = new I2PAppContext(props);
UPnP upnp = new UPnP(ctx);
ControlPoint cp = new ControlPoint();
System.out.println("Searching for UPnP devices:");
cp.start();
cp.search();
Thread.sleep(10000);
//while(true) {
DeviceList list = cp.getDeviceList();
System.out.println("Found " + list.size() + " devices!");
StringBuilder sb = new StringBuilder();
Iterator<Device> it = list.iterator();
while(it.hasNext()) {
Device device = it.next();
upnp.listSubDev(device.toString(), device, sb);
System.out.println("Here is the listing for " + device.toString() + " :");
System.out.println(sb.toString());
sb.setLength(0);
}
//}
System.exit(0);
}
示例2: main
import org.cybergarage.upnp.ControlPoint; //导入方法依赖的package包/类
/**
* Dumps out device info in semi-HTML format
*/
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.setProperty(PROP_ADVANCED, "true");
I2PAppContext ctx = new I2PAppContext(props);
UPnP upnp = new UPnP(ctx);
ControlPoint cp = new ControlPoint();
System.out.println("Searching for UPnP devices:");
cp.start();
cp.search();
Thread.sleep(10000);
//while(true) {
DeviceList list = cp.getDeviceList();
System.out.println("Found " + list.size() + " devices!");
StringBuilder sb = new StringBuilder();
Iterator<Device> it = list.iterator();
int i = 0;
while(it.hasNext()) {
Device device = it.next();
upnp.listSubDev(device.toString(), device, sb);
System.out.println("Here is the listing for device " + (++i) +
' ' + device.getFriendlyName() + " :");
System.out.println(sb.toString());
sb.setLength(0);
}
//}
System.exit(0);
}
示例3: run
import org.cybergarage.upnp.ControlPoint; //导入方法依赖的package包/类
@Override
public void run() {
final ControlPoint cp = controlPointRef.get();
if (cp == null) {
if (LOG.isWarnEnabled()) {
LOG.warn("Skipping search for Wemo devices because UPNP ControlPoint is unavailable.");
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Initiating search for Wemo devices.");
}
cp.search();
}
}