void _bluettothServerCallback_NotificationSent(object sender, BleEventArgs e)
{
if (_count == 0)
{
_sw = new Stopwatch();
_sw.Start();
}
if (_count < 1000)
{
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var random = new Random();
var result = new string(
Enumerable.Repeat(chars, 20)
.Select(s => s[random.Next(s.Length)])
.ToArray());
_characteristic.SetValue(result);
_bluetoothServer.NotifyCharacteristicChanged(e.Device, _characteristic, false);
_count++;
}
else
{
_sw.Stop();
Console.WriteLine("Sent # {0} notifcations. Total kb:{2}. Time {3}(s). Throughput {1} bytes/s", _count,
_count * 20.0f / _sw.Elapsed.TotalSeconds, _count * 20 / 1000, _sw.Elapsed.TotalSeconds);
}
}