- Added some hipadab array math
- Added missing cnvrt files, stolen from Markus - Debugged the new sinqhttpopt driver for SINQ HTTP HM - Debugged the driver for the new S7 Siemens SPS - Added handling of hexadecimal terminators to ascon.c - Increased the write buffer size in asynnet again - Fixed a core dump in lld.c - Added writing of second gen HM to nxscript.c - Added doubletime command to SICS - Fixed a core dump issue in sicshdbadapter.c on dimension changes - Modified sicsobj to look for lower case keys too SKIPPED: psi/cnvrt.c psi/cnvrt.h psi/el734hp.c psi/make_gen psi/sinqhttpopt.c psi/sinqhttpprot.c psi/spss7.c psi/swmotor.c
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "sicsobj.h"
|
||||
#include <macro.h>
|
||||
#include "commandlog.h"
|
||||
#include "arrayutil.h"
|
||||
|
||||
#define MAX_HDB_PATH 1024
|
||||
|
||||
@@ -451,13 +452,12 @@ int formatNameValue(Protocol protocol, char *name, char *value,
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int sendZippedNodeData(pHdb node, SConnection * pCon)
|
||||
static int sendZippedNodeData(pHdb node, hdbValue newValue, SConnection * pCon)
|
||||
{
|
||||
hdbValue newValue;
|
||||
int i, *iData = NULL;
|
||||
char *path = NULL;
|
||||
double sum = 0;
|
||||
|
||||
newValue = node->value;
|
||||
path = GetHipadabaPath(node);
|
||||
switch (newValue.dataType) {
|
||||
case HIPINTAR:
|
||||
@@ -474,10 +474,12 @@ static int sendZippedNodeData(pHdb node, SConnection * pCon)
|
||||
}
|
||||
memset(iData, 0, newValue.arrayLength * sizeof(int));
|
||||
for (i = 0; i < newValue.arrayLength; i++) {
|
||||
sum += (double)newValue.v.intArray[i];
|
||||
iData[i] = htonl(newValue.v.intArray[i]);
|
||||
}
|
||||
SCWriteZipped(pCon, path, iData, newValue.arrayLength * sizeof(int));
|
||||
free(iData);
|
||||
/* printf("Wrote zipped data %s, sum %lf\n", path, sum); */
|
||||
break;
|
||||
case HIPFLOATAR:
|
||||
case HIPFLOATVARAR:
|
||||
@@ -493,14 +495,16 @@ static int sendZippedNodeData(pHdb node, SConnection * pCon)
|
||||
}
|
||||
memset(iData, 0, newValue.arrayLength * sizeof(int));
|
||||
for (i = 0; i < newValue.arrayLength; i++) {
|
||||
sum+= newValue.v.floatArray[i];
|
||||
iData[i] = htonl((int) (newValue.v.floatArray[i] * 65536.));
|
||||
}
|
||||
SCWriteZipped(pCon, path, iData, newValue.arrayLength * sizeof(int));
|
||||
/* printf("Wrote zipped data %s, sum %lf\n", path, sum); */
|
||||
free(iData);
|
||||
break;
|
||||
default:
|
||||
SCWrite(pCon, "ERROR: zipped writing not supported for this datatype",
|
||||
eError);
|
||||
SCPrintf(pCon, eError, "ERROR: zipped writing not supported for this datatype on node %s",
|
||||
path);
|
||||
free(path);
|
||||
return 0;
|
||||
}
|
||||
@@ -597,7 +601,7 @@ static hdbCallbackReturn SICSNotifyCallback(pHdb node, void *userData,
|
||||
*/
|
||||
if (GetHdbProperty(node, "transfer", value, 80) == 1) {
|
||||
if (strstr(value, "zip") != NULL) {
|
||||
status = sendZippedNodeData(node, cbInfo->pCon);
|
||||
status = sendZippedNodeData(node, *(mm->v), cbInfo->pCon);
|
||||
free(pPath);
|
||||
DeleteDynString(result);
|
||||
return hdbContinue;
|
||||
@@ -2094,6 +2098,7 @@ int readHdbValue(hdbValue * v, char *data, char *error, int errlen)
|
||||
free(v->v.text);
|
||||
}
|
||||
v->v.text = strdup(data);
|
||||
v->arrayLength = strlen(data);
|
||||
break;
|
||||
case HIPINTVARAR:
|
||||
if (!adjustDataLength(v, data)) {
|
||||
@@ -2447,8 +2452,9 @@ static int ZipGetHdbNode(SConnection * pCon, SicsInterp * pSics,
|
||||
}
|
||||
memset(&newValue, 0, sizeof(hdbValue));
|
||||
GetHipadabaPar(targetNode, &newValue, pCon);
|
||||
status = sendZippedNodeData(targetNode, newValue, pCon);
|
||||
ReleaseHdbValue(&newValue);
|
||||
return sendZippedNodeData(targetNode, pCon);
|
||||
return status;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@@ -2934,8 +2940,10 @@ static int HdbArrayNode(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
pHdb node = NULL;
|
||||
pObjectDescriptor pDes = NULL;
|
||||
int length, idx, ival, i;
|
||||
int xstart, xend, xlength, ystart, yend, ylength;
|
||||
double dval;
|
||||
hdbValue v;
|
||||
long sum;
|
||||
|
||||
if (argc < 4) {
|
||||
SCWrite(pCon, "ERROR: need at least three arguments to harray", eError);
|
||||
@@ -2988,6 +2996,22 @@ static int HdbArrayNode(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(strcmp(argv[2],"sum") == 0){
|
||||
if(argc < 9){
|
||||
SCWrite(pCon,"ERROR: not enough arguments to harray sum", eError);
|
||||
return 0;
|
||||
}
|
||||
xstart = atoi(argv[3]);
|
||||
xend = atoi(argv[4]);
|
||||
xlength = atoi(argv[5]);
|
||||
ystart = atoi(argv[6]);
|
||||
yend = atoi(argv[7]);
|
||||
ylength = atoi(argv[8]);
|
||||
sum = sumWindow(node->value.v.intArray,xstart,xend,xlength,ystart,yend,ylength);
|
||||
SCPrintf(pCon,eValue,"sum = %ld", sum);
|
||||
return 1;
|
||||
}
|
||||
|
||||
idx = atoi(argv[2]);
|
||||
if(idx < 0 || idx >= node->value.arrayLength ){
|
||||
SCPrintf(pCon,eError,"ERROR: %d is out of range 0 - %d",
|
||||
|
||||
Reference in New Issue
Block a user