deviceType in desciption of subdevices missing
----------------------------------------------
Key: FELIX-2579
URL: https://issues.apache.org/jira/browse/FELIX-2579
Project: Felix
Issue Type: Bug
Reporter: Lars-Erik Kimmel
Priority: Minor
The desciption lacks of deviceType for subdevices.
It can be pinned down to BuildDevice, where only in the description of the root
device the deviceType with the highest supported version is added to the
document.
a simple workaround helps by introducing a method made of the code in the build
of the root device:
private static void setDeviceTypeWithHighestVersion(Device devUPnP,
ServiceReference sr) {
Object aux = sr.getProperty(UPnPDevice.TYPE);
if(aux==null){
devUPnP.setDeviceType(null);
}else if(aux instanceof String){
devUPnP.setDeviceType((String) aux);
}else if(aux instanceof String[]){
//The property key UPnP.device.type should be a String
String[] v = (String[]) aux;
int maxindex=0;
int
max=Integer.parseInt(v[0].substring(v[0].lastIndexOf(":")+1));
int tmp;
for (int i = 1; i < v.length; i++) {
tmp=Integer.parseInt(v[i].substring(v[i].lastIndexOf(":")+1));
if(max<tmp){
max=tmp;
maxindex=i;
}
}
devUPnP.setDeviceType(v[maxindex]);
}
}
And call
setDeviceTypeWithHighestVersion(devUPnP, sr);
in buildRootDeviceNode(..) and buildDevice(..)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.