Commit 058d8c78 authored by koennecke's avatar koennecke
Browse files

First working version of a protocol for the FastCOM MPA device

parent 5e7078ca
......@@ -56,25 +56,21 @@ static int MPAProtHandler(Ascon *a)
mpa->mode = ECHO;
a->lineCount = 1;
a->wrPos = 5; /* skip over the echo: */
a->state = AsconWriting;
return 1;
}
if(strstr(writeData,"q:mpa") != NULL){
mpa->mode = QMPA;
a->lineCount = 8;
a->wrPos = 0;
DynStringCopy(a->wrBuffer,"MPA?\r\n");
a->state = AsconWriting;
return 1;
}
if(strstr(writeData,"q:getdata") != NULL){
mpa->mode = SNDFILE;
a->wrPos = 0;
a->lineCount = 1;
DynStringCopy(a->wrBuffer,"sendfile sics.mpa\r\n");
a->state = AsconWriting;
return 1;
}
a->state = AsconWriting;
return 1;
break;
case AsconReading:
if(mpa->mode != SNDFILE){
......@@ -93,8 +89,12 @@ static int MPAProtHandler(Ascon *a)
a->lineCount = atoi(readData);
mpa->mode = QMPA;
}
DynStringClear(a->rdBuffer);
a->state = AsconReading; /* read more lines */
}
if(a->state == AsconTimeout){
DynStringCopy(a->rdBuffer,"AscErr: Timeout");
}
return ret;
}
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment