Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load channelFile items into system channels vector #865

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

taclane
Copy link
Contributor

@taclane taclane commented Nov 14, 2023

When a channelFile is used for conventional systems, these channels are successfully created and monitored, but are not added to the system channels vector. Downstream plugins or other API calls may want to access a list of conventional channels assigned to a system with sys->get_channels() whether or not a channelFile is in use.

This change does not affect the methods trunk-recorder uses to set up conventional systems with a channelFile, it only loads those channels into the internal vector after the .csv file has been read.

@robotastic
Copy link
Owner

Great addition... I feel like we could also probably simplify this section of code now, since conventional talkgroups will now be loaded into the channels vector. I will go check it out tonight:

if (system->has_channel_file()) {
std::vector<Talkgroup *> talkgroups = system->get_talkgroups();
for (vector<Talkgroup *>::iterator tg_it = talkgroups.begin(); tg_it != talkgroups.end(); tg_it++) {
Talkgroup *tg = *tg_it;
bool channel_added = setup_convetional_channel(system, tg->freq, tg->number);
if (!channel_added) {
BOOST_LOG_TRIVIAL(error) << "[" << system->get_short_name() << "]\t Unable to find a source for this conventional channel! Channel not added: " << format_freq(tg->freq) << " Talkgroup: " << tg->number;
// return false;
} else {
system_added = true;
}
}
} else {

@robotastic robotastic merged commit 7d629d3 into robotastic:master Nov 14, 2023
1 check passed
@taclane taclane deleted the channelfile-load branch November 16, 2023 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants