×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    23

    Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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 )

  2. #2
    Registered User
    Join Date
    Apr 2006
    Posts
    6

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    Did you turn discovery on on the PC?

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    23

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    yes discovery is turned on

  4. #4
    Super Contributor
    Join Date
    Dec 2005
    Location
    England,UK
    Posts
    1,600

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    7

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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

  6. #6
    Registered User
    Join Date
    Jul 2006
    Posts
    23

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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.

  7. #7
    Super Contributor
    Join Date
    Dec 2005
    Location
    England,UK
    Posts
    1,600

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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 12:19.

  8. #8
    Registered User
    Join Date
    Feb 2006
    Posts
    7

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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.

  9. #9
    Super Contributor
    Join Date
    Dec 2005
    Location
    England,UK
    Posts
    1,600

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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 10:50.

  10. #10
    Registered User
    Join Date
    Feb 2006
    Posts
    7

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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.

  11. #11
    Super Contributor
    Join Date
    Dec 2005
    Location
    England,UK
    Posts
    1,600

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    [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

  12. #12
    Registered User
    Join Date
    Feb 2006
    Posts
    7

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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.

  13. #13
    Super Contributor
    Join Date
    Dec 2005
    Location
    England,UK
    Posts
    1,600

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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

  14. #14
    Registered User
    Join Date
    Feb 2006
    Posts
    7

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    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

  15. #15
    Super Contributor
    Join Date
    Dec 2005
    Location
    England,UK
    Posts
    1,600

    Re: Bluetooth PC Server - Mobile Phone Clients. Bluecove problems?

    Hi,

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


    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!.

    .... not authorised to release this information
    common usual quote on samsung support website.
    Jim

Similar Threads

  1. Problems with socket connection between client and server
    By Al_KaRaJo in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2006-11-15, 18:28
  2. J2ME, Bluetooth, Using your Phone as a Gateway???
    By zinomorph in forum Bluetooth Technology
    Replies: 2
    Last Post: 2005-08-26, 13:02
  3. Replies: 1
    Last Post: 2005-01-04, 17:16
  4. Nokia Activ Server 2.1 - problems
    By choumanb in forum WAP Servers
    Replies: 0
    Last Post: 2003-05-16, 07:34
  5. Replies: 5
    Last Post: 2003-02-07, 11:25

Posting Permissions

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