Esempio n. 1
0
void copy_DBR_CTRL(const void * dbr, unsigned count, PVStructure::shared_pointer const & pvStructure)
{
    const T* data = static_cast<const T*>(dbr);

    PVStructure::shared_pointer alarm = pvStructure->getStructureField("alarm");
    alarm->getIntField("status")->put(0);
    alarm->getIntField("severity")->put(data->severity);
    alarm->getStringField("message")->put(dbrStatus2alarmMessage[data->status]);

    PVStructure::shared_pointer disp = pvStructure->getStructureField("display");
    disp->getStringField("units")->put(std::string(data->units));
    disp->getDoubleField("limitHigh")->put(data->upper_disp_limit);
    disp->getDoubleField("limitLow")->put(data->lower_disp_limit);

    copy_format<T>(dbr, disp);

    PVStructure::shared_pointer va = pvStructure->getStructureField("valueAlarm");
    std::tr1::static_pointer_cast<sF>(va->getSubField("highAlarmLimit"))->put(data->upper_alarm_limit);
    std::tr1::static_pointer_cast<sF>(va->getSubField("highWarningLimit"))->put(data->upper_warning_limit);
    std::tr1::static_pointer_cast<sF>(va->getSubField("lowWarningLimit"))->put(data->lower_warning_limit);
    std::tr1::static_pointer_cast<sF>(va->getSubField("lowAlarmLimit"))->put(data->lower_alarm_limit);

    PVStructure::shared_pointer ctrl = pvStructure->getStructureField("control");
    ctrl->getDoubleField("limitHigh")->put(data->upper_ctrl_limit);
    ctrl->getDoubleField("limitLow")->put(data->lower_ctrl_limit);

    copy_DBR<pT, sT, sF, aF>(&data->value, count, pvStructure);
}
Esempio n. 2
0
    PVStructure::shared_pointer request(PVStructure::shared_pointer const & args)
        throw (RPCRequestException)
    {
        // TODO error handling
        double a = atof(args->getStringField("a")->get().c_str());
        double b = atof(args->getStringField("b")->get().c_str());

        PVStructure::shared_pointer result = getPVDataCreate()->createPVStructure(resultStructure);
        result->getDoubleField("c")->put(a+b);
        return result;
    }
Esempio n. 3
0
void copy_DBR_STS(const void * dbr, unsigned count, PVStructure::shared_pointer const & pvStructure)
{
    const T* data = static_cast<const T*>(dbr);

    PVStructure::shared_pointer alarm = pvStructure->getStructureField("alarm");
    // no mapping needed
    alarm->getIntField("status")->put(0);
    alarm->getIntField("severity")->put(data->severity);
    alarm->getStringField("message")->put(dbrStatus2alarmMessage[data->status]);

    copy_DBR<pT, sT, sF, aF>(&data->value, count, pvStructure);
}
Esempio n. 4
0
void copy_format<dbr_time_string>(const void * /*dbr*/, PVStructure::shared_pointer const & pvDisplayStructure)
{
    pvDisplayStructure->getStringField("format")->put("%s");
}