jrowberg / bglib

BGLib implementation for Bluegiga BLE Bluetooth Smart modules
Other
240 stars 170 forks source link

Bug when parsing very long packets #17

Open mjbrown opened 9 years ago

mjbrown commented 9 years ago

There is a bug in your C# and Python when parsing very long packets. I ran across it in my fork. Nobody has probably seen it before because seldom are there packets larger than 256 bytes. Here's the fixes in a diff:

diff --git a/MSVCSharp/BGLib.cs b/MSVCSharp/BGLib.cs index 55aac3c..8e42338 100644 --- a/MSVCSharp/BGLib.cs +++ b/MSVCSharp/BGLib.cs @@ -1816,7 +1816,7 @@ namespace Bluegiga { bgapiRXBuffer[bgapiRXBufferPos++] = ch; if (bgapiRXBufferPos == 2) { // just received "Length Low" byte, so store expected packet length