UPnPAction[] actions = services[i].getActions();
for (int j = 0; j < actions.length; j++) {
boolean valid=true;
Action act = new Action(ser.getServiceNode());
act.setName(actions[j].getName());
ArgumentList al = new ArgumentList();
String[] names=actions[j].getInputArgumentNames();
if(names!=null){
for (int k = 0; k < names.length; k++) {
UPnPStateVariable variable = actions[j].getStateVariable(names[k]);
if(variable==null){
/*
* //TODO Create a stict and relaxed behavior of the base driver which
* export as much it can or export only 100% complaint UPnPDevice service
*/
Activator.logger.WARNING(
"UPnP Device that cotains serviceId="+id+" contains the action "
+actions[j].getName()+" with the Input argument "+names[k]
+" not related to any UPnPStateVariable. Thus this action won't be exported");
valid=false;
break;
}
Argument a = new Argument();
a.setDirection(Argument.IN);
a.setName(names[k]);
a.setRelatedStateVariableName(variable.getName());
al.add(a);
}
}
names=actions[j].getOutputArgumentNames();
if(names!=null && valid){
for (int k = 0; k < names.length; k++) {
UPnPStateVariable variable = actions[j].getStateVariable(names[k]);
if(variable==null){
/*
* //TODO Create a stict and relaxed behavior of the base driver which
* export as much it can or export only 100% complaint UPnPDevice service
*/
Activator.logger.WARNING(
"UPnP Device that cotains serviceId="+id+" contains the action "
+actions[j].getName()+" with the Output argument "+names[k]
+" not related to any UPnPStateVariable. Thus this action won't be exported");
}
Argument a = new Argument();
a.setDirection(Argument.OUT);
a.setName(names[k]);
a.setRelatedStateVariableName(variable.getName());
al.add(a);
}
}
if(valid) {
act.setArgumentList(al);
ser.addAction(act);