Skip to content

BluetoohLE - Best way to manually read Characteristic value on a given interval? #1142

Answered by aritchie
wagenheimer asked this question in Q&A
Discussion options

You must be logged in to vote

Android prevents a read/write at the same time (it has to). iOS does not, but does its own internal synchronization.

Observable
    .Interval(TimeSpan.FromSeconds(30))
    .Where(_ => !this.IsWriting)
    .Select(_ => yourChar.Read())
    .Switch()
    .Subscribe(
        x => {}, // do whatever with the read value
        ex => {} // deal with error
   );

I'm not sure why you can't set a var when writing, but you need to for your requirement

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by wagenheimer
Comment options

You must be logged in to vote
1 reply
@aritchie
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants