예제 #1
0
void PluginManager::DisableAndStopPlugin(ola_plugin_id plugin_id) {
  AbstractPlugin *plugin = STLFindOrNull(m_loaded_plugins, plugin_id);
  if (!plugin_id) {
    return;
  }

  if (STLRemove(&m_active_plugins, plugin_id)) {
    plugin->Stop();
  }

  if (STLRemove(&m_enabled_plugins, plugin_id)) {
    plugin->SetEnabledState(false);
  }
}
예제 #2
0
bool PluginManager::EnableAndStartPlugin(ola_plugin_id plugin_id) {
  if (STLContains(m_active_plugins, plugin_id)) {
    // Already running, nothing to do.
    return true;
  }

  AbstractPlugin *plugin = STLFindOrNull(m_loaded_plugins, plugin_id);
  if (!plugin) {
    return false;
  }

  if (STLInsertIfNotPresent(&m_enabled_plugins, plugin_id, plugin)) {
    plugin->SetEnabledState(true);
  }

  return StartIfSafe(plugin);
}