Hello,
I am working on a simple program to talk to an ELM 327 Bluetooth device over a Serial Port Protocol. I have verified that my debug device (Samsung Galaxy Note II VZW) can talk to the device using other programs that seem to work. I have no experience with Bluetooth and Android, so please forgive any obvious mistakes.
I hesitate to post code here, mainly because I have things spread out into various classes. If needed, I can try to reproduce my problem with a simpler, single class. However, if anyone knows any tips that can save me that trouble, I'd appreciate it.
The problem at hand is that ANYTHING I send to the device results in a response of "AT+BRSF=24\r". On a second attempt to communicate, my InputStream.read(Buffer) times out. For instance, I send the command "010C\r" (which requests a specific response from the device), and I get the BRSF response above. A second attempt results in a timeout of the subsequent read(), as though the device has nothing further to say.
The code I use to communicate is this:
[HIGH]
String Command = "010C\r";
m_OutputStream.write(Command.getBytes());
Thread.sleep(1000);
byte[] Buffer = new byte[m_InputStream.available()];
m_InputStream.read(Buffer);
[/HIGH]Google has not helped. If source code would help, I'll gladly reduce my code to the bare essentials and post it. However, I hope that this is an easy issue to resolve with the above information.
Thank you in advance for any replies.
- Kert
I am working on a simple program to talk to an ELM 327 Bluetooth device over a Serial Port Protocol. I have verified that my debug device (Samsung Galaxy Note II VZW) can talk to the device using other programs that seem to work. I have no experience with Bluetooth and Android, so please forgive any obvious mistakes.
I hesitate to post code here, mainly because I have things spread out into various classes. If needed, I can try to reproduce my problem with a simpler, single class. However, if anyone knows any tips that can save me that trouble, I'd appreciate it.
The problem at hand is that ANYTHING I send to the device results in a response of "AT+BRSF=24\r". On a second attempt to communicate, my InputStream.read(Buffer) times out. For instance, I send the command "010C\r" (which requests a specific response from the device), and I get the BRSF response above. A second attempt results in a timeout of the subsequent read(), as though the device has nothing further to say.
The code I use to communicate is this:
[HIGH]
String Command = "010C\r";
m_OutputStream.write(Command.getBytes());
Thread.sleep(1000);
byte[] Buffer = new byte[m_InputStream.available()];
m_InputStream.read(Buffer);
[/HIGH]Google has not helped. If source code would help, I'll gladly reduce my code to the bare essentials and post it. However, I hope that this is an easy issue to resolve with the above information.
Thank you in advance for any replies.
- Kert