### GET /api/industryTemplate/sizes Source: https://printers.niim.blue/other/niimbot-cloud Fetches all available template sizes. ```APIDOC ## GET /api/industryTemplate/sizes ### Description Gat all available template sizes ### Method GET ### Endpoint https://print.niimbot.com/api/industryTemplate/sizes ### Parameters None ### Request Example ``` GET https://print.niimbot.com/api/industryTemplate/sizes HTTP/1.1 ``` ### Response #### Success Response (200) - **[List of available template sizes]** #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### GET /api/hardware/list Source: https://printers.niim.blue/other/niimbot-cloud Retrieves a list of all NIIMBOT printer characteristics. ```APIDOC ## GET /api/hardware/list ### Description Get all NIIMBOT printers characteristics. ### Method GET ### Endpoint https://print.niimbot.com/api/hardware/list ### Parameters None ### Request Example ``` GET https://print.niimbot.com/api/hardware/list HTTP/1.1 ``` ### Response #### Success Response (200) - **[List of printer objects, each with various characteristics]** #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Get Templates by Size Source: https://printers.niim.blue/other/niimbot-cloud Retrieves a paginated list of templates filtered by specific dimensions and language. ```HTTP POST https://print.niimbot.com/api/industryTemplate/page HTTP/1.1 Content-Type: application/json niimbot-user-agent: AppVersionName/999.0.0 { "languageCode": "en", "width": 50, "height": 30, "limit": 256, "page": 1 } ``` -------------------------------- ### Get Industry Template Sizes Source: https://printers.niim.blue/other/niimbot-cloud Fetches all available dimensions for industry-specific label templates. ```HTTP GET https://print.niimbot.com/api/industryTemplate/sizes HTTP/1.1 niimbot-user-agent: AppVersionName/999.0.0 ``` -------------------------------- ### Get Industry Template Categories Source: https://printers.niim.blue/other/niimbot-cloud Retrieves categorized label templates based on language, width, and height parameters. ```HTTP POST https://print.niimbot.com/api/industryTemplate/categories HTTP/1.1 Content-Type: application/json niimbot-user-agent: AppVersionName/999.0.0 { "languageCode": "en", "width": 50, "height": 30, "limit": 10, "page": 1 } ``` -------------------------------- ### Get Cloud Template by OneCode Source: https://printers.niim.blue/other/niimbot-cloud Retrieves specific label roll properties using a unique identifier. Requires a POST request with the 'oneCode' parameter in the JSON body. ```HTTP POST https://print.niimbot.com/api/template/getCloudTemplateByOneCode HTTP/1.1 Content-Type: application/json niimbot-user-agent: AppVersionName/999.0.0 { "oneCode" : "02282280" } ``` -------------------------------- ### Get RFID Label Information Source: https://printers.niim.blue/other/niimbot-cloud Retrieves remaining print counts and metadata for a specific label roll via serial number. Note that the API response is encrypted. ```HTTP POST https://print.niimbot.com/api/rfid/getRfid HTTP/1.1 Content-Type: application/json niimbot-user-agent: OS/Android AppVersionName/999.0.0 DeviceId/xxx referer/CP001Mobile count/1111111 { "serialNumber" : "PZ1G311330000385" } ``` -------------------------------- ### POST /api/industryTemplate/page Source: https://printers.niim.blue/other/niimbot-cloud Fetches templates based on specified size criteria. ```APIDOC ## POST /api/industryTemplate/page ### Description Get templates by size ### Method POST ### Endpoint https://print.niimbot.com/api/industryTemplate/page ### Parameters #### Request Body - **languageCode** (string) - Required - The language code for the templates. - **width** (integer) - Required - The width of the template. - **height** (integer) - Required - The height of the template. - **limit** (integer) - Optional - The maximum number of templates to return per page. - **page** (integer) - Optional - The page number for pagination. ### Request Example ```json { "languageCode": "en", "width": 50, "height": 30, "limit": 256, "page": 1 } ``` ### Response #### Success Response (200) - **[List of templates matching the specified size]** #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### POST /api/industry/listIndustryCategoryMachineAdaptInfo Source: https://printers.niim.blue/other/niimbot-cloud Retrieves adaptation information for industry categories and machines. ```APIDOC ## POST /api/industry/listIndustryCategoryMachineAdaptInfo ### Description Retrieves adaptation information for industry categories and machines. ### Method POST ### Endpoint https://print.niimbot.com/api/industry/listIndustryCategoryMachineAdaptInfo ### Parameters #### Request Body - **[No specific fields mentioned in the provided text, assuming an empty or generic body might be used]** ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **[Information about machine adaptation to industry categories]** #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Flash Firmware using jcPrinterSdk (Python) Source: https://printers.niim.blue/firmware/flashing-firmware This Python script utilizes the jcPrinterSdk to connect to a local websocket server and flash firmware onto a Niim Blue printer. It requires the 'websocket-client' library. The script establishes a connection, selects the printer, enables logging, reads the firmware file, calculates its CRC32 checksum, and then sends the firmware update request. ```python import websocket import json from zlib import crc32 websocket_url = "ws://localhost:37989" filename = "/absolute/path/to/firmware.bin" version = "3.01" ws = websocket.WebSocket() ws.connect(websocket_url) # receiving info about connected printers req = {"apiName": "getAllPrinters"} ws.send(json.dumps(req)) connectData = {} message = json.loads(ws.recv()) if message.get("resultAck", None) and message["resultAck"].get("info", None): info = json.loads(message["resultAck"]["info"]) connectData["printerName"] = [*info][0] connectData["port"] = int(info[connectData["printerName"]]) # connect Printer req = {"apiName": "selectPrinter", "parameter": connectData} ws.send(json.dumps(req)) message = ws.recv() print(json.loads(message)) # enable detailed logging to console req = {"apiName": "enableConsoleAllLog", "parameter": {"isEnable": 1}} ws.send(json.dumps(req)) while True: message = json.loads(ws.recv()) if message.get("apiName", None) == req["apiName"]: break print(message) with open(filename, "rb") as f: fw = f.read() crc = crc32(fw) print(f"Firmware CRC: {crc:08X}") req = { "apiName": "updateFirmware", "parameter": { "fileName": filename, "strSwVersion": version, "strCrc": f"{crc:08X}", }, } ws.send(json.dumps(req)) while True: message = json.loads(ws.recv()) if message.get("apiName", None) == req["apiName"]: print(message) resAck = message.get("resultAck", None) if resAck and resAck.get("result", None) == 0: break # close the websocket connection ws.close() ``` -------------------------------- ### SetPageSize Command Structures Source: https://printers.niim.blue/interfacing/proto Configures the print page dimensions and settings. The command format varies in length (2 to 13 bytes) depending on the printer model and specific configuration requirements. ```binary 55 55 13 02 00 f0 XX aa aa 55 55 13 04 00 f0 01 80 XX aa aa 55 55 13 06 00 f0 01 80 00 01 XX aa aa 55 55 13 09 00 f0 01 80 00 01 00 00 00 XX aa aa 55 55 13 0d 00 f0 01 80 00 01 00 00 00 00 00 00 00 XX aa aa ``` -------------------------------- ### POST /api/firmware/machineCascadeDetail Source: https://printers.niim.blue/other/niimbot-cloud Checks for firmware updates and retrieves printer characteristics. Supports different base URLs for production and testing. ```APIDOC ## POST /api/firmware/machineCascadeDetail ### Description Check firmware update and some printer characteristics. ### Method POST ### Endpoint - `https://print.niimbot.com/api/firmware/machineCascadeDetail` - `https://print.jc-test.cn/api/firmware/machineCascadeDetail` (for testing) ### Parameters #### Request Body - **machineName** (string) - Required - The name of the printer machine. - **firmVersion** (string) - Required - The current firmware version. ### Request Example ```json { "machineName" : "B1", "firmVersion": "5.10" } ``` ### Response #### Success Response (200) - **[Details about firmware update availability and printer characteristics]** #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### List Industry Category Machine Adaptations Source: https://printers.niim.blue/other/niimbot-cloud Retrieves information regarding machine adaptation for various industry categories. ```HTTP POST https://print.niimbot.com/api/industry/listIndustryCategoryMachineAdaptInfo HTTP/1.1 Content-Type: application/json niimbot-user-agent: AppVersionName/999.0.0 ``` -------------------------------- ### Check Machine Firmware and Characteristics Source: https://printers.niim.blue/other/niimbot-cloud Checks for firmware updates and retrieves printer characteristics for a specific model. Supports both production and testing environments. ```HTTP POST https://print.niimbot.com/api/firmware/machineCascadeDetail HTTP/1.1 Content-Type: application/json niimbot-user-agent: AppVersionName/999.0.0 { "machineName" : "B1", "firmVersion": "5.10" } ``` ```HTTP POST https://print.jc-test.cn/api/firmware/machineCascadeDetail HTTP/1.1 Content-Type: application/json niimbot-user-agent: AppVersionName/999.0.0 { "machineName" : "B1", "firmVersion": "5.20" } ``` -------------------------------- ### SetPageSize Command Source: https://printers.niim.blue/interfacing/proto This command configures the page size for printing. The format varies based on the required data length, affecting row count, column count, and other parameters. ```APIDOC ## SetPageSize Command ### Description Configures the page size for printing. The format varies based on the required data length, affecting row count, column count, and other parameters. Column count must be less than or equal to the printhead size. ### Method Not Applicable (Command Packet) ### Endpoint Not Applicable (Command Packet) ### Parameters #### Command Variants: - **2 bytes**: `55 55 13 02 00 f0 XX aa aa` - `00 f0`: Row count (240px) - `XX`: Checksum - **4 bytes**: `55 55 13 04 00 f0 01 80 XX aa aa` - `00 f0`: Row count (240px) - `01 80`: Column count (384px) - `XX`: Checksum - **6 bytes**: `55 55 13 06 00 f0 01 80 00 01 XX aa aa` - `00 f0`: Row count (240px) - `01 80`: Column count (384px) - `00 01`: Copies count - `XX`: Checksum - **9 bytes**: `55 55 13 09 00 f0 01 80 00 01 00 00 00 XX aa aa` - `00 f0`: Row count (240px) - `01 80`: Column count (384px) - `00 01`: Copies count - `00 00 00`: Is divide (0 or 1, unknown use) - `XX`: Checksum - **13 bytes**: `55 55 13 0d 00 f0 01 80 00 01 00 00 00 00 00 00 00 XX aa aa` - `00 f0`: Row count (240px) - `01 80`: Column count (384px) - `00 01`: Copies count - `00 00 00`: Unknown use fields - `00 00 00 00`: Unknown use fields - `XX`: Checksum ### Request Example ``` 55 55 13 04 00 f0 01 80 XX aa aa ``` ### Response No specific response documented for this command. Success is typically indicated by the absence of error signals. ``` -------------------------------- ### POST /api/template/getCloudTemplateByOneCode Source: https://printers.niim.blue/other/niimbot-cloud Retrieves label roll properties using a unique code. ```APIDOC ## POST /api/template/getCloudTemplateByOneCode ### Description Get label roll properties by unique id. ### Method POST ### Endpoint https://print.niimbot.com/api/template/getCloudTemplateByOneCode ### Parameters #### Request Body - **oneCode** (string) - Required - The unique identifier for the label roll. ### Request Example ```json { "oneCode" : "02282280" } ``` ### Response #### Success Response (200) - **[Fields will vary based on the specific template properties]** #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### POST /api/industryTemplate/categories Source: https://printers.niim.blue/other/niimbot-cloud Retrieves template categories based on specified criteria. ```APIDOC ## POST /api/industryTemplate/categories ### Description Get template categories ### Method POST ### Endpoint https://print.niimbot.com/api/industryTemplate/categories ### Parameters #### Request Body - **languageCode** (string) - Required - The language code for the categories. - **width** (integer) - Required - The width of the template. - **height** (integer) - Required - The height of the template. - **limit** (integer) - Optional - The maximum number of categories to return. - **page** (integer) - Optional - The page number for pagination. ### Request Example ```json { "languageCode": "en", "width": 50, "height": 30, "limit": 10, "page": 1 } ``` ### Response #### Success Response (200) - **[List of template categories]** #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Retrieve Hardware and Firmware Information Source: https://printers.niim.blue/interfacing/serial-commands Commands to query the printer's hardware version, model, serial number, and firmware version. These commands return formatted strings containing device identification data. ```text #10001 #10003 ``` -------------------------------- ### PrintEmptyRow Command Source: https://printers.niim.blue/interfacing/proto This command is used to fill a specified row with blank (white) pixels. It allows for repeating the blank row multiple times. ```APIDOC ## PrintEmptyRow Command ### Description Used to fill a row with blank (white) pixels. Allows for repeating the blank row multiple times. ### Method Not Applicable (Command Packet) ### Endpoint Not Applicable (Command Packet) ### Parameters - **Command**: `55 55 84` - **Data Length**: Variable - **Row Number**: (1 byte) The row to be filled with blank pixels. - **Repeat Count**: (1 byte) Number of times to repeat the blank row. - **Checksum**: (2 bytes) Calculated checksum. ### Request Example ``` 55 55 84 03 00 04 02 XX aa aa ``` - `00 04`: Row number is 4 - `02`: Repeat count (repeat row two times) - `XX`: Checksum ### Response No specific response documented for this command. Success is typically indicated by the absence of error signals. ``` -------------------------------- ### List NIIMBOT Printers Source: https://printers.niim.blue/other/niimbot-cloud Retrieves a comprehensive list of all supported NIIMBOT printer characteristics. ```HTTP GET https://print.niimbot.com/api/hardware/list HTTP/1.1 ``` ```HTTP GET https://oss-print.niimbot.com/public_resources/static_resources/devices.json HTTP/1.1 ``` -------------------------------- ### PrintEmptyRow Command Source: https://printers.niim.blue/interfacing/proto Instructs the printer to output a blank row. The packet includes a row number and a repeat count to optimize whitespace printing. ```binary 55 55 84 03 00 04 02 XX aa aa ``` -------------------------------- ### Heartbeat Command Source: https://printers.niim.blue/interfacing/proto Maintains the connection between the host and the printer. Different versions exist based on the printer's protocol version. ```binary 55 55 dc 01 01 dc aa aa 55 55 dc 01 04 d9 aa aa ``` -------------------------------- ### Hardware Information Commands Source: https://printers.niim.blue/interfacing/serial-commands Endpoints for retrieving hardware and firmware identification details from the printer. ```APIDOC ## GET #10001 ### Description Retrieves the hardware version and printer identification (model and serial number). ### Method GET ### Endpoint #10001 ### Response #### Success Response (200) - **data** (string) - Returns format: #10001:V[version],D[model]-[serial],[status] ### Response Example #10001:V13.10,D110-G326030306,1 --- ## GET #10003 ### Description Retrieves the current firmware version of the printer. ### Method GET ### Endpoint #10003 ### Response #### Success Response (200) - **version** (string) - Returns format: #10003:[version]*[checksum]# ### Response Example #10003:13.14*21# ``` -------------------------------- ### POST /api/rfid/getRfid Source: https://printers.niim.blue/other/niimbot-cloud Fetches remaining prints and other information for a label using its serial number. The response is encrypted. ```APIDOC ## POST /api/rfid/getRfid ### Description Get label remaining prints and other info by serial number. Response is encrypted. ### Method POST ### Endpoint https://print.niimbot.com/api/rfid/getRfid ### Parameters #### Request Body - **serialNumber** (string) - Required - The serial number of the label. ### Request Example ```json { "serialNumber" : "PZ1G311330000385" } ``` ### Response #### Success Response (200) - **[Encrypted data containing label information]** #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### PrintBitmapRow Command Source: https://printers.niim.blue/interfacing/proto This command sends a full row segment containing both black and white pixels. It includes the row number, repeat count, black pixel count, and pixel data. ```APIDOC ## PrintBitmapRow Command ### Description Used to send a full row segment that includes both black and white pixels. It specifies the row number, repeat count, black pixel count, and the pixel data itself. ### Method Not Applicable (Command Packet) ### Endpoint Not Applicable (Command Packet) ### Parameters - **Command**: `55 55 85` - **Data Length**: Variable - **Row Number**: (1 byte) The row number to print. - **Black Pixel Count**: (2 bytes) Total number of black pixels in the row, in little-endian format (`[0, LL, HH]` for total mode). - **Repeat Count**: (1 byte) Number of times to repeat the row. - **Pixel Data**: Variable length, representing the row's pixels. - **Checksum**: (2 bytes) Calculated checksum. ### Request Example ``` 55 55 85 0a 00 00 13 00 00 01 ff 00 df 0f XX aa aa ``` - `00 00`: Row number is 0 - `13 00`: Black pixel count (19) - `00 01`: Repeat count (repeat row 1 time) - `ff 00 df 0f`: Pixel data (Draw 32 pixels: 19 black, 13 empty) - `XX`: Checksum ### Response No specific response documented for this command. Success is typically indicated by the absence of error signals. ### Black Pixel Count Segment Details - **Split Mode**: Calculates non-zero bits in chunks. Base chunk size is `printhead size / 8 / 3`. - **Total Mode**: Returns total number of pixels in little-endian format: `[0, LL, HH]`. - **Auto Mode**: Defaults to split mode, falls back to total mode if unavailable. ``` -------------------------------- ### PrintBitmapRowIndexed Command Source: https://printers.niim.blue/interfacing/proto Optimized command for rows with fewer than 7 black pixels. It uses unsigned 16-bit integers to define the specific X-coordinates of black pixels. ```binary 55 55 83 0a 00 03 02 00 00 02 00 0a 01 40 XX aa aa ``` -------------------------------- ### Hardware Testing and Control Commands Source: https://printers.niim.blue/interfacing/serial-commands A collection of diagnostic commands to interact with printer hardware components including the motor, sensors, and RFID modules. Note that some commands require specific parameters like speed or length. ```text test beep test motor [-] test motor test get sensor test get id test set id test print test flash test rfid1 test rfid2 test unlock chip test get chip lock test rfidMode test exit ``` -------------------------------- ### PrintBitmapRow Command Source: https://printers.niim.blue/interfacing/proto Sends a full row segment containing both black and white pixels. The packet specifies the row number, repeat count, and black pixel count for rendering. ```binary 55 55 85 0a 00 00 13 00 00 01 ff 00 df 0f XX aa aa ``` -------------------------------- ### PrintBitmapRowIndexed Command Source: https://printers.niim.blue/interfacing/proto This command is used when the black pixel count is less than 7. Pixel data is encoded using pixel indexes (unsigned 16-bit integers). ```APIDOC ## PrintBitmapRowIndexed Command ### Description Used when the black pixel count is less than 7. Data is encoded with pixel indexes (unsigned 16-bit integers). ### Method Not Applicable (Command Packet) ### Endpoint Not Applicable (Command Packet) ### Parameters - **Command**: `55 55 83` - **Data Length**: Variable - **Row Number**: (1 byte) The row number. - **Black Pixel Count**: (1 byte) The count of black pixels. - **Repeat Count**: (1 byte) Number of times to repeat the row. - **Pixel Indexes**: Variable length, unsigned 16-bit integers representing pixel positions. - **Checksum**: (2 bytes) Calculated checksum. ### Request Example ``` 55 55 83 0a 00 03 02 00 00 02 00 0a 01 40 XX aa aa ``` - `00 03`: Row number is 3 - `02`: Black pixel count (2) - `00 00`: Repeat count (repeat row two times) - `02 00`: Draw pixel at x=10 - `0a 01`: Draw pixel at x=320 - `40`: Checksum ### Response No specific response documented for this command. Success is typically indicated by the absence of error signals. ``` -------------------------------- ### Custom Bootloader for Artery AT32F403ARCT7 Source: https://printers.niim.blue/hardware/NIIMBOT-B21_C2B/niimbot-b21-c2b-unbrick A minimal C bootloader designed to jump to the main application firmware located at address 0x08002000. It checks for a valid stack address before disabling interrupts, setting the Vector Table Offset Register (VTOR), and enabling interrupts to safely transition to the application. This code is intended for the Artery AT32F403ARCT7 microcontroller. ```c #include "at32f403a_407.h" #define APP_ADDRESS 0x08002000 typedef void (*pFunction)(void); void jump_to_app(void) { uint32_t appStack = *(__IO uint32_t*)APP_ADDRESS; pFunction appEntry = (pFunction)*(__IO uint32_t*)(APP_ADDRESS + 4); if ((appStack & 0x2FFE0000) == 0x20000000) // Check for valid RAM address { __disable_irq(); SCB->VTOR = APP_ADDRESS; __set_MSP(appStack); __enable_irq(); appEntry(); } } int main(void) { jump_to_app(); while (1) {} } ``` -------------------------------- ### Heartbeat Command Source: https://printers.niim.blue/interfacing/proto Sends a heartbeat signal to the printer to maintain connection. Two advanced versions are available depending on the protocol version. ```APIDOC ## Heartbeat Command ### Description Sends a heartbeat signal to the printer to maintain connection. Two advanced versions are available depending on the protocol version. ### Method Not Applicable (Command Packet) ### Endpoint Not Applicable (Command Packet) ### Parameters #### Advanced 1: - **Command**: `55 55 dc 01 01 dc` #### Advanced 2 (for `protocolVersion >= 3`): - **Command**: `55 55 dc 01 04 d9` ### Request Example ``` 55 55 dc 01 01 dc aa aa ``` ### Response No specific response documented for this command. Successful heartbeat is typically indicated by the printer remaining responsive. ``` -------------------------------- ### Printer Control and Diagnostics Source: https://printers.niim.blue/interfacing/serial-commands Commands for controlling physical printer components like motors and sensors. ```APIDOC ## POST test motor ### Description Controls the printer motor speed and duration, or stops the motor. ### Method POST ### Endpoint test motor [-] ### Parameters #### Request Body - **speed** (integer) - Required - Motor speed value - **length** (integer) - Required - Duration or length of movement --- ## GET test get sensor ### Description Retrieves data from the printer's internal system sensors. ### Method GET ### Endpoint test get sensor ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.