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

Default priority to 16 for commands. #103

Open
1 task done
dopry opened this issue Mar 12, 2018 · 1 comment
Open
1 task done

Default priority to 16 for commands. #103

dopry opened this issue Mar 12, 2018 · 1 comment

Comments

@dopry
Copy link
Contributor

dopry commented Mar 12, 2018

Node Version: N/A
Node BACstack Version: master, 4777725

  • Feature Request

Feature Request / Question

  • When writing commandable properties, priority should default to 16.

Current Behaviour

when writing a commandable proper if a priority is not provided, a parameter-out-of-range error is received from some devices.

Expected Behaviour

It would be nice if the priority defaulted to 16 as it does in the web services specification. This might not be exact to spec. Other devices might throw errors if we pass priority to non-commandable properties through APDU instead of WebServices. It looks like if an Object is commandable, then Priority Array and Relinquish Default are required. Maybe the library could check for those properties.

Steps to reproduce Issue

  • WritePropert to the Present Value of some commandable object...
const objectId = { type: Bacstack.enum.ObjectTypes.OBJECT_BINARY_VALUE, instance: 2};
function command(deviceIp, value, priority) {
    return new Promise((resolve, reject) => {
        client.writeProperty(deviceIp, objectId, 
           Bacstack.enum.PropertyIds.PROP_PRESENT_VALUE,
            // set binary-value present-values with enumerated BACnetBinaryPV(0=inactive, 1=active)
            [ { type: Bacstack.enum.ApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED, value } ],
            // must set priority when commanding, otherwise you will get an out of range exception.
            // { priority },
            (err, response) => (err) ? reject(err) : resolve(response)
        );
    });
};

command('192.168.1.81', 0, 8).then((response) => {
   console.log('then', JSON.stringify(response));
})
.catch((err) => {
   console.log('err', JSON.stringify(err));
});

you can uncomment the options line in the client.writeProperty method to see a working case.. 

@Apollon77
Copy link

These changes should be incorporated int https://github.com/BiancoRoyal/node-bacstack, please try this package and open issues at https://github.com/BiancoRoyal/node-bacstack/issues if it does not work as expected

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

2 participants