Пример #1
0
/**
 * @brief SimLog::setVpz
 *        Set the VPZ package used for the simulation
 */
void SimLog::setVpz(vle::vpz::Vpz *vpz)
{
    mVpz = vpz;
    vle::vpz::Observables curVpzObs;
    vle::vpz::Views       curVpzViews;

    curVpzViews  = mVpz->project().experiment().views();
    curVpzObs    = mVpz->project().experiment().views().observables();


    if ( getWidget() )
    {
        // Update the title (Experiment Name and VPZ file name)
        QString expName = mVpz->project().experiment().name().c_str();
        QString simTitle = QString("%1 (%2)").arg(expName).arg(mVpz->filename().c_str());
        mWidgetTab->setModelName(simTitle);

        QObject::connect(mWidgetTab, SIGNAL(doStartStop()),
                         this,       SLOT  (startStop()));
    }

    if ( getWidgetToolbar() )
    {
        mWidgetToolbar->buildTree(mVpz);

        QObject::connect(mWidgetToolbar, SIGNAL(addSig    (QString, QString)),
                         this,           SLOT  (addPlotSig(QString, QString)));
        QObject::connect(mWidgetToolbar, SIGNAL(delSig    (QString)),
                         this,           SLOT  (delPlotSig(QString)));
    }
}
bool Cws_machineEx::onStartStop( IEspContext &context, IEspStartStopRequest &req, 
                                         IEspStartStopResponse &resp)
{
    try
    {
        if (!context.validateFeatureAccess(EXEC_FEATURE_URL, SecAccess_Full, false))
            throw MakeStringException(ECLWATCH_EXECUTION_ACCESS_DENIED, "Permission denied.");

        char* userName = (char*) m_sTestStr1.str();
        char* password = (char*) m_sTestStr2.str();
        doStartStop(context, req.getAddresses(), userName, password, req.getStop(), resp);
    }
    catch(IException* e)
    {   
        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
    }
    return true;
}
Пример #3
0
/**
 * @brief SimPlot::setVpz
 *        Set the VPZ package used for the simulation
 */
void SimPlot::setVpz(vleVpz *vpz)
{
    mVpz = vpz;

    vle::vpz::Vpz   *oldVpz;

    // NOTE - View list is loaded from disk using vle::Vpz
    // only because GVLE2::vleVpz does not support views
    // direct access yet. This must be changed in future.

    QString fileName = vpz->getFilename();
    oldVpz = new vle::vpz::Vpz(fileName.toStdString());

    vle::vpz::Observables curVpzObs;
    vle::vpz::Views       curVpzViews;

    curVpzViews  = oldVpz->project().experiment().views();
    curVpzObs    = oldVpz->project().experiment().views().observables();

    if ( getWidget() )
    {
        // Update the title (Experiment Name and VPZ file name)
        QString expName = oldVpz->project().experiment().name().c_str();
        QString simTitle = QString("%1 (%2)").arg(expName).arg(oldVpz->filename().c_str());
        mWidgetTab->setModelName(simTitle);

        QObject::connect(mWidgetTab, SIGNAL(doStartStop()),
                         this,       SLOT  (startStop()));
    }

    if ( getWidgetToolbar() )
    {
        mWidgetToolbar->buildTree(oldVpz);

        QObject::connect(mWidgetToolbar, SIGNAL(addSig    (plotSignal *)),
                         this,           SLOT  (addPlotSig(plotSignal *)));
        QObject::connect(mWidgetToolbar, SIGNAL(delSig    (plotSignal *)),
                         this,           SLOT  (delPlotSig(plotSignal *)));
        QObject::connect(mWidgetToolbar, SIGNAL(updateSig    (plotSignal *)),
                         this,           SLOT  (updatePlotSig(plotSignal *)));
    }
}
bool Cws_machineEx::onStartStopDone( IEspContext &context, IEspStartStopDoneRequest &req, 
                                         IEspStartStopResponse &resp)
{
    throw MakeStringException(ECLWATCH_INTERNAL_ERROR, "StartStopDone feature not supported.");
    //following code is no longer accessible but will remain for reference

    try
    {
        if (!context.validateFeatureAccess(EXEC_FEATURE_URL, SecAccess_Full, false))
            throw MakeStringException(ECLWATCH_EXECUTION_ACCESS_DENIED, "Permission denied.");

        const char*addresses0 = req.getAddresses();
        bool bStop = req.getStop();

        char* userName = (char*) m_sTestStr1.str();
        char* password = (char*) m_sTestStr2.str();

        StringArray addresses;
        char* pAddr = (char*) addresses0;
        while (pAddr)
        {
            char* ppAddr = strstr(pAddr, "|Addresses_");
            if (!ppAddr)
            {
                char* ppAddr0 = strchr(pAddr, '=');
                if (!ppAddr0)
                    addresses.append(pAddr);
                else
                    addresses.append(ppAddr0+1);
                break;
            }
            else
            {
                char addr[1024];
                strncpy(addr, pAddr, ppAddr - pAddr);
                addr[ppAddr - pAddr] = 0;
                char* ppAddr0 = strchr(addr, '=');
                if (!ppAddr0)
                    addresses.append(addr);
                else
                    addresses.append(ppAddr0+1);

                pAddr = ppAddr + 1;
            }
        }

        doStartStop(context, addresses, userName, password, bStop, resp);

        double version = context.getClientVersion();
        if (version > 1.07)
        {
            resp.setAutoRefresh( req.getAutoRefresh() );
            resp.setMemThreshold(req.getMemThreshold());
            resp.setDiskThreshold(req.getDiskThreshold());
            resp.setCpuThreshold(req.getCpuThreshold());
            resp.setMemThresholdType(req.getMemThresholdType());
            resp.setDiskThresholdType(req.getDiskThresholdType());
        }
    }
    catch(IException* e)
    {   
        FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
    }
    return true;
}