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


Java RemoteDevice类代码示例

本文整理汇总了Java中org.fourthline.cling.model.meta.RemoteDevice的典型用法代码示例。如果您正苦于以下问题:Java RemoteDevice类的具体用法?Java RemoteDevice怎么用?Java RemoteDevice使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RemoteDevice类属于org.fourthline.cling.model.meta包,在下文中一共展示了RemoteDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: remoteDeviceRemoved

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
@Override
public void remoteDeviceRemoved(Registry registry, RemoteDevice device) {
	System.out.println("{UPNP Discovery}:Registry: Remote device removed: "+ device.getDisplayString());
	
	//posting event
	HashMap<String, String> properties = new HashMap<String, String>();
	properties.put("UpnpEvent", "Device_Removed");
	properties.put("UDN", ""+device.getIdentity().getUdn().getIdentifierString());
	properties.put("Name", ""+device.getDisplayString());
	properties.put("Type", ""+device.getType().getType());
	Activator.event = new Event("symphony/event", properties);
	//System.out.println("Posting event");
	Activator.admin.postEvent(Activator.event);	
	
	//removing device from list
	deviceArrayList.remove(device);	
}
 
开发者ID:SyMPHOnY-,项目名称:Smart-Home-Gateway,代码行数:18,代码来源:UpnpServiceHandler.java

示例2: generateIconList

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
protected void generateIconList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) {
    if (!deviceModel.hasIcons()) return;

    Element iconListElement = appendNewElement(descriptor, deviceElement, ELEMENT.iconList);

    for (Icon icon : deviceModel.getIcons()) {
        Element iconElement = appendNewElement(descriptor, iconListElement, ELEMENT.icon);

        appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.mimetype, icon.getMimeType());
        appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.width, icon.getWidth());
        appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.height, icon.getHeight());
        appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.depth, icon.getDepth());
        if (deviceModel instanceof RemoteDevice) {
        	appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.url,  icon.getUri());
        } else if (deviceModel instanceof LocalDevice) {
        	appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.url,  namespace.getIconPath(icon));
        }
    }
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:20,代码来源:UDA10DeviceDescriptorBinderImpl.java

