Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Bluetooth Printing using Qt
QtWS25 Last Chance

[Solved] Bluetooth Printing using Qt

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 4.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    seethanellai
    wrote on last edited by
    #1

    Hi,

    I am having one android app with printing facilities. I am able to print through ethernet printing.
    But now i want to print using bluetooth printers (Bixolon SRP 350 plus). I have search it in google. I am unable to find the proper guidance.

    I have checked QtBluetooth , but it says

    "Push files to remote devices using the OBEX Object Push Profile (OPP) - Object Push Profile is not supported on Android."

    Anyone have idea on this, Please help me with this.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Maybe "this":http://overglobe.wordpress.com/2013/12/27/android-bluetooth-printer/ will help

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        seethanellai
        wrote on last edited by
        #3

        Is it possible in Qt C++? Without calling java methods?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          seethanellai
          wrote on last edited by
          #4

          Is it possible in Qt C++? Without calling java methods?

          [quote author="SGaist" date="1415053464"]Hi,

          Maybe "this":http://overglobe.wordpress.com/2013/12/27/android-bluetooth-printer/ will help[/quote]

          1 Reply Last reply
          0
          • S Offline
            S Offline
            seethanellai
            wrote on last edited by
            #5

            This is achived by QBluetoothSocket. Done.

            [quote author="seethanellai" date="1415082611"]Is it possible in Qt C++? Without calling java methods?

            [quote author="SGaist" date="1415053464"]Hi,

            Maybe "this":http://overglobe.wordpress.com/2013/12/27/android-bluetooth-printer/ will help[/quote]

            [/quote]

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Nice !

              Would you mind sharing your solution ? That might help other people :)

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • S Offline
                S Offline
                seethanellai
                wrote on last edited by
                #7

                Sure. Below is the code snippet..
                @
                /* Connect to blue tooth socket with the proper MAC address and unique uuid. UUID can be created through QBluetoothUUID */

                // Connect to service
                static const QLatin1String serviceUuid("00001101-0000-1000-8000-00805F9B34FB");

                m_pBtSocket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
                
                    QBluetoothAddress address = QBluetoothAddress("74:F0:7D:E2:23:44");
                    m_pBtSocket->connectToService(address,QBluetoothUuid(serviceUuid),QIODevice::ReadWrite);
                

                //Connect to the signal.
                connect(m_pBtSocket, SIGNAL(connected()), this, SLOT(connected()));
                connect(m_pBtSocket, SIGNAL(disconnected()), this, SLOT(disconnected()));

                //Once it is connected to the printer then send text to it
                void bluetoothprint::connected()
                {
                m_pBtSocket->write(text);
                m_pBtSocket->write("\n\n\n\n\n\r");

                m_pTextEdit->append("Connected: " + m_pBtSocket->peerName());
                

                }

                void bluetoothprint::disconnected()
                {
                m_pTextEdit->append("disconnected");
                }
                @

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Thanks !

                  Happy coding !

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MTCA
                    wrote on last edited by
                    #9

                    Hi, Thank you for sharing your code.
                    Just wanted to know if the above mechanism can work for any printer or it is printer specific?
                    With the reference of your code, i am able to connect to various printer models but I am not able to print the text using write().

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      Togay210
                      Banned
                      wrote on last edited by Togay210
                      #10
                      This post is deleted!
                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved