Message parsing method, device and server, computer readable storage medium
Technical field
The application belongs to charging pile technical field more particularly to a kind of message parsing method, device and server, computer
Readable storage medium storing program for executing.
Background technique
With science and technology and society continuous development, new energy technology application it is also more and more extensive, and electric vehicle and
Charging pile is an important directions of new energy technology.
In recent years, with the continuous growth of electric vehicle quantity, the quantity of charging pile is also increased.Each charging pile is both needed to
Data interaction is carried out with backstage, to complete the corresponding operatings such as order is paid, data are reported, powered.And under normal circumstances, charging
Stake is to carry out data interaction, the i.e. corresponding message of charging pile active upload by TCP message and backstage, receives this from the background and sets
Standby uplink message, and the uplink message is parsed, corresponding data are obtained, downlink message is then sent according to demand for control.Its
In, the currently used TCP message analysis mode in charging pile backstage is mostly the mode based on hard coded, and the data modification of hard coded is logical
It can only often be modified by edited source code and recompility executable file, flexibility is poor.
That is, the packet parsing mode based on hard coded, so that charging pile backstage cannot neatly increase equipment class
Type, modification device parameter etc., and every a set of new charging pile equipment of increase, then need additionally to develop a set of corresponding TCP message solution
Analyse agreement, larger workload and not convenient for safeguarding.
Summary of the invention
In view of this, the embodiment of the present application provides a kind of message parsing method, device and server, computer-readable storage
Medium, the flexibility to solve the problems, such as existing charging pile backstage TCP message analysis mode are poor.
The first aspect of the embodiment of the present application provides a kind of message parsing method, comprising:
Obtain the TCP message that charging pile uploads;
The message parameter information of the preconfigured charging pile is searched, the message parameter information includes parameter type letter
Breath, parameter start frame information and parameter length information;
According to the message parameter information, the TCP message is parsed, obtains packet parsing result.
With reference to first aspect, in a kind of feasible implementation, it is described acquisition charging pile upload TCP message it
Before, further includes:
Obtain the TCP message configuration information of the charging pile of user's typing;
By the facility information associated storage of the TCP message configuration information and the charging pile, the message parameter is obtained
Information.
With reference to first aspect, in a kind of feasible implementation, by the TCP message configuration information and the charging
The facility information associated storage of stake, after obtaining the message parameter information, further includes:
According to the facility information of the message parameter information and the charging pile, message parameter configuration template is generated.
With reference to first aspect, in a kind of feasible implementation, in the charging pile for obtaining user's typing
Before TCP message configuration information, further includes:
According to the facility information of the charging pile, pre-stored target configuration template is judged whether there is;
When there are the target configuration template, then the charging pile is reported automatically according to the target configuration template
Literary parameter configuration operation;
When the target configuration template is not present, then enter the TCP report of the charging pile for obtaining user's typing
The step of literary configuration information.
With reference to first aspect, in a kind of feasible implementation, described according to the message parameter information, institute is parsed
TCP message is stated, after obtaining packet parsing result, further includes:
By the Data Format Transform of the packet parsing result at preset format;
The packet parsing result of the preset format is transmitted to operation layer.
The second aspect of the embodiment of the present application provides a kind of packet parsing device, comprising:
Receive message module, for obtaining the TCP message of charging pile upload;
Searching module, for searching the message parameter information of the preconfigured charging pile, the message parameter information
Including parameter type information, parameter start frame information and parameter length information;
Parsing module, for parsing the TCP message, obtaining packet parsing result according to the message parameter information.
In conjunction with second aspect, in a kind of feasible implementation, further includes:
Configuration information obtains module, the TCP message configuration information of the charging pile for obtaining user's typing;
Associated storage module, for by the facility information associated storage of the TCP message configuration information and the charging pile,
Obtain the message parameter information.
In conjunction with second aspect, in a kind of feasible implementation, further includes:
Template generation module generates message for the facility information according to the message parameter information and the charging pile
Parameter configuration template.
In conjunction with second aspect, in a kind of feasible implementation, further includes:
Judgment module judges whether there is pre-stored target configuration for the facility information according to the charging pile
Template;
Module is automatically configured, for when there are the target configuration template, then automatically according to the target configuration template
Message parameter configuration operation is carried out to the charging pile;
Into module, for when the target configuration template is not present, then entering the described of acquisition user's typing
The step of TCP message configuration information of charging pile.
In conjunction with second aspect, in a kind of feasible implementation, further includes:
Format converting module, for by the Data Format Transform of the packet parsing result at preset format;
Transmission module, for the packet parsing result of the preset format to be transmitted to operation layer.
The third aspect of the embodiment of the present application provides a kind of server, including memory, processor and is stored in described
In memory and the computer program that can run on the processor, the processor are realized when executing the computer program
Such as the step of any one of above-mentioned first aspect the method.
The fourth aspect of the embodiment of the present application provides a kind of computer readable storage medium, the computer-readable storage medium
Matter is stored with computer program, and the side as described in above-mentioned any one of first aspect is realized when the computer program is executed by processor
The step of method.
Existing beneficial effect is the embodiment of the present application compared with prior art: by being pre-configured with each charging pile
The relevant parameter of TCP message, according to the TCP message of the message parameter information parsing charging pile configured, i.e., with parameter configuration
Form carries out the TCP message parsing of charging pile, in this way when parameter is modified or needs to access new charging pile equipment, no
With edited source code or again corresponding packet parsing agreement is developed, flexibility is higher, and workload is smaller and easy to maintain.
Detailed description of the invention
It in order to more clearly explain the technical solutions in the embodiments of the present application, below will be to embodiment or description of the prior art
Needed in attached drawing be briefly described, it should be apparent that, the accompanying drawings in the following description is only some of the application
Embodiment for those of ordinary skill in the art without any creative labor, can also be according to these
Attached drawing obtains other attached drawings.
Fig. 1 is the framework schematic block diagram of charging pile power supply system provided by the embodiments of the present application;
Fig. 2 is a kind of schematic process flow diagram of message parsing method provided by the embodiments of the present application;
Fig. 3 is a kind of another schematic process flow diagram of message parsing method provided by the embodiments of the present application;
Fig. 4 is a kind of structural schematic block diagram of packet parsing device provided by the embodiments of the present application;
Fig. 5 is the schematic diagram of server provided by the embodiments of the present application.
Specific embodiment
In being described below, for illustration and not for limitation, the tool of such as particular system structure, technology etc is proposed
Body details, so as to provide a thorough understanding of the present application embodiment.However, it will be clear to one skilled in the art that there is no these specific
The application also may be implemented in the other embodiments of details.In other situations, it omits to well-known system, device, electricity
The detailed description of road and method, so as not to obscure the description of the present application with unnecessary details.
Before introducing the specific technical solution of the embodiment of the present application, the embodiment of the present application may relate to first application
Explanation is introduced in scene.
The framework schematic block diagram of charging pile power supply system shown in Figure 1, the system include at least one charging pile 11,
Charging pile manages platform 12, equipment access platform 13 and intelligent mobile terminal 14.Wherein, charging pile management platform connects with equipment
Enter Platform communication connection, equipment access platform and at least one charging pile communicate to connect, and intelligent mobile terminal can be with charging pile
Manage platform, charging pile communication connection.
Equipment access platform can receive the message that each charging pile uploads, root for accessing each charging pile equipment
The message is parsed according to message configuration information and obtains parsing result, which is transferred to charging pile management platform;It can also be with
The instruction or message that forwarding charging pile management platform issues;The message that charging pile management platform is sent can also be received and match confidence
Breath carries out message configuration according to the message configuration information.Certainly, which can also have other function, herein
It is not construed as limiting.
Charging pile management platform can be used for being managed each charging pile, for example, the payment of charging order, charging pile supply
Electric control etc..And intelligent mobile terminal can be, for example, but be not limited to mobile phone, tablet computer etc., it can be real by the mobile terminal
The functions such as now scanning payment, order generate, order is paid.
Wherein, the data interaction between equipment access platform and charging pile is to be realized by message protocol, and equipment connects
Enter between platform and different types of charging pile, used message protocol is different.Currently based on the packet parsing of hard coded
Mode accesses new charging pile equipment if necessary, and the charging pile equipment of the new access is the charging accessed different from before
Stake, then need developer to develop a set of new message protocol again, to guarantee between the charging pile equipment newly accessed and backstage
Normal data interaction.In addition, if needing to modify message parameter either modifies other parameters, then need again to source code
It is edited.
In a kind of charging scenarios, charging car owner can scan the two dimensional code on charging pile by mobile phone, enter charging
Order interface, in the charging order interface, charging car owner can fill in the relevant informations such as charging duration, the charging amount of money, then
It generates charging order and is uploaded to server, server is by completing order payment with interacting for mobile phone;Then, server can be with
It controls corresponding charging pile and executes powered operation;Charging car owner can be connected to by charging adapter etc. the plug of charging pile into
Row charging, during the charging process, charging pile can report the charge datas such as charging current, voltage to equipment by way of message
Access platform, equipment access platform parse the message according to message configuration information, obtain packet parsing as a result, then by the report
Literary parsing result is transmitted to charging pile management platform.
It should be noted that above-mentioned mentioned application scenarios are only some exemplary scenes, do not cause to this Shen
Please embodiment concrete scene restriction.
It, below will be to skill provided by the embodiments of the present application after having introduced the application scenarios that the embodiment of the present application may relate to
Art scheme describes in detail explanation.In order to illustrate technical solution described herein, carried out below by specific embodiment
Explanation.
Embodiment one
Explanation will be introduced to message parsing method from equipment access platform end in the present embodiment.
Fig. 2 is referred to, is a kind of schematic process flow diagram of message parsing method provided by the embodiments of the present application, this method can
With the following steps are included:
Step S201, the TCP message that charging pile uploads is obtained.
It is understood that the type of above-mentioned TCP message can be arbitrary, i.e., the message can be charging pile and equipment
Any message transmitted between access platform, for example, logging in message, telemetering message etc..And the system of the TCP message can be and appoint
Meaning, i.e. the message message that can be 16 systems is also possible to the message of other systems, is not limited thereto.
Step S202, the message parameter information of preconfigured charging pile is searched, message parameter information includes parameter type
Information, parameter start frame information and parameter length information.
It should be noted that above-mentioned parameter type information refers to the information for characterizing which kind of parameter is the parameter be, i.e., by being somebody's turn to do
Parameter type information can learn the relevant informations such as corresponding parameter name.Parameter start frame information refers to that characterizing the parameter is reporting
Start frame in text is the information of which frame.Parameter length information refers to the letter for characterizing the shared length of the parameter in messages
Breath.
The message parameter information is that equipment access platform receives and stores the configuration information that issues of charging pile management platform and obtains
It arrives.Specifically, user can input corresponding message configuration parameter, then charging pile by the administration page of management platform
Platform is managed according to the configuration information of user, which is issued to equipment access platform, equipment access platform can incite somebody to action
The configuration information and corresponding charging pile are associated storage, can be according to filling after the message for receiving charging pile upload
The facility information of electric stake searches the configuration information of the charging pile, and is parsed according to the configuration information to the message.
Wherein, the message parameter information searching process of charging pile can be especially by the facility information of charging pile, the charging
The facility information of stake can be specially unique ID of charging pile etc..
Step S203, according to message parameter information, TCP message is parsed, packet parsing result is obtained.
Specifically, after finding out message parameter information, can according to configured parameter name, parameter start frame,
The information such as parameter length parse all parameters included in the TCP message.The packet parsing result includes parameters
Numerical value.
As can be seen that carrying out the TCP message parsing of charging pile by way of parameter configuration, modifies or need in parameter
When accessing new charging pile equipment, develop corresponding packet parsing agreement without edited source code or again, flexibility compared with
Height, workload are smaller and easy to maintain.
Embodiment two
Fig. 3 is referred to, is a kind of another schematic process flow diagram of message parsing method provided by the embodiments of the present application, it should
Method may comprise steps of:
Step S301, according to the facility information of charging pile, pre-stored target configuration template is judged whether there is;When depositing
In target configuration template, S302 is entered step;When target configuration template is not present, S303 is entered step.
Specifically, by facility informations such as unique ID of charging pile, equipment access platform, which is searched, locally to be filled with the presence or absence of this
The corresponding configuration template of electric stake.Wherein, the corresponding configuration template of the charging pile can refer to the corresponding configuration mould of such charging pile
Plate is previously provided with corresponding message parameter configuration template to such charging pile;It is also possible to that this charging pile is corresponding to match
Set template.If corresponding configuration template can be found, parameter configuration can be carried out according to the configuration template automatically, it can not
User's manual configuration is needed if corresponding configuration template cannot be found with user's manual configuration.
Wherein, which refers to the corresponding configuration template of the charging pile, may include in the configuration template but
It is not limited to the parameter configurations such as parameter name, parameter start frame, parameter length.
Step S302, message parameter configuration operation is carried out to charging pile automatically according to target configuration template.
Step S303, the TCP message configuration information of the charging pile of user's typing is obtained.
Specifically, user by charging pile manage platform administration page, can according to the type etc. of charging pile equipment, if
Setting the message parameter of the charging pile equipment can be handed down to and set after charging pile management platform gets the configuration information of user
Standby access platform.
Wherein, which includes but is not limited to the correlations such as parameter name, parameter length, parameter start frame
Information.
Step S304, by the facility information associated storage of TCP message configuration information and charging pile, message parameter letter is obtained
Breath.
It specifically, can be by the TCP message configuration information after equipment access platform receives TCP message configuration information
It is managed storage with the facility information of charging pile, obtains appreciation message parameter information.
Step S305, according to the facility information of message parameter information and charging pile, message parameter configuration template is generated.
Specifically, after the completion of user configures for some or certain a kind of charging pile, equipment access platform can be automatic
Configuration template is generated according to the configuration of user, in this way, can then call this automatically at the time of encountering this kind of charging piles again later
Configuration template carries out parameter configuration, does not have to user's manual configuration again, improves the efficiency of parameter configuration and the experience of user.
Step S306, the TCP message that charging pile uploads is obtained.
Step S307, the message parameter information of preconfigured charging pile is searched, message parameter information includes parameter type
Information, parameter start frame information and parameter length information.
Step S308, according to message parameter information, TCP message is parsed, packet parsing result is obtained.
It should be noted that step S306~S308 is identical as the step S201~S203 of above-described embodiment one, correlation is situated between
It continues and refers to corresponding contents above, details are not described herein.
Step S309, by the Data Format Transform of packet parsing result at preset format.
Specifically, after equipment access platform obtains packet parsing result, which can be passed to
Operation layer, so that operation layer carries out corresponding business processing operation according to the result.And operation layer generally has data format
Therefore certain requirement can carry out the conversion of data format before being transmitted.
Specifically, packet parsing result is organized into the manageable data format of business in the form of key-value.Its
In, which can determine according to the operation layer of required transmission, be not limited thereto.
Step S310, the packet parsing result of preset format is transmitted to operation layer.
It should be noted that in some embodiments, step S301~S305 and step S308~S309 are optional
's.
As can be seen that the present embodiment carries out the TCP message parsing of charging pile by way of parameter configuration, modified in parameter
Or when needing to access new charging pile equipment, corresponding packet parsing agreement is developed without edited source code or again,
Flexibility is higher, and workload is smaller and easy to maintain.Further, it is also possible to carry out parameter configuration automatically according to configuration template, and can
To automatically generate configuration template according to user configuration, to improve the efficiency and user experience of parameter configuration.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process
Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present application constitutes any limit
It is fixed.
Embodiment three
Fig. 4 is referred to, is a kind of structural schematic block diagram of packet parsing device provided by the embodiments of the present application, which can
To include:
Receive message module 41, for obtaining the TCP message of charging pile upload;
Searching module 42, for searching the message parameter information of preconfigured charging pile, message parameter information includes ginseng
Number type information, parameter start frame information and parameter length information;
Parsing module 43, for parsing TCP message, obtaining packet parsing result according to message parameter information.
In a kind of feasible implementation, above-mentioned apparatus can also include:
Configuration information obtains module, the TCP message configuration information of the charging pile for obtaining user's typing;
Associated storage module, for obtaining message for the facility information associated storage of TCP message configuration information and charging pile
Parameter information.
In a kind of feasible implementation, above-mentioned apparatus can also include:
Template generation module generates message parameter configuration for the facility information according to message parameter information and charging pile
Template.
In a kind of feasible implementation, above-mentioned apparatus can also include:
Judgment module judges whether there is pre-stored target configuration template for the facility information according to charging pile;
Module is automatically configured, for when there are target configuration template, then automatically according to target configuration template to charging pile
Carry out message parameter configuration operation;
Into module, for when target configuration template is not present, then entering the TCP report for obtaining the charging pile of user's typing
The step of literary configuration information.
In a kind of feasible implementation, above-mentioned apparatus can also include:
Format converting module, for by the Data Format Transform of packet parsing result at preset format;
Transmission module, for the packet parsing result of preset format to be transmitted to operation layer.
It should be noted that the embodiment one of the packet parsing device of the present embodiment and message parsing method above is a pair of
It answers, related or similar introduction refers to corresponding contents above, and details are not described herein.
As can be seen that the present embodiment carries out the TCP message parsing of charging pile by way of parameter configuration, modified in parameter
Or when needing to access new charging pile equipment, corresponding packet parsing agreement is developed without edited source code or again,
Flexibility is higher, and workload is smaller and easy to maintain.
Example IV
Fig. 5 is the schematic diagram for the server that one embodiment of the application provides.As shown in figure 5, the server 5 of the embodiment wraps
It includes: processor 50, memory 51 and being stored in the computer that can be run in the memory 51 and on the processor 50
Program 52.The processor 50 realizes the step in above-mentioned each message parsing method embodiment when executing the computer program 52
Such as step S201 to S203 shown in Fig. 2 suddenly,.Alternatively, the processor 50 is realized when executing the computer program 52
State each module or the function of unit in each Installation practice, such as the function of module 41 to 43 shown in Fig. 4.
Illustratively, the computer program 52 can be divided into one or more modules or unit, it is one or
The multiple modules of person or unit are stored in the memory 51, and are executed by the processor 50, to complete the application.It is described
One or more modules or unit can be the series of computation machine program instruction section that can complete specific function, which uses
In implementation procedure of the description computer program 52 in the server 5.For example, the computer program 52 can be divided
It is cut into Receive message module, searching module and parsing module, each module concrete function is as follows:
Receive message module, for obtaining the TCP message of charging pile upload;Searching module, it is preconfigured for searching
The message parameter information of charging pile, message parameter information include parameter type information, parameter start frame information and parameter length letter
Breath;Parsing module, for parsing TCP message, obtaining packet parsing result according to message parameter information.
Wherein, one or more servers 5 can form above equipment access platform.The server may include,
But it is not limited only to, processor 50, memory 51.It will be understood by those skilled in the art that Fig. 5 is only the example of server 5, and
The restriction to server 5 is not constituted, may include perhaps combining certain components or not than illustrating more or fewer components
Same component, such as the server can also include input-output equipment, network access equipment, bus etc..
Alleged processor 50 can be central processing unit (Central Processing Unit, CPU), can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processor
Deng.
The memory 51 can be the internal storage unit of the server 5, such as the hard disk or memory of server 5.
The memory 51 is also possible to the External memory equipment of the server 5, such as the plug-in type being equipped on the server 5 is hard
Disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card
(Flash Card) etc..Further, the memory 51 can also both include the internal storage unit of the server 5 or wrap
Include External memory equipment.The memory 51 is for other programs needed for storing the computer program and the server
And data.The memory 51 can be also used for temporarily storing the data that has exported or will export.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each function
Can unit, module division progress for example, in practical application, can according to need and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of described device is divided into different functional unit or module, more than completing
The all or part of function of description.Each functional unit in embodiment, module can integrate in one processing unit, can also
To be that each unit physically exists alone, can also be integrated in one unit with two or more units, it is above-mentioned integrated
Unit both can take the form of hardware realization, can also realize in the form of software functional units.In addition, each function list
Member, the specific name of module are also only for convenience of distinguishing each other, the protection scope being not intended to limit this application.Above system
The specific work process of middle unit, module, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodiment
The part of load may refer to the associated description of other embodiments.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure
Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
It is implemented in hardware or software, the specific application and design constraint depending on technical solution.Professional technician
Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed
Scope of the present application.
In embodiment provided herein, it should be understood that disclosed device, server and method, Ke Yitong
Other modes are crossed to realize.For example, device described above, server example are only schematical, for example, the mould
The division of block or unit, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple
Unit or assembly can be combined or can be integrated into another system, or some features can be ignored or not executed.It is another
Point, shown or discussed mutual coupling or direct-coupling or communication connection can be through some interfaces, device or
The INDIRECT COUPLING or communication connection of unit can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated module or unit are realized in the form of SFU software functional unit and sell as independent product
Or it in use, can store in a computer readable storage medium.Based on this understanding, the application realizes above-mentioned reality
The all or part of the process in a method is applied, relevant hardware can also be instructed to complete by computer program, it is described
Computer program can be stored in a computer readable storage medium, the computer program when being executed by processor, it can be achieved that
The step of above-mentioned each embodiment of the method.Wherein, the computer program includes computer program code, the computer program
Code can be source code form, object identification code form, executable file or certain intermediate forms etc..Computer-readable Jie
Matter may include: can carry the computer program code any entity or device, recording medium, USB flash disk, mobile hard disk,
Magnetic disk, CD, computer storage, read-only memory (ROM, Read-Only Memory), random access memory (RAM,
Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that described
The content that computer-readable medium includes can carry out increasing appropriate according to the requirement made laws in jurisdiction with patent practice
Subtract, such as does not include electric carrier signal and electricity according to legislation and patent practice, computer-readable medium in certain jurisdictions
Believe signal.
Embodiment described above is only to illustrate the technical solution of the application, rather than its limitations;Although referring to aforementioned reality
Example is applied the application is described in detail, those skilled in the art should understand that: it still can be to aforementioned each
Technical solution documented by embodiment is modified or equivalent replacement of some of the technical features;And these are modified
Or replacement, the spirit and scope of each embodiment technical solution of the application that it does not separate the essence of the corresponding technical solution should all
Comprising within the scope of protection of this application.