HDatta
HDatta

Reputation: 3

Android Things on RaspberryPi3 and HC-05 Bluetooth Classic

I am using Android Things preview 6 image on Raspberry Pi3. Now I have application that can connect to HC-05 when running on Android Phone but same application not able to connect to HC-05 when it is running on Raspberry Pi3 with Android Things. I can see HC-05 is classic bluetooth device and Wondering as Android things not give popup to enter passkey is making the problem to connect the HC-05 or is there something I am missing

I am getting below error

ConnectThread run: IO Exceptionjava.io.IOException: read failed, socket might closed or timeout, read ret: -1 D/BluetoothSocket: close() this: android.bluetooth.BluetoothSocket@ea69040, channel: -1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@e5f1b79, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@173c0bemSocket: android.net.LocalSocket@3f7251f impl:android.net.LocalSocketImpl@284706c fd:java.io.FileDescriptor@c2cf635, mSocketState: INIT D/BluetoothSocket: close() this: android.bluetooth.BluetoothSocket@4272aca, channel: -1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@5f2f43b, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@f7e2758mSocket: android.net.LocalSocket@ec3c0b1 impl:android.net.LocalSocketImpl@7f52996 fd:java.io.FileDescriptor@6129917, mSocketState: INIT

Upvotes: 0

Views: 170

Answers (1)

HDatta
HDatta

Reputation: 3

The problem with my HC-05 that it needs pin to pair with Android Things App and as Android Things dont have luxury of user interface we have to set the pin programmatically through app After few mints of searching I found answer of how to set pairing pin through program from this post programmatically-pairing-with-a-ble-device-on-android-4-4 and it is working perfectly for me. no need to change anything in my app accept added broadcast receiver

Thanks

Upvotes: 0

Related Questions