You Are Here:

Community: Developer Discussion Boards

#1 Old Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-05-05, 17:54

Join Date: May 2006
Posts: 23
Jossnaz
Offline
Registered User
Hi

I'm a student from switzerland, working for a bluetooth project.
The goal is to code a PC server which can handle several Mobile Phone clients. Send them some questions, receive their answers. Security is not needed.

I chose the example from benhuis website, but I have a problem with bluecove creating a server, that is able to be found by the mobile phone and establish connection.
When I use the example of benhui's website, mobile is server, pc is client -> no problem. But PC server, Mobile client (what i actually need..) -> finds rarely the server, if pc is found the connection cannot establish correctly.
There is no error or log I can show you, the server simply is "waiting for connection..." while the phone tries to connect.
My J2ME experiences are pretty poor, I read some articles and examples though.

I lost so much time yet... Would really be a great thing to get started.

Are there any working examples, using a PC and bluecove as a server or does somebody know what's wrong with benhui's example?

Any different approache ideas? Different libraries? linux using bluez perhaps easier? Java COMM API would not be a possible solution?



Greetings from switzerland and a lot of thanks


Lukas

( http://www.benhui.net/modules.php?na...ne_Part_1.html )
Reply With Quote

#2 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-05-06, 11:41

Join Date: Apr 2006
Posts: 6
LordElpus
Offline
Registered User
Did you turn discovery on on the PC?
Reply With Quote

#3 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-05-07, 22:18

Join Date: May 2006
Posts: 23
Jossnaz
Offline
Registered User
yes discovery is turned on
Reply With Quote

#4 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-05-08, 09:43

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
To run BlueCove you need WinXP Service Pack 2 with a XP compatable blue tooth adapter which is Bluetooth version 1.0 with Cambridge Radio Ltd or Belkin 1.0 , difficult to find now all BT 2.0


Next you need the de.avetana obex package zip package source code
and the package MicroEmulator
* Copyright (C) 2001 Bartek Teodorczyk <barteo@it.pl>
under GNU.
Some Google-ing on these name will find the packages.


Under Netbeans 4.1 IDE build the BlueCove library project which is basis of BT under J2SE the "dist" directory contains the library BlueCove.jar this is added to the de.avetana project libraries now built as library de.avetana.jar

/* These lines are changes needed to use OBEX
String connectionURL = null;
String connSPPmodURL = null;

* from de.avetana.OBEXConnector.open("btgoep://remoteAddress:channel")

connSPPmodURL = "btgoep:"+ connectionURL.substring(6);
connection = OBEXConnector.open(connSPPmodURL);
client.updateStatus("Connection obtained");


ClientSession cs = (ClientSession)connection;
HeaderSet hs = cs.createHeaderSet();

cs.connect(hs);
client.updateStatus("OBEX session created");






The higlighted code is the client code. This is code copied from the Mobile project using Netbeans 4.1 and it runs on my Nokia 6230i

UUID[] uuidSet = {new UUID("1106", true)}; OBEXFile transfer
/* the Server and client service attributes */
public static int[] attribSet = {0x0100, 0x0001, 0x0002, 0x0003, 0x0004};

To pick up multiple phones.
cs.connect(hs);
client.updateStatus("OBEX session created");


public newConn extends Thread{


public void run(){

InputStream is = new FileInputStream(file);
byte filebytes[] = new byte[is.available()];
is.read(filebytes);
is.close();


hs = cs.createHeaderSet();
hs.setHeader(HeaderSet.NAME, file.getName());
hs.setHeader(HeaderSet.TYPE, "text/plain");
hs.setHeader(HeaderSet.LENGTH, new Long(filebytes.length));

Operation putOperation = cs.put(hs);
client.updateStatus("Pushing file: " + file.getName());
client.updateStatus("Total file size: " + filebytes.length + " bytes");

OutputStream outputStream = putOperation.openOutputStream();
outputStream.write(filebytes);
client.updateStatus("File push complete");

outputStream.close();
}
}
every time a new connection is found call newConn().start;
for a new connection an now you have a multi connection server
Reply With Quote

#5 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-08-22, 19:31

Join Date: Feb 2006
Posts: 7
FVelasco
Offline
Registered User
Hi, are you still there?
I've got the same problem than Jossnaz, but I can't include the "avetana" software in my proyect because it's under license. Does anyone know another solution without this package. Is that one of the limitations of bluecove or it's my application? It seems that there are a lot of people with the same problem and no much solutions..
Thanks in advance.
Francisco
Reply With Quote

#6 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-08-23, 13:54

Join Date: Jul 2006
Posts: 23
tfm
Offline
Registered User
Jossnaz I'm a student from Pakistan, working on a similar kind of project which you are.

My project differs in the sense that my client does not need to receive anything from the server but it just needs to send some data. And I also want to connect multiple cell phone clients to the server.

I'm using Ubuntu linux for development and using Avetana as the library. Its very difficult here to get a windows compatible bluetooth adapter.

I have written a server & client code where the server receives the key pressed by the client on the cellphone & displays it.

email me at onlytabish@hotmail.com if you are interested in the code.

I'm specifically interested in knowing who is supporting you for the project and have you thought of how you would handle the situation of connecting more than 7 clients because you cannot connect more then 7 clients to a bluetooth server.
Reply With Quote

#7 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-08-24, 11:09

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
Quote:
Originally Posted by FVelasco
Hi, are you still there?
I've got the same problem than Jossnaz, but I can't include the "avetana" software in my proyect because it's under license. Does anyone know another solution without this package. Is that one of the limitations of bluecove or it's my application? It seems that there are a lot of people with the same problem and no much solutions..
Thanks in advance.
Francisco
avetana source code is covered by GNU Free licence and can be used for academic work. This code is *NOT* for commercial use.

See this site for example of commercial use of software licence
http://www.j2mepolish.org/licenses.html#commercial

This open source project may help
http://sourceforge.net/projects/openobex

may solve your problem but is for non-commercial use.

Although Bluecove was written by the INTEL Corp among others it may have similar conditions of non-commerical use.

The simple answer is that you request permission for use and give a clear
citiations and cross reference in appendix of your project.

If you are writing for a Master or Doctorate I dont expect the examiners will allow the use of the code as the project is supposed to be unique.

Consider making your own protocol but using the same binary code ie.
0x1106 on the service using btspp: and write your own callback code.

This unversity did http://www.caside.lancs.ac.uk/java_bt.php


finally try a spot of google "obex source code (j2se)"

the DOCJAR website give loads of free code to think about.

Jim
Last edited by jimgilmour1 : 2006-08-24 at 13:19.
Reply With Quote

#8 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-08-24, 19:03

Join Date: Feb 2006
Posts: 7
FVelasco
Offline
Registered User
Thanks for such amount of information, now i'll try to digest it...

I'm a bit lost with bluecove. Do you why my mobile phone can't discover my pc as a bluetooth device? Avetana is going to help me out?(I wish...) I've tried with j2se 1.4 and 1.5 (I can't remember where I read it was needed the 1.4 version), with the bluecove20050514.jar, with the patched version from Benhui and with my own compiled version (1.4 and 1.5). Now I don't know what to try. (oh, I forgot it: my bluettoth device is 2.0..., Do I still have any opportunity?)

There is something extrange: with the differents bluecove version (original and Benhui's one) my pc gets 2 different addresses. I've seen that the original doesn't implement method "setDiscoverable()" (it just return false). Can it work anywhere?
I'll try with avetana and all you mentioned, Jim.
Reply With Quote

#9 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-08-25, 11:18

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
Quote:
from FVelasco

(oh, I forgot it: my bluettoth device is 2.0..., Do I still have any opportunity?)
BT V2.0 is not recognised by MS XP BT or NCF. Bluecove will only work with
http://support.microsoft.com/default.aspx?kbid=841803

My belkin version 2.0 worked as a Version 1.0 device when I hacked bt.inf list if devices
see my hack bt.inf thread

http://discussion.forum.nokia.com/fo...ight=Bluetooth
Jim
Last edited by jimgilmour1 : 2006-08-25 at 11:50.
Reply With Quote

#10 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-08-28, 17:57

Join Date: Feb 2006
Posts: 7
FVelasco
Offline
Registered User
Thanks again.
I feel ashamed: the problem was (at first, now I've got new ones) that I had forgotten to turn discovery on on the pc , I thought that with the function "setDiscoverable()" was enough; then I realized that it was not implemented...

Now, I can discover my pc as a device, but I can't discover any services on it. It only discovers a L2CAP service, searching for uuid=0x0100; even when I opened a BTSPP url on the server (pc). I suppose it's the underlying protocol what it discovers... It doesn't find the serviceClassUUID that I use or the btspp identifier (0x0003). I would use L2CAP instead, but bluecove doesn't implement the interfaces (L2CAPConnection, etc.)
I can send data to the pc because I know the bluetooth address and the BTSPP service starts always with channel 1 ("btspp:\\myAdress:1"); but I need the service discovery.
Maybe it's due to the driver. I will try to hack the driver as you mentioned. I hope it works. If it does not work, I'll try with another bluetooth-USB adapter.
Reply With Quote

#11 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-08-28, 21:54

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
[quote=FVelasco]Thanks again.

Now, I can discover my pc as a device, but I can't discover any services on it. It only discovers a L2CAP service, searching for uuid=0x0100; even when I opened a BTSPP url on the server (pc). I suppose it's the underlying protocol what it discovers... It doesn't find the serviceClassUUID that I use or the btspp identifier (0x0003). I would use L2CAP instead, but bluecove doesn't implement the interfaces (L2CAPConnection, etc.)
/QUOTE]
Your server is supposed to use service registration of

UUID attr[] = new UUID{0x0001,0x0002,0x0003,0x0100}


which will allow you to discover all services
i expect you use just {0x0003,0x0100}

Jim
Reply With Quote

#12 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-08-29, 17:15

Join Date: Feb 2006
Posts: 7
FVelasco
Offline
Registered User
Hi, Jim

Sorry, but don't understand what you propose...

"Your server is supposed to use service registration of

UUID attr[] = new UUID{0x0001,0x0002,0x0003,0x0100}"

Where can I do this? in the server... but, setting attributes via record.setAttributeValue()?



I might be wrong: I thought that when I do:

------------------------

UUID myServiceUuid=new UUID("1234", true);

String myServerUrl="btspp://localhost:"+myServiceUuid+";name=myServiceName";

notifier= (StreamConnectionNotifier) Connector.open(myServerUrl);

------------------------

then the serviceRecord must register myServiceUuid as an Uuid reachable in a service discovery, am I wrong?



I've tried too:

------------------------

DataElement data=new DataElement(DataElement.UUID,myServiceUuid);

record.setAttributeValue(0x0003,dato);

------------------------

, but it doesn't work.





My client is:

------------------------

uuidList=new UUID[1];

uuidList[0]=myServiceUuid;

(...)

trans =agent.searchServices(null, uuidList, arrayDisp[i], this);

------------------------

I think it's time for me to study a bit more the JSR82 specification...





In the other hand, trying to hack the driver, I can't find other Pnp ID for my USB dongle than the one wich corresponds to Generic Bluetooth Radio (USB\Vid_0a12&Pid_0001), even when I use the drivers that the adapter carried.
Reply With Quote

#13 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-08-29, 20:15

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
Try this code the second param is a DataElement which you build up with the attibutes.
This code may help

PHP Code:
   public void run()
    {    
        
        try
        {
            
device LocalDevice.getLocalDevice();
            
device.setDiscoverable(DiscoveryAgent.GIAC);
            
UUID uuid =new UUID("00112233445566778899AABBCCDDEEFF",false);//spp
            
StreamConnectionNotifier service;
            
service =(StreamConnectionNotifier)Connector.open("btspp://localhost:" +uuid.toString() + ";name=serialconn");
            
ServiceRecord record=device.getRecord(service);
            
record.setAttributeValue0x0008, new DataElementDataElement.U_INT_10xFF ) );
            
//record.setDeviceServiceClasses(0x1101);
            
device.updateRecord(record);
            
stringItem1.setText(stringItem1.getText()+"\nListening for client...");
            
StreamConnection conn service.acceptAndOpen();
            
stringItem1.setText(stringItem1.getText()+"\nConnected to Client.");
            
        }
        catch(
Exception ioe)
        {
            
stringItem1.setText(stringItem1.getText()+"\nException in Server: "+ioe.getMessage());
            
ioe.printStackTrace();
        }
    
stringItem1.setText(stringItem1.getText()+"\nServer Terminated.");    
    } 

PHP Code:
                       ServiceRecord srec javax.bluetooth.LocalDevice.getLocalDevice().getRecord(notifier);
                
DataElement serviceClassIDList srec.getAttributeValue(0x01);
                
DataElement newSCList = new DataElement (DataElement.DATSEQ);
                
newSCList.addElement(new DataElement(DataElement.UUID, new UUID(0x1105)));
                
srec.setAttributeValue(0x0001newSCList);

                
//Upate the protocol Descriptor list to contain OBEX
                
DataElement protocolDescriptorList srec.getAttributeValue(0x0004);
                
DataElement newProtDescList = new DataElement (DataElement.DATSEQ);
                
= (Enumeration)protocolDescriptorList.getValue();
                while (
v.hasMoreElements()) {
                    
DataElement de = (DataElement)v.nextElement();
                    
newProtDescList.addElement(de);
                }
                
                
DataElement obexDescriptor = new DataElement(DataElement.DATSEQ);
                
obexDescriptor.addElement(new DataElement(DataElement.UUID, new UUID(0x0008)));

                
newProtDescList.addElement(obexDescriptor);
                
srec.setAttributeValue(0x0004newProtDescList); 



Jim
Reply With Quote

