@Override public void onScanResult(int callbackType, ScanResult result) { final BluetoothDevice device = result.getDevice();
if(device.getName()!=null) { mIsDeviceGanglion = device.getName().toUpperCase().contains(SampleGattAttributes.DEVICE_NAME_GANGLION); } else{//device name is not available mIsDeviceGanglion= false; }
runOnUiThread(new Runnable() { @Override public void run() {
Log.v(TAG,"Found LE Device "+ device.getName()); mLeDeviceListAdapter.addDevice(device); mLeDeviceListAdapter.notifyDataSetChanged(); } }); }
Can there be a public "sample app" / demo app? That, for example, displays the live 4 channel graph? The same screen might also display a numeric counter that accumulates any packet number sequencing errors. This could give a rough estimate of the connection quality. So that if you increased distance between the mobile and the Ganglion past a certain threshold, you may see this start to climb.
Max, do you use Github? If so you could just issue a pull request to Florian on your mods.
I was thinking of the very same thing! I am learning Florian's code to see how to at least keep a running count of dropped packets.
I have used MPAndroidChart (https://github.com/PhilJay/MPAndroidChart) in another application, for showing a live channel. This could be integrated into Florian's application.
It is already a demo app, but it doesn't have a graph implemented.
The functionality to keep track of any dropped packets is already in there - updatePacketsCount() is called every time new data is available and compares the packet ids to see how many packets have been lost.
The method getPacketLoss() calculates the packet loss in % of total packets.
Florian, cool. I have not run your demo app. What does it display / any user interface? Does it just display a percentage packet loss? I believe you said earlier that there was a substantial loss during startup phase, but none after that. How would the display make this more clear? A percentage figure does not make obvious the current packet loss. Does the app also display the current count of lost packets? So that one can see new packets lost when that increments?
It's not built in. But the Simblee has some spare analog to digital converter pins. You could rig up a (resistor) voltage divider and monitor the battery level on one of the spare aux channels.
This thread is not exactly what you want, but discusses the aux channels.
Comments
private ScanCallback mLeScanCallback = new ScanCallback() {
@Override
public void onScanResult(int callbackType, ScanResult result)
{
final BluetoothDevice device = result.getDevice();
if(device.getName()!=null) {
mIsDeviceGanglion = device.getName().toUpperCase().contains(SampleGattAttributes.DEVICE_NAME_GANGLION);
}
else{//device name is not available
mIsDeviceGanglion= false;
}
runOnUiThread(new Runnable() {
@Override
public void run() {
Log.v(TAG,"Found LE Device "+ device.getName());
mLeDeviceListAdapter.addDevice(device);
mLeDeviceListAdapter.notifyDataSetChanged();
}
});
}
@Override
public void onBatchScanResults(List<ScanResult> results) {
Log.w( "ScanCallback", "onBatchScanResults");
super.onBatchScanResults(results);
}
@Override
public void onScanFailed(int errorCode) {
Log.w("ScanCallback", "onScanFailed");
super.onScanFailed(errorCode);
}
};
static class ViewHolder {
TextView deviceName;
TextView deviceAddress;
}
the Ganglion connected to my Amazon (Android) tablet for 10 hours with
NO lost packets! I used a modified version of the demo app: