Browse Source

Added inline image abort file transfer.

master
Alec Murphy 5 years ago
parent
commit
0d130ce9bf
  1. 30
      Uriel.HC

30
Uriel.HC

@ -12,10 +12,12 @@ U8 UrielPageBuf[2097152];
U8 UrielFileBuf[10485760];
I64 UrielFileBufSize=0;
I64 UrielPageBufSize=0;
I64 UrielGetFileAborted=0;
I64 UrielGetFileSuccess=0;
CComm *c=CommInit8n1(URIEL_PORT,115200);
U0 Get(U8 *remote_file, U8 *local_file="file") {
UrielGetFileAborted=0;
UrielGetFileSuccess=0;
Bool load=FALSE;
I64 b=0;
@ -33,7 +35,7 @@ U0 Get(U8 *remote_file, U8 *local_file="file") {
StrCpy(progress1_desc, "Receiving file");
while (!load) {
if ((TickTimer-StartTimer)>URIEL_TIMEOUT) { UrielFileBufSize=0; break; };
if (InU8(0x60)==0x01) { UrielFileBufSize=0; break; };
if (InU8(0x60)==0x01) { UrielGetFileAborted=1; UrielFileBufSize=0; break; };
PrevFileBufSize=UrielFileBufSize;
Sleep(0);
while (FifoU8Rem(c->RX_fifo,&b)) {
@ -92,24 +94,28 @@ U0 Send(U8 *local_file, U8 *remote_file="") {
}
U0 InsertImg(U8 *img_anchor, U8 *img_sid, U8 *img_eid, U8 *img_url) {
UrielGetFileAborted=0;
UrielGetFileSuccess=0;
DocAnchorFind(DocPut, img_anchor);
Get(img_url, URIEL_TMP_IMG);
while (UrielGetFileSuccess==0) {
while (UrielGetFileAborted==0 && UrielGetFileSuccess==0) {
DocAnchorFind(DocPut, img_anchor);
Get("retry:send", URIEL_TMP_IMG);
}
DocAnchorFind(DocPut, img_anchor);
DocBMP(,URIEL_TMP_IMG);
if (StrCmp(img_sid, "")!=0) {
DocAnchorFind(DocPut, img_sid);
DocPrintPartial(DocPut, "$ID,14$");
}
if (StrCmp(img_eid, "")!=0) {
DocAnchorFind(DocPut, img_eid);
DocPrintPartial(DocPut, "$ID,-14$");
if (UrielGetFileAborted==0) {
DocAnchorFind(DocPut, img_anchor);
DocBMP(,URIEL_TMP_IMG);
if (StrCmp(img_sid, "")!=0) {
DocAnchorFind(DocPut, img_sid);
DocPrintPartial(DocPut, "$ID,14$");
}
if (StrCmp(img_eid, "")!=0) {
DocAnchorFind(DocPut, img_eid);
DocPrintPartial(DocPut, "$ID,-14$");
}
DocAnchorFind(DocPut, img_anchor);
}
DocAnchorFind(DocPut, img_anchor);
UrielGetFileAborted=0;
UrielGetFileSuccess=0;
}

Loading…
Cancel
Save