Portable Bluetooth Thermal Printer Goojprt PT-210
Version: PT2D-6004
Interfaces: Bluetooth 4.0 (classic/bluetooth low energy), Mini USB
Print method: Line thermal printer
Dot per line: 384 dots/line
Commands: ESC/POS compatible with order sets
Internal characters: ASCII CH, GB18030
Text/Graphic support: english, russian, ukrainian, figure, symbol, chinese, graph, curve, icon pre-stored, 9 barcodes, QR code, PDF417
We had used this printer in some pet projects. We don’t have a full bluetooth spec so do some research.
After power on this printer starts advertising bluetooth packets.
As you can see on the screenshot this device supports bluetooth classic and bluetooth low energy protocols.
Advertising packet contains two services:
UUID = 0x18F0 (000018f0-0000-1000-8000-00805f9b34fb) – its a standard battery service
UUID = e7810a71-73ae-499d-8c15-faa9aef0c3f2 – its a custom service
Connect to printer by bluetooth and discover services:
There are 4 services:
uuid=”000018f0-0000-1000-8000-00805f9b34fb” (battery)
uuid=”0000fee7-0000-1000-8000-00805f9b34fb” (Custom UUID of Tencent Holdings Limited)
uuid=”e7810a71-73ae-499d-8c15-faa9aef0c3f2″ (Custom printer service)
uuid=”49535343-fe7d-4ae5-8fa9-9fafd205e455″ (ISSC Proprietary Service, UART ISSC dual mode)
and characteristics:
(Battery service)
<service uuid=”000018f0-0000-1000-8000-00805f9b34fb”>
<characteristic uuid=”00002af0-0000-1000-8000-00805f9b34fb”>
<descriptor configure=”CCCD”/>
<property name=”NOTIFY”/>
</characteristic>
<characteristic uuid=”00002af1-0000-1000-8000-00805f9b34fb”>
<permission name=”WRITE”/>
<property name=”WRITE”/>
<property name=”WRITE_WITHOUT_RESPONSE”/>
</characteristic>
</service>
(Custom UUID of Tencent Holdings Limited)
<service uuid=”0000fee7-0000-1000-8000-00805f9b34fb”>
<characteristic uuid=”0000fec8-0000-1000-8000-00805f9b34fb”>
<descriptor configure=”CCCD”/>
<property name=”INDICATE”/>
</characteristic>
<characteristic uuid=”0000fec7-0000-1000-8000-00805f9b34fb”>
<permission name=”WRITE”/>
<property name=”WRITE”/>
<property name=”WRITE_WITHOUT_RESPONSE”/>
</characteristic>
</service>
(ISSC Proprietary Service)
<service uuid=”49535343-fe7d-4ae5-8fa9-9fafd205e455″>
<characteristic uuid=”49535343-1e4d-4bd9-ba61-23c647249616″> (ISSC Transparent TX)
<descriptor configure=”CCCD”/>
<property name=”NOTIFY”/>
</characteristic>
<characteristic uuid=”49535343-8841-43f4-a8d4-ecbe34729bb3″> (ISSC Transparent RX)
<permission name=”WRITE”/>
<property name=”WRITE”/>
<property name=”WRITE_WITHOUT_RESPONSE”/>
</characteristic>
<characteristic uuid=”49535343-aca3-481c-91ec-d85e28a60318″> (ISSC Air Patch)
<descriptor configure=”CCCD”/>
<permission name=”WRITE”/>
<property name=”WRITE”/>
<property name=”NOTIFY”/>
</characteristic>
</service>
(Custom printer service)
<service uuid=”e7810a71-73ae-499d-8c15-faa9aef0c3f2″>
<characteristic uuid=”bef8d6c9-9c21-4c9e-b632-bd58c1009f9f”>
<descriptor configure=”CCCD”/>
<property name=”NOTIFY”/>
</characteristic>
<characteristic uuid=”bef8d6c9-9c21-4c9e-b632-bd58c1009f9f”>
<permission name=”WRITE”/> (in fact write not available)
<property name=”WRITE”/>
<property name=”WRITE_WITHOUT_RESPONSE”/>
</characteristic>
</service>
To print a text we try to use characteristic uuid=”bef8d6c9-9c21-4c9e-b632-bd58c1009f9f” but in fact write operation is not available for this characteristic.
We able to print a text using another characteristic uuid=”49535343-8841-43f4-a8d4-ecbe34729bb3″ (ISSC Transparent RX)
You could prepare commands manually or use a library. For example:
“com.github.anastaciocintra:escpos-coffee:4.1.0”
To print “CITRUSDEV” you should convert this text into UTF-8 hex bytes (ASCII table) and add LF CR in hex (new line)
//text.toByteArray(Charsets.UTF_8)
val bytes = byteArrayOf(0x43, 0x49, 0x54, 0x52, 0x55, 0x53, 0x44, 0x45, 0x56, 0x0A, 0x0D)
val characteristic: BluetoothGattCharacteristic = bluetoothGatt.getService(serviceUUID).getCharacteristic(characteristicUUID)
characteristic.value = bytes
characteristic.writeType = BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE
bluetoothGatt.writeCharacteristic(characteristic)
You could set different text style, alignment, font size or print image by sending ESC command (0x1B) and params.
Authored by Maksym Baidala.