×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Jun 2007
    Location
    Vadodara
    Posts
    64

    Cool Communication + Bluetooth Printer

    Hello all,
    How can I get connected with Bluetooth printer and get my text printed.
    Technically, how my J2ME come to know that It has printing facility. Yes we can find device during "Inquiry" but then how to get connected and start printing.
    Guide me technical steps..

    Thnx

  2. #2
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: Communication + Bluetooth Printer

    I dont try ever for BT printer but u can try this. Please try to follow these guidelines:

    1. search the devices.
    2. get bluetooth address from device u found.
    3. make connection with that device
    like
    Code:
    String URL = "btgoep://" + ((RemoteDevice) vect_4_remotedevices.elementAt(list.getSelectedIndex())).getBluetoothAddress() + ":1;master=false;encrypt=false;authenticate=false";
      StreamConnection streamConnection = null;
            OutputStream outputStream = null;
            try {
                streamConnection = (StreamConnection) Connector.open(URL);
                if (streamConnection != null) {
                    log("CONN NOT NULL");
                } else {
                    log("CONN NULL");
                }
                outputStream = streamConnection.openOutputStream();
                outputStream.write(image_bytes);
                outputStream.flush();
                 } catch (Exception exception) {
    
            } finally {
                try {
                    if (streamConnection != null) {
                        streamConnection.close();
                        streamConnection = null;
                    }
                    if (outputStream != null) {
                        outputStream.close();
                        outputStream = null;
                    }
                } catch (Exception exception) {
                    
                }
            }
    check and reply..
    thanks,
    jitu_goldie..

    KEEP TRYING..

  3. #3
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: Communication + Bluetooth Printer

    If there is printing profile in the printer you should connect to that

  4. #4
    Regular Contributor
    Join Date
    Jun 2007
    Location
    Vadodara
    Posts
    64

    Cool Re: Communication + Bluetooth Printer

    Thnx frnd,
    Unfortunetly i'wl get printer by next week but yes i've document abt its protocol.
    1) One suggested way is to get bluetooth address during "Inquiry" then get connected.
    Secondly,
    2) How do i know that it has "Printing profil" and how to get connected to that profile then.
    Thnkx for reply.

  5. #5
    Regular Contributor
    Join Date
    Jun 2007
    Location
    Vadodara
    Posts
    64

    Cool Re: Communication + Bluetooth Printer

    Would Just following work ???

    String URL = "btspp://" + ((RemoteDevice) vect_4_remotedevices.elementAt(list.getSelectedIndex())).getBluetoothAddress() + ":1;master=false;encrypt=false;authenticate=false";
    StreamConnection streamConnection = null;
    OutputStream outputStream = null;
    try {
    streamConnection = (StreamConnection) Connector.open(URL);
    if (streamConnection != null) {
    log("CONN NOT NULL");
    } else {
    log("CONN NULL");
    }
    outputStream = streamConnection.openOutputStream();
    outputStream.write(image_bytes);
    outputStream.flush();
    } catch (Exception exception) {

    } finally {
    try {
    if (streamConnection != null) {
    streamConnection.close();
    streamConnection = null;
    }
    if (outputStream != null) {
    outputStream.close();
    outputStream = null;
    }
    } catch (Exception exception) {

    }
    }

  6. #6
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: Communication + Bluetooth Printer

    btspp AFAIK is using in case of master and slave communication. For printing purpose u have to use btgoep protocol. Had u tried the suggestions gave by me in my previous post..
    thanks,
    jitu_goldie..

    KEEP TRYING..

  7. #7
    Regular Contributor
    Join Date
    Jun 2007
    Location
    Vadodara
    Posts
    64

    Cool Re: Communication + Bluetooth Printer

    hello jitu,
    Unfortunately, I wl hv printer still by next week.
    One thing i came to know tht If I know the priting service (UUID) in advance then i can connect directly n start printing. if yes then (as per bluetooth assinged numbers)
    Direct printing - 0x1118
    Basic priting - 0x1122

    Code:
    String connString = discoAgent.selectService(oneOfAboveUUID, NO_SECURITY, NO_MASTER);
    StreamConnection cl = (StreamConnection) Connector.open(connString);
    cl.OpenInputStream(); cl.OpenOutputStream();
    Is tht so? pls correct me for this.
    thnx.
    Last edited by viku_006; 2009-05-22 at 13:54.

  8. #8
    Regular Contributor
    Join Date
    Jun 2007
    Location
    Vadodara
    Posts
    64

    Cool Re: Communication + Bluetooth Printer

    I've got the printer and yes succeed in printing. following is what the steps I followed
    1)Discovered for printer
    2)Once got, discovered for services using (0x0003 -> RMCOMM_UUID)
    Code:
    agent.searchServices(null, new UUID[]{RFCOMM_UUID}, rmDevice, this);
    3)On services discovered, I get connectionURL
    4)Did communication using StreamConnection and succeed in printing.

    My confusion is,
    1) what's use of priting profile (Direct printing(0x1118), Basic printing(0x1122))?
    I used RFCOMM uuid in searching only

    Thanx

Similar Threads

  1. Replies: 0
    Last Post: 2009-03-11, 02:10
  2. S60's buffer in bluetooth communication problem
    By lsepulve in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2007-03-20, 23:09
  3. Replies: 0
    Last Post: 2004-04-12, 12:22
  4. Replies: 0
    Last Post: 2004-04-12, 12:21
  5. Nokia 7650 support Bluetooth audo?
    By ovjo12 in forum Bluetooth Technology
    Replies: 5
    Last Post: 2003-07-17, 18:50

Posting Permissions

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