Skip to content
Version 6.1.0
Contact Us

BACnetStack_SetServiceEnabled

bool BACnetStack_SetServiceEnabled(
const uint32_t deviceInstance,
const uint32_t service,
const bool enabled);

Enables a BACnet service on a device.

The following services are automatically enabled:

  • ReadProperty (12)
  • Who-Has (33)
  • Who-Is (34) Answering Who-Has needs only Who-Has (33), which is enabled by default: the stack replies with I-Have to a Who-Has that matches one of its objects whenever Who-Has is enabled, whether or not I-Have (27) is.
Parameter Direction Description
deviceInstance in The instance of the device to enable the service on.
service in The BACnet service to enable, as a BACnetServicesSupported BIT NUMBER (not a service choice). Values 0..49 at this protocol revision; anything larger is rejected. Enabling a service this build does not execute is refused too: the call returns false and leaves the bit clear. That covers a service whose processor is compiled out by its STACK_OPTION_*, the virtual-terminal services (21-23, never implemented), the removed services (13, 24, 25), GetAlarmSummary and GetEnrollmentSummary unless STACK_OPTION_AE_ALARM_SUMMARY / STACK_OPTION_AE_ENROLLMENT_SUMMARY is defined together with STACK_OPTION_ALARMS_AND_EVENTS (deprecated; off in STACK_OPTION_TARGET_FULL), and the audit services and AuthRequest, which only a test-tool build executes. Disabling a service is always accepted (an unknown device or a value above 49 still returns false). The commonly needed ones: 12 = ReadProperty, 14 = ReadPropertyMultiple, 15 = WriteProperty, 16 = WritePropertyMultiple, 5 = SubscribeCOV, 38 = SubscribeCOVProperty, 27 = I-Have, 33 = Who-Has, 34 = Who-Is, 6 = AtomicReadFile, 7 = AtomicWriteFile, 10 = CreateObject, 11 = DeleteObject, 17 = DeviceCommunicationControl, 20 = ReinitializeDevice, 35 = ReadRange, 39 = GetEventInformation, 0 = AcknowledgeAlarm, 2 = ConfirmedEventNotification. See CASBACnetStack::BACnetServicesSupported for the complete enumeration.
enabled in True to enable, false to disable. Recommended value: true

True if successful, false if failed.

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