GXDN: Gurux Developer Network
SendSync Method (data, dataType, replyTerminator, count, waitTime, copyAllData, replyDataType, replyData)
NamespacesGurux.SerialGXSerialSendSync(Object, VariantType, Object, Int32, Int32, Boolean, VariantType, Object%)
Sends data synchronously.
A reply from the receiver, whether the send operation was successful, or if the data needs to be resent, is expected.
Parameters
data (Object)
Data to send.
dataType (VariantType)
The type that data is converted to, before sending.
replyTerminator (Object)
The end of the reply data.
count (Int32)
The number of reply data bytes to be read.
waitTime (Int32)
Maximum time, in milliseconds, to wait for reply data. Value -1 indicates infinite wait time.
copyAllData (Boolean)
If True, all the reply data is copied to ReplyData.
replyDataType (VariantType)
Determines the type of reply data.
replyData ( Object %)
Received reply data.
Return Value
True, if the send operation was successful.
Remarks
The ReplyTerminator can, for example, be a single byte ('0xA1'), a string ("OK") or an array of bytes.
Size of ReplyTerminator can be between 1 and n bytes.
Remarks
Every time the SendSync method is called, the reply buffer is reset, and all the earlier arrived data is removed. The new arriving reply data is copied to ReplyData.
If copyAllData is set to False, and there are more bytes than count parameter in the reply buffer, the surpassing bytes can be read using the GetReplyData method.
Examples
CopyVBScript
                'Send long and wait until OK reply is received or 5 seconds.
'Data is returned as string.
dim dataToSend as long
dataToSend = "256"
dim ReplyData as object
GXSerial1.SendSync dataToSend, GX_VT_INT32, "OK", 0, 5000, True, GX_VT_STR, ReplyData
GXSerial1.SendSyncComplete = true

'Send data and wait until 4 bytes is received.
'Received data is received as long (Int32)
GXSerial1.SendSync dataToSend, 0, 0, 4, -1, false, GX_VT_INT32, ReplyData
GXSerial1.SendSyncComplete = true
See Also

Assembly: Gurux.Serial (Module: Gurux.Serial) Version: 5.0.0.2