Added support for multiple bluetooth devices#45
Open
Technickel-Dev wants to merge 1 commit intoomaraflak:masterfrom
Open
Added support for multiple bluetooth devices#45Technickel-Dev wants to merge 1 commit intoomaraflak:masterfrom
Technickel-Dev wants to merge 1 commit intoomaraflak:masterfrom
Conversation
omaraflak
reviewed
Aug 11, 2019
| private BluetoothCallback bluetoothCallback; | ||
|
|
||
| private ReceiveThread receiveThread; | ||
| private ArrayList<ReceiveThread> receiveThreads = new ArrayList<>(); |
Owner
There was a problem hiding this comment.
Prefer the use of List here :
List<ReceiveThread> receiveThreads;and initialize it with the other variables in the initialize() method :
receiveThreads = new ArrayList<>();
omaraflak
reviewed
Aug 11, 2019
| * Disconnect from all bluetooth devices. | ||
| */ | ||
| public void disconnect() { | ||
| for (ReceiveThread receiveThread: receiveThreads) { |
Owner
There was a problem hiding this comment.
We want to able to control each socket separately. We should not disconnect every socket.
Owner
There was a problem hiding this comment.
Or you should rename the method disconnectAll()
omaraflak
reviewed
Aug 11, 2019
| * @param msg String message. | ||
| * @param charset Charset used to encode the String. Default charset is UTF-8. | ||
| */ | ||
| public void send(String msg, String charset){ |
Owner
There was a problem hiding this comment.
Same here, can you rename it to sendToAll() ?
omaraflak
reviewed
Aug 11, 2019
| socket.connect(); | ||
| connected = true; | ||
| receiveThread = new ReceiveThread(socket, device); | ||
| ReceiveThread receiveThread = new ReceiveThread(socket, device); |
Owner
There was a problem hiding this comment.
Also, we should be able to differentiate messages from callbacks. We should know which socket triggered which callback.
There was a problem hiding this comment.
I need it. Do you have update for this?
bluetooth.setDeviceCallback(new DeviceCallback() {
@Override
public void onMessage(BluetoothDevice device, byte[] message) {
}
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here are the changes that would resolve #42, adding in support for multiple Bluetooth connections. I have been unable to fully test the functionality yet, but will be able to do so in the next week as I will be around the hardware then. If you have any suggestions or ideas for additional changes, let me know!