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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Packed Data Message Formats With Fixed-Length Strings |
From: | Dirk Zimoch <[email protected]> |
To: | <[email protected]> |
Date: | Thu, 10 Nov 2016 08:56:09 +0100 |
Hi Iain,In StreamDevice you can use the variable MaxInput instead of a terminator if you have a fixed number of input bytes.
To give more advice I would need to see a message. 'Python struct format "128s12ii"' does not mean anything to me.
Dirk On 08.11.2016 17:46, Iain Marcuson wrote:
I am writing EPICS code to interface with a custom device. The device protocol is fixed-length messages. I can read and write the message parameters with Stream Device, and have done so successfully except for the fixed-length string, which I have had to bypass in assorted ways. The output command message has the Python struct format "ii128s12i". The input message has the Python struct format "128s12ii". The "12i" refers to 12 parameters, passed or returned. My two questions are: 1) How can I parse the fixed-length string? The normal string-handling routines fail either because of terminator characters in the string or because the string is two long. 2) I handle the parameters by having a PV for each parameter, and a separate "group" of PVs for each command. Is this best practice? Thank you, Iain Marcuson.