Data communication method and device

By dynamically adjusting the compression ratio, combined with changes in data characteristics and network status in portable printer data communication, the problem of traditional technology being difficult to take into account both data transmission quality and efficiency, and achieving more efficient data transmission.

CN119052183BActive Publication Date: 2025-02-07SHENZHEN FEASYCOM TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411547203.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-02-07
Estimated Expiration
2044-11-01

AI Technical Summary

Technical Problem

In the data communication of portable printers, it is difficult to take into account both the data transmission quality and efficiency, and the traditional fixed compression ratio cannot adapt to different data characteristics and network states.

Method used

By acquiring the data characteristics of the data to be transmitted and the network status of the data communication device, the compression ratio is dynamically adjusted. The specific steps include identifying data characteristics, determining the initial compression ratio, adjusting it to a target compression ratio, and performing compression processing and transmission based on the target compression ratio.

Benefits of technology

While ensuring the quality of data transmission, it optimizes the use of network resources, reduces bandwidth waste, improves data transmission efficiency, and adapts to data transmission needs in different scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119052183B_ABST
    Figure CN119052183B_ABST
Patent Text Reader

Abstract

The present application discloses a data communication method and device, and relates to the field of data communication technology. Among them, the data communication method proposed in the present application obtains the data to be transmitted, identifies the data characteristics of the data to be transmitted, and then determines the initial compression ratio of the data to be transmitted according to the data characteristics of the data to be transmitted, and then obtains the network status of the data communication device, and adjusts the initial compression ratio to the target compression ratio based on the network status of the data communication device, and finally compresses the data to be transmitted based on the target compression ratio to obtain the corresponding data packet, and transmits the data packet to the portable printer. In this way, the present application can dynamically adjust the compression ratio according to the data characteristics of the data to be transmitted and the network status of the data communication device, so as to optimize the use of network resources, reduce bandwidth waste, improve data transmission efficiency, and meet the data transmission needs between the portable printer and the portable printer in different scenarios while ensuring the quality of data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data communication technology, and in particular to a data communication method and device. Background Art

[0002] In data communication with a portable printer, in order to reduce the amount of data transmission, improve network transmission efficiency, and reduce printing delay, the data is generally compressed before being transmitted to the portable printer so that the portable printer can receive it. Traditional data transmission methods often use a fixed compression ratio to compress the data before transmitting it to the portable printer. Although the above method is simple and easy to implement, it may not be able to take into account both the quality and efficiency of data transmission during the specific data transmission process.

[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of this application is to provide a data communication method and device, aiming to improve data transmission efficiency while ensuring data transmission quality.

[0005] To achieve the above object, the present application proposes a data communication method, which is applied to a data communication device. The data communication method includes:

[0006] Get the data to be transmitted;

[0007] Identifying data characteristics of the data to be transmitted; the data characteristics of the data to be transmitted include data type and data priority;

[0008] Determining an initial compression ratio of the data to be transmitted according to the data type, data priority and a preset initial compression ratio mapping table of the data to be transmitted;

[0009] Acquiring a network status of a data communication device, and adjusting the initial compression ratio to a target compression ratio based on the network status of the data communication device;

[0010] The data to be transmitted is compressed based on a target compression ratio to obtain a corresponding data packet, and the data packet is transmitted to the portable printer.

[0011] In one embodiment, the step of determining the initial compression ratio of the data to be transmitted according to the data characteristics of the data to be transmitted specifically includes:

[0012] Dividing the data to be transmitted into multiple data segments according to data type and / or data priority;

[0013] Determine the initial compression ratio corresponding to each data segment according to the data type, data priority and a preset initial compression ratio mapping table of the data to be transmitted;

[0014] The step of obtaining the network status of the data communication device and adjusting the initial compression ratio to the target compression ratio based on the network status of the data communication device specifically includes:

[0015] Acquiring a network status of a data communication device, and adjusting an initial compression ratio corresponding to each data segment to a target compression ratio based on the network status of the data communication device;

[0016] The step of compressing the data to be transmitted based on the target compression ratio to obtain a corresponding data packet, and transmitting the data packet to the portable printer specifically includes:

[0017] The plurality of data segments are compressed respectively based on a plurality of target compression ratios, the compressed data segments are reassembled into a complete data packet, and the data packet is transmitted to the portable printer.

[0018] In one embodiment, the network status of the data communication device includes network bandwidth, network delay and packet loss rate; the step of obtaining the network status of the data communication device and adjusting the initial compression ratio to the target compression ratio based on the network status of the data communication device includes:

[0019] Obtaining the current network bandwidth, network delay and packet loss rate of the data communication device;

[0020] Determining a compression ratio adjustment coefficient according to the network bandwidth, network delay and packet loss rate;

[0021] Based on the initial compression ratio and the compression ratio adjustment coefficient, a target compression ratio of the data to be transmitted is determined.

[0022] In one embodiment, the method further comprises determining the compression ratio adjustment coefficient according to the following formula:

[0023] K M =K B ×(1 / B+1)+k D ×D+k L ×L;

[0024] Among them, K M represents the compression ratio adjustment factor, B represents the current network bandwidth, D represents the network delay, L represents the packet loss rate, and K B represents the bandwidth factor, k D represents the delay coefficient, k L Indicates the packet loss rate coefficient.

[0025] In one embodiment, the step of determining the target compression ratio of the data to be transmitted based on the initial compression ratio and the compression ratio adjustment coefficient includes:

[0026] When the compression ratio adjustment coefficient is lower than a first preset threshold, determining the initial compression ratio as a target compression ratio;

[0027] When the compression ratio adjustment coefficient is not lower than the first preset threshold, the compression ratio adjustment level is determined according to the compression ratio adjustment coefficient, and the initial compression ratio is adjusted according to the compression ratio adjustment level to obtain a target compression ratio of the data to be transmitted.

[0028] In one embodiment, the method further comprises:

[0029] Obtain the change in compression ratio adjustment coefficient;

[0030] When the change in the compression ratio adjustment coefficient exceeds a second preset threshold, the method returns to the step of acquiring the network status of the data communication device and adjusting the initial compression ratio to a target compression ratio based on the network status of the data communication device.

[0031] In one embodiment, before the step of obtaining the data to be transmitted, the method further includes:

[0032] Get priority setting instructions;

[0033] According to the priority setting instruction, the data to be transmitted is set to a corresponding data priority.

[0034] In addition, to achieve the above-mentioned purpose, the present application also proposes a data communication device, which is communicatively connected to a portable printer, and the data communication device includes: a memory, a processor, and a data communication program stored in the memory and executable on the processor, and the data communication program is configured to implement the steps of the data communication method.

[0035] In one embodiment, the data communication device includes at least one of a mobile device, a server, a router or a switch.

[0036] The data communication method proposed in the present application obtains the data to be transmitted, identifies the data characteristics of the data to be transmitted, determines the initial compression ratio of the data to be transmitted according to the data characteristics of the data to be transmitted, obtains the network status of the data communication device, and adjusts the initial compression ratio to the target compression ratio based on the network status of the data communication device, and finally compresses the data to be transmitted based on the target compression ratio to obtain the corresponding data packet, and transmits the data packet to the portable printer. In this way, the present application can dynamically adjust the compression ratio according to the data characteristics of the data to be transmitted and the network status of the data communication device, thereby optimizing the use of network resources, reducing bandwidth waste, and improving data transmission efficiency while ensuring the quality of data transmission, so as to meet the data transmission needs between the portable printer and the portable printer in different scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0039] Figure 1 A flow chart of an embodiment of a data communication method of the present application;

[0040] Figure 2 A flowchart of another embodiment of the data communication method of the present application is provided;

[0041] Figure 3 A flowchart of another embodiment of the data communication method of the present application is provided;

[0042] Figure 4 A flowchart diagram of another embodiment of the data communication method of the present application is provided;

[0043] Figure 5 A flowchart diagram of another embodiment of the data communication method of the present application is provided;

[0044] Figure 6 A schematic diagram of a flow chart of a data communication method and an embodiment of the present application;

[0045] Figure 7 A schematic diagram of a circuit structure provided for an embodiment of a data communication device of the present application.

[0046] Description of Figure Numbers:

[0047] 10. Memory; 20. Processor.

[0048] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0049] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0050] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0051] The main solution of the embodiment of the present application is: obtaining data to be transmitted;

[0052] Identifying data characteristics of the data to be transmitted; the data characteristics of the data to be transmitted include data type and data priority;

[0053] Determining an initial compression ratio of the data to be transmitted according to the data type, data priority and a preset initial compression ratio mapping table of the data to be transmitted;

[0054] Acquiring a network status of a data communication device, and adjusting the initial compression ratio to a target compression ratio based on the network status of the data communication device;

[0055] The data to be transmitted is compressed based on a target compression ratio to obtain a corresponding data packet, and the data packet is transmitted to the portable printer.

[0056] In this embodiment, for the convenience of description, the following description is made by taking the identification data communication device as the execution subject.

[0057] In the prior art, in order to reduce the amount of data transmission, improve network transmission efficiency, and reduce printing delays in data communication with a portable printer, data is generally compressed before being transmitted to the portable printer so that the portable printer can receive it. Traditional data transmission methods often use a fixed compression ratio to compress data before transmitting it to the portable printer. Although the above method is simple and easy to implement, it may not take into account both the quality and efficiency of data transmission during the specific data transmission process.

[0058] The present application provides a solution that enables a data communication device to dynamically adjust the compression ratio according to the data characteristics of the data to be transmitted and the network status of the data communication device, thereby optimizing the use of network resources while ensuring the quality of data transmission, reducing bandwidth waste, and improving data transmission efficiency, thereby meeting the data transmission needs between a portable printer and a data communication device in different scenarios.

[0059] It can be seen from the above embodiments that the present application obtains the data to be transmitted and identifies the data features of the data to be transmitted, determines the initial compression ratio of the data to be transmitted according to the data features of the data to be transmitted, obtains the network status of the data communication device, and adjusts the initial compression ratio to the target compression ratio based on the network status of the data communication device, and finally compresses the data to be transmitted based on the target compression ratio to obtain the corresponding data packet, and transmits the data packet to the portable printer. In this way, the present application can dynamically adjust the compression ratio according to the data features of the data to be transmitted and the network status of the data communication device, thereby optimizing the use of network resources, reducing bandwidth waste, and improving data transmission efficiency while ensuring the quality of data transmission, and meeting the data transmission needs between the portable printer and the portable printer in different scenarios.

