dm_SendRecv (send & receive a block of bytes)
Function
int16 dm_SendRecv(uint16 uiPortNo, uchar08 *ucpSendBuf, uchar08 ucBytesCount, uchar08 *ucpRecvBuf, uint16 uiBufSize, char08 *cpErrMsg);
Description
Send & receive or take acknowledge for a block of bytes between Master and Device.
Input Parameters
- uchar08 uiPortNo – (virtual) comport number in order to communicate with Master
- char08 *ucpSendBuf – pointer to a data buffer to send
- uchar08 ucBytesCount – bytes number to send from ucpSendBuf
- uint16 uiBufSize – size of receive data buffer ucpRecvBuf
Output parameters
- char08 *ucpRecvBuf – pointer to a data buffer to return received data
- char08 *cpErrMsg – pointer to buffer to return error message (minimum 256 bytes)
Return value
Number of received bytes if success or negative error number.
Example
char08 cpErrMsg[256];
uchar08 ucpBuf[] =Â { 0x12, 0x34 }, ucAck;
int16 iRes = dm_SendRecv(iPortNo, ucpBuf, 2, &ucAck, 1, cpErrMsg);