[Solved] Bluetooth Printing using Qt
-
wrote on 3 Nov 2014, 10:42 last edited by
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.
-
Hi,
Maybe "this":http://overglobe.wordpress.com/2013/12/27/android-bluetooth-printer/ will help
-
wrote on 4 Nov 2014, 06:29 last edited by
Is it possible in Qt C++? Without calling java methods?
-
wrote on 4 Nov 2014, 06:30 last edited by
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]
-
wrote on 4 Nov 2014, 10:34 last edited by
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]
-
Nice !
Would you mind sharing your solution ? That might help other people :)
-
wrote on 5 Nov 2014, 05:44 last edited by
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");
}
@ -
Thanks !
Happy coding !
-
wrote on 19 Aug 2020, 07:02 last edited by
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(). -
This post is deleted!