Two-dimensional code identification method and device and new energy vehicle charging and discharging method based on two-dimensional code identification method and deviceTechnical Field
The invention belongs to the technical field of charging and discharging of new energy vehicles, and particularly relates to a two-dimensional code identification method and device required for starting charging and discharging equipment, and a new energy vehicle charging and discharging method based on the two-dimensional code identification method and device.
Background
With the popularization of new energy automobiles, the country builds great support for charge and discharge equipment, and charge and discharge equipment operators' platforms in the market are more and more. At present, the starting mode of the charging and discharging equipment is mainly started in a two-dimensional code mode. However, when two-dimensional codes are identified, the two-dimensional codes are generally analyzed according to a polling rule of the two-dimensional codes, the algorithm is not good, the problem of wasting calculation power is likely to exist, if the number of the two-dimensional codes is large, the identification time is long, and the required repeated calculation power is increased.
Disclosure of Invention
The invention aims to provide a two-dimensional code identification method capable of reducing identification time and required calculation force.
In order to achieve the above purpose, the invention adopts the following technical scheme:
the two-dimensional code identification method is used for identifying the two-dimensional code corresponding to the charging and discharging equipment of the new energy automobile to obtain the related information of the charging and discharging equipment, and comprises the following steps:
step 1: acquiring position information of a user and two-dimensional code content obtained by scanning a two-dimensional code corresponding to new energy automobile charging and discharging equipment by the user, and then executing the step 2;
step 2: calculating the two-dimensional code content by using a hash algorithm to obtain a unique value corresponding to the two-dimensional code content, and then executing the step 3;
step 3: checking whether the cache information contains the relevant information of the charging and discharging equipment corresponding to the unique value corresponding to the two-dimensional code content, if so, directly obtaining the relevant information of the charging and discharging equipment from the cache information and executing the step 6, and if not, executing the step 4;
step 4: searching an operator list of all charge and discharge devices in the range of n kilometers around the user from a database by using the position information of the user, wherein n is more than 0, obtaining a corresponding two-dimensional code analysis rule through the operator list as a specific two-dimensional code analysis rule, analyzing the two-dimensional code content by using the specific two-dimensional code analysis rule, obtaining relevant information of the charge and discharge devices from an analysis result if analysis is successful, executing step 6, and executing step 5 if analysis fails;
step 5: performing traversal analysis on the two-dimensional code content by using two-dimensional code analysis rules except the specific two-dimensional code analysis rules, obtaining relevant information of the charge and discharge equipment from analysis results if analysis is successful, and executing step 6, and not obtaining relevant information of the charge and discharge equipment if analysis fails;
step 6: and storing the unique value corresponding to the two-dimensional code content and the related information of the charging and discharging equipment as the cache information.
The related information of the charging and discharging equipment comprises the operator and equipment identity information thereof.
The invention also provides a two-dimensional code recognition system for realizing the two-dimensional code recognition method, which adopts the scheme that:
the two-dimensional code identification system is used for identifying the two-dimensional code corresponding to the charging and discharging equipment of the new energy automobile to obtain the related information of the charging and discharging equipment, and comprises a client for executing the step 1, and a server which is communicated with the client and is used for executing the steps 2 to 6.
The server is arranged in the aggregation charging and discharging platform.
The invention also provides a new energy vehicle charging and discharging method based on the two-dimensional code identification method and the system, and the new energy vehicle charging and discharging method comprises the following steps:
step one: identifying two-dimensional codes corresponding to the charging and discharging equipment of the new energy automobile by using the two-dimensional code identification method to obtain related information of the charging and discharging equipment;
step two: and carrying out communication with a corresponding third party charging and discharging platform based on the related information of the charging and discharging equipment to realize authentication, returning an authentication result, and if the authentication is passed, charging and discharging the new energy vehicle by using the charging and discharging equipment.
Due to the application of the technical scheme, compared with the prior art, the invention has the following advantages: the two-dimensional code identification method and the system can reduce the calculation force required by repeated analysis rules, can reduce the identification time of the two-dimensional code, and can realize the quick start of the charging and discharging equipment by using the new energy vehicle charging and discharging method.
Drawings
FIG. 1 is a flow chart of a two-dimensional code recognition method of the present invention.
Fig. 2 is a schematic diagram of a two-dimensional code recognition system according to the present invention.
Fig. 3 is a flowchart of the new energy vehicle charging and discharging method of the present invention.
Detailed Description
The invention will be further described with reference to examples of embodiments shown in the drawings.
Embodiment one: before using the charging and discharging equipment, a user of the new energy vehicle can use the charging and discharging equipment after the code scanning is performed on the corresponding two-dimensional code added by the charging and discharging equipment. At this time, the following two-dimensional code identification method as shown in fig. 1 is adopted to identify the two-dimensional code corresponding to the charging and discharging equipment of the new energy automobile to obtain the related information (including the operator id and equipment identity information equipment id) of the charging and discharging equipment:
a two-dimensional code identification method comprises the following steps:
step 1: acquiring the position information Location of a user and two-dimension code content QRCode obtained by scanning the two-dimension code corresponding to the charging and discharging equipment of the new energy automobile by the user, and then executing the step 2;
step 2: calculating the QRCode of the two-dimensional code content by utilizing a hash algorithm to obtain a unique value HashKey corresponding to the QRCode of the two-dimensional code content, and then executing the step 3;
step 3: checking whether the cache information contains the relevant information of the charge and discharge equipment corresponding to the unique value HashKey corresponding to the two-dimensional code content QRCode, if so (namely, the cache information contains the relevant information of the charge and discharge equipment corresponding to the unique value HashKey corresponding to the two-dimensional code content QRCode), directly obtaining the relevant information of the charge and discharge equipment from the cache information and executing the step 6, and if not (namely, the cache information does not contain the relevant information of the charge and discharge equipment corresponding to the unique value HashKey corresponding to the two-dimensional code content QRCode), executing the step 4;
step 4: searching an operator list of all charge and discharge devices in the range of n (n is more than 0, for example, n=2) kilometers around the user from a database by using the position information Location of the user, obtaining a corresponding two-dimensional code analysis rule through the operator list as a specific two-dimensional code analysis rule, analyzing the two-dimensional code content QRCode by using the specific two-dimensional code analysis rule, obtaining relevant information of the charge and discharge devices from an analysis result if the analysis is successful, executing step 6, and executing step 5 if the analysis is failed;
step 5: traversing and analyzing the QRCode of the two-dimensional code content by utilizing other two-dimensional code analysis rules except the specific two-dimensional code analysis rule, if the analysis is successful, obtaining the related information of the charge and discharge equipment from the analysis result, executing the step 6, and if the analysis fails, not obtaining the related information of the charge and discharge equipment, and prompting that the equipment information does not exist;
step 6: and storing the unique value HashKey corresponding to the two-dimensional code content QRCode and the related information (including the operator Id and the equipment identity information EquipmentId) of the charging and discharging equipment as cache information.
The two-dimensional code recognition system for realizing the two-dimensional code recognition method is shown in fig. 2, and comprises a client (APP) and a server which communicate through an HTTP protocol. The client is used for executing the step 1, and the server is used for executing the steps 2 to 6. The server may be disposed in an aggregate charge-discharge platform.
Based on the two-dimensional code identification method and the system, the new energy vehicle can realize charge and discharge by using charge and discharge equipment through the following charge and discharge method. As shown in fig. 3, the charging and discharging method of the new energy vehicle comprises the following steps:
step one: identifying two-dimension codes corresponding to the charging and discharging equipment of the new energy automobile by using the two-dimension code identification method to obtain related information of the charging and discharging equipment;
step two: and (3) carrying out communication with a corresponding third party charging and discharging platform based on the related information of the charging and discharging equipment to realize authentication, returning an authentication result, and if the authentication is passed, charging and discharging the new energy vehicle by using the charging and discharging equipment.
According to the invention, the calculation force required by repeated analysis rules is reduced by utilizing the uniqueness of the hash, and the range of the two-dimensional code analysis rules is further narrowed by utilizing the position information of the user, so that the time required by two-dimensional code identification can be reduced to a certain extent, and the charge and discharge equipment can be started rapidly.
The above embodiments are provided to illustrate the technical concept and features of the present invention and are intended to enable those skilled in the art to understand the content of the present invention and implement the same, and are not intended to limit the scope of the present invention. All equivalent changes or modifications made in accordance with the spirit of the present invention should be construed to be included in the scope of the present invention.