Not a good way to knowingly close a connection within the `onNext` of `establishConnection` and if connection is lost, only errors occurRxJava 2.0 - handling ressources for uncaught subsciber error in publish().refCount()RxAndroidBle waiting for client response
How to evaluate the performance of open source solver?
split one column into two columns based on it's value using t/sql
What does the multimeter dial do internally?
Was it ever illegal to name a pig "Napoleon" in France?
Category-theoretic treatment of diffs, patches and merging?
Can a UA Lore Mastery wizard use the Spell Secrets or Alchemical Casting features to modify spells cast through wands or staffs?
What is a writing material that persists forever or for a long time?
Computer name naming convention for security
Adjust the Table
Why did Old English lose both thorn and eth?
What exactly is a "murder hobo"?
Number of states in taxi environment (Dietterich 2000)
Is this Cambridge Dictionary example of "felicitate" valid?
Shrinking padding of node with label options
Password Hashing Security Using Scrypt & Argon2
"Distance" between summands in Taylor Series of Cosine
Is there a formal/better word than "skyrocket" for the given context?
Sum of even numbers N?
What are the effects of abstaining from eating a certain flavor?
What do you call a situation where you have choices but no good choice?
Replacement for Thyme
What factors could lead to bishops establishing monastic armies?
How many Jimmys can fit?
When do flights get cancelled due to fog?
Not a good way to knowingly close a connection within the `onNext` of `establishConnection` and if connection is lost, only errors occur
RxJava 2.0 - handling ressources for uncaught subsciber error in publish().refCount()RxAndroidBle waiting for client response
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
In the event that I'm writing a characteristic that will reboot the device, I run into a world of trouble. For example.
scanResult.bleDevice.establishConnection(false).flatMapCompletable connection ->
connection.writeCharacteristic(UUID, "reboot".toByteArray(Charset.defaultCharset())).ignoreElement()
The original establish connection never properly completes, only returns an error that the device has disconnected, which, with all other kinds of code in place to handle improper disconnections, this one becomes difficult.If I try to dispose of the connection during the onComplete of the writeCharacteristic I never seem to get a proper callback. I'm not sure that there is any specific bug with this, but rather, I'm looking for insight into how to properly
rx-java2 rxandroidble
add a comment |
In the event that I'm writing a characteristic that will reboot the device, I run into a world of trouble. For example.
scanResult.bleDevice.establishConnection(false).flatMapCompletable connection ->
connection.writeCharacteristic(UUID, "reboot".toByteArray(Charset.defaultCharset())).ignoreElement()
The original establish connection never properly completes, only returns an error that the device has disconnected, which, with all other kinds of code in place to handle improper disconnections, this one becomes difficult.If I try to dispose of the connection during the onComplete of the writeCharacteristic I never seem to get a proper callback. I'm not sure that there is any specific bug with this, but rather, I'm looking for insight into how to properly
rx-java2 rxandroidble
add a comment |
In the event that I'm writing a characteristic that will reboot the device, I run into a world of trouble. For example.
scanResult.bleDevice.establishConnection(false).flatMapCompletable connection ->
connection.writeCharacteristic(UUID, "reboot".toByteArray(Charset.defaultCharset())).ignoreElement()
The original establish connection never properly completes, only returns an error that the device has disconnected, which, with all other kinds of code in place to handle improper disconnections, this one becomes difficult.If I try to dispose of the connection during the onComplete of the writeCharacteristic I never seem to get a proper callback. I'm not sure that there is any specific bug with this, but rather, I'm looking for insight into how to properly
rx-java2 rxandroidble
In the event that I'm writing a characteristic that will reboot the device, I run into a world of trouble. For example.
scanResult.bleDevice.establishConnection(false).flatMapCompletable connection ->
connection.writeCharacteristic(UUID, "reboot".toByteArray(Charset.defaultCharset())).ignoreElement()
The original establish connection never properly completes, only returns an error that the device has disconnected, which, with all other kinds of code in place to handle improper disconnections, this one becomes difficult.If I try to dispose of the connection during the onComplete of the writeCharacteristic I never seem to get a proper callback. I'm not sure that there is any specific bug with this, but rather, I'm looking for insight into how to properly
rx-java2 rxandroidble
rx-java2 rxandroidble
edited Mar 27 at 10:58
Dariusz Seweryn
2,2741 gold badge8 silver badges19 bronze badges
2,2741 gold badge8 silver badges19 bronze badges
asked Mar 25 at 22:45
Nic CapdevilaNic Capdevila
9898 silver badges23 bronze badges
9898 silver badges23 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The question is more related to the usage of RxJava 2 than about the library. To solve your problem you would need to first keep the subscription to .establishConnection() until it will emit and a subsequent write will happen. The code could look like this:
scanResult.bleDevice.establishConnection(false) // establish the connection
.publish connectionObs ->
// it will be needed to be subscribed until something will happen on it so a need to publish
connectionObs.takeUntil( // keep the connection subscribed until...
connectionObs.flatMapSingle
// ...the first write will complete
it.writeCharacteristic(
uuid,
"reboot".toByteArray(Charset.defaultCharset())
)
)
.ignoreElements()
This is beautiful. Yes, my question was more directed towards RxJava2, you are correct. Thank you for the help
– Nic Capdevila
Mar 28 at 0:13
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55347464%2fnot-a-good-way-to-knowingly-close-a-connection-within-the-onnext-of-establish%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The question is more related to the usage of RxJava 2 than about the library. To solve your problem you would need to first keep the subscription to .establishConnection() until it will emit and a subsequent write will happen. The code could look like this:
scanResult.bleDevice.establishConnection(false) // establish the connection
.publish connectionObs ->
// it will be needed to be subscribed until something will happen on it so a need to publish
connectionObs.takeUntil( // keep the connection subscribed until...
connectionObs.flatMapSingle
// ...the first write will complete
it.writeCharacteristic(
uuid,
"reboot".toByteArray(Charset.defaultCharset())
)
)
.ignoreElements()
This is beautiful. Yes, my question was more directed towards RxJava2, you are correct. Thank you for the help
– Nic Capdevila
Mar 28 at 0:13
add a comment |
The question is more related to the usage of RxJava 2 than about the library. To solve your problem you would need to first keep the subscription to .establishConnection() until it will emit and a subsequent write will happen. The code could look like this:
scanResult.bleDevice.establishConnection(false) // establish the connection
.publish connectionObs ->
// it will be needed to be subscribed until something will happen on it so a need to publish
connectionObs.takeUntil( // keep the connection subscribed until...
connectionObs.flatMapSingle
// ...the first write will complete
it.writeCharacteristic(
uuid,
"reboot".toByteArray(Charset.defaultCharset())
)
)
.ignoreElements()
This is beautiful. Yes, my question was more directed towards RxJava2, you are correct. Thank you for the help
– Nic Capdevila
Mar 28 at 0:13
add a comment |
The question is more related to the usage of RxJava 2 than about the library. To solve your problem you would need to first keep the subscription to .establishConnection() until it will emit and a subsequent write will happen. The code could look like this:
scanResult.bleDevice.establishConnection(false) // establish the connection
.publish connectionObs ->
// it will be needed to be subscribed until something will happen on it so a need to publish
connectionObs.takeUntil( // keep the connection subscribed until...
connectionObs.flatMapSingle
// ...the first write will complete
it.writeCharacteristic(
uuid,
"reboot".toByteArray(Charset.defaultCharset())
)
)
.ignoreElements()
The question is more related to the usage of RxJava 2 than about the library. To solve your problem you would need to first keep the subscription to .establishConnection() until it will emit and a subsequent write will happen. The code could look like this:
scanResult.bleDevice.establishConnection(false) // establish the connection
.publish connectionObs ->
// it will be needed to be subscribed until something will happen on it so a need to publish
connectionObs.takeUntil( // keep the connection subscribed until...
connectionObs.flatMapSingle
// ...the first write will complete
it.writeCharacteristic(
uuid,
"reboot".toByteArray(Charset.defaultCharset())
)
)
.ignoreElements()
edited Mar 27 at 11:17
answered Mar 27 at 10:17
Dariusz SewerynDariusz Seweryn
2,2741 gold badge8 silver badges19 bronze badges
2,2741 gold badge8 silver badges19 bronze badges
This is beautiful. Yes, my question was more directed towards RxJava2, you are correct. Thank you for the help
– Nic Capdevila
Mar 28 at 0:13
add a comment |
This is beautiful. Yes, my question was more directed towards RxJava2, you are correct. Thank you for the help
– Nic Capdevila
Mar 28 at 0:13
This is beautiful. Yes, my question was more directed towards RxJava2, you are correct. Thank you for the help
– Nic Capdevila
Mar 28 at 0:13
This is beautiful. Yes, my question was more directed towards RxJava2, you are correct. Thank you for the help
– Nic Capdevila
Mar 28 at 0:13
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55347464%2fnot-a-good-way-to-knowingly-close-a-connection-within-the-onnext-of-establish%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown