Test
This commit is contained in:
12
XModem.cpp
12
XModem.cpp
@@ -21,7 +21,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "XModem.h"
|
||||
#include "TimeoutSerial.h"
|
||||
|
||||
#ifdef UTEST
|
||||
#include "CppUTestExt/MockSupport.h"
|
||||
#endif
|
||||
@@ -32,7 +32,7 @@ const unsigned char XModem::SOH = 1;
|
||||
const unsigned char XModem::EOT = 4;
|
||||
const unsigned char XModem::CAN = 0x18;
|
||||
|
||||
const int XModem::receiveDelay=7000;
|
||||
const int XModem::receiveDelay=7;
|
||||
const int XModem::rcvRetryLimit = 10;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ bool XModem::dataAvail(int delay)
|
||||
{
|
||||
if (this->byte != -1)
|
||||
return true;
|
||||
if ((this->byte = this->recvChar(delay)) != -1)
|
||||
if ((this->byte = this->serial->readChar(delay)) != -1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -68,11 +68,11 @@ int XModem::dataRead(int delay)
|
||||
this->byte = -1;
|
||||
return b;
|
||||
}
|
||||
return this->recvChar(delay);
|
||||
return this->serial->readChar(delay);
|
||||
}
|
||||
void XModem::dataWrite(char symbol)
|
||||
{
|
||||
this->sendData(&symbol, 1);
|
||||
this->serial->write(&symbol, 1);
|
||||
}
|
||||
bool XModem::receiveFrameNo()
|
||||
{
|
||||
@@ -148,7 +148,7 @@ bool XModem::receiveFrames(transfer_t transfer)
|
||||
this->blockNoExt = 1;
|
||||
this->retries = 0;
|
||||
while (1) {
|
||||
char cmd = this->dataRead(1000);
|
||||
char cmd = this->dataRead(10);
|
||||
switch(cmd){
|
||||
case XModem::SOH:
|
||||
if (!this->receiveFrameNo()) {
|
||||
|
||||
Reference in New Issue
Block a user