addDevice method

void addDevice(
  1. FakeBacnetDevice device
)

Adds a device; it answers Who-Is and requests.

Implementation

void addDevice(FakeBacnetDevice device) {
  _devices[device.deviceId] = device;
  device._listeners.add(
    (object, property) => _notify(device, object, property),
  );
  device._eventListeners.add((notification) {
    if (device.communication != BacnetCommunicationState.enable) return;
    unawaited(
      Future<void>.delayed(latency + device.latency, () {
        if (!_events.isClosed) _events.add(notification);
      }),
    );
  });
}