BACnet.Protocol.Services.Behaviour behaviour (bacstack v0.1.0-dev.1)

Copy Markdown View Source

Behaviour for BACnet confirmed and unconfirmed services.

All service modules implement this behaviour so that the stack can uniformly obtain the service name, determine confirmed vs unconfirmed, and convert the service parameters to/from APDU structures.

Summary

Callbacks

Whether the service is of type confirmed or unconfirmed.

Get the service name atom.

Get a service request APDU for this service.

Callbacks

confirmed?()

@callback confirmed?() :: boolean()

Whether the service is of type confirmed or unconfirmed.

get_name()

@callback get_name() :: atom()

Get the service name atom.

to_apdu(struct, t)

Get a service request APDU for this service.

For confirmed service requests, the following keys default to specific values, if not specified:

  • segmented_response_accepted: true
  • max_segments: :more_than_64
  • max_apdu: 1476
  • invoke_id: 0

These keys can be overriden through request_data. request_data may be ignored for unconfirmed services.

When setting max_segments, do not use :unspecified because it makes it for the server unable to determine if the response is transmittable or not. Thus :unspecified might be as low as maximum two segments. For that reason, always use a specific max segments or :more_than_64.