- 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
This commit is contained in:
27
spss7.c
27
spss7.c
@ -125,7 +125,7 @@ static int decodeString(char *pPtr, char *string, int maxlen)
|
||||
fullength = maxlen;
|
||||
used = maxlen;
|
||||
}
|
||||
memset(string,0,fullength);
|
||||
memset(string,0,fullength+1);
|
||||
memcpy(string, pPtr+2, used);
|
||||
return fullength + 2;
|
||||
}
|
||||
@ -164,11 +164,11 @@ static char *S7WriteHandler(void *actionData, char *reply, int comerror)
|
||||
static void UpdateSPSDataBase(pS7Action self)
|
||||
{
|
||||
char *pPtr;
|
||||
char name[14], unit[8], description[24], reference[10], error[50];
|
||||
char name[15], unit[9], description[25], reference[11], error[50];
|
||||
unsigned char type, alarm;
|
||||
short val;
|
||||
unsigned short val;
|
||||
int ival;
|
||||
unsigned char bval;
|
||||
unsigned char bval, b2;
|
||||
float fval;
|
||||
pHdb node = NULL;
|
||||
hdbValue hdbVal;
|
||||
@ -183,10 +183,18 @@ static void UpdateSPSDataBase(pS7Action self)
|
||||
pPtr += decodeString(pPtr, description,24);
|
||||
pPtr += decodeString(pPtr, reference,10);
|
||||
node = GetHipadabaNode(self->spsNode,name);
|
||||
if(node == NULL){
|
||||
printf("Something very fishy is happening here: did Roman change the SPS layout under our feet?\n");
|
||||
continue;
|
||||
}
|
||||
switch (type) {
|
||||
case 1:
|
||||
case 4:
|
||||
memcpy(&bval,pPtr+1,1);
|
||||
memcpy(&bval,pPtr,1);
|
||||
/*
|
||||
memcpy(&b2,pPtr+1,1);
|
||||
printf("Bytes: %d %d\n", bval, b2);
|
||||
*/
|
||||
hdbVal = MakeHdbInt(bval);
|
||||
UpdateHipadabaPar(node,hdbVal,NULL);
|
||||
pPtr += 2;
|
||||
@ -300,7 +308,7 @@ static hdbCallbackReturn S7WriteCallback(pHdb currentNode,
|
||||
static void InitializeSPSDataBase(pS7Action self, pHdb parent)
|
||||
{
|
||||
char *pPtr;
|
||||
char name[14], unit[8], description[24], reference[10], num[10], error[50];
|
||||
char name[15], unit[9], description[25], reference[11], num[11], error[50];
|
||||
unsigned char type, alarm;
|
||||
short val;
|
||||
int ival;
|
||||
@ -371,6 +379,7 @@ static char *S7InitHandler(void *actionData, char *reply, int comerror)
|
||||
{
|
||||
pS7Action self = (pS7Action)actionData;
|
||||
short dblength;
|
||||
pHdb node = NULL;
|
||||
|
||||
/*
|
||||
* Start: read length of the database
|
||||
@ -393,6 +402,12 @@ static char *S7InitHandler(void *actionData, char *reply, int comerror)
|
||||
memcpy(&dblength, self->replyData+16,2);
|
||||
dblength = ntohs(dblength);
|
||||
InitializeSPSDataBase(self,self->spsNode);
|
||||
node = GetHipadabaNode(self->spsNode,"init");
|
||||
/*
|
||||
if(node != NULL){
|
||||
UpdateHipadabaPar(node,MakeHdbInt(1), NULL);
|
||||
}
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user