{
lnk.linkStatus = cc;
lnk.linkStale = true;
return cc;
}
TBitfield bf = TBitfieldRegistry.getBitfield(tag);
if (bf == null)
{
cc = lnk.linkStatus = TErrorList.invalid_structure_tag;
lnk.linkStale = true;
return cc;
}
if (!bf.hasFields())
{
cc = lnk.linkStatus = TErrorList.invalid_field;
lnk.linkStale = true;
return cc;
}
boolean fieldKnown = false;
String[] parts;
String dev = lnk.devName;
String prp = lnk.devProperty;
String fld = null;
if (!fieldKnown)
{
parts = lnk.devProperty.split("\\.");
if (parts.length > 1 && bf.isField(parts[parts.length-1]))
{
prp = lnk.devProperty.substring(0, lnk.devProperty.lastIndexOf(parts[parts.length-1])-1);
fieldKnown = true;
fld = parts[parts.length-1];
}
}
if (!fieldKnown)
{
parts = lnk.devName.split("\\.");
if (parts.length > 1 && bf.isField(parts[parts.length-1]))
{
dev = lnk.devName.substring(0, lnk.devName.lastIndexOf(parts[parts.length-1])-1);
fieldKnown = true;
fld = parts[parts.length-1];
lnk.setCloseOnRelink(true);
}
else
{ // not a single field -> the entire tagged bitfield ?
if (TLinkFactory.debugLevel > 0)
DbgLog.log("mapSingleFieldToBitfield","mapped bitfield "+parts[parts.length-1]+" is not a field of "+tag);
return 0;
}
}
if (fieldKnown)
{
tf.addLinkToReLinkList(lnk, bf,fld);
lnk.devName = dev;
lnk.devProperty = prp;
}
else
{ // this should not happen if every thing goes well
cc = lnk.linkStatus = TErrorList.invalid_field;
// TODO: find a way of calling the callback with this status
return cc;
}
lnk.dOutput.dFormat = bf.getFormat();
lnk.dOutput.setBitField(new TBitfield[]{bf});
lnk.dOutput.setField(fld);
if (lnk.hasDependencies())
{ // just finished learning this, but I already have dependencies ?
for (TLink xl : lnk.dependencies)