From ae2c5eeeab5f445bdef20042cdf3cc8d1312a748 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 16 Jul 2017 16:11:47 +0200 Subject: [PATCH] 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. --- src/apps/serialconnect/XModem.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/apps/serialconnect/XModem.cpp b/src/apps/serialconnect/XModem.cpp index 22a4a90ea4..4184c68792 100644 --- a/src/apps/serialconnect/XModem.cpp +++ b/src/apps/serialconnect/XModem.cpp @@ -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; }