Exemplo n.º 1
0
bool ExampleLink::init()
{
    initPVRecord();

    PVStructurePtr pvStructure = getPVRecordStructure()->getPVStructure();
    pvValue = pvStructure->getSubField<PVDoubleArray>("value");
    if(!pvValue) {
        return false;
    }
    ChannelProvider::shared_pointer provider =
        getChannelProviderRegistry()->getProvider(providerName);
    if(!provider) {
         cout << getRecordName() << " provider "
              << providerName << " does not exist" << endl;
        return false;
    }
    ChannelRequester::shared_pointer channelRequester =
        dynamic_pointer_cast<ChannelRequester>(getPtrSelf());
    channel = provider->createChannel(channelName,channelRequester);
    event.wait();
    if(!status.isOK()) {
        cout << getRecordName() << " createChannel failed "
             << status.getMessage() << endl;
        return false;
    }
    PVStructurePtr pvRequest = CreateRequest::create()->createRequest(
        "value");
    MonitorRequester::shared_pointer  monitorRequester =
        dynamic_pointer_cast<MonitorRequester>(getPtrSelf());
    monitor = channel->createMonitor(monitorRequester,pvRequest);
    return true;
}
Exemplo n.º 2
0
bool NTNDArrayRecord::init()
{   
    initPVRecord();
    NTNDArrayRecordPtr xxx = dynamic_pointer_cast<NTNDArrayRecord>(getPtrSelf());
    ntndarrayServerThread = NTNDArrayRecordThreadPtr(new NTNDArrayRecordThread(xxx));
    ntndarrayServerThread->init();
    ntndarrayServerThread->start();
    return true;
}
Exemplo n.º 3
0
bool HelloPutGetRecord::init()
{
    
    initPVRecord();
    pvArgumentValue = getPVStructure()->getSubField<PVString>("argument.value");
    if(pvArgumentValue.get()==NULL) return false;
    pvResultValue = getPVStructure()->getSubField<PVString>("result.value");
    if(pvResultValue.get()==NULL) return false;
    return true;
}
Exemplo n.º 4
0
bool ExampleHello::init()
{
    
    initPVRecord();
    PVFieldPtr pvField;
    pvArgumentValue = getPVStructure()->getSubField<PVString>("argument.value");
    if(pvArgumentValue.get()==NULL) return false;
    pvResultValue = getPVStructure()->getSubField<PVString>("result.value");
    if(pvResultValue.get()==NULL) return false;
    pvTimeStamp.attach(getPVStructure()->getSubField("result.timeStamp"));
    return true;
}
Exemplo n.º 5
0
bool ExampleGetLinkRecord::init(PvaClientPtr const & pva,string const & channelName,string const & providerName)
{
    initPVRecord();

    PVStructurePtr pvStructure = getPVRecordStructure()->getPVStructure();
    pvValue = pvStructure->getSubField<PVDoubleArray>("value");
    if(!pvValue) {
        return false;
    }
    pvaClientGet = pva->channel(channelName,providerName)->createGet();
    return true;
}
bool ExampleMonitorLinkRecord::init(PvaClientPtr const & pva,string const & channelName,string const & providerName)
{
    initPVRecord();

    PVStructurePtr pvStructure = getPVRecordStructure()->getPVStructure();
    pvValue = pvStructure->getSubField<PVDoubleArray>("value");
    if(!pvValue) {
        return false;
    }
    PvaClientChannelPtr pvaClientChannel = pva->channel(channelName,providerName,0.0);
    monitorRequester = dynamic_pointer_cast<PvaClientMonitorRequester>(getPtrSelf());
    pvaClientMonitor = pvaClientChannel->monitor("value",monitorRequester);
    return true;
}
Exemplo n.º 7
0
void PowerSupplyRecord::initPvt()
{
    initPVRecord();
    PVStructurePtr pvStructure = getPVStructure();
    PVFieldPtr pvField;
    pvField = pvStructure->getSubField("alarm");
    pvAlarm.attach(pvField);
    pvCurrent = pvStructure->getSubField<PVDouble>("current.value");
    pvVoltage = pvStructure->getSubField<PVDouble>("voltage.value");
    pvPower = pvStructure->getSubField<PVDouble>("power.value");
    alarm.setMessage("bad voltage");
    alarm.setSeverity(majorAlarm);
    pvAlarm.set(alarm);
}
Exemplo n.º 8
0
bool ExampleLink::init()
{
    initPVRecord();

    PVStructurePtr pvStructure = getPVRecordStructure()->getPVStructure();
    pvTimeStamp.attach(pvStructure->getSubField("timeStamp"));
    pvAlarm.attach(pvStructure->getSubField("alarm"));
    pvValue = static_pointer_cast<PVDoubleArray>(
        pvStructure->getScalarArrayField("value",pvDouble));
    if(!pvValue) {
        return false;
    }
    ChannelProvider::shared_pointer provider =
        getChannelProviderRegistry()->getProvider(providerName);
    if(!provider) {
         cout << getRecordName() << " provider "
              << providerName << " does not exist" << endl;
        return false;
    }
    ChannelRequester::shared_pointer channelRequester =
        dynamic_pointer_cast<ChannelRequester>(getPtrSelf());
    channel = provider->createChannel(channelName,channelRequester);
    event.wait();
    if(!status.isOK()) {
        cout << getRecordName() << " createChannel failed "
             << status.getMessage() << endl;
        return false;
    }
    ChannelGetRequester::shared_pointer channelGetRequester =
        dynamic_pointer_cast<ChannelGetRequester>(getPtrSelf());
    PVStructurePtr pvRequest = CreateRequest::create()->createRequest(
        "value,alarm,timeStamp");
    channelGet = channel->createChannelGet(channelGetRequester,pvRequest);
    event.wait();
    if(!status.isOK()) {
        cout << getRecordName() << " createChannelGet failed "
             << status.getMessage() << endl;
        return false;
    }
    getPVValue = static_pointer_cast<PVDoubleArray>(
        getPVStructure->getScalarArrayField("value",pvDouble));
    if(!getPVValue) {
        cout << getRecordName() << " get value not  PVDoubleArray" << endl;
        return false;
    }
    return true;
}
Exemplo n.º 9
0
bool PowerSupply::init()
{
    initPVRecord();
    PVStructurePtr pvStructure = getPVStructure();
    PVFieldPtr pvField;
    bool result;
    pvField = pvStructure->getSubField("timeStamp");
    if(!pvField) {
        cerr << "no timeStamp" << endl;
        return false;
    }
    result = pvTimeStamp.attach(pvField);
    if(!result) {
        cerr << "no timeStamp" << endl;
        return false;
    }
    pvField = pvStructure->getSubField("alarm");
    if(!pvField) {
        cerr << "no alarm" << endl;
        return false;
    }
    result = pvAlarm.attach(pvField);
    if(!result) {
        cerr << "no alarm" << endl;
        return false;
    }
    pvCurrent = pvStructure->getSubField<PVDouble>("current.value");
    if(!pvCurrent) {
        cerr << "no current\n";
        return false;
    }
    pvVoltage = pvStructure->getSubField<PVDouble>("voltage.value");
    if(!pvVoltage) {
        cerr << "no current\n";
        return false;
    }
    pvPower = pvStructure->getSubField<PVDouble>("power.value");
    if(!pvPower) {
        cerr << "no powert\n";
        return false;
    }
    return true;
}
Exemplo n.º 10
0
bool RecordListRecord::init()
{
    initPVRecord();
    PVStructurePtr pvStructure = getPVStructure();
    database = pvStructure->getStringField("argument.database");
    if(database.get()==NULL) return false;
    regularExpression = pvStructure->getStringField(
        "argument.regularExpression");
    if(regularExpression.get()==NULL) return false;
    status = pvStructure->getStringField("result.status");
    if(status.get()==NULL) return false;
    PVFieldPtr pvField = pvStructure->getSubField("result.names");
    if(pvField.get()==NULL) {
        std::cerr << "no result.names" << std::endl;
        return false;
    }
    name = static_pointer_cast<PVStringArray>(
         pvStructure->getScalarArrayField("result.names",pvString));
    if(name.get()==NULL) return false;
    return true;
}
Exemplo n.º 11
0
bool PowerSupplyRecord::init()
{
    initPVRecord();
    PVStructurePtr pvStructure = getPVStructure();
    PVFieldPtr pvField;
    bool result;
    pvField = pvStructure->getSubField("alarm");
    if(!pvField) {
        cerr << "no alarm" << endl;
        return false;
    }
    result = pvAlarm.attach(pvField);
    if(!result) {
        cerr << "no alarm" << endl;
        return false;
    }
    pvCurrent = pvStructure->getSubField<PVDouble>("current.value");
    if(!pvCurrent) {
        cerr << "no current\n";
        return false;
    }
    pvVoltage = pvStructure->getSubField<PVDouble>("voltage.value");
    if(!pvVoltage) {
        cerr << "no current\n";
        return false;
    }
    pvPower = pvStructure->getSubField<PVDouble>("power.value");
    if(!pvPower) {
        cerr << "no power\n";
        return false;
    }
    alarm.setMessage("bad voltage");
    alarm.setSeverity(majorAlarm);
    pvAlarm.set(alarm);
    return true;
}
Exemplo n.º 12
0
bool NDArrayRecord::init()
{
    initPVRecord();
    setTraceLevel(0);
    return true;
}