[Solved] Bluetooth Printing using Qt
-
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
-
Is it possible in Qt C++? Without calling java methods?
-
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]
-
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 :)
-
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 !
-
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().