WO2017194024A1 - Method and apparatus for generating barcode pattern - Google Patents

Method and apparatus for generating barcode pattern Download PDF

Info

Publication number
WO2017194024A1
WO2017194024A1 PCT/CN2017/084292 CN2017084292W WO2017194024A1 WO 2017194024 A1 WO2017194024 A1 WO 2017194024A1 CN 2017084292 W CN2017084292 W CN 2017084292W WO 2017194024 A1 WO2017194024 A1 WO 2017194024A1
Authority
WO
WIPO (PCT)
Prior art keywords
barcode
plaintext
wearable device
image
generation instruction
Prior art date
Application number
PCT/CN2017/084292
Other languages
French (fr)
Chinese (zh)
Inventor
王强
申子熹
刘文清
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2017194024A1 publication Critical patent/WO2017194024A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06046Constructional details

Definitions

  • the present application relates to the field of computer technology, and in particular, to a method and apparatus for generating a barcode image.
  • a barcode is a graphical identifier that is used to express a set of information by arranging a plurality of black bars and white bars according to certain coding rules. Barcodes can be used to identify a variety of information such as product names, book classification numbers, and mail numbers. Therefore, they are widely used in many fields such as commodity circulation, book management, postal management, and banking systems.
  • the process of generating a barcode is generally based on an android (Android)/windows (Windows operating system) system, calling the existing graphics processing function in the android/windows system, using the bar code plaintext as a function input value, using the graphics processing function to process
  • the resulting barcode can then be obtained, wherein the barcode plaintext can be a string for generating a barcode image, which is not encrypted.
  • the graphics processing function in the android/windows system is a packaged function set, and has a plurality of graphics drawing functions including drawing a barcode. Therefore, the graphics processing function has a large amount of data and occupies more storage space. It is not conducive to use in a device with a small storage space such as a wearable device such as a wristband.
  • an embodiment of the present application provides a method and apparatus for generating a barcode image.
  • the technical solution is as follows:
  • a method of generating a barcode image comprising:
  • a barcode image is drawn based on the barcode value, and the barcode image is displayed.
  • the method is performed by the wearable device through a firmware code, where the encoding rule and the correspondence between the barcode type and the encoding rule are stored.
  • the method further includes:
  • Transcoding and converting the barcode plaintext to obtain a barcode value including:
  • the barcode plaintext is encoded and converted according to the determined encoding rule to obtain a barcode value.
  • the barcode image comprises a plurality of lines.
  • the drawing the barcode image according to the barcode value comprises:
  • a barcode image is drawn based on the starting point coordinates, the ending point coordinates, and the width of the line.
  • the method further includes:
  • the barcode plaintext is stored in the wearable device corresponding to the barcode image.
  • the barcode generating instruction is a first barcode generating instruction
  • the barcode plaintext corresponding to the barcode generating instruction is a first barcode plaintext
  • the method further includes:
  • the stored barcode image is displayed in response to the second barcode plaintext being the same as the first barcode plaintext.
  • the barcode is a one-dimensional barcode or a two-dimensional barcode.
  • an apparatus for generating a barcode image comprising:
  • An obtaining module configured to receive a barcode generation instruction, and obtain a barcode plaintext corresponding to the barcode generation instruction
  • a conversion module configured to encode and convert the barcode plaintext to obtain a barcode value
  • a drawing module for drawing a barcode image based on the barcode value.
  • the device is implemented by the wearable device through a firmware code, wherein the wearable device stores an encoding rule and a correspondence between the barcode type and the encoding rule.
  • the device further includes:
  • a determining module configured to determine a barcode type corresponding to the plaintext of the barcode
  • the conversion module is configured to:
  • the barcode plaintext is encoded and converted according to the determined encoding rule to obtain a barcode value.
  • the barcode image comprises a plurality of lines.
  • the drawing module is configured to:
  • a barcode image is drawn based on the starting point coordinates, the ending point coordinates, and the width of the line.
  • the device further includes:
  • a storage module configured to store, in response to receiving the barcode image storage instruction, the barcode plaintext and the barcode image in the wearable device.
  • the barcode generating instruction is a first barcode generating instruction
  • the barcode plaintext corresponding to the barcode generating instruction is a first barcode plaintext
  • the acquiring module is further configured to:
  • the display unit of the notification wearable device displays the stored barcode image.
  • the barcode is a one-dimensional barcode or a two-dimensional barcode.
  • an apparatus for generating a barcode image comprising:
  • One or more processors and
  • a memory storing program instructions that, when executed by the processor, configure the apparatus to perform the method of generating a barcode image of the present application.
  • a computer readable storage medium storing program instructions that, when executed by a processor of a computing device, configure the device to perform the method of generating a barcode image of the present application.
  • the wearable device has a firmware code (the firmware code may be a firmware code dedicated to generating a barcode), and the firmware code wearing device may receive the barcode generation instruction to obtain the barcode plaintext corresponding to the barcode generation instruction, and the barcode is The plaintext performs transcoding, obtains a barcode value, draws a barcode image according to the barcode value, and displays a barcode image.
  • the firmware code dedicated to generating the barcode only needs to include the code for performing the above processing, so the amount of data of the firmware code is small, so that the storage space of the wearable device can be reduced.
  • FIG. 1 is a flowchart of a method for generating a barcode image according to an embodiment of the present application
  • FIG. 2 is a schematic diagram of a step of drawing a barcode image according to an embodiment of the present application
  • FIG. 3 is a schematic structural diagram of an apparatus for generating a barcode image according to an embodiment of the present application
  • FIG. 4 is a schematic structural diagram of a wearable device according to an embodiment of the present application.
  • a barcode which is referred to as a barcode
  • a barcode may include a 1D barcode and a 2D barcode.
  • the wearable device may be a wearable device having a barcode generating function, such as a smart bracelet, a smart pen, a Bluetooth headset, or the like.
  • the wearable device has a firmware code dedicated to generating a barcode, for example, a firmware code dedicated to generating a barcode can be integrated in its system program.
  • the wearable device may include a short-range communication component for performing information interaction with other devices, and the short-range communication component may be an NFC (Near Field Communication) communication component or a Bluetooth communication component, and the wearable device may include a screen. Display the information that needs to be displayed during the process of generating the barcode, such as the original barcode plaintext, barcode image, and so on.
  • the wearable device may include an input unit, such as a button, a touch screen, etc., and the user may perform an input operation that may be involved in generating a barcode on the wearable device through the input unit; the wearable device may include a processor, and the processor may be used to perform the wearable device.
  • the wearable device may further include a memory that can be used to record or store data generated by the wearable device in the process of generating the barcode and receive data from other devices.
  • the wearable device can also include components such as sensors, output units, and power supplies.
  • the wearable device is taken as an example of a smart wristband, and a detailed description of the solution is performed. Other situations are similar, and the present embodiment is not described in detail.
  • the process flow shown in FIG. 1 will be described in detail below with reference to specific embodiments.
  • the process flow shown in FIG. 1 can be performed by a wearable device having a firmware code.
  • Step 101 Receive a barcode generation instruction, and obtain a barcode plaintext corresponding to the barcode generation instruction.
  • a firmware code dedicated to generating a barcode can be integrated into the system program of the wearable device, that is, it can be understood that the wearable device adopts an embedded platform and performs related processing through the embedded system.
  • the embedded system is a "special computer system that is completely embedded in the controlled device and designed for a specific application". Unlike a general-purpose computer system such as a personal computer, the embedded system is different. Commonly implemented are predefined tasks with specific requirements, such as the task of generating barcodes. Because the embedded system is only for a specific task, the designer can optimize it to reduce the size and cost.
  • an embedded system can be understood as a control program for an embedded processor control board stored in ROM.
  • the core of an embedded system consists of one or more microprocessors or microcontrollers that are pre-programmed to perform a few tasks.
  • the software on an embedded system is usually temporarily unchanged; so it can be called "firmware.”
  • the bar code plaintext may be a string of characters used to generate a barcode image, unencrypted (usually also unencoded), and the characters herein may include at least one of letters, numbers, and symbols. Since the bar code plaintext has not been encoded and converted, it is also referred to herein as the original bar code plaintext.
  • the barcode generation button on the wearable device can be clicked, and the barcode generation button can be a physical button or a virtual button. Therefore, the wearable device can be triggered to receive the barcode generation instruction, and at the same time, obtain the original barcode plaintext corresponding to the barcode generation instruction.
  • the original barcode is the plaintext corresponding to the payment account, and the solution scenario is the mobile payment as an example.
  • the wearable device receives the barcode generation request sent by the terminal, and the barcode generation request carries the original barcode plaintext (and/or the corresponding barcode generation instruction).
  • the user may choose to use the payment account to make payment.
  • the user can open the payment software installed on the terminal and click the clear text generation button, and the terminal can generate the payment class.
  • the user's account of the software corresponds to the original bar code.
  • the terminal can establish a connection with the wearable device through NFC, Bluetooth, and other short-range communication software.
  • the terminal can send the original bar code to the wearable device, and the wearable device can obtain the original bar code plaintext.
  • the wearable device automatically generates the original barcode plaintext according to the pre-stored plaintext generation algorithm.
  • the payment device may be installed in the wearable device, and after purchasing an item, the user may open the payment software installed on the wearable device, and click on the clear text.
  • the button is generated, and the wearable device can generate the original barcode plaintext corresponding to the user account of the payment software according to the pre-stored plaintext generation algorithm.
  • the wearable device does not need to install the payment software, and only needs to embed the plaintext generation algorithm of the payment software.
  • the wearable device can obtain the original barcode plaintext corresponding to the user account according to the plaintext generation algorithm.
  • the original bar code plaintext for the payment class may be periodically changed, that is, each original bar code plaintext has a certain validity period, and after the expiration date, a new original bar code plaintext needs to be regenerated.
  • Step 102 Perform coding conversion on the barcode plaintext to obtain a barcode value.
  • an encoding rule for barcode conversion may be pre-stored, and the wearable device may encode and convert the obtained original barcode plaintext according to the encoding rule, thereby obtaining a barcode image for drawing. Bar code value.
  • the barcode type of the original barcode clear text is determined before the step 102, and the corresponding processing may be as follows: the wearable device determines the barcode type corresponding to the original barcode plaintext (hereinafter also referred to as Make the first barcode type).
  • the wearable device After obtaining the original barcode clear text, the wearable device determines the first barcode type corresponding to the original barcode plaintext according to the plaintext format (such as the character length, the character type, and the identifier character) of the original barcode plaintext.
  • the type information of the original bar code plaintext may be recorded at the same time when the original bar code plaintext is generated, and the wearable device may directly determine the first bar code type corresponding to the original bar code plaintext according to the type information.
  • the process of step 102 may be as follows: the correspondence between the bar code type and the encoding rule stored in the firmware code (or in the memory of the wearable device) pre-stored by the wearable device And determining an encoding rule corresponding to the first barcode type; encoding and converting the original barcode plaintext according to the encoding rule corresponding to the first barcode type, to obtain a barcode value.
  • the corresponding relationship between the barcode type and the encoding rule may be stored in the firmware code in advance, and the barcode value corresponding to different plaintext characters in each barcode type is recorded in the correspondence relationship.
  • Table 1 is exemplary. A correspondence table between Code128 and bar code values is given. After the wearable device determines the first barcode type corresponding to the plain text of the original barcode, it can be on the The coding rule corresponding to the first barcode type is determined in the correspondence relationship. Then, the original bar code plaintext can be code-converted according to the coding rule corresponding to the first bar code type, thereby obtaining a corresponding bar code value.
  • the code 128C code is taken as an example here for description.
  • Code128C encoding includes start field, data field, check field and end field.
  • the starting field of Code128C is unified as “Start C” corresponding to ID105 in Table 1.
  • the field is used to indicate the original bar code plaintext of the user account.
  • the original bar code plaintext of Code128C is generally a numeric string code of even length. Each two digits is a bit of data, and the check field is calculated by the start field and the data field.
  • check field (ID value corresponding to the start field + sequence number of each data of the data field ⁇ data value per bit of the data field) % 103, where "%103" is taken for 103
  • the end field is unified to "Stop" corresponding to the ID 106 in Table 1.
  • the original bar code plain text is 95270078 as an example
  • the ID corresponding to the start field is 105
  • the first bit data is 95
  • the second bit data is 27, the third bit data is 0, and the fourth bit data is 78.
  • Step 103 drawing a barcode image according to the barcode value, and displaying the barcode image.
  • the wearable device may draw the barcode value into a barcode image by using the firmware code. Further, since the barcode value only includes two characters, two different colors may be selected respectively.
  • the line ie, the bar code line
  • the process of drawing the barcode image in step 103 may include: determining a starting point coordinate and an ending point coordinate of each barcode line; determining a spacing of each barcode line according to a screen size of the wearing device and a number of bits of the barcode value. (ie, the width of the bar code line); according to the starting point coordinates, the end point coordinates and the spacing of each bar code line, each bar code character in the bar code value is drawn into a corresponding bar code line to generate a barcode image.
  • the wearer of the wearable device can embed the following code in the firmware code of the wearable device so that the wearable device can complete the corresponding process of drawing the barcode image.
  • the start point coordinate and the end point coordinate of each bar code line may be determined first, and here, the XY plane coordinates may be considered, and each bar code line may be determined.
  • the production personnel can determine the spacing of each bar code line according to the screen size of the wearable device and the number of bits of the bar code value, and the spacing of each bar code line can be regarded as the width of each bar code line.
  • the wearable device can sequentially draw each bar code character of the bar code value into a corresponding bar code line according to the starting point coordinates, the end point coordinates and the spacing of each bar code line determined above, so that the barcode image can be generated.
  • Figure 2 shows a schematic diagram of a simple drawing process.
  • the above code for drawing a barcode image can be as follows:
  • the wearable device can be selectively stored, and the corresponding processing can be as follows: when receiving the barcode image storage instruction, storing the original barcode plaintext and the barcode image in the wearable Inside the device.
  • the wearable device draws the barcode image according to the original barcode
  • the storage button on the wearable device can be clicked, and the wearable device can receive the barcode image storage.
  • the corresponding processing may be as follows: when the wearable device receives the barcode generation instruction corresponding to the original barcode plaintext again, if the wearable device stores the original barcode plaintext The corresponding barcode image displays the barcode image.
  • the original bar code plaintext may be obtained, and it may be determined whether the original bar code plaintext is stored locally. Barcode image. If the wearable device stores the barcode image corresponding to the plain text of the original barcode, the stored barcode image may be directly displayed. If the wearable device does not store the barcode image corresponding to the original barcode plaintext, the steps 102 and 103 may be performed based on the original barcode plaintext. deal with.
  • the system program of the wearable device is integrated with a firmware code for generating a barcode
  • the wearable device receives the barcode generation instruction, and obtains the original barcode plaintext corresponding to the barcode generation instruction, and the wearable device according to the code pre-stored in the firmware code.
  • the rule encodes and converts the original barcode plaintext to obtain a barcode value
  • the wearable device draws the barcode value into a barcode image through the firmware code, and displays the barcode image.
  • the firmware code dedicated to generating the barcode has a smaller amount of data and occupies less storage space, so that a device with a smaller storage space such as a wearable device can integrate the firmware code in the system program to implement the embedded platform. Processing of barcode images.
  • the embodiment of the present application further provides an apparatus for generating a barcode image.
  • the apparatus includes:
  • the obtaining module 301 is configured to receive a barcode generating instruction, and obtain a barcode plaintext corresponding to the barcode generating instruction;
  • the conversion module 302 is configured to perform coding and conversion on the barcode plaintext to obtain a barcode value.
  • the drawing module 303 is configured to draw a barcode image according to the barcode value.
  • the wearable device stores an encoding rule and a correspondence between the barcode type and the encoding rule.
  • the device further includes a display module, configured to display the barcode image.
  • the device further includes:
  • a determining module configured to determine a barcode type corresponding to the plaintext of the barcode
  • the conversion module is configured to:
  • the drawing module is configured to:
  • a barcode image is drawn based on the starting point coordinates, the ending point coordinates, and the width of the line.
  • the device further includes:
  • a storage module configured to store the barcode plaintext and the barcode image in the wearable device when receiving the barcode image storage instruction.
  • the device further includes:
  • a display module configured to display the barcode image if the wearable device stores the barcode image corresponding to the plaintext of the original barcode when the wearable device receives the barcode generation instruction corresponding to the plaintext of the original barcode.
  • the foregoing barcode generation instruction is a first barcode generation instruction
  • the barcode plaintext corresponding to the barcode generation instruction is a first barcode plaintext
  • the obtaining module is further configured to:
  • the display unit of the notification wearable device displays the stored barcode image.
  • the system program of the wearable device is integrated with a firmware code for generating a barcode
  • the wearable device receives the barcode generation instruction, and obtains the original barcode plaintext corresponding to the barcode generation instruction, and the wearable device according to the code pre-stored in the firmware code.
  • the rule encodes and converts the original barcode plaintext to obtain a barcode value
  • the wearable device draws the barcode value into a barcode image through the firmware code, and displays the barcode image. In this way, it is dedicated to generating barcodes.
  • the firmware code only needs to include the code to complete the above processing, so the amount of data of the firmware code is small, so that the storage space of the wearable device can be reduced.
  • the apparatus for generating a barcode image in the foregoing embodiment is only illustrated by the division of each functional module, and in actual application, the function may be allocated by different functional modules as needed.
  • the internal structure of the device is divided into different functional modules to perform all or part of the functions described above.
  • the device for generating a barcode image provided by the above embodiment is the same as the method for generating a barcode image. The specific implementation process is described in detail in the method embodiment, and details are not described herein again.
  • FIG. 4 is a schematic structural diagram of a wearable device according to an exemplary embodiment.
  • the wearable device can be used to implement the method of generating a barcode image provided in the above embodiments.
  • the wearable device 400 can include an RF (Radio Frequency) circuit 110, a memory 120 including one or more computer readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, and a WiFi (wireless fidelity,
  • the Wireless Fidelity module 170 includes a processor 180 having one or more processing cores, and a power supply 190 and the like.
  • the RF circuit 110 can be used for transmitting and receiving information or during a call, and receiving and transmitting signals. Specifically, after receiving downlink information of the base station, the downlink information is processed by one or more processors 180. In addition, the data related to the uplink is sent to the base station. .
  • the RF circuit 110 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier). , duplexer, etc.
  • RF circuitry 110 can also communicate with the network and other devices via wireless communication.
  • the wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code). Division Multiple Access (CDMA), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (Short Messaging Service), and the like.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • e-mail Short Messaging Service
  • the memory 120 can be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by running software programs and modules stored in the memory 120.
  • the memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to Data created by the use of the wearable device 400 (such as audio data, phone book, etc.), and the like.
  • memory 120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 120 may also include a memory controller to provide access to memory 120 by processor 180 and input unit 130.
  • the input unit 130 can be configured to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
  • input unit 130 can include touch-sensitive surface 131 as well as other input devices 132.
  • Touch-sensitive surface 131 also referred to as a touch display or trackpad, can collect touch operations on or near the user (such as a user using a finger, stylus, etc., on any suitable object or accessory on touch-sensitive surface 131 or The operation near the touch-sensitive surface 131) and driving the corresponding connecting device according to a preset program.
  • the touch-sensitive surface 131 can include two portions of a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
  • the processor 180 is provided and can receive commands from the processor 180 and execute them.
  • the touch-sensitive surface 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 130 can also include other input devices 132.
  • other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
  • the display unit 140 can be used to display information input by the user or information provided to the user. And various graphical user interfaces of the wearable device 400, these graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof.
  • the display unit 140 may include a display panel 141.
  • the display panel 141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like.
  • touch-sensitive surface 131 may cover the display panel 141, and when the touch-sensitive surface 131 detects a touch operation thereon or nearby, it is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 according to the touch event The type provides a corresponding visual output on display panel 141.
  • touch-sensitive surface 131 and display panel 141 are implemented as two separate components to implement input and input functions, in some embodiments, touch-sensitive surface 131 can be integrated with display panel 141 for input. And output function.
  • Wearable device 400 can also include at least one type of sensor 150, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may close the display panel 141 when the wearable device 400 moves to the ear. And / or backlight.
  • the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity.
  • the wearable device 400 can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, here No longer.
  • the audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the wearable device 400.
  • the audio circuit 160 can transmit the converted electrical data of the received audio data to the speaker 161 for conversion to the sound signal output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal by the audio circuit 160. After receiving, it is converted into audio data, and then processed by the audio data output processor 180, transmitted to the, for example, another wearable device via the RF circuit 110, or outputted to the memory 120 for further processing.
  • the audio circuit 160 may also include an earbud jack to provide communication of the peripheral earphones with the wearable device 400.
  • WiFi is a short-range wireless transmission technology
  • the wearable device 400 passes through the WiFi module 170. It can help users send and receive emails, browse web pages and access streaming media, etc. It provides users with wireless broadband Internet access.
  • FIG. 4 shows the WiFi module 170, it can be understood that it does not belong to the necessary configuration of the wearable device 400, and may be omitted as needed within the scope of not changing the essence of the application.
  • the processor 180 is the control center of the wearable device 400, connecting various portions of the entire handset with various interfaces and lines, by running or executing software programs and/or modules stored in the memory 120, and recalling data stored in the memory 120.
  • the various functions and processing data of the wearable device 400 are executed to perform overall monitoring of the mobile phone.
  • the processor 180 may include one or more processing cores; preferably, the processor 180 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like.
  • the modem processor primarily handles wireless communications. It can be understood that the above modem processor may not be integrated into the processor 180.
  • the wearable device 400 also includes a power source 190 (such as a battery) that supplies power to the various components.
  • a power source 190 such as a battery
  • the power source can be logically coupled to the processor 180 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
  • Power supply 190 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
  • the wearable device 400 may further include a camera, a Bluetooth module, and the like, and details are not described herein again.
  • the display unit of the wearable device 400 is a touch screen display.
  • Wearable device 400 also includes one or more programs, one or more of which are stored in a memory and configured to be executed by a processor, the one or more programs including a method for performing a method of generating a barcode image
  • the method of generating a barcode image includes:
  • a barcode image is drawn based on the barcode value, and the barcode image is displayed.
  • the wearable device stores an encoding rule, and a correspondence between the barcode type and the encoding rule.
  • the method further includes:
  • Transcoding and transcoding the barcode plaintext to obtain a barcode value including:
  • the barcode image is drawn according to the barcode value, including:
  • a barcode image is drawn based on the starting point coordinates, the ending point coordinates, and the width of the line.
  • the method further includes:
  • the barcode plaintext is stored in the wearable device corresponding to the barcode image.
  • the method further includes:
  • the wearable device receives the barcode generating instruction corresponding to the plaintext of the original barcode again, if the wearable device stores the barcode image corresponding to the original barcode plaintext, the barcode image is displayed.
  • the bar code generation instruction is a first bar code generation instruction
  • the bar code plaintext corresponding to the bar code generation instruction is a first bar code plaintext
  • the method further includes:
  • the stored barcode image is displayed in response to the second barcode plaintext being the same as the first barcode plaintext.
  • the optional barcode is a one-dimensional barcode or a two-dimensional barcode.
  • the system program of the wearable device is integrated with a firmware code for generating a barcode, and the wearable device receives the barcode generation instruction, and obtains the original barcode plaintext corresponding to the barcode generation instruction, and the wearable device according to the code pre-stored in the firmware code.
  • original The barcode plaintext is encoded and converted to obtain a barcode value, and the wearable device draws the barcode value into a barcode image through the firmware code, and displays the barcode image.
  • the firmware code dedicated to generating the barcode only needs to include the code for performing the above processing, so the amount of data of the firmware code is small, so that the storage space of the wearable device can be reduced.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The present application relates to the technical field of computers. Disclosed are a method and apparatus for generating a barcode pattern. The method can be executed by a wearable device by means of its firmware code and comprises: receiving a barcode generation instruction, and obtaining a barcode plaintext corresponding to the barcode generation instruction; transcoding the barcode plaintext to obtain a barcode value; and drawing a barcode pattern according to the barcode value and displaying the barcode pattern. By means of the present application, a device similar to a wearable device having a small storage space can implement the generation of a barcode pattern on an embedded platform by integrating the firmware code into a system program.

Description

一种生成条形码图像的方法和装置Method and device for generating barcode image
本申请要求于2016年5月13日提交中国专利局,申请号为201610321596.4,发明名称为“一种生成条形码图像的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201610321596.4, entitled "A Method and Apparatus for Generating a Barcode Image", which is incorporated herein by reference. In the application.
技术领域Technical field
本申请涉及计算机技术领域,特别涉及一种生成条形码图像的方法和装置。The present application relates to the field of computer technology, and in particular, to a method and apparatus for generating a barcode image.
背景技术Background technique
条形码是将多个黑条和白条,按照一定的编码规则排列,用以表达一组信息的图形标识符。条形码可以用于标识商品的商品名称、图书分类号、邮件编号等多种信息,因而在商品流通、图书管理、邮政管理、银行系统等许多领域都得到广泛的应用。A barcode is a graphical identifier that is used to express a set of information by arranging a plurality of black bars and white bars according to certain coding rules. Barcodes can be used to identify a variety of information such as product names, book classification numbers, and mail numbers. Therefore, they are widely used in many fields such as commodity circulation, book management, postal management, and banking systems.
生成条形码的处理一般是采用基于android(安卓)/windows(视窗操作系统)系统的平台,调用android/windows系统中现有的图形处理函数,将条码明文作为函数输入值,使用该图形处理函数处理后从而可以得到绘制好的条形码,其中,条码明文可以是用于生成条形码图像,未经加密的字符串。The process of generating a barcode is generally based on an android (Android)/windows (Windows operating system) system, calling the existing graphics processing function in the android/windows system, using the bar code plaintext as a function input value, using the graphics processing function to process The resulting barcode can then be obtained, wherein the barcode plaintext can be a string for generating a barcode image, which is not encrypted.
在实现本申请的过程中,申请人发现上述技术至少存在以下问题:In the process of implementing the present application, the applicant found that the above technology has at least the following problems:
android/windows系统中的图形处理函数为封装好的函数集合,具备包含绘制条形码在内的多种图形绘制的功能,因此该图形处理函数的数据量较大,占用的存储空间较多,这样,不利于在穿戴设备(如手环)这种存储空间较小的设备中使用。The graphics processing function in the android/windows system is a packaged function set, and has a plurality of graphics drawing functions including drawing a barcode. Therefore, the graphics processing function has a large amount of data and occupies more storage space. It is not conducive to use in a device with a small storage space such as a wearable device such as a wristband.
发明内容Summary of the invention
为了解决上述技术问题,本申请实施例提供一种生成条形码图像的方法和装置。所述技术方案如下: In order to solve the above technical problem, an embodiment of the present application provides a method and apparatus for generating a barcode image. The technical solution is as follows:
第一方面,提供了一种生成条形码图像的方法,所述方法包括:In a first aspect, a method of generating a barcode image is provided, the method comprising:
接收条形码生成指令,获取所述条形码生成指令对应的条形码明文;Receiving a barcode generation instruction, and acquiring a barcode plaintext corresponding to the barcode generation instruction;
对所述条形码明文进行编码转换,得到条形码值;Transcoding and converting the barcode plaintext to obtain a barcode value;
根据所述条形码值绘制条形码图像,并显示所述条形码图像。A barcode image is drawn based on the barcode value, and the barcode image is displayed.
可选的,该方法由穿戴设备通过其中的固件代码执行,所述穿戴设备中存储有编码规则以及条形码类型与编码规则的对应关系。Optionally, the method is performed by the wearable device through a firmware code, where the encoding rule and the correspondence between the barcode type and the encoding rule are stored.
可选的,所述方法还包括:Optionally, the method further includes:
确定所述条形码明文对应的条形码类型;Determining a barcode type corresponding to the plaintext of the barcode;
对所述条形码明文进行编码转换,得到条形码值,包括:Transcoding and converting the barcode plaintext to obtain a barcode value, including:
根据条形码类型与编码规则的对应关系,确定与所确定的条形码类型对应的编码规则;Determining an encoding rule corresponding to the determined barcode type according to a correspondence between the barcode type and the encoding rule;
根据所确定的编码规则,对所述条形码明文进行编码转换,得到条形码值。The barcode plaintext is encoded and converted according to the determined encoding rule to obtain a barcode value.
可选的,所述条形码图像包括多个线条。Optionally, the barcode image comprises a plurality of lines.
可选的,所述根据所述条形码值绘制条形码图像,包括:Optionally, the drawing the barcode image according to the barcode value comprises:
确定每个线条的起始点坐标和结束点坐标;Determine the starting point coordinates and ending point coordinates of each line;
根据所述穿戴设备的屏幕大小,以及所述条形码值的位数,确定每个线条的宽度;Determining a width of each line according to a screen size of the wearable device and a number of bits of the barcode value;
根据所述线条的起始点坐标、结束点坐标和宽度,绘制条形码图像。A barcode image is drawn based on the starting point coordinates, the ending point coordinates, and the width of the line.
可选的,所述方法还包括:Optionally, the method further includes:
响应于接收到条形码图像存储指令,将所述条形码明文与所述条形码图像对应存储在所述穿戴设备内。可选的,所述条形码生成指令是第一条形码生成指令,所述条形码生成指令对应的条形码明文是第一条形码明文,所述方法还包括:In response to receiving the barcode image storage instruction, the barcode plaintext is stored in the wearable device corresponding to the barcode image. Optionally, the barcode generating instruction is a first barcode generating instruction, and the barcode plaintext corresponding to the barcode generating instruction is a first barcode plaintext, and the method further includes:
接收第二条形码生成指令,Receiving a second barcode generation instruction,
获取所述第二条形码生成指令对应的第二条形码明文,Obtaining a second barcode plaintext corresponding to the second barcode generation instruction,
判断所述第二条形码明文是否与所述第一条形码明文相同,Determining whether the second barcode plaintext is the same as the first barcode plaintext,
响应于所述第二条形码明文与所述第一条形码明文相同,显示所述存储的条形码图像。 The stored barcode image is displayed in response to the second barcode plaintext being the same as the first barcode plaintext.
可选的,所述条形码是一维条形码或二维条形码。Optionally, the barcode is a one-dimensional barcode or a two-dimensional barcode.
第二方面,提供了一种生成条形码图像的装置,所述装置包括:In a second aspect, an apparatus for generating a barcode image is provided, the apparatus comprising:
获取模块,用于接收条形码生成指令,获取所述条形码生成指令对应的条形码明文;An obtaining module, configured to receive a barcode generation instruction, and obtain a barcode plaintext corresponding to the barcode generation instruction;
转换模块,用于对所述条形码明文进行编码转换,得到条形码值;a conversion module, configured to encode and convert the barcode plaintext to obtain a barcode value;
绘制模块,用于根据所述条形码值绘制条形码图像。A drawing module for drawing a barcode image based on the barcode value.
可选的,该装置由穿戴设备通过其中的固件代码实现,其中所述穿戴设备中存储有编码规则以及条形码类型与编码规则的对应关系。Optionally, the device is implemented by the wearable device through a firmware code, wherein the wearable device stores an encoding rule and a correspondence between the barcode type and the encoding rule.
可选的,所述装置还包括:Optionally, the device further includes:
确定模块,用于确定与所述条形码明文对应的条形码类型;a determining module, configured to determine a barcode type corresponding to the plaintext of the barcode;
所述转换模块,用于:The conversion module is configured to:
根据条形码类型与编码规则的对应关系,确定与所述确定的条形码类型对应的编码规则;Determining an encoding rule corresponding to the determined barcode type according to a correspondence between the barcode type and the encoding rule;
根据确定的编码规则,对所述条形码明文进行编码转换,得到条形码值。The barcode plaintext is encoded and converted according to the determined encoding rule to obtain a barcode value.
可选的,所述条形码图像包括多个线条。Optionally, the barcode image comprises a plurality of lines.
可选的,所述绘制模块,用于:Optionally, the drawing module is configured to:
确定每个线条的起始点坐标和结束点坐标;Determine the starting point coordinates and ending point coordinates of each line;
根据所述穿戴设备的屏幕大小,以及所述条形码值的位数,确定每个线条的宽度;Determining a width of each line according to a screen size of the wearable device and a number of bits of the barcode value;
根据所述线条的起始点坐标、结束点坐标和宽度,绘制条形码图像。A barcode image is drawn based on the starting point coordinates, the ending point coordinates, and the width of the line.
可选的,所述装置还包括:Optionally, the device further includes:
存储模块,用于响应于接收到条形码图像存储指令,将所述条形码明文与所述条形码图像对应存储在所述穿戴设备内。And a storage module, configured to store, in response to receiving the barcode image storage instruction, the barcode plaintext and the barcode image in the wearable device.
可选的,其中所述条形码生成指令是第一条形码生成指令,所述条形码生成指令对应的条形码明文是第一条形码明文,其中,所述获取模块还用于:Optionally, the barcode generating instruction is a first barcode generating instruction, and the barcode plaintext corresponding to the barcode generating instruction is a first barcode plaintext, wherein the acquiring module is further configured to:
接收第二条形码生成指令,Receiving a second barcode generation instruction,
获取所述第二条形码生成指令对应的第二条形码明文, Obtaining a second barcode plaintext corresponding to the second barcode generation instruction,
判断所述第二条形码明文是否与所述第一条形码明文相同,Determining whether the second barcode plaintext is the same as the first barcode plaintext,
响应于所述第二条形码明文与所述第一条形码明文相同,通知穿戴设备的显示单元显示所述存储的条形码图像。In response to the second barcode plaintext being the same as the first barcode plaintext, the display unit of the notification wearable device displays the stored barcode image.
可选的,所述条形码是一维条形码或二维条形码。Optionally, the barcode is a one-dimensional barcode or a two-dimensional barcode.
第三方面,提供了一种生成条形码图像的装置,包括:In a third aspect, an apparatus for generating a barcode image is provided, comprising:
一个或多个处理器,和One or more processors, and
存储器,所述存储器存储有程序指令,所述程序指令当由所述处理器执行时,配置所述装置执行本申请的生成条形码图像的方法。A memory storing program instructions that, when executed by the processor, configure the apparatus to perform the method of generating a barcode image of the present application.
第四方面,提供了一种计算机可读存储介质,存储有程序指令,所述程序指令当由计算装置的处理器执行时,配置所述装置执行本申请的生成条形码图像的方法。In a fourth aspect, a computer readable storage medium is provided, storing program instructions that, when executed by a processor of a computing device, configure the device to perform the method of generating a barcode image of the present application.
本申请实施例提供的技术方案带来的有益效果是:The beneficial effects brought by the technical solutions provided by the embodiments of the present application are:
本申请实施例中,穿戴设备中具有固件代码(该固件代码可以是专用于生成条形码的固件代码),通过执行固件代码穿戴设备可以接收条码生成指令,获取条码生成指令对应的条码明文,对条码明文进行编码转换,得到条码值,根据条码值绘制条形码图像,并显示条形码图像。这样,专用于生成条形码的固件代码只需要包括完成上述处理的代码,所以固件代码的数据量较小,从而可以减小穿戴式设备的存储空间占用。In the embodiment of the present application, the wearable device has a firmware code (the firmware code may be a firmware code dedicated to generating a barcode), and the firmware code wearing device may receive the barcode generation instruction to obtain the barcode plaintext corresponding to the barcode generation instruction, and the barcode is The plaintext performs transcoding, obtains a barcode value, draws a barcode image according to the barcode value, and displays a barcode image. Thus, the firmware code dedicated to generating the barcode only needs to include the code for performing the above processing, so the amount of data of the firmware code is small, so that the storage space of the wearable device can be reduced.
附图说明DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present application. Other drawings may also be obtained from those of ordinary skill in the art in light of the inventive work.
图1是本申请实施例提供的一种生成条形码图像的方法流程图;1 is a flowchart of a method for generating a barcode image according to an embodiment of the present application;
图2是本申请实施例提供的一种绘制条形码图像的步骤示意图;2 is a schematic diagram of a step of drawing a barcode image according to an embodiment of the present application;
图3是本申请实施例提供的一种生成条形码图像的装置结构示意图;3 is a schematic structural diagram of an apparatus for generating a barcode image according to an embodiment of the present application;
图4是本申请实施例提供的一种穿戴设备的结构示意图。 FIG. 4 is a schematic structural diagram of a wearable device according to an embodiment of the present application.
具体实施方式detailed description
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objects, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
本申请实施例提供了一种生成条形码的方法,该方法的执行主体为穿戴设备。其中,条形码(Barcode),简称条码,可以包括一维条码(1D Barcode)和二维码(2D Barcode)。其中,穿戴设备可以是具有生成条形码功能的可穿戴式设备,如智能手环、智能笔、蓝牙耳机等。穿戴设备中具有专用于生成条形码的固件代码,例如可以其系统程序中集成专用于生成条形码的固件代码。穿戴设备可以包括近距离通信部件,用于与其它设备进行信息交互,近距离通信部件可以是NFC(Near Field Communication,近距离无线通讯技术)通信部件或蓝牙通信部件,穿戴设备可以包括屏幕,用于显示生成条形码过程中需要显示的信息,如原始条码明文,条形码图像等。穿戴设备可以包括输入单元,如按键、触摸屏等,用户可以通过输入单元在穿戴设备上进行生成条形码过程中可能涉及的输入操作;穿戴设备可以包括处理器,处理器可以用于负责穿戴设备所进行的各种处理(例如在控制智能设备的过程所进行的处理);穿戴设备还可以包括存储器,存储器可以用于记录或存储穿戴设备在生成条形码的过程中产生的数据以及从其它设备接收数据。穿戴设备还可以包括传感器、输出单元以及电源等部件。本实施例中,以穿戴设备为智能手环为例,进行方案的详细说明,其它情况与之类似,本实施例不再累述。The embodiment of the present application provides a method for generating a barcode, and the execution body of the method is a wearable device. Among them, a barcode (Barcode), which is referred to as a barcode, may include a 1D barcode and a 2D barcode. The wearable device may be a wearable device having a barcode generating function, such as a smart bracelet, a smart pen, a Bluetooth headset, or the like. The wearable device has a firmware code dedicated to generating a barcode, for example, a firmware code dedicated to generating a barcode can be integrated in its system program. The wearable device may include a short-range communication component for performing information interaction with other devices, and the short-range communication component may be an NFC (Near Field Communication) communication component or a Bluetooth communication component, and the wearable device may include a screen. Display the information that needs to be displayed during the process of generating the barcode, such as the original barcode plaintext, barcode image, and so on. The wearable device may include an input unit, such as a button, a touch screen, etc., and the user may perform an input operation that may be involved in generating a barcode on the wearable device through the input unit; the wearable device may include a processor, and the processor may be used to perform the wearable device. Various processing (such as processing performed in a process of controlling a smart device); the wearable device may further include a memory that can be used to record or store data generated by the wearable device in the process of generating the barcode and receive data from other devices. The wearable device can also include components such as sensors, output units, and power supplies. In this embodiment, the wearable device is taken as an example of a smart wristband, and a detailed description of the solution is performed. Other situations are similar, and the present embodiment is not described in detail.
下面将结合具体实施方式,对图1所示的处理流程进行详细的说明,图1所示的处理流程可以由具有固件代码的穿戴设备执行。The process flow shown in FIG. 1 will be described in detail below with reference to specific embodiments. The process flow shown in FIG. 1 can be performed by a wearable device having a firmware code.
步骤101,接收条码生成指令,获取条码生成指令对应的条码明文。穿戴设备的系统程序中可以集成有专用于生成条形码的固件代码,即可以理解为穿戴设备采用嵌入式平台,通过嵌入式系统来进行相关的处理。此处,嵌入式系统是一种“完全嵌入受控器件内部,为特定应用而设计的专用计算机系统”,与个人计算机这样的通用计算机系统不同,嵌入式系 统通常执行的是带有特定要求的预先定义的任务,如生成条形码的任务。由于嵌入式系统只针对一项特殊的任务,设计人员能够对它进行优化,减小尺寸降低成本。通常,嵌入式系统可以理解为一个存储在ROM中的嵌入式处理器控制板的控制程序。嵌入式系统的核心是由一个或多个预先编程好以用来执行少数几项任务的微处理器或者单片机组成。与通用计算机能够运行用户选择的软件不同,嵌入式系统上的软件通常是暂时不变的;所以可以称之为“固件”。Step 101: Receive a barcode generation instruction, and obtain a barcode plaintext corresponding to the barcode generation instruction. A firmware code dedicated to generating a barcode can be integrated into the system program of the wearable device, that is, it can be understood that the wearable device adopts an embedded platform and performs related processing through the embedded system. Here, the embedded system is a "special computer system that is completely embedded in the controlled device and designed for a specific application". Unlike a general-purpose computer system such as a personal computer, the embedded system is different. Commonly implemented are predefined tasks with specific requirements, such as the task of generating barcodes. Because the embedded system is only for a specific task, the designer can optimize it to reduce the size and cost. In general, an embedded system can be understood as a control program for an embedded processor control board stored in ROM. The core of an embedded system consists of one or more microprocessors or microcontrollers that are pre-programmed to perform a few tasks. Unlike a general-purpose computer capable of running a user-selected software, the software on an embedded system is usually temporarily unchanged; so it can be called "firmware."
条码明文可以是用于生成条形码图像,未经加密(通常也未经编码转换)的字符串,这里所说的字符可以包括字母、数字和符号中的至少一种。由于条码明文还没有经过编码转换,因此,本文中也称作原始条码明文。The bar code plaintext may be a string of characters used to generate a barcode image, unencrypted (usually also unencoded), and the characters herein may include at least one of letters, numbers, and symbols. Since the bar code plaintext has not been encoded and converted, it is also referred to herein as the original bar code plaintext.
当用户需要在穿戴设备上生成并显示条形码时,可以点击穿戴设备上的条码生成按键,条码生成按键可以是物理按键也可以是虚拟按键。从而可以触发穿戴设备接收到条码生成指令,同时获取条码生成指令对应的原始条码明文。基于不同的情况,如下以原始条码明文为支付账户对应的明文,方案场景为手机支付为例,给出了几种获取原始条码明文的方式:When the user needs to generate and display a barcode on the wearable device, the barcode generation button on the wearable device can be clicked, and the barcode generation button can be a physical button or a virtual button. Therefore, the wearable device can be triggered to receive the barcode generation instruction, and at the same time, obtain the original barcode plaintext corresponding to the barcode generation instruction. Based on the different situations, the original barcode is the plaintext corresponding to the payment account, and the solution scenario is the mobile payment as an example. Several ways to obtain the original barcode clear text are given:
方式一,穿戴设备接收终端发送的条码生成请求,条码生成请求中携带有原始条码明文(和/或对应的条形码生成指令)。In the first mode, the wearable device receives the barcode generation request sent by the terminal, and the barcode generation request carries the original barcode plaintext (and/or the corresponding barcode generation instruction).
在实施中,用户在购买一件商品后,可以选择使用支付账户来进行付款,这时,用户可以打开安装在终端上的支付类软件,点击明文生成按键,这时终端可以生成与该支付类软件的用户账户对应的原始条码明文,之后,终端可以通过NFC、蓝牙等近距离通信软件与穿戴设备建立连接,终端从而可以将原始条码明文发送给穿戴设备,穿戴设备则可以获取原始条码明文。In the implementation, after purchasing a product, the user may choose to use the payment account to make payment. In this case, the user can open the payment software installed on the terminal and click the clear text generation button, and the terminal can generate the payment class. The user's account of the software corresponds to the original bar code. After that, the terminal can establish a connection with the wearable device through NFC, Bluetooth, and other short-range communication software. The terminal can send the original bar code to the wearable device, and the wearable device can obtain the original bar code plaintext.
方式二,穿戴设备根据预先存储的明文生成算法自动生成原始条码明文。In the second manner, the wearable device automatically generates the original barcode plaintext according to the pre-stored plaintext generation algorithm.
在实施中,穿戴设备中可以安装有用于支付的支付类软件,用户在购买一件商品后,可以打开安装在穿戴设备上的支付类软件,点击明文 生成按键,穿戴设备则可以根据预先存储的明文生成算法生成与该支付类软件的用户账户对应的原始条码明文。或者,穿戴设备中无需安装上述支付类软件,只需要嵌入该支付类软件的明文生成算法,进而在用户点击明文生成按键后,穿戴设备可以根据明文生成算法获取到用户账户对应的原始条码明文。In the implementation, the payment device may be installed in the wearable device, and after purchasing an item, the user may open the payment software installed on the wearable device, and click on the clear text. The button is generated, and the wearable device can generate the original barcode plaintext corresponding to the user account of the payment software according to the pre-stored plaintext generation algorithm. Alternatively, the wearable device does not need to install the payment software, and only needs to embed the plaintext generation algorithm of the payment software. After the user clicks the plaintext generation button, the wearable device can obtain the original barcode plaintext corresponding to the user account according to the plaintext generation algorithm.
此处,鉴于安全性考虑,上述用于支付类的原始条码明文可以是周期性变化的,即每条原始条码明文具备一定的有效期,在有效期过后,需要重新生成新的原始条码明文。Herein, in view of security considerations, the original bar code plaintext for the payment class may be periodically changed, that is, each original bar code plaintext has a certain validity period, and after the expiration date, a new original bar code plaintext needs to be regenerated.
步骤102,对条码明文进行编码转换,得到条码值。穿戴设备的固件代码中(或者在穿戴设备的存储器中)可以预先存储有用于条形码转换的编码规则,穿戴设备可以根据编码规则对得到的原始条码明文进行编码转换,从而可以得到用于绘制条形码图像的条码值。Step 102: Perform coding conversion on the barcode plaintext to obtain a barcode value. In the firmware code of the wearable device (or in the memory of the wearable device), an encoding rule for barcode conversion may be pre-stored, and the wearable device may encode and convert the obtained original barcode plaintext according to the encoding rule, thereby obtaining a barcode image for drawing. Bar code value.
可选的,由于原始条码明文的种类多种多样,在步骤102之前可以确定获取到的原始条码明文的条码类型,相应的处理可以如下:穿戴设备确定原始条码明文对应的条码类型(下文也称作第一条码类型)。Optionally, the barcode type of the original barcode clear text is determined before the step 102, and the corresponding processing may be as follows: the wearable device determines the barcode type corresponding to the original barcode plaintext (hereinafter also referred to as Make the first barcode type).
穿戴设备可以在获取到原始条码明文后,根据原始条码明文的明文格式(如字符长度、字符种类、标识字符)的等信息确定原始条码明文对应的第一条码类型。或者,在生成原始条码明文的时候可以同时记录该原始条码明文的类型信息,穿戴设备可以直接根据该类型信息确定原始条码明文对应的第一条码类型。After obtaining the original barcode clear text, the wearable device determines the first barcode type corresponding to the original barcode plaintext according to the plaintext format (such as the character length, the character type, and the identifier character) of the original barcode plaintext. Alternatively, the type information of the original bar code plaintext may be recorded at the same time when the original bar code plaintext is generated, and the wearable device may directly determine the first bar code type corresponding to the original bar code plaintext according to the type information.
可选的,基于上述确定了原始条码明文的条码类型的情况,步骤102的处理可以如下:穿戴设备根据预先存储在固件代码中(或穿戴设备的存储器中)的条码类型与编码规则的对应关系,确定第一条码类型对应的编码规则;根据第一条码类型对应的编码规则,对原始条码明文进行编码转换,得到条码值。Optionally, based on the foregoing determining the bar code type of the original bar code plaintext, the process of step 102 may be as follows: the correspondence between the bar code type and the encoding rule stored in the firmware code (or in the memory of the wearable device) pre-stored by the wearable device And determining an encoding rule corresponding to the first barcode type; encoding and converting the original barcode plaintext according to the encoding rule corresponding to the first barcode type, to obtain a barcode value.
在实施中,穿戴设备中可以预先在固件代码中存储有多种条码类型和编码规则的对应关系,该对应关系中记录了每个条码类型下不同明文字符对应的条码值,表1示例性的给出了Code128与条码值的对应关系表。穿戴设备在确定了原始条码明文对应的第一条码类型后,可以在上 述对应关系中确定第一条码类型对应的编码规则。之后,可以继续根据第一条码类型对应的编码规则,对原始条码明文进行编码转换,从而得到对应的条码值。具体的,此处以Code128C编码为例来进行说明。目前微信/QQ钱包/支付宝均采用Code128C编码,Code128C编码包括起始字段、数据字段、校验字段和结束字段,其中,Code128C的起始字段统一为表1中ID105对应的“Start C”,数据字段则是用于指示用户账户的原始条码明文,Code128C的原始条码明文一般是长度为偶数的数字串编码,每两个数字为一位数据,校验字段由起始字段和数据字段计算可得,相应的计算公式为:校验字段=(起始字段对应的ID值+数据字段每位数据的顺序编号×数据字段每位数据值)%103,其中,“%103”为对103进行取余计算,结束字段为统一为表1中ID106对应的“Stop”。具体的,此处以原始条码明文为95270078为例,起始字段对应的ID为105,第1位数据为95,第2位数据为27,第3位数据为0,第4位数据为78,所以校验字段=(105+1*95+2*27+3*0+4*78)%103=51,对照表1,对95270078进行编码转换:起始字段Start C(bbsbssbbbss)+数据位[95(bsbbbbsbsss)+27(bbbsbbssbss)+00(bbsbbssbbss)+78(bbssssbsbss)+检验位51(bbsbbbsbsss)+结束位Stop(bbsssbbbsbsbb),从而可以得到条码值(bbsbssbbbssbsbbbbsbsssbbbsbbssbssbbsbbssbbssbbssssbsbssbbsbbbsbsssbbsssbbbsbsbb)。In the implementation, the corresponding relationship between the barcode type and the encoding rule may be stored in the firmware code in advance, and the barcode value corresponding to different plaintext characters in each barcode type is recorded in the correspondence relationship. Table 1 is exemplary. A correspondence table between Code128 and bar code values is given. After the wearable device determines the first barcode type corresponding to the plain text of the original barcode, it can be on the The coding rule corresponding to the first barcode type is determined in the correspondence relationship. Then, the original bar code plaintext can be code-converted according to the coding rule corresponding to the first bar code type, thereby obtaining a corresponding bar code value. Specifically, the code 128C code is taken as an example here for description. At present, WeChat/QQ wallet/AlipPay adopt Code128C encoding. Code128C encoding includes start field, data field, check field and end field. The starting field of Code128C is unified as “Start C” corresponding to ID105 in Table 1. The field is used to indicate the original bar code plaintext of the user account. The original bar code plaintext of Code128C is generally a numeric string code of even length. Each two digits is a bit of data, and the check field is calculated by the start field and the data field. The corresponding calculation formula is: check field = (ID value corresponding to the start field + sequence number of each data of the data field × data value per bit of the data field) % 103, where "%103" is taken for 103 For the remainder calculation, the end field is unified to "Stop" corresponding to the ID 106 in Table 1. Specifically, the original bar code plain text is 95270078 as an example, the ID corresponding to the start field is 105, the first bit data is 95, the second bit data is 27, the third bit data is 0, and the fourth bit data is 78. So the check field = (105 + 1 * 95 + 2 * 27 + 3 * 0 + 4 * 78) % 103 = 51, compared to Table 1, encoding conversion of 95270078: start field Start C (bbsbssbbbss) + data bits [95 (bsbbbbsbsss) +27 (bbbsbbssbss) +00 (bbsbbssbbss) +78 (bbssssbsbss) + parity bit 51 (bbsbbbsbsss) + end bit Stop (bbsssbbbsbsbb), so that the bar code value can be obtained (bbsbssbbbssbsbbbbsbsssbbbsbbssbssbbsbbssbbssbbssssbsbssbbsbbbsbsssbbsssbbbsbsbb).
表1Table 1
IDID Code128ACode128A Code128BCode128B Code128CCode128C BandCodeBandCode 编码值Coded value
00 SPSP SPSP 00 212222212222 bbsbbssbbssBbsbbssbbss
11 ! ! 11 222122222122 bbssbbsbbssBbssbbsbbss
22 "" "" 22 222221222221 bbssbbssbbsBbssbbssbbs
33 ## ## 33 121223121223 bssbssbbsssBssbssbbsss
44 $$ $$ 44 121322121322 bssbsssbbssBssbsssbbss
55 % % 55 131222131222 bsssbssbbssBsssbssbbss
66 && && 66 122213122213 bssbbssbsssBssbbssbsss
77 '' '' 77 122312122312 bssbbsssbssBssbbsssbss
88 (( (( 88 132212132212 bsssbbssbssBsssbbssbss
99 )) )) 99 221213221213 bbssbssbsssBbssbssbsss
1010 ** ** 1010 221312221312 bbssbsssbssBbssbsssbss
1111 ++ ++ 1111 231212231212 bbsssbssbssBbsssbssbss
1212 ,, ,, 1212 112232112232 bsbbssbbbssBsbbssbbbss
1313 -- -- 1313 122132122132 bssbbsbbbssBssbbsbbbss
1414 .. .. 1414 122231122231 bssbbssbbbsBssbbssbbbs
1515 // // 1515 113222113222 bsbbbssbbssBsbbbssbbss
1616 00 00 1616 123122123122 bssbbbsbbssBssbbbsbbss
1717 11 11 1717 123221123221 bssbbbssbbsBssbbbssbbs
1818 22 22 1818 223211223211 bbssbbbssbsBbssbbbssbs
1919 33 33 1919 221132221132 bbssbsbbbssBbssbsbbbss
2020 44 44 2020 221231221231 bbssbssbbbsBbssbssbbbs
21twenty one 55 55 21twenty one 213212213212 bbsbbbssbssBbsbbbssbss
22twenty two 66 66 22twenty two 223112223112 bbssbbbsbssBbssbbbsbss
23twenty three 77 77 23twenty three 312131312131 bbbsbbsbbbsBbbsbbsbbbs
24twenty four 88 88 24twenty four 311222311222 bbbsbssbbssBbbsbssbbss
2525 99 99 2525 321122321122 bbbssbsbbssBbbssbsbbss
2626 :: :: 2626 321221321221 bbbssbssbbsBbbssbssbbs
2727 ; ; 2727 312212312212 bbbsbbssbssBbbsbbssbss
2828 << << 2828 322112322112 bbbssbbsbssBbbssbbsbss
2929 = = 2929 322211322211 bbbssbbssbsBbbssbbssbs
3030 >> >> 3030 212123212123 bbsbbsbbsssBbsbbsbbsss
3131 ? ? 3131 212321212321 bbsbbsssbbsBbsbbsssbbs
3232 @@ @@ 3232 232121232121 bbsssbbsbbsBbsssbbsbbs
3333 AA AA 3333 111323111323 bsbsssbbsssBsbsssbbsss
3434 BB BB 3434 131123131123 bsssbsbbsssBsssbsbbsss
3535 CC CC 3535 131321131321 bsssbsssbbsBsssbsssbbs
3636 DD DD 3636 112313112313 bsbbsssbsssBsbbsssbsss
3737 EE EE 3737 132113132113 bsssbbsbsssBsssbbsbsss
3838 FF FF 3838 132311132311 bsssbbsssbsBsssbbsssbs
3939 GG GG 3939 211313211313 bbsbsssbsssBbsbsssbsss
4040 HH HH 4040 231113231113 bbsssbsbsssBbsssbsbsss
4141 II II 4141 231311231311 bbsssbsssbsBbsssbsssbs
4242 JJ JJ 4242 112133112133 bsbbsbbbsssBsbbsbbbsss
4343 KK KK 4343 112331112331 bsbbsssbbbsBsbbsssbbbs
4444 LL LL 4444 132131132131 bsssbbsbbbsBsssbbsbbbs
4545 MM MM 4545 113123113123 bsbbbsbbsssBsbbbsbbsss
4646 NN NN 4646 113321113321 bsbbbsssbbsBsbbbsssbbs
4747 OO OO 4747 133121133121 bsssbbbsbbsBsssbbbsbbs
4848 PP PP 4848 313121313121 bbbsbbbsbbsBbbsbbbsbbs
4949 QQ QQ 4949 211331211331 bbsbsssbbbsBbsbsssbbbs
5050 RR RR 5050 231131231131 bbsssbsbbbsBbsssbsbbbs
5151 SS SS 5151 213113213113 bbsbbbsbsssBbsbbbsbsss
5252 TT TT 5252 213311213311 bbsbbbsssbsBbsbbbsssbs
5353 UU UU 5353 213131213131 bbsbbbsbbbsBbsbbbsbbbs
5454 VV VV 5454 311123311123 bbbsbsbbsssBbbsbsbbsss
5555 WW WW 5555 311321311321 bbbsbsssbbsBbbsbsssbbs
5656 XX XX 5656 331121331121 bbbsssbsbbsBbbsssbsbbs
5757 YY YY 5757 312113312113 bbbsbbsbsssBbbsbbsbsss
5858 ZZ ZZ 5858 312311312311 bbbsbbsssbsBbbsbbsssbs
5959 [[ [[ 5959 332111332111 bbbsssbbsbsBbbsssbbsbs
6060 \\ \\ 6060 314111314111 bbbsbbbbsbsBbbsbbbbsbs
6161 ]] ]] 6161 221411221411 bbssbssssbsBbssbssssbs
6262 ^^ ^^ 6262 431111431111 bbbbsssbsbsBbbbsssbsbs
6363 __ __ 6363 111224111224 bsbssbbssssBsbssbbssss
6464 NULNUL `` 6464 111422111422 bsbssssbbssBsbssssbbss
6565 SOHSOH aa 6565 121124121124 bssbsbbssssBssbsbbssss
6666 STXSTX bb 6666 121421121421 bssbssssbbsBssbssssbbs
6767 ETXETX cc 6767 141122141122 bssssbsbbssBssssbsbbss
6868 EOTEOT dd 6868 141221141221 bssssbssbbsBssssbssbbs
6969 ENQENQ ee 6969 112214112214 bsbbssbssssBsbbssbssss
7070 ACKACK ff 7070 112412112412 bsbbssssbssBsbbssssbss
7171 BELBEL gg 7171 122114122114 bssbbsbssssBssbbsbssss
7272 BSBS hh 7272 122411122411 bssbbssssbsBssbbssssbs
7373 HTHT ii 7373 142112142112 bssssbbsbssBssssbbsbss
7474 LFLF jj 7474 142211142211 bssssbbssbsBssssbbssbs
7575 VTVT kk 7575 241211241211 bbssssbssbsBbssssbssbs
7676 FFFF II 7676 221114221114 bbssbsbssssBbssbsbssss
7777 CRCR mm 7777 413111413111 bbbbsbbbsbsBbbbsbbbsbs
7878 SOSO nn 7878 241112241112 bbssssbsbssBbssssbsbss
7979 SISI oo 7979 134111134111 bsssbbbbsbsBsssbbbbsbs
8080 DLEDLE pp 8080 111242111242 bsbssbbbbssBsbssbbbbss
8181 DC1DC1 qq 8181 121142121142 bssbsbbbbssBssbsbbbbss
8282 DC2DC2 rr 8282 121241121241 bssbssbbbbsBssbssbbbbs
8383 DC3DC3 ss 8383 114212114212 bsbbbbssbssBsbbbbssbss
8484 DC4DC4 tt 8484 124112124112 bssbbbbsbssBssbbbbsbss
8585 NAKNAK uu 8585 124211124211 bssbbbbssbsBssbbbbssbs
8686 SYNSYN vv 8686 411212411212 bbbbsbssbssBbbbsbssbss
8787 ETBETB ww 8787 421112421112 bbbbssbsbssBbbbssbsbss
8888 CANCAN xx 8888 421211421211 bbbbssbssbsBbbbssbssbs
8989 EMEM yy 8989 212141212141 bbsbbsbbbbsBbsbbsbbbbs
9090 SUBSUB zz 9090 214121214121 bbsbbbbsbbsBbsbbbbsbbs
9191 ESCESC {{ 9191 412121412121 bbbbsbbsbbsBbbbsbbsbbs
9292 FSFS || 9292 111143111143 bsbsbbbbsssBsbsbbbbsss
9393 GSGS }} 9393 111341111341 bsbsssbbbbsBsbsssbbbbs
9494 RSRS ~ 9494 131141131141 bsssbsbbbbsBsssbsbbbbs
9595 USUS DELDEL 9595 114113114113 bsbbbbsbsssBsbbbbsbsss
9696 FNC3FNC3 FNC3FNC3 9696 114311114311 bsbbbbsssbsBsbbbbsssbs
9797 FNC2FNC2 FNC2FNC2 9797 411113411113 bbbbsbsbsssBbbbsbsbsss
9898 SHIFTSHIFT SHIFTSHIFT 9898 411311411311 bbbbsbsssbsBbbbsbsssbs
9999 CODECCODEC CODECCODEC 9999 113141113141 bsbbbsbbbbsBsbbbsbbbbs
100100 CODEBCODEB FNC4FNC4 CODEBCODEB 114131114131 bsbbbbsbbbs Bsbbbbsbbbs
101101 FNC4FNC4 CODEACODEA CODEACODEA 311141311141 bbbsbsbbbbs Bbbsbsbbbbs
102102 FNC1FNC1 FNC1FNC1 FNC1FNC1 411131411131 bbbbsbsbbbs Bbbbsbsbbbs
103103 StartAStartA StartAStartA StartAStartA 211412211412 bbsbssssbssBbsbssssbss
104104 StartBStartB StartBStartB StartBStartB 211214211214 bbsbssbssssBbsbssbssss
105105 StartCStartC StartCStartC StartCStartC 211232211232 bbsbssbbbssBbsbssbbbss
106106 StopStop StopStop StopStop 23311122331112 bbsssbbbsbsbbBbsssbbbsbsbb
步骤103,根据条码值绘制条形码图像,并显示条形码图像。 Step 103, drawing a barcode image according to the barcode value, and displaying the barcode image.
在实施中,穿戴设备在得到原始条码明文对应的条码值后,可以通过固件代码,将条码值绘制成条形码图像,进一步的,由于条码值只包含两种字符,可以分别选用两种不同颜色的线条(即条码线)来对应两种字符,即可以按字符顺序将两种颜色的线条紧密排布,即可生成相应的条形码图像,进而,穿戴设备可以将条形码图像显示在屏幕上。例如,对于上文95270078对应的条码值(bbsbssbbbssbsbbbbsbsssbbbsbbssbssbbsbbssbbssbbssssbsbssbbsbbbsbsssb bsssbbbsbsbb),在本步骤中,只需将b用黑色线标出,s用白色线标出,就可以生成对应的条形码图像。In the implementation, after obtaining the barcode value corresponding to the plain text of the original barcode, the wearable device may draw the barcode value into a barcode image by using the firmware code. Further, since the barcode value only includes two characters, two different colors may be selected respectively. The line (ie, the bar code line) corresponds to two characters, that is, the lines of the two colors can be arranged closely in character order to generate a corresponding barcode image, and the wearable device can display the barcode image on the screen. For example, for the bar code value corresponding to 95270078 above (bbsbssbbbssbsbbbbsbsssbbbsbbssbssbbsbbssbbssbbssssbsbssbbsbbbsbsssb Bsssbbbsbsbb), in this step, you only need to mark b with a black line and s with a white line to generate a corresponding barcode image.
可选的,步骤103中绘制条形码图像的过程可以包括:确定每条条码线的起始点坐标和结束点坐标;根据穿戴设备的屏幕大小,以及条码值的位数,确定每条条码线的间距(即条码线的宽度);根据每条条码线的起始点坐标、结束点坐标和间距,将条码值中每个条码字符绘制成对应的条码线,生成条形码图像。在实施中,穿戴设备的生产人员可以在穿戴设备的固件代码中植入如下代码,从而穿戴设备可以完成相应的绘制条形码图像的处理。具体的,考虑到绘制条形码时是按照条码线逐一绘制,则可以先确定每条条码线的起始点坐标和结束点坐标,此处可以考虑用X-Y平面坐标来表示,则可以确定每条条码线的起始点的X坐标和Y坐标,以及结束点的X坐标和Y坐标。之后,生产人员可以根据穿戴设备的屏幕大小,以及条码值的位数来确定每条条码线的间距,每条条码线的间距即可以认为是每条条码线的宽度。最后,穿戴设备则可以根据上述确定的每条条码线的起始点坐标、结束点坐标和间距,将条码值中每个条码字符依次绘制成对应的条码线,从而,可以生成条形码图像。图2给出了一种简单的绘制过程示意图。Optionally, the process of drawing the barcode image in step 103 may include: determining a starting point coordinate and an ending point coordinate of each barcode line; determining a spacing of each barcode line according to a screen size of the wearing device and a number of bits of the barcode value. (ie, the width of the bar code line); according to the starting point coordinates, the end point coordinates and the spacing of each bar code line, each bar code character in the bar code value is drawn into a corresponding bar code line to generate a barcode image. In an implementation, the wearer of the wearable device can embed the following code in the firmware code of the wearable device so that the wearable device can complete the corresponding process of drawing the barcode image. Specifically, considering that the bar code is drawn one by one according to the bar code line, the start point coordinate and the end point coordinate of each bar code line may be determined first, and here, the XY plane coordinates may be considered, and each bar code line may be determined. The X and Y coordinates of the starting point, and the X and Y coordinates of the ending point. After that, the production personnel can determine the spacing of each bar code line according to the screen size of the wearable device and the number of bits of the bar code value, and the spacing of each bar code line can be regarded as the width of each bar code line. Finally, the wearable device can sequentially draw each bar code character of the bar code value into a corresponding bar code line according to the starting point coordinates, the end point coordinates and the spacing of each bar code line determined above, so that the barcode image can be generated. Figure 2 shows a schematic diagram of a simple drawing process.
上述绘制条形码图像的代码可以如下:The above code for drawing a barcode image can be as follows:
Figure PCTCN2017084292-appb-000001
Figure PCTCN2017084292-appb-000001
Figure PCTCN2017084292-appb-000002
Figure PCTCN2017084292-appb-000002
可选的,对于一些常用的不会发生变化的条形码,穿戴设备可以选择性的进行存储,相应的处理可以如下:当接收到条形码图像存储指令时,将原始条码明文与条形码图像对应存储在穿戴设备内。Optionally, for some commonly used barcodes that do not change, the wearable device can be selectively stored, and the corresponding processing can be as follows: when receiving the barcode image storage instruction, storing the original barcode plaintext and the barcode image in the wearable Inside the device.
在实施中,在穿戴设备根据原始条码明文绘制成条形码图像后,如果用户认为该条形码图像为常用条形码图像,则可以点击穿戴设备上的存储按键,这时,穿戴设备则可以接收到条形码图像存储指令,从而,穿戴设备可以将当前显示的条形码图像和其对应的原始条码明文进行对应存储。In the implementation, after the wearable device draws the barcode image according to the original barcode, if the user thinks that the barcode image is a common barcode image, the storage button on the wearable device can be clicked, and the wearable device can receive the barcode image storage. The instructions, whereby the wearable device can store the currently displayed barcode image and its corresponding original barcode plaintext.
可选的,基于上述存储原始条码明文和条形码图像的情况,穿戴设 备在获取到原始条码明文后,判断本地是否已存储有对应的条形码图像,相应的处理可以如下:当穿戴设备再次接收到对应原始条码明文的条码生成指令时,如果穿戴设备存储有原始条码明文对应的条形码图像,则显示条形码图像。Optionally, based on the above-mentioned case of storing the original barcode plaintext and the barcode image, After obtaining the original barcode clear text, it is determined whether the corresponding barcode image is stored locally, and the corresponding processing may be as follows: when the wearable device receives the barcode generation instruction corresponding to the original barcode plaintext again, if the wearable device stores the original barcode plaintext The corresponding barcode image displays the barcode image.
在实施中,在穿戴设备存储原始条码明文和条形码图像后,再次接收到对应某个原始条码明文的条码生成指令时,可以获取该原始条码明文,并可以判断本地是否存储有该原始条码明文对应的条形码图像。如果穿戴设备存储有原始条码明文对应的条形码图像,则可以直接显示存储的条形码图像,如果穿戴设备未存储有原始条码明文对应的条形码图像,则可以基于该原始条码明文进行步骤102和步骤103的处理。In the implementation, after the wearable device stores the original bar code plaintext and the barcode image, and receives the bar code generation instruction corresponding to the plaintext of the original bar code again, the original bar code plaintext may be obtained, and it may be determined whether the original bar code plaintext is stored locally. Barcode image. If the wearable device stores the barcode image corresponding to the plain text of the original barcode, the stored barcode image may be directly displayed. If the wearable device does not store the barcode image corresponding to the original barcode plaintext, the steps 102 and 103 may be performed based on the original barcode plaintext. deal with.
本申请实施例中,穿戴设备的系统程序中集成有专用于生成条形码的固件代码,穿戴设备接收条码生成指令,获取条码生成指令对应的原始条码明文,穿戴设备根据预先存储在固件代码中的编码规则,对原始条码明文进行编码转换,得到条码值,穿戴设备通过固件代码,将条码值绘制成条形码图像,并显示条形码图像。这样,专用于生成条形码的固件代码的数据量较小,占用的存储空间较少,从而如穿戴设备这种存储空间较小的设备可以在系统程序中集成该固件代码来实现嵌入式平台下生成条形码图像的处理。In the embodiment of the present application, the system program of the wearable device is integrated with a firmware code for generating a barcode, and the wearable device receives the barcode generation instruction, and obtains the original barcode plaintext corresponding to the barcode generation instruction, and the wearable device according to the code pre-stored in the firmware code. The rule encodes and converts the original barcode plaintext to obtain a barcode value, and the wearable device draws the barcode value into a barcode image through the firmware code, and displays the barcode image. In this way, the firmware code dedicated to generating the barcode has a smaller amount of data and occupies less storage space, so that a device with a smaller storage space such as a wearable device can integrate the firmware code in the system program to implement the embedded platform. Processing of barcode images.
基于相同的技术构思,本申请实施例还提供了一种生成条形码图像的装置,如图3所示,该装置包括:Based on the same technical concept, the embodiment of the present application further provides an apparatus for generating a barcode image. As shown in FIG. 3, the apparatus includes:
获取模块301,用于接收条码生成指令,获取所述条码生成指令对应的条码明文;The obtaining module 301 is configured to receive a barcode generating instruction, and obtain a barcode plaintext corresponding to the barcode generating instruction;
转换模块302,用于对所述条码明文进行编码转换,得到条码值;The conversion module 302 is configured to perform coding and conversion on the barcode plaintext to obtain a barcode value.
绘制模块303,用于根据所述条码值绘制条形码图像。The drawing module 303 is configured to draw a barcode image according to the barcode value.
可选的,所述穿戴设备中存储有编码规则以及条形码类型与编码规则的对应关系。Optionally, the wearable device stores an encoding rule and a correspondence between the barcode type and the encoding rule.
可选的,所述装置还包括显示模块,用于显示所述条形码图像。Optionally, the device further includes a display module, configured to display the barcode image.
可选的,所述装置还包括: Optionally, the device further includes:
确定模块,用于确定与所述条码明文对应的条码类型;a determining module, configured to determine a barcode type corresponding to the plaintext of the barcode;
所述转换模块,用于:The conversion module is configured to:
根据上述对应关系,确定所述条码类型对应的编码规则;Determining, according to the foregoing correspondence, an encoding rule corresponding to the barcode type;
根据所述条码类型对应的编码规则,对所述条码明文进行编码转换,得到条码值。And performing coding conversion on the barcode plaintext according to the coding rule corresponding to the barcode type, to obtain a barcode value.
可选的,所述绘制模块,用于:Optionally, the drawing module is configured to:
确定每个线条的起始点坐标和结束点坐标;Determine the starting point coordinates and ending point coordinates of each line;
根据所述穿戴设备的屏幕大小,以及所述条码值的位数,确定所述每个线条的宽度;Determining a width of each of the lines according to a screen size of the wearable device and a number of bits of the barcode value;
根据所述线条的起始点坐标、结束点坐标和宽度,绘制条形码图像。A barcode image is drawn based on the starting point coordinates, the ending point coordinates, and the width of the line.
可选的,所述装置还包括:Optionally, the device further includes:
存储模块,用于当接收到条形码图像存储指令时,将所述条码明文与所述条形码图像对应存储在所述穿戴设备内。And a storage module, configured to store the barcode plaintext and the barcode image in the wearable device when receiving the barcode image storage instruction.
可选的,所述装置还包括:Optionally, the device further includes:
显示模块,用于当所述穿戴设备再次接收到对应所述原始条码明文的条码生成指令时,如果所述穿戴设备存储有所述原始条码明文对应的条形码图像,则显示所述条形码图像。And a display module, configured to display the barcode image if the wearable device stores the barcode image corresponding to the plaintext of the original barcode when the wearable device receives the barcode generation instruction corresponding to the plaintext of the original barcode.
可选的,上述条码生成指令是第一条码生成指令,上述条码生成指令对应的条码明文是第一条码明文,所述获取模块还用于:Optionally, the foregoing barcode generation instruction is a first barcode generation instruction, and the barcode plaintext corresponding to the barcode generation instruction is a first barcode plaintext, and the obtaining module is further configured to:
接收第二条码生成指令,Receiving a second barcode generation instruction,
获取所述第二条码生成指令对应的第二条码明文,Obtaining a second barcode plaintext corresponding to the second barcode generation instruction,
判断所述第二条码明文是否与所述第一条码明文相同,Determining whether the second barcode plaintext is the same as the first barcode plaintext,
响应于所述第二条码明文与所述第一条码明文相同,通知穿戴设备的显示单元显示所述存储的条形码图像。In response to the second bar code plaintext being the same as the first bar code plaintext, the display unit of the notification wearable device displays the stored barcode image.
本申请实施例中,穿戴设备的系统程序中集成有专用于生成条形码的固件代码,穿戴设备接收条码生成指令,获取条码生成指令对应的原始条码明文,穿戴设备根据预先存储在固件代码中的编码规则,对原始条码明文进行编码转换,得到条码值,穿戴设备通过固件代码,将条码值绘制成条形码图像,并显示条形码图像。这样,专用于生成条形码的 固件代码只需要包括完成上述处理的代码,所以固件代码的数据量较小,从而可以减小穿戴式设备的存储空间占用。In the embodiment of the present application, the system program of the wearable device is integrated with a firmware code for generating a barcode, and the wearable device receives the barcode generation instruction, and obtains the original barcode plaintext corresponding to the barcode generation instruction, and the wearable device according to the code pre-stored in the firmware code. The rule encodes and converts the original barcode plaintext to obtain a barcode value, and the wearable device draws the barcode value into a barcode image through the firmware code, and displays the barcode image. In this way, it is dedicated to generating barcodes. The firmware code only needs to include the code to complete the above processing, so the amount of data of the firmware code is small, so that the storage space of the wearable device can be reduced.
需要说明的是:上述实施例提供的生成条形码图像的装置在生成条形码图像时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的生成条形码图像的装置与生成条形码图像的方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that, when generating a barcode image, the apparatus for generating a barcode image in the foregoing embodiment is only illustrated by the division of each functional module, and in actual application, the function may be allocated by different functional modules as needed. Upon completion, the internal structure of the device is divided into different functional modules to perform all or part of the functions described above. In addition, the device for generating a barcode image provided by the above embodiment is the same as the method for generating a barcode image. The specific implementation process is described in detail in the method embodiment, and details are not described herein again.
图4是根据一示例性实施例示出的一种穿戴设备的结构示意图。该穿戴设备可以用于实施上述实施例中提供的生成条形码图像的方法。FIG. 4 is a schematic structural diagram of a wearable device according to an exemplary embodiment. The wearable device can be used to implement the method of generating a barcode image provided in the above embodiments.
穿戴设备400可以包括RF(Radio Frequency,射频)电路110、包括有一个或一个以上计算机可读存储介质的存储器120、输入单元130、显示单元140、传感器150、音频电路160、WiFi(wireless fidelity,无线保真)模块170、包括有一个或者一个以上处理核心的处理器180、以及电源190等部件。本领域技术人员可以理解,图4中示出的穿戴设备结构并不构成对穿戴设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中:The wearable device 400 can include an RF (Radio Frequency) circuit 110, a memory 120 including one or more computer readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, and a WiFi (wireless fidelity, The Wireless Fidelity module 170 includes a processor 180 having one or more processing cores, and a power supply 190 and the like. Those skilled in the art will appreciate that the wearable device structure illustrated in FIG. 4 does not constitute a definition of a wearable device, may include more or fewer components than illustrated, or combine some components, or different component arrangements. among them:
RF电路110可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,交由一个或者一个以上处理器180处理;另外,将涉及上行的数据发送给基站。通常,RF电路110包括但不限于天线、至少一个放大器、调谐器、一个或多个振荡器、用户身份模块(SIM)卡、收发信机、耦合器、LNA(Low Noise Amplifier,低噪声放大器)、双工器等。此外,RF电路110还可以通过无线通信与网络和其他设备通信。所述无线通信可以使用任一通信标准或协议,包括但不限于GSM(Global System of Mobile communication,全球移动通讯系统)、GPRS(General Packet Radio Service,通用分组无线服务)、CDMA(Code  Division Multiple Access,码分多址)、WCDMA(Wideband Code Division Multiple Access,宽带码分多址)、LTE(Long Term Evolution,长期演进)、电子邮件、SMS(Short Messaging Service,短消息服务)等。The RF circuit 110 can be used for transmitting and receiving information or during a call, and receiving and transmitting signals. Specifically, after receiving downlink information of the base station, the downlink information is processed by one or more processors 180. In addition, the data related to the uplink is sent to the base station. . Generally, the RF circuit 110 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier). , duplexer, etc. In addition, RF circuitry 110 can also communicate with the network and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code). Division Multiple Access (CDMA), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (Short Messaging Service), and the like.
存储器120可用于存储软件程序以及模块,处理器180通过运行存储在存储器120的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器120可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据穿戴设备400的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器120还可以包括存储器控制器,以提供处理器180和输入单元130对存储器120的访问。The memory 120 can be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by running software programs and modules stored in the memory 120. The memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to Data created by the use of the wearable device 400 (such as audio data, phone book, etc.), and the like. Moreover, memory 120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 120 may also include a memory controller to provide access to memory 120 by processor 180 and input unit 130.
输入单元130可用于接收输入的数字或字符信息,以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。具体地,输入单元130可包括触敏表面131以及其他输入设备132。触敏表面131,也称为触摸显示屏或者触控板,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触敏表面131上或在触敏表面131附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触敏表面131可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器180,并能接收处理器180发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触敏表面131。除了触敏表面131,输入单元130还可以包括其他输入设备132。具体地,其他输入设备132可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The input unit 130 can be configured to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls. In particular, input unit 130 can include touch-sensitive surface 131 as well as other input devices 132. Touch-sensitive surface 131, also referred to as a touch display or trackpad, can collect touch operations on or near the user (such as a user using a finger, stylus, etc., on any suitable object or accessory on touch-sensitive surface 131 or The operation near the touch-sensitive surface 131) and driving the corresponding connecting device according to a preset program. Alternatively, the touch-sensitive surface 131 can include two portions of a touch detection device and a touch controller. Wherein, the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information. The processor 180 is provided and can receive commands from the processor 180 and execute them. In addition, the touch-sensitive surface 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch-sensitive surface 131, the input unit 130 can also include other input devices 132. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
显示单元140可用于显示由用户输入的信息或提供给用户的信息以 及穿戴设备400的各种图形用户接口,这些图形用户接口可以由图形、文本、图标、视频和其任意组合来构成。显示单元140可包括显示面板141,可选的,可以采用LCD(Liquid Crystal Display,液晶显示器)、OLED(Organic Light-Emitting Diode,有机发光二极管)等形式来配置显示面板141。进一步的,触敏表面131可覆盖显示面板141,当触敏表面131检测到在其上或附近的触摸操作后,传送给处理器180以确定触摸事件的类型,随后处理器180根据触摸事件的类型在显示面板141上提供相应的视觉输出。虽然在图4中,触敏表面131与显示面板141是作为两个独立的部件来实现输入和输入功能,但是在某些实施例中,可以将触敏表面131与显示面板141集成而实现输入和输出功能。The display unit 140 can be used to display information input by the user or information provided to the user. And various graphical user interfaces of the wearable device 400, these graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. The display unit 140 may include a display panel 141. Alternatively, the display panel 141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 131 may cover the display panel 141, and when the touch-sensitive surface 131 detects a touch operation thereon or nearby, it is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 according to the touch event The type provides a corresponding visual output on display panel 141. Although in FIG. 4, touch-sensitive surface 131 and display panel 141 are implemented as two separate components to implement input and input functions, in some embodiments, touch-sensitive surface 131 can be integrated with display panel 141 for input. And output function.
穿戴设备400还可包括至少一种传感器150,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板141的亮度,接近传感器可在穿戴设备400移动到耳边时,关闭显示面板141和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于穿戴设备400还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。Wearable device 400 can also include at least one type of sensor 150, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may close the display panel 141 when the wearable device 400 moves to the ear. And / or backlight. As a kind of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity. It can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for the wearable device 400 can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, here No longer.
音频电路160、扬声器161,传声器162可提供用户与穿戴设备400之间的音频接口。音频电路160可将接收到的音频数据转换后的电信号,传输到扬声器161,由扬声器161转换为声音信号输出;另一方面,传声器162将收集的声音信号转换为电信号,由音频电路160接收后转换为音频数据,再将音频数据输出处理器180处理后,经RF电路110以发送给比如另一穿戴设备,或者将音频数据输出至存储器120以便进一步处理。音频电路160还可能包括耳塞插孔,以提供外设耳机与穿戴设备400的通信。The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the wearable device 400. The audio circuit 160 can transmit the converted electrical data of the received audio data to the speaker 161 for conversion to the sound signal output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal by the audio circuit 160. After receiving, it is converted into audio data, and then processed by the audio data output processor 180, transmitted to the, for example, another wearable device via the RF circuit 110, or outputted to the memory 120 for further processing. The audio circuit 160 may also include an earbud jack to provide communication of the peripheral earphones with the wearable device 400.
WiFi属于短距离无线传输技术,穿戴设备400通过WiFi模块170 可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图4示出了WiFi模块170,但是可以理解的是,其并不属于穿戴设备400的必须构成,完全可以根据需要在不改变申请的本质的范围内而省略。WiFi is a short-range wireless transmission technology, and the wearable device 400 passes through the WiFi module 170. It can help users send and receive emails, browse web pages and access streaming media, etc. It provides users with wireless broadband Internet access. Although FIG. 4 shows the WiFi module 170, it can be understood that it does not belong to the necessary configuration of the wearable device 400, and may be omitted as needed within the scope of not changing the essence of the application.
处理器180是穿戴设备400的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器120内的软件程序和/或模块,以及调用存储在存储器120内的数据,执行穿戴设备400的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器180可包括一个或多个处理核心;优选的,处理器180可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器180中。The processor 180 is the control center of the wearable device 400, connecting various portions of the entire handset with various interfaces and lines, by running or executing software programs and/or modules stored in the memory 120, and recalling data stored in the memory 120. The various functions and processing data of the wearable device 400 are executed to perform overall monitoring of the mobile phone. Optionally, the processor 180 may include one or more processing cores; preferably, the processor 180 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like. The modem processor primarily handles wireless communications. It can be understood that the above modem processor may not be integrated into the processor 180.
穿戴设备400还包括给各个部件供电的电源190(比如电池),优选的,电源可以通过电源管理系统与处理器180逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源190还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。The wearable device 400 also includes a power source 190 (such as a battery) that supplies power to the various components. Preferably, the power source can be logically coupled to the processor 180 through a power management system to manage functions such as charging, discharging, and power management through the power management system. . Power supply 190 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
尽管未示出,穿戴设备400还可以包括摄像头、蓝牙模块等,在此不再赘述。具体在本实施例中,穿戴设备400的显示单元是触摸屏显示器。Although not shown, the wearable device 400 may further include a camera, a Bluetooth module, and the like, and details are not described herein again. Specifically in the present embodiment, the display unit of the wearable device 400 is a touch screen display.
穿戴设备400还包括有一个或者一个以上的程序,其中一个或者一个以上程序存储于存储器中,且经配置以由处理器执行,所述一个或者一个以上程序包含用于执行生成条形码图像的方法的指令,该生成条形码图像的方法包括:Wearable device 400 also includes one or more programs, one or more of which are stored in a memory and configured to be executed by a processor, the one or more programs including a method for performing a method of generating a barcode image The method of generating a barcode image includes:
接收条码生成指令,获取所述条码生成指令对应的条码明文;Receiving a barcode generating instruction, and acquiring a barcode plaintext corresponding to the barcode generating instruction;
对所述条码明文进行编码转换,得到条码值;Transcoding and converting the barcode plaintext to obtain a barcode value;
根据所述条码值绘制条形码图像,并显示所述条形码图像。A barcode image is drawn based on the barcode value, and the barcode image is displayed.
可选的,所述穿戴设备中存储有编码规则,以及条形码类型与编码规则的对应关系。 Optionally, the wearable device stores an encoding rule, and a correspondence between the barcode type and the encoding rule.
可选的,所述方法还包括:Optionally, the method further includes:
确定所述条码明文对应的条码类型;Determining a barcode type corresponding to the plaintext of the barcode;
对所述条码明文进行编码转换,得到条码值,包括:Transcoding and transcoding the barcode plaintext to obtain a barcode value, including:
根据上述对应关系,确定所述条码类型对应的编码规则;Determining, according to the foregoing correspondence, an encoding rule corresponding to the barcode type;
根据所述条码类型对应的编码规则,对所述条码明文进行编码转换,得到条码值。And performing coding conversion on the barcode plaintext according to the coding rule corresponding to the barcode type, to obtain a barcode value.
可选的,根据所述条码值绘制条形码图像,包括:Optionally, the barcode image is drawn according to the barcode value, including:
确定每个线条的起始点坐标和结束点坐标;Determine the starting point coordinates and ending point coordinates of each line;
根据所述穿戴设备的屏幕大小,以及所述条码值的位数,确定所述每个线条的宽度;Determining a width of each of the lines according to a screen size of the wearable device and a number of bits of the barcode value;
根据所述线条的起始点坐标、结束点坐标和宽度,绘制条形码图像。A barcode image is drawn based on the starting point coordinates, the ending point coordinates, and the width of the line.
可选的,所述方法还包括:Optionally, the method further includes:
当接收到条形码图像存储指令时,将所述条码明文与所述条形码图像对应存储在所述穿戴设备内。When the barcode image storage instruction is received, the barcode plaintext is stored in the wearable device corresponding to the barcode image.
可选的,所述方法还包括:Optionally, the method further includes:
当所述穿戴设备再次接收到对应所述原始条码明文的条码生成指令时,如果所述穿戴设备存储有所述原始条码明文对应的条形码图像,则显示所述条形码图像。And when the wearable device receives the barcode generating instruction corresponding to the plaintext of the original barcode again, if the wearable device stores the barcode image corresponding to the original barcode plaintext, the barcode image is displayed.
可选的,上述条码生成指令是第一条码生成指令,上述条码生成指令对应的条码明文是第一条码明文,所述方法还包括:Optionally, the bar code generation instruction is a first bar code generation instruction, and the bar code plaintext corresponding to the bar code generation instruction is a first bar code plaintext, and the method further includes:
接收第二条码生成指令,Receiving a second barcode generation instruction,
获取所述第二条码生成指令对应的第二条码明文,Obtaining a second barcode plaintext corresponding to the second barcode generation instruction,
判断所述第二条码明文是否与所述第一条码明文相同,Determining whether the second barcode plaintext is the same as the first barcode plaintext,
响应于所述第二条码明文与所述第一条码明文相同,则显示所述存储的条形码图像。The stored barcode image is displayed in response to the second barcode plaintext being the same as the first barcode plaintext.
可选的所述条形码是一维条形码或二维条形码。The optional barcode is a one-dimensional barcode or a two-dimensional barcode.
本申请实施例中,穿戴设备的系统程序中集成有专用于生成条形码的固件代码,穿戴设备接收条码生成指令,获取条码生成指令对应的原始条码明文,穿戴设备根据预先存储在固件代码中的编码规则,对原始 条码明文进行编码转换,得到条码值,穿戴设备通过固件代码,将条码值绘制成条形码图像,并显示条形码图像。这样,专用于生成条形码的固件代码只需要包括完成上述处理的代码,所以固件代码的数据量较小,从而可以减小穿戴式设备的存储空间占用。In the embodiment of the present application, the system program of the wearable device is integrated with a firmware code for generating a barcode, and the wearable device receives the barcode generation instruction, and obtains the original barcode plaintext corresponding to the barcode generation instruction, and the wearable device according to the code pre-stored in the firmware code. Rule, original The barcode plaintext is encoded and converted to obtain a barcode value, and the wearable device draws the barcode value into a barcode image through the firmware code, and displays the barcode image. Thus, the firmware code dedicated to generating the barcode only needs to include the code for performing the above processing, so the amount of data of the firmware code is small, so that the storage space of the wearable device can be reduced.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。A person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium. The storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
以上所述仅为本申请的较佳实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。 The above is only the preferred embodiment of the present application, and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application are included in the protection of the present application. Within the scope.

Claims (18)

  1. 一种生成条形码图像的方法,该方法由穿戴设备通过其中的固件代码执行,所述方法包括:A method of generating a barcode image, the method being performed by a wearable device through a firmware code therein, the method comprising:
    接收条形码生成指令;Receiving a barcode generation instruction;
    获取所述条形码生成指令对应的条形码明文;Obtaining a barcode plaintext corresponding to the barcode generation instruction;
    对所述条形码明文进行编码转换,得到条形码的值;Transcoding and converting the barcode plaintext to obtain a barcode value;
    根据所述条形码的值绘制条形码图像;Drawing a barcode image according to the value of the barcode;
    显示所述条形码图像。The barcode image is displayed.
  2. 根据权利要求1所述的方法,其中所述穿戴设备中存储有编码规则,以及条形码类型与编码规则的对应关系。The method of claim 1, wherein the wearable device stores an encoding rule and a correspondence between the barcode type and the encoding rule.
  3. 根据权利要求2所述的方法,还包括:The method of claim 2 further comprising:
    确定所述条形码明文对应的条形码类型。Determining the barcode type corresponding to the plaintext of the barcode.
  4. 根据权利要求3所述的方法,其中,对所述条形码明文进行编码转换,得到条形码的值,包括:The method of claim 3, wherein transcoding the barcode plaintext to obtain a value of the barcode comprises:
    根据所述对应关系,确定与所确定的条形码类型对应的编码规则;Determining, according to the correspondence, an encoding rule corresponding to the determined barcode type;
    根据所确定的编码规则,对所述条形码明文进行编码转换,得到条形码的值。The barcode plaintext is encoded and converted according to the determined encoding rule to obtain a value of the barcode.
  5. 根据权利要求1所述的方法,其中所述条形码图像包括多个线条,The method of claim 1 wherein said barcode image comprises a plurality of lines,
    其中,根据所述条形码的值绘制条形码图像,包括:Wherein, drawing a barcode image according to the value of the barcode includes:
    确定每个线条的起始点坐标和结束点坐标;Determine the starting point coordinates and ending point coordinates of each line;
    根据所述穿戴设备的屏幕大小,以及所述条形码的值的位数,确定每个线条的宽度;Determining the width of each line according to the screen size of the wearable device and the number of bits of the value of the barcode;
    根据所述线条的起始点坐标、结束点坐标和宽度,绘制条形码图像。A barcode image is drawn based on the starting point coordinates, the ending point coordinates, and the width of the line.
  6. 根据权利要求1所述的方法,还包括:The method of claim 1 further comprising:
    响应于接收到条形码图像存储指令,将所述条形码明文与所述条形码图像对应存储在所述穿戴设备内。In response to receiving the barcode image storage instruction, the barcode plaintext is stored in the wearable device corresponding to the barcode image.
  7. 根据权利要求6所述的方法,其中所述条形码生成指令是第一条形码生成指令,所述条形码生成指令对应的条形码明文是第一条形码明 文,所述方法还包括:The method according to claim 6, wherein the barcode generation instruction is a first barcode generation instruction, and the barcode plaintext corresponding to the barcode generation instruction is a first barcode The method further includes:
    接收第二条形码生成指令;Receiving a second barcode generation instruction;
    获取所述第二条形码生成指令对应的第二条形码明文;Obtaining a second barcode plaintext corresponding to the second barcode generation instruction;
    判断所述第二条形码明文是否与所述第一条形码明文相同;Determining whether the second barcode plaintext is the same as the first barcode plaintext;
    响应于所述第二条形码明文与所述第一条形码明文相同,显示所述存储的条形码图像。The stored barcode image is displayed in response to the second barcode plaintext being the same as the first barcode plaintext.
  8. 根据权利要求1所述的方法,其中所述条形码是一维条形码或二维条形码。The method of claim 1 wherein the barcode is a one-dimensional barcode or a two-dimensional barcode.
  9. 一种生成条形码图像的装置,该装置由穿戴设备通过其中的固件代码实现,所述装置包括:A device for generating a barcode image, the device being implemented by a wearable device through a firmware code therein, the device comprising:
    获取模块,用于接收条形码生成指令,获取所述条形码生成指令对应的条形码明文;An obtaining module, configured to receive a barcode generation instruction, and obtain a barcode plaintext corresponding to the barcode generation instruction;
    转换模块,用于对所述条形码明文进行编码转换,得到条形码的值;a conversion module, configured to encode and convert the barcode plaintext to obtain a barcode value;
    绘制模块,用于根据所述条形码的值绘制条形码图像。A drawing module for drawing a barcode image based on the value of the barcode.
  10. 根据权利要求9所述的装置,其中所述穿戴设备中存储有编码规则以及条形码类型与编码规则的对应关系。The apparatus according to claim 9, wherein the wearable device stores an encoding rule and a correspondence relationship between the barcode type and the encoding rule.
  11. 根据权利要求10所述的装置,还包括:The apparatus of claim 10 further comprising:
    确定模块,用于确定与所述条形码明文对应的条形码类型。A determining module is configured to determine a barcode type corresponding to the plaintext of the barcode.
  12. 根据权利要求11所述的装置,其中所述转换模块,用于:The apparatus of claim 11 wherein said conversion module is operative to:
    根据所述对应关系,确定与所确定的条形码类型对应的编码规则;Determining, according to the correspondence, an encoding rule corresponding to the determined barcode type;
    根据确定的编码规则,对所述条形码明文进行编码转换,得到条形码的值。The barcode plaintext is encoded and converted according to the determined encoding rule to obtain a barcode value.
  13. 根据权利要求9所述的装置,其中,所述条形码图像包括多个线条,所述绘制模块,用于:The apparatus of claim 9, wherein the barcode image comprises a plurality of lines, and the rendering module is configured to:
    确定每个线条的起始点坐标和结束点坐标;Determine the starting point coordinates and ending point coordinates of each line;
    根据所述穿戴设备的屏幕大小,以及所述条形码的值的位数,确定每个线条的宽度;Determining the width of each line according to the screen size of the wearable device and the number of bits of the value of the barcode;
    根据所述线条的起始点坐标、结束点坐标和宽度,绘制条形码图像。A barcode image is drawn based on the starting point coordinates, the ending point coordinates, and the width of the line.
  14. 根据权利要求9所述的装置,还包括: The apparatus of claim 9 further comprising:
    存储模块,用于响应于接收到条形码图像存储指令,将所述条形码明文与所述条形码图像对应存储在所述穿戴设备内。And a storage module, configured to store, in response to receiving the barcode image storage instruction, the barcode plaintext and the barcode image in the wearable device.
  15. 根据权利要求14所述的装置,其中所述条形码生成指令是第一条形码生成指令,所述条形码生成指令对应的条形码明文是第一条形码明文,其中,所述获取模块还用于:The apparatus according to claim 14, wherein the barcode generation instruction is a first barcode generation instruction, and the barcode plaintext corresponding to the barcode generation instruction is a first barcode plaintext, wherein the acquisition module is further configured to:
    接收第二条形码生成指令;Receiving a second barcode generation instruction;
    获取所述第二条形码生成指令对应的第二条形码明文;Obtaining a second barcode plaintext corresponding to the second barcode generation instruction;
    判断所述第二条形码明文是否与所述第一条形码明文相同;Determining whether the second barcode plaintext is the same as the first barcode plaintext;
    响应于所述第二条形码明文与所述第一条形码明文相同,通知穿戴设备的显示单元显示所述存储的条形码图像。In response to the second barcode plaintext being the same as the first barcode plaintext, the display unit of the notification wearable device displays the stored barcode image.
  16. 根据权利要求9所述的装置,其中所述条形码是一维条形码或二维条形码。The device of claim 9 wherein said barcode is a one-dimensional barcode or a two-dimensional barcode.
  17. 一种生成条形码图像的装置,包括:An apparatus for generating a barcode image, comprising:
    一个或多个处理器;和One or more processors; and
    存储器,所述存储器存储有程序指令,所述程序指令当由所述处理器执行时,配置所述装置执行根据权利要求1-8中任一项所述的方法。A memory storing program instructions that, when executed by the processor, configure the apparatus to perform the method of any of claims 1-8.
  18. 一种计算机可读存储介质,存储有程序指令,所述程序指令当由计算装置的处理器执行时,配置所述装置执行根据权利要求1-8中任一项所述的方法。 A computer readable storage medium storing program instructions that, when executed by a processor of a computing device, configure the apparatus to perform the method of any of claims 1-8.
PCT/CN2017/084292 2016-05-13 2017-05-15 Method and apparatus for generating barcode pattern WO2017194024A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610321596.4 2016-05-13
CN201610321596.4A CN107368872B (en) 2016-05-13 2016-05-13 A kind of method and apparatus generating bar code image

Publications (1)

Publication Number Publication Date
WO2017194024A1 true WO2017194024A1 (en) 2017-11-16

Family

ID=60266683

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/084292 WO2017194024A1 (en) 2016-05-13 2017-05-15 Method and apparatus for generating barcode pattern

Country Status (2)

Country Link
CN (1) CN107368872B (en)
WO (1) WO2017194024A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10896409B2 (en) * 2011-06-24 2021-01-19 Paypal, Inc. Animated two-dimensional barcode checks
CN113672230A (en) * 2021-06-23 2021-11-19 重庆斯欧智能科技研究院有限公司 Industrial element identification coding method
CN114372547A (en) * 2021-12-22 2022-04-19 广西柳钢东信科技有限公司 Two-dimensional bar code design method for steel serial number identification

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109002821B (en) * 2018-07-19 2021-11-02 武汉科技大学 Online silver shield digital identification method based on connected domain and tangent slope
CN110263895B (en) * 2019-06-25 2023-02-17 北京慧眼智行科技有限公司 Code graph generation method and system
CN111340166A (en) * 2020-03-18 2020-06-26 中科星图(深圳)数字技术产业研发中心有限公司 Method for generating unique identification map
CN111310876A (en) * 2020-03-18 2020-06-19 中科星图(深圳)数字技术产业研发中心有限公司 Personnel management method and management system for epidemic situation prevention and control
CN112800799A (en) * 2021-01-27 2021-05-14 迅镭智能(广州)科技有限公司 Character conversion system for scanning gun

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102934008A (en) * 2010-04-20 2013-02-13 索尼电脑娱乐公司 Universal active 3d stereo shutter glasses
CN104866093A (en) * 2015-04-27 2015-08-26 百度在线网络技术(北京)有限公司 Method and apparatus for obtaining interactive code in wearable device and wearable device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105205776A (en) * 2015-09-28 2015-12-30 梁天润 Interaction method for Internet of things on basis of intelligent wearable device
CN105394890A (en) * 2015-12-29 2016-03-16 聂洪贵 Intelligent wearing accessory with NFC payment function and use method thereof
CN108491748B (en) * 2018-04-02 2020-01-10 腾讯音乐娱乐科技(深圳)有限公司 Graphic code identification and generation method and device and computer readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102934008A (en) * 2010-04-20 2013-02-13 索尼电脑娱乐公司 Universal active 3d stereo shutter glasses
CN104866093A (en) * 2015-04-27 2015-08-26 百度在线网络技术(北京)有限公司 Method and apparatus for obtaining interactive code in wearable device and wearable device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10896409B2 (en) * 2011-06-24 2021-01-19 Paypal, Inc. Animated two-dimensional barcode checks
US11915210B2 (en) 2011-06-24 2024-02-27 Paypal, Inc. Animated two-dimensional barcode checks
CN113672230A (en) * 2021-06-23 2021-11-19 重庆斯欧智能科技研究院有限公司 Industrial element identification coding method
CN113672230B (en) * 2021-06-23 2024-04-09 重庆斯欧智能科技研究院有限公司 Industrial element identification coding method
CN114372547A (en) * 2021-12-22 2022-04-19 广西柳钢东信科技有限公司 Two-dimensional bar code design method for steel serial number identification
CN114372547B (en) * 2021-12-22 2023-10-13 广西柳钢东信科技有限公司 Two-dimensional bar code design method for steel numbering identification

Also Published As

Publication number Publication date
CN107368872A (en) 2017-11-21
CN107368872B (en) 2019-04-23

Similar Documents

Publication Publication Date Title
WO2017194024A1 (en) Method and apparatus for generating barcode pattern
US10353883B2 (en) Method, device and storage medium for providing data statistics
EP3206110B1 (en) Method of providing handwriting style correction function and electronic device adapted thereto
CN111984165B (en) Method and device for displaying message and terminal equipment
EP3160150A1 (en) Electronic device and method for executing function using speech recognition thereof
CN104852885B (en) Method, device and system for verifying verification code
US20160210453A1 (en) Electronic device and inputted signature processing method of electronic device
KR20160005895A (en) Electronic Device And Method For Providing Interface Of The Same, Accessory For The Electronic Device
US20160307351A1 (en) Interactive Method And Apparatus Based On Web Picture
CN108958606B (en) Split screen display method and device, storage medium and electronic equipment
KR20150079829A (en) Gesture-based conversation processing method, apparatus, and terminal device
WO2015043194A1 (en) Virtual keyboard display method and apparatus, and terminal
WO2018006841A1 (en) Qr code information transmission method, device and apparatus
US10438525B2 (en) Method of controlling display of electronic device and electronic device thereof
US20150089431A1 (en) Method and terminal for displaying virtual keyboard and storage medium
KR20150057080A (en) Apparatas and method for changing a input mode according to input method in an electronic device
CN109416615A (en) Handle the method for touch event and the electronic device suitable for this method
US20140053098A1 (en) Secure text entry methods for portable electronic devices
CN108369445A (en) The cascade for waking up segmentation framework touches
CN105278795B (en) A kind of method and apparatus on display function column
CN114629649A (en) Data processing method and device based on cloud computing and storage medium
US9886743B2 (en) Method for inputting data and an electronic device thereof
CN104794139B (en) Information retrieval method, apparatus and system
WO2015101254A1 (en) Information interaction method, apparatus and system
CN107656670A (en) Method, terminal device and the computer-readable medium that a kind of icon is shown

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17795642

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17795642

Country of ref document: EP

Kind code of ref document: A1