test/test_mode_tests.c
static float calculate_per(app_test_mode_data_received_t * rxdata)
{
    uint32_t seq = rxdata->hdr.seq;
    uint32_t dup = rxdata->rxCntrs.dup;
    uint32_t rxCntr = rxdata->rxCntrs.cntr;

    if (m_rx.startRXCntr == 0 || m_rx.startSeq >= seq)
    {
        LOGI("Re-started RX counters: rxCntr = %u, seq = %u\n", rxCntr, seq);
        m_rx.startRXCntr = rxCntr;
        m_rx.startSeq = seq;
    }
    m_rx.lastRXCntr = rxCntr;
    m_rx.lastSeq = seq;
    rxCntr = rxCntr - m_rx.startRXCntr;
    seq = seq - m_rx.startSeq;
    if (seq > 0)
    {
        m_rx.per = ((float) (seq - (rxCntr - dup)) / (float) (seq)) * 100;
    }

    // store RSSI value of last received package
    m_rx.rssi = rxdata->rssi;

    return m_rx.per;
}
/**
 * \brief   Packet Error Rate (PER %) calculation
 *
 * This function calculates PER % i.e. number of missed messages in
 * relation to number of sent messages. PER value is needed in some
 * certification measurements.
 *
 * PER% = (seq - (rxCntr - dup)) / seq
 *
 * \param   seq
 *          Number of sent messages
 * \param   rxCntr
 *          Number of received received message
 * \param   dup
 *          Number of duplicate messages. Incremented if two consecutive
 *          has the same sequence number
 * \return  per
 *          Calculated Packet Error Rate percentage
 */
\brief   Packet Error Rate (PER %) calculation
This function calculates PER % i.e. number of missed messages in
relation to number of sent messages. PER value is needed in some
certification measurements.

PER% = (seq - (rxCntr - dup)) / seq

\param   seq
Number of sent messages
\param   rxCntr
Number of received received message
\param   dup
Number of duplicate messages. Incremented if two consecutive
has the same sequence number
\return  per
Calculated Packet Error Rate percentage
\ brief Packet Error Rate ( PER % ) calculation This function calculates PER % i . e . number of missed messages in relation to number of sent messages . PER value is needed in some certification measurements . PER% = ( seq - ( rxCntr - dup )) / seq \ param seq Number of sent messages \ param rxCntr Number of received received message \ param dup Number of duplicate messages . Incremented if two consecutive has the same sequence number \ return per Calculated Packet Error Rate percentage
static float calculate_per(app_test_mode_data_received_t * rxdata)
{
    uint32_t seq = rxdata->hdr.seq;
    uint32_t dup = rxdata->rxCntrs.dup;
    uint32_t rxCntr = rxdata->rxCntrs.cntr;
    if (m_rx.startRXCntr == 0 || m_rx.startSeq >= seq)
    {
        LOGI("Re-started RX counters: rxCntr = %u, seq = %u\n", rxCntr, seq);
        m_rx.startRXCntr = rxCntr;
        m_rx.startSeq = seq;
    }
    m_rx.lastRXCntr = rxCntr;
    m_rx.lastSeq = seq;
    rxCntr = rxCntr - m_rx.startRXCntr;
    seq = seq - m_rx.startSeq;
    if (seq > 0)
    {
        m_rx.per = ((float) (seq - (rxCntr - dup)) / (float) (seq)) * 100;
    }
    m_rx.rssi = rxdata->rssi;
    return m_rx.per;
}
static float calculate_per ( app_test_mode_data_received_t * rxdata ) { uint32_t seq = rxdata -> hdr . seq ; uint32_t dup = rxdata -> rxCntrs . dup ; uint32_t rxCntr = rxdata -> rxCntrs . cntr ; if ( m_rx . startRXCntr == 0 || m_rx . startSeq >= seq ) { LOGI ( " \n " , rxCntr , seq ) ; m_rx . startRXCntr = rxCntr ; m_rx . startSeq = seq ; } m_rx . lastRXCntr = rxCntr ; m_rx . lastSeq = seq ; rxCntr = rxCntr - m_rx . startRXCntr ; seq = seq - m_rx . startSeq ; if ( seq > 0 ) { m_rx . per = ( ( float ) ( seq - ( rxCntr - dup ) ) / ( float ) ( seq ) ) * 100 ; } m_rx . rssi = rxdata -> rssi ; return m_rx . per ; }
\brief   Packet Error Rate (PER %) calculation
 This function calculates PER % i.e.
\ brief Packet Error Rate ( PER % ) calculation This function calculates PER % i . e .
// store RSSI value of last received package