CN106228220A - A kind of two-dimensional code generation method based on multithreading and system - Google Patents

A kind of two-dimensional code generation method based on multithreading and system Download PDF

Info

Publication number
CN106228220A
CN106228220A CN201610576440.0A CN201610576440A CN106228220A CN 106228220 A CN106228220 A CN 106228220A CN 201610576440 A CN201610576440 A CN 201610576440A CN 106228220 A CN106228220 A CN 106228220A
Authority
CN
China
Prior art keywords
quick response
response code
sub
parameter
main thread
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN201610576440.0A
Other languages
Chinese (zh)
Inventor
杨晓东
孙文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Gongshang University
Original Assignee
Zhejiang Gongshang University
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 Zhejiang Gongshang University filed Critical Zhejiang Gongshang University
Priority to CN201610576440.0A priority Critical patent/CN106228220A/en
Publication of CN106228220A publication Critical patent/CN106228220A/en
Pending legal-status Critical Current

Links

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
    • 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/06037Record 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 multi-dimensional coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention provides a kind of two-dimensional code generation method based on multithreading, comprise the following steps: (1) sets Quick Response Code parameter;(2) main thread obtains Quick Response Code parameter;(3) main thread is packaged into parameter object parameter;(4) one sub-thread of main thread instantiation;(5) main thread sends parameter object to sub-line journey;(6) sub-line journey receives parameter object;(7) sub-line journey calculates Quick Response Code matrix;(8) sub-line journey beams back main thread Quick Response Code matrix;(9) main thread receives Quick Response Code matrix and renders Quick Response Code;(10) sub-line journey is closed.Additionally provide a kind of Quick Response Code based on multithreading and generate system, including Quick Response Code parameter setting module and algoritic module.The present invention employs multi-thread mechanism in traditional Quick Response Code generation technique, Quick Response Code formation efficiency is higher, has accomplished significantly to promote in processing speed and response speed, and system is more stable, it is truly realized multi-thread programming, improves the resource utilization of system.

Description

A kind of two-dimensional code generation method based on multithreading and system
Technical field
The present invention relates to the generation method of Quick Response Code, be specifically related to a kind of two-dimensional code generation method based on multithreading and be System.
Background technology
Bar code is the multiple secret notes and blank not waited by width, according to certain coding rule arrangement, in order to express one The graphical identifier of group information.Secret note and blank, according to the different in width of one group of horizontal direction secret note, are weaved into by one-dimensional bar code The a series of characters being made up of " 0 " and " 1 ", this binary-coded character encodes according to certain rule.Two-dimensional bar is at water Square storing information to the two-dimensional space of vertical direction, according to coding principle, two-dimensional bar is divided into capable row's formula two dimension bar shaped Code and matrix type two-dimension bar code.Two-dimensional bar has that information capacity is big, reliability is high and the advantage such as strong security.
In recent years, along with the development of smart mobile phone technology is with universal, by mobile intelligent terminal equipment such as mobile phones, it is thus achieved that two User is the most deeply popularized in the application of dimension code bearer related information and service, and Quick Response Code is the most gradually applied to opening from closed system Place system application changes, and the formation efficiency of Quick Response Code is increasingly becoming focus of concern.
A lot of owing to realizing the technology of Quick Response Code, the most incompatible, for the coding principle of Quick Response Code, generally can divide For following two type: row row's formula two-dimensional bar code and matrix two-dimensional code.The matrix form that row row's formula two-dimensional bar code is representative Two-dimensional bar code has Code16K, Code49, PDF417 etc..The representative matrix two-dimensional barcode of matrix two-dimensional code has: CodeOne, MaxiCode, QRCode, DataMatrix etc..
But, traditional two-dimensional code generation method has the disadvantage that formation efficiency is low.Under conventional situation, generate Quick Response Code Method perform in a serial fashion, after the function that needs to be finished, just can perform another function;System is unstable Fixed, if some code runs the most time-consuming, then statement below must wait until that time-consuming operation could continue after terminating Running, at this moment system is possible to lose response.
The coding module of Quick Response Code is the key components of any two-dimensional code generation method, and the generation of Quick Response Code is very Complicated calculating process, relates to data encoding and the Error Correction of Coding etc. of complexity.Any link is made mistakes all without being successfully generated two dimension Code, and each link must be carried out on the basis of previous link is correctly completed.Therefore, improve and improve existing The efficiency of two-dimensional code generation method is necessary.
Summary of the invention
The invention provides a kind of two-dimensional code generation method based on multithreading and system, it is therefore intended that solve traditional two In dimension code generating method, Quick Response Code formation efficiency is low, and system response time is long, the problem that system stability is the highest.
For reaching above-mentioned purpose, the present invention is achieved through the following technical solutions:
A kind of two-dimensional code generation method based on multithreading, comprises the following steps:
(1) Quick Response Code parameter is set;
(2) main thread obtains Quick Response Code parameter;
(3) main thread is packaged into parameter object parameter;
(4) one sub-thread of main thread instantiation;
(5) main thread sends parameter object to sub-line journey;
(6) sub-line journey receives parameter object;
(7) sub-line journey calculates Quick Response Code matrix;
(8) sub-line journey beams back main thread Quick Response Code matrix;
(9) main thread receives Quick Response Code matrix and renders Quick Response Code;
(10) sub-line journey is closed.
Described Quick Response Code is one or more of matrix two-dimensional barcode.
In step (1), described Quick Response Code parameter at least includes the big of Quick Response Code content, Quick Response Code level of error correction and Quick Response Code Little.
The Quick Response Code parameter encapsulation that described parameter object is got by main thread forms, and facilitates between main thread and sub-line journey Data transmission.
Described sub-line journey is created by one sub-thread of instantiation by main thread, and sub-line journey can be monitored immediately and receive master Thread sends the parameter object data of coming, and main thread collaborative work, for improving efficiency and the raising of two-dimensional code generation method The utilization rate of system resource.
In step (7), according to the criterion calculation Quick Response Code matrix of matrix two-dimensional code, main thread is loaded down with trivial details Quick Response Code square Battle array process is placed in sub-line journey calculating, for alleviating the service pressure of main thread, can improve the response efficiency of system.
Present invention also offers a kind of Quick Response Code based on multithreading and generate system, including Quick Response Code parameter setting module and Algoritic module.
Described Quick Response Code parameter setting module is for setting the relevant parameter of Quick Response Code, and described parameter at least includes Quick Response Code Content, Quick Response Code level of error correction and the size of Quick Response Code.
Described algoritic module includes main thread functional module and sub-line journey functional module.
Described main thread functional module has been used for main thread function, including: obtain Quick Response Code parameter, be packaged into parameter pair As, instantiation sub-line journey, send data, the sub-thread-data of monitoring reception to sub-line journey and render Quick Response Code.
Described sub-line journey functional module has been used for sub-line journey function, including: receive and parse through main thread parameter object, meter Calculate Quick Response Code matrix, send data to main thread.
The present invention compared with prior art, has the advantage that
The present invention employs multi-thread mechanism in traditional Quick Response Code generation technique, and Quick Response Code formation efficiency is higher, Having accomplished in processing speed and response speed significantly to promote, system is more stable, is truly realized multi-thread programming, improves The resource utilization of system.
Accompanying drawing illustrates:
Fig. 1 is the structural representation that present invention Quick Response Code based on multithreading generates system;
Fig. 2 is present invention two-dimensional code generation method based on multithreading and the workflow diagram of system;
Fig. 3 is the workflow diagram of main thread in present invention Quick Response Code based on multithreading generation system;
Fig. 4 is the workflow diagram that present invention Quick Response Code based on multithreading generates system neutron thread.
Detailed description of the invention:
The present invention provides a kind of two-dimensional code generation method based on multithreading and system, specific works flow process as in figure 2 it is shown, The method purpose is that the formation efficiency solving conventional two-dimensional code generating method is low, and system response time is long, and system stability is not High problem.
In one embodiment of the invention, as a example by generating a concrete Quick Response Code, the Quick Response Code utilizing the present invention is raw One-tenth method realizes the generation of this Quick Response Code, comprises the steps:
(1) setting Quick Response Code parameter, the Quick Response Code parameter of setting includes Quick Response Code content, Quick Response Code level of error correction and two dimension The size of code, Quick Response Code content setting is " abc " herein, and level of error correction is set as " L ", and size is set as 400px*400px;
(2) main thread obtains the Quick Response Code parameter set, including above-mentioned Quick Response Code content, Quick Response Code level of error correction and two The size of dimension code;
(3) main thread is packaged into parameter object (being herein encapsulated as " object "), parameter object three Quick Response Code parameters Comprise three Quick Response Code parameters of setting, after being packaged into object, can conveniently realize the data between main thread and sub-line journey and pass Defeated;
(4) one sub-thread of main thread instantiation, the most named " worker ", this sub-line journey " worker " is immediately with son Thread monitoring reception function (it is assumed herein that being " wkOnMsg () ") monitors the data that main thread may send, and this sub-line journey can With with main thread collaborative work, for improve two-dimensional code generation method efficiency and improve system resource utilization rate;
(5) main thread sends function (it is assumed herein that be postMsg () ") using parameter object " object " as main thread Parameter sends to sub-line journey " worker ";
(6) sub-line journey " worker " sub-line journey monitoring reception function " wkOnMsg () " receives parameter object " object ";
(7) attribute of sub-line journey " worker " analytic parameter object " object ", obtains the Quick Response Code parameter set, it may be assumed that Quick Response Code content is " abc ", and level of error correction is " L ", and size is 400px*400px, according to the Quick Response Code parameter resolved and two dimension Code standard (being herein standard GB/T/T 18284-2000 " quick response matrix code "), calculates Quick Response Code matrix " data ", Main thread is placed on the calculating process of Quick Response Code matrix " data " loaded down with trivial details for complexity in sub-line journey " worker " and calculates, and is used for alleviating The service pressure of main thread, it is also possible to improve the response efficiency of system;
(8) sub-line journey " worker " sub-line journey sends function (it is assumed herein that being " wkPostMsg () ") Quick Response Code square Battle array " data " beams back main thread;
(9) main thread main thread monitoring reception function (it is assumed herein that being " onMsg () "), monitoring reception Quick Response Code matrix " data ", and according to Quick Response Code size 400*400px set, generate corresponding with rendering function (it is assumed herein that being " fill () ") The Quick Response Code of size;
(10), after generating Quick Response Code, sub-line journey " worker " is automatically switched off, and is used for saving system resource.
Present invention also offers a kind of Quick Response Code based on multithreading and generate system, including Quick Response Code parameter setting module and Algoritic module.Quick Response Code based on multithreading generates the structural representation of system as shown in Figure 1.
Described Quick Response Code parameter setting module is for setting the relevant parameter of Quick Response Code, and described parameter at least includes Quick Response Code Content, Quick Response Code level of error correction and the size of Quick Response Code.
Described algoritic module includes main thread functional module and sub-line journey functional module.
Described main thread functional module has been used for main thread function, including: obtain Quick Response Code parameter, be packaged into parameter pair As, instantiation sub-line journey, send data, the sub-thread-data of monitoring reception to sub-line journey and render Quick Response Code.
In present invention Quick Response Code based on multithreading generation system, the workflow diagram of main thread is as it is shown on figure 3, specifically walk Rapid as follows:
Main thread obtains Quick Response Code parameter from Quick Response Code parameter setting module, including all Quick Response Code parameters set;
Main thread is packaged into parameter object Quick Response Code parameter, and parameter object is for the data between main thread and sub-line journey Communication;
The sub-line journey that main thread instantiation one is new;
Main thread sends sub-line journey packaged parameter object;
The Quick Response Code matrix that sub-line journey sends over is monitored and received to main thread;
Main thread resolves the Quick Response Code matrix received, and enters according to the Quick Response Code parameter set by Quick Response Code parameter setting module Row Quick Response Code renders.
Described sub-line journey functional module has been used for sub-line journey function, including: receive and parse through main thread parameter object, meter Calculate Quick Response Code matrix, send data to main thread.
Present invention Quick Response Code based on multithreading generates the workflow diagram of system neutron thread as shown in Figure 4, specifically walks Rapid as follows:
The Quick Response Code parameter object that monitoring reception main thread is sent;
The Quick Response Code matrix of Quick Response Code is calculated according to Quick Response Code parameter;
Quick Response Code matrix is sent back to main thread;
After sending successfully, close sub-line journey, releasing memory, save system resource.
Below it is only the detailed description of the invention of the present invention, not the present invention is done any pro forma restriction, every Any simple modification, equivalent variations or the modification done embodiment of above according to the technical spirit of the present invention, all still falls within The protection domain of technical solution of the present invention.

Claims (9)

1. a two-dimensional code generation method based on multithreading, it is characterised in that comprise the following steps:
(1) Quick Response Code parameter is set;
(2) main thread obtains Quick Response Code parameter;
(3) main thread is packaged into parameter object parameter;
(4) one sub-thread of main thread instantiation;
(5) main thread sends parameter object to sub-line journey;
(6) sub-line journey receives parameter object;
(7) sub-line journey calculates Quick Response Code matrix;
(8) sub-line journey beams back main thread Quick Response Code matrix;
(9) main thread receives Quick Response Code matrix and renders Quick Response Code;
(10) sub-line journey is closed.
2. two-dimensional code generation method based on multithreading as claimed in claim 1, it is characterised in that in step (1), described two Dimension code parameter at least includes Quick Response Code content, Quick Response Code level of error correction and the size of Quick Response Code.
3. two-dimensional code generation method based on multithreading as claimed in claim 1, it is characterised in that described Quick Response Code is matrix One or more of formula two-dimensional bar code.
4. two-dimensional code generation method based on multithreading as claimed in claim 1, it is characterised in that in step (7), according to square The criterion calculation Quick Response Code matrix of configuration Quick Response Code.
5. a Quick Response Code based on multithreading generates system, it is characterised in that include Quick Response Code parameter setting module and algorithm Module.
6. Quick Response Code based on multithreading as claimed in claim 5 generates system, it is characterised in that described Quick Response Code parameter sets Cover half block is for setting the relevant parameter of Quick Response Code, and described parameter at least includes Quick Response Code content, Quick Response Code level of error correction and two The size of dimension code.
7. Quick Response Code based on multithreading as claimed in claim 5 generates system, it is characterised in that described algoritic module includes Main thread functional module and sub-line journey functional module.
8. Quick Response Code based on multithreading as claimed in claim 5 generates system, it is characterised in that described main thread function mould Block has been used for main thread function, including: obtain Quick Response Code parameter, be packaged into parameter object, instantiation sub-line journey, to sub-line journey Send data, the sub-thread-data of monitoring reception and render Quick Response Code.
9. Quick Response Code based on multithreading as claimed in claim 5 generates system, it is characterised in that described sub-line journey function mould Block has been used for sub-line journey function, including: receive and parse through main thread parameter object, calculating Quick Response Code matrix, send out to main thread Send data.
CN201610576440.0A 2016-07-19 2016-07-19 A kind of two-dimensional code generation method based on multithreading and system Pending CN106228220A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610576440.0A CN106228220A (en) 2016-07-19 2016-07-19 A kind of two-dimensional code generation method based on multithreading and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610576440.0A CN106228220A (en) 2016-07-19 2016-07-19 A kind of two-dimensional code generation method based on multithreading and system

Publications (1)

Publication Number Publication Date
CN106228220A true CN106228220A (en) 2016-12-14

Family

ID=57531003

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610576440.0A Pending CN106228220A (en) 2016-07-19 2016-07-19 A kind of two-dimensional code generation method based on multithreading and system

Country Status (1)

Country Link
CN (1) CN106228220A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145927A (en) * 2017-04-25 2017-09-08 浙江工商大学 Two-dimensional code generation method and system based on multithreading

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1553392A (en) * 2003-12-19 2004-12-08 吉林省防伪保真技术产品开发有限公司 Two-dimensional bar code antifogery bill special seal and antifogery bill information checking network system
CN103745190A (en) * 2014-02-17 2014-04-23 云南电网公司 Two-dimensional code-based performance and monitoring data presentation method
CN103886628A (en) * 2014-03-10 2014-06-25 百度在线网络技术(北京)有限公司 Two-dimension code image generating method and device
CN104580804A (en) * 2015-01-09 2015-04-29 中科宇图天下科技有限公司 Image compression uploading method and system
CN105095866A (en) * 2015-07-17 2015-11-25 重庆邮电大学 Rapid behavior identification method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1553392A (en) * 2003-12-19 2004-12-08 吉林省防伪保真技术产品开发有限公司 Two-dimensional bar code antifogery bill special seal and antifogery bill information checking network system
CN103745190A (en) * 2014-02-17 2014-04-23 云南电网公司 Two-dimensional code-based performance and monitoring data presentation method
CN103886628A (en) * 2014-03-10 2014-06-25 百度在线网络技术(北京)有限公司 Two-dimension code image generating method and device
CN104580804A (en) * 2015-01-09 2015-04-29 中科宇图天下科技有限公司 Image compression uploading method and system
CN105095866A (en) * 2015-07-17 2015-11-25 重庆邮电大学 Rapid behavior identification method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
康春颖: ""网络二维码图片的生成算法研究"", 《黑龙江大学自然科学学报》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145927A (en) * 2017-04-25 2017-09-08 浙江工商大学 Two-dimensional code generation method and system based on multithreading

Similar Documents

Publication Publication Date Title
CN101699405B (en) Method and device for interaction between host program and plug-in and interaction between plug-ins
CN111723885B (en) Industrial Internet enterprise identification interaction system and implementation method thereof
CN104216761B (en) It is a kind of that the method for sharing equipment is used in the device that can run two kinds of operating system
CN102938081B (en) The data processing method of smart card personalization, controller and system
CN103415017A (en) Method, device and mobile terminal of virtual SIM card
CN103825811A (en) Implementation scheme for accessing sensor protocol self-identification IOT (internet of things) gateway
CN103078921B (en) A kind of transmission, the method and device of reception message
CN103118356A (en) Embedded type intelligent card e universal integrated circuit card (eUICC) activating method, system, terminal and platform
CN110798490B (en) Method and device for accessing third-party system based on data center and data center
CN103781072B (en) The implementation method and chip of a kind of terminal intelligent card
CN105554912A (en) IOT (Internet of Things) terminal based on virtual SIM/USIM
CN103107888B (en) The identity identifying method that the dynamic multi-attribute of facing moving terminal is multi-level
CN104507130A (en) SIM (Subscriber Identity Module) card and system supporting mobile communication network switching
CN104507072B (en) A kind of method of communication network switching
CN107005575A (en) A kind of smart card and its method of work with dynamic token OTP functions
CN103347248B (en) A kind of based on identity identifying method trans-regional on handheld terminal
CN101872317A (en) VxWorks multitask synchronization and communication method
CN106228220A (en) A kind of two-dimensional code generation method based on multithreading and system
CN102609840A (en) Multi-application mobile payment system
CN107295458A (en) Terminal, smart card and its between set up Bluetooth connecting method, device and server
CN111582663B (en) NQI quality service method, platform, user terminal and readable storage medium
CN109195139B (en) Data transmission method, device, platform and medium for M2M management platform and eSIM card
CN103716445A (en) Dynamic barcode-based data exchange method
CN104951417A (en) Method for achieving USB combined device suitable for high-capacity USIM
CN105653925B (en) Network trading authentication method, system and smart card

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20161214