Skip to content
Version 6.1.0
Contact Us

BACnetStack_RegisterCallbackMSTPSendBytes

void BACnetStack_RegisterCallbackMSTPSendBytes(
bool (*FPCallbackMSTPSendBytes)(const uint32_t networkPortInstance, const uint8_t *buffer, const uint16_t length));

Registers the callback the stack calls from BACnetStack_LoopMSTP() to write one complete MS/TP frame to the wire.

THE CALLBACK MUST NOT RETURN UNTIL THE LAST STOP BIT HAS LEFT THE TRANSMITTER (transmit complete, not transmit-buffer empty). The stack releases the RS-485 driver as soon as it returns (BACnetStack_RegisterCallbackMSTPTransmitEnable()), because the clause on sending a frame (135-2024 clause 9.5.5.1) has the node keep its driver on until the last octet is out, no longer than a short post-drive delay, and then switch it off and the receiver on. A send that only queues the octets cuts the tail off every frame. If the transceiver echoes what is sent, the echo may come back through the receive callback; the stack recognises and discards the echo of each frame it sent. Return true when the frame was sent, false when it was not.

See also: CASBACnetStack::FPCallbackMSTPSendBytes

Parameter Direction Description
FPCallbackMSTPSendBytes in The function pointer for the CallbackMSTPSendBytes function. See CASBACnetStack::FPCallbackMSTPSendBytes for more info.

FPCallbackMSTPSendBytes

Topic: Data link and system callbacks. Declared in CASBACnetStackDLL.h.