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 2019 2020 2021 2022 2023 2024 | 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 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Asub record problems to update waveforms of string-type |
From: | Perrier Pierre <[email protected]> |
To: | "[email protected]" <[email protected]> |
Date: | Fri, 23 Sep 2011 14:01:26 +0000 |
Hello, I have some problems with the use
of the “asub” record. I’m trying to update a waveform record with two strings. So, my EPICS database looks like this: record(waveform, "$(P):CRExeSeq") { field(PINI, "NO") field(DTYP, "Soft Channel") field(UDF, "0") field(NELM, "2") field(FTVL, "STRING") } record(aSub, "$(P):_notifyCRExeSeq") { field(SCAN, "Event") field(EVNT, "4") field(OUTA, "$(P):CRExeSeq") field(SNAM, "asub_notify") field(PINI, "NO") field(FTVA, "STRING") field(NOVA, "2") field(NEVA, "2") } The “$(P):CRExeSeq” record is updated by the “$(P):_notifyCRExeSeq” record when an observer class executes the “post_event(4)” function. The problem is that my “asub_notify” function doesn’t really update the string
waveform. In this function, I process the update in the following way: // I get the new informations from an other class QStringList
l_infoAnotifier = g_drvSequenceurMetier->getCRExecutionSequence(); //Here, I process the update if(precord->nova
<= l_infoAnotifier.size()){
// I create a char**
char** l_info =
(char**)
malloc(l_infoAnotifier.size()*sizeof(char*));
for(int
i=0;i<l_infoAnotifier.size();i++){
l_info[i] = (char*)
malloc(40*sizeof(char));
if(l_infoAnotifier.at(i).length()<=40){
strcpy_s(l_info[i],40,l l_infoAnotifier.at(i).toStdString().c_str()); }
else {
strcpy_s(l_info[i],40,"Error too much char"); } }
//Copy
try {
char** l_stringout = (char**)
precord->vala;
memcpy_s(l_stringout,(40*precord->nova)*sizeof(char),
l_info,(40*l_infoAnotifier.size())*sizeof(char)); }
catch (...) {
printf("Error in the asub_notify function\n"); }
//Delete
delete[] l_info; } In the same way, I created a process function which seems to work for updating waveform of double-type data. Here, I think the problem comes from the string type and the “memcpy” functions. Does anyone know how to realize asub functions for string waveforms? Or know why this code doesn’t work?
|