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.
Since ADDriver inherits from asynNDArrayDriver which inherits from asynPortDriver, i figured i could use asynPortDriver's inherited methods to instantiate the socket client and asyn interface instead of creating everything again from scratch in c++.
So im inside areaDetector-R3-11/ADSimDetector/simDetectorApp/src/simDetector.cpp:1021 - that is, inside the simDetector class constructor - trying in all sorts of ways to create an asyn client to a socket... and failing.
What i managed to do so far: create an asynPort with drvAsynIPPortConfigure("PORT", "127.0.1.1:<test_port>") in the st.cmd file and, inside the cpp file:
#include <asynOctetSyncIO>
//(...) next line is inside the constructor
pasynOctetSyncIO->connect("PORT", 0, &pasynUserSelf, NULL);
but:
1 - im not even sure this is was i want to do: i think i would prefer to create the port and TCP connection already inside the cpp code instead of depending on cmd file;
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
1025 | pasynOctetSyncIO->write(NULL, pasynUserSelf, "TEST\n", strlen("TEST\n"), sizeof("TEST\n"));
In the doxygen pages ( https://epics-modules.github.io/master/asyn/R4-30/asynDoxygenHTML/classasyn_octet_client.html), i could only find
asynOctetClient->write instead of asynOctetSyncIO->write and they do seem different. In this documentation ( https://epics-modules.github.io/master/asyn/R4-43/asynDriver.html#asynOctet)
it isnt clear to me what is the expected *drvPvt...
Questions (finally):
1 - Can i instantiate my asynPort inside the cpp code to avoid using drvAsynIPPortConfigure?
2 - How can i write/read to the connected port?
3 - Is there a minimal working example which i can follow?
Im sorry if the doubts are trivial but i really have been lost in the documentation for some time now. Thanks in advance,
Marco
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.
|