[0060] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a data communication device, etc. The following takes a data communication device as an example to illustrate this embodiment and the following embodiments.

[0061] Based on this, the present application embodiment provides a data method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the data communication method of the present application.

[0062] In this embodiment, the data communication method includes steps S100 to S500:

[0063] Step S100, obtaining data to be transmitted.

[0064] It should be noted that the data to be transmitted can be in the form of text, image, audio, video, etc. The data to be transmitted can be obtained by user input, receiving from other devices, reading from a memory, etc. It is understandable that the present application can obtain a variety of data types and sources to ensure the versatility and flexibility of the data communication method.

[0065] Step S200, identifying data characteristics of the data to be transmitted; the data characteristics of the data to be transmitted include data type and data priority.

[0066] It should be noted that the data types may include text data, image data, audio data, and video data. Among them, text data has different encoding formats, image data has different resolutions and compression formats, and audio and video data may have different sampling rates and bit rates. Identifying the data features of the data to be transmitted can be performed by analyzing data content, extracting metadata, using machine learning algorithms, and the like. For example, for image data, image recognition technology can be used to determine its resolution and compression format for identification; for text data, its encoding type and language model can be analyzed for identification; for audio and video data, parameters such as sampling rate and bit rate can be analyzed for identification. Data priority can be determined based on factors such as the importance of the data, real-time requirements, and user settings. For example, emergency notifications or real-time video streams may be given a higher priority, while ordinary text messages or non-real-time picture sharing may have a lower priority. The identification of data priority helps to reasonably allocate resources and prioritize during data compression and transmission. By identifying the features of the data to be transmitted, the data communication device can better understand the characteristics of the data to be transmitted, thereby providing a basis for subsequent compression processing.

[0067] Step S300, determining the initial compression ratio of the data to be transmitted according to the data type, data priority and a preset initial compression ratio mapping table of the data to be transmitted.

[0068] It should be noted that the preset initial compression ratio mapping table may include initial compression ratio values ​​corresponding to a plurality of data types and priority combinations. For example, text data may have a higher priority and a higher initial compression ratio, while image data may have a lower priority and a lower initial compression ratio. In this way, the data communication device can quickly determine the initial compression ratio according to the data type and priority, thereby improving processing efficiency.

[0069] In step S300, the data communication device first identifies the data type and data priority of the data to be transmitted. If the data to be transmitted is high priority data, the data communication device will search the initial compression ratio mapping table for the corresponding high initial compression ratio value. On the contrary, if the data to be transmitted is low priority data, the data communication device will select a lower initial compression ratio value. In this way, the data communication device can ensure that the high priority data obtains better quality assurance during the transmission process, while appropriately compressing the low priority data to save network resources.

[0070] In this embodiment, the initial compression ratio mapping table can be obtained through experiments and statistical analysis to ensure its accuracy and applicability. In practical applications, the initial compression ratio mapping table can be updated regularly to adapt to new data types and changes in network environment. In addition, the initial compression ratio mapping table can also analyze a large amount of historical data to extract typical features and priorities of different types of data, thereby optimizing the setting of the initial compression ratio. For example, for video data with high real-time requirements, the initial compression ratio mapping table can set a lower compression ratio to ensure transmission quality and speed, while for non-real-time file data, a higher compression ratio can be used to save bandwidth. In addition, the initial compression ratio mapping table can also be adjusted through user feedback to meet the needs of specific user groups. For example, if a certain user group prefers high-quality image transmission, the initial compression ratio mapping table can set a higher initial compression ratio value for the image data to ensure image quality. In this embodiment, by combining the data type and priority to determine the initial compression ratio, the data communication device can more intelligently process different types of data to ensure the efficiency and reliability of data transmission.

[0071] Step S400: acquiring a network status of a data communication device, and adjusting the initial compression ratio to a target compression ratio based on the network status of the data communication device.

[0072] It should be noted that the network status of the data communication device may include but is not limited to the current network bandwidth, network delay, packet loss rate, signal strength, network congestion, etc. The network status may be obtained through a built-in network interface module or by interacting with an interface of a network service provider. For example, the network delay and packet loss rate may be measured by sending a specific network detection packet, or the current network bandwidth and signal strength may be obtained by analyzing the statistical data provided by the network interface module. The acquisition of the network status may be real-time or periodic to ensure that the data communication device can respond to changes in the network environment in a timely manner.

[0073] In step S400, the initial compression ratio is adjusted based on the network status of the data communication device, and a variety of strategies can be used. For example, when it is detected that the network bandwidth is low, the target compression ratio can be appropriately lowered to reduce the data packet size, thereby reducing the network transmission time; conversely, if the network bandwidth is high, the target compression ratio can be appropriately increased to further optimize the data transmission efficiency. In addition, if the network delay is high, it may be necessary to reduce the compression ratio to reduce data processing time and ensure that the data can be transmitted in time. By dynamically adjusting the target compression ratio, the present application can flexibly respond according to the real-time network conditions to ensure the stability and efficiency of data transmission.

[0074] Step S500: compress the data to be transmitted based on the target compression ratio to obtain a corresponding data packet, and transmit the data packet to the portable printer.

[0075] In this step, the data communication device will compress the data to be transmitted according to the determined target compression ratio. The compression algorithm can be a general compression algorithm, such as ZIP, RAR, JPEG, etc., or a compression algorithm optimized for a specific data type. After the compression process, the data communication device will generate a corresponding data packet and send the data packet to the target device through the network interface. During the transmission process, the data communication device can also use fragmentation, retransmission, encryption and other technologies to ensure the security and reliability of data transmission.

[0076] In this embodiment, by obtaining the data to be transmitted and identifying the data features of the data to be transmitted, and then determining the initial compression ratio of the data to be transmitted according to the data features of the data to be transmitted, then obtaining the network status of the data communication device, and adjusting the initial compression ratio based on the network status of the data communication device to obtain the target compression ratio of the data to be transmitted, and finally compressing the data to be transmitted based on the target compression ratio of the data to be transmitted, obtaining the corresponding data packet, and transmitting the data packet to the portable printer. In this way, the present application can dynamically adjust the compression ratio according to the data features of the data to be transmitted and the network status of the data communication device, thereby optimizing the use of network resources, reducing bandwidth waste, improving data transmission efficiency, and meeting the data transmission requirements between the portable printer and the portable printer in different scenarios while ensuring the quality of data transmission. Through the implementation of the present application, the data communication device can better adapt to different network environments and data types, so that the portable printer can receive and process data more efficiently, thereby improving the overall work efficiency and user experience.

[0077] In a feasible implementation, the data communication device can further optimize data transmission according to the current state and capability of the portable printer. For example, if the portable printer is currently in a low power state, the data communication device can adjust the compression ratio to reduce the data transmission amount to reduce the processing burden of the printer.

[0078] In one possible implementation, reference Figure 2 , step S300 specifically includes steps S311 to S312, wherein:

[0079] Step S311, dividing the data to be transmitted into multiple data segments according to data type and / or data priority.

[0080] It should be noted that, in practical applications, the data to be transmitted often contains multiple types of data, such as text, images, audio and video, etc. At the same time, the data to be transmitted may contain data segments of multiple priorities, such as urgent business reports and ordinary email attachments. In order to more effectively process these different types of data, the data communication device can divide the data to be transmitted into multiple data segments, each data segment corresponding to a data type and / or data priority. For example, urgent business reports can be divided into high-priority data segments, while ordinary email attachments are divided into low-priority data segments. For another example, image data and text data can be divided into different data segments for separate processing. In this way, the data communication device can optimize the processing according to the specific needs of each data segment, thereby improving the efficiency and quality of overall data transmission.

[0081] Step S312, determining the initial compression ratio corresponding to each data segment according to the data type, data priority and a preset initial compression ratio mapping table of the data to be transmitted.

[0082] In step S312, the data communication device will determine the initial compression ratio for each data segment independently. Specifically, the device will retrieve the corresponding initial compression ratio value from the initial compression ratio mapping table according to the specific type and priority of each data segment. For example, for a high-priority text data segment, the device will select a higher initial compression ratio value to ensure fast transmission; and for a low-priority image data segment, a lower initial compression ratio value will be selected to save bandwidth. In this way, the data communication device can adopt the most appropriate compression strategy for each data segment to ensure the efficiency and reliability of data transmission.

[0083] Step S400 includes step S410, obtaining the network status of the data communication device, and adjusting the initial compression ratio corresponding to each data segment to a target compression ratio based on the network status of the data communication device.

[0084] It is understood that in step S410, the data communication device will monitor the network status in real time and dynamically adjust the initial compression ratio of each data segment according to the current network status. For example, if the network bandwidth suddenly drops, the device will automatically reduce the compression ratio of all data segments to reduce the size of the data packet and avoid network congestion and data loss. On the contrary, if the network condition improves, the device can increase the compression ratio to fully utilize the network bandwidth and improve data transmission efficiency.

[0085] In addition, the data communication device can also adjust the compression ratio according to other network indicators such as network delay and packet loss rate. For example, if the network delay is high, the device may reduce the compression ratio to reduce data processing time and ensure that the data can reach the receiving end in time. Through this flexible adjustment mechanism, the data communication device can adapt to the ever-changing network environment and ensure the stability and reliability of data transmission.

[0086] Step S500 includes step S510, compressing the multiple data segments respectively based on multiple target compression ratios, recombining the compressed data segments into a complete data packet, and transmitting the data packet to the portable printer.

[0087] In this embodiment, the data communication device will perform independent compression processing on each data segment. That is, for each data segment, the device will compress according to its corresponding target compression ratio to ensure that each data segment achieves the optimal compression effect. The compressed data segments will be reassembled into a complete data packet for transmission to the portable printer. In step S510, the data communication device adopts a data reorganization mechanism to ensure that the integrity and order of the data are maintained during the compression and reorganization process. The reorganized data packet will contain all necessary information, including the identification, order and compression information of the data segment, so that the receiving end can correctly decompress and reorganize the data.

[0088] In addition, in order to further improve the efficiency and security of data transmission, the data communication device can also use data fragmentation technology to split large data packets into multiple smaller data packets to adapt to the MTU (maximum transmission unit) limit of the network and reduce the fragmentation and reassembly overhead caused by large data packets. At the same time, the data communication device can also implement data encryption and identity authentication mechanisms to ensure the security and privacy of data during transmission.

