Add get-module-state.js and the relevant device command id.

This commit is contained in:
László Monda
2017-12-15 02:58:51 +01:00
parent b8be1c965b
commit 3967593c9c
3 changed files with 17 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env node
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
function getModuleState() {
const payload = new Buffer([uhk.usbCommands.getModuleProperties, 1]);
console.log('Sending ', uhk.bufferToString(payload));
device.write(uhk.getTransferData(payload));
const receivedBuffer = device.readSync();
console.log('Received', uhk.bufferToString(receivedBuffer));
setTimeout(getModuleState, 500)
}
getModuleState();