how to perform serial communication

  • Replies:1
  • OpenNot stickiedUnanswered

Jan 25, 2013 10:42:42 PM

Hi all,
I am a newbie in Android but I am pretty much okay in windows app (C#, C++) development.
I have developed an OBDII scanner for vehicles and have also written its code in C#. The communication from the scanner is being done serially through USB to serial cable (RS232) and the raw data is converted according to the formulas before displaying to the user. Now I want to write the same app for android to use it on my tablet through usb to serial cable.
I don't have any idea about serial communication in android but have some general/little knowledge of eclipse about how to put text boxes and buttons (as this app is almost all about text boxes, buttons and serial communication). Most of the code is about serially sending data and receiving it.
can anyone help me out to give me a head start about setting the baud rate/initialization?
and what can be the android equivalent of this c# code...

1private void button1_Click(object sender, EventArgs e)
2 {
3 //rpm
4 serialPort2.DiscardInBuffer();
5 serialPort2.WriteLine("010c\r\n");
6 Thread.Sleep(250);
7 // serialPort2.DiscardInBuffer();
8
9 string ec = serialPort2.ReadExisting();
10 //richTextBox2.Text = ec;
11 string p = for3.erpm(ec);
12 richTextBox1.Text = p;
13
14 }

— modified on Jan 25, 2013 11:25:47 PM