Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push multiple messages to a subscriber #23

Merged
merged 1 commit into from
Nov 26, 2013
Merged

Conversation

RhinoLance
Copy link
Contributor

Pushes multiple messages to a subscriber where more than one delimiter exists in a message.

As an example, let's assume that in our app, we've called
bluetoothSerial.subscribe('\n', success, failure);

If MEGBluetoothSerial::bleDidReceiveData gets sent a string of "1\n2\n" our success callback above gets called with "1". "2\n" remains in the buffer.

If MEGBluetoothSerial::bleDidReceiveData then gets sent a string of "3\n", our success callback above gets called with "2", as it's now next in the buffer

As you can see, as soon as MEGBluetoothSerial::bleDidReceiveData gets sent data with more than one delimiter, our callback will be out of phase with the message received.

This pull request ensures that MEGBluetoothSerial::bleDidReceiveData will fire our success callback for each delimited message.

P.S. This is my first pull request, so apologies in advance if I've mucked it up or done something wrong. Let me know if I need to change it somehow.

don added a commit that referenced this pull request Nov 26, 2013
Push multiple messages to a subscriber
@don don merged commit 4ad96f0 into don:master Nov 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants