Bar code processing, displaying and reading method and device
Technical Field
The application relates to the technical field of terminals, in particular to a method and a device for processing, displaying and reading bar codes.
Background
With the rapid expansion and development of retail industry and consumer market, the increase of Chinese barcode label business is promoted. Because the bar code has the obvious characteristics of high speed, convenient use, low cost and the like, bar code labels are required to be used in more and more places. However, the conventional bar code has the obvious disadvantage that the data capacity is low, only 32 pure characters are supported, and the increasing use scenes are difficult to meet. At present, in online scenes, the barcode on the mobile phone is used as payment certificates, ticket certificates, coupons, admission tickets, member certificates and other scenes increasingly, but the barcode is limited by the data transmission capacity of the barcode, and more information is difficult to transmit by using the barcode in many times.
Although two-dimensional codes provide a solution for more data input, up to thousand characters, the cost of the device for reading two-dimensional codes is much higher than that of one-dimensional codes, and the device is a barrier to popularization.
Disclosure of Invention
The embodiment of the application provides a method and a device for processing, displaying and reading a bar code, which are used for increasing the information quantity transmitted by the bar code and solving the problem of application limitation of the bar code caused by the transmitted information quantity.
In one aspect, an embodiment of the present application provides a barcode processing method, including:
dividing a character string to be processed into a plurality of divided character strings, wherein the divided character strings do not exceed a set length;
generating header information for the plurality of divided character strings, respectively, the header information being used to represent sequence information of the divided character strings;
and generating a plurality of character strings to be displayed according to the plurality of segmentation character strings and the corresponding head information thereof.
Correspondingly, the embodiment of the application provides a bar code processing device, which comprises:
the segmentation module is used for segmenting the character string to be processed into a plurality of segmentation character strings, wherein the segmentation character strings do not exceed a set length;
a header information generation module configured to generate header information for each of the plurality of divided character strings, the header information being used to indicate sequence information of the divided character strings;
and the character generation module to be displayed is used for generating a plurality of character strings to be displayed according to the plurality of segmentation character strings and the corresponding head information.
In another aspect, an embodiment of the present application provides a barcode display method, including:
receiving a plurality of character strings to be displayed;
and dynamically and sequentially displaying the bar codes generated by the character strings to be displayed on a screen at a set frequency.
Accordingly, an embodiment of the present application provides a barcode display device, which includes:
the receiving module is used for receiving a plurality of character strings to be displayed;
and the display module is used for dynamically and sequentially displaying the bar codes generated by the plurality of character strings to be displayed on the screen at a set frequency.
In addition, an embodiment of the present application further provides a barcode reading method, including:
reading a plurality of bar codes;
determining sequence information of the plurality of barcodes according to the head information of the plurality of barcodes;
and combining the message body information of the barcodes according to the sequence information of the barcodes to determine the character strings carried by the barcodes.
Accordingly, an embodiment of the present application provides a barcode reading apparatus, including:
a barcode reading module for reading a plurality of barcodes;
the head information determining module is used for determining the sequence information of the plurality of barcodes according to the head information of the plurality of barcodes;
and the combination module is used for combining the message body information of the barcodes according to the sequence information of the barcodes to determine the character strings borne by the barcodes.
The beneficial effects are as follows:
the application provides a bar code processing method and a bar code processing device, wherein a character string to be processed is divided into a plurality of divided character strings, and the divided character strings do not exceed a set length; generating header information for each of the plurality of divided character strings, the header information being used to indicate sequence information of the divided character strings; and generating a plurality of character strings to be displayed according to the plurality of segmentation character strings and the corresponding head information thereof. By the bar code processing scheme, the long character string can be divided into the short character strings, and the sequence information of each short character string in the long character string is given, so that the long character string can be transmitted without being limited by the length of the long character string.
The application also provides a bar code display method and a bar code display device, which are used for receiving a plurality of character strings to be displayed; and dynamically and sequentially displaying the bar codes generated by the character strings to be displayed on a screen at a set frequency. By the bar code display scheme, the situation that the character string generation and the bar code display equipment are separated can be supported, and the bar code display device only needs to support receiving of a plurality of character strings to be displayed and displaying of corresponding bar codes.
In addition, the application also provides a bar code reading method and a bar code reading device, which are used for reading a plurality of bar codes; determining sequence information of the plurality of barcodes according to the header information of the plurality of barcodes; and combining the message body information of the plurality of barcodes according to the sequence information of the plurality of barcodes to determine the character strings carried by the plurality of barcodes. Therefore, the information carried by the barcodes can be integrated, the content carried by the barcodes is determined, and the long character string can be transmitted without being limited by the length of the long character string.
Drawings
Specific embodiments of the present application will be described below with reference to the accompanying drawings, in which:
fig. 1 is a schematic flow chart illustrating a barcode processing method in an embodiment of the present application;
FIG. 2 is a flow chart illustrating a barcode reading method in an embodiment of the present application;
FIG. 3 is a flow chart illustrating a barcode display method in an embodiment of the present application;
FIG. 4 is a flowchart illustrating a barcode processing method according to a first embodiment;
FIG. 5 is a flowchart showing a barcode reading method according to the second embodiment;
FIG. 6 is a schematic structural diagram of a barcode processing apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram showing a barcode processing apparatus according to an embodiment of the present application;
FIG. 8 is a schematic structural diagram of a barcode reading apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram illustrating a barcode display apparatus according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions and advantages of the present application more apparent, the following further detailed description of the exemplary embodiments of the present application with reference to the accompanying drawings makes it clear that the described embodiments are only a part of the embodiments of the present application, and not an exhaustive list of all embodiments. And the embodiments and features of the embodiments in the present description may be combined with each other without conflict.
The inventor notices in the process of invention that: barcodes have a low cost and a high popularity, but are limited by the data transmission capacity of barcodes, and it is often difficult to transmit more information using barcodes. The inventor hopes to utilize the characteristic that the bar code can be dynamically generated and refreshed on intelligent terminals such as mobile phones and the like, and the capacity of data transmission is increased by matching with the corresponding coding rule; since the scheme can multiplex the bar code reading equipment, no additional cost is caused, and great benefits are brought to the popularization and the use.
Based on this, embodiments of the present application propose a barcode processing method and apparatus, a barcode display method and apparatus, and a barcode reading method and apparatus, which are described in detail below.
Fig. 1 illustrates a barcode processing method in an embodiment of the present application, and as shown in the figure, the method includes:
step 101, dividing a character string to be processed into a plurality of divided character strings, wherein the divided character strings do not exceed a set length;
step 102, respectively generating header information for a plurality of segmentation character strings, wherein the header information is used for representing sequence information of the segmentation character strings;
the sequence information may include the total number of strings in the set and position information in the strings in the set for the current string.
And 103, generating a plurality of character strings to be displayed according to the plurality of segmentation character strings and the corresponding head information thereof.
Has the advantages that: according to the bar code processing method, a character string to be processed is divided into a plurality of divided character strings, and the divided character strings do not exceed a set length; generating header information for each of the plurality of divided character strings, the header information being used to indicate sequence information of the divided character strings; and generating a plurality of character strings to be displayed according to the plurality of segmentation character strings and the corresponding head information thereof. By the bar code processing scheme, the long character string can be divided into the short character strings, and the sequence information of each short character string in the long character string is given, so that the long character string can be transmitted without being limited by the length of the long character string.
Further, the barcode processing method according to the embodiment of the present application, after generating a plurality of character strings to be displayed, further includes: and respectively generating bar codes for the plurality of character strings to be displayed and displaying the bar codes on a screen.
In the barcode processing scheme, the function of processing the character string to be processed to generate the plurality of character strings to be displayed and the function of generating the barcodes for the plurality of character strings to be displayed respectively on the screen can be completed by different entities, but are not limited to be completed by one device, and under the condition that one device is completed, the mobile terminal can complete the operation of processing the character string to be processed to generate the plurality of character strings to be displayed and also complete the operation of generating the barcodes for the plurality of character strings to be displayed respectively on the screen. Under the condition that the two devices are completed, the server can complete the operation of processing the character strings to be processed to generate a plurality of character strings to be displayed, the character strings to be displayed are sent to the mobile terminal, and then the mobile terminal completes the operation of respectively generating the plurality of character strings to be displayed into the bar codes to be displayed on the screen.
Further, the barcode processing method of the embodiment of the present application, generating barcodes for the plurality of to-be-displayed character strings respectively and displaying the barcodes on a screen includes: and dynamically and sequentially displaying the bar codes generated by the character strings to be displayed on a screen at a set frequency.
The characteristic that the screen of the mobile terminal can be refreshed dynamically is utilized, and the mobile terminal can refresh a plurality of bar codes dynamically to read the bar codes to the reading equipment under the condition that a user does not sense the bar codes. In specific implementation, a plurality of bar codes can be directly displayed on a screen and read by reading equipment respectively; or, the display of the plurality of barcodes may be performed by manually switching the display of the plurality of barcodes by the user, and the implementation is not limited to the method of dynamically and sequentially displaying the barcodes generated by the plurality of character strings to be displayed on the screen at a set frequency.
Fig. 2 illustrates a barcode reading method in an embodiment of the present application, and as shown in the figure, includes:
step 201, reading a plurality of bar codes;
step 202, determining sequence information of a plurality of barcodes according to the header information of the plurality of barcodes;
and 203, combining the message body information of the plurality of barcodes according to the sequence information of the plurality of barcodes to determine the character strings carried by the plurality of barcodes.
In view of the above situation that the character string generation and the barcode display device are separated, the present application also provides a barcode display method, as shown in fig. 3, including the following steps:
step 301, receiving a plurality of character strings to be displayed;
and 302, dynamically and sequentially displaying the bar codes generated by the plurality of character strings to be displayed on a screen at a set frequency.
In order to facilitate the practice of the present application, the following examples are given.
The first embodiment is as follows:
in the first embodiment, a barcode processing method is described with an example of a case where a character string is generated and a barcode display device is separated, and as shown in fig. 4, the barcode processing method includes:
step 401, a server divides a character string to be processed into a plurality of divided character strings, wherein the divided character strings do not exceed a set length;
the character string is divided to be not more than the set length so as to generate the bar code subsequently, the capacity of the bar code is not more than, at present, the most practical mode is that the maximum length is not more than 30 bits, and no less than 16 bits are recommended.
Step 402, the server respectively generates head information for a plurality of segmentation character strings, wherein the head information is used for representing sequence information of the segmentation character strings;
the header information may be in two ways:
in a first mode, the fixed length of the header information is 2 bits, and for convenience of description, the 2-bit header information is represented by "TX", where one digit X represents the position of the current character string in the plurality of character strings to be displayed, and another digit T represents the total number of the plurality of character strings to be displayed. Because the bar code has a plurality of code systems, some code systems only support pure numbers and do not support letters, wherein the range of X and T is 1-9 (for code systems which do not support letters, the total number is 9) or 1-9 + A-Z (the total number is 35 by adding 26 letters to 9 numbers). Such an acquisition may be up to 9 (for code systems that do not support letters) or 35, for a total of up to 30 x 9-270 or 30 x 35-1050 characters.
In a second mode, the length of the header information is variable, and the first digit is 0 and is used for indicating that the length of the header information is variable; the second digit is N, the length of the head information is (N x 2+2), and the range of N is 2 to 9; the header information also comprises N-bit numbers which represent the positions of the current character strings in the character strings to be displayed, and the N-bit numbers represent the total number of the character strings to be displayed. For convenience of explanation, the header information is represented by "0 ntt.. txx.. X", where "TT... T" is an N-bit number indicating the total number of the plurality of character strings to be displayed, and "XX... X" is an N-bit number indicating the position of the current character string in the plurality of character strings to be displayed. Wherein, the range of X and T is 1-9 (the total number is 9 for the code system which does not support letters) or 1-9 + A-Z (the total number is 35 for 9 numbers plus 26 letters). The number of the bar codes can be greatly expanded and the information quantity of the bar codes can be increased by the mode that the length of the head information is variable.
Since the range of the first digit T is 1 to 9 or 1 to 9+ a to Z, and 0 is not possible, the first digit T of the first mode is 0, which indicates that the header information length is variable, so that the first mode and the second mode can be simultaneously used and the reading device can distinguish which mode is specifically used by determining whether the first digit is 0, and the first mode and the second mode can be separately applied.
Step 403, the server generates a plurality of character strings to be displayed according to the plurality of segmentation character strings and the corresponding header information thereof;
taking the fixed header information in the first method in step 102 as an example, a specific example "43 abcd.", where "43" is a header, the following "abcd." represents the content of the character string that needs to be transmitted, the first digit T is 4, which indicates that this is a group of 4 character strings in total, and the second digit X is 3, which indicates that this character string is currently the 3 rd character string in the sequence of the group of character strings.
Taking the variable-length header information in the second method in step 102 as an example, a specific example "021508 abcd.", where "0" indicates that this is the second encoding method, the last "2", i.e., "N", indicates that the first 2 bits of the last 4 bits are the total number of "TT", the last 2 bits are the "XX" serial number, i.e., "TT" is "15", indicates that this is a total 15 strings in the group, and "XX" is "08", indicates that this string is currently the 8 th string in the string sequence in the group, and the last "abcd." indicates that this string content needs to be transmitted.
Step 404, the server sends a plurality of character strings to be displayed to the mobile terminal;
and 405, dynamically and sequentially displaying the bar codes generated by the plurality of character strings to be displayed on a screen by the mobile terminal according to a set frequency.
Example two
The barcode reading method according to the second embodiment, as shown in fig. 5, includes:
step 501, sequentially reading a plurality of bar codes dynamically displayed on a screen at a set frequency;
step 502, determining sequence information of a plurality of barcodes according to the header information of the plurality of barcodes;
when reading the sequence information of a plurality of barcodes, the reading mode can be determined according to which header information is specifically adopted in the first embodiment.
If the first mode is adopted separately in the first embodiment, in this step, one digit X represents the position of the current character string in the character strings to be displayed, and the other digit T represents the total number of the character strings to be displayed, according to the first 2 digits of information of the bar codes.
If the first mode is adopted alone or the first mode and the second mode can be adopted simultaneously in the first embodiment, in this step, it is determined that the header information length is variable according to the first digit of the plurality of barcodes being 0; determining the length of the head information to be (N x 2+2) according to the second digit of the plurality of barcodes to be N, wherein the range of N is 2 to 9;
determining XX... X of the position of the current character string in the character strings to be displayed according to the number of N bits in the header information, wherein the N bits represent the position of the current character string in the character strings to be displayed;
determining TT... T total number of the character strings to be displayed according to the number of N bits in the header information representing the total number of the character strings to be displayed.
Step 503, combining the message body information of the plurality of barcodes according to the sequence information of the plurality of barcodes, and determining the character strings carried by the plurality of barcodes.
The following is a description of a specific example.
In this example, the character string to be processed is:
“1234567890ABCDEFGHIJ1234567890ABCDEFGHIJ1234567890ABCDEFGHIJ1234567890”
the character string to be processed has 70 characters in total; in this example, a length of 30 is set, and the character string to be processed is divided into three character strings of 30+30+ 10:
segmentation of character string 1: "1234567890 ABCDEFGHIJ 1234567890"
Segmentation of character string 2: "ABCDEFGHIJ 1234567890 ABCDEFGHIJ"
Segmentation of character string 3: "1234567890"
Respectively generating head information for the three segmentation character strings by adopting a first mode:
the header information of the divided character string 1 is "31", the header information of the divided character string 2 is "32", and the header information of the divided character string 3 is "33".
Generating a plurality of character strings to be displayed according to the three segmentation character strings and the corresponding head information as follows:
character string to be displayed 1: "311234567890 ABCDEFGHIJ 1234567890"
Character string to be displayed 2: "32 ABCDEFGHIJ1234567890 ABCDEFGHIJ"
Character string to be displayed 3: "331234567890"
And dynamically and sequentially displaying the bar codes generated by the character strings to be displayed on a screen at a set frequency. The reading end reads the first digit as "3", and knows that fixed head information is adopted, namely the group has 3 character strings in total, and the serial numbers are 1, 2 and 3 respectively, so that the code scanning equipment acquires continuous 3 bar code information and can analyze the information to restore the information into the original character string of "1234567890 ABCDEFGHIJ1234567890ABCDEFGHIJ 1234567890;
if each bar code is presented for a time period of 0.2-0.5 seconds, then it now takes about 0.6-1.5 seconds to collect such a string.
The advantage of this coding method is that even if the collecting sequence of the code scanning device is not according to the character string dividing sequence (as in the above example: starting from 2: 3, 1, 2), the original character string can be successfully restored after the correction (sorting, duplication removal, omission checking, etc.) according to the serial number and the total number of the head, and only the mobile phone needs to circularly update and display all the character strings according to the fixed frequency.
Based on the same inventive concept, the embodiment of the present application further provides a barcode processing apparatus and a barcode reading apparatus, and as the principle of solving the problem of these apparatuses is similar to that of a barcode processing method and a barcode reading method, the implementation of these apparatuses may refer to the implementation of the method, and repeated details are not repeated.
As shown in fig. 6, the barcode processing apparatus according to the embodiment of the present application may include:
the segmentation module 601 is configured to segment a to-be-processed character string into a plurality of segmented character strings, where the segmented character strings do not exceed a set length;
a header information generating module 602, configured to generate header information for each of the plurality of segmented character strings, where the header information is used to represent sequence information of the segmented character strings;
a to-be-displayed character generating module 603, configured to generate a plurality of to-be-displayed character strings according to the plurality of segmentation character strings and corresponding header information thereof.
Further, the barcode processing apparatus according to the embodiment of the present application may also include, as shown in fig. 7, a barcode processing module 702,
a barcode processing module 702, configured to generate barcodes for the multiple character strings to be displayed, respectively, so as to display the barcodes on the screen 701.
The screen 701 is used for displaying a barcode, and may be included in the barcode processing apparatus according to the embodiment of the present application or may be other than the barcode processing apparatus according to the embodiment of the present application.
Further, the barcode processing module 702 is further configured to output barcodes generated by a plurality of character strings to be displayed to the screen 701 in a set frequency sequence.
As shown in fig. 8, the barcode reading apparatus in the embodiment of the present application includes:
a barcode reading module 801 for reading a plurality of barcodes;
a header information determining module 802, configured to determine sequence information of the multiple barcodes according to header information of the multiple barcodes;
and the combining module 803 is configured to combine the message body information of the multiple barcodes according to the sequence information of the multiple barcodes, so as to determine a character string carried by the multiple barcodes.
As shown in fig. 9, the barcode display apparatus in the embodiment of the present application includes:
a receiving module 901, configured to receive a plurality of character strings to be displayed;
a display module 902, configured to dynamically and sequentially display, on a screen, barcodes generated by the multiple character strings to be displayed received by the receiving module 901 at a set frequency.
For convenience of description, each part of the above-described apparatus is separately described as being functionally divided into various modules or units. Of course, the functionality of the various modules or units may be implemented in the same one or more pieces of software or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.