Hi,
I have a large Provision handling different device Models. Now I have a device which is rather buggy and does not accept boolean values for most of the paths. Using
declare(....,....,{ value: ["0", 'xsd:string'] });
works though.
Now I thought to overwrite the declare function. I cannot think of another way besides using dozens of else/if and that would seriously mess up my code.
However as I’m not experienced in node/js I need a little help. Below doesn’t work
if (MODEL === 'buggyDevice') {
var origDeclare = declare; //does not work
declare = function (path, timestamps, values) {
if (values.value === false) {
values.value = ["0", 'xsd:string'];
}
if (values.value === true) {
values.value = ["1", 'xsd:string'];
}
return origDeclare(path, timestamps, values);
}
}
thank you
Simon