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: | Re: Stream device problem with redirection in @mismatch |
From: | Dirk Zimoch <[email protected]> |
To: | <[email protected]> |
Date: | Thu, 2 Apr 2015 16:10:43 +0200 |
Hello Jan, What is your terminator? I tried to reproduce your problem but everything seems to work. BTW: There are some other ways: 1. Use 3-state mbbi and %{off|on |INTERLOCK} format. 2. Use default value assignment (relatively new feature):%?... does not fail on mismatch but results in 0. (or "" for string formats).
in "get ch\$1 status\r\r\n = %?{off|on }%(\$2){INTERLOCK|}";If the device sends "INTERLOCK", %?{off|on } results in 0 (Off) and %(\$2){INTERLOCK|} in 1 (INTERLOCK)
If the device sends "off" or "on ", %(\$2){INTERLOCK|} results in 1 (Ok). Dirk On 01.04.2015 15:51, ruzickaj wrote:
Hi all, I have a device that sends a response on command "on/off" (requested value) or "INTERLOCK"). I use a @mismatch exception handler and redirection to record in order to catch this "INTERLOCK" string. After that I turn on or off the LED widget (Interlocked or Non-Interlocked). When I started IOC it gave me a buffer overflow. Buffer overflow is appeared after adding arg: (\$2). DB and proto file are following: DB: # requested value laser state record(bi, "$(device):StatEnable") { field(DESC, "Laser Enabled") field(DTYP, "stream") field(INP, "@fibotecLtbis.proto get_enable($(channel),$(device):StatEnableInterlock) $(port)") field(SCAN, "1 second") field(ZNAM, "Off") field(ONAM, "On") field(PINI,"YES") } #makro #channel=1 #device=name:ch1 # #Catching INTERLOCK message record(bi, "$(device):StatEnableInterlock") { field(DESC, "Laser Enabled") field(ZNAM, "INTERLOCK") field(ONAM, "Ok") field(VAL, "1") field(PINI,"YES") } Proto file: get_enable { out "get ch\$1 status"; in "get ch\$1 status\r\r\n = %{off|on } "; @mismatch {in "get ch\$1 status\r\r\n%(\$2){INTERLOCK}";}} Thanks Jan