mirror of https://github.com/FOME-Tech/openblt.git
Refs #130. More graceful handling of the Cancel-button pressed event in Microboot.
git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@191 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
parent
2887a83258
commit
5168861331
|
@ -325,6 +325,10 @@ begin
|
|||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
@ -354,6 +358,17 @@ begin
|
|||
|
||||
for regionCnt := 0 to datafile.GetRegionCnt-1 do
|
||||
begin
|
||||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// obtain the region info
|
||||
datafile.GetRegionInfo(regionCnt, addr, len);
|
||||
|
||||
|
@ -386,6 +401,17 @@ begin
|
|||
bufferOffset := 0;
|
||||
while len > 0 do
|
||||
begin
|
||||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// set the current write length taking into account kMaxProgLen
|
||||
currentWriteCnt := len mod kMaxProgLen;
|
||||
if currentWriteCnt = 0 then currentWriteCnt := kMaxProgLen;
|
||||
|
@ -437,7 +463,6 @@ begin
|
|||
MbiCallbackOnProgress(progress);
|
||||
MbiCallbackOnLog('File successfully downloaded t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnDone;
|
||||
|
||||
end; //*** end of OnTimeout ***
|
||||
|
||||
|
||||
|
@ -515,10 +540,6 @@ procedure MbiStop; stdcall;
|
|||
begin
|
||||
// set stop request
|
||||
stopRequest := true;
|
||||
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
end; //*** end of MbiStop ***
|
||||
|
||||
|
||||
|
|
|
@ -326,6 +326,10 @@ begin
|
|||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
@ -355,6 +359,17 @@ begin
|
|||
|
||||
for regionCnt := 0 to datafile.GetRegionCnt-1 do
|
||||
begin
|
||||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// obtain the region info
|
||||
datafile.GetRegionInfo(regionCnt, addr, len);
|
||||
|
||||
|
@ -387,6 +402,17 @@ begin
|
|||
bufferOffset := 0;
|
||||
while len > 0 do
|
||||
begin
|
||||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// set the current write length taking into account kMaxProgLen
|
||||
currentWriteCnt := len mod kMaxProgLen;
|
||||
if currentWriteCnt = 0 then currentWriteCnt := kMaxProgLen;
|
||||
|
@ -438,7 +464,6 @@ begin
|
|||
MbiCallbackOnProgress(progress);
|
||||
MbiCallbackOnLog('File successfully downloaded t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnDone;
|
||||
|
||||
end; //*** end of OnTimeout ***
|
||||
|
||||
|
||||
|
@ -516,10 +541,6 @@ procedure MbiStop; stdcall;
|
|||
begin
|
||||
// set stop request
|
||||
stopRequest := true;
|
||||
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
end; //*** end of MbiStop ***
|
||||
|
||||
|
||||
|
|
|
@ -274,6 +274,7 @@ begin
|
|||
Sleep(5);
|
||||
if stopRequest then
|
||||
begin
|
||||
MbiCallbackOnLog('Transport layer connection cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Transport layer connection cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
@ -319,6 +320,7 @@ begin
|
|||
Sleep(5);
|
||||
if stopRequest then
|
||||
begin
|
||||
MbiCallbackOnLog('Transport layer connection cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Transport layer connection cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
@ -361,6 +363,10 @@ begin
|
|||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
@ -390,6 +396,17 @@ begin
|
|||
|
||||
for regionCnt := 0 to datafile.GetRegionCnt-1 do
|
||||
begin
|
||||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// obtain the region info
|
||||
datafile.GetRegionInfo(regionCnt, addr, len);
|
||||
|
||||
|
@ -422,6 +439,17 @@ begin
|
|||
bufferOffset := 0;
|
||||
while len > 0 do
|
||||
begin
|
||||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// set the current write length taking into account kMaxProgLen
|
||||
currentWriteCnt := len mod kMaxProgLen;
|
||||
if currentWriteCnt = 0 then currentWriteCnt := kMaxProgLen;
|
||||
|
@ -551,10 +579,6 @@ procedure MbiStop; stdcall;
|
|||
begin
|
||||
// set stop request
|
||||
stopRequest := true;
|
||||
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
end; //*** end of MbiStop ***
|
||||
|
||||
|
||||
|
|
|
@ -303,6 +303,10 @@ begin
|
|||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
@ -331,6 +335,17 @@ begin
|
|||
|
||||
for regionCnt := 0 to datafile.GetRegionCnt-1 do
|
||||
begin
|
||||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// obtain the region info
|
||||
datafile.GetRegionInfo(regionCnt, addr, len);
|
||||
|
||||
|
@ -363,6 +378,17 @@ begin
|
|||
bufferOffset := 0;
|
||||
while len > 0 do
|
||||
begin
|
||||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// set the current write length taking into account kMaxProgLen
|
||||
currentWriteCnt := len mod kMaxProgLen;
|
||||
if currentWriteCnt = 0 then currentWriteCnt := kMaxProgLen;
|
||||
|
@ -491,10 +517,6 @@ procedure MbiStop; stdcall;
|
|||
begin
|
||||
// set stop request
|
||||
stopRequest := true;
|
||||
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
end; //*** end of MbiStop ***
|
||||
|
||||
|
||||
|
|
|
@ -308,6 +308,10 @@ begin
|
|||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
@ -336,6 +340,17 @@ begin
|
|||
|
||||
for regionCnt := 0 to datafile.GetRegionCnt-1 do
|
||||
begin
|
||||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// obtain the region info
|
||||
datafile.GetRegionInfo(regionCnt, addr, len);
|
||||
|
||||
|
@ -368,6 +383,17 @@ begin
|
|||
bufferOffset := 0;
|
||||
while len > 0 do
|
||||
begin
|
||||
// check if the user cancelled
|
||||
if stopRequest then
|
||||
begin
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnError('Programming session cancelled by user.');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// set the current write length taking into account kMaxProgLen
|
||||
currentWriteCnt := len mod kMaxProgLen;
|
||||
if currentWriteCnt = 0 then currentWriteCnt := kMaxProgLen;
|
||||
|
@ -419,7 +445,6 @@ begin
|
|||
MbiCallbackOnProgress(progress);
|
||||
MbiCallbackOnLog('File successfully downloaded t='+ShortString(TimeToStr(Time)));
|
||||
MbiCallbackOnDone;
|
||||
|
||||
end; //*** end of OnTimeout ***
|
||||
|
||||
|
||||
|
@ -497,10 +522,6 @@ procedure MbiStop; stdcall;
|
|||
begin
|
||||
// set stop request
|
||||
stopRequest := true;
|
||||
|
||||
// disconnect the transport layer
|
||||
MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time)));
|
||||
loader.Disconnect;
|
||||
end; //*** end of MbiStop ***
|
||||
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue