int controller_imp::find_in_end_station(struct jdksavdecc_eui64 &other_entity_id, const uint8_t *frame)
    {
        struct jdksavdecc_eui64 other_controller_id = jdksavdecc_acmpdu_get_controller_entity_id(frame, ETHER_HDR_SIZE);

        for(uint32_t i = 0; i < end_station_vec.size(); i++)
        {
            struct jdksavdecc_eui64 end_entity_id = end_station_vec.at(i)->get_adp()->get_entity_entity_id();
            struct jdksavdecc_eui64 this_controller_id = end_station_vec.at(i)->get_adp()->get_controller_entity_id();

            if((jdksavdecc_eui64_compare(&end_entity_id, &other_entity_id) == 0) &&
                ((jdksavdecc_eui64_compare(&other_controller_id, &this_controller_id) == 0) ||
                (jdksavdecc_eui64_compare(&other_controller_id, &end_entity_id) == 0)))
            {
                return i;
            }
        }

        return -1;
    }
Exemple #2
0
int controller_imp::find_in_end_station(struct jdksavdecc_eui64 & other_entity_id, bool isUnsolicited, const uint8_t * frame)
{
    struct jdksavdecc_eui64 other_controller_id = jdksavdecc_acmpdu_get_controller_entity_id(frame, ETHER_HDR_SIZE);

    for (uint32_t i = 0; i < end_station_array->size(); i++)
    {
        struct jdksavdecc_eui64 end_entity_id = end_station_array->at(i)->get_adp()->get_entity_entity_id();
        struct jdksavdecc_eui64 this_controller_id = end_station_array->at(i)->get_adp()->get_controller_entity_id();
        bool entity_id_match = false;
        bool controller_id_match = false;

        if (jdksavdecc_eui64_compare(&end_entity_id, &other_entity_id) == 0)
        {
            entity_id_match = true;
        }

        //Do not try to find the controller_id if it is an unsolicited response
        if (isUnsolicited && entity_id_match)
        {
            return i;
        }
        else
        {
            if (jdksavdecc_eui64_compare(&other_controller_id, &this_controller_id) == 0 ||
                jdksavdecc_eui64_compare(&other_controller_id, &end_entity_id) == 0)
            {
                controller_id_match = true;
            }

            if (entity_id_match && controller_id_match)
            {
                return i;
            }
        }
    }

    return -1;
}