- Removed napi from SICS
- Added error fields to hwardware objects: motor, counter, histmem - Optimised sinqhttpopt - Added haddcheck which adds checks to hipadaba nodes. The current implementation only checks for selctions agaisnt the values property. Expand when more checks are required.
This commit is contained in:
@ -173,10 +173,19 @@ static void writeDiaphragm2(NXhandle hfil, NXdict hdict,
|
||||
SNXSPutMotorNull(pServ->pSics, pCon, hfil, hdict, "dia2zplus0", "d2vu");
|
||||
SNXSPutMotor(pServ->pSics, pCon, hfil, hdict, "dia2z_minus", "d2vl");
|
||||
SNXSPutMotorNull(pServ->pSics, pCon, hfil, hdict, "dia2zminus0", "d2vl");
|
||||
SNXSPutMotor(pServ->pSics, pCon, hfil, hdict, "dia2z_x", "d2x");
|
||||
SNXSPutMotorNull(pServ->pSics, pCon, hfil, hdict, "dia2z_x0", "d2x");
|
||||
|
||||
SNXSPutVariable(pServ->pSics, pCon, hfil, hdict, "dia2dist",
|
||||
"dia1_dia2");
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
static void writeCollimator(NXhandle hfil, NXdict hdict,
|
||||
SConnection * pCon)
|
||||
{
|
||||
|
||||
SNXSPutMotor(pServ->pSics, pCon, hfil, hdict, "cov", "cov");
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
static void writeSample(NXhandle hfil, NXdict hdict, SConnection * pCon)
|
||||
@ -298,6 +307,8 @@ static void PoldiStart(pPolterdi self, SConnection * pCon)
|
||||
|
||||
writeDiaphragm2(hfil, hdict, pCon);
|
||||
|
||||
writeCollimator(hfil, hdict, pCon);
|
||||
|
||||
writeSample(hfil, hdict, pCon);
|
||||
|
||||
/*
|
||||
@ -426,6 +437,10 @@ static void PoldiStart(pPolterdi self, SConnection * pCon)
|
||||
NXDputalias(hfil, hdict, "cntime", &fVal);
|
||||
lVal = GetMonitor(pCount, 1, pCon);
|
||||
NXDputalias(hfil, hdict, "cnmon1", &lVal);
|
||||
lVal = GetMonitor(pCount, 2, pCon);
|
||||
NXDputalias(hfil, hdict, "cnmon3", &lVal);
|
||||
lVal = GetMonitor(pCount, 3, pCon);
|
||||
NXDputalias(hfil, hdict, "cnmon4", &lVal);
|
||||
eMode = GetCounterMode(pCount);
|
||||
if (eMode == eTimer) {
|
||||
strcpy(pBueffel, "timer");
|
||||
@ -545,10 +560,12 @@ static void PoldiUpdate(pPolterdi self, SConnection * pCon)
|
||||
NXDputalias(hfil, hdict, "cntime", &fVal);
|
||||
lVal = GetMonitor(pCount, 1, pCon);
|
||||
NXDputalias(hfil, hdict, "cnmon1", &lVal);
|
||||
lVal = GetMonitor(pCount, 0, pCon);
|
||||
lVal = GetMonitor(pCount, 4, pCon);
|
||||
NXDputalias(hfil, hdict, "cnprot", &lVal);
|
||||
lVal = GetMonitor(pCount, 2, pCon);
|
||||
NXDputalias(hfil, hdict, "cnmon2", &lVal);
|
||||
NXDputalias(hfil, hdict, "cnmon3", &lVal);
|
||||
lVal = GetMonitor(pCount, 3, pCon);
|
||||
NXDputalias(hfil, hdict, "cnmon4", &lVal);
|
||||
eMode = GetCounterMode(pCount);
|
||||
if (eMode == eTimer) {
|
||||
strcpy(pBueffel, "timer");
|
||||
|
@ -95,26 +95,52 @@ typedef struct {
|
||||
int headerReceived;
|
||||
} HttpProt, *pHttpProt;
|
||||
/*---------------------------------------------------------------------*/
|
||||
static int moreToReadThen(Ascon *a, int length)
|
||||
{
|
||||
pHttpProt pHttp = NULL;
|
||||
pHttp = (pHttpProt)a->private;
|
||||
|
||||
if(pHttp->headerReceived == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(pHttp->bytesExpected - GetDynStringLength(a->rdBuffer) > length){
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
static int HTTPcallback(int handle, void *userData)
|
||||
{
|
||||
Ascon *a = (Ascon *)userData;
|
||||
pHttpProt pHttp = NULL;
|
||||
unsigned char ch;
|
||||
int length;
|
||||
char *data;
|
||||
Ascon *a = (Ascon *)userData;
|
||||
pHttpProt pHttp = NULL;
|
||||
unsigned char ch;
|
||||
int length;
|
||||
char *data;
|
||||
int blockSize = 65536;
|
||||
|
||||
if(a == NULL){
|
||||
printf("really serious error in HTTPcallback\n");
|
||||
return 0;
|
||||
}
|
||||
pHttp = (pHttpProt)a->private;
|
||||
if(a == NULL){
|
||||
printf("really serious error in HTTPcallback\n");
|
||||
return 0;
|
||||
}
|
||||
pHttp = (pHttpProt)a->private;
|
||||
|
||||
data = (char *)ANETreadPtr(handle,&length);
|
||||
if(data != NULL){
|
||||
DynStringConcatBytes(a->rdBuffer,data,length);
|
||||
}
|
||||
ANETreadConsume(handle,length);
|
||||
return 1;
|
||||
data = (char *)ANETreadPtr(handle,&length);
|
||||
if(data != NULL){
|
||||
/*
|
||||
This code here should optimize away excessive calls
|
||||
to memcpy which I have seen in a sysprof test on
|
||||
SICS @ BOA
|
||||
*/
|
||||
if(moreToReadThen(a,blockSize) == 1 && length < blockSize){
|
||||
// skip
|
||||
} else {
|
||||
DynStringConcatBytes(a->rdBuffer,data,length);
|
||||
ANETreadConsume(handle,length);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
@ -329,6 +355,7 @@ static int processHeader(Ascon *a)
|
||||
} else {
|
||||
DynStringClear(a->rdBuffer);
|
||||
}
|
||||
DynStringCapacity(a->rdBuffer,pHttp->bytesExpected);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -242,9 +242,9 @@ static int TasSaveStatus(void *self, char *name, FILE * fd)
|
||||
pMot = FindMotor(pServ->pSics, tasMotorOrder[i]);
|
||||
if (pMot) {
|
||||
MotorGetPar(pMot, "hardupperlim", &value);
|
||||
fprintf(fd, "%s hardupperlim %f\n", tasMotorOrder[i], value);
|
||||
fprintf(fd, "catch {%s hardupperlim %f}\n", tasMotorOrder[i], value);
|
||||
MotorGetPar(pMot, "hardlowerlim", &value);
|
||||
fprintf(fd, "%s hardlowerlim %f\n", tasMotorOrder[i], value);
|
||||
fprintf(fd, "catch {%s hardlowerlim %f}\n", tasMotorOrder[i], value);
|
||||
/*
|
||||
DISABLED: reading all the motors made to much of a delay during
|
||||
normal operation of the instrument. This is mainly due to the
|
||||
|
Reference in New Issue
Block a user