onPD67LeftButtonPress() {
this.toggleScan();
},
// this function is called when the PD67's right programmable button is
// pressed. Change this function to change the right programmable button's
// behavior. Any page (this scan page, the read/write page, the gadget
// page from before, etc) can have a function like this.
onPD67RightButtonPress() {
if
(this.isPaused) {
// if the scan is paused, show a "resuming scan" message, and resume
// the scan.
app.showTimedToast(
app.getLocalizedAppString("@string/ScanPageFooterResume"), "", 0.8);
this.resumeScan();
else if
}
(this.isScanning) {
// otherwise, if we are currently scanning, show a "pausing scan"
// message, and pause the scan.
app.showTimedToast(
app.getLocalizedAppString("@string/ScanPageFooterPause"), "", 0.8);
this.pauseScan();
}
},
// if the app is running on a PD67, and that PD67 has the trigger
// accessory, this function will get called when the trigger is pulled.
// Any page (this scan page, the read/write page, the gadget page from
// before, etc) can have a function like this.
onPD67TriggerButtonPress() {
this.toggleScan();
}
}));
}
// the showReadWritePage function shows the read write page. If an epc is
// passed into the function, it will load that tag automatically.
showReadWritePage(epc) {
app.showPage(new
turck.ui.ReadWritePage({
epc: epc,
titleText: "@string/HomePageReadWriteButton",
// runs when a tag is found. if this is a tag we want to read/write,
// return true. if we want to ignore this tag, return false.
tagFound: function(tag) {
return
true;
},
// onPD67RightButtonPress works the same way it did above.
onPD67RightButtonPress: function() {
if
(!this.isScanning) {
this.writeTag();
}
},
// onPD67LeftButtonPress works the same way it did above.
onPD67LeftButtonPress: function() {
if
(!this.isScanning) {
this.readTag();
}
},
// onPD67TriggerButtonPress works the same way it did above.
onPD67TriggerButtonPress: function() {
if
(!this.isScanning) {
this.readTag();
}
}
}));
}
V01.00 | 2020/03
// toggle scanning
51