本文整理汇总了Java中org.cybergarage.upnp.ControlPoint类的典型用法代码示例。如果您正苦于以下问题:Java ControlPoint类的具体用法?Java ControlPoint怎么用?Java ControlPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ControlPoint类属于org.cybergarage.upnp包,在下文中一共展示了ControlPoint类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startThread
import org.cybergarage.upnp.ControlPoint; //导入依赖的package包/类
private void startThread() {
if (this.mSearchThread != null) {
LogInfo.log("dlna", "thread is not null");
this.mSearchThread.setSearcTimes(0);
} else {
LogInfo.log("dlna", "thread is null, create a new thread");
ControlPoint controlPoint = new ControlPoint();
this.mControlPoint = controlPoint;
this.mSearchThread = new SearchThread(controlPoint);
}
if (this.mSearchThread.isAlive()) {
LogInfo.log("dlna", "thread is alive");
this.mSearchThread.awake();
return;
}
LogInfo.log("dlna", "start the thread");
this.mSearchThread.start();
}
示例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();
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);
}
示例3: 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);
}
示例4: init
import org.cybergarage.upnp.ControlPoint; //导入依赖的package包/类
@Override
public void init(ProviderConfiguration configuration, OnEventListener onEventListener) throws Exception {
controlPoint = new ControlPoint();
if (!controlPoint.start()) {
throw new IOException("Could not start UPNP ControlPoint.");
}
deviceRegistry = new WemoDeviceRegistry(controlPoint);
controlPoint.addDeviceChangeListener(deviceRegistry);
// Schedule a new UPNP search for every minute.
executorService = Executors.newSingleThreadScheduledExecutor();
executorService.scheduleAtFixedRate(new UpnpSearchRunnable(controlPoint), 0l, 1l, TimeUnit.MINUTES);
if (LOG.isInfoEnabled()) {
LOG.info("Scheduled a search for Wemo devices every minute.");
}
stateDefinitions = new ArrayList<>();
eventDefinitions = new ArrayList<>();
actionDefinitions = new HashMap<>();
stateDefinitions.add(new WemoSwitchStateDefinition());
eventDefinitions.add(new WemoSwitchOnOffEventDefinition());
actionDefinitions.put(TurnOnOffActionDefinition.DEF_UUID, new TurnOnOffActionDefinition(deviceRegistry));
this.onEventListener = onEventListener;
controlPoint.addEventListener(this);
}
示例5: 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();
}
}
示例6: SearchThread
import org.cybergarage.upnp.ControlPoint; //导入依赖的package包/类
public SearchThread(ControlPoint mControlPoint) {
this.mControlPoint = mControlPoint;
this.mControlPoint.addDeviceChangeListener(this.mDeviceChangeListener);
}
示例7: SearchThread
import org.cybergarage.upnp.ControlPoint; //导入依赖的package包/类
public SearchThread(ControlPoint mControlPoint) {
super();
this.mControlPoint = mControlPoint;
this.mControlPoint.addDeviceChangeListener(mDeviceChangeListener);
}
示例8: init
import org.cybergarage.upnp.ControlPoint; //导入依赖的package包/类
private void init() {
mControlPoint = new ControlPoint();
mSearchThread = new SearchThread(mControlPoint);
registerWifiStateReceiver();
}
示例9: UpnpSearchRunnable
import org.cybergarage.upnp.ControlPoint; //导入依赖的package包/类
public UpnpSearchRunnable(ControlPoint controlPoint) {
controlPointRef = new WeakReference<ControlPoint>(controlPoint);
}
示例10: WemoDeviceRegistry
import org.cybergarage.upnp.ControlPoint; //导入依赖的package包/类
public WemoDeviceRegistry(ControlPoint controlPoint) {
this.controlPoint = controlPoint;
}
示例11: UPnPManager
import org.cybergarage.upnp.ControlPoint; //导入依赖的package包/类
private UPnPManager() {
this.cp = new ControlPoint();
}