Thursday, 6 June 2019

nodejs module might not working properly

While using node.js in Helpers.js there is this loop which my code stucks and won't run...exports.copyBufferBlocks = function copyBufferBlocks(buffer, values, offset) {for (var i = 0; i < values.length; i++) {console.log(values[i]);values[i].copy(buffer, offset + (i * 2), 0, 2);}};Essentially my code at some point is calling this function through the relevant modules.By issuingconsole.log(values[i]);I see that values[i] is not null..but whatever I do this is the ouputTypeError: values[i].copy is not a functionat Object.copyBufferBlocks (c:\Users\_______\Documents\Monitoring\Sub-Assy Monitor\newApp\modbus-stream-app\node_modules\modbus-pdu\lib\Helpers.js:155:13)​This is the Function I am Trying to use​writeMultipleRegisters(options?: StreamSimpleOptions & {values?: Buffer[];},next?: CallbackType): void;​and this is how I am using itconnection.writeMultipleRegisters({address: 0, values:buf1}, (err,res) => {...some code here})wherebuf1= Buffer.from(['0xff', '0xff', '0xff']);

Submitted June 06, 2019 at 01:49PM by umbaman

No comments:

Post a Comment