flinthamm
Posts: 2
Joined: Mon Mar 02, 2009 11:37 pm
Location: United Kingdom

VPort Binary Data

Mon Mar 02, 2009 11:49 pm

Hi,

I have a few pre-sales questions regarding the Windows ActiveX version of your Serial Tools product. The aim is to communicate with a 3rd party application over a serial connection using just one of your Serial Tools Virual Ports (acting like a null modem cable between the two).

1) Can the Vport class handle binary data e.g. Using VB6 byte array in the range 0-255?
2) Why does the Vport class not have similar functions to the Port class like 'StringToByteArray' and 'ByteArrayToString'?
3) I have tried passing the variant 'Data' from the Vports 'OnDataFromPort' event to the conversion functions of an instantiated standard 'Port' object but the data does not appear to convert? Can you confirm how to read/write binary data using the Vport class?
4) Unlike the standard 'Port' class there does not appear to be anyway of controlling the baud rate, parity, stop bits etc. Is it possible or does the port just get configured by the 3rd party application?
5) Are there any performance or functional limitations in the 14 day trial version of this component that I should be aware of?
6) Why are you better than your competitors offering similar products Fabulatech, Eltima, etc?

Many thanks in advance for you help in these matters.

User avatar
johan
GpsGate
Posts: 14371
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: VPort Binary Data

Tue Mar 03, 2009 12:10 pm

1 & 2) You use the method in the Port class for this.
3) Well it should... could you give an example of how it "does not appear to convert"?
4) There is no way of controlling the baud rate. The VPort class will accept any baud rate, and adjust automatically.
5) No. It is a fully functional trail.
6) This is up to you to determine.


Regards,
Johan

Franson Support

flinthamm
Posts: 2
Joined: Mon Mar 02, 2009 11:37 pm
Location: United Kingdom

RE: VPort Binary Data

Tue Mar 03, 2009 1:45 pm

Thanks for your comments.

Your documentation shows the 'StringToByteArray' and 'ByteArrayToString' functions only being used with the Port class not the VPort class. Although it does say it can be used by the Read/Write or OnRead Event it does not appear to work using the 'OnDataFromPort' event in the VPort class?

For a crude but relevant example:

Dim objPort as new SerialXP.Port
Dim objVPort as new serialXP.VPort

Assuming some data has been received (Which I know it has because Data contains a 32 character string)

Private Sub objVPort_OnDataFromPort(Data As Variant)

Dim binary_data() As Byte
Dim string_data As String

'// Commented
'string_data = objVPort.DataFromPort(0, 5000)
'string_data = cstr(Data)
string_data = Data

binary_data = objPort.StringToByteArray(string_data)

'// Type mismatch error (Array is unintialised?)
debug.print ubound(binary_data)

End Sub

Please can you give an example of how it can be used with the VPort class in the 'OnDataFromPort' event?

Many thanks.

User avatar
johan
GpsGate
Posts: 14371
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: VPort Binary Data

Thu Mar 05, 2009 1:52 am

Try this:

Code: Select all

    ' To convert from String to Byte() use Port.StringToByteArray
    
    ' Or use:
    ' Dim arr() As Byte
    ' arr = StrConv(str, vbFromUnicode)

    ' To convert from Byte() to String use Port.ByteArrayToString
    ' Or use:
    ' Dim arr() As Byte
    ' str = StrConv(arr, vbUnicode)

Regards,
Johan

Franson Support

Return to “SerialTools”