use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class Device method getServiceList.
// //////////////////////////////////////////////
// serviceList
// //////////////////////////////////////////////
public ServiceList getServiceList() {
ServiceList serviceList = new ServiceList();
Node serviceListNode = getDeviceNode().getNode(ServiceList.ELEM_NAME);
if (serviceListNode == null)
return serviceList;
int nNode = serviceListNode.getNNodes();
for (int n = 0; n < nNode; n++) {
Node node = serviceListNode.getNode(n);
if (Service.isServiceNode(node) == false)
continue;
Service service = new Service(node);
serviceList.add(service);
}
return serviceList;
}
use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class Device method getParentDevice.
// //////////////////////////////////////////////
// Parent Device
// //////////////////////////////////////////////
// Thanks for Stefano Lenzi (07/24/04)
/**
* @return A Device that contain this object.<br>
* Return <code>null</code> if this is a root device.
*/
public Device getParentDevice() {
if (isRootDevice())
return null;
Node devNode = getDeviceNode();
Node aux = null;
// <device><deviceList><device>
aux = devNode.getParentNode().getParentNode();
return new Device(aux);
}
use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class Device method getRootDevice.
// //////////////////////////////////////////////
// Root Device
// //////////////////////////////////////////////
public Device getRootDevice() {
Node rootNode = getRootNode();
if (rootNode == null)
return null;
Node devNode = rootNode.getNode(Device.ELEM_NAME);
if (devNode == null)
return null;
return new Device(rootNode, devNode);
}
use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class Device method getIconList.
public IconList getIconList() {
IconList iconList = new IconList();
Node iconListNode = getDeviceNode().getNode(IconList.ELEM_NAME);
if (iconListNode == null)
return iconList;
int nNode = iconListNode.getNNodes();
for (int n = 0; n < nNode; n++) {
Node node = iconListNode.getNode(n);
if (Icon.isIconNode(node) == false)
continue;
Icon icon = new Icon(node);
if (icon.hasURL()) {
String iconURL = icon.getURL();
byte[] iconBytes = iconBytesMap.get(iconURL);
if (iconBytes != null) {
icon.setBytes(iconBytes);
}
}
iconList.add(icon);
}
return iconList;
}
use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class Device method updateConfigId.
private void updateConfigId(Device dev) {
int configId = 0;
DeviceList cdevList = dev.getDeviceList();
int cdevCnt = cdevList.size();
for (int n = 0; n < cdevCnt; n++) {
Device cdev = cdevList.getDevice(n);
updateConfigId(cdev);
configId += cdev.getConfigId();
configId &= UPnP.CONFIGID_UPNP_ORG_MAX;
}
ServiceList serviceList = dev.getServiceList();
int serviceCnt = serviceList.size();
for (int n = 0; n < serviceCnt; n++) {
Service service = serviceList.getService(n);
service.updateConfigId();
configId += service.getConfigId();
configId &= UPnP.CONFIGID_UPNP_ORG_MAX;
}
Node devNode = getDeviceNode();
if (devNode == null)
return;
String devDescXml = devNode.toString();
configId += UPnP.caluculateConfigId(devDescXml);
configId &= UPnP.CONFIGID_UPNP_ORG_MAX;
devNode.setAttribute(CONFIG_ID, configId);
}
Aggregations