This Extension allows your application to control the low coast BLE ‘cat’ thermal printer:
Typically, such printers have their own official Android application. However, the printer protocol remains private, making it difficult for it to connect to a user application.
For example, you can make an application for a toy store that can scan products and print receipts. Your children will be delighted)
I used information from an article about reverse engineering and a ready-made library for Arduino to figure out how communication with the printer works.
The purpose of the extension is to connect a printer and print a canvas, which must first be created in the user application:
Properties:
Methods:
Note: Search by name is needed in order to connect to a compatible device whose name is different to “MXxx”
Note: The device must first be found
Note: The extension automatically converts the canvas to black and white. However, to avoid unpredictable results, it is better to draw the image in black and white. If desired, the image can be converted to the width of the printer paper, or centered.
Events:
Possible error codes:
ERR_BLE_NOT_SUPORTED=1;
ERR_API_LEVEL_NOT_SUPORTED =2;
ERR_SYSTEM_NOT_SUPORTED =3;
ERR_BLE_IS_DISABLED =4;
ERR_SCANNER_ALREADY_RUNNING =5;
ERR_BLE_ALREADY_CONNECTED =6;
ERR_BLE_DISCONNECTED =7;
ERR_TPCAT_NOT_FOUND =8;
ERR_TPCAT_NOT_CONNECTED =9;
ERR_BLE_SEND=10;
ERR_TPCAT_ALREADY_PRINTING =11;
ERR_TPCAT_PRINT_ERROR =12;
Possible status codes:
ST_INIT_SCAN = 1;
ST_STOP_SCAN = 2;
ST_BLE_DEV_FOUND = 3;
ST_TPCAT_FOUND = 4;
ST_TPCAT_INIT_CONNECT = 5;
ST_TPCAT_CONNECTED = 6;
ST_TPCAT_DESCONNECTED = 7;
ST_TPCAT_PRINT_COMPLETE = 8;
Current Version:
ScBleTpCatV2.aix (38.5 KB)
Test Project :
BleTpTestV2.aia (132.4 KB)
Note: The extension was only tested on printer “MX05”. Perhaps it will work on other similar printers, with a paper width of 56mm and a resolution of 384 pixels.