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: Using asyn as a TCP socket client in AD ioc |
From: | Mark Rivers via Tech-talk <tech-talk at aps.anl.gov> |
To: | "Marco A. Barra Montevechi Filho" <marco.filho at lnls.br>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Thu, 23 Feb 2023 00:33:56 +0000 |
Hi Marco, 1 - Can i instantiate my asynPort inside the cpp code to avoid using drvAsynIPPortConfigure? Yes, you can simply call drvAsynIPPortConfigure() from your cpp code. drvAsynIPPortConfigure is both a C callable function and an iocsh command. The C callable function
drvAsynIPPortConfigure is defined in drvAsynIPPort.h. Here is an example of calling drvAsynIPPortConfigure() from within C++ code: However, in general I prefer to create the port in the st.cmd file. That way you can easily enable asynTrace in your st.cmd file to see the communication to the device.
You first need to call pasynOctetSyncIO->connect() to connect an asynUser structure to the port you created above. You do this using the name of the port you passed to
drvAsynIPPortConfigure. It does not matter if you created that port in the st.cmd file or in your C++ code. Here is an example from the same driver above: You tried to do this, but you passed &pasynUserSelf. That won’t work, pasynUserSelf is the asynUser for your asynPortDriver object. You need to allocate a new asynUser
structure and pass that. In this example that pasynUser is a private class variable: You then call pasynOctetSyncIO->write()
or pasynOctetSyncIO->writeRead() 3 - Is there a minimal working example which i can follow? The example above is this: https://github.com/epics-modules/quadEM/blob/master/quadEMApp/src/drvNSLS_EM.cpp There are several areaDetector drivers that do exactly what you are doing, make a simple socket connection to a vendor server. ADPilatus talks to the Dectris camserver. It calls drvAsynIPPortConfigure in the st.cmd https://github.com/areaDetector/ADPilatus/blob/master/pilatusApp/src/pilatusDetector.cpp ADmarCCD talks to the Rayonix server. It calls drvAsynIPPortConfigure in the st.cmd https://github.com/areaDetector/ADmarCCD/blob/master/marCCDApp/src/marCCD.cpp Search for “pasynOctetSyncIO” in both of those drivers. Mark From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of
Marco A. Barra Montevechi Filho via Tech-talk Hello all, Context: I have an AreaDetector ioc which i want to communicate with a simple TCP socket. Since its heavily based on ADSim, i figured i would want to test the basic functionalities
in ADSimDetector before trying the implementation in the actual ioc. I have my ADSimdetector from areaDetector-R3-11. but: 2 - i dont know how to use the write method. I tried
pasynOctetSyncIO->write(NULL, pasynUserSelf, "TEST\n", strlen("TEST\n"), sizeof("TEST\n")); and similar lines but i get:
../simDetector.cpp:1025:35: error: cannot convert ‘asynUser*’ to ‘const char*’ in argument passing Questions (finally): 1 - Can i instantiate my asynPort inside the cpp code to avoid using drvAsynIPPortConfigure?
Aviso Legal: Esta mensagem e seus anexos podem conter informações confidenciais e/ou de uso restrito. Observe atentamente seu conteúdo e considere eventual consulta ao remetente antes
de copiá-la, divulgá-la ou distribuí-la. Se você recebeu esta mensagem por engano, por favor avise o remetente e apague-a imediatamente. Disclaimer: This email and its attachments may contain confidential and/or privileged information. Observe its content carefully and consider possible querying to the sender before
copying, disclosing or distributing it. If you have received this email by mistake, please notify the sender and delete it immediately. |