I think in the BleManager's OnBleMessageReceived when the parallel Stack is cleared of consumed items the list should either be iterated over in reverse, or i decremented whenever an item is removed:
// Run through the parallel stack, remove the commands that have consumed the BleObject
for (int i = _parallelStack.Count - 1; i >= 0; i--)
{
if (_parrallelStack[i].CommandReceived(obj))
{
_parrallelStack[i].End();
_parrallelStack.RemoveAt(i);
}
}
or
// Run through the parallel stack, remove the commands that have consumed the BleObject
for (int i = 0; i < _parrallelStack.Count; i++)
{
if (_parrallelStack[i].CommandReceived(obj))
{
_parrallelStack[i].End();
_parrallelStack.RemoveAt(i);
i--;
}
}
I think in the BleManager's OnBleMessageReceived when the parallel Stack is cleared of consumed items the list should either be iterated over in reverse, or i decremented whenever an item is removed:
or