Receive data from Bluetooth RS232 Adapter

DanielOliveira87DanielOliveira87 Member
edited January 21 in Xamarin.Android

Hi everyone,

i'm working with Xamarin Android since 2017. I work with professional equipements and now i'm converting an old Windows Mobile Application, that connects to a Parani SD1000 bluetooth RS232 adapter to receive information, to an Android app. Following the android-serialport-api - android_to_rs232_guideline.wiki this is what i have:

I have successfully connected to the Bluetooth RS232 adapter but cannot receive any data:

//ParcelUuid[] a =  btDevice.GetUuids();
UUID uuid = UUID.FromString("00001101-0000-1000-8000-00805f9b34fb");
BthSocket = btDevice.CreateRfcommSocketToServiceRecord(uuid);
BthSocket.Connect();

inputStream = BthSocket.InputStream;
var mReader = new InputStreamReader(inputStream);

var bufferReader = new BufferedReader(mReader);

if (BthSocket.IsConnected)
{
    byteRead += bufferReader.Read(buffer, byteRead, 1);
}

In order to reveive data, i need to configure some RS232 parameters to the remote machine start transmiting data.
Windows Mobile Serial Port configuration example:

this.cPort.ReadBufferSize   = 8192;
this.cPort.Parity           = Parity.None;
this.cPort.StopBits         = StopBits.One;
this.cPort.DataBits         = 8;
this.cPort.Handshake        = Handshake.None;
this.cPort.ReadTimeout      = 500;
this.cPort.WriteTimeout     = 500;
this.cPort.RtsEnable        = true;
this.cPort.DtrEnable        = false;

I have tryed many suggestions without success, because i cannot find a way to properly configure the RS232 parameteres mentioned above. Do you have any suggestion to achieve this kind of comunication?

Thanks

Sign In or Register to comment.