Qianjun Wang
As an aside, following eith's suggestion be aware that if you do not implement such a count or something similar a BLE disconnect followed by a reconnect will silently discard the buffer contents at the time of BLE disconnect (in our experience, may be different with latest Softdevice/IDEs) and those packets discarded will be lost. Tracking received packets allows reloading the buffer and hence BLE transmission.
As an aside, following eith's suggestion be aware that if you do not implement such a count or something similar a BLE disconnect followed by a reconnect will silently discard the buffer contents at the time of BLE disconnect (in our experience, may be different with latest Softdevice/IDEs) and those packets discarded will be lost. Tracking received packets allows reloading the buffer and hence BLE transmission.