I'm using qz-tray's excellent system to read USB scale data in Angular 7.
I have a read every second or so that gathers about 8 bytes which has
weight and scale status:
setInterval(this.readAgain, 1000); // called in ngOnInit()
And here's the class member:
readAgain(){
const getScaleData = async () => {
let deviceInfo = {"vendorId" : usb.vendor, "productId" :
usb.product, "usagePage" : "0x008d", "responseSize" : 10};
const scale_data = await qz.hid.readData(deviceInfo);
console.log("scale data =" + scale_data);
return scale_data;
}
getScaleData().then(result => {
console.log("result = " + result)
console.log(InterpretScaleData1(result));
})
}
My question has to do with the function InterpretScaleData. I've found for
this function to work I need to declare it *outside* my component class.
If I place this function as part of the class and try to reference it
(either as this.IntepretScaleData() or InterpretScaleData()) I get runtime
error saying that the function is not defined.
I'm confused by this behavior. Can anyone share some light as to why this
is so?
TIA
Harry
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.