From ec8a3a7bc482818fae7b852fac0e85cde4971d17 Mon Sep 17 00:00:00 2001 From: koennecke Date: Mon, 16 Sep 2013 09:27:51 +0000 Subject: [PATCH] - Fixed documentation typos - In support of HMsec, allow the count command in countsec to run without a preset parameter. If this is missing the old, stored preset is used. - Removed a check which causes initialisation of the HM from a batch file fail for POLDI - fixed @nl@ encoding of \n problem with certain kinds of batch files generated by GTSE - Fixed a bug with summing on hitsmemsec. nxdataset now uses 64 bit int for dimensions. - Fixed motorsec to remove itself properly from a parent when linked. Please note that there is still the limitation that a second generation motor can only be linked once in a Hipadaba tree - Extended subsampling a HM for second generation HM - Added a hscriptnotify. This calls a script on the update of a node - POLDI has been rebuilt, chnages to data file writing - For testing, sinqhttopt now understands a special command, byteswapoff, which switches off byte swapping. Required when the HM ius run on an Intel box. --- polterwrite.c | 14 ++++++++++++++ sinqhttpopt.c | 31 +++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/polterwrite.c b/polterwrite.c index 87f4334..0c79db5 100644 --- a/polterwrite.c +++ b/polterwrite.c @@ -183,8 +183,13 @@ static void writeDiaphragm2(NXhandle hfil, NXdict hdict, static void writeCollimator(NXhandle hfil, NXdict hdict, SConnection * pCon) { + char pBueffel[50]; SNXSPutMotor(pServ->pSics, pCon, hfil, hdict, "cov", "cov"); + memset(pBueffel,0,sizeof(pBueffel)); + Tcl_Eval(InterpGetTcl(pServ->pSics),"coll"); + strncpy(pBueffel,Tcl_GetStringResult(InterpGetTcl(pServ->pSics)), 49); + NXDputalias(hfil, hdict, "collpos", pBueffel); } /*--------------------------------------------------------------------*/ @@ -231,6 +236,15 @@ static void writeSample(NXhandle hfil, NXdict hdict, SConnection * pCon) SNXSPutMotorNull(pServ->pSics, pCon, hfil, hdict, "ssv0", "sv"); SNXSPutMotor(pServ->pSics, pCon, hfil, hdict, "ssa", "sa"); SNXSPutMotorNull(pServ->pSics, pCon, hfil, hdict, "ssa0", "sa"); + + pCom = FindCommand(pServ->pSics,"chi"); + if(pCom != NULL){ + SNXSPutMotor(pServ->pSics, pCon, hfil, hdict, "schi", "chi"); + SNXSPutMotorNull(pServ->pSics, pCon, hfil, hdict, "schi0", "chi"); + SNXSPutMotor(pServ->pSics, pCon, hfil, hdict, "sphi", "phi"); + SNXSPutMotorNull(pServ->pSics, pCon, hfil, hdict, "sphi0", "phi"); + } + } /*--------------------------------------------------------------------*/ diff --git a/sinqhttpopt.c b/sinqhttpopt.c index 4eaee31..f5acd60 100644 --- a/sinqhttpopt.c +++ b/sinqhttpopt.c @@ -93,6 +93,7 @@ typedef struct { int bytesExpected; char *contentType; int headerReceived; + int byteSwap; } HttpProt, *pHttpProt; /*---------------------------------------------------------------------*/ static int moreToReadThen(Ascon *a, int length) @@ -254,9 +255,15 @@ static void handleReply(Ascon * a) if(pHttp->node == NULL){ clearSICSData(pHttp->binData); dataPtr = getSICSDataPointer(pHttp->binData, 0, len); - for (i = 0; i < len; i++) { - dataPtr[i] = ntohl(hmData[i]); - } + if(pHttp->byteSwap == 1){ + for (i = 0; i < len; i++) { + dataPtr[i] = ntohl(hmData[i]); + } + } else { + for (i = 0; i < len; i++) { + dataPtr[i] = hmData[i]; + } + } assignSICSType(pHttp->binData, 0, len, INTTYPE); DynStringClear(a->rdBuffer); DynStringCopy(a->rdBuffer, "SICSDATA"); @@ -275,9 +282,15 @@ static void handleReply(Ascon * a) } pHttp->node->value.arrayLength = len; } - for(i = 0; i < len; i++){ - pHttp->node->value.v.intArray[i] = ntohl(hmData[i]); - } + if(pHttp->byteSwap == 1){ + for(i = 0; i < len; i++){ + pHttp->node->value.v.intArray[i] = ntohl(hmData[i]); + } + } else { + for(i = 0; i < len; i++){ + pHttp->node->value.v.intArray[i] = hmData[i]; + } + } NotifyHipadabaPar(pHttp->node,NULL); DynStringClear(a->rdBuffer); DynStringCopy(a->rdBuffer, "NODEDATA"); @@ -377,6 +390,11 @@ static int HttpHandler(Ascon * a) a->state = AsconConnectDone; /* success */ break; case AsconWriteStart: + if(strcmp(GetCharArray(a->wrBuffer),"byteswapoff") == 0) { + pHttp->byteSwap = 0; + a->state = AsconReadDone; + return 0; + } if(!ANETvalidHandle(pHttp->sockHandle)){ hostport = strdup(a->hostport); colon = strchr(hostport, ':'); @@ -520,6 +538,7 @@ static int HttpProtInit(Ascon * a, SConnection * con, } pHttp->sockHandle = -10; pHttp->contentType = strdup("text/html"); + pHttp->byteSwap = 1; a->private = pHttp; a->killPrivate = killHttp; a->state = AsconConnectStart;