}
private static String[] getDeviceProperties16(String context,String server,String device,String property,int timeout) throws IOException
{
String tgt = getNamesQueryTarget(context,server,device);
if (tgt == null) return null;
TLink tl;
TDataType dout;
TDataType din;
int cc = 0,n,i,j;
NAME32[] properties;
String[] strprops;
n = getNumberOf("PROPS",tgt);
if (n <= 0) return null;
if (n*32 > maxQueryBufferSize) n = maxQueryBufferSize/32;
properties = new NAME32[n];
for (i=0; i<n; i++) properties[i] = new NAME32();
if (properties.length <= 0) return null;
dout = new TDataType(properties);
if (property != null) din = new TDataType(property); else din = null;
properties_have_query_function = false;
try
{
tl = new TLink(tgt,"PROPS",dout,din,TAccess.CA_READ);
cc = tl.execute(TLink.defaultTimeout,true);
tl.close();
if ((cc & TErrorList.CE_SENDDATA) == TErrorList.CE_SENDDATA)
{
if ((cc & TErrorList.has_query_function) == TErrorList.has_query_function)
{
properties_have_query_function = true;
}
cc = 0;
}
}
catch (Exception e)
{
MsgLog.log("getDeviceProperties16", e.getMessage(),TErrorList.non_existent_elem,e,0);
cc = TErrorList.host_not_resolved;
}
if (cc == 0)
{
for (i=0,n=0; i<properties.length; i++) if (properties[i].name.length() > 0) n++;
strprops = new String[n];
for (i=0,j=0; j<n && i<properties.length; i++)
{
if (properties[i].name.length() == 0) continue;
strprops[j++] = properties[i].name;
}
return strprops;
}
else if (cc != TErrorList.link_not_open)
{
if (lastQueriedContext == context && lastQueriedServer == server &&
lastQueriedDevice == device && lastQueriedServer != null)
{
cc = 0;
}
else
{
hLegacyByteBlob = new byte[n * PropertyQuery.sizeInBytes];
dout = new TDataType(hLegacyByteBlob,"");
tl = new TLink(tgt,"PROPS",dout,din,TAccess.CA_READ);
cc = tl.execute(TLink.defaultTimeout,false);
tl.close();
}
if (cc == 0)
{
lastQueriedContext = context;
lastQueriedServer = server;