Welcome to WiFi-Forum

Go Back   WiFi-Forum - Wi-Fi Discussion Forum > Bluetooth Discussion Forums > alt.cellular.bluetooth
Reply
 
Thread Tools Display Modes
  #1  
Old 08-15-2005, 02:50 PM
Tobias Küster
 
Posts: n/a
Default Bluetooth with J2ME

Hello,
we are encountering some problems connecting us to the WRAP THOR
evaluation kit using a mobile. Actually, we are encountering some
problems connecting several mobiles among each other as well. Maybe you
can help me.

I wrote a J2ME program that can act as a server and as a client. You can
find the essential parts of the code below. The server is intended to
open a conection using a given UUID (e.g. 1101 for SPP), then an
outputstream is opened. The client in connecting to this stream and is
reading data in a loop, until the stop-command is sent.

For testing we are using a Motorola A1000 as well as a Nokia 6320. On
the Nokia the Server doesn't work at all. The program gets stuck as soon
as the server is started and not even one of the debugging messages are
given to the screen. On the Motorola the Server works only when opening
an Inputstream (for reading data from, but not for writing). It seems to
get stuck when trying to open the outputstream (unfortunately debugging
is quite hard when the program is running on the mobile...).

The client is working well on the Nokia. We managed to conect to a PC
and send data from the pc to the mobile using the BlueGiga WRAP THOR TTY
program and a BT keyboard dongle. Still, the same thing doesn't work on
the Motorola...

And for some reason the getFriendlyName is causing an exection on the
okia while working perfectly on the Motorola, but that's not so
important - just interesting. We are very deranged since some parts of
the program seem only to work on the one phone and the rest only on the
other...

Here's some of the code. I hope you can help, and thanks in advance.
Tobias

The server:
----------------------------------------------
LocalDevice device = LocalDevice.getLocalDevice();
device.setDiscoverable(DiscoveryAgent.GIAC);
// build URL string
String url= "btspp://localhost:" + uuid + ";name=BTTestServer";
// connect to url
StreamConnectionNotifier notifier =
(StreamConnectionNotifier)Connector.open(url);
// wait for client and open stream then
StreamConnection conn = notifier.acceptAndOpen();
DataOutputStream out= conn.openDataOutputStream();
--------------------------------------------------

The client: (the essentaial part of the
DiscoveryListener.serviceDiscovered()-method)
--------------------------------------------------
//get URL string from the service record found
String url=
servRecord[i].getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOE NCRYPT,false);
StreamConnection conn= (StreamConnection) Connector.open(url);
DataInputStream in= conn.openDataInputStream();
while (stop==false) {
int number= in.read();
form.append(number+"");
}
---------------------------------------------------
Reply With Quote
Reply


Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Synchronisation error. Don't manage to reconnect properly with bluetooth (6230i) Boerge Nokia Forum 6 10-05-2005 08:27 AM
Bluetooth crippling. Remove This Verizon Forum 67 08-13-2005 12:16 PM
Treo 650 Bluetooth Hotsync Derek alt.cellular.bluetooth 0 08-10-2005 06:31 PM




All times are GMT -7. The time now is 07:51 AM.

vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. All Contents Copyright © Wifi-Forum.com