×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    24

    Java Bluetooth Printer Star SM-T300, printer does´t work.

    Hi everybody,

    I have:
    Nokia E51 and a Bluetooth printer Star SM-T300

    The printer can be found on windows using default bluetooth serach, this printer has a password, (defaul:1234) accepted easyly on windows.

    I try to connect using RFCOMM Simple Client:
    ========================================
    OutputStream os = null;
    StreamConnection con = null;
    try {
    /*
    * Open the connection to the server
    */
    con = (StreamConnection) Connector.open("btspp://00150EE0A89D:1;authenticate=false;encrypt=false;master=false");
    /*
    * Sends data to remote device
    */
    os = con.openOutputStream();
    os.write(data.getBytes());
    /*
    * Close all resources
    */
    os.close();
    con.close();
    } catch (IOException e2) {
    System.out.println("Failed to print data");
    System.out.println("IOException: " + e2.getMessage());
    return false;
    }
    ======================================
    And Nothing happens.

    I try to use Obex with authenticator:
    ==================================
    ClientSession clientSession = (ClientSession) Connector.open("btgoep://00150ee0a89d:1",Connector.READ_WRITE);


    HeaderSet hsConnect = clientSession.createHeaderSet();

    hsConnect.createAuthenticationChallenge(null, true, true);
    clientSession.setAuthenticator(new OBEXAuthenticator()); //this class is a simple implementation of Authenticator
    HeaderSet hsConnectReply = clientSession.connect(hsConnect);

    if (hsConnectReply.getResponseCode() != ResponseCodes.OBEX_HTTP_OK) {
    AppMidlet.getInstance().appendForm("Failed to connect"+hsConnectReply);
    }
    ==============================

    =====Class OBEXAuthenticator =========
    public class OBEXAuthenticator implements Authenticator {

    String userName;
    String senha;

    public OBEXAuthenticator (String userName,String senha) {
    this.userName = userName;
    this.senha = senha;
    }
    public OBEXAuthenticator () {
    this.userName = "1234";
    this.senha = "1234";
    }

    public PasswordAuthentication onAuthenticationChallenge(String description, boolean isUserIdRequired, boolean isFullAccess) {
    // AppMidlet.getInstance().appendForm("Teste");
    return new PasswordAuthentication(userName.getBytes(), senha.getBytes());
    }

    public byte[] onAuthenticationResponse(byte[] userName) {
    //AppMidlet.getInstance().appendForm("Teste2");
    return senha.getBytes();
    }

    }
    =====================

    And with obex authencaticator the code stop on line:
    HeaderSet hsConnectReply = clientSession.connect(hsConnect);

    My printer support only password, not user, but my code supports user and pass.
    What´s worng with my obex code?
    RFCOMM supports authencation?

    I use bluecove on windows to try to search supported services.
    My code show an service on my printer, only BT Serial and show the same url used on my RFCOMM example.
    My code doesn´t show any OBEX service.

    What I can do?


    Thanks.

  2. #2
    Registered User
    Join Date
    Apr 2011
    Posts
    1

    Re: Java Bluetooth Printer Star SM-T300, printer does´t work.

    Dear ricardopcunha,

    You can try putting the code "Thread.sleep(2000)" right after the “os.write(data.getBytes());”.
    If you need further assistance, please contact us directly so we can further assist you. You may reach us at Support@starmicronics.com or 800-782-7636 Option 2 for Technical Support.

    Regards,

    Customer Support

Similar Threads

  1. Using Bluetooth Enabled Printer using J2ME
    By sprateek in forum Mobile Java General
    Replies: 6
    Last Post: 2014-03-06, 13:37
  2. Communication + Bluetooth Printer
    By viku_006 in forum Mobile Java General
    Replies: 7
    Last Post: 2009-05-29, 11:14
  3. Selecting a Bluetooth Printer
    By zinxed in forum Bluetooth Technology
    Replies: 2
    Last Post: 2007-09-06, 10:39
  4. Setting up a local printer, to appear like bluetooth printer
    By djmeza in forum Bluetooth Technology
    Replies: 2
    Last Post: 2005-05-03, 16:42
  5. help: 7650 + Bluetooth printer
    By Denmark in forum Bluetooth Technology
    Replies: 2
    Last Post: 2003-07-02, 11:37

Posting Permissions

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