You Are Here:

Community: Developer Discussion Boards

#1 Old Question Unexpected response when sending AT commands to N82 via Bluetooth - 2008-11-25, 16:00

Join Date: Mar 2004
Posts: 11
Location: Norway
fpaaske
Offline
Registered User
Hi all!

I have a program that uses BlueCove to search and connect to bluetooth devices, and then use AT commands to do call control.

A connection to a device is made like this
Code:
String url = "btspp://006057D6441F:1;authenticate=false;encrypt=false;master=true";
streamConnection = (StreamConnection) Connector.open(url);
InputStream inputStream = streamConnection.openInputStream();
OutputStream outputStream = streamConnection.openOutputStream();
in = new InputStreamReader(inputStream);
out = new OutputStreamWriter(outputStream);
Then I have one thread for reading and one thread for writing from/to the streams.
The writing is done like this:
Code:
out.write("AT\r");
out.flush();
The reading is done like this:
Code:
while((b = in.read()) != -1) {
  if(b == 13) // parse each line
    break;
  buffer.append((char)b);
}
parseData(buffer.toString());
Now, the funny part is that this works perfectly with many different (maybe all?) SonyEricsson devices (both old and new), but very few Nokia devices. On a Nokia 6610, it works fine (but not all AT commands are working). What happens is that I manage to send one command, e.g. AT\r, and then the input stream just gets a lot of '13'. If I try to send a new command, an exception is thrown stating that the connection is closed.


Is there anything I have to do to initialize the N80/N82/N90/N95 before I send the commands?

Any help is appreciated!

Thanks in advance!

Frank
Reply With Quote

#2 Old Re: Unexpected response when sending AT commands to N82 via Bluetooth - 2008-11-25, 16:27

Join Date: Mar 2004
Posts: 11
Location: Norway
fpaaske
Offline
Registered User
Sorry, I think I have fixed it by using :2 instead of :1 in the connection url.. And it still works with SonyEricsson too

At least I hope this will help someone else as well!
Reply With Quote

#3 Old 2008-12-16, 19:24

Join Date: Mar 2003
Posts: 2,617
traud
Offline
Super Contributor
I highly recommend do to a service search for the Dial-Up Networking and if that fails for the Headset UUID. You cannot be sure there is an AT command interface on a fixed channel ID as you use.
Reply With Quote

#4 Old Re: Unexpected response when sending AT commands to N82 via Bluetooth - 2008-12-17, 13:16

Join Date: Mar 2004
Posts: 11
Location: Norway
fpaaske
Offline
Registered User
Thank you for your reply! I will try to follow your suggestion! Although I might have quite a way to go before I understand how to find a specific service
Reply With Quote

#5 Old Re: Unexpected response when sending AT commands to N82 via Bluetooth - 2008-12-17, 23:56

Join Date: Dec 2008
Posts: 104
Unit1ed
Offline
Regular Contributor
Thanks, ":2" really helped me with my problem.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
sending and receiving AT GSM commands ervalerio Mobile Java General 2 2008-10-13 15:08
Bluetooth (virtual) serial port: not for AT commands? smb@nokia Bluetooth Technology 9 2008-03-23 13:33
How to activated the bluetooth interface for sending GPRS data to bluetooth printer Loner77 Bluetooth Technology 0 2004-04-12 13:25
How to activated the bluetooth interface for sending GPRS data to bluetooth printer Loner77 Bluetooth Technology 0 2004-04-12 13:23
AT commands and Bluetooth SPP btnokdev Bluetooth Technology 2 2003-04-16 19:55

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia