I often have many questions about which documents to read or from which examples to learn.
Thank you.
Hi Mark,
Your guess is absolutely right.
I want to send a 24-byte hex packet and receive a packet which use same format.
I have found something may be helpful in your another answer.
So I will start to learn with
Thank you for your generous help.
Regards,
YaweiZhang
At 2020-01-06 21:19:33, "Mark Rivers" <[email protected]> wrote:
>Hi YaweiZhang,
>
>
>I looks like you need to send a 24-byte packet and receive a 4-byte response?
>
>
>Is the output packet binary or hex ASCII characters?
>
>
>Is the response binary or hex ASCII characters? Because you do not show any terminators on input or output I suspect it is binary, not hex.
>
>
>Stream device may be able to construct the Check Code for you for with its "checksum" converter, but you need to see if your check code uses one of the algorithms that stream device supports.
>
>
>I think you will need other software to create the timestamp bytes.
>
>
>One way to do this is not to use stream device at all, but just use an asyn record. Your Python code would build the entire 24-byte array and write it to the BOUT field of the asyn record. The asyn record would then read the 4 byte response into the BINP field.
>
>
>Alternatively you could write a little C++ driver based on asynPortDriver to build and send the string and parse the response.
>
>
>Mark
>
>
>
>________________________________
>From: 张亚威 <[email protected]>
>Sent: Sunday, January 5, 2020 9:43 PM
>To: Mark Rivers
>Cc: [email protected]
>Subject: Re:RE: help for streamDevice question
>
>
>Sorry.
>I want to send many socket packages to a device.
>A single package consist of a 8 bytes time stamp(changeable), a 4 bytes protocol number, a 4 bytes determined number and a 8 bytes check code(changeable).
>
>Time Stamp
>
>
>Protocol
>
>Vision
>
>
>Command
>
>
>Check Code
>
>
>8 bytes
>
>
>4 bytes
>
>
>4 bytes
>
>
>8 bytes
>
>
>What I suppose is to use hex format to save the data.
>So I write record like this:
>record(waveform,"data")
>{
>field (DTVP, "stream")
>field(INP, "@devTest.proto array_in L0")
>field(FTVL, "LONG")
>field(NELM, "256")
>field(PINI, "YES")
>field(SCAN, "Passive")
>}
>and proto file
>data0 = 0x23;
>array_in {
>out "\${data0}";
>in "%4x";
>}
>In this case, only determined data can be sent. I hope to sent some changeable data which produced by a python program in real-time.
>
>Thank you very much.
>
>YaweiZhang
>
>
>
>
>At 2020-01-06 00:22:42, "Mark Rivers" <[email protected]> wrote:
>I think you need to be more specific. What is the format of the strings you are trying to write and read?
>
>Mark
>
>
>From: Tech-talk <[email protected]> On Behalf Of ??? via Tech-talk
>Sent: Sunday, January 5, 2020 8:22 AM
>To: [email protected]
>Subject: help for streamDevice question
>
>hi,
>
> I want to use streamDevice to communicate with a device just like https://epics.anl.gov/tech-talk/2016/msg01310.php does.
> My problem is that I don't know how to write changeable data into record, which include time and a time-dependent encryption number.
> Could someone give me a hand?
> Thanks a lot.
>
>Regards,
>YaweiZhang
>
>
>
>
>
>
>