Hi There,
I’m fairly new to using Estimote’s Products. I’m in the process of testing and trying to build an app that uses LTE Beacons to scan for UWB Beacons and then reports them back to the cloud. I’m aware that there is an app that has a similar functionality to this, but it rather scans for BLE/legacy beacons.
The issue that I’m having is I’m trying to use the UWB Ranging API instead of ble.startScanning(). Has anyone completed something similar to this before - if so would you mind giving me a idea of how you used this to build your app.
Many Thanks
This is a sample of the code I’m using - I do not know how to handle the panID for the UWB I purchased, it’s using the default at the moment.
var isUwbRangingInProgress = false; // Flag to track UWB ranging operation
function scanForAssets() {
var assets = ;
var LookID = ;
if (isUwbRangingInProgress) {
uwb.stop()
// UWB ranging is already in progress, skip starting a new one
return;
}
// Set the flag to indicate that UWB ranging is in progress
isUwbRangingInProgress = true;
// Using the TOF_RESPONDER role
var role = uwb.Role.TOF_RESPONDER;
// Setting the options for the UWB ranging
var options = {
timeout: 0,
mode: uwb.Mode.LONG_RANGE,
panID: 0X44,
minDistance: 0.5,
maxDistance: 10,
blinkPeriod: 1000
};
// Optional callback function to handle the distance measurements
var callback = function(distance) {
// Process the distance data as needed
sync.now(),
print(id=${distance.id} distance=${distance.dist}
)
assets.push(distance.dist);
LookID.push(distance.id)
};
// Start the UWB ranging
uwb.start(role, options, callback)
.then(() => {
// UWB ranging operation completed successfully
isUwbRangingInProgress = false; // Reset the flag
})
}
// I call function immediately and also set a timer to repeat it 5 sec
scanForAssets();
timers.repeat(‘5 sec’, scanForAssets);