JungIn Choi
05/03/2021, 1:17 PMDay47
• Reading time - RxAndroidBLE
• Coding time - Lock (Sammi lock) controlling app demo
BLEManager.kt
- create rxble client , device discovery using scan filter with key
Self-Comment
• First challengd - location permission thing.
◦ I definitely added the location permission in manifest, but it just didn’t work . Some error about location permission was being printed on logs. I just had to copy the location permission requesting method from Map demo app, and called that from onCreate, and it worked.
• Second challengd - was with Rx….. and I just had to follow the company code snippet to fix my wrong code.
◦ I posted both working & not working code on this thread. And.. I’ll have to figure why not-working-code did not work.
• Ugh…….I did not 100% understand the operation related with BLE. I’ll have to check the flow more thoroughly tomorrow.
• Third challengd - is something with toast. As in the video I posted on this thread’s comment, I made the button text change, according to the Behavior Subject’s value. However I just can’t pop up the toast..? Hmmm
Goals-Tomorrow
• review controller flow - analyze it in notion.
• resolve issues with toast
• move on to Lock(PlusLock) controlling app demo.JungIn Choi
05/03/2021, 1:17 PMJungIn Choi
05/03/2021, 1:34 PMNOT-WORKING-CODE
connection!!.setupNotification(this.BICYCLE_CHARACTERISTIC)
.take(1)
.singleOrError()
.flatMap {observable ->
observable.take(1)
.singleOrError()
.zipWith(
connection!!.writeCharacteristic(
BICYCLE_CHARACTERISTIC,
BICYCLE_COMMAND_PASSWORD
)
)
}
WORKING-CODE
connection!!.setupNotification(this.BICYCLE_CHARACTERISTIC)
.flatMap { it }
.take(1)
.singleOrError()
.zipWith(
connection!!.writeCharacteristic(
BICYCLE_CHARACTERISTIC,
BICYCLE_COMMAND_PASSWORD
)
)
why..?