Accessing CTS/RTS state in RFCOMM Blue Tooth profile from Android

1.2k Views Asked by At

I'm working on an android application using my phone's bluetooth and a bluetooth board that has an RS232 interface and supports the RFCOMM profile.

I have the RFCOMM connection working fine, but I cannot find a way through the android API to access the RTS and CTS signals, which are part of the RFCOMM profile and also exposed on my BT board.

Can anyone tell me how to read/write RTS/CTS from an android device?

A similar question was asked here: Bluetooth control signals (DTR, DSR, RTS, CTS) on Android but never answered.

1

There are 1 best solutions below

0
On

This isn't a complete answer and will not be suitable for most applications, however you can do it using the native C library for Bluedroid from Android 4.2 onwards or BlueZ before that.

The following file: https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/master/stack/rfcomm/port_api.c contains a function called PORT_Control which should set the line status for you and PORT_GetModemStatus will return the line statuses.

There is another question covering the use of the Bluedroid native library here: Android NDK accessing native bluetooth functions bluedroid.