Skip to content

tag encoding for object identifier not always correct #180

@cdriks

Description

@cdriks

Node Version: 18.9.0

Node BACstack Version: 0.0.1-beta.14

  • Bug Report
  • Feature Request
  • Question

Current Behaviour (Bug Report)

Hi,

Trying to add a list item to the recipient-list of a notification class, it doesn't work.

I'm using it like this:

        let validDays = { value: { "value": [127], "bitsUsed": 7 }, type: bacstack.enum.ApplicationTags.BIT_STRING }; //every days true
        let fromTime = { value: new Date(1, 1, 1, 0, 0, 0), type: bacstack.enum.ApplicationTags.TIME };
        let toTime = { value: new Date(1, 1, 1, 23, 59, 59, 990), type: bacstack.enum.ApplicationTags.TIME };
        let deviceIdentifier = { value: { type: bacstack.enum.ObjectType.DEVICE, instance: clientDOI }, type: bacstack.enum.ApplicationTags.OBJECTIDENTIFIER };
        let processIdentifier = { value: clientDOI, type: bacstack.enum.ApplicationTags.UNSIGNED_INTEGER };
        let issueConfirmedNotifications = { value: true, type: bacstack.enum.ApplicationTags.BOOLEAN };
        let transitions = { value: { "value": [7], "bitsUsed": 3 }, type: bacstack.enum.ApplicationTags.BIT_STRING };


        this.bacstack.addListElement(ip, { type: bacstack.enum.ObjectType.NOTIFICATION_CLASS, instance: instance }, { id: 102, index: bacstack.enum.ASN1_ARRAY_ALL },
            [
                validDays,
                fromTime,
                toTime,
                deviceIdentifier,
                processIdentifier,
                issueConfirmedNotifications,
                transitions,
            ], err => {
                if (err) {
                    console.error(err);
                }
                callback();
            });

Using Wireshark, I can see an error (Malformed Packet), and that the tags are correct expect for the line :

let deviceIdentifier = { value: { type: bacstack.enum.ObjectType.DEVICE, instance: clientDOI }, type: bacstack.enum.ApplicationTags.OBJECTIDENTIFIER };

Where the tag is 0xc4. If I compare with existing items of recepient lists, it is there 0x0c.

On the other hand, the tag for the object identifier is correct (c4), for example for iAm messages, and 0c is there not correct...

I don't understand, in which case the OBJECTIDENTIFIER has to be changed into c4 and in which case it should be 0c.... So I can't propose a PR for it, sorry.
Wireshark makes the the difference between Object Identifier (c4) and Device Identifier (0c).

An Idea, how to correct it?

Thanks in advance,

Cédric

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions