本文整理汇总了Java中org.teleal.cling.model.meta.Device类的典型用法代码示例。如果您正苦于以下问题:Java Device类的具体用法?Java Device怎么用?Java Device使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Device类属于org.teleal.cling.model.meta包,在下文中一共展示了Device类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
}
}
示例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;
}
示例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());
}
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
}
示例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));
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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();
}
}