Hi,
I'm currently writing a motor driver and I'm not sure on the best
way to implement a particular aspect of it. The main control link
to the hardware is via TCP/IP, on startup the driver registers
parameters of interest on the controller and the controller then
sends all subscribed information out via UDP broadcasts. I think I
need to create a udp server on the IOC, so far I am doing the
following:
IOC boot script:
#TCP port for control, this works
drvAsynIPPortConfigure("PCS1_CTRL", "192.168.113.10:51512", 100,
0, 0)
asynOctetSetInputEos("PCS1_CTRL", 0, "\r\n")
asynOctetSetOutputEos("PCS1_CTRL", 0, "\r\n")
# Configure UDP port for Walter and Bai streams
drvAsynIPServerPortConfigure(PCS1_UDP,"192.168.113.12:51513 udp",
10, 0, 0, 0)
# Configure Walter and Bai PCS8000 controller
pcsControllerConfig(PCS1, 0, 2, 20, 20)
# Configure Walter and Bai PCS8000 Axis
pcsAxisConfig(PCS1, 1)
# Configure Walter and Bai PCS8000 Axis
pcsAxisConfig(PCS1, 2)
Driver constructor(class pcsController: public
asynMotorController ):
/* Connect to pcsController controller TCP for control */
status = pasynOctetSyncIO->connect(lowLevelPortName, 0,
&pasynUserController_, NULL);
pasynUserUDPStream = pasynManager->createAsynUser(0,0);
status = pasynManager->connectDevice(pasynUserUDPStream,
streamPortName,0);
pasynInterface =
pasynManager->findInterface(pasynUserUDPStream, asynOctetType,
1);
pasynOctet = (asynOctet *) pasynInterface->pinterface;
octetPvt=pasynInterface->drvPvt;
Driver poll():
status = pasynOctet->read(octetPvt, pasynUserUDPStream,
rxBuffer, 65535 - 1,
&nBytesIn, &eomReason);
In the poll() method or perhaps a separate thread elsewhere I
know I will have to update the asyn parameters manually and call
callParamCallbacks() to get the record to update. Am I going about
this the right way?
Thanks in advance
Lee
--
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United
Kingdom