A printing method and a printer supporting local multi-mode switching and cloud revocation

By combining a barcode scanning and button switching mechanism with local caching and a role QR code library, the cloud printer achieves local multi-mode switching and automatic verification, solving the problems of cumbersome switching and complex management in existing technologies, and improving operational efficiency and data management efficiency.

CN122018829BActive Publication Date: 2026-07-10ZHUHAI XPRINTER ELECTRONICS TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHUHAI XPRINTER ELECTRONICS TECHNOLOGY CO LTD
Filing Date
2026-04-09
Publication Date
2026-07-10

Smart Images

  • Figure CN122018829B_ABST
    Figure CN122018829B_ABST
Patent Text Reader

Abstract

The application provides a printing method and a printer supporting local multi-mode switching and cloud verification, comprising: synchronously defining a required business mode on a printing device and a cloud to establish a business mode configuration table; declaring the printing device as a composite device to establish a simulated keyboard transmission channel; continuously monitoring local interactive events of the printing device and switching through the business mode configuration table; attaching an intention identifier to original commodity barcode data and generating verification data; sending the verification data to the cloud or a "keyed" POS machine, and automatically performing verification and inventory management according to the intention identifier. The application switches the business through a multi-channel mode switching trigger mechanism in combination with a local business mode configuration table or a role two-dimensional code library, and establishes a data link between the cloud platform, the POS machine and the intelligent printing device, so that the cloud or the POS machine can directly identify the business intention and trigger the corresponding business process, achieving the effects of supporting local multi-mode switching and realizing end-to-end intelligent business processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of printer technology, and specifically to a printing method and printer that supports local multi-mode switching and cloud verification. Background Technology

[0002] Currently, the core function of most cloud printers on the market is to print out instructions issued from the cloud or a connected host. In a POS system, this host is typically a PC / POS machine. Some high-end printers integrate a barcode scanning module, forming a barcode printer all-in-one machine, which can obtain barcode information through the built-in scanning module. A typical solution for this type of printer with a POS system is as follows: the POS machine runs the POS software and processes transaction logic, inputs product information through an external barcode scanner or the built-in scanning module, and prints shopping receipts through an external receipt printer. The devices are connected via independent USB or serial cables. Existing solutions have the following problems:

[0003] 1. Switching between different business modes is cumbersome and dependent on the network / host. When the printer needs to serve different business scenarios, such as goods receiving, issuing, and inventory counting, mode switching must be done through a host computer or cloud backend. It cannot achieve quick and direct local switching of business modes, resulting in low efficiency and the inability to work independently without a network or a ready host. Furthermore, in practical applications, complex POS systems require cashiers to possess certain skills, increasing training time and labor costs.

[0004] 2. Low equipment integration leads to complex management and low resource utilization. To achieve a complete checkout process—scanning, payment, and printing—merchants need at least three independent devices: a barcode scanner, a POS machine, and a printer. Each device requires separate configuration, monitoring, and maintenance, increasing management complexity and operational burden. Furthermore, the independent operation and limited functionality of each device result in low resource utilization. Connecting via independent USB or serial cables leads to cluttered wiring at the checkout counter, occupies multiple interfaces, increases equipment costs, and causes frequent compatibility and stability issues.

[0005] 3. Inability to achieve automatic verification and inventory management. Even if the cloud printer can scan the barcode and upload the data to the cloud, the uploaded raw barcode data itself does not carry any business scenario information. This makes it impossible for the cloud server to automatically distinguish whether a scan is for "inbound" or "outbound". Additional manual labeling or complex follow-up processing must be relied upon. However, manual labeling is prone to errors and is not conducive to verification and inventory management.

[0006] 4. Printing equipment has limited functionality and poor coordination. Traditional printers only function as output devices, with a one-way command relationship with the POS system. They cannot act as input devices to provide data to the POS system, thus failing to simplify the hardware configuration of the checkout process.

[0007] Therefore, it is necessary to design a printing method and printer that can support local multi-mode switching, composite device simulation and data routing, and realize automatic verification and inventory management. Summary of the Invention

[0008] To address the common problems in existing technologies, the present invention aims to provide a printing method and printer that supports local multi-mode switching and cloud verification. This invention achieves the effect of supporting local multi-mode switching by using a multi-channel mode switching trigger mechanism such as barcode scanning and button pressing, combined with a locally cached business mode configuration table or role QR code library for real-time query and switching.

