Skip to content

BACnet encoding #58

@bachp

Description

@bachp

BACnet uses ASN.1 to encode it's datastructures. It also defines an encoding that is similar but not the same as the standard BER encoding.

The following are the main difference I identified between the BACnet Encoding and BER:

  • While BACnet also uses a TLV encoding simular to BER, it uses a different header:
|------|------|------|--------|------|------|------|------|
|   0  |   1  |  2   |   3    |   4  |  5   |  6   |    7 |
|------|------|------|--------|------|------|------|------|
|  Tag Number                 |Class |Length/Value/Type   |
|------|------|------|--------|------|------|------|------|
  • Because of the above header, the class attribute can is only one bit. This means the standard only supports context and application tagging.
  • A list off application specific datatypes is defined in the standard:
0 = Null
1 = Boolean
2 = Unsigned Integer
3 = Signed Integer (2's complement notation)
4 = Real (ANSI/IEEE-754 floating point)
5 = Double (ANSI/IEEE-754 double precision floating point)
6 = Octet String
7 = Character String
8 = Bit String
9 = Enumerated
10 = Date
11 = Time
12 = BACnetObjectIdentifier

These are used instead of the universal ones.

I see the following possible ways of implemementing this:

  1. Add the encoding as an option to the current BER encoding, similart to CER and DER.
  2. Add it as a completely new encoding alongside the current BER encoding.
  3. Implement it in a spearate crate.

Currently I'm playing around with the code to see if option 1 or 2 is a better fit.

@XAMPPRocky I would like to get your opinion which option you think is preferable? Specifically I would like to know if you see the BACnet encoding as part of this repo, or if I should go with a separate one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/codecRelated to a new or existing ASN.1 codec.help wantedExtra attention is neededkind/enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions