public boolean getSendSingleDelivery() { return canSendSingleDelivery; }
private void getRequest(TClient tcaller, byte[] data)
{
Arrays.fill(requestBytes,(byte)0);
byte[] d = requestBytes;
TDataType din = null;
int offset = 0, datasize = 0;
int renewalMultiplier;
int cc = 0, nreqs = 0;
short bmode;
boolean isTrueMCast = false;
boolean isLegacy = false;
boolean sendSingleDelivery = false;
boolean chkResendData = false;
boolean resendCurrentData = false;
TClientEntry tce = null;
TClient tc = tcaller;
String astr = null;
if (srvCycleTime < rejectEarlierThan) return;
// peel off the header
TReqHdr hdr = new TReqHdr(data, 0, TReqHdr.hdrSizeInBytes);
tc.userName = hdr.getUserName();
int tineProtocol = hdr.getProtocol();
if (tineProtocol < 5)
{
SendMessageToCaller(tc, null, TErrorList.illegal_protocol,null);
}
tc.tineProtocol = (short)tineProtocol;
tc.revisionId = hdr.getRevisionId();
if (tineProtocol < 6) isLegacy = true;
int totalsize = hdr.getTotalSizeInBytes();
int hdrSize = isLegacy ? TSubscription.hdrSizeInBytesLegacy : TSubscription.hdrSizeInBytes;
int conSize = isLegacy ? TContractP5.hdrSizeInBytes : TContract.hdrSizeInBytes;
offset += TReqHdr.hdrSizeInBytes;
if (debugLevel > 3) DbgLog.log("getRequest",hdr.toString());
TContractTable tct = null;
long t_now = System.currentTimeMillis();
while (offset < totalsize)
{ // peel off the TSubscription
nreqs++; resendCurrentData = false;
TSubscription sub = new TSubscription(tineProtocol, data, offset, hdrSize);
tc = tcaller; // reset this in case of packed network requests
bmode = TMode.getBaseMode(sub.mode);
// Is the caller using alias names ?
if ((astr=getNameFromAlias(sub.contract.eqmDeviceName)) != null) sub.contract.eqmDeviceName = astr;
if ((astr=getNameFromAlias(sub.contract.eqmProperty)) != null) sub.contract.eqmProperty = astr;
offset += hdrSize + conSize + sub.contract.extStringSize;
if (debugLevel > 0 && sub.numblks == sub.blknum)
{
if (debugLevel > 2)
DbgLog.log("getRequest",sub.toString());
else
{
String msg = sub.contract.eqmName+" "+sub.contract.eqmDeviceName+" "+
sub.contract.eqmProperty+" "+sub.pollingInterval+" msec "+
"("+sub.numblks+" blks) "+TMode.toString(sub.mode);
DbgLog.log("getRequest", msg);
}
}
// prepare incoming data ...
if ((datasize = sub.getInputDataSize()) > 0)
{
din = getInputDataTypeRepository(tc, sub);
if (din.update(data, offset, datasize, sub.blknum, sub.blkid))
{
din.bytesin += datasize;
}
offset += datasize + (datasize % 2);
if (din.blksin < din.numblks)
{
if (debugLevel > 2)
DbgLog.log("getRequest","input data set "+din.blksin+" of "+din.numblks);
continue;
}
if (din.numblks > 1 && debugLevel > 1)
DbgLog.log("getRequest","long input data set ("+din.numblks+" blocks) complete");
// when finished ...
din.resetBuffersReady();
din.getData();
if (debugLevel > 3) DbgLog.log("getRequest","input data : \n" + din.toString());
}
// requested output data ...
if ((cc=fixOutputDataTypeAndSize(sub)) != 0)
{ // default format ?
SendMessageToCaller(tc, sub, cc, null);