Appendix A. tBlue Library for Android
In the Bluetooth examples you’ve seen in this book, the interactions have been simple: opening a connection and sending a few characters. But to use Bluetooth, you must also:
Find the cell phone’s Bluetooth adapter.
Define a Bluetooth object that represents the device you are talking to (such as an Arduino).
Open a socket that represents the Bluetooth serial connection.
Open some stream objects: one for sending messages, one for receiving.
Because the Android Bluetooth APIs are complex, we created the class TBlue, which keeps things simple. Chapter 8 has example code that shows you how to use the tBlue
library. Here is the source of the TBlue
class:
// tBlue.java - simple wrapper for Android Bluetooth libraries ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access