本文整理汇总了Java中com.connectsdk.service.DeviceService.disconnect方法的典型用法代码示例。如果您正苦于以下问题:Java DeviceService.disconnect方法的具体用法?Java DeviceService.disconnect怎么用?Java DeviceService.disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.connectsdk.service.DeviceService
的用法示例。
在下文中一共展示了DeviceService.disconnect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeServiceWithId
import com.connectsdk.service.DeviceService; //导入方法依赖的package包/类
/**
* Removes a DeviceService from the ConnectableDevice instance.
*
* @param serviceId ID of the DeviceService to be removed (DLNA, webOS TV, etc)
*/
public void removeServiceWithId(String serviceId) {
DeviceService service = services.get(serviceId);
if (service == null)
return;
service.disconnect();
services.remove(serviceId);
final List<String> removed = getMismatchCapabilities(service.getCapabilities(), getCapabilities());
Util.runOnUI(new Runnable() {
@Override
public void run() {
for (ConnectableDeviceListener listener : listeners)
listener.onCapabilityUpdated(ConnectableDevice.this, new ArrayList<String>(), removed);
}
});
}
示例2: disconnect
import com.connectsdk.service.DeviceService; //导入方法依赖的package包/类
/**
* Enumerates through all DeviceServices and attempts to disconnect from each of them.
*/
public void disconnect() {
for (DeviceService service: services.values()) {
service.disconnect();
}
Util.runOnUI(new Runnable() {
@Override
public void run() {
for (ConnectableDeviceListener listener : listeners)
listener.onDeviceDisconnected(ConnectableDevice.this);
}
});
}