Skip to content
Version 6.1.0
Contact Us

BACnetStack_SendRegisterForeignDevice

bool BACnetStack_SendRegisterForeignDevice(
const uint32_t networkPortInstance,
const uint16_t timeToLive,
const uint8_t * connectionString,
const uint8_t connectionStringLength);

Sends a RegisterForeignDevice BVLL message to a specified BBMD (BACnet Broadcast Management Device) to register as a foreign device on the BACnet IP network.

SIDE EFFECTS of a successful registration (the BBMD’s BVLC-Result of success): the IPv4 Network Port object’s BACnet_IP_Mode becomes FOREIGN, and the first success after this device was unregistered (it never registered, was refused with a NAK, or let the time-to-live lapse) also announces it with an I-Am sent through the BBMD (Distribute-Broadcast-To-Network), so it is discoverable across the internetwork. A renewal sends no I-Am. FD_BBMD_Address and FD_Subscription_Lifetime are present and writable on every BACnet/IP Network Port (135-2024 cl. 12.56.41, 12.56.42), so a BACnet client can write them: a written value is held until a ReinitializeDevice of ACTIVATE_CHANGES or WARMSTART and then handed to the host’s Set callbacks. The stack does not re-register by itself; the host’s next call to this function decides where to register, and for how long.

PRECONDITION: BACnetStack_RegisterCallbackGetSystemTime() must have been registered first; without a clock the time-to-live cannot be tracked and this returns false before sending.

connectionStringLength must be exactly 6 (BACnet/IP). Any other length is refused before anything is sent, and this returns false.

BACnet reference: ANSI/ASHRAE 135-2024 Annex J: J.2.6 (Register-Foreign-Device) and J.5.2.2 (its use by a BBMD).

Parameter Direction Description
timeToLive in How many seconds this device has to register again with the BBMD; if it does not, the BBMD may drop it from its Foreign Device Table. THE STACK DOES NOT AUTO-RENEW. It tracks the deadline locally and, when it passes, drops its own foreign-device state and resets the Network Port’s BACnetIPMode to normal. The host must call this function again before the time-to-live expires. 0 is accepted but expires on the next tick, cancelling the registration locally while the BBMD may still hold the entry - it does NOT mean “forever”.
Parameter Direction Description
networkPortInstance in The IPv4 Network Port object instance to send on.
connectionString in The connection string that represents the IP Address and Port of the BBMD to send the RegisterForeignDevice message. Example: 0xC0, 0xA8, 0x01, 0x05, 0xBA, 0xC0 is 192.168.1.5:47808. It must be exactly 6 octets; any other connectionStringLength returns false and sends nothing.
connectionStringLength in The number of bytes in the connection string.

True if successfully sent, otherwise false.

Topic: BACnet/IP: BBMD and foreign devices. Declared in CASBACnetStackDLL.h.