Skip to content
Version 6.1.0
Contact Us

BACnetStack_RemoveDevice

bool BACnetStack_RemoveDevice(const uint32_t deviceInstance);

Removes a device, and with it every object, property override and COV subscription that device owned.

Caution: removing a device has three side effects.

  1. Removing the first device re-targets the main-device APIs. Every function that takes no deviceInstance - the Channel, Group and Schedule configuration calls, the BACnet/SC UUID sync, the router and virtual-network checks - resolves “the device” as the FIRST device still registered. Remove the first one and the next device silently inherits all of them.
  2. A virtual device’s router mapping goes with it. Removing the device also removes it from its virtual network, so the same instance can be added to a virtual network again.
  3. Its data links are released and reset (in builds with Network Port objects). Every data link (BACnet/IP, MS/TP, BACnet/SC) bound to one of the device’s Network Port objects is freed for the next Network Port object of any device, and reset: a BACnet/IP data link loses its BBMD mode, BDT, FDT and foreign-device registration; a BACnet/SC data link closes every connection - CallbackSCStopListening is called for each URI it listens on and CallbackDisconnectWebsocket for each open connection (when registered), before this function returns - and loses its VMAC, accept URIs and hub and direct-connect configuration, but keeps the settings that apply to every BACnet/SC data link (UUID, timeouts and the like); an MS/TP data link loses its MAC address; and each data link’s router-port binding is dropped and, in a build with the physical router, the router ports are resolved again.
Parameter Direction Description
deviceInstance in The instance of the device to remove.

True if the device existed and was removed, false if no such device exists.

Topic: Device and services. Declared in CASBACnetStackDLL.h.