-
Notifications
You must be signed in to change notification settings - Fork 28
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
IMPROVED Bluetooth Service #734
base: master
Are you sure you want to change the base?
Conversation
strange ascii character list https://theasciicode.com.ar/ascii-control-characters/unit-separator-ascii-code-31.html |
@sriharivishnu i m getting this error |
compositeDisposable.add(bluetoothConnection.observeByteStream().lift((FlowableOperator<String, Byte>) this::getWriter).onBackpressureBuffer().observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()) | ||
.subscribe(s -> { | ||
// READ COMMAND RESPONSE | ||
Log.d(TAG, "READ: " + s); | ||
//Remove the last command because response has been received | ||
if (!sentCommands.isEmpty()) sentCommands.remove(); | ||
//Send the response to the target | ||
if (!switchedHandler) mHandler.obtainMessage(Constants.MESSAGE_READ, s).sendToTarget(); | ||
|
||
//Sent all the waiting commands | ||
if (switchedHandler && sentCommands.isEmpty()) { | ||
Log.e(TAG, "SENT ALL PREVIOUS"); | ||
switchedHandler = false; | ||
mHandler = tempHandler; | ||
writeOverflow(); | ||
} | ||
|
||
}, throwable -> { | ||
Log.e(TAG, "startChat: "+ "ERROR OCCURRED WHILE READING"); | ||
disconnect(); | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sriharivishnu Can't we use this??
compositeDisposable.add(bluetoothConnection.observeStringStream('~')
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(new Consumer<String>() {
@Override
public void accept(String s) throws Exception {
Log.d(TAG, "accept: " + s);
}
}));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rrijal53 There is an error in their implementation. I had to modify the components of their function, which is why wrote it myself.
For |
5c640ca
to
7f9f670
Compare
Features
updateHandler()
is called, make sure there is no overflow, and if there is, wait till it is finished before executing commands in the new fragment.Info
PLEASE USE THE FOLLOWING BLUETOOTH SERVER:
Steps
Main Change:
Switched the delimiter and now sends the entire output of the CLI in one stream.