Ejemplo n.º 1
0
DisplayContestContact *LoggerContestLog::addContact( int newctno, int extraFlags, bool saveNew )
{
   // add the contact number as an new empty contact, with disk block and log_seq

   bool timenow = true;
   if ( ( extraFlags & TO_BE_ENTERED ) || isPostEntry() )
      timenow = false;

   DisplayContestContact *lct;
   makeContact( timenow, ( BaseContact * ) lct );
   std::string temp = ( boost::format( "%3.3d" ) % newctno ).str();
   lct->serials.setValue( temp );
   lct->setLogSequence( nextBlock << 16 );
   nextBlock++;
   if ( newctno > maxSerial )
   {
      maxSerial = newctno;
   }
   lct->contactFlags.setValue( lct->contactFlags.getValue() | extraFlags );
   if ( saveNew )
   {
      lct->commonSave();		// make sure contact is correct
   }
   ctList.insert( lct );
   if ( saveNew )
   {
      commonSave( false );
   }

   return lct;
}
Ejemplo n.º 2
0
Contact *findContact(char *mob)
{
 char fname[100],lname[100]; 
 fseek(fp,0,SEEK_SET); 
 char buff[100];
 while(fgets(buff,100,fp)!=NULL)
 {
  printf("%s\n",buff);
  if(stringRecognizer(buff,mob))
  return makeContact(buff);   
 }
 return NULL;   
}
Ejemplo n.º 3
0
bool LoggerContestLog::GJVloadContacts( void )
{
   ContestContact * rct = 0;

   nextBlock = 1;

   for ( int i = 0; i < logCount; i++ )
   {
      makeContact( false, ( BaseContact * ) rct );
      if ( rct->GJVload( ( int ) nextBlock ) )
      {
         nextBlock++;
         ctList.insert( rct );
         int maxct = atoi( rct->serials.getValue().c_str() );
         if ( maxct > maxSerial )
            maxSerial = maxct;

      }
   }
   return true;
}
Ejemplo n.º 4
0
bool LoggerContestLog::importLOG( HANDLE hLogFile )
{
   THandleStream * hs = new THandleStream( ( int ) hLogFile );
   TStringList *ls = new TStringList();
   ls->LoadFromStream( hs );

   TEMPBUFF( temp, 100 );
   // Import from LOG format
   // Needs modification for "new" log format

   locValid = false;
   //   save();
   // read remainder of lines; write each line as we go

   long next_block = 1;

   bool started = false;

   DisplayContestContact *ct = 0;
   int lineNo = -1;
   while ( ++lineNo < ls->Count )
   {
      // skip new format header information, until we can cope
      // properly with it
      std::string stemp = trimr( ls->Strings[ lineNo ].c_str() );
      if ( stemp.length() == 0 || ( !started && !isdigit( ls->Strings[ lineNo ][ 1 ] ) ) )
      {
         // GJV.LOG

         /*
         Contest Title                        : VHFNFD
         Band in MHz                          : 432
         Section Entered                      : Multi Operator
         Name of Entrant/Club/Contest Group   : Bracknell Amateur Radio Club
         Band in MHz                          : %band%
         Section Entered                      : %section%
         Callsign Used                        : %call%
         QRH Locator Sent                     : %locator%
         Location as sent(District or QTH)    : %QTH%
         Brief Details of Transmitter Used    : %Transmitter%
         Brief Details of Receiver Used       : %Receiver%
         Power Output (Watts)                 : %power%
         Antenna Type                         : %Antenna%
         Antenna Height AGL(metres)           : %AGL%
         QTH Height ASL(metres)               : %ASL%

         Difficult ones:
         Name and Callsign of all Operators   :
         G0GJV  G4AUC  G0FCT  G0HVS
         Name, Callsign, Telephone Number, Address for Correspondence :
                                     : M. J. Goodey
                                     : G0GJV
                                     : 62, Rose Hill
                                     : Binfield
                                     : Berkshire
                                     : RG42 5LG
                               Phone : 01344 428614
                               Email : [email protected]

         */
         unsigned int spos = stemp.find( ":" );
         if ( spos != std::string::npos )
         {
            std::string text = trim( stemp.substr( spos + 1, stemp.size() ) );

            if ( strupr( stemp ).find( "CONTEST TITLE" ) == 0 )
            {
               name.setValue( text );
            }
            else
               if ( strupr( stemp ).find( "BAND IN MHZ" ) == 0 )
               {
                  band.setValue( text );
               }
               else
                  if ( strupr( stemp ).find( "SECTION ENTERED" ) == 0 )
                  {
                     entSect.setValue( text );
                  }
                  else
                     if ( strupr( stemp ).find( "NAME OF ENTRANT/CLUB/CONTEST GROUP" ) == 0 )
                     {
                        entrant.setValue( text );
                     }
                     else
                        if ( strupr( stemp ).find( "CALLSIGN USED" ) == 0 )
                        {
                           // we need to tail clip the callsign - or we end up with things like
                           // M1DUD/QRP        CLASS : SO  /   50MHZ FIXED
                           unsigned int spos = text.find( " " );
                           if ( spos != std::string::npos )
                           {
                              text = trim( text.substr( 0, spos ) );
                           }
                           mycall.fullCall.setValue( strupr( text ) );
                           mycall.valRes = CS_NOT_VALIDATED;
                           mycall.validate();

                        }
                        else
                           if ( strupr( stemp ).find( "QRH LOCATOR SENT" ) == 0 ||
                                strupr( stemp ).find( "QTH LOCATOR SENT" ) == 0 )
                           {
                              // yes, contestx DOES say QRH!
                              myloc.loc.setValue( strupr( text ) );
                              validateLoc();
                           }
                           else
                              if ( strupr( stemp ).find( "POWER OUTPUT" ) == 0 )
                              {
                                 power.setValue( text );
                              }
                              else
                                 if ( strupr( stemp ).find( "LOCATION AS SENT" ) == 0 )
                                 {
                                    location.setValue( text );
                                 }
                                 else
                                    if ( strupr( stemp ).find( "ANTENNA TYPE" ) == 0 )
                                    {
                                       entAnt.setValue( text );
                                    }
                                    else
                                       if ( strupr( stemp ).find( "ANTENNA HEIGHT" ) == 0 )
                                       {
                                          entAGL.setValue( text );
                                       }
                                       else
                                          if ( strupr( stemp ).find( "QTH HEIGHT" ) == 0 )
                                          {
                                             entASL.setValue( text );
                                          }
                                          else
                                             if ( strupr( stemp ).find( "BRIEF DETAILS OF TRANSMITTER USED" ) == 0 )
                                             {
                                                entTx.setValue( text );
                                             }
                                             else
                                                if ( strupr( stemp ).find( "BRIEF DETAILS OF RECEIVER USED" ) == 0 )
                                                {
                                                   entRx.setValue( text );
                                                }
         }
         continue;
      }
      started = true;

      makeContact( false, ( BaseContact * ) ct );
      ct->setLogSequence( 0 );

      stemp += std::string( 200, ' ' );   // make sure there is plenty more...
      const char *lbuff = stemp.c_str();
      // parse contact line in

      strcpysp( temp, &lbuff[ 0 ], 6 );
      ct->time.setDate( temp, DTGLOG );
      strcpysp( temp, &lbuff[ 7 ], 4 );
      ct->time.setTime( temp, DTGLOG );
      strcpysp( temp, &lbuff[ 21 ], 15 );
      ct->cs = callsign( strupr( temp ) );
      ct->cs.valRes = CS_NOT_VALIDATED;
      strcpysp( temp, &lbuff[ 37 ], 3 );
      ct->reps.setValue( temp );
      strcpysp( temp, &lbuff[ 41 ], 4 );
      ct->serials.setValue( temp );

      int maxct = atoi( ct->serials.getValue().c_str() );
      if ( maxct > maxSerial )
         maxSerial = maxct;

      strcpysp( temp, &lbuff[ 46 ], 3 );
      ct->repr.setValue( temp );
      strcpysp( temp, &lbuff[ 51 ], 4 );
      ct->serialr.setValue( temp );

      // here is the score field
      strcpysp( temp, &lbuff[ 59 ], 5 );
      if ( atoi( temp ) == 0 )
         ct->contactFlags.setValue( NON_SCORING );

      strcpysp( temp, &lbuff[ 65 ], 6 );
      ct->op1.setValue( temp );

      strcpysp( temp, &lbuff[ 72 ], 6 );
      ct->loc.loc.setValue( temp );
      ct->loc.valRes = LOC_NOT_VALIDATED;

      //ct->comments = "";

      TEMPBUFF( extra, EXTRALENGTH + 1 );
      TEMPBUFF( comments, COMMENTLENGTH + 1 );

      strcpysp( extra, &lbuff[ 81 ], 2 );          // 81 is district code
      if ( extra[ 0 ] && extra[ 1 ] && ( extra[ 0 ] != ' ' && extra[ 1 ] != ' ' ) )
      {
         // we always attempt to import the district mult field
         strcpysp( comments, &lbuff[ 93 ], COMMENTLENGTH );
         ct->comments.setValue( comments );

      }
      else
      {
         strcpysp( extra, &lbuff[ 93 ], EXTRALENGTH );
      }
      ct->extraText.setValue( extra );

      //	   strcpysp(ct->power, power, 7);
      //      ct->PowerWatts = PowerWatts;
      // save contact

      // we have to have logSequence set before we insert - or it will cause
      // duplicates

      next_block++ ;
      ct->setLogSequence( next_block << 16 );

      ctList.insert( ct );
   }
   delete ls;
   delete hs;
   return true;
}
Ejemplo n.º 5
0
//============================================================
void BaseContestLog::processMinosStanza( const std::string &methodName, MinosTestImport * const mt )
{
   unsigned long logSequence = ( unsigned long ) - 1;

   int itemp;
   if ( mt->getStructArgMemberValue( "lseq", itemp ) )
      logSequence = ( unsigned long ) itemp;

   if ( methodName == "MinosLogContest" )
   {
      mt->getStructArgMemberValue( "name", name );
      mt->getStructArgMemberValue( "band", band );

      bool btemp;
      if ( mt->getStructArgMemberValue( "scoreKms", btemp ) )
         scoreMode.setInitialValue( btemp ? PPKM : PPQSO );

      mt->getStructArgMemberValue( "startTime", DTGStart );
      mt->getStructArgMemberValue( "endTime", DTGEnd );

      mt->getStructArgMemberValue( "districtMult", districtMult );
      mt->getStructArgMemberValue( "DXCCMult", countryMult );
      mt->getStructArgMemberValue( "locMult", locMult );
      mt->getStructArgMemberValue( "QTHReq", otherExchange );
      mt->getStructArgMemberValue( "AllowLoc4", allowLoc4 );
      mt->getStructArgMemberValue( "AllowLoc8", allowLoc8 );
   }
   else
      if ( methodName == "MinosLogMode" )
      {
         mt->getStructArgMemberValue( "readOnly", readOnly );
      }
   if ( methodName == "MinosLogQTH" )
   {
      if ( mt->getStructArgMemberValue( "locator", myloc.loc ) )
         validateLoc();
      mt->getStructArgMemberValue( "district", location );
      mt->getStructArgMemberValue( "location", location ); // doubled up...
   }
   else
      if ( methodName == "MinosLogEntry" )
      {
         mt->getStructArgMemberValue( "call", mycall.fullCall );
      }
      else
         if ( methodName == "MinosLogStation" )
         {
            mt->getStructArgMemberValue( "power", power );
         }
         else
            if ( methodName == "MinosLogOperators" )
            {}
            else
               if ( methodName == "MinosLogCurrent" )
               {}
               else
                  if ( methodName == "MinosLogBundles" )
                  {}
                  else
                     if ( methodName == "MinosLogComment" )
                     {
                        BaseContact * rct = pcontactAtSeq( logSequence );
                        if ( !rct )
                        {
                           makeContact( false, rct );
                           rct->setLogSequence( logSequence );
                           ctList.insert( rct );
                           nextBlock++;
                        }
                        rct->processMinosStanza( methodName, mt );

                     }
                     else
                        if ( methodName == "MinosLogQSO" )
                        {
                           BaseContact * rct = pcontactAtSeq( logSequence );
                           if ( !rct )
                           {
                              makeContact( false, rct );
                              rct->setLogSequence( logSequence );
                              ctList.insert( rct );
                              nextBlock++;
                           }
                           rct->processMinosStanza( methodName, mt );

                        }
}