PSI update
r1464 | ffr | 2007-02-12 12:20:21 +1100 (Mon, 12 Feb 2007) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
634f2023b1
commit
3168325921
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user