am new here. Am suspecting bug in bluetooth stack, please read and enlighten me.
I have a serial bluetooth module of Laird, configured to be discoverable, connectible and switch to remote command mode on connection. It is powered as stand alone device.
I have MIDlet running on Sony Ericsson K810i mobile, which discovers and gets connected to module as client. My application is supposed to send AT commands and get responses and display. typically i read status of GPIO of module.
Application works well, but some time during when it is querying, module goes into DATA-MODE and application hangs. I am sure my application is not sending a command to turn mode of module into DATA-MODE. Module is also well tested so can't be suspected.
Code that is establishing connection: connectionURL = servicesFound.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,false); conn = (Connection) Connector.open(connectionURL);
Code that sends: StreamConnection streamConn = (StreamConnection) conn; OutputStream os = streamConn.openOutputStream(); String Command_Switch_state = "ATS621?\r"; os.write(Command_Switch_state.getBytes());
Code that receives: InputStream is = streamConn.openInputStream(); int x = is.read();
I am actually reading response byte by byte and parsing.
Thanks & Regards