当前位置: 首页>>代码示例>>Java>>正文


Java Device类代码示例

本文整理汇总了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;
}
 
开发者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


注:本文中的org.teleal.cling.model.meta.Device类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。