本文整理汇总了Java中org.teleal.cling.model.meta.Device类的典型用法代码示例。如果您正苦于以下问题:Java Device类的具体用法?Java Device怎么用?Java Device使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Device类属于org.teleal.cling.model.meta包,在下文中一共展示了Device类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: CreateListenerToPrintUPnPDeviceData
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
/**
* Lists devices, services, actions, and action argumensts.
*
* @return A listener to print out debut information.
*/
public static RegistryListener CreateListenerToPrintUPnPDeviceData(){
RegistryListener Listener = new DefaultRegistryListener(){
@Override
public void deviceAdded(Registry registry, Device device) {
Service service = device.findService(new UDAServiceId("WANIPConnection"));
if (service != null){
ramaTiNup.println("Found WANIPConnection service.");
}
ramaTiNup.println("Added device: " + device.getDisplayString());
for (Service s: device.findServices()){
ramaTiNup.println(" Has Service: " + s.toString());
for (Action a: s.getActions()){
ramaTiNup.println(" Has Action: " + a.getName());
for (ActionArgument aArgs: a.getArguments()){
ramaTiNup.println(" Has Action Argument: " + aArgs.getName());
}
}
}
}
};
return Listener;
}
开发者ID:Ch3ck,项目名称:ramaTiNuP,代码行数:29,代码来源:UPnP.java
示例2: DmrDevice
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
protected DmrDevice(Device<?, ?, ?> device) {
this.device = device;
ac = new ActionController();
String friendlyName = device.getDetails().getFriendlyName();
if (!TextUtils.isEmpty(friendlyName)) {
try {
byte[] bytes = new byte[friendlyName.length()];
for (int i = 0; i < bytes.length; ++i) {
bytes[i] = (byte) (friendlyName.charAt(i) & 0x00FF);
}
this.friendlyName = new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:17,代码来源:DmrDevice.java
示例3: adaptDevice
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
private DeviceListItem adaptDevice(Device device) {
DeviceListItem deviceItem = new DeviceListItem();
deviceItem.setId(device.getIdentity().getUdn());
deviceItem.setName(device.getDetails().getFriendlyName());
deviceItem.setDescription(device.getDetails().getModelDetails().getModelName());
if (device.getIcons() != null && device.getIcons().length > 0) {
Icon icon = device.getIcons()[0];
URL iconUrl = ((RemoteDevice) device).normalizeURI(icon.getUri());
try {
BufferedImage deviceImage = ImageIO.read(iconUrl);
deviceItem.setIcon(deviceImage);
} catch (IOException ex) {
logger.log(Level.SEVERE, "Exception caught scaling renderer icon at [" + iconUrl.getPath() + "]; " + ex.getMessage(), ex);
}
} else {
deviceItem.setIcon(defaultDeviceIcon.getImage());
}
return deviceItem;
}
开发者ID:Douglas6,项目名称:pipoint,代码行数:21,代码来源:DlnaRendererManager.java
示例4: onServiceConnected
import org.teleal.cling.model.meta.Device; //导入依赖的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
示例5: onServiceConnected
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
public void onServiceConnected(ComponentName className, IBinder service) {
upnpService = (AndroidUpnpService) service;
boolean found = false;
for (Device<?, ?, ?> device : upnpService.getRegistry().getDevices()) {
try {
if (device.getDetails().getSerialNumber() != null && !device.getDetails().getSerialNumber().isEmpty()) {
if (device.getDetails().getSerialNumber().equals(((BrowserUpnp) mBrowser).getSerial())) {
startBrowse(device);
found = true;
}
} else {
if (device.getIdentity().getUdn().toString().equals(((BrowserUpnp) mBrowser).getSerial())) {
startBrowse(device);
found = true;
}
}
} catch (Exception e) {}
}
if (!found)
Toast.makeText(getActivity(), getString(R.string.errorSomethingWentWrong), Toast.LENGTH_LONG).show();
}
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:25,代码来源:FileSourceBrowserFragment.java
示例6: onServiceConnected
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
public void onServiceConnected(ComponentName className, IBinder service) {
mUpnpService = (AndroidUpnpService) service;
boolean found = false;
for (Device<?, ?, ?> device : mUpnpService.getRegistry().getDevices()) {
try {
if (!TextUtils.isEmpty(device.getDetails().getSerialNumber())) {
if (device.getDetails().getSerialNumber().equals(mFileSource.getUpnpSerialNumber())) {
startBrowse(device);
found = true;
}
} else {
if (device.getIdentity().getUdn().toString().equals(mFileSource.getUpnpSerialNumber())) {
startBrowse(device);
found = true;
}
}
} catch (Exception e) {}
}
if (!found) {
mUpnpService.getRegistry().addListener(new DeviceListRegistryListener());
mUpnpService.getControlPoint().search();
}
}
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:27,代码来源:UpnpTvShow.java
示例7: onServiceConnected
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
public void onServiceConnected(ComponentName className, IBinder service) {
mUpnpService = (AndroidUpnpService) service;
boolean found = false;
for (Device<?, ?, ?> device : mUpnpService.getRegistry().getDevices()) {
try {
if (!TextUtils.isEmpty(device.getDetails().getSerialNumber())) {
if (device.getDetails().getSerialNumber().equals(mFileSource.getUpnpSerialNumber())) {
startBrowse(device);
found = true;
}
} else {
if (device.getIdentity().getUdn().toString().equals(mFileSource.getUpnpSerialNumber())) {
startBrowse(device);
found = true;
}
}
} catch (Exception e) {}
}
if (!found) {
mUpnpService.getRegistry().addListener(new DeviceListRegistryListener());
mUpnpService.getControlPoint().search();
}
}
开发者ID:MizzleDK,项目名称:Mizuu,代码行数:27,代码来源:UpnpMovie.java
示例8: DmrDevice
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
protected DmrDevice(Device<?, ?, ?> device) {
this.device = device;
String friendlyName = device.getDetails().getFriendlyName();
if (!TextUtils.isEmpty(friendlyName)) {
try {
byte[] bytes = new byte[friendlyName.length()];
for (int i = 0; i < bytes.length; ++i) {
bytes[i] = (byte) (friendlyName.charAt(i) & 0x00FF);
}
this.friendlyName = new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:16,代码来源:DmrDevice.java
示例9: deviceAdded
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
@Override
public void deviceAdded(Registry registry, Device device) {
super.deviceAdded(registry, device);
if (device.getType().toString().contains("MediaRenderer")
&& callback != null) {
if (deviceSet.add(device))
callback.onDeviceAdd(new DmrDevice(device));
}
}
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:10,代码来源:DeviceManager.java
示例10: deviceRemoved
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
@Override
public void deviceRemoved(Registry registry, Device device) {
super.deviceRemoved(registry, device);
if (device.getType().toString().contains("MediaRenderer")
&& callback != null) {
deviceSet.remove(device);
callback.onDeviceDown(new DmrDevice(device));
}
}
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:10,代码来源:DeviceManager.java
示例11: deviceAdded
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
@Override
public void deviceAdded(Registry registry, Device device) {
super.deviceAdded(registry, device);
if (callback != null) {
callback.onDeviceAdd(device);
}
}
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:8,代码来源:DeviceManager.java
示例12: deviceRemoved
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
@Override
public void deviceRemoved(Registry registry, Device device) {
super.deviceRemoved(registry, device);
if (callback != null) {
callback.onDeviceRemove(device);
}
}
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:8,代码来源:DeviceManager.java
示例13: onDeviceAdd
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
@Override
public void onDeviceAdd(Device device) {
if (device.getType().toString().contains("MediaRenderer")) {
DmrDevice dmrDevice = new DmrDevice(device);
if (dmrDevices.add(dmrDevice)) {
listener.onDeviceAdd(dmrDevice);
}
}
}
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:10,代码来源:DmrDeviceManager.java
示例14: onDeviceRemove
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
@Override
public void onDeviceRemove(Device device) {
if (device.getType().toString().contains("MediaRenderer")) {
for (DmrDevice dmrDevice : dmrDevices) {
if (device.getIdentity().getUdn().toString()
.equals(dmrDevice.getUdn())) {
dmrDevices.remove(dmrDevice);
listener.onDeviceRemove(dmrDevice);
}
}
}
}
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:13,代码来源:DmrDeviceManager.java
示例15: onServiceConnected
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
public void onServiceConnected(ComponentName className, IBinder service) {
// Toast.makeText(_hgcontext.getApplicationContext(), "UPnP service active.", 2000).show();
try {
upnpService = (AndroidUpnpService) service;
if (upnpService.getRegistry() != null) {
// Refresh the list with all known devices
//listAdapter.clear();
for (Device device : upnpService.getRegistry().getDevices()) {
//registryListener.deviceAdded(device);
// Toast.makeText(_hgcontext.getApplicationContext(), device.getDisplayString(), 2000).show();
}
// Getting ready for future device advertisements
upnpService.getRegistry().addListener(registryListener);
}
if (upnpService.getControlPoint() != null) {
// Search asynchronously for all devices
upnpService.getControlPoint().search();
} else {
// Toast.makeText(_hgcontext.getApplicationContext(), "UPnP initialization error: Control Point is null!", 2000).show();
}
} catch (Exception e) {
// Toast.makeText(_hgcontext.getApplicationContext(), e.getMessage(), 2000).show();
}
}
开发者ID:genemars,项目名称:HomeGenie-Android,代码行数:29,代码来源:UpnpManager.java
示例16: deviceRemoved
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
public void deviceRemoved(final Device device) {
//runOnUiThread(new Runnable() {
// public void run() {
// Toast.makeText(getApplicationContext(), "UpNP: removed " + device.getDisplayString(), 2000).show();
//listAdapter.remove(new DeviceDisplay(device));
// }
//});
}
开发者ID:genemars,项目名称:HomeGenie-Android,代码行数:9,代码来源:UpnpManager.java
示例17: connect
import org.teleal.cling.model.meta.Device; //导入依赖的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
示例18: deviceAdded
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
/**
* Adds a new device to the list if its type equals mDeviceType.
*/
public void deviceAdded(final Device<?, ?, ?> device) {
for (int i = 0; i < getCount(); i++) {
if (getItem(i).equals(device)) {
return;
}
}
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (device.getType().getType().equals(mDeviceType)) {
add(device);
sort(new Comparator<Device<?, ?, ?>>() {
@Override
public int compare(Device<?, ?, ?> lhs,
Device<?, ?, ?> rhs) {
return lhs.getDetails().getFriendlyName()
.compareTo(rhs.getDetails().getFriendlyName());
}
});
}
}
});
}
开发者ID:Nutomic,项目名称:controldlna,代码行数:30,代码来源:DeviceArrayAdapter.java
示例19: deviceRemoved
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
/**
* Removes the device from the list (if it is an element).
*/
public void deviceRemoved(final Device<?, ?, ?> device) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (getPosition(device) != -1) {
remove(device);
}
}
});
}
开发者ID:Nutomic,项目名称:controldlna,代码行数:15,代码来源:DeviceArrayAdapter.java
示例20: onServiceConnected
import org.teleal.cling.model.meta.Device; //导入依赖的package包/类
/**
* Registers DeviceListener, adds known devices and starts search if requested.
*/
public void onServiceConnected(ComponentName className, IBinder service) {
mUpnpService = (AndroidUpnpService) service;
mUpnpService.getRegistry().addListener(RemotePlayService.this);
for (Device<?, ?, ?> d : mUpnpService.getControlPoint().getRegistry().getDevices()) {
if (d instanceof LocalDevice) {
localDeviceAdded(mUpnpService.getRegistry(), (LocalDevice) d);
}
else {
remoteDeviceAdded(mUpnpService.getRegistry(), (RemoteDevice) d);
}
}
mUpnpService.getControlPoint().search();
}
开发者ID:Nutomic,项目名称:controldlna,代码行数:17,代码来源:RemotePlayService.java
注:本文中的org.teleal.cling.model.meta.Device类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论