Skip to content
Version 6.1.0
Contact Us

BACnetStack_UpdateVirtualNetworkNumber

bool BACnetStack_UpdateVirtualNetworkNumber(
const uint32_t deviceInstance,
const uint16_t oldNetworkNumber,
const uint16_t newNetworkNumber);

Changes a virtual network’s number in the virtual router’s routing map, and the Network_Number of every virtual Network Port object on that network: the main device’s (created by BACnetStack_AddVirtualNetwork()) and each virtual device’s (created by BACnetStack_AddDeviceToVirtualNetwork()).

The ports advertise the number the router routes. Their new number is the active value; a pending Network_Number a client wrote is kept, and activating it later moves the map from the number set here.

A virtual network can also be renumbered through the Network Port object: a client’s WriteProperty of its Network_Number is held pending, and when it is activated (ReinitializeDevice ACTIVATE_CHANGES or WARMSTART, or BACnetStack_ActivateNetworkPortPendingChanges()) the stack moves the virtual router’s map from the port’s current number to the new one. The activation is refused, and nothing is activated, if the pending number is already a virtual network, is the active or pending Network_Number of another, non-virtual Network Port object of the device, or is a physical router port’s network or operator route.

A CallbackGetPropertyUnsignedInteger that answers Network_Number is not asked: the stack serves the Network Port object’s Network_Number itself.

The device must already be a virtual router - call BACnetStack_AddVirtualNetwork() first.

Parameter Direction Description
deviceInstance in The device instance of the main device, matching the deviceInstance originally passed to BACnetStack_AddVirtualNetwork().
oldNetworkNumber in The current network number of the virtual network. Must exist in the virtual router.
newNetworkNumber in The new network number for the virtual network. Must not already be in use as a virtual network; 0 (local) and 65535 (broadcast) are reserved and rejected.

True if successful - including the no-op case where oldNetworkNumber equals newNetworkNumber. False if deviceInstance does not match the main device, the device is not a virtual router, the old number does not exist, the new number is a duplicate or reserved, the physical router already serves the new number, the new number is the Network_Number (active or pending) of another, non-virtual Network Port object of the device, or the stack was built without STACK_OPTION_VIRTUAL_ROUTER.

Topic: Routing and virtual networks. Declared in CASBACnetStackDLL.h.