#14 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-09-04, 17:47

Join Date: Feb 2006
Posts: 7
FVelasco
Offline
Registered User
Hi again.
Well, I've finally resolved my problem. I mean, maybe there were no problem at all. I think it's my phone(motorola v360), it couldn't discover a SPP service in my pc. I've tried with another one (Nokia 6103) and it works fine! With the code I had at the beginning!
But there is something extrange:
- v360 can find a L2CAP service in my pc (but it's not a service I've made, over bluecove, it's a Personal Area Network I don't recognize).
- v360 can find SPP services in 6103 (so v360 can find SPP services...)
- 6103 can find a SPP service in my pc over bluecove (so bluecove can set services discoverables...).
But:
- v360 cannot find the SPP service over bluetooth.

If I get to know what's happening I'll tell you.
Bye
Reply With Quote

#15 Old Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems? - 2006-09-05, 11:13

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
Hi,

Quote:
I've tried with another one (Nokia 6103) and it works fine!
Oh course thats why Nokia is so popular "it works fine!"


Quote:
I think it's my phone(motorola v360),
You have 60 seconds to discover the device then ............. the phone silently turns off discovery. You CANNOT turn discovery on programatically.

You need to set authorization off on the Motorola , but I dont have a clue how !.



See the motorola development kit FAQ,and cry!.

The only was to connect is using signed applications. Same with java.

The only phone with worse support is samsung E720. All use of bluetooth is for Samsung only!.

Quote:
.... not authorised to release this information
common usual quote on samsung support website.
Jim
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
Problems with socket connection between client and server Al_KaRaJo Mobile Java Networking & Messaging & Security 4 2006-11-15 19:28
J2ME, Bluetooth, Using your Phone as a Gateway??? zinomorph Bluetooth Technology 2 2005-08-26 14:02
problems with bluetooth file transfer to 6230? - here's the solution! spyghost Bluetooth Technology 1 2005-01-04 18:16
Nokia Activ Server 2.1 - problems choumanb WAP Servers 0 2003-05-16 08:34
7650 Bluetooth Modem with Toshiba Tecra 9000 Windows XP - RESOLVED Now! d0lph1n Bluetooth Technology 5 2003-02-07 12:25

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