Beispiel #1
0
void InputMap::setEditorUniverse(t_input_universe uni)
{
	if (uni < universes())
		m_editorUniverse = uni;
	else
		m_editorUniverse = 0;
}
Beispiel #2
0
void OutputMap::saveDefaults()
{
    QSettings settings;
    QString key;
    QString str;

    for (quint32 i = 0; i < universes(); i++)
    {
        OutputPatch* outputPatch = patch(i);
        OutputPatch* fbPatch = feedbackPatch(i);
        Q_ASSERT(outputPatch != NULL);
        Q_ASSERT(fbPatch != NULL);

        /* Plugin name */
        key = QString("/outputmap/universe%2/plugin/").arg(i);
        settings.setValue(key, outputPatch->pluginName());

        /* Plugin output */
        key = QString("/outputmap/universe%2/output/").arg(i);
        settings.setValue(key, str.setNum(outputPatch->output()));

        /* Plugin name */
        key = QString("/outputmap/universe%2/feedbackplugin/").arg(i);
        settings.setValue(key, fbPatch->pluginName());

        /* Plugin output */
        key = QString("/outputmap/universe%2/feedback/").arg(i);
        settings.setValue(key, str.setNum(fbPatch->output()));
    }
}
Beispiel #3
0
OutputPatch* OutputMap::feedbackPatch(quint32 universe) const
{
    if (universe < universes())
        return m_fb_patch[universe];
    else
        return NULL;
}
Beispiel #4
0
void InputMap::setEditorUniverse(quint32 uni)
{
    if (uni < universes())
        m_editorUniverse = uni;
    else
        m_editorUniverse = 0;
}
Beispiel #5
0
void OutputMap::loadDefaults()
{
    QSettings settings;
    QString plugin;
    QString output;
    QString key;

    for (quint32 i = 0; i < universes(); i++)
    {
        /* Plugin name */
        key = QString("/outputmap/universe%2/plugin/").arg(i);
        plugin = settings.value(key).toString();

        /* Plugin output */
        key = QString("/outputmap/universe%2/output/").arg(i);
        output = settings.value(key).toString();

        if (plugin.length() > 0 && output.length() > 0)
        {
            /* Check that the same plugin & output are not mapped
               to more than one universe at a time. */
            quint32 m = mapping(plugin, output.toInt());
            if (m == QLCChannel::invalid() || m == i)
                setPatch(i, plugin, output.toInt());
        }
    }
}
Beispiel #6
0
void InputOutputMap::setBlackout(bool blackout)
{
    /* Don't do blackout twice */
    if (m_blackout == blackout)
        return;
    m_blackout = blackout;

    if (blackout == true)
    {
        QByteArray zeros(512, 0);
        for (quint32 i = 0; i < universes(); i++)
        {
            Universe *universe = m_universeArray.at(i);
            if (universe->outputPatch() != NULL)
                universe->outputPatch()->dump(universe->id(), zeros);
        }
    }
    else
    {
        /* Force writing of values back to the plugins */
        m_universeChanged = true;
    }

    emit blackoutChanged(m_blackout);
}
Beispiel #7
0
bool InputOutputMap::removeAllUniverses()
{
    quint32 uniCount = universes();
    for (quint32 i = 0; i < uniCount; i++)
    {
        Universe *uni = m_universeArray.takeLast();
        delete uni;
    }
    m_latestUniverseId = invalidUniverse();
    return true;
}
Beispiel #8
0
quint32 OutputMap::mapping(const QString& pluginName, quint32 output) const
{
    for (quint32 uni = 0; uni < universes(); uni++)
    {
        const OutputPatch* p = patch(uni);
        if (p->pluginName() == pluginName && p->output() == output)
            return uni;
    }

    return QLCIOPlugin::invalidLine();
}
Beispiel #9
0
quint32 InputMap::mapping(const QString& pluginName, quint32 input) const
{
    for (quint32 uni = 0; uni < universes(); uni++)
    {
        const InputPatch* p = patch(uni);
        if (p->pluginName() == pluginName && p->input() == input)
            return uni;
    }

    return InputMap::invalidUniverse();
}
Beispiel #10
0
int OutputMap::mapping(const QString& pluginName, t_output output) const
{
	for (int uni = 0; uni < universes(); uni++)
	{
		const OutputPatch* p = patch(uni);
		if (p->pluginName() == pluginName && p->output() == output)
			return uni;
	}

	return -1;
}
Beispiel #11
0
/*****************************************************************************
 * Input data
 *****************************************************************************/
