PSI update

r1464 | ffr | 2007-02-12 12:20:21 +1100 (Mon, 12 Feb 2007) | 2 lines
This commit is contained in:
Ferdi Franceschini
2007-02-12 12:20:21 +11:00
committed by Douglas Clowes
parent 634f2023b1
commit 3168325921
157 changed files with 29053 additions and 910 deletions

View File

@@ -434,6 +434,42 @@ void getRS232Error(int iCode, char *errorBuffer,
}
}
/*--------------------------------------------------------------------*/
int fixRS232Error(prs232 self, int iCode){
int i, status, read;
char buffer[8192];
switch(iCode){
case BADMEMORY:
case FAILEDCONNECT:
return 0;
break;
case INCOMPLETE:
case TIMEOUT:
/*
* try to clear possibly pending stuff
*/
for(i = 0; i < 3; i++){
if(availableRS232(self)){
read = 8192;
readRS232(self,buffer,&read);
}
}
return 1;
break;
case NOTCONNECTED:
case BADSEND:
closeRS232(self);
status = initRS232(self);
if(status){
return 1;
} else {
return 0;
}
break;
}
return 0;
}
/*--------------------------------------------------------------------*/
int getRS232Timeout(prs232 self){
return self->timeout;
}