BLE SCAN question.
Posted: 22:18, 15 Jul 2015
I haven't used Java since I left school 15 years ago, can some one please point me to the right direction.
Here is a snippet of code from app.js of BLE SCAN. I programmed some random payload bytes to the BLE device, and I was able to read the RSSI and device name, is there a way to read the payload.
Where can I find the data structure of "device", there is device.name, device.rssi and device.address, maybe there is a device.payload?
Thanks for your help.
$.each(app.devices, function(key, device)
{
// Only show devices that are updated during the last 10 seconds.
if (device.timeStamp + 10000 > timeNow)
{
// Map the RSSI value to a width in percent for the indicator.
var rssiWidth = 1; // Used when RSSI is zero or greater.
if (device.rssi < -100) { rssiWidth = 100; }
else if (device.rssi < 0) { rssiWidth = 100 + device.rssi; }
// Create tag for device data.
var element = $(
'<li>'
+ '<strong>' + device.name + '</strong><br />'
// Do not show address on iOS since it can be confused
// with an iBeacon UUID.
+ (evothings.os.isIOS() ? '' : device.address + '<br />')
+ device.rssi + '<br />'
+ '<div style="background:rgb(225,0,0);height:20px;width:'
+ rssiWidth + '%;"></div>'
+ '</li>'
);
$('#found-devices').append(element);
}
});
Here is a snippet of code from app.js of BLE SCAN. I programmed some random payload bytes to the BLE device, and I was able to read the RSSI and device name, is there a way to read the payload.
Where can I find the data structure of "device", there is device.name, device.rssi and device.address, maybe there is a device.payload?
Thanks for your help.
$.each(app.devices, function(key, device)
{
// Only show devices that are updated during the last 10 seconds.
if (device.timeStamp + 10000 > timeNow)
{
// Map the RSSI value to a width in percent for the indicator.
var rssiWidth = 1; // Used when RSSI is zero or greater.
if (device.rssi < -100) { rssiWidth = 100; }
else if (device.rssi < 0) { rssiWidth = 100 + device.rssi; }
// Create tag for device data.
var element = $(
'<li>'
+ '<strong>' + device.name + '</strong><br />'
// Do not show address on iOS since it can be confused
// with an iBeacon UUID.
+ (evothings.os.isIOS() ? '' : device.address + '<br />')
+ device.rssi + '<br />'
+ '<div style="background:rgb(225,0,0);height:20px;width:'
+ rssiWidth + '%;"></div>'
+ '</li>'
);
$('#found-devices').append(element);
}
});