Ejemplo n.º 1
0
bool CQWW::validateExchange(Qso *qso)

// mult1=CQ Country
// mult2=CQ zone
// exchange same for all : RST zone
{
    if (!separateExchange(qso)) return(false);
    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    bool ok = false;
    if (exchElement.size() == 2) {
        finalExch[0] = exchElement[0];
        finalExch[1] = exchElement[1];
    } else if (exchElement.size() == 1) {
        fillDefaultRST(qso);
        finalExch[1] = exchElement[0];
    }
    int zone=finalExch[1].toInt(&ok);
    if (ok) {
        if (zone>0 && zone<41) {
            qso->zone=zone;
            qso->mult_name = finalExch[1];
            determineMultType(qso);
            // override for marine mobile stations: zone credit only
            if (qso->isMM) {
                qso->mult[0]    = -1;
                qso->isamult[0] = false;
            }
            copyFinalExch(ok, qso);
        } else {
            ok=false;
        }
    }
    return(ok);
}
Ejemplo n.º 2
0
bool FD::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);
    if (exchElement.size() < 2) return(false);
    bool ok = false;

    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    // get the exchange
    determineMultType(qso);

    if (qso->isamult[0]) {
        // Domestic call: CLASS SECTION
        ok = valExch_name_state(0, qso->mult[0]);
    } else {
        // DX: CLASS DX
        finalExch[0] = exchElement[0];
        finalExch[1] = "DX";
        ok           = true;
    }
    for (int i = 0; i < nExch; i++) {
        qso->rcv_exch[i] = finalExch[i];
    }
    return(ok);
}
Ejemplo n.º 3
0
bool Sprint::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);
    bool ok = false;

    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    // get the exchange
    determineMultType(qso);

    if (qso->isamult[0]) {
        // Domestic call: # NAME STATE
        if (exchElement.size() < 3) return(false);
        ok = valExch_nr_name_state(0, qso->mult[0]);
    } else if (qso->isamult[1]) {
        // NA country
        ok           = valExch_nr_name();
        finalExch[2] = qso->PfxName;
    } else {
        // DX
        ok           = valExch_nr_name();
        finalExch[2] = "DX";
    }
    for (int i = 0; i < nExch; i++) {
        qso->rcv_exch[i] = finalExch[i];
    }

    return(ok);
}
Ejemplo n.º 4
0
bool ARRL10::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);
    fillDefaultRST(qso);

    finalExch[1].clear();
    qso->rcv_exch[0].clear();
    qso->rcv_exch[1].clear();
    bool ok = false;

    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    qso->pts = 0;
    determineMultType(qso);

    // mobile ITU regions (RST) R1, (RST) R2, (RST) R3
    // not using validator in contest.cpp since here R1/R2/R3 are
    // multipliers
    if (qso->isMM) {
        for (int i = exchElement.size() - 1; i >= 0; i--) {
            int r = 0;
            if (exchElement[i] == "R1") r = 1;
            if (exchElement[i] == "R2") r = 2;
            if (exchElement[i] == "R3") r = 3;
            if (r) {
                // make this count as "domestic mult" regardless of actual country of callsign
                qso->mult[1]    = -1;
                qso->isamult[0] = true;
                break;
            }
        }
    }
    if (qso->isamult[0]) {
        // Domestic call: (RST) state
        ok = valExch_rst_state(0, qso->mult[0]);
    } else if (qso->isamult[1]) {
        // DX: (RST) #
        // two things entered; assume first is rst
        int inr = 0;
        if (exchElement.size() == 2) {
            finalExch[0] = exchElement[0];
            inr          = 1;
        }

        // serial number; must be convertable to int
        bool iok = false;
        exchElement[inr].toInt(&iok, 10);
        if (iok) {
            ok           = true;
            finalExch[1] = exchElement[inr];
        }
    }
    copyFinalExch(ok, qso);
    return(ok);
}
Ejemplo n.º 5
0
bool ARRLDX::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);

    fillDefaultRST(qso);
    finalExch[1].clear();
    qso->rcv_exch[0].clear();
    qso->rcv_exch[1].clear();
    bool ok = false;

    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    // get the exchange
    determineMultType(qso);

    qso->pts = 0;

    // for US/VE stations
    if (usVe) {
        // mobile stations: /MM /AM qso credit but not a mult
        if (qso->isMM) {
            qso->mult[0]    = -1;
            qso->isamult[0] = true;
        }
        if (qso->isamult[0]) {
            ok = valExch_rst_name(qso);
            if (ok) {
                qso->pts = 3;
            }
        }
    } else {
        // DX stations
        if (qso->isamult[0]) {
            ok = valExch_rst_state(0, qso->mult[0]);
            if (ok) {
                qso->pts = 3;
            }
        }
    }
    if (qso->dupe) qso->pts = 0;
    copyFinalExch(ok, qso);
    return(ok);
}
Ejemplo n.º 6
0
/*!
   KQP exchange validator
 */