void InputMap::slotPluginConfigurationChanged(QLCIOPlugin* plugin)
{
    for (quint32 i = 0; i < universes(); i++)
    {
        InputPatch* ip = patch(i);
        Q_ASSERT(ip != NULL);
        if (ip->plugin() == plugin)
            ip->reconnect();
    }

    emit pluginConfigurationChanged(plugin->name());
}
Beispiel #12
0
QStringList OutputMap::universeNames() const
{
    QStringList list;
    for (quint32 i = 0; i < universes(); i++)
    {
        OutputPatch* p(patch(i));
        Q_ASSERT(p != NULL);
        list << QString("%1: %2 (%3)").arg(i + 1)
                                      .arg(p->pluginName())
                                      .arg(p->outputName());
    }

    return list;
}
Beispiel #13
0
bool OutputMap::setPatch(quint32 universe, const QString& pluginName,
                         quint32 output)
{
    if (universe >= universes())
    {
        qWarning() << Q_FUNC_INFO << "Universe" << universe << "out of bounds.";
        return false;
    }

    m_universeMutex.lock();
    m_patch[universe]->set(plugin(pluginName), output);
    m_universeMutex.unlock();

    return true;
}
Beispiel #14
0
void OutputMap::slotPluginConfigurationChanged(QLCIOPlugin* plugin)
{
    for (quint32 i = 0; i < universes(); i++)
    {
        OutputPatch* op = patch(i);
        Q_ASSERT(op != NULL);
        if (op->plugin() == plugin)
        {
            m_universeMutex.lock();
            op->reconnect();
            m_universeMutex.unlock();
        }
    }

    emit pluginConfigurationChanged(plugin->name());
}
Beispiel #15
0
void InputMap::slotConfigurationChanged()
{
    QLCInPlugin* plugin = qobject_cast<QLCInPlugin*> (QObject::sender());
    if (plugin == NULL) // The signal comes from a plugin that isn't guaranteed to behave
        return;

    for (quint32 i = 0; i < universes(); i++)
    {
        InputPatch* ip = patch(i);
        Q_ASSERT(ip != NULL);
        if (ip->plugin() == plugin)
            ip->reconnect();
    }

    emit pluginConfigurationChanged(plugin->name());
}
Beispiel #16
0
bool OutputMap::setPatch(quint32 universe, const QString& pluginName,
                         quint32 output, bool isFeedback)
{
    if (universe >= universes())
    {
        qWarning() << Q_FUNC_INFO << "Universe" << universe << "out of bounds.";
        return false;
    }

    m_universeMutex.lock();
    if (isFeedback == false)
    m_patch[universe]->set(doc()->ioPluginCache()->plugin(pluginName), output);
    else
        m_fb_patch[universe]->set(doc()->ioPluginCache()->plugin(pluginName), output);
    m_universeMutex.unlock();

    return true;
}
Beispiel #17
0
bool InputOutputMap::setInputPatch(quint32 universe, const QString &pluginName,
                                   quint32 input, const QString &profileName)
{
    /* Check that the universe that we're doing mapping for is valid */
    if (universe >= universes())
    {
        qWarning() << Q_FUNC_INFO << "Universe" << universe << "out of bounds.";
        return false;
    }

    QMutexLocker locker(&m_universeMutex);
    InputPatch *currInPatch = m_universeArray.at(universe)->inputPatch();
    QLCInputProfile *currProfile = NULL;
    if (currInPatch != NULL)
    {
        currProfile = currInPatch->profile();
        disconnect(currInPatch, SIGNAL(inputValueChanged(quint32,quint32,uchar,const QString&)),
                this, SIGNAL(inputValueChanged(quint32,quint32,uchar,const QString&)));
    }
Beispiel #18
0
void OutputMap::slotConfigurationChanged()
{
    QLCOutPlugin* plugin = qobject_cast<QLCOutPlugin*> (QObject::sender());
    if (plugin == NULL) // The signal comes from a plugin that isn't guaranteed to behave
        return;

    for (quint32 i = 0; i < universes(); i++)
    {
        OutputPatch* op = patch(i);
        Q_ASSERT(op != NULL);
        if (op->plugin() == plugin)
        {
            m_universeMutex.lock();
            op->reconnect();
            m_universeMutex.unlock();
        }
    }

    emit pluginConfigurationChanged(plugin->name());
}
Beispiel #19
0
Json::Value GetE131UniverseBytesReceived()
{
    Json::Value result;
    Json::Value universes(Json::arrayValue);

    int i;

    if (ddpBytesReceived) {
        Json::Value ddpUniverse;
        ddpUniverse["id"] = "DDP";

        if (ddpMaxChannel > ddpMinChannel) {
            std::stringstream ss;
            ss << ddpMinChannel << "-" << ddpMaxChannel;
            std::string chanRange = ss.str();
            ddpUniverse["startChannel"] = chanRange;
        } else {
            ddpUniverse["startChannel"] = "-";
        }
        
        std::stringstream ss;
        ss << ddpBytesReceived;
        std::string bytesReceived = ss.str();
        ddpUniverse["bytesReceived"] = bytesReceived;
        
        std::stringstream pr;
        pr << ddpPacketsReceived;
        std::string packetsReceived = pr.str();
        ddpUniverse["packetsReceived"] = packetsReceived;
        
        std::stringstream er;
        er << ddpErrors;
        std::string errors = er.str();
        ddpUniverse["errors"] = errors;
        universes.append(ddpUniverse);
    }

	for(i = 0; i < InputUniverseCount; i++) {
		Json::Value universe;

		universe["id"] = InputUniverses[i].universe;
		universe["startChannel"] = InputUniverses[i].startAddress;

		universe["bytesReceived"] = std::to_string(InputUniverses[i].bytesReceived);
		universe["packetsReceived"] = std::to_string(InputUniverses[i].packetsReceived);
		universe["errors"] = std::to_string(InputUniverses[i].errorPackets);

		universes.append(universe);
	}
    if (e131Errors) {
        Json::Value universe;
        
        universe["id"] = "E1.31 Errors";
        universe["startChannel"] = "-";
        universe["bytesReceived"] = "-";
        universe["packetsReceived"] = "-";
        
        std::stringstream er;
        er << e131Errors;
        std::string errors = er.str();
        universe["errors"] = errors;
        
        universes.append(universe);
    }
    if (unknownUniverse.packetsReceived) {
        Json::Value universe;
        
        universe["id"] = "Ignored";
        universe["startChannel"] = "-";
        
        std::stringstream er;
        er << e131Errors;
        std::string errors = er.str();

        std::stringstream ss;
        ss << unknownUniverse.bytesReceived;
        std::string bytesReceived = ss.str();
        universe["bytesReceived"] = bytesReceived;

        std::stringstream pr;
        pr << unknownUniverse.packetsReceived;
        std::string packetsReceived = pr.str();
        universe["packetsReceived"] = packetsReceived;
        
        universe["errors"] = "-";
        
        universes.append(universe);
    }
    if (e131SyncPackets) {
        Json::Value universe;
        
        universe["id"] = "E1.31 Sync";
        universe["startChannel"] = "-";
        universe["bytesReceived"] = "-";

        std::stringstream er;
        er << e131SyncPackets;
        std::string sync = er.str();
        universe["packetsReceived"] = sync;
        
        universe["errors"] = "-";
        
        universes.append(universe);
    }
    
	result["universes"] = universes;

	return result;
}