/* Function for getting next page number to send.  */
static ant_bsc_page_t next_page_number_get(ant_bsc_profile_t *p_profile)
/* Function for getting next page number to send.  */
static ant_bsc_page_t next_page_number_get(ant_bsc_profile_t *p_profile)
{
    ant_bsc_page_t page_number;
    if (p_profile->_cb.p_sens_cb->message_counter < (BACKGROUND_DATA_INTERVAL))
    {
        page_number  = p_profile->_cb.p_sens_cb->main_page_number;
    }
    else
    {
        page_number  = p_profile->_cb.p_sens_cb->bkgd_page_number;
    }
    if ((p_profile->_cb.p_sens_cb->message_counter % TX_TOGGLE_DIVISOR) == 0)
    {
        p_profile->_cb.p_sens_cb->toggle_bit ^= 1;
    }
    ++(p_profile->_cb.p_sens_cb->message_counter);
    if (p_profile->_cb.p_sens_cb->message_counter == (BACKGROUND_DATA_INTERVAL + MAIN_DATA_INTERVAL))
    {
        p_profile->_cb.p_sens_cb->message_counter = 0;
        next_bkgd_page_number_set(p_profile);
    }
    return page_number;
}