bool KQP::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);

    qso->bandColumn=qso->band;
    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    // check prefix
    determineMultType(qso);

    // any number must be RST; take last one entered
    int nrField=-1;
    bool ok_part[2];
    ok_part[0]=false;
    ok_part[1]=false;
    for (int i=exchElement.size()-1;i>=0;i--) {
        bool ok=false;
        exchElement.at(i).toInt(&ok);
        if (ok) {
            nrField=i;
            ok_part[0]=true;
            break;
        }
    }
    if (nrField!=-1) {
        finalExch[0]=exchElement.at(nrField);
    } else {
        // default RST
        if (qso->modeType==CWType || qso->modeType==DigiType) {
            finalExch[0]="599";
        } else {
            finalExch[0]="59";
        }
        ok_part[0]=true;
    }

    // look for state or KS county

    // both KS and non-KS can work stations with county mults
    int m=-1;
    int multField=-1;
    if (qso->isamult[0]) {
        for (int i=exchElement.size()-1;i>=0;i--) {
            m=isAMult(exchElement.at(i),0);
            if (m!=-1) {
                ok_part[1]=true;
                qso->mult[0]=m;
                multField=i;
                break;
            }
        }
        // special case: KS stations get the "KS" mult for any KS county worked
        if (withinState) {
            if (ok_part[1]) {
                qso->isamult[1]=true;
               // qso->isamult[0]=false;
                qso->mult[1]=0;
               // qso->mult[0]=-1; // don't count as a county mult
                qso->newmult[0]=false;
            }
        }
    }
    // non-KS only works KS
    if (withinState) {
        // KS station mults
        // check first for DX:
        for (int i=exchElement.size()-1;i>=0;i--) {
            // ignore any 'KS' entered here
            if (exchElement.at(i)=="KS") continue;

            m=isAMult(exchElement.at(i),1);
            if (m!=-1) {
                ok_part[1]=true;
                qso->mult[1]=m;
                multField=i;
                break;
            }
        }
        if (ok_part[1]) {
            finalExch[1]=exchElement.at(multField);
        }

        // only copy into log if exchange is validated
        if (ok_part[0] && ok_part[1]) {
            for (int i = 0; i < nExch; i++) {
                qso->rcv_exch[i] = finalExch[i];
            }
        }
    }
    // if exchange is ok and a mobile, we need a mobile dupe check
    if (qso->isMobile && ok_part[0] && ok_part[1]) {
        emit(mobileDupeCheck(qso));
        if (!qso->dupe) {
            emit(clearDupe());
        }
    }
    return(ok_part[0] && ok_part[1]);
}
Ejemplo n.º 7
0
/*!
   PAQP exchange validator

   mult 0: PA counties
   mult 1: ARRL/Canadian Sections
 */
bool PAQP::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);

    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    // check prefix
    determineMultType(qso);

    // any number must be qso number; take last one entered
    int nrField=-1;
    bool ok_part[2];
    ok_part[0]=false;
    ok_part[1]=false;
    for (int i=exchElement.size()-1;i>=0;i--) {
        bool ok=false;
        exchElement.at(i).toInt(&ok);
        if (ok) {
            nrField=i;
            ok_part[0]=true;
            break;
        }
    }
    if (nrField!=-1) {
        finalExch[0]=exchElement.at(nrField);
    }

    // look for section or PA county

    // both PA and non-PA have county mults
    int m=-1;
    int multField=-1;
    if (qso->isamult[0]) {
        for (int i=exchElement.size()-1;i>=0;i--) {
            m=isAMult(exchElement.at(i),0);
            if (m!=-1) {
                ok_part[1]=true;
                qso->mult[0]=m;
                multField=i;
                break;
            }
        }
        // special case: PA stations get the "WPA" or "EPA" mult for PA county worked
        if (withinState) {
            if (ok_part[1]) {
                if (EPA_counties.contains(exchElement.at(multField)))
                       qso->mult[1]=0; // EPA
                else
                       qso->mult[1]=1; // WPA
            }
        }
    }
    // non-PA only works PA
    if (!withinState) {
        if (!ok_part[1]) return(false);
    }

    // PA also gets mults for sections; can also work DX

    // check first for DX:
    if (!qso->isamult[1]) {
        finalExch[1]="DX";
        ok_part[1]=true;
    } else {
        for (int i=exchElement.size()-1;i>=0;i--) {
            // ignore any 'WPA' or 'EPA' entered here
            if (exchElement.at(i)=="EPA" || exchElement.at(i)=="WPA") continue;

            m=isAMult(exchElement.at(i),1);
            if (m!=-1) {
                ok_part[1]=true;
                qso->mult[1]=m;
                multField=i;
            break;
            }
        }
        if (ok_part[1]) {
            finalExch[1]=exchElement.at(multField);
        }
    }

    // only copy into log if exchange is validated
    if (ok_part[0] && ok_part[1]) {
        for (int i = 0; i < nExch; i++) {
            qso->rcv_exch[i] = finalExch[i];
        }
    }
    // if exchange is ok and a mobile, we need a mobile dupe check
    if (qso->isMobile && ok_part[0] && ok_part[1]) {
        emit(mobileDupeCheck(qso));
        if (!qso->dupe) {
            emit(clearDupe());
        }
    }
    return(ok_part[0] && ok_part[1]);
}
Ejemplo n.º 8
0
/*!
   sweepstakes exchange validator
 */
bool Sweepstakes::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);

    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    // check prefix
    determineMultType(qso);

    bool ok_part[4];
    ok_part[0]   = false; // qso #
    ok_part[1]   = false; // prec
    ok_part[2]   = false; // check
    ok_part[3]   = false; // section

    qso->mult[1] = -1;
    // don't check non-US/VE calls
    if (qso->isamult[0]) {
        // # PREC CK SECTION; 4 elements minimum
        // could have #PREC  together; 3 elements minimum
        if (exchElement.size() < 3) return(false);

        bool *used = new bool[exchElement.size()];
        for (int i = 0; i < exchElement.size(); i++) used[i] = false;

        // take last entered section name
        for (int i = exchElement.size() - 1; i >= 0; i--) {
            int m;
            if ((m = isAMult(exchElement.at(i), 0)) != -1) {
                if (!ok_part[3]) {
                    finalExch[3] = exchElement.at(i);
                    qso->mult[0] = m;
                    ok_part[3]   = true;
                    used[i]      = true;
                } else {
                    used[i] = true; // mark other entries matching section as used
                }
            }
        }

        // look for precedence attached to qso number (eq 213A). If so,
        // move precedence to a separate array element in exchElement

        // start search from end of entered data
        for (int i = exchElement.size() - 1; i >= 0; i--) {
            QByteArray last = exchElement.at(i);
            last = last.right(1);
            if (last == "Q" || last == "A" || last == "B" ||
                    last == "U" || last == "M" || last == "S") {
                QByteArray tmp = exchElement.at(i);
                tmp.chop(1);
                if (!tmp.isEmpty()) {
                    bool ok = false;
                    int nr=tmp.toInt(&ok, 10);
                    Q_UNUSED(nr);
                    if (ok) {
                        used[i]=true;
                        if (!ok_part[0]) {
                            finalExch[0]=tmp;
                            ok_part[0]=true;
                        }
                        if (!ok_part[1]) {
                            ok_part[1]=true;
                            finalExch[1]=last;
                        }
                    }
                } else if (exchElement.at(i).size()==1) {
                    // matched just prec
                    used[i]=true;
                    if (!ok_part[1]) {
                        ok_part[1]=true;
                        finalExch[1]=last;
                    }
                }
            }
        }

        // qso number: take last number which is not 2 digits or is a single digit
        for (int i = exchElement.size() - 1; i >= 0; i--) {
            if (used[i]) continue;
            bool nrok = false;
            int  nr   = exchElement.at(i).toInt(&nrok, 10);
            if (nrok && nr > 99) {
                // >99: QSO number
                finalExch[0] = exchElement.at(i);
                used[i]      = true;
                ok_part[0]   = true;
                break;
            } else if (nrok && nr<10 && (exchElement.at(i).size()==1)) {
                // single digit: must also be qso number
                finalExch[0] = exchElement.at(i);
                used[i]      = true;
                ok_part[0]   = true;
                break;
            }
        }
        // check: take last two-digit number
        for (int i = exchElement.size() - 1; i >= 0; i--) {
            if (used[i]) continue;
            bool nrok = false;
            int  nr   = exchElement.at(i).toInt(&nrok, 10);
            Q_UNUSED(nr);
            if (nrok && (exchElement.at(i).size()==2)) {
                ok_part[2]   = true;
                used[i]      = true;
                finalExch[2] = exchElement.at(i);
                break;
            }
        }

        // if still don't have a qso number, take the first number on the line
        if (!ok_part[0]) {
            for (int i = 0; i < exchElement.size(); i++) {
                if (used[i]) continue;

                bool ok;
                int nr = exchElement.at(i).toInt(&ok, 10);
                Q_UNUSED(nr);
                if (ok && !ok_part[0]) {
                    finalExch[0] = exchElement.at(i);
                    ok_part[0]=true;
                    used[i]=true;
                } else if (ok) {
                    used[i]      = true;
                }
            }
        }
        // try to update callsign if there is a non-identified string
        if (ok_part[0] & ok_part[1] & ok_part[2] & ok_part[3]) {
            for (int i = exchElement.size() - 1; i >= 0; i--) {
                if (!used[i]) {
                    bool ok;
                    int nr = exchElement.at(i).toInt(&ok, 10);
                    Q_UNUSED(nr);
                    if (!ok) {
                        qso->call = exchElement.at(i);
                    }
                    break;
                }
            }
        }
        delete[] used;
    } else {
        // not US/VE call, can't be logged
        return(false);
    }

    // only copy into log if exchange is validated
    if (ok_part[0] & ok_part[1] & ok_part[2] & ok_part[3]) {
        for (int i = 0; i < nExch; i++) {
            qso->rcv_exch[i] = finalExch[i];
        }
    }

    return(ok_part[0] & ok_part[1] & ok_part[2] & ok_part[3]);
}
Ejemplo n.º 9
0
bool IARU::validateExchange(Qso *qso)
{
    if (!separateExchange(qso)) return(false);
    bool ok = false;
    for (int ii = 0; ii < MMAX; ii++) qso->mult[ii] = -1;

    determineMultType(qso);

    // auto-fill rst
    if (qso->mode == RIG_MODE_CW || qso->mode == RIG_MODE_CWR ||
        qso->mode == RIG_MODE_RTTY || qso->mode == RIG_MODE_RTTYR) {
        finalExch[0] = "599";
    } else {
        finalExch[0] = "59";
    }

    // is it a HQ or official?
    qso->isamult[1] = valExch_rst_state(1, qso->mult[1]);
    if (qso->isamult[1]) {
        // HQ's don't count for zone mult
        qso->isamult[0] = false;
        qso->mult[0]    = -1;
        qso->zone       = 0;
    } else {
        // not a HQ : (RST) + zone
        if (exchElement.size() == 2) {
            finalExch[0] = exchElement[0]; // rst
            finalExch[1] = exchElement[1]; // zone
        } else {
            finalExch[1] = exchElement[0]; // zone
        }

        // parse zone. ok is true if conversion to integer succeeds
        qso->zone = finalExch[1].toInt(&ok, 10);
        if (ok && qso->zone > 0 && qso->zone <= zoneMax()) {
            qso->isamult[0] = true;
            qso->mult[0]    = qso->zone - 1; // important: update zone with what was logged!
        } else {
            qso->isamult[0] = false;
            qso->zone       = 0;
            qso->mult[0]    = -1;
            qso->continent  = ALL;
        }
    }
    qso->mult_name = finalExch[1];
    ok             = qso->isamult[0] || qso->isamult[1];

    for (int i = 0; i < nExch; i++) {
        qso->rcv_exch[i] = finalExch[i];
    }

    // dupes get zero pts
    if (qso->dupe) {
        qso->pts = 0;
        return(ok);
    }

    // unknown mults: assign 1 point; it may be a HQ station not on list
    if (qso->isamult[0] == false && qso->isamult[1] == false) {
        qso->pts = 1;
        return(ok);
    }
    if (qso->zone == _myZone || qso->isamult[1]) {
        // same zone, HQ, IARU official : 1 pt
        qso->pts = 1;
    } else if (qso->continent == myContinent) {
        qso->pts = 3;
    } else {
        qso->pts = 5;
    }
    return(ok);
}