Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag encoding for object identifier not always correct #180

Open
1 of 3 tasks
cdriks opened this issue Nov 4, 2022 · 0 comments
Open
1 of 3 tasks

tag encoding for object identifier not always correct #180

cdriks opened this issue Nov 4, 2022 · 0 comments

Comments

@cdriks
Copy link

cdriks commented Nov 4, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant