Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020 
<== Date ==> <== Thread ==>

Subject: Re: I'm looking for a pvacces example to read PVStructure
From: Marty Kraimer via Tech-talk <tech-talk@aps.anl.gov>
To: Heinz Junkes <junkes@fhi-berlin.mpg.de>
Cc: tech-talk@aps.anl.gov
Date: Thu, 14 Mar 2019 05:43:41 -0400
Also replace
int iChunk(char *pvName)
with
int iChunk(const std::string & pvName)

and
char pv[] = "CRYVISIL:STM:FASTSCAN:IMAGE_CHUNK";
with
std::string pv("CRYVISIL:STM:FASTSCAN:IMAGE_CHUNK");

Also why are you creating a thread instead of just calling iChunk directly?

Marty

On 3/14/19 5:31 AM, Marty Kraimer wrote:
Change
int iChunk(char *pvName)
{
     PvaClientPtr pva= PvaClient::get("pva”);
try {
to

int iChunk(char *pvName)
{
    PvaClientPtr pva= PvaClient::get("pva”);
    PvaClient::setDebug(true);
 try {

What is the result?

Also what does:
pvget -v -r "" CRYVISIL:STM:FASTSCAN:IMAGE_CHUNK
show?

Marty

On 3/13/19 3:00 PM, Heinz Junkes wrote:
Hello, Marty,

Thanks for the example. But even with that I don't manage to run it.

#include <iostream>
#include <getopt.h>

#include <epicsThread.h>
#include <epicsTime.h>

#include <epicsExit.h>
#include <iocsh.h>

#include <iostream>

#include <pv/pvaClient.h>
#include <pv/pvData.h>

using namespace std;
using namespace epics::pvaClient;
using namespace epics::pvData;

int iChunk(char *pvName)
{
     PvaClientPtr pva= PvaClient::get("pva”);
try {
     PvaClientChannelPtr channel = pva->channel(pvName);
     PvaClientPutGetPtr putGet = channel->createPutGet("putField(value)getField()");
     putGet->connect();
     PvaClientPutDataPtr putData = putGet->getPutData();
     PVStructurePtr pvValue = putData->getPVStructure();
     // CODE TO  PUT ALL FIELDS IN value

     putGet->putGet();
     PvaClientGetDataPtr getData = putGet->getGetData();
     cout << getData->getPVStructure() << endl

     } catch (std::runtime_error e) {
         cout << "exception " << e.what() << endl;
         exit(1);
     }
     return 0;
}

int main(int argc,char *argv[])
{
   epicsThreadId simpleId;

     if(argc>=2) {
         iocsh(argv[1]);
         epicsThreadSleep(.2);
     }

     char pv[] = "CRYVISIL:STM:FASTSCAN:IMAGE_CHUNK";
     simpleId = epicsThreadCreate("IChunkT", epicsThreadPriorityMedium,
epicsThreadGetStackSize(epicsThreadStackMedium),
                                 (EPICSTHREADFUNC)iChunk, pv);
     iocsh(NULL);
     epicsExit(0);
     return(0);
}


The “ putGet->connect();” raises an exception


exception channel CRYVISIL:STM:FASTSCAN:IMAGE_CHUNK PvaClientPutGet::connect
PvaClientPutGet::channelPutGetConnect)
pvRequest
structure
     structure getField
     structure putField
         structure value

error
Not Implemented
Error: epicsMutex::invalidMutex()


the PV is available

[junkes@dune iocmyEx]$ pvinfo CRYVISIL:STM:FASTSCAN:IMAGE_CHUNK
CRYVISIL:STM:FASTSCAN:IMAGE_CHUNK epics:nt/NTTable:1.0
     string[] labels
     structure value
         double[] x
         double[] y
         double[] z
         int[] time_index
     string descriptor
     alarm_t alarm
         int severity
         int status
         string message
     time_t timeStamp
         long secondsPastEpoch
         int nanoseconds
         int userTag
     int counter

Am I doing something wrong?

Danke, Heinz
------------------------------------------------------------------------------
Fritz-Haber-Institut    | Phone:         (+49 30) 8413-4270
Heinz Junkes             | Fax (G3+G4):   (+49 30) 8413-5900
Faradayweg 4-6        |
D - 14195 Berlin        | E-Mail: junkes@fhi-berlin.mpg.de
------------------------------------------------------------------------------

On 12. Mar 2019, at 15:26, Marty Kraimer via Tech-talk <tech-talk@aps.anl.gov> wrote:

Using pvaClientCPP your code would be something like:

    PvaClientChannelPtr channel = pva->channel("CRYVISIL:STM:FASTSCAN:IMAGE_CHUNK");      PvaClientPutGetPtr putGet = channel->createPutGet("putField(value)getField()");
     putGet->connect();
     PvaClientPutDataPtr putData = putGet->getPutData();
     PVStructurePtr pvValue = putData->getPVStructure();
     // CODE TO  PUT ALL FIELDS IN value

     putGet->putGet();
     PvaClientGetDataPtr getData = putGet->getGetData();
     cout << getData->getPVStructure() << endl;




References:
I'm looking for a pvacces example to read PVStructure Heinz Junkes via Tech-talk
Re: I'm looking for a pvacces example to read PVStructure will.rogers--- via Tech-talk
Re: I'm looking for a pvacces example to read PVStructure Marty Kraimer via Tech-talk
Re: I'm looking for a pvacces example to read PVStructure Heinz Junkes via Tech-talk
Re: I'm looking for a pvacces example to read PVStructure Marty Kraimer via Tech-talk

Navigate by Date:
Prev: Re: I'm looking for a pvacces example to read PVStructure Marty Kraimer via Tech-talk
Next: Re: I'm looking for a pvacces example to read PVStructure Heinz Junkes via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020 
Navigate by Thread:
Prev: Re: I'm looking for a pvacces example to read PVStructure Marty Kraimer via Tech-talk
Next: Re: I'm looking for a pvacces example to read PVStructure Heinz Junkes via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020 
ANJ, 14 Mar 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·