[0089] Through the above steps, the present application provides an efficient, flexible and secure data transmission method, which can dynamically adjust the compression ratio according to different network conditions and data characteristics, optimize the use of network resources, reduce bandwidth waste, improve data transmission efficiency, and meet the data transmission needs between portable printers in different scenarios. The above dynamic adjustment mechanism enables the data communication device to better adapt to the ever-changing network environment and provide more stable and reliable data transmission services for portable printers. In practical applications, this technology can be widely used in various mobile office scenarios, such as business meetings, distance education, medical consultations, etc., to provide users with convenient printing solutions.

[0090] In one possible implementation, reference Figure 3 , the network status of the data communication device includes network bandwidth, network delay and packet loss rate; the step S400 includes steps S411 to S413, wherein:

[0091] Step S411, obtaining the current network bandwidth, network delay and packet loss rate of the data communication device.

[0092] It should be noted that the network bandwidth determines the maximum rate of data transmission, the network delay affects the response time of data transmission, and the packet loss rate reflects the stability of the network. Obtaining the current network bandwidth, network delay and packet loss rate of the data communication device can be achieved in a variety of ways. For example, the data communication device can periodically send network detection packets and calculate the current network delay by measuring the round-trip time of the detection packets. Similarly, the data communication device can calculate the packet loss rate by analyzing the number of data packets transmitted and the number of data packets successfully received. As for the network bandwidth, the data communication device can estimate it by measuring the amount of data successfully transmitted within a certain period of time. By obtaining the current network bandwidth, network delay and packet loss rate of the data communication device, it is ensured that the data communication device can accurately judge the current network status, so as to facilitate the subsequent dynamic adjustment of the initial compression ratio.

[0093] Step S412: determining a compression ratio adjustment coefficient according to the network bandwidth, network delay and packet loss rate.

[0094] In this embodiment, the compression ratio adjustment coefficient is used to dynamically adjust the initial compression ratio to adapt to the current network conditions. Specifically, the data communication device will calculate a comprehensive compression ratio adjustment coefficient based on the current network bandwidth, network delay and packet loss rate. For example, if the current network bandwidth is low, the delay is high, and the packet loss rate is high, indicating that the network condition is poor, the data communication device will calculate a larger compression ratio adjustment coefficient to increase the degree of data compression to avoid further deterioration of the network condition. On the contrary, if the current network bandwidth is high, the delay is low, and the packet loss rate is low, indicating that the network condition is good, the data communication device will calculate a smaller compression ratio adjustment coefficient to reduce the degree of data compression, make full use of network resources, and facilitate the portable printer to efficiently receive data. The method for calculating the compression ratio adjustment coefficient can be based on a preset empirical formula or a model derived from a machine learning algorithm to ensure the accuracy and adaptability of the adjustment.

[0095] In a feasible implementation manner, the method further includes determining the compression ratio adjustment coefficient according to the following formula:

[0096] K M =K B ×(1 / B+1)+k D ×D+k L ×L;

[0097] Among them, K M represents the compression ratio adjustment factor, B represents the current network bandwidth, D represents the network delay, L represents the packet loss rate, and KB represents the bandwidth factor, k D represents the delay coefficient, k L Indicates the packet loss rate coefficient.

[0098] In this embodiment, the bandwidth coefficient k B , delay coefficient k D and packet loss coefficient k L The bandwidth coefficient k is positive. B It is used to characterize the influence of bandwidth on compression ratio. When the bandwidth is higher, 1 / B+1 is closer to zero, and the compression ratio adjustment coefficient K M The smaller the delay coefficient k, the lower the compression level should be. D It is used to characterize the influence of network delay on compression ratio. When the network delay D is longer, the compression ratio adjustment coefficient KM increases accordingly. At this time, the compression degree should be increased to reduce the transmission time. The packet loss rate coefficient k L It is used to characterize the influence of packet loss rate on compression ratio. When the packet loss rate L is higher, it indicates that the network stability is poor, and the compression ratio adjustment coefficient KM increases accordingly to ensure the reliability of data transmission. By reasonably setting the values ​​of bandwidth coefficient kB, delay coefficient kD and packet loss rate coefficient kL, the data communication device can dynamically adjust the compression ratio according to the current network status, thereby ensuring the efficiency and reliability of data transmission while adapting to the ever-changing network environment.

[0099] In this embodiment, for example, when bandwidth B = 10 Mbps, delay D = 50 ms, packet loss rate L = 2%, bandwidth coefficient kB = 0.05, delay coefficient kD = 0.01, packet loss rate coefficient k L =0.1, then the compression ratio adjustment coefficient K calculated according to the formula M for:

[0100] K M =0.05×(1 / 10+1)+0.01×50+0.1×2=0.05×0.1+0.5+0.2=0.005+0.5+0.2=0.705.

[0101] Step S413: determining a target compression ratio of the data to be transmitted based on the initial compression ratio and the compression ratio adjustment coefficient.

[0102] In this embodiment, the data communication device adjusts the coefficient K according to the calculated compression ratio. M Dynamically adjust the initial compression ratio. If the current network condition is poor, the compression ratio adjustment factor K M If the compression ratio is smaller, the data communication device will reduce the compression ratio to reduce the demand for network resources, thereby avoiding further deterioration of the network condition. On the contrary, if the current network condition is good, the compression ratio adjustment coefficient K MIf the initial compression ratio is larger, the data communication device will increase the compression ratio to improve the data transmission efficiency while fully utilizing network resources. Specifically, the data communication device can directly multiply the initial compression ratio by the compression ratio adjustment coefficient to obtain the target compression ratio. For example, if the initial compression ratio is 2:1, the compression ratio adjustment coefficient K calculated above is M is 0.705, then the target compression ratio is 2×0.705=1.41:1. That is, during the data transmission process, the data communication device will use a compression ratio of 1.41:1 to compress the data. In addition, other algorithms or logical judgments can be used to comprehensively consider the initial compression ratio and the compression ratio adjustment coefficient to determine the final target compression ratio. For example, the data communication device can set a threshold value, when the compression ratio adjustment coefficient K M When the threshold is exceeded, the initial compression ratio is adjusted. This can avoid frequent adjustments to the compression ratio when the network conditions do not change much, thereby reducing unnecessary calculations and resource consumption, making the portable printer more stable and efficient during operation.

[0103] It can be understood that when the data characteristics of the data to be transmitted include multiple data types and / or multiple data priorities, the data to be transmitted is divided into multiple data segments according to the data type and / or data priority; after determining the initial compression ratio corresponding to each data segment based on the data type, data priority and a preset initial compression ratio mapping table of the data to be transmitted, the present application calculates the corresponding compression ratio adjustment coefficient for the initial compression ratio corresponding to each data segment according to the current network status of the data communication device, so as to determine the target compression ratio corresponding to each data segment, thereby realizing differentiated compression processing of data of different types and priorities.

[0104] In one possible implementation, reference Figure 4 Step S413 includes step S4131, when the compression ratio adjustment coefficient is lower than a first preset threshold, determining the initial compression ratio as the target compression ratio; when the compression ratio adjustment coefficient is not lower than the first preset threshold, determining the compression ratio adjustment level according to the compression ratio adjustment coefficient, and adjusting the initial compression ratio according to the compression ratio adjustment level to obtain the target compression ratio of the data to be transmitted.

[0105] In this embodiment, when the compression ratio adjustment coefficient K M When the compression ratio is lower than the first preset threshold, the data communication device will directly determine the initial compression ratio as the target compression ratio. This means that the current network condition has little impact on data compression and there is no need to adjust the initial compression ratio. For example, if the first preset threshold is set to 1.5, and the calculated compression ratio adjustment coefficient K is M If it is 1.2, the data communication device will keep the initial compression ratio unchanged.

[0106] In this embodiment, when the compression ratio adjustment coefficient K M When the compression ratio is not less than the first preset threshold, the data communication device will determine the compression ratio adjustment level according to the compression ratio adjustment coefficient. The compression ratio adjustment level can be a preset range. For example, when K M When it is between 1.5 and 2.0, the adjustment level is 1; when K M When the value is between 2.0 and 2.5, the adjustment level is 2; and so on. Each adjustment level corresponds to a specific compression ratio adjustment value, which is used to further adjust the initial compression ratio. According to the determined compression ratio adjustment level, the data communication device will adjust the initial compression ratio according to the level to obtain the target compression ratio of the data to be transmitted. For example, if the initial compression ratio is 2:1 and the compression ratio adjustment factor K is M is 2.3, and the corresponding compression ratio adjustment level is 2, then the data communication device will adjust the initial compression ratio according to the adjustment value corresponding to level 2. Assuming that the adjustment value corresponding to level 2 is 1.2, the target compression ratio is calculated as follows:

[0107] Target compression ratio = initial compression ratio × adjustment value corresponding to compression ratio adjustment level;

[0108] Target compression ratio = 2 × 1.2;

[0109] Target compression ratio = 2.4.

[0110] In this way, the data communication device can flexibly adjust the compression ratio according to the real-time network status to ensure the efficiency and reliability of data transmission. At the same time, by setting the preset threshold and the compression ratio adjustment level, the data communication device can avoid frequent adjustment of the compression ratio when the network status does not change much, thereby reducing unnecessary calculations and resource consumption, thereby saving the energy consumption of the portable printer during operation and improving the overall work efficiency.

[0111] In one possible implementation, reference Figure 5 The method further includes steps S610 to S620, wherein:

[0112] Step S610, obtaining the change amount of the compression ratio adjustment coefficient.

[0113] In this embodiment, the data communication device continuously monitors the network status and calculates the compression ratio adjustment coefficient K M Specifically, the data communication device will recalculate the compression ratio adjustment coefficient K under the current network status periodically or according to a specific event trigger. M For example, at regular intervals (such as every second, every minute, or every hour) or when network conditions change significantly, the data communication device will re-evaluate the values ​​of bandwidth B, delay D, and packet loss rate L, and update K accordingly. M Compression ratio adjustment factor KM The change in the value is used by the data communication device to respond to changes in network conditions in a timely manner, ensuring that the adjustment of the compression ratio can reflect the latest network environment.

