dariuszseweryn / RxAndroidBle

An Android Bluetooth Low Energy (BLE) Library with RxJava3 interface
http://polidea.github.io/RxAndroidBle/
Apache License 2.0
3.42k stars 578 forks source link

No support for Rfcomm Socket? #408

Closed martyglaubitz closed 6 years ago

martyglaubitz commented 6 years ago

Summary

This is more a question than an issue. Im trying to communicate with an Bluetooth OBD Adapter. Im following this guide: https://blog.lemberg.co.uk/how-guide-obdii-reader-app-development.

What you're basicly doing is opening a socket and send the Adapter Commands (very TCPish) onto which it responds. It goes like this (Codesnippet taken from the guide)

// create the socket
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothDevice device = btAdapter.getRemoteDevice(deviceAddress);
UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
BluetoothSocket socket = device.createInsecureRfcommSocketToServiceRecord(uuid);
socket.connect();

//send commands & process response
new EchoOffObdCommand().run(socket.getInputStream(), socket.getOutputStream());
new LineFeedOffObdCommand().run(socket.getInputStream(), socket.getOutputStream());
new TimeoutObdCommand().run(socket.getInputStream(), socket.getOutputStream());
new SelectProtocolObdCommand(ObdProtocols.AUTO).run(socket.getInputStream(), socket.getOutputStream());

I can't find a method like createRfcommSocket (disregarding the insecure) in the library. How would you solve this task with this library?

Library version

1.5.0-SNAPSHOT

dariuszseweryn commented 6 years ago

Hello @martyglaubitz

Unfortunately this library aims only at Bluetooth Low Energy hence RxAndroidBle Bluetooth sockets are not supported at all

Best Regards

martyglaubitz commented 6 years ago

Alright, thank you! 😃