Skip to content
Version 6.1.0
Contact Us

BACnetStack_Tick

bool BACnetStack_Tick();

Runs the stack.

Call it repeatedly, from one thread, for as long as the stack runs.

Main loop of the interface. Call this repeatedly from one thread for as long as the stack is running; nothing is sent or received between calls.

CALL CADENCE. There is no fixed requirement, but Tick() is the only pump for inbound frames, the data-link and BBMD loops, confirmed-request retries and timeouts, COV, trend logging and alarm evaluation. Ticking slowly delays every one of those: peers see late responses, timeouts fire late, and inbound frames are dropped once the host’s socket buffer fills. Aim for every 10-100 ms for a typical device; go faster if you need tight COV or alarm latency.

REQUIRED CALLBACKS. Register CallbackReceiveMessageForPort and CallbackSendMessageForPort before the first Tick(). Without CallbackReceiveMessageForPort the stack reads nothing, reports no error, and the device is silently deaf. Without CallbackSendMessageForPort it can answer nothing. Neither is optional in practice.

On each call, uses the receive message callback to get bytes from the socket, then processes them.Also handles any other clean - up or maintenance functions like COV expiration.

Returns true if any work was done during this tick, otherwise false. Work is defined as : -Processed an incoming BACnet message

  • Sent a BACnet message
  • Advanced BACnet/SC startup or connection state in a way that changed internal state or requested a websocket action

True if work was done, otherwise false.

Topic: Main loop and reset. Declared in CASBACnetStackDLL.h.