I'm having issues with tdSensor() and tdSensorvalues()
I'm running this on NodeJS using FFI to call the C functions. The computer this is run on is running Telldus Center 2.1.2.
Code: Select all
Definitions of tdSensor and tdSensorvalue:
tdSensor: ['int',['char*','int','char*','int','int*','int*']],
tdSensorValue: ['int',['char*','char*','int','int','char*','int','int*']]
Code: Select all
var protocolPtr = ref.alloc('char');
var modelPtr = ref.alloc('char');
var datatypePtr = ref.alloc('int');
var idPtr = ref.alloc('int');
while (variables.telldus.tdSensor(protocolPtr,20,modelPtr,20,idPtr,datatypePtr) == 0) {
console.log("success");
console.log(protocolPtr.deref());
console.log(modelPtr.deref());
console.log(idPtr.deref());
console.log(datatypePtr.deref());
var valuePtr = ref.alloc('char');
var timePtr = ref.alloc('int');
p = variables.telldus.tdSensorValue(protocolPtr,modelPtr,idPtr.deref(),datatypePtr.deref(),valuePtr,32,timePtr);
console.log("Result: " + p);
};
Code: Select all
102
116
135
3
Result: -4
102
116
135
1
Result: -4
If i register a callback to tdRegisterSensorEvent(), i get the following in return:
Code: Select all
Received an event on sensor with id(135) that reported value: 4.7
fineoffset : temperaturehumidity : 135 : 1 : 4.7 : 1486064027
Received an event on sensor with id(135) that reported value: 59
fineoffset : temperaturehumidity : 135 : 2 : 59 : 1486064027
Hopefully someone can spot the issue and help me resolve it.
Thanks in advance