×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    2

    Problems send aplication java with obex bluecove

    greetings to all, sorry for my English
    I'm trying to send a java application from PC to phone via Obex bluecove.El protocol chosen is OBEX because I have no j2me application installed on the phone, the PC sends the application to the phone and this is installed, my problem comes when I receive the signal in my phone to accept the connection and then asks me for a PIN. in all the manuals I've read, speak of a pairing, but I do not want the phone will need to enter a pin, but only by pressing accept java application is installed on the phone.He tried changing all the additional parameters the url "btgoep" but nothing.Greetings to all and thanks

    PHP Code:
    public static void OBEXSTest(String btaString fileint channelthrows IOException {
            
    LocalDevice myLocalDevice LocalDevice.getLocalDevice();
            
                    
            
    String url "";
            
    url "btgoep://" bta ":" channel ";authenticate=false";
            

            
    System.out.println ("Connecting to " url " on " bta);
            
    ClientSession conn = (ClientSessionConnector.open(url);
            
    System.out.println("hola");
            
    HeaderSet header conn.createHeaderSet();
            
    HeaderSet response conn.connect(header);
            if (
    response.getResponseCode() != ResponseCodes.OBEX_HTTP_OK) {
                
    System.out.println("Connect Error " response.getResponseCode());
            }
            
    System.out.println("connected");

                
    File sendFile = new File (file);
                
    header conn.createHeaderSet();
                
    header.setHeader(HeaderSet.NAMEsendFile.getName());
                
                
    String type null;
                
                if (
    file.endsWith(".jpg")) type "image/jpeg";
                else if (
    file.endsWith(".gif")) type "image/gif";
                else if (
    file.endsWith(".jar")) type "application/x-java-archive";
                else if (
    file.endsWith(".vcf")) type "text/x-vcard";
                else if (
    file.endsWith(".midi") || file.endsWith(".mid")) type "audio/x-midi";
                
                if (
    type != nullheader.setHeader(HeaderSet.TYPEtype);
                
    header.setHeader(HeaderSet.LENGTH, new Long (sendFile.length()));

                
    Operation op conn.put(header);

                
    OutputStream os op.openOutputStream();
                
    InputStream is = new FileInputStream (sendFile);
                
                
    byte[] = new byte[is.available()];
                
    System.out.println(">>>>: "+is.available());
                
    int r;
                
    long ts System.currentTimeMillis();
                
    long tot 0;
                while ((
    is.read(b)) > 0) {
                        
    os.write(b0r);
                        
    tot += r;
                        
    System.out.println("Transmission speed " + ((double)tot / (double)(System.currentTimeMillis() - ts)) + "kb/sec");
                }
                
    is.close();
                
    os.close();
                
    op.close();
                
            
            
            
    conn.disconnect(conn.createHeaderSet());
            
    conn.close();
            
    System.out.println ("Connection terminated " url);
        
        } 

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,104
    You use the wrong channel ID. You have to connect to OBEX push. If you do not know the (current) channel ID of OPP, you have to do a complete service search or use DiscoveryAgent.selectService. Furthermore, to make your application more dynamic, I recommend to do a device search (inquiry) before as well.

Similar Threads

  1. BlueCove + OBEX
    By eisernWolf in forum Mobile Java General
    Replies: 1
    Last Post: 2008-06-24, 15:25
  2. how to send header object to the client in obex?
    By lfzgjj in forum Symbian C++
    Replies: 0
    Last Post: 2007-12-29, 05:34
  3. Send file from device to PC using OBEX
    By kaiten-sushi in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2007-02-12, 15:52
  4. Can not send any Obex Objects to a billionton bluetooth
    By hoy_cpe in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2006-08-01, 07:28
  5. suckho, i have encontered the same problems. Could you tell me how you resolved it?
    By dicson_hu in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2005-12-09, 10:56

Posting Permissions

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