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;