[0009] The present invention achieves the above objectives through the following technical solutions:

[0010] A printing method that supports local multi-mode switching and cloud-based verification includes:

[0011] S1: Define the required business modes synchronously on the printing device and in the cloud, assign a unique mode code to each business mode and establish a business mode configuration table.

[0012] S2: Declare the printing device as a composite device by configuring the device descriptor in the firmware, define the composite device interface descriptor and establish a simulated keyboard transmission channel.

[0013] S3: The printing device has a built-in barcode scanning module and establishes a communication connection with the cloud and a data connection with the POS machine; it loads the business mode configuration table and initializes the barcode scanning module and the printing engine.

[0014] S4: Continuously monitor the local interaction events of the printing device and determine whether the local interaction events trigger a business mode switch. If so, switch the business mode by looking up the business mode configuration table.

[0015] S5: Obtain the original product barcode data through the scanning module, and add an intent identifier to the original product barcode data according to the unique pattern code of the current business mode to generate verification data.

[0016] S6: The verification data is sent to the cloud or "typed" into the POS machine in a simulated keyboard key sequence through the simulated keyboard transmission channel. The cloud or the POS machine automatically performs verification and inventory management based on the intent identifier.

[0017] S7: After the verification is completed, the cloud or the POS machine sends a print command to the printing device, and the printing device executes the printing task according to the print command.

[0018] According to the printing method for supporting local multi-mode switching and cloud verification provided by the present invention, step S1 further includes:

[0019] S11: Define the data structure of the required business model and create the business model configuration table in the cloud database. Define a set of API endpoints based on the RESTful architecture and use the API endpoints as the only access channel for the printing device to the business model configuration table.

[0020] S12: Select the appropriate local cache on the printing device according to the business complexity and set the synchronization manager. Call the API endpoint through the synchronization manager to pull the business mode configuration table and save it to the local cache.

[0021] S13: When the business mode configuration table changes, the cloud assigns an incrementing version number, the printing device initiates a synchronization request carrying the local version number, and the cloud returns version difference data.

[0022] According to the printing method for supporting local multi-mode switching and cloud verification provided by the present invention, step S1 further includes:

[0023] S14: The cloud assigns a unique role QR code to each of the aforementioned business models, and the content of the role QR code includes the role ID.

[0024] S15: The printing device acquires the role QR code and establishes a role QR code library. It scans the role QR code through the scanning module, parses out the role ID, and returns it to the cloud for validity verification.

[0025] According to the printing method supporting local multi-mode switching and cloud verification provided by the present invention, the firmware reconstructs the USB interface of the printing device according to the business mode, and the steps include: pre-setting a USB descriptor template pool in the firmware and selecting and loading a USB descriptor set from it at runtime, wherein the USB descriptor set includes the device descriptor and the composite device interface descriptor.

[0026] The composite device interface descriptor includes a first interface descriptor and a second interface descriptor, wherein the first interface descriptor is a printing device class and the second interface descriptor is an HID class.

[0027] According to the printing method supporting local multi-mode switching and cloud verification provided by the present invention, the device descriptor is set to: bDeviceClass=0xEF, bDeviceSubClass=0x02; the first interface descriptor is set to: bInterfaceClass=0x07, and specifies the printer protocol; the second interface descriptor is set to: bInterfaceClass=0x03, bInterfaceSubClass=0x01.

[0028] According to the printing method for supporting local multi-mode switching and cloud verification provided by the present invention, step S4 further includes:

[0029] S411: Select a physical button on the printing device as the mode switching key, and configure the input and interruption of the mode switching key.

[0030] S412: When an interrupt is triggered, the current service mode is read from the memory of the printing device, the index position of the current service mode is queried through the service mode configuration table, and the next service mode configuration is obtained in the predefined order of the table.

[0031] S413: Configure the system to switch to the next business mode according to the next business mode, and write it into the memory as the current business mode.

[0032] According to the printing method for supporting local multi-mode switching and cloud verification provided by the present invention, step S4 further includes;

[0033] S421: Scan the QR code of the role in the next business mode through the scanning module and parse out its role ID, and compare and search the role ID in the local role QR code library.

[0034] S422: If the search result is a local match, proceed to the next step; if it is not a local match, return to step S15 for validity verification.

[0035] If the role ID is verified as valid, the cloud will return the corresponding business mode configuration to the printing device by querying the business mode configuration table.

[0036] S423: The printing device loads the corresponding business mode configuration and switches to the next business mode.

[0037] According to the printing method supporting local multi-mode switching and cloud verification provided by the present invention, step S5 includes:

[0038] S51: The product barcode is read by the scanning module and decoded to obtain the original product barcode data containing the product identity string.

[0039] S52: The printing device reads the unique pattern code of the current business mode from the business mode configuration table and defines at least one delimiter.

[0040] S53: The pattern encoding, separator, and original product barcode data are sequentially concatenated and structurally encapsulated to generate structured data with business semantics.

[0041] The separator is used to distinguish the prefix of the structured data from the original product barcode data, and the prefix is ​​the intent identifier.

[0042] According to the printing method for supporting local multi-mode switching and cloud verification provided by the present invention, step S6 includes:

[0043] S611: The cloud parses the received structured data and queries the intent identifier through the business mode configuration table to identify the current business mode.

[0044] S612: Publish the current business action to the corresponding message queue topic according to the current business mode, deploy multiple corresponding business reconciliation services and subscribe to the message queue topic.

[0045] S613: The business verification service queries the product master database based on the original product barcode data to obtain product SKU information, and associates the corresponding outbound order with the printing device ID.

[0046] S614: Automatically verify and update the outbound order based on the product SKU information.

[0047] According to the printing method for supporting local multi-mode switching and cloud verification provided by the present invention, step S6 includes:

[0048] S621: Activate the POS cashier window on the printing device, parse the structured data, and simulate the USB HIDKEYBOARD device channel.

[0049] S622: Write the structured data into the keyboard report structure with key codes and modifier key states, and set keyboard_event_flag.

[0050] S623: A keyboard report is sent to the POS machine by periodically polling the IN endpoint. The POS machine parses the keyboard report and automatically performs verification.

[0051] The printing method supporting local multi-mode switching and cloud verification provided by the present invention further includes:

[0052] S8: The printing device has a built-in lightweight business rule engine and context manager. It updates the local batch context in the context manager according to the current business action, and outputs the corresponding business rules through the business rule engine according to the local batch context. It determines whether the current business action meets the business rules. If so, it triggers the automatic printing task of the summary sheet.

[0053] According to the printing method for supporting local multi-mode switching and cloud verification provided by the present invention, step S8 further includes:

[0054] S81: Call the evaluation function of the business rule engine after each update of the local batch context.

[0055] S82: The business rule engine loads all automatic printing rules under the current business mode, and sequentially uses the automatic printing rules as input and evaluates their triggering conditions through the evaluation function.

[0056] S83: Determine whether the current business action meets the triggering condition. If so, the business rule engine immediately triggers and executes the corresponding automatic printing rule's Action.

[0057] A printer that supports local multi-mode switching and cloud verification includes a memory for storing a printer program; and a processor for executing the printer program stored in the memory to implement the steps of the method described above.

[0058] Therefore, the present invention has the following beneficial effects:

[0059] 1. This invention utilizes a multi-channel mode switching trigger mechanism, including QR code scanning and button presses, combined with a locally cached business mode configuration table or role QR code library for real-time querying and switching. This enables intuitive local interaction for mode switching, reducing reliance on the host screen and network. Furthermore, its simple operation and reduced skill requirements make it particularly suitable for environments such as warehouses and retail stores that require rapid switching between work scenarios, significantly improving operational efficiency and accuracy.

[0060] 2. This invention configures the printing device as a USB composite device through the firmware layer. Compared with existing single-function or network-dependent printing solutions, the printing device can both receive printing instructions from the POS machine and send the product barcode obtained by scanning to the POS machine via keyboard input. This realizes the functions of the traditional "barcode scanner + printer" two devices, thereby significantly simplifying the cash register wiring and reducing the hardware procurement and maintenance costs for merchants.

[0061] 3. This invention dynamically adds the current business mode code as an intent prefix to the original barcode data in the printing device, and establishes a data link between the cloud platform, POS machine and intelligent printing device, enabling the cloud or POS machine to directly identify the business intent and trigger the corresponding business process, such as automated classification, verification and inventory increase / decrease, etc., thereby realizing end-to-end intelligent business processing and greatly improving data value and management efficiency.

[0062] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. Attached Figure Description

[0063] Figure 1 This is a flowchart of a printing method embodiment of the present invention that supports local multi-mode switching and cloud verification.

[0064] Figure 2 This is a complete workflow diagram of the printing device in an embodiment of a printing method that supports local multi-mode switching and cloud verification according to the present invention. Detailed Implementation

[0065] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0066] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0067] An embodiment of a printing method supporting local multi-mode switching and cloud verification.

[0068] See Figure 1 This invention relates to a printing method that supports local multi-mode switching and cloud-based verification, comprising:

[0069] S1: Define the required business modes synchronously on the printing device and in the cloud, assign a unique mode code to each business mode and establish a business mode configuration table.

[0070] S2: Declare the printing device as a composite device by configuring the device descriptor in the firmware, define the composite device interface descriptor and establish a simulated keyboard transmission channel.

[0071] S3: The printing device has a built-in barcode scanning module and establishes a communication connection with the cloud and a data connection with the POS machine; it loads the business mode configuration table and initializes the barcode scanning module and the printing engine.

[0072] S4: Continuously monitor the local interaction events of the printing device and determine whether the local interaction events trigger a business mode switch. If so, switch the business mode by looking up the business mode configuration table.

[0073] S5: Obtain the original product barcode data through the scanning module, and add an intent identifier to the original product barcode data according to the unique pattern code of the current business mode to generate verification data.

[0074] S6: The verification data is sent to the cloud or "typed" into the POS machine in a simulated keyboard key sequence through the simulated keyboard transmission channel. The cloud or the POS machine automatically performs verification and inventory management based on the intent identifier.

[0075] S7: After the verification is completed, the cloud or the POS machine sends a print command to the printing device, and the printing device executes the printing task according to the print command.

[0076] In this embodiment, step S1 further includes:

[0077] S11: Define the data structure of the required business model and create the business model configuration table in the cloud database. Define a set of API endpoints based on the RESTful architecture and use the API endpoints as the only access channel for the printing device to the business model configuration table.

[0078] S12: Select the appropriate local cache on the printing device according to the business complexity and set the synchronization manager. Call the API endpoint through the synchronization manager to pull the business mode configuration table and save it to the local cache.

[0079] S13: When the business mode configuration table changes, the cloud assigns an incrementing version number, the printing device initiates a synchronization request carrying the local version number, and the cloud returns version difference data.

[0080] Specifically, in this embodiment, a business mode configuration table is created in a cloud-based MySQL database. The business mode configuration table includes, but is not limited to, mode code, mode name, UI template file address, associated print template ID, and configuration version number.

[0081] Specifically, this embodiment sets up a configuration management interface, allowing administrators to add, delete, modify, and query business models on the Web console. Any modification will automatically increment the version field of the corresponding record to update the version number.

[0082] Specifically, in this embodiment, the cloud receives request parameters from the printing device including device_id (device identifier) ​​and local_version (local version number), and responds with full or incremental configuration data. For example, when local_version is lower than the latest version on the cloud, it returns difference data, which is used by the printing device to obtain its latest available business mode configuration.

[0083] In this embodiment, step S1 further includes:

[0084] S14: The cloud assigns a unique role QR code to each of the aforementioned business models, and the content of the role QR code includes the role ID.

[0085] S15: The printing device acquires the role QR code and establishes a role QR code library. It scans the role QR code through the scanning module, parses out the role ID, and returns it to the cloud for validity verification.

[0086] Specifically, the steps for generating the role QR code in this embodiment include: creating a role profile, which includes, but is not limited to, role ID, bound personnel, bound business mode, and permissions; generating a JSON string containing role ID, timestamp, and a random number (the random number is for preventing replay); digitally signing the JSON string to form a payload string; and converting the payload string into a role QR code. For example, taking the warehouse clerk role, the role profile includes: Role ID: ROLE_WAREHOUSE_RECEIVER_01; Bound Personnel: Zhang (Warehouse Clerk); Bound Business Mode: MODE_RECEIVING (Receiving Mode); Validity Period: From [Date] to [Date]; Permissions: Can perform receiving and printing warehouse labels, but cannot perform outbound operations.

[0087] Specifically, in this embodiment, after scanning the role's QR code, the printing device sends the parsed role ID and its own printing device ID to the cloud's verification interface. The cloud then performs a chain-like validity verification, which includes the following steps:

[0088] S151: Verify the digital signature using the public key.

[0089] S152: Verify timeliness and prevent replay attacks by checking whether the timestamp is within its validity period and whether the random number has not been used.

[0090] S153: Check the role status by querying the database to confirm whether the role is enabled and within its validity period.

[0091] S154: Confirm that the print device ID is in the authorized device list for this role.

[0092] In this embodiment, the firmware reconstructs the USB interface of the printing device according to the business mode. The steps include: pre-setting a USB descriptor template pool in the firmware and selecting and loading a USB descriptor set from it at runtime. The USB descriptor set includes the device descriptor and the composite device interface descriptor. The composite device interface descriptor includes a first interface descriptor and a second interface descriptor. The first interface descriptor is a printing device class, and the second interface descriptor is an HID class.

[0093] In this embodiment, the device descriptor is set to: bDeviceClass=0xEF, bDeviceSubClass=0x02; the first interface descriptor is set to: bInterfaceClass=0x07, and specifies the printer protocol; the second interface descriptor is set to: bInterfaceClass=0x03, bInterfaceSubClass=0x01.

[0094] Specifically, this embodiment defines and initializes key USB data structures in the memory of the printing device. The configuration descriptor set includes, in order: Interface association descriptor: bFirstInterface=0, bInterfaceCount=2, used to bind the composite device interface; Printer interface descriptor: bInterfaceNumber=0, bInterfaceClass=0x07, this is the first interface descriptor setting, used to allocate Bulk-IN and Bulk-OUT endpoints; HID keyboard interface descriptor: bInterfaceNumber=1, bInterfaceClass=0x03, bInterfaceSubClass=0x01, this is the second interface descriptor setting, used to allocate the Interrupt-IN endpoint; HID report descriptor: used to define standard keyboard reports, such as 6-byte input report description keys, modifier keys, etc.

[0095] Specifically, this embodiment also includes the configuration of Bulk-IN, Bulk-OUT, and Interrupt-IN endpoints. The type, size, and address of each endpoint are calculated and set. For example, the Bulk-IN endpoint is configured as 0x81 for printer status return; the Bulk-OUT endpoint is configured as 0x01 for receiving print data; and the Interrupt-IN endpoint is configured as 0x82 for sending keyboard reports.

[0096] In this embodiment, step S4 further includes:

[0097] S411: Select a physical button on the printing device as the mode switching key, and configure the input and interruption of the mode switching key.

[0098] S412: When an interrupt is triggered, the current service mode is read from the memory of the printing device, the index position of the current service mode is queried through the service mode configuration table, and the next service mode configuration is obtained in the predefined order of the table.

[0099] S413: Configure the system to switch to the next business mode according to the next business mode, and write it into the memory as the current business mode.

[0100] Specifically, this embodiment uses physical buttons as mode switching keys in ways including, but not limited to, short-press switching, double-click switching, and combination key switching.

[0101] In this embodiment, step S4 further includes;

[0102] S421: Scan the QR code of the role in the next business mode through the scanning module and parse out its role ID, and compare and search the role ID in the local role QR code library.

[0103] S422: If the search result is a local match, proceed to the next step; if it is not a local match, return to step S15 for validity verification.

[0104] If the role ID is verified as valid, the cloud will return the corresponding business mode configuration to the printing device by querying the business mode configuration table.

[0105] S423: The printing device loads the corresponding business mode configuration and switches to the next business mode.

[0106] In this embodiment, step S5 includes:

[0107] S51: The product barcode is read by the scanning module and decoded to obtain the original product barcode data containing the product identity string.

[0108] S52: The printing device reads the unique pattern code of the current business mode from the business mode configuration table and defines at least one delimiter.

[0109] S53: The pattern encoding, separator, and original product barcode data are sequentially concatenated and structurally encapsulated to generate structured data with business semantics.

[0110] The separator is used to distinguish the prefix of the structured data from the original product barcode data, and the prefix is ​​the intent identifier.

[0111] Specifically, this embodiment uses JSON for structured encapsulation, which can directly send the JSON-encapsulated data as the body of an HTTP request.

[0112] In this embodiment, step S6 includes:

[0113] S611: The cloud parses the received structured data and queries the intent identifier through the business mode configuration table to identify the current business mode.

[0114] S612: Publish the current business action to the corresponding message queue topic according to the current business mode, deploy multiple corresponding business reconciliation services and subscribe to the message queue topic.

[0115] S613: The business verification service queries the product master database based on the original product barcode data to obtain product SKU information, and associates the corresponding outbound order with the printing device ID.

[0116] S614: Automatically verify and update the outbound order based on the product SKU information.

[0117] In this embodiment, step S6 includes:

[0118] S621: Activate the POS cashier window on the printing device, parse the structured data, and simulate the USB HIDKEYBOARD device channel.

[0119] S622: Write the structured data into the keyboard report structure with key codes and modifier key states, and set keyboard_event_flag.

[0120] S623: A keyboard report is sent to the POS machine by periodically polling the IN endpoint. The POS machine parses the keyboard report and automatically performs verification.

[0121] In this embodiment, it also includes:

[0122] S8: The printing device has a built-in lightweight business rule engine and context manager. It updates the local batch context in the context manager according to the current business action, and outputs the corresponding business rules through the business rule engine according to the local batch context. It determines whether the current business action meets the business rules. If so, it triggers the automatic printing task of the summary sheet.

[0123] In this embodiment, step S8 further includes:

[0124] S81: Call the evaluation function of the business rule engine after each update of the local batch context.

[0125] S82: The business rule engine loads all automatic printing rules under the current business mode, and sequentially uses the automatic printing rules as input and evaluates their triggering conditions through the evaluation function.

[0126] S83: Determine whether the current business action meets the triggering condition. If so, the business rule engine immediately triggers and executes the corresponding automatic printing rule's Action.

[0127] Figure 2 The complete workflow of a printing device from startup to handling user interaction and executing business logic includes:

[0128] Device power-on initialization: Load and apply the locally cached business mode configuration table, and set the default working mode; load the business mode configuration table and initialize the scanning module and printing engine; start the synchronization manager to synchronize the latest mode configuration data and QR code role library with the cloud.

[0129] Interactive event listening and routing: Continuously listen for local interactive events from physical buttons, QR code scanning modules, etc., and route them to different processing sub-processes based on event type to switch business modes, including:

[0130] The button-triggered path, such as double-clicking the FEED button, triggers the business mode switching logic. The printing device calculates and switches to the next preset business mode according to the locally stored mode sequence table. This process is completed entirely locally and does not rely on the network. After switching, the system updates the current mode status and provides status feedback by changing the LED color on the printing device, emitting a prompt sound, or refreshing the screen.

[0131] The scanning process triggers a process where the scanning module scans and decodes the role's QR code, and the printing device parses the role ID from the QR code and triggers the verification process. Once verification is successful, the printing device retrieves the corresponding business mode configuration for that role from the cloud or loads it from its local cache, and switches to that mode.

[0132] Dual-channel verification selection: When a barcode scan is decoded into a regular product code, the data reporting sub-process begins. The printing device automatically adds an intent identifier to the original product barcode based on the current business model, generating structured data with business semantics. The printing device dynamically selects the reporting channel according to a preset strategy. For example, when network conditions are poor, the POS verification path is selected, and the printing device "inputs" the barcode data into the POS system via its simulated keyboard interface using a simulated keyboard key sequence. When centralized processing is required, the cloud verification path is selected. The printing device sends the structured data to the cloud server's API port via the network. After the cloud parses the intent identifier, it automatically routes the data to the corresponding verification service to complete business logic such as inventory increases and decreases.

[0133] An embodiment of a printer that supports local multi-mode switching and cloud verification.

[0134] This invention relates to a printer that supports local multi-mode switching and cloud verification, including a memory for storing printer programs; and a processor for executing the printer programs stored in the memory to implement the steps of the method described.

[0135] Specifically, in this embodiment, the memory stores instructions that can be executed by at least one processor. By executing the instructions stored in the memory, at least one processor can execute the above-mentioned printing method that supports local multi-mode switching and cloud verification.

[0136] The processor is the control center of the printer. It can connect to various parts of the control device through various interfaces and lines. By running or executing instructions stored in the memory and calling data stored in the memory, it can realize various functions of the printer and process data.

[0137] In one possible design, the processor may include one or more processing units. The processor may integrate an application processor and a modem processor, where the application processor primarily handles the operating system, user interface, and applications, while the modem processor primarily handles wireless communication. It is understood that the modem processor may also not be integrated into the processor.

[0138] In some embodiments, the processor and memory can be implemented on the same chip; in other embodiments, they can be implemented on separate chips.

[0139] Specifically, the processor in this embodiment can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, which can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the printing method supporting local multi-mode switching and cloud verification disclosed in the embodiments of this application can be directly reflected as being executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.

[0140] Specifically, in this embodiment, the memory, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The memory can include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memory, magnetic disk, optical disk, etc. Memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited to this. The memory in this embodiment can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0141] Specifically, this embodiment designs and programs the processor to embed the code corresponding to the printing method supporting local multi-mode switching and cloud verification described in the above embodiments into the chip, thereby enabling the chip to execute the steps of the printing method supporting local multi-mode switching and cloud verification in the embodiments during operation. How to design and program the processor is a well-known technique to those skilled in the art, and will not be elaborated here.

[0142] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0143] The above embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Any non-substantial changes and substitutions made by those skilled in the art based on the present invention shall fall within the scope of protection claimed by the present invention.

Claims

1. A printing method supporting local multi-mode switching and cloud-based verification, characterized in that, include: S1: Define the required business modes synchronously on the printing device and the cloud, assign a unique mode code to each business mode and establish a business mode configuration table; S2: Declare the printing device as a composite device by configuring the device descriptor in the firmware, define the composite device interface descriptor and establish a simulated keyboard transmission channel; S3: The printing device has a built-in barcode scanning module and establishes a communication connection with the cloud and a data connection with the POS machine; it loads the business mode configuration table and initializes the barcode scanning module and the printing engine. S4: Continuously monitor the local interaction events of the printing device and determine whether the local interaction events trigger a business mode switch. If so, switch the business mode by looking up the business mode configuration table. S5: Obtain the original product barcode data through the scanning module, and add an intent identifier to the original product barcode data according to the unique pattern code of the current business mode and generate verification data; S6: The verification data is sent to the cloud or "typed" into the POS machine in a simulated keyboard key sequence through the simulated keyboard transmission channel. The cloud or the POS machine automatically performs verification and inventory management based on the intent identifier. S7: After the verification is completed, the cloud or the POS machine sends a print command to the printing device, and the printing device executes the printing task according to the print command.

2. The printing method supporting local multi-mode switching and cloud verification according to claim 1, characterized in that, Step S1 also includes: S11: Define the data structure of the required business model and create the business model configuration table in the database in the cloud. Define a set of API endpoints based on the RESTful architecture and use the API endpoints as the only access channel for the printing device to the business model configuration table. S12: Select the appropriate local cache on the printing device and set the synchronization manager according to the business complexity. Call the API endpoint through the synchronization manager to pull the business mode configuration table and save it to the local cache. S13: When the business mode configuration table changes, the cloud assigns an incrementing version number, the printing device initiates a synchronization request carrying the local version number, and the cloud returns version difference data.

3. The printing method supporting local multi-mode switching and cloud verification according to claim 2, characterized in that, Step S1 also includes: S14: The cloud assigns a unique role QR code to each of the aforementioned business models, and the content of the role QR code includes a role ID; S15: The printing device acquires the role QR code and establishes a role QR code library. It scans the role QR code through the scanning module, parses out the role ID, and returns it to the cloud for validity verification.

4. The printing method supporting local multi-mode switching and cloud verification according to claim 1, characterized in that: The firmware reconstructs the USB interface of the printing device according to the business mode. The steps include: pre-setting a USB descriptor template pool in the firmware and selecting and loading a USB descriptor set from it at runtime. The USB descriptor set includes the device descriptor and the composite device interface descriptor. The composite device interface descriptor includes a first interface descriptor and a second interface descriptor, wherein the first interface descriptor is a printing device class and the second interface descriptor is an HID class.

5. The printing method supporting local multi-mode switching and cloud verification according to claim 4, characterized in that: The device descriptor is set to: bDeviceClass=0xEF, bDeviceSubClass=0x02; the first interface descriptor is set to: bInterfaceClass=0x07, and specifies the printer protocol; the second interface descriptor is set to: bInterfaceClass=0x03, bInterfaceSubClass=0x01.

6. The printing method supporting local multi-mode switching and cloud verification according to claim 2, characterized in that, Step S4 also includes: S411: Select a physical button on the printing device as the mode switching key, and configure the input and interrupt of the mode switching key; S412: When an interrupt is triggered, the current business mode is read from the memory of the printing device, the index position of the current business mode is queried through the business mode configuration table, and the next business mode configuration is obtained according to the predefined order of the table. S413: Configure the system to switch to the next business mode according to the next business mode, and write it into the memory as the current business mode.

7. The printing method supporting local multi-mode switching and cloud verification according to claim 3, characterized in that, Step S4 also includes: S421: Scan the role QR code of the next business mode through the scanning module and parse its role ID, and compare and search the role ID in the local role QR code library; S422: If the search result is a local match, proceed to the next step; if no local match is found, return to step S15 for validity verification. If the role ID is verified as valid, the cloud will return the corresponding business mode configuration to the printing device by querying the business mode configuration table; S423: The printing device loads the corresponding business mode configuration and switches to the next business mode.

8. The printing method supporting local multi-mode switching and cloud verification according to claim 4, characterized in that, Step S5 includes: S51: The product barcode is read by the scanning module and decoded to obtain the original product barcode data containing the product identity string; S52: The printing device reads the unique mode code of the current business mode from the business mode configuration table and defines at least one delimiter; S53: The pattern encoding, separator, and original product barcode data are sequentially concatenated and structurally encapsulated to generate structured data with business semantics; The separator is used to distinguish the prefix of the structured data from the original product barcode data, and the prefix is ​​the intent identifier.

9. The printing method supporting local multi-mode switching and cloud verification according to claim 8, characterized in that, Step S6 includes: S611: The cloud parses the received structured data and queries the intent identifier through the business mode configuration table to identify the current business mode; S612: Publish the current business action to the corresponding message queue topic according to the current business mode, deploy multiple corresponding business reconciliation services and subscribe to the message queue topic; S613: The business verification service queries the product master database based on the original product barcode data to obtain product SKU information, and associates the corresponding outbound order based on the printing device ID; S614: Automatically verify and update the outbound order based on the product SKU information.

10. The printing method supporting local multi-mode switching and cloud verification according to claim 8, characterized in that, Step S6 includes: S621: Activate the POS cashier window on the printing device, parse the structured data and simulate the USB HIDKEYBOARD device channel; S622: Write the structured data into the keyboard report structure with key codes and modifier key states, and set keyboard_event_flag; S623: A keyboard report is sent to the POS machine by periodically polling the IN endpoint. The POS machine parses the keyboard report and automatically performs verification.

11. The printing method supporting local multi-mode switching and cloud verification according to any one of claims 1-10, characterized in that, Also includes: S8: The printing device has a built-in lightweight business rule engine and context manager. It updates the local batch context in the context manager according to the current business action, and outputs the corresponding business rules through the business rule engine according to the local batch context. It determines whether the current business action meets the business rules. If so, it triggers the automatic printing task of the summary sheet.

12. The printing method supporting local multi-mode switching and cloud verification according to claim 11, characterized in that, Step S8 also includes: S81: Call the evaluation function of the business rule engine after each update of the local batch context; S82: The business rule engine loads all automatic printing rules under the current business mode, and sequentially uses the automatic printing rules as input and evaluates their triggering conditions through the evaluation function; S83: Determine whether the current business action meets the triggering condition. If so, the business rule engine immediately triggers and executes the corresponding automatic printing rule action.

13. A printer that supports local multi-mode switching and cloud-based verification, characterized in that, include: Memory, used to store printer programs; A processor, when executing a printer program stored in the memory, implements the steps of the method according to any one of claims 1-12.