示例3: notifyDiscoveryStart

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
synchronized public boolean notifyDiscoveryStart(final RemoteDevice device) {
    // Exit if we have it already, this is atomic inside this method, finally
    if (getUpnpService().getRegistry().getRemoteDevice(device.getIdentity().getUdn(), true) != null) {
        log.finer("Not notifying listeners, already registered: " + device);
        return false;
    }
    for (final RegistryListener listener : getListeners()) {
        getConfiguration().getRegistryListenerExecutor().execute(
                new Runnable() {
                    public void run() {
                        listener.remoteDeviceDiscoveryStarted(RegistryImpl.this, device);
                    }
                }
        );
    }
    return true;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:18,代码来源:RegistryImpl.java

示例4: remoteDeviceDiscoveryFailed

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
@Override
public void remoteDeviceDiscoveryFailed(Registry registry, final RemoteDevice device,
        final Exception ex) {
    runOnUiThread(new Runnable() {
        public void run() {
            Toast.makeText(
                    BrowserActivity.this,
                    "Discovery failed of '"
                            + device.getDisplayString()
                            + "': "
                            + (ex != null ? ex.toString()
                                    : "Couldn't retrieve device/service descriptors"),
                    Toast.LENGTH_LONG).show();
        }
    });
    deviceRemoved(device);
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:18,代码来源:BrowserActivity.java

示例5: remoteDeviceAdded

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
@Override
public void remoteDeviceAdded(Registry registry, RemoteDevice device) {
	Log.e("DeviceListRegistryListener",
			"remoteDeviceAdded:" + device.toString()
					+ device.getType().getType());

	if (device.getType().getNamespace().equals("schemas-upnp-org")
			&& device.getType().getType().equals("MediaServer")) {
		final DeviceItem display = new DeviceItem(device, device
				.getDetails().getFriendlyName(),
				device.getDisplayString(), "(REMOTE) "
						+ device.getType().getDisplayString());
		deviceAdded(display);
	}

	if (device.getType().getNamespace().equals("schemas-upnp-org")
			&& device.getType().getType().equals("MediaRenderer")) {
		final DeviceItem dmrDisplay = new DeviceItem(device, device
				.getDetails().getFriendlyName(),
				device.getDisplayString(), "(REMOTE) "
						+ device.getType().getDisplayString());
		dmrAdded(dmrDisplay);
	}
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:25,代码来源:DevicesActivity.java

示例6: deviceRemoved

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
private void deviceRemoved(Device device) {
	if(device.getType().getType().equals("MediaRenderer") && device instanceof RemoteDevice) {
		final String id = device.getIdentity().getUdn().toString();
		removing.add(id);

		// Delay removal for a few seconds to make sure that it isn't just a temp disconnect
		dlnaService.getControlPoint().search();
		downloadService.postDelayed(new Runnable() {
			@Override
			public void run() {
				if(removing.contains(id)) {
					devices.remove(id);
					removing.remove(id);
					broadcastDescriptors();
				}
			}
		}, 5000L);
	}
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:20,代码来源:DLNARouteProvider.java

示例7: handleNetworkSourceSelected

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
public void handleNetworkSourceSelected(NetworkSourceItem item) {
	if(item.getNetworkObject() != null && item.getNetworkObject() instanceof DeviceDisplay) {
		DeviceDisplay dd = (DeviceDisplay) item.getNetworkObject();
		Device unspecDevice = dd.getDevice();
		if(unspecDevice instanceof RemoteDevice) {
			RemoteDevice currentDevice = (RemoteDevice) unspecDevice; 
			for (RemoteService service : currentDevice.getServices()) {
                if (service.getServiceType().getType().equals("ContentDirectory")) {
                	currentService = service;	
                	//dlnaContentListingBuilder.clearContainerIdStack();
                	PathStack.clearContainerIdStack();
                	dlnaContentListingBuilder.buildFolderListing(null);
                }
            }
		}
	}
}
 
开发者ID:eriklupander,项目名称:microgramcaster,代码行数:18,代码来源:UPnPHandler.java

示例8: getView

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
        convertView = inflator.inflate(R.layout.browse_item, parent, false);

        holder = new ViewHolder();
        holder.icon = (ImageView) convertView.findViewById(R.id.browseItemIcon);
        holder.name = (TextView) convertView.findViewById(R.id.browseItemName);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    Device device = (Device) getItem(position);
    holder.icon.setImageResource(R.drawable.device);
    if (device instanceof RemoteDevice && device.hasIcons()) {
        Icon[] icons = device.getIcons();
        for (int i = 0; i < icons.length; i++) {
            if (48 == icons[i].getHeight() && 48 == icons[i].getWidth() && "image/png".equals(icons[i].getMimeType().toString())) {
                URL iconUri = ((RemoteDevice) device).normalizeURI(icons[i].getUri());
                if (iconUri != null) {
                    Log.d(getClass().getName(), "Device icon uri:" + iconUri);
                    new IconDownloadTask((ListView) parent, position).execute(Uri.parse(iconUri.toString()));
                    break;

                }
            }
        }
    } else if (device instanceof LocalDevice) {
        //We know our icon
        holder.icon.setImageResource(R.drawable.yaacc48_24_png);
    }

    holder.name.setText(device.getDetails().getFriendlyName());

    return convertView;
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:40,代码来源:BrowseDeviceAdapter.java

示例9: getSonosControllerHosts

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
public List<String> getSonosControllerHosts() {
    List<String> result = new ArrayList<String>();
    for (Device device : upnpService.getRegistry().getDevices(new DeviceType("schemas-upnp-org", "ZonePlayer"))) {
        if (device instanceof RemoteDevice) {
            URL descriptorURL = ((RemoteDevice) device).getIdentity().getDescriptorURL();
            if (descriptorURL != null) {
                result.add(descriptorURL.getHost());
            }
        }
    }
    return result;
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:13,代码来源:UPnPService.java

示例10: remoteDeviceAdded

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
@Override
public void remoteDeviceAdded(Registry registry, RemoteDevice device) {
	System.out.println("{UPNP Discovery}:Registry: Remote device added "+ device.getDisplayString() +
			" UDN: " + device.getIdentity().getUdn());
	
		

	
	boolean duplicity=false;
	for (int i=0; i<deviceArrayList.size(); i++){
		Device d=deviceArrayList.get(i);
									
		if (device.getIdentity().getUdn().equals(d.getIdentity().getUdn())==true) duplicity=true;
	}
	
	// posting event if not duplicate device
	if (duplicity==false){
		HashMap<String, String> properties = new HashMap<String, String>();
		properties.put("UpnpEvent", "Device_Added");
		properties.put("UDN", ""+device.getIdentity().getUdn().getIdentifierString());
		properties.put("Name", ""+device.getDisplayString());
		properties.put("Type", ""+device.getType().getType());
		Activator.event = new Event("symphony/event", properties);
		//System.out.println("Posting event");
		Activator.admin.postEvent(Activator.event);	
		
		//adding device
		deviceArrayList.add(device);		
	}
	else {
		System.out.println("{UPNP Discovery}:Registry: Ignoring duplicate Device_Added event from " + device.getDisplayString());
	}
	

}
 
开发者ID:SyMPHOnY-,项目名称:Smart-Home-Gateway,代码行数:36,代码来源:UpnpServiceHandler.java

示例11: remoteDeviceAdded

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
public void remoteDeviceAdded(Registry registry, RemoteDevice device)
{
  if (device.getDetails().getModelDetails().getModelName().contains("hue bridge"))
  {
    devices.add(new Device(device.getDetails().getBaseURL().toString(),
        device.getDetails().getFriendlyName()));
  }
}
 
开发者ID:thht,项目名称:ambilike,代码行数:9,代码来源:HueDiscover.java

示例12: remoteDeviceAdded

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
@Override
public void remoteDeviceAdded(Registry registry, RemoteDevice device) {
    super.remoteDeviceAdded(registry, device);

    for(IHeartRateDataServiceSenderConnectionListener listener : mICSUpnpServiceConnectionListenerList) {
        listener.onDeviceAdded();
    }
}
 
开发者ID:mklschreiber,项目名称:Crowdi,代码行数:9,代码来源:HeartRateDataServiceSenderConnection.java

示例13: remoteDeviceAdded

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
@Override
public void remoteDeviceAdded(Registry registry, RemoteDevice device) {
    super.remoteDeviceAdded(registry, device);

    for(IWearNotificationServiceSenderConnectionListener listener : mICSUpnpServiceConnectionListenerList) {
        listener.onDeviceAdded();
    }
}
 
开发者ID:mklschreiber,项目名称:Crowdi,代码行数:9,代码来源:WearNotificationServiceSenderConnection.java

示例14: maintain

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
void maintain() {

        if (getDeviceItems().isEmpty()) return;

        // Remove expired remote devices
        Map<UDN, RemoteDevice> expiredRemoteDevices = new HashMap();
        for (RegistryItem<UDN, RemoteDevice> remoteItem : getDeviceItems()) {
            if (log.isLoggable(Level.FINEST))
                log.finest("Device '" + remoteItem.getItem() + "' expires in seconds: "
                                   + remoteItem.getExpirationDetails().getSecondsUntilExpiration());
            if (remoteItem.getExpirationDetails().hasExpired(false)) {
                expiredRemoteDevices.put(remoteItem.getKey(), remoteItem.getItem());
            }
        }
        for (RemoteDevice remoteDevice : expiredRemoteDevices.values()) {
            if (log.isLoggable(Level.FINE))
                log.fine("Removing expired: " + remoteDevice);
            remove(remoteDevice);
        }

        // Renew outgoing subscriptions
        Set<RemoteGENASubscription> expiredOutgoingSubscriptions = new HashSet();
        for (RegistryItem<String, RemoteGENASubscription> item : getSubscriptionItems()) {
            if (item.getExpirationDetails().hasExpired(true)) {
                expiredOutgoingSubscriptions.add(item.getItem());
            }
        }
        for (RemoteGENASubscription subscription : expiredOutgoingSubscriptions) {
            if (log.isLoggable(Level.FINEST))
                log.fine("Renewing outgoing subscription: " + subscription);
            renewOutgoingSubscription(subscription);
        }
    }
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:34,代码来源:RemoteItems.java

示例15: resume

import org.fourthline.cling.model.meta.RemoteDevice; //导入依赖的package包/类
public void resume() {
    log.fine("Updating remote device expiration timestamps on resume");
    List<RemoteDeviceIdentity> toUpdate = new ArrayList<RemoteDeviceIdentity>();
    for (RegistryItem<UDN, RemoteDevice> remoteItem : getDeviceItems()) {
        toUpdate.add(remoteItem.getItem().getIdentity());
    }
    for (RemoteDeviceIdentity identity : toUpdate) {
        update(identity);
    }
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:11,代码来源:RemoteItems.java


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