SerialConnect: handle cancelled file transfers.

The remote can cancel a file transfer by sending a CAN character.
Handle this by stopping the transfer and hiding the progress bar.
This commit is contained in:
Adrien Destugues 2017-07-16 16:11:47 +02:00
parent cd4d3a3010
commit ae2c5eeeab

View File

@ -19,6 +19,7 @@ static const char kSOH = 1;
static const char kEOT = 4;
static const char kACK = 6;
static const char kNAK = 21;
static const char kCAN = 24;
static const char kSUB = 26;
static const int kBlockSize = 128;
@ -91,6 +92,16 @@ XModemSender::BytesReceived(const uint8_t* data, size_t length)
}
break;
case kCAN:
{
BMessage msg(kMsgProgress);
msg.AddInt32("pos", 0);
msg.AddInt32("size", 0);
msg.AddString("info", "Remote cancelled transfer");
fListener.SendMessage(&msg);
return true;
}
default:
break;
}