| 68 | } |
| 69 | |
| 70 | void connector_impl::configure(const std::shared_ptr<cfg::trace>& _configuration) { |
| 71 | std::scoped_lock lk{configure_mutex_}; |
| 72 | if (_configuration) { |
| 73 | is_enabled_ = _configuration->is_enabled_; |
| 74 | is_sd_enabled_ = _configuration->is_sd_enabled_; |
| 75 | } |
| 76 | |
| 77 | if (is_enabled_) { // No need to create filters if tracing is disabled! |
| 78 | for (auto& its_channel : _configuration->channels_) { |
| 79 | if (!add_channel(its_channel->id_, its_channel->name_)) { |
| 80 | VSOMEIP_ERROR << "Channel " << its_channel->id_ << " has multiple definitions."; |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | for (auto& its_filter : _configuration->filters_) { |
| 85 | for (auto& its_channel : its_filter->channels_) { |
| 86 | auto its_channel_ptr = get_channel_impl(its_channel); |
| 87 | if (its_channel_ptr) { |
| 88 | if (its_filter->is_range_) { |
| 89 | its_channel_ptr->add_filter(its_filter->matches_[0], its_filter->matches_[1], its_filter->ftype_); |
| 90 | } else { |
| 91 | its_channel_ptr->add_filter(its_filter->matches_, its_filter->ftype_); |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | VSOMEIP_INFO << "vsomeip tracing " << (is_enabled_ ? "enabled." : "not enabled.") << " vsomeip service discovery tracing " |
| 99 | << (is_sd_enabled_ ? "enabled." : "not enabled."); |
| 100 | } |
| 101 | |
| 102 | void connector_impl::reset() { |
| 103 | // reset to default |