We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to extend this so I can connect to multiple UART servers simultaneously.
I've already got the scan filtering for UART devices only and am passing the list of device labels to the TerminalFragement
But it looks like I'm overwriting the socket connection when I loop through the devices and create them in the service.
If i send a message I only get a reply from one of the devices. Is there an elegant way of doing this without just creating an array of services?
for(String d:deviceList) { try { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); BluetoothDevice device = bluetoothAdapter.getRemoteDevice(d); status("connecting..." + device); connected = Connected.Pending; SerialSocket socket = new SerialSocket(getActivity().getApplicationContext(), device); // need to make multiple connectons and retrieve address service.connect(socket); } catch (Exception e) { onSerialConnectError(e); } }
The text was updated successfully, but these errors were encountered:
I recommend to create distinct service instances. Else you would have to enhance the service class to manage multiple sockets
Sorry, something went wrong.
No branches or pull requests
I'm trying to extend this so I can connect to multiple UART servers simultaneously.
I've already got the scan filtering for UART devices only and am passing the list of device labels to the TerminalFragement
But it looks like I'm overwriting the socket connection when I loop through the devices and create them in the service.
If i send a message I only get a reply from one of the devices. Is there an elegant way of doing this without just creating an array of services?
for(String d:deviceList) {
try {
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothDevice device = bluetoothAdapter.getRemoteDevice(d);
status("connecting..." + device);
connected = Connected.Pending;
SerialSocket socket = new SerialSocket(getActivity().getApplicationContext(), device); // need to make multiple connectons and retrieve address
service.connect(socket);
} catch (Exception e) {
onSerialConnectError(e);
}
}
The text was updated successfully, but these errors were encountered: