A data interaction method and device, a storage medium and an electronic device
By introducing header and tail data into the print instruction data, the data interaction device can parse and obtain print parameters after detecting these two data points, thus solving the problems of data loss and data sticking, and ensuring the accuracy of data parsing and the normal operation of the printing equipment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN JINGCHEN INTELLIGENT IDENTIFICATION TECH CO LTD
- Filing Date
- 2024-12-27
- Publication Date
- 2026-06-26
AI Technical Summary
During data transmission, printing devices may experience data loss or data concatenation, which can prevent the printer from parsing the print command and thus prevent the user from completing the printing task.
By introducing header and footer data into the print instruction data, the data interaction device only parses and obtains the print parameters after detecting these two data points, ensuring data integrity and avoiding data from different parts of the same file.
It improves the accuracy of data parsing, ensures the normal operation of printing equipment, reduces waste of printing materials, and enhances the convenience of user operation.
Smart Images

Figure CN119872091B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of printer technology, and more specifically, to a data interaction method, apparatus, storage medium, and electronic device in the field of printer technology. Background Technology
[0002] Printing devices are commonly used in work and life scenarios, helping people improve work efficiency and make life more convenient. In existing technologies, users can send printing instructions to printing devices through terminal devices to conveniently control the printing devices to perform printing operations. However, problems such as data loss and data concatenation may occur during data transmission, causing the printing devices to be unable to properly parse the printing instructions and complete the user's printing work. Therefore, a method is needed to improve the parsing accuracy of printing devices. Summary of the Invention
[0003] This application provides a data interaction method, apparatus, storage medium, and electronic device. The method can combine header data, printing parameters, and tail data, so that the printing device can parse and obtain printing parameters after detecting the header and tail data, thereby avoiding the sticking of header and tail data, improving the accuracy of data parsing, and ensuring the normal operation of the printing device.
[0004] In a first aspect, embodiments of this application provide a data interaction method applied to a printing device, the method comprising:
[0005] Obtain the printing instruction data sent by the terminal device, and parse and process the printing instruction data;
[0006] If the print instruction data contains header data and footer data, then a parsing completion feedback message is sent to the terminal device so that the terminal device can display the parsing completion feedback message;
[0007] Obtain the printing parameter data from the printing instruction data;
[0008] The printing operation is performed based on the aforementioned printing parameter data.
[0009] Secondly, embodiments of this application provide a data interaction device, the device comprising:
[0010] The parsing and processing unit is used to acquire the printing instruction data sent by the terminal device and to parse and process the printing instruction data.
[0011] The information feedback unit is used to send parsing completion feedback information to the terminal device if the print instruction data contains header data and tail data, so that the terminal device can display the parsing completion feedback information.
[0012] A parameter acquisition unit is used to acquire printing parameter data from the printing instruction data;
[0013] A printing operation unit is used to perform printing operations based on the printing parameter data.
[0014] Thirdly, embodiments of this application provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.
[0015] Fourthly, embodiments of this application provide an electronic device that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.
[0016] In one or more embodiments of this application, printing instruction data sent by a terminal device is acquired and parsed. If the printing instruction data contains header and footer data, a parsing completion feedback message is sent to the terminal device so that the terminal device displays the parsing completion feedback message. Printing parameter data from the printing instruction data is then acquired, and a printing operation is performed based on the printing parameter data. By splicing header, footer, and footer data, the printing device detects the header and footer data before parsing and acquiring the printing parameters, thereby avoiding data overlap, improving the accuracy of data parsing, and ensuring the normal operation of the printing device. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is an example diagram illustrating how a terminal device sends instructions, as provided in an embodiment of this application.
[0019] Figure 2 This is a flowchart illustrating a data interaction method provided in an embodiment of this application;
[0020] Figure 3 This is a flowchart illustrating a parsing processing method provided in an embodiment of this application;
[0021] Figure 4 This is a flowchart illustrating a method for acquiring printing parameter data provided in an embodiment of this application;
[0022] Figure 5 This is an example diagram illustrating the acquisition of byte length data and print parameter data provided in an embodiment of this application;
[0023] Figure 6 This is a schematic diagram of a verification process provided in an embodiment of this application;
[0024] Figure 7 This is a schematic diagram of the structure of a data interaction device provided in an embodiment of this application;
[0025] Figure 8 This is a schematic diagram of the structure of a data interaction device provided in an embodiment of this application;
[0026] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0027] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0028] Printing equipment refers to hardware devices capable of outputting electronic documents, images, or other information to paper or other media. Printers are widely used in offices, homes, and other environments, printing electronic documents, photos, charts, and other image data into paper form. Wire marking machines are also a type of printing equipment, sometimes called wire marking printers or marking machines. They are used for marking wiring in electrical control, power distribution equipment, and integrated cabling projects, and can be applied in power, telecommunications, steel, and manufacturing industries. Wire marking machines print characters on conduits to identify wires and cables. These conduits can be made of materials such as PVC tubing, heat shrink tubing, or self-adhesive labels. They are used to protect wires and cables from external damage, ensuring their safety and extending their lifespan. Marked wires and cables clearly display their function, purpose, specifications, and other information, facilitating classification, identification, and maintenance by staff. When users want to use the printing equipment, they can print directly from the control panel or using their own terminal device. Please refer to [link to relevant documentation]. Figure 1This embodiment of the present application provides an example of a terminal device sending instructions. The terminal device can be an electronic device such as a mobile phone, tablet, or wearable device held by the user. The terminal device can have an application installed to control the printing device and realize data interaction methods. The user can set printing parameter data in the application of the terminal device, and then the terminal device can generate printing instruction data based on the printing parameter data and send the instruction data to the printing device. The printing parameter data can include relevant parameters when the printing device performs printing operations, and the printing instruction data is used to instruct the printing device to perform printing operations according to the printing parameter data.
[0029] However, problems such as data loss and data concatenation may occur during data transmission, causing the printing device to be unable to properly parse the printing instruction data and complete the user's printing work. This application provides a data interaction device. The data interaction method provided in this application can be implemented by a computer program and can run on a data interaction device based on the von Neumann architecture. The computer program can be integrated into the application or run as an independent tool application. The data interaction device can be a printing device or a module or application program in the printing device used to implement the data interaction method. The print command data sent by the terminal device consists of header data, print parameter data, and tail data. The header data and tail data are located at the beginning and end of the print command data, respectively, and play a role in identifying and protecting the print parameter data during data transmission. When the data interaction device detects that the printing device has received the print command data, it can parse and process the print command data. Only when the header data and tail data are detected simultaneously will the data interaction device determine that a complete print command data has been received, and obtain the print parameter data between the header data and tail data. Then, it controls the printing device to perform the printing operation based on the print parameter data, thereby avoiding the concatenation of data, improving the accuracy of data parsing, and ensuring the normal operation of the printing device.
[0030] The data interaction method provided in this application will be described in detail below with reference to specific embodiments.
[0031] Please see Figure 2 This is a flowchart illustrating a data interaction method provided in an embodiment of this application. Figure 2 As shown, the method described in this application embodiment may include the following steps S101-S104.
[0032] S101, obtain the printing instruction data sent by the terminal device, and parse and process the printing instruction data.
[0033] Specifically, when a user wants to use a printing device to perform a printing operation, they can use the terminal device to set the printing parameter data. Then, the terminal device can generate printing instruction data based on the printing parameter data and send the printing instruction data to the printing device. After the data interaction obtains the printing instruction data from the terminal device, it can parse and process the printing instruction data. The parsing and processing can obtain the content in the printing instruction data. For example, the position and content of the header data and the footer data can be determined through parsing and processing.
[0034] S102, if the print instruction data contains header data and footer data, send parsing completion feedback information to the terminal device so that the terminal device can display the parsing completion feedback information.
[0035] Specifically, if the parsing process determines that the print command data contains header and footer data, then a complete print command data set has been obtained, without any concatenation with preceding or following data. The data interaction device can then send a parsing completion feedback message to the terminal device, which will then display this message. This feedback message informs the user that the printing device has received the complete print command data sent by the terminal device. The parsing completion feedback message can be displayed on the terminal device as a pop-up window, a ringtone, or a vibration. For example, the terminal device can display a window saying "Printing device has completed parsing."
[0036] S103, retrieve the print parameter data from the print instruction data.
[0037] Specifically, the data interaction device obtains the header and tail data through parsing and processing, determines the position of the header and tail data in the print instruction data, and then obtains the print parameter data located between the header and tail data.
[0038] S104 performs printing operations based on printing parameter data.
[0039] Specifically, printing parameter data refers to the relevant parameters of the printing device when performing printing operations. The data interaction device can control the printing device to perform printing operations based on the printing parameter data. For example, the printing parameter data may contain the printing content that the user expects to print, and then the printing device can print the content on paper or other media.
[0040] In this embodiment, printing instruction data sent by a terminal device is acquired and parsed. If header and footer data exist in the printing instruction data, a parsing completion feedback message is sent to the terminal device so that the terminal device can display the parsing completion feedback message. Printing parameter data is then obtained from the printing instruction data, and a printing operation is performed based on the printing parameter data. By splicing header, footer, and footer data, the printing device detects the header and footer data before parsing and obtaining the printing parameters, thereby avoiding data overlap, improving the accuracy of data parsing, and ensuring the normal operation of the printing device.
[0041] The header and footer data can have byte lengths of the first byte and the second byte, respectively, and can have header and footer data formats, respectively. The first byte length, the second byte length, the header data format, and the footer data format can be the initial settings of the data interaction device, or they can be preset by the user or staff. The terminal device can generate header data according to the first byte length and the preset header data format, and the data interaction device can also parse the header data in the print command data according to the first byte length and the preset header data format. Similarly, the terminal device can generate footer data according to the second byte length and the preset footer data format, and the data interaction device can also parse the footer data in the print command data according to the second byte length and the preset footer data format.
[0042] Please see also Figure 3 This document provides a flowchart illustrating the parsing process in an embodiment of this application. Step S101 may include the following steps:
[0043] S201: Obtain the first data from the header of the print instruction data based on the length of the first byte. If the first data matches the preset header data format, then the first data is determined as the header data.
[0044] Specifically, the data interaction device can obtain first data that meets the first byte length from the header of the print instruction data. If the first data matches the preset header data format, the first data can be identified as the header data.
[0045] Optionally, the header data is located at the very beginning of the transmitted data and is used to identify the start of the print command data. It can contain control and management information. For example, the header data can include identification information, protocol type, etc. The identification information can be the source address, destination address, etc., which can be used to determine the source and destination of the print command data. The protocol type can indicate the transmission protocol used by the print command data, such as Transmission Control Protocol (TCP), User Datagram Protocol (UDP), Internet Protocol (IP), etc. The header data can also include a sequence number, which controls the order of the print command data. When the print command data needs to be split into multiple packets, the sequence number can instruct the printing device to reassemble the data in the correct order. The header data is mainly used for packet routing, transmission control, etc., to ensure that the print command data arrives at the printing device correctly.
[0046] S202: Obtain the second data from the end of the print instruction data based on the length of the second byte. If the second data matches the preset end data format, then the second data is determined as the end data.
[0047] Specifically, the data interaction device can obtain second data that meets the second byte length from the end of the print instruction data. If the second data matches the preset end data format, the second data can be identified as the end data.
[0048] Optionally, the tail data is located at the end of the data packet and can be used to identify the end of the print instruction data. For example, in the Point-to-Point Protocol (PPP), the tail data can contain a terminator to indicate the end of a print instruction data. The PPP protocol is mainly used to establish, configure and test data link connections between two network entities.
[0049] In this embodiment, first data is obtained from the header of the print instruction data based on a first byte length. If the first data matches a preset header data format, it is determined as header data. Second data is obtained from the tail of the print instruction data based on a second byte length. If the second data matches a preset tail data format, it is determined as tail data. By determining the header and tail data using pre-set byte lengths and data formats, the accuracy of header and tail data acquisition is improved, avoiding incorrect reception of print instruction data due to tampering or omission of header and tail data, thus improving the accuracy of print instruction data reception and parsing.
[0050] In one embodiment of this application, to further improve the accuracy of the print instruction data, the terminal device can obtain the print parameter data input by the user, determine the byte length of the print parameter data, and generate byte length data based on the byte length of the print parameter data. It is understood that the print instruction data generated by the terminal is data after data conversion processing, so the byte length is the number of bytes in the converted print parameter data, and the byte length data is the converted byte length. The data conversion processing can be binary data conversion processing. The terminal device can also add the byte length data to the print instruction data to facilitate more accurate acquisition of the print parameter data by the data interaction device. For example, the terminal device can concatenate the byte length data between the header data and the print parameter data.
[0051] Please see also Figure 4 This application provides a flowchart for obtaining printing parameter data. Step S102 may include the following steps:
[0052] S301, retrieve the length of the bytes appended to the header data.
[0053] Specifically, after determining that the print instruction data contains both header data and footer data, i.e., after obtaining a complete print instruction data, the data interaction device can begin to obtain the byte length data concatenated after the header data. The data interaction device can obtain the print parameter data in the print instruction data based on the byte length data, and the byte length of the print parameter data matches the byte length data.
[0054] Optionally, the data interaction device can obtain byte length data that meets the third byte length after the header data. The third byte length can be the initial setting of the data interaction device or can be preset by the user or staff. The terminal device can generate byte length data based on the third byte length, which makes it easier for the data interaction device to obtain accurate byte length data and also makes it easier to obtain subsequent printing parameter data accurately.
[0055] S302, Get the byte length corresponding to the byte length data.
[0056] Specifically, since the print instruction data is data after data conversion processing, for example, the print instruction data can be binary data, so the byte length data can also be binary data. The data interaction device can obtain the corresponding byte length based on the binary byte length data.
[0057] S303: Obtain the third data that meets the byte length requirement after the concatenated byte length data, and determine the third data as the print parameter data in the print instruction data.
[0058] Specifically, the data interaction data can obtain a third data that meets the byte length requirement after the byte length data, and determine the third data as the print parameter data in the print instruction data.
[0059] Please see also Figure 5 This embodiment of the application provides an example diagram of obtaining byte length data and printing parameter data. If the data conversion process is binary data conversion process and the length of the third byte is 10 bytes, the data interaction device can obtain the 10 bytes of byte length data concatenated after the header data. If the byte length data is "0111110100", the corresponding byte length is 500, indicating that the byte length of the printing parameter data is 500 bytes. The data interaction device can obtain 500 bytes of printing parameter data after the byte length data.
[0060] In this embodiment, the byte length data concatenated after the header data is obtained, the corresponding byte length is obtained, and a third piece of data concatenated after the byte length data that satisfies the byte length requirement is obtained. This third piece of data is then identified as the print parameter data in the print instruction data. This method of quickly locating the print parameter data using the byte length data makes the data structure clearer and improves the efficiency of data parsing.
[0061] In one embodiment of this application, the data interaction may further include the following steps:
[0062] If the print command data contains header and footer data, a parsing completion message will be output, which may include a light indicator or a vibration indicator.
[0063] Specifically, in addition to sending parsing completion feedback information to the terminal device to remind the user that complete print command data has been received, the data interaction device can also remind the user on the printing device. If the print command data contains header and footer data, the data interaction device can output parsing completion prompt information. The parsing completion prompt information can be output by the printing device and may include light prompt information or vibration prompt information.
[0064] Optionally, a light-up module can be installed on the printing device. If the print command data contains header and footer data, the data interaction device can control the light-up module to output a light-up prompt message. The light-up prompt message can indicate that the light will illuminate according to a first preset light-up mode. The first preset light-up mode can be preset by the user or staff and can include the light color, flashing interval, and number of flashes. For example, in the first preset light-up mode, the light color is green, the flashing interval is 0.5 seconds, and the number of flashes is 3. If the print command data contains header and footer data, the data interaction device can control the light-up module to flash the green light 3 times at 0.5-second intervals to indicate to the user that the complete print command data has been received.
[0065] Optionally, a vibration module can be installed on the printing device. If the printing instruction data contains header data and tail data, the data interaction device can control the vibration module to output vibration prompt information. The vibration prompt information can be that the vibration is performed according to a first preset vibration mode. The first preset vibration mode can be preset by the user or staff and can include vibration frequency, vibration duration, etc.
[0066] In this embodiment, a light or vibration is used to provide prompts, giving the user timely feedback on the printing device side. This reduces misunderstandings about the printing device's status, avoids delaying other work processes due to continuous monitoring of the device status, and improves the convenience of user operation.
[0067] In one embodiment of this application, the data interaction may further include the following steps:
[0068] If the print command data does not contain both header and footer data simultaneously, a parsing failure feedback message is sent to the terminal device so that the terminal device displays the parsing failure feedback message, and / or outputs a parsing failure prompt message, and / or stops the printing operation.
[0069] Specifically, the parsing process may only retrieve the header data, or only the footer data, or neither. This indicates that the data in the print command data has been missing or tampered with during transmission. Therefore, if the print command data does not contain both header and footer data simultaneously, a parsing failure feedback message is sent to the terminal device so that the terminal device can display the parsing failure feedback message. The parsing failure feedback message can be used to inform the user that the printing device has not correctly received the print command data, so that the user can resend the print command data or troubleshoot the terminal device and the printing device. The parsing failure feedback message can be displayed on the terminal device in the form of a pop-up window, a ringtone, or a vibration. For example, the terminal device can pop up a window displaying "Printing device parsing failed".
[0070] In addition to sending parsing failure feedback information to the terminal device, the data interaction device can also output parsing failure prompt information on the printing device side. This prompt information can include a light indicator or a vibration indicator. If the print command data does not contain header and tail data simultaneously, the light indicator can illuminate according to a second preset lighting mode, and the vibration indicator can vibrate according to a second preset vibration mode. For example, in the second preset lighting mode, the light color is red, the flashing interval is 0.5 seconds, and the number of flashes is 3. If the print command data does not contain header and tail data simultaneously, the data interaction device can control the light module to flash the red light 3 times at 0.5-second intervals to indicate to the user that the print command data parsing has failed.
[0071] The data interaction device can also control the printing equipment to stop printing operations, preventing erroneous printing operations and waste of printing materials in the event of data parsing failure. If the printing equipment is a wire marking machine, since it can not only print on the wire tube but also cut and move it for printing and cutting, the data interaction device can also stop the cutting and moving processes to prevent erroneous printing, cutting, and moving of the wire tube if the target specifications are not suitable, thus avoiding waste of wire tube.
[0072] In this embodiment, when incomplete or incorrect printing instruction data is detected, a prompt message is output to the user and the printing operation is stopped. This ensures that only correct and complete data is processed, guarantees the accuracy of the printing operation, reduces waste of printing materials, and improves the transparency of the operation by providing prompt messages, thereby enhancing the convenience of user operation.
[0073] After obtaining the printing parameter data from the printing instruction data, the data interaction device can perform the printing operation based on the printing parameter data. However, to prevent the printing parameter data from being omitted or tampered with during data transmission, the terminal device can encrypt the printing parameter data using a preset encryption method to obtain verification data. This verification data is then appended between the printing parameter data and the end data, facilitating the data interaction device's retrieval of the verification data from the printing instruction data and its verification processing of the printing parameter data. The encryption method can be an initial setting of the data interaction device or a preset setting by the user or staff. For example, it can use a hash algorithm to encrypt the printing parameter data, calculating a hash value and using that hash value as the verification data. Other encryption methods include Advanced Encryption Standard (AES) and Data Encryption Standard (DES).
[0074] Please see also Figure 6 This document provides a flowchart of a verification process for an embodiment of this application. Step S104 may include the following steps:
[0075] S401 performs verification processing on the printing parameter data.
[0076] Specifically, after the data interaction device obtains the printing parameter data, it can perform verification processing on the printing parameter data.
[0077] Optionally, after obtaining the printing parameter data, the data interaction device can obtain the verification data located between the printing parameter data and the tail data. It is understood that both the printing parameter data and the tail data have a fixed byte length, so the data between them is the verification data. Then, the data interaction device can encrypt the printing parameter data using a preset encryption method to obtain the target data. If the target data matches the verification data, it indicates that the printing parameter data has not been omitted or tampered with, and the printing parameter data can be confirmed to have passed the verification process.
[0078] S402, if the printing parameter data passes the verification process, a verification success feedback message is sent to the terminal device so that the terminal device can display the verification success feedback message.
[0079] Specifically, if the printing parameter data passes the verification process, a verification success feedback message can be sent to the terminal device so that the terminal device can display the verification success feedback message. The verification success feedback message is used to inform the user that the printing device has successfully obtained the complete printing parameter data. The verification success feedback message can be displayed on the terminal device in the form of a pop-up window, a ringing sound, or a vibration. For example, the terminal device can pop up a window that displays "Parameter data verification passed".
[0080] S403 performs printing operations based on printing parameter data.
[0081] Specifically, printing parameter data refers to the relevant parameters of the printing device when performing printing operations. The data interaction device can control the printing device to perform printing operations based on the printing parameter data. For example, the printing parameter data may contain the printing content that the user expects to print, and then the printing device can print the content on paper or other media.
[0082] In this embodiment, the printing parameter data is validated. If the printing parameter data passes the validation process, a validation success feedback message is sent to the terminal device, allowing the terminal device to display the validation success feedback message and perform the printing operation based on the printing parameter data. Validation processing prevents printing errors, reduces printing failures and material waste caused by data problems, and the validation success feedback further improves operational transparency and user convenience.
[0083] In one embodiment of this application, the data interaction may further include the following steps:
[0084] If the printed parameter data passes the verification process, a verification success message will be output, which may include a light indicator or a vibration indicator.
[0085] Specifically, in addition to sending verification success feedback information to the terminal device to remind the user that complete and accurate printing parameter data has been received, the data interaction device can also prompt the user on the printing device. If the printing parameter data passes the verification process, the data interaction device can output a verification success prompt message. The verification success prompt message can be output by the printing device and may include a light prompt message or a vibration prompt message.
[0086] Optionally, if the printing parameter data passes the verification process, the lighting module can be controlled to light up according to the third preset lighting mode to output lighting prompt information, and / or the vibration module can be controlled to vibrate according to the third preset vibration mode to output vibration prompt information.
[0087] In this embodiment, a light or vibration is used to provide prompts, giving the user timely feedback on the printing device side. This reduces misunderstandings about the printing device's status, avoids delaying other work processes due to continuous monitoring of the device status, and improves the convenience of user operation.
[0088] In one embodiment of this application, the data interaction may further include the following steps:
[0089] If the print parameter data fails the verification process, a verification failure feedback message is sent to the terminal device so that the terminal device displays the verification failure feedback message, and / or outputs a verification failure prompt message, and / or stops the printing operation.
[0090] Specifically, if the target data does not match the verification data, it indicates that the printing parameter data has been omitted or tampered with. It can be determined that the printing parameter data has failed the verification process. The data interaction device can send verification failure feedback information to the terminal device so that the terminal device can display the verification failure feedback information. This can be used to inform the user that the printing device has not received complete and correct printing parameter data, so that the user can resend the printing command data or perform maintenance on the terminal device and the printing device. The verification failure feedback information can be displayed on the terminal device in the form of a pop-up window, a ringtone, or a vibration. For example, the terminal device can pop up a window displaying "Printing parameter verification failed".
[0091] In addition to sending verification failure feedback information to the terminal device, the data interaction device can also output verification failure prompt information on the printing device side. The verification failure prompt information may include light-up prompt information or vibration prompt information. If the printing parameter data fails the verification process, the light-up prompt information may indicate that the light will illuminate according to the fourth preset light-up mode, and the vibration prompt information may indicate that the light will vibrate according to the fourth preset vibration mode. The first preset light-up mode, the second preset light-up mode, the third preset light-up mode, and the fourth preset light-up mode may be different to distinguish them. Similarly, the first preset vibration mode, the second preset vibration mode, the third preset vibration mode, and the fourth preset vibration mode may also be different.
[0092] The data interaction device can also control the printing equipment to stop printing operations, preventing printing from being performed with incorrect printing parameters and thus avoiding waste of printing materials. If the printing equipment is a wire marking machine, since it can not only print on the wire tube but also cut and move it for printing and cutting, the data interaction device can also stop the cutting and moving processes to prevent incorrect printing, cutting, and moving of the wire tube when the target specifications are not suitable, thereby avoiding waste of wire tube.
[0093] In this embodiment, when the printing parameter data fails verification, a prompt message is output to the user and the printing operation is stopped. This ensures that only correct and complete data is processed, guarantees the accuracy of the printing operation, reduces waste of printing materials, and improves the transparency of the operation by providing prompt messages, thereby improving the convenience of user operation.
[0094] The following will be combined with the appendix Figure 7 - Appendix Figure 8 This application provides a detailed description of the data interaction device provided in its embodiments. It should be noted that the appendix... Figure 7 - Appendix Figure 8 The data interaction device in the middle is used to execute this application. Figures 1-6 The methods shown in the embodiments are for illustrative purposes only, illustrating the parts relevant to the embodiments of this application. For specific technical details not disclosed, please refer to this application. Figures 1-6 The example shown.
[0095] Please see Figure 7 This illustration shows a schematic diagram of a data interaction device provided in an exemplary embodiment of this application. The data interaction device can be implemented as all or part of a device through software, hardware, or a combination of both. The device 1 includes a parsing and processing unit 11, an information feedback unit 12, a parameter acquisition unit 13, and a printing operation unit 14.
[0096] The parsing and processing unit 11 is used to obtain the printing instruction data sent by the terminal device and to parse and process the printing instruction data.
[0097] The information feedback unit 12 is used to send parsing completion feedback information to the terminal device if the print instruction data contains header data and tail data, so that the terminal device displays the parsing completion feedback information;
[0098] Parameter acquisition unit 13 is used to acquire printing parameter data in the printing instruction data;
[0099] The printing operation unit 14 is used to perform printing operations based on the printing parameter data.
[0100] In this embodiment, the printing instruction data sent by the terminal device is acquired and parsed. If the printing instruction data contains header and footer data, a parsing completion feedback message is sent to the terminal device so that the terminal device can display the parsing completion feedback message. The printing parameter data in the printing instruction data is then acquired, and the printing operation is performed based on the printing parameter data. By splicing the header, printing parameters, and footer data, the printing device detects the header and footer data before parsing and acquiring the printing parameters, thereby avoiding data overlap, improving the accuracy of data parsing, and ensuring the normal operation of the printing device.
[0101] Please see Figure 8 This illustration shows a schematic diagram of a data interaction device provided in an exemplary embodiment of this application. The data interaction device can be implemented as all or part of a device through software, hardware, or a combination of both. The device 1 includes a parsing processing unit 11, an information feedback unit 12, a parsing completion prompt unit 15, a parsing failure prompt unit 16, a parameter acquisition unit 13, a verification data acquisition unit 17, a printing operation unit 14, a verification success prompt unit 18, and a verification failure prompt unit 19.
[0102] The parsing and processing unit 11 is used to obtain the printing instruction data sent by the terminal device and to parse and process the printing instruction data.
[0103] Optionally, the parsing processing unit 11 is specifically used to obtain first data from the header of the print instruction data based on the length of the first byte. If the first data matches a preset header data format, the first data is determined as header data.
[0104] The second data is obtained from the end of the print instruction data based on the length of the second byte. If the second data matches the preset end data format, the second data is determined as the end data.
[0105] The information feedback unit 12 is used to send parsing completion feedback information to the terminal device if the print instruction data contains header data and tail data, so that the terminal device displays the parsing completion feedback information;
[0106] The parsing completion prompt unit 15 is used to output parsing completion prompt information if the print instruction data contains header data and tail data, wherein the parsing completion prompt information includes light-up prompt information or vibration prompt information.
[0107] The parsing failure notification unit 16 is used to send parsing failure feedback information to the terminal device if the print instruction data does not contain header data and footer data simultaneously, so that the terminal device displays the parsing failure feedback information.
[0108] And / or, output a parsing failure message.
[0109] And / or, stop the printing operation.
[0110] Parameter acquisition unit 13 is used to acquire printing parameter data in the printing instruction data;
[0111] Optionally, the parameter acquisition unit 13 is specifically used to acquire the byte length data concatenated after the header data;
[0112] Based on the byte length data, the print parameter data in the print instruction data is obtained, wherein the byte length of the print parameter data is the same as that of the byte length data.
[0113] Optionally, the parameter acquisition unit 13 is specifically used to acquire the byte length corresponding to the byte length data;
[0114] Obtain the third data that meets the specified byte length after concatenating the byte length data, and determine the third data as the print parameter data in the print instruction data.
[0115] The verification data acquisition unit 17 is used to acquire verification data located between the print parameter data and the tail data;
[0116] The printing operation unit 14 is used to perform printing operations based on the printing parameter data.
[0117] Optionally, the printing operation unit 14 is specifically used to perform verification processing on the printing parameter data;
[0118] If the printing parameter data passes the verification process, a verification success feedback message is sent to the terminal device so that the terminal device can display the verification success feedback message.
[0119] The printing operation is performed based on the aforementioned printing parameter data.
[0120] Optionally, the printing operation unit 14 is specifically used to encrypt the printing parameter data using a preset encryption method to obtain the target data;
[0121] If the target data matches the verification data, then the printing parameter data is determined to have passed the verification process.
[0122] The verification success prompt unit 18 is used to output a verification success prompt message if the printed parameter data passes the verification process. The verification success prompt message includes a light prompt message or a vibration prompt message.
[0123] The verification failure notification unit 19 is used to send verification failure feedback information to the terminal device if the printed parameter data fails the verification process, so that the terminal device displays the verification failure feedback information.
[0124] And / or, output a verification failure message.
[0125] And / or, stop the printing operation.
[0126] In this embodiment, the printing instruction data sent by the terminal device is acquired, and first data is obtained from the header of the printing instruction data based on the first byte length. If the first data matches a preset header data format, the first data is determined as the header data. Second data is obtained from the tail of the printing instruction data based on the second byte length. If the second data matches a preset tail data format, the second data is determined as the tail data. Determining the header and tail data by using preset byte lengths and data formats improves the accuracy of header and tail data acquisition, avoids incorrect reception of printing instruction data due to tampering or omission of header and tail data, and improves the accuracy of printing instruction data reception and parsing. If header and tail data exist in the printing instruction data, a parsing completion feedback message is sent to the terminal device to display the parsing completion feedback message. This is indicated by a light or vibration, providing timely feedback to the user on the printing device side, reducing user misunderstanding of the printing device status, avoiding the need for continuous monitoring of the device status and delaying other work processes, and improving the convenience of user operation. The process involves retrieving the byte length data appended to the header data, obtaining the corresponding byte length, and then retrieving the third data appended to the header data that satisfies the specified byte length. This third data is then identified as the print parameter data within the print instruction data. This byte length data method allows for rapid location of the print parameter data, resulting in a clearer data structure and improved data parsing efficiency.
[0127] The printing parameter data undergoes verification. If the verification passes, a success feedback message is sent to the terminal device, which then displays this message and proceeds with the printing operation. Verification prevents printing errors, reducing printing failures and material waste caused by data issues. Successful verification feedback further enhances operational transparency and user convenience, ensuring the printer detects both header and footer data before parsing and retrieving printing parameters. This avoids data overlap, improves data parsing accuracy, and guarantees normal printer operation. Furthermore, if incomplete or incorrect printing command data is detected, or if printing parameter data verification fails, a prompt message is displayed to the user, and printing stops. This ensures only correct and complete data is processed, guaranteeing printing accuracy, reducing material waste, and enhancing user convenience through improved transparency.
[0128] It should be noted that the data interaction device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the data interaction method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data interaction device and the data interaction method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0129] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0130] This application also provides a computer storage medium that can store multiple instructions, which are adapted to be loaded and executed by a processor as described above. Figures 1-6 The data interaction method described in the illustrated embodiment can be found in the following document for a detailed execution process: Figures 1-6 The specific details of the illustrated embodiments will not be elaborated here.
[0131] This application also provides a computer program product storing at least one instruction, which is loaded and executed by the processor as described above. Figures 1-6 The data interaction method described in the illustrated embodiment can be found in the following document for a detailed execution process: Figures 1-6 The specific details of the illustrated embodiments will not be elaborated here.
[0132] Please refer to Figure 9This diagram illustrates a structural block diagram of an electronic device provided in an exemplary embodiment of this application. The electronic device in this application may include one or more components such as a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, memory 120, input device 130, and output device 140 may be connected via the bus 150.
[0133] Processor 110 may include one or more processing cores. Processor 110 connects to various parts of the electronic device using various interfaces and lines, and executes various functions of terminal 100 and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 120, and by calling data stored in memory 120. Optionally, processor 110 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 110 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user page, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 110 and may be implemented separately using a communication chip.
[0134] The memory 120 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 120 may include non-transitory computer-readable storage medium. The memory 120 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the various method embodiments described above, etc. The operating system may be the Android system, including systems deeply developed based on the Android system, the iOS system developed by Apple Inc., including systems deeply developed based on the iOS system, or other systems.
[0135] The memory 120 can be divided into operating system space and user space. The operating system runs in the operating system space, while native and third-party applications run in user space. To ensure that different third-party applications can achieve good running performance, the operating system allocates corresponding system resources for each application. However, different application scenarios within the same third-party application have different requirements for system resources. For example, in local resource loading scenarios, third-party applications have high requirements for disk read speed; in animation rendering scenarios, third-party applications have high requirements for GPU performance. Since the operating system and third-party applications are independent of each other, the operating system often cannot promptly perceive the current application scenario of a third-party application, resulting in the operating system's inability to adapt system resources accordingly.
[0136] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to establish data communication between the third-party applications and the operating system. This would allow the operating system to obtain the current scenario information of the third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
[0137] The input device 130 is used to receive input instructions or data, and includes, but is not limited to, a keyboard, mouse, camera, microphone, or touch device. The output device 140 is used to output instructions or data, and includes, but is not limited to, a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 can be a touch display screen.
[0138] The touch display screen can be designed as a full-screen, curved screen, or irregularly shaped screen. It can also be designed as a combination of a full-screen and a curved screen, or a combination of an irregularly shaped screen and a curved screen; however, this application does not limit the specific design in this regard.
[0139] In addition, those skilled in the art will understand that the structure of the electronic device shown in the above figures does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the electronic device may also include radio frequency circuits, input units, sensors, audio circuits, Wireless Fidelity (WiFi) modules, power supplies, Bluetooth modules, etc., which will not be described in detail here.
[0140] exist Figure 9 In the illustrated electronic device, the processor 110 can be used to call the data interaction application stored in the memory 120 and specifically perform the following operations:
[0141] Obtain the printing instruction data sent by the terminal device, and parse and process the printing instruction data;
[0142] If the print instruction data contains header data and footer data, then a parsing completion feedback message is sent to the terminal device so that the terminal device can display the parsing completion feedback message;
[0143] Obtain the printing parameter data from the printing instruction data;
[0144] The printing operation is performed based on the aforementioned printing parameter data.
[0145] In one embodiment, when the processor 110 performs parsing processing on the print instruction data, it specifically performs the following operations:
[0146] First data is obtained from the header of the print instruction data based on the length of the first byte. If the first data matches the preset header data format, the first data is determined as the header data.
[0147] The second data is obtained from the end of the print instruction data based on the length of the second byte. If the second data matches the preset end data format, the second data is determined as the end data.
[0148] In one embodiment, when the processor 110 executes the process of acquiring the print parameter data from the print instruction data, it specifically performs the following operations:
[0149] Obtain the byte length data appended to the header data;
[0150] Based on the byte length data, the print parameter data in the print instruction data is obtained, wherein the byte length of the print parameter data is the same as that of the byte length data.
[0151] In one embodiment, when the processor 110 executes the byte length data and obtains the print parameter data from the print instruction data, it specifically performs the following operations:
[0152] Obtain the byte length corresponding to the byte length data;
[0153] Obtain the third data that meets the specified byte length after concatenating the byte length data, and determine the third data as the print parameter data in the print instruction data.
[0154] In one embodiment, when executing the data interaction method, the processor 110 also performs the following operations:
[0155] If the print instruction data contains header data and tail data, a parsing completion prompt message is output, which includes a light-up prompt message or a vibration prompt message.
[0156] In one embodiment, when executing the data interaction method, the processor 110 also performs the following operations:
[0157] If the print instruction data does not contain both header and footer data simultaneously, a parsing failure feedback message is sent to the terminal device so that the terminal device displays the parsing failure feedback message.
[0158] And / or, output a parsing failure message.
[0159] And / or, stop the printing operation.
[0160] In one embodiment, when the processor 110 performs a printing operation based on the printing parameter data, it specifically performs the following operations:
[0161] The printing parameter data is then validated.
[0162] If the printing parameter data passes the verification process, a verification success feedback message is sent to the terminal device so that the terminal device can display the verification success feedback message.
[0163] The printing operation is performed based on the aforementioned printing parameter data.
[0164] In one embodiment, when executing the data interaction method, the processor 110 also performs the following operations:
[0165] If the printing parameter data passes the verification process, a verification success message will be output, which may include a light indicator or a vibration indicator.
[0166] In one embodiment, when executing the data interaction method, the processor 110 also performs the following operations:
[0167] If the printed parameter data fails the verification process, a verification failure feedback message is sent to the terminal device so that the terminal device displays the verification failure feedback message.
[0168] And / or, output a verification failure message.
[0169] And / or, stop the printing operation.
[0170] In one embodiment, when executing the data interaction method, the processor 110 also performs the following operations:
[0171] Obtain the verification data located between the print parameter data and the tail data;
[0172] When performing the verification process on the printed parameter data, the following operations are performed:
[0173] The printing parameter data is encrypted using a preset encryption method to obtain the target data;
[0174] If the target data matches the verification data, then the printing parameter data is determined to have passed the verification process.
[0175] In this embodiment, the printing instruction data sent by the terminal device is acquired, and first data is obtained from the header of the printing instruction data based on the first byte length. If the first data matches a preset header data format, the first data is determined as the header data. Second data is obtained from the tail of the printing instruction data based on the second byte length. If the second data matches a preset tail data format, the second data is determined as the tail data. Determining the header and tail data by using preset byte lengths and data formats improves the accuracy of header and tail data acquisition, avoids incorrect reception of printing instruction data due to tampering or omission of header and tail data, and improves the accuracy of printing instruction data reception and parsing. If header and tail data exist in the printing instruction data, a parsing completion feedback message is sent to the terminal device to display the parsing completion feedback message. This is indicated by a light or vibration, providing timely feedback to the user on the printing device side, reducing user misunderstanding of the printing device status, avoiding the need for continuous monitoring of the device status and delaying other work processes, and improving the convenience of user operation. The process involves retrieving the byte length data appended to the header data, obtaining the corresponding byte length, and then retrieving the third data appended to the header data that satisfies the specified byte length. This third data is then identified as the print parameter data within the print instruction data. This byte length data method allows for rapid location of the print parameter data, resulting in a clearer data structure and improved data parsing efficiency.
[0176] The printing parameter data undergoes verification. If the verification passes, a success feedback message is sent to the terminal device, which then displays this message and proceeds with the printing operation. Verification prevents printing errors, reducing printing failures and material waste caused by data issues. Successful verification feedback further enhances operational transparency and user convenience, ensuring the printer detects both header and footer data before parsing and retrieving printing parameters. This avoids data overlap, improves data parsing accuracy, and guarantees normal printer operation. Furthermore, if incomplete or incorrect printing command data is detected, or if printing parameter data verification fails, a prompt message is displayed to the user, and printing stops. This ensures only correct and complete data is processed, guaranteeing printing accuracy, reducing material waste, and enhancing user convenience through improved transparency.
[0177] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.
[0178] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
[0179] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in the embodiments of this specification are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the printing instruction data and printing parameter data involved in this specification were obtained under full authorization.
Claims
1. A data interaction method applied to a printing device, characterized in that, The method includes: The system acquires printing instruction data sent by the terminal device and parses the printing instruction data. The printing instruction data is composed of header data, printing parameter data, and tail data. The header data and tail data are used to identify and protect the printing parameter data during data transmission. If the print instruction data contains header data and footer data, then a parsing completion feedback message is sent to the terminal device so that the terminal device can display the parsing completion feedback message; Obtain the printing parameter data from the printing instruction data; Perform the printing operation based on the aforementioned printing parameter data; The step of obtaining the printing parameter data in the printing instruction data includes: obtaining the printing parameter data located between the header data and the tail data.
2. The method according to claim 1, characterized in that, The parsing and processing of the print instruction data includes: First data is obtained from the header of the print instruction data based on the length of the first byte. If the first data matches the preset header data format, the first data is determined as the header data. The second data is obtained from the end of the print instruction data based on the length of the second byte. If the second data matches the preset end data format, the second data is determined as the end data.
3. The method according to claim 1, characterized in that, The step of obtaining the printing parameter data from the printing instruction data includes: Obtain the byte length data appended to the header data; Based on the byte length data, the print parameter data in the print instruction data is obtained, wherein the byte length of the print parameter data is the same as that of the byte length data.
4. The method according to claim 3, characterized in that, Based on the byte length data, the printing parameter data in the printing instruction data is obtained, including: Obtain the byte length corresponding to the byte length data; Obtain the third data that meets the specified byte length after concatenating the byte length data, and determine the third data as the print parameter data in the print instruction data.
5. The method according to claim 1, characterized in that, The method further includes: If the print instruction data contains header data and tail data, a parsing completion prompt message is output, which includes a light-up prompt message or a vibration prompt message.
6. The method according to claim 1, characterized in that, The method further includes: If the print instruction data does not contain both header and footer data simultaneously, a parsing failure feedback message is sent to the terminal device so that the terminal device displays the parsing failure feedback message. And / or, output a parsing failure message. And / or, stop the printing operation.
7. The method according to claim 3, characterized in that, The printing operation based on the printing parameter data includes: The printing parameter data is then validated. If the printing parameter data passes the verification process, a verification success feedback message is sent to the terminal device so that the terminal device can display the verification success feedback message. The printing operation is performed based on the aforementioned printing parameter data.
8. The method according to claim 7, characterized in that, The method further includes: If the printing parameter data passes the verification process, a verification success message will be output, which may include a light indicator or a vibration indicator.
9. The method according to claim 7, characterized in that, The method further includes: If the printed parameter data fails the verification process, a verification failure feedback message is sent to the terminal device so that the terminal device displays the verification failure feedback message. And / or, output a verification failure message. And / or, stop the printing operation.
10. The method according to claim 7, characterized in that, The method further includes: Obtain the verification data located between the print parameter data and the tail data; The verification process for the printing parameter data includes: The printing parameter data is encrypted using a preset encryption method to obtain the target data; If the target data matches the verification data, then the printing parameter data is determined to have passed the verification process.
11. A data interaction device, characterized in that, The device includes: The parsing and processing unit is used to acquire the printing instruction data sent by the terminal device and to parse and process the printing instruction data. The printing instruction data is composed of header data, printing parameter data and tail data. The header data and the tail data are used to identify and protect the printing parameter data during data transmission. The information feedback unit is used to send parsing completion feedback information to the terminal device if the print instruction data contains header data and tail data, so that the terminal device can display the parsing completion feedback information. A parameter acquisition unit is used to acquire printing parameter data from the printing instruction data; A printing operation unit is used to perform printing operations based on the printing parameter data; The step of obtaining the printing parameter data in the printing instruction data includes: obtaining the printing parameter data located between the header data and the tail data.
12. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions, which are adapted to be loaded by a processor and executed as method steps as claimed in any one of claims 1 to 10.
13. An electronic device, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed the method steps as claimed in any one of claims 1 to 10.