<commit_before>/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * PathportPlugin.cpp
 * The Pathport plugin for ola
 * Copyright (C) 2005-2009 <NAME>
 */

#include <string>
#include "ola/StringUtils.h"
#include "ola/Logging.h"
#include "olad/PluginAdaptor.h"
#include "olad/Preferences.h"
#include "plugins/pathport/PathportDevice.h"
#include "plugins/pathport/PathportPlugin.h"


namespace ola {
namespace plugin {
namespace pathport {

const char PathportPlugin::PATHPORT_DEVICE_NAME[] = "Pathport Device";
const char PathportPlugin::PLUGIN_NAME[] = "Pathport Plugin";
const char PathportPlugin::PLUGIN_PREFIX[] = "pathport";


/*
 * Start the plugin
 * For now we just have one device.
 */
bool PathportPlugin::StartHook() {
  m_device = new PathportDevice(this,
                                PATHPORT_DEVICE_NAME,
                                m_preferences,
                                m_plugin_adaptor);

  if (!m_device)
    return false;

  if (!m_device->Start()) {
    delete m_device;
    return false;
  }
  m_plugin_adaptor->RegisterDevice(m_device);
  return true;
}


/*
 * Stop the plugin
 * @return true on sucess, false on failure
 */
bool PathportPlugin::StopHook() {
  m_plugin_adaptor->UnregisterDevice(m_device);
  m_device->Stop();
  delete m_device;
  return true;
}


/*
 * Return the description for this plugin
 */
string PathportPlugin::Description() const {
  return
"Pathport Plugin\n"
"----------------------------\n"
"\n"
"This plugin creates a single device with 5 input and 5 output ports.\n"
"\n"
"The universe the port is patched to corresponds with the DMX channels used \n"
"in the pathport protocol. For example universe 0 is xDMX channels 1 - 512, \n"
"universe 1 is xDMX channels 513 - 1024.\n"
"\n"
"--- Config file : ola-pathport.conf ---\n"
"\n"
"ip = a.b.c.d\n"
"The ip address to bind to. If not specified it will use the first \n"
"non-loopback ip.\n"
"\n"
"name = ola-Pathport\n"
"The name of the node.\n"
"\n"
"node-id = <int>\n"
"The pathport id of the node\n"
"\n";
}


/*
 * Load the plugin prefs and default to sensible values
 */
bool PathportPlugin::SetDefaultPreferences() {
  bool save = false;

  if (!m_preferences)
    return false;

  // we don't worry about ip here
  // if it's non existant it will choose one<commit_msg> * update pathport plugin docs<commit_after>/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * PathportPlugin.cpp
 * The Pathport plugin for ola
 * Copyright (C) 2005-2009 <NAME>
 */

#include <string>
#include "ola/StringUtils.h"
#include "ola/Logging.h"
#include "olad/PluginAdaptor.h"
#include "olad/Preferences.h"
#include "plugins/pathport/PathportDevice.h"
#include "plugins/pathport/PathportPlugin.h"


namespace ola {
namespace plugin {
namespace pathport {

const char PathportPlugin::PATHPORT_DEVICE_NAME[] = "Pathport Device";
const char PathportPlugin::PLUGIN_NAME[] = "Pathport Plugin";
const char PathportPlugin::PLUGIN_PREFIX[] = "pathport";


/*
 * Start the plugin
 * For now we just have one device.
 */
bool PathportPlugin::StartHook() {
  m_device = new PathportDevice(this,
                                PATHPORT_DEVICE_NAME,
                                m_preferences,
                                m_plugin_adaptor);

  if (!m_device)
    return false;

  if (!m_device->Start()) {
    delete m_device;
    return false;
  }
  m_plugin_adaptor->RegisterDevice(m_device);
  return true;
}


/*
 * Stop the plugin
 * @return true on sucess, false on failure
 */
bool PathportPlugin::StopHook() {
  m_plugin_adaptor->UnregisterDevice(m_device);
  m_device->Stop();
  delete m_device;
  return true;
}


/*
 * Return the description for this plugin
 */
string PathportPlugin::Description() const {
  return
"Pathport Plugin\n"
"----------------------------\n"
"\n"
"This plugin creates a single device with 5 input and 5 output ports.\n"
"\n"
"The universe the port is patched to corresponds with the DMX channels used \n"
"in the pathport protocol. For example universe 0 is xDMX channels 0 - 511, \n"
"universe 1 is xDMX channels 512 - 1023.\n"
"\n"
"--- Config file : ola-pathport.conf ---\n"
"\n"
"ip = a.b.c.d\n"
"The ip address to bind to. If not specified it will use the first \n"
"non-loopback ip.\n"
"\n"
"name = ola-Pathport\n"
"The name of the node.\n"
"\n"
"node-id = <int>\n"
"The pathport id of the node\n"
"\n";
}


/*
 * Load the plugin prefs and default to sensible values
 */
bool PathportPlugin::SetDefaultPreferences() {
  bool save = false;

  if (!m_preferences)
    return false;

  // we don't worry about ip here
  // if it's non existant it will choose one
{'fraction_non_alphanumeric': 0.11215109476851078, 'fraction_numerical': 0.01270265752966739, 'mean_word_length': 3.1613351877607787, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '505927', 'n_tokens_mistral': 1923, 'n_tokens_neox': 1816, 'n_words': 695}