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

fix tag encoding for object identifier #179

Closed
wants to merge 1 commit into from

Conversation

cdriks
Copy link

@cdriks cdriks commented Nov 3, 2022

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, 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 "c4" in place of "0c".

The encoded tags are correct for the other types, so I changed the encoded tags for tagNumber in [12,14]. In my case, the problem is fixed.

No idea, if it can bring to other bugs...

Thanks in advance,

Cédric

@cdriks
Copy link
Author

cdriks commented Nov 4, 2022

PR not to use! iAm Telegrams are not functional anymore. No idea, on how to correct it...
I opened an issue therefore : #180

Cédric

@cdriks cdriks closed this Nov 4, 2022
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

Successfully merging this pull request may close these issues.

1 participant