Thanks for your help. Indeed, now my waveform is updated at each call of my "asub_notify" function. Unfortunately, I've another problem, strings in the waveform are completely wrong (ex : "&@ñ««««") like a pointer error. So, I think the problem comes from the cast of precord->vala , what do you think about it ? I don't know what is the type of vala. Does anyone know ?
Maybe someone has an example of "asub" record process function which updates waveforms of string-type.
Cheers,
Pierre Perrier
-----Message d'origine-----
De : Steiner, Mathias [mailto:[email protected]]
Envoyé : vendredi 23 septembre 2011 16:47
À : Perrier Pierre
Objet : RE: Asub record problems to update waveforms of string-type
Pierre,
This may only be tangential to your problem, but I have found that when my aSub records update an 'analog out' variable, the value immediately updates everywhere.
OTOH, when updating strings or waveform strings, they only "sort of" update.
A caget will provide the updated string value, but EDM will show the old value. This is even true when the EDM window is killed and restarted -- which I don't understand at all.
Adding FLNK, "$(P):CRExeSeq.PROC" to your aSub, though not pretty, may fix the immediate problem.
Cheers -Mathias
From: [email protected] [mailto:[email protected]] On Behalf Of Perrier Pierre
Sent: Friday, September 23, 2011 10:01 AM
To: [email protected]
Subject: Asub record problems to update waveforms of string-type
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?
Cheers,
Pierre PERRIER
Stagiaire - MCO LIL
Sopra group.
Parc Innolin
9 rue du Golf 33700 Merignac
Phone : +33 (0)5 56 12 79 59
[email protected] - www.sopragroup.com
Ce message peut contenir des informations confidentielles dont la divulgation est à ce titre rigoureusement interdite en l'absence d'autorisation explicite de l'émetteur. Dans l'hypothèse où vous auriez reçu par erreur ce message, merci de le renvoyer à l’émetteur et de détruire toute copie.
Pensez à l’environnement avant d’imprimer.
- Replies:
- Re: Asub record problems to update waveforms of string-type Tim Mooney
- References:
- Asub record problems to update waveforms of string-type Perrier Pierre
- Navigate by Date:
- Prev:
RE: Asub record problems to update waveforms of string-type Allison, Stephanie
- Next:
RE: Asub record problems to update waveforms of string-type Steiner, Mathias
- 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
- Navigate by Thread:
- Prev:
RE: Asub record problems to update waveforms of string-type Steiner, Mathias
- Next:
Re: Asub record problems to update waveforms of string-type Tim Mooney
- 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
|