[0114] Step S620, when the change in the compression ratio adjustment coefficient exceeds a second preset threshold, return to the step of acquiring the network status of the data communication device, and adjusting the initial compression ratio to the target compression ratio based on the network status of the data communication device.

[0115] In this embodiment, step S620, when the compression ratio adjustment coefficient K M When the change in exceeds the second preset threshold, the data communication device will re-acquire the current network status and adjust the initial compression ratio based on the new network status to obtain the target compression ratio of the data to be transmitted. This means that the data communication device can monitor the changes in network conditions in real time and dynamically adjust the compression ratio according to the changes to ensure the efficiency and reliability of data transmission. For example, the second preset threshold is set to 0.3, and the compression ratio adjustment coefficient K is M When the change in the compression ratio reaches 0.2, the data communication device will recalculate the target compression ratio according to the new compression ratio adjustment coefficient. M When the change in reaches 0.5, the data communication device will re-acquire the current network status and recalculate the compression ratio adjustment coefficient K according to the new network status. M , based on the compression ratio adjustment factor K obtained by recalculation M The initial compression ratio is adjusted to the target compression ratio. The specific adjustment process is referred to the above embodiment and will not be described in detail here.

[0116] In this embodiment, by returning to the step of obtaining the network status of the data communication device and adjusting the initial compression ratio to the target compression ratio based on the network status of the data communication device when the change in the compression ratio adjustment coefficient exceeds the second preset threshold, the data communication device can respond to changes in network conditions in real time and flexibly adjust the compression ratio to ensure the efficiency and reliability of data transmission. At the same time, by setting a preset threshold, the data communication device can avoid frequently adjusting the compression ratio when the network conditions do not change much, thereby reducing unnecessary calculations and resource consumption, thereby saving energy consumption of the portable printer during operation and improving overall work efficiency.

[0117] In one possible implementation, reference Figure 6 Before step S100, the method further includes steps S011 to S012, wherein:

[0118] Step S021, obtaining a priority setting instruction.

[0119] It should be noted that the priority setting instructions can be directly input by the user or automatically set according to the needs of the application. For example, in an enterprise environment, employees can set the priority of different files through the internal system to ensure that critical business data can be transmitted first. In a home environment, users can set the priority of specific data types through the user interface of the smart device, such as setting family photos to a high priority to ensure that good transmission quality can be obtained under limited network bandwidth.

[0120] Specifically, the user can input the priority setting instruction through a graphical user interface (GUI) or a command line interface (CLI). For example, the user can select a file in the graphical user interface and set its priority, or enter a specific command in the command line interface to specify the priority. The data communication device then parses the instruction input by the user, extracts the priority information, and associates it with the data to be transmitted. For example, if the user sets a high priority for a file through the graphical user interface, the data communication device will parse the instruction and associate the high priority mark with the file data.

[0121] Step S022: according to the priority setting instruction, the data to be transmitted is set to a corresponding data priority.

[0122] In step S022, the data communication device will mark the priority of the data to be transmitted according to the priority setting instruction provided by the user or the application. This process ensures that the data communication device can reasonably allocate resources according to the preset priority when processing data. For example, if the user specifies a certain file as a high priority, the data communication device will set a higher compression ratio for the file to allocate more bandwidth and processing time to ensure that it can be quickly and reliably transmitted to the portable printer.

[0123] In this embodiment, by obtaining the data to be transmitted and identifying the data characteristics of the data to be transmitted, and then determining the initial compression ratio of the data to be transmitted according to the data characteristics of the data to be transmitted, then obtaining the network status of the data communication device, and adjusting the initial compression ratio based on the network status of the data communication device to obtain the target compression ratio of the data to be transmitted, finally compressing the data to be transmitted based on the target compression ratio of the data to be transmitted, obtaining the corresponding data packet, and transmitting the data packet to the portable printer. In this way, the present application can dynamically adjust the compression ratio according to the data characteristics of the data to be transmitted and the network status of the data communication device, thereby optimizing the use of network resources while ensuring the quality of data transmission, reducing bandwidth waste, improving data transmission efficiency, meeting the data transmission requirements between the portable printer and different scenarios, and reducing unnecessary delays and data loss. In addition, by setting priorities, the present application further optimizes the data transmission process, ensures that key data can be processed with high quality, and improves the user experience.

[0124] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the data communication method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0125] The present application also provides a data communication device, wherein the data communication device is connected to a portable printer for communication. Figure 7 The data communication device includes a memory 10, a processor 20, and a data communication program stored in the memory 10 and executable on the processor 20, wherein the data communication program is configured to implement the steps of the data communication method.

[0126] The data communication device provided by the present application adopts the data communication method in the above embodiment, which can improve the data transmission efficiency while ensuring the data transmission quality. Compared with the prior art, the beneficial effects of the data communication device provided by the present application are the same as the beneficial effects of the data communication method provided by the above embodiment, and other technical features in the data communication device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0127] In a feasible implementation manner, the data communication device includes at least one of a mobile device, a server, a router or a switch.

[0128] In this embodiment, the data communication device may be a mobile device, such as a smart phone, a tablet computer, or a laptop computer. These devices usually have a built-in wireless communication module and can be connected to various networks, such as cellular networks, Wi-Fi, and Bluetooth. Implementing the data communication method of the present application on these devices can ensure that the portable printer can still obtain efficient and reliable data transmission services during the mobile process.

[0129] On the server side, the data communication device can be a high-performance server, which is usually deployed in a data center or a cloud platform. Through the data communication method of the present application, the server can optimize the data transmission between servers and improve the efficiency of large-scale data processing and distribution.

[0130] Routers and switches, as key devices of network infrastructure, can also integrate the data communication method of the present application. By implementing the method of the present application on routers and switches, the data transmission of the entire network can be optimized, network congestion can be reduced, and the stability and response speed of the network can be improved.

[0131] In a specific implementation, the processor 20 of the data communication device may be a central processing unit (CPU), a digital signal processor (DSP) or an application-specific integrated circuit (ASIC). The processor 20 is responsible for executing the data communication program stored in the memory 10, and completing operations such as data compression processing, network status monitoring and compression ratio adjustment according to program instructions.

[0132] The memory 10 may be a random access memory (RAM), a read only memory (ROM) or a solid state drive (SSD), etc. The memory 10 is used to store a data communication program and various data and parameters generated during the data communication process.

[0133] In addition, the data communication device may also include other hardware components such as input / output interfaces, network interfaces, etc. The input / output interfaces may be used to connect external devices such as keyboards, mice, monitors, etc., so that users can operate and monitor the working status of the data communication device. The network interface is used to connect to an external network to receive and send data.

[0134] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A data communication method, applied to a data communication device, characterized in that: The data communication device is communicatively connected to the portable printer, and the data communication method comprises: Get the data to be transmitted; Identifying data characteristics of the data to be transmitted; the data characteristics of the data to be transmitted include data type and data priority; Dividing the data to be transmitted into multiple data segments according to data type and / or data priority; According to the data type, data priority and preset initial compression ratio mapping table of the data to be transmitted, the initial compression ratio corresponding to each data segment is determined, so as to adopt the most appropriate compression strategy for each data segment to ensure the efficiency and reliability of data transmission; Acquiring a network status of a data communication device, and adjusting an initial compression ratio corresponding to each data segment to a target compression ratio based on the network status of the data communication device; The step of obtaining the network status of the data communication device and adjusting the initial compression ratio corresponding to each data segment to the target compression ratio based on the network status of the data communication device includes: When the network bandwidth decreases, the compression ratio of all data segments is reduced to reduce the size of data packets and avoid network congestion and data loss; when the network condition improves, the compression ratio of all data segments is increased to improve the utilization of network bandwidth and data transmission efficiency; Compressing the plurality of data segments respectively based on a plurality of target compression ratios, recombining the compressed data segments into a complete data packet, and transmitting the data packet to the portable printer; The network status of the data communication device includes network bandwidth, network delay and packet loss rate; the step of obtaining the network status of the data communication device and adjusting the initial compression ratio to the target compression ratio based on the network status of the data communication device includes: Obtaining the current network bandwidth, network delay and packet loss rate of the data communication device; Determining a compression ratio adjustment coefficient according to the network bandwidth, network delay and packet loss rate; When the compression ratio adjustment coefficient is lower than a first preset threshold, determining the initial compression ratio as a target compression ratio; When the compression ratio adjustment coefficient is not lower than the first preset threshold value, the compression ratio adjustment level is determined according to the compression ratio adjustment coefficient, and the initial compression ratio is adjusted according to the compression ratio adjustment level to obtain the target compression ratio of the data to be transmitted, so as to avoid frequent adjustment of the target compression ratio when the network condition does not change much, reduce unnecessary calculation and resource consumption, save energy consumption of the portable printer during operation, and improve overall work efficiency.

2. The data communication method according to claim 1, wherein: The method further includes determining the compression ratio adjustment coefficient according to the following formula: K M =K B ×(1 / B+1)+k D ×D+k L ×L; Among them, K M represents the compression ratio adjustment factor, B represents the current network bandwidth, D represents the network delay, L represents the packet loss rate, and K B represents the bandwidth factor, k D represents the delay coefficient, k L Indicates the packet loss rate coefficient.

3. The data communication method according to claim 1, wherein: The method further comprises: Obtain the change in compression ratio adjustment coefficient; When the change in the compression ratio adjustment coefficient exceeds a second preset threshold, the method returns to the step of acquiring the network status of the data communication device and adjusting the initial compression ratio to a target compression ratio based on the network status of the data communication device.

4. The data communication method according to claim 3, characterized in that: Before the step of obtaining the data to be transmitted, the method further includes: Get priority setting instructions; According to the priority setting instruction, the data to be transmitted is set to a corresponding data priority.

5. A data communication device, characterized in that: The data communication device is communicatively connected to a portable printer, and comprises: a memory, a processor, and a data communication program stored in the memory and executable on the processor, wherein the data communication program is configured to implement the steps of the data communication method as described in any one of claims 1 to 4.

6. The data communication device according to claim 5, characterized in that: The data communication device includes at least one of a mobile device, a server, a router or a switch.

Citation Information

Patent Citations

  • Method and device for optimizing remote application video play

    CN103139609A

  • Data transmission method and device, electronic equipment and storage medium

    CN115086306A

  • Data transmission method and device, electronic equipment and computer storage medium

    CN116209007A