MCPcopy Create free account
hub / github.com/ON4QZ/QSSTV / saveImage

Method saveImage

src/drmrx/sourcedecoder.cpp:507–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505
506
507void sourceDecoder::saveImage(transportBlock *tbPtr)
508{
509 int i;
510 QByteArray hybridBa;
511 displayMBoxEvent *stmb=0;
512 QString downloadF;
513 modeCodeTmp=tbPtr->modeCode;
514 callsignTmp=tbPtr->callsign;
515
516 alreadyDisplayed=true;
517 if(tbPtr->alreadyReceived)
518 {
519 addToLog("Image already received",LOGDRMSRC);
520 return ;
521 }
522 if(tbPtr->fileName.isEmpty()) return ;
523 if(tbPtr->retrieveTries==0) lastAvgSNR=avgSNR;
524 isHybrid=false;
525 if((tbPtr->fileName.left(3)==".de") || (tbPtr->fileName.left(3)=="de_"))
526 {
527 isHybrid=true;
528 //ftpInterface ftpIntf("Save Image FTP");
529 if((enableHybridRx) && (soundRoutingInput!=soundBase::SNDINFROMFILE))
530 {
531 addToLog(QString("Hybrid filename %1, attempt %2").arg(tbPtr->fileName).arg(tbPtr->retrieveTries+1),LOGALL);
532 downloadF=rxDRMImagesPath+"/"+tbPtr->fileName;
533 for(i=0;i<tbPtr->dataSegmentPtrList.count();i++)
534 {
535 hybridBa+=tbPtr->dataSegmentPtrList.at(i)->data;
536 }
537 if(hc.deCrypt(&hybridBa))
538 {
539 if (tbPtr->retrieveTries==0)
540 {
541 ff->setupFtp("GetHybridImage",hc.host(),hc.port(),hc.user(),hc.passwd(),hc.dir()+"/"+hybridFtpHybridFilesDirectory);
542
543 ff->downloadFile(tbPtr->fileName.toLatin1(),downloadF,false,false);
544 }
545 tbPtr->retrieveTries++;
546
547 }
548 else
549 {
550 if (tbPtr->retrieveTries==0)
551 {
552 stmb= new displayMBoxEvent("Hybrid Error","No file downloaded");
553 QApplication::postEvent( dispatcherPtr, stmb ); // Qt will delete it when done
554 return;
555 }
556 }
557 }
558 else
559 {
560 downloadF.clear();
561 }
562 tbPtr->newFileName=downloadF;
563 } // end of hybrid.
564 else

Callers

nothing calls this directly

Calls 12

countMethod · 0.80
atMethod · 0.80
deCryptMethod · 0.80
setupFtpMethod · 0.80
hostMethod · 0.80
portMethod · 0.80
userMethod · 0.80
passwdMethod · 0.80
dirMethod · 0.80
setAlreadyReceivedMethod · 0.80
downloadFileMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected