Using VaCapture

I am using ASync32 with Delphi and am using the VaComm component to send and receive messages. While it is working, as I create communications functions for various commands, as the receive messages become more complex, I am looking for ways to simplify receiving and buffering entire packets. Each of my Receive packets starts with a Hex Code of FB and ends with a Hex Code FE. This seems like the perfect opportunity to use VaCapture based on the documentation, however, in-practice, I've not been able to figure out how to make it work. Here's what a receive message looks like: FB0000200210020131FE
This is a simple one that I am able to parse, however, there are some much more complex and lengthy messages that are going to be more complex for me to parse manually.

Can someone please point me in the right direction?

Did you try to setup VaCapture like:

  vacapture1.DataStart := chr($FB);
  vacapture1.DataFinish := chr($FE);

Then the event OnMessage() should be triggered with string value chr(00)+chr(00)+chr(20)+chr(02)+chr(10)+chr(02)+chr(01)+chr(31)

Ok, So I did have DataStart and DataFinish setup as you noted in the properties, however, just to be sure, I went ahead and added to the FormActivate procedure.

Where I'm lost is, I have no idea how to read the captured data out.
When I'm using the VaComm component, I just read it out like so: Receive:=StringToHex(VaComm1.ReadText);

However, I have absolutely no clue how I should read it out of the VaCapture component.

I'm writing my output to a memo control so that I can view both the transmit and receive. It works using ReadText, so I know that the hardware and this incarnation of software is working, I'm just very lost when it come to VaCapture and it's use. I have read the documentation, however, I seem to be missing something.

Another observation is that if I set the TVaCapture component Active=FALSE, my messages are still being intercepted and cannot be read using ReadText. The only way I can see them with ReadText is to Disassociate Comm from it. I'm only doing this to revert my application back to a working state.

Ok, i must admit I'm a bit rusty and missed the simple "Data" variable while using the OnMessage event. I am now getting the data back almost as expected, However... When I use ReadData and run it through my StringToHex function I get this back: FB0000200210020131FE, when I receive the same data back through TVaBuffer and run it through StringToHex, I get the following back: 2020200210020131. The two nulls at the beginning of the string were converted to space values. Any ideas?

When you connect TVaCapture, you do NOT need to read the data, the data is provided via the event OnMessage and its Data parameter. I'm not sure how you combine this with a TVaBuffer as this isn't needed.

When I said TVaBuffer, I actually meant to say TVaCapture. The results I expect back is 0000200210020131 (which is what I'm seeing with my packet sniffer), however, I'm getting 2020200210020131 when using TVaCapture.

We've investigated this and this is because internally 00 is not an allow character. We've added an extension for it, i.e. property VaCapture.DataType that you can set to daBinary to handle this. The next update will have this extension.