CN116566969A - Protocol downloading method, device, equipment and storage medium - Google Patents

Protocol downloading method, device, equipment and storage medium Download PDF

Info

Publication number
CN116566969A
CN116566969A CN202211520198.7A CN202211520198A CN116566969A CN 116566969 A CN116566969 A CN 116566969A CN 202211520198 A CN202211520198 A CN 202211520198A CN 116566969 A CN116566969 A CN 116566969A
Authority
CN
China
Prior art keywords
protocol
target
interface
management structure
preset
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
CN202211520198.7A
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.)
Hangzhou Hollysys Automation Co Ltd
Original Assignee
Hangzhou Hollysys Automation Co Ltd
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 Hangzhou Hollysys Automation Co Ltd filed Critical Hangzhou Hollysys Automation Co Ltd
Priority to CN202211520198.7A priority Critical patent/CN116566969A/en
Publication of CN116566969A publication Critical patent/CN116566969A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Communication Control (AREA)

Abstract

The application discloses a protocol downloading method, a device, equipment and a storage medium, which relate to the field of network communication and comprise the following steps: acquiring a target protocol through a preset instance callback interface, determining protocol configuration data, and determining a target interface index and a target channel index according to the protocol configuration data; binding the target interface index, the target channel index and protocol configuration data to a preset protocol management structure; invoking a target downloading interface through the target interface index, analyzing protocol configuration data through the target downloading interface, and determining configuration data corresponding to a protocol to be downloaded; and calling a target sending interface through the target channel index, and sending configuration data corresponding to the protocol to be downloaded to a preset protocol main card so that the preset protocol main card downloads the corresponding protocol according to the received configuration data. In this way, the downloading of a plurality of different protocols can be realized by the protocol downloading method, and the efficiency of downloading different protocols by the protocol main card is effectively improved.

Description

Protocol downloading method, device, equipment and storage medium
Technical Field
The present invention relates to the field of network communications, and in particular, to a protocol downloading method, apparatus, device, and storage medium.
Background
With the development of PLC (Programmable Logic Controller ) products, PLC products are increasingly frequently applied to various application scenarios such as high-end equipment, complex machines, production line control, etc., and multi-protocol integration is generally divided into two modes at present.
The first mode is an ontology integration mode, each protocol in the interaction part of controller software (RTS) and protocol layer codes is independent, and for three links of periodic input data reading and periodic output data writing in four links of protocol processing and processing of diagnostic data, there are many similarities among different protocols, each protocol independently exists and can lead to a large number of redundant codes, and repeated workload is also brought in the stages of code maintenance and product maintenance.
The second mode is an integration mode aiming at the communication module, and the RTS code and the protocol layer code are one-to-one processing modes, and if different protocol types appear on the same communication module, and the two different protocol types have great difference in the processing flow in the controller software, great problems in compatibility and maintainability can be brought.
It follows that both of the above approaches may present compatibility and redundancy issues when downloading different types of protocols.
Disclosure of Invention
Accordingly, the present invention aims to provide a protocol downloading method, device, equipment and storage medium, which can download different types of protocols through the same set of procedures and downloading interfaces, thereby avoiding the use of different procedures for different protocols, improving the compatibility of the protocol main card when downloading different protocols, and effectively reducing the redundancy of codes when downloading multiple protocols. The specific scheme is as follows:
in a first aspect, the present application discloses a protocol downloading method, including:
acquiring a target protocol through a preset instance callback interface, determining protocol configuration data corresponding to the target protocol, determining a target interface index in a first management structure and determining a target channel index in a second management structure according to the protocol configuration data;
binding the target interface index, the target channel index and the protocol configuration data to a preset protocol management structure;
invoking a target downloading interface through the target interface index in the preset protocol management structure, analyzing the protocol configuration data through the target downloading interface, and determining configuration data corresponding to a protocol to be downloaded from the analyzed protocol configuration data;
And calling a target sending interface through the target channel index in the preset protocol management structure, and sending configuration data corresponding to the protocol to be downloaded to a preset protocol main card through the target sending interface so that the preset protocol main card downloads the corresponding protocol according to the received configuration data.
Optionally, the obtaining the target protocol through the preset instance callback interface, determining protocol configuration data corresponding to the target protocol, determining a target interface index in the first management structure according to the configuration data, and before determining a target channel index in the second management structure, further includes:
adding a target interface group to the first management structure, and judging whether to create a personalized download interface; the target interface group comprises a plurality of functional interfaces;
if yes, initializing the personalized download interface to the first management structure to finish interface initialization;
providing the device number, the channel number and the interface function to the second management structure so as to complete channel initialization.
Optionally, the invoking the target downloading interface through the target interface index in the preset protocol management structure, analyzing the protocol configuration data through the target downloading interface, and determining configuration data corresponding to the protocol to be downloaded from the analyzed protocol configuration data, including:
Invoking a target downloading interface of the target interface group in the first management structure according to the target interface index in the preset protocol management structure;
analyzing the protocol configuration data through a downloading function in the target downloading interface, and determining configuration data corresponding to a protocol to be downloaded from the analyzed protocol configuration data.
Optionally, the protocol downloading method may further include:
invoking a read input data function interface in the target interface group in the first management structure according to the target interface index in the preset protocol management structure, and processing periodic input data of the target protocol through the read input data function interface to obtain processed periodic input data;
acquiring a read input function interface in the second management structure through the target channel index in the preset protocol management structure, and writing the processed periodic input data into a preset input data area through the read input function interface;
invoking a write output data function interface in the target interface group in the first management structure according to the target interface index, and processing the periodic output data of the target protocol through the write output data function interface to obtain processed periodic output data;
And acquiring a write output function interface in the second management structure through the target channel index in the preset protocol management structure, and writing the processed periodic output data into a target channel protocol through the write output function interface.
Optionally, the protocol downloading method may further include:
calling a read diagnosis data function interface in the target interface group in the first management structure according to the target interface index in the preset protocol management structure, and processing diagnosis data in the target protocol through the read diagnosis data function interface to obtain processed diagnosis data;
and acquiring a read diagnosis function interface in the second management structure through the target channel index in the preset protocol management structure, and writing the processed diagnosis data into a preset diagnosis data area by utilizing the read diagnosis function interface.
Optionally, the protocol downloading method may further include:
invoking a target state data function interface in the target interface group in the first management structure according to the target interface index in the preset protocol management structure, and processing state data in the target protocol through the target state data function interface to obtain processed state data;
And acquiring the target state function interface in the second management structure through a target channel index in a preset protocol management structure, and setting and/or acquiring the processed state data according to the target state function interface so as to complete the state setting and/or acquiring of the target protocol.
Optionally, after the preset protocol main card downloads the corresponding protocol according to the received configuration data, the method may further include:
judging whether the number of the protocols which are downloaded completely reaches the preset number of the protocols or not;
if the number of the preset protocols is not reached, re-jumping to the step of acquiring the target protocol through the callback interface of the preset instance so as to download the next protocol;
and ending the protocol downloading if the preset number of protocols is reached.
In a second aspect, the present application discloses a protocol downloading apparatus, including:
the index determining module is used for acquiring a target protocol through a preset instance callback interface, determining protocol configuration data corresponding to the target protocol, determining a target interface index in a first management structure according to the configuration data, and determining a target channel index in a second management structure.
The data binding module is used for binding the target interface index, the target channel index and the protocol configuration data to a preset protocol management structure;
the data analysis module is used for calling a target downloading interface through the target interface index in the preset protocol management structure, analyzing the protocol configuration data through the target downloading interface, and determining configuration data corresponding to a protocol to be downloaded from the analyzed protocol configuration data;
and the protocol downloading module is used for calling a target sending interface through the target channel index in the preset protocol management structure and sending the configuration data corresponding to the protocol to be downloaded to a preset protocol main card through the target sending interface so that the preset protocol main card can determine that the corresponding protocol is downloaded according to the received configuration data.
In a third aspect, the present application discloses an electronic device comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the protocol downloading method as previously disclosed.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program which when executed by a processor implements a protocol downloading method as previously disclosed.
In the application, a target protocol is acquired through a preset instance callback interface, protocol configuration data corresponding to the target protocol is determined, a target interface index is determined in a first management structure according to the protocol configuration data, a target channel index is determined in a second management structure, and the target interface index, the target channel index and the protocol configuration data are bound to a preset protocol management structure. And then, calling a target downloading interface through the target interface index in the preset protocol management structure, analyzing the protocol configuration data through the target downloading interface, determining the configuration data corresponding to the protocol to be downloaded from the analyzed protocol configuration data, and finally, calling a target sending interface through the target channel index in the preset protocol management structure, and sending the configuration data corresponding to the protocol to be downloaded to a preset protocol main card through the target sending interface so that the preset protocol main card downloads the corresponding protocol according to the received configuration data. Therefore, the interface to be used can be determined through the preset index, the protocol data is analyzed through the determined interface, and the analyzed data is transmitted to the preset protocol main card, so that the protocol main card downloads the corresponding protocol according to the received configuration data after receiving the data. In this way, different types of protocols can be downloaded through the same set of processes and download interfaces, so that different processes are prevented from being adopted for different protocols, compatibility of a protocol main card when different protocols are downloaded is improved, and redundancy of codes when multiple protocols are downloaded is effectively reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a protocol downloading method provided in the present application;
fig. 2 is a general implementation framework diagram of the IODriver provided in the present application;
FIG. 3 is a diagram of an IOdriver interface initialization process provided in the present application;
fig. 4 is a process diagram of initializing an IODriver device channel provided in the present application;
FIG. 5 is a configuration data binding diagram provided herein;
FIG. 6 is a flowchart of a specific protocol downloading method provided in the present application;
FIG. 7 is a flowchart of a specific protocol downloading method provided in the present application;
FIG. 8 is a flowchart of a specific protocol downloading method provided in the present application;
fig. 9 is a schematic structural diagram of a protocol downloading method and device provided in the present application;
fig. 10 is a block diagram of an electronic device provided in the present application.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
At present, multiprotocol integration is generally divided into two modes, one mode is an ontology integration mode, in which each protocol in the interaction part of controller software and protocol layer codes exists independently, but there are many similarities among different protocols, and the independent existence of each protocol can lead to a large amount of redundant codes. Another way is to integrate the communication modules, and when different protocol types appear on the same communication module and there is a large difference in the processing flow of the two different protocol types in the controller software, compatibility problems are brought.
In order to overcome the technical problems, the application provides a protocol downloading method, which can download different types of protocols through the same set of processes and downloading interfaces, avoids adopting different processes aiming at different protocols, improves the compatibility of a protocol main card when downloading different protocols, and effectively reduces the redundancy of codes when downloading multiple protocols.
Referring to fig. 1, the embodiment of the invention discloses a protocol downloading method, which comprises the following steps:
step S11, a target protocol is acquired through a preset instance callback interface, protocol configuration data corresponding to the target protocol is determined, a target interface index is determined in a first management structure according to the protocol configuration data, and a target channel index is determined in a second management structure.
In this embodiment, a target protocol is acquired through a preset instance callback interface, protocol configuration data corresponding to the target protocol is determined, a target interface index is determined in a first management structure according to the protocol configuration data, and a target channel index is determined in a second management structure. That is, the target protocol to be downloaded is obtained first by using the preset instance callback interface, and the preset instance callback interface is a preset IODriver callback interface, where the target protocol may be multiple types of protocols, and the overall implementation framework of the IODriver is shown in fig. 2, after the target protocol is obtained, protocol configuration data issued by AT configuration software corresponding to the target protocol is determined, and a target interface index is determined in a preset first management structure, that is, a preset Driver management structure, through the protocol configuration data, and a target channel index is determined in a preset second management structure, that is, a preset device management structure. It should be noted that, the IODriver callback interface refers to an abstract interface of different types of protocol instances in the callback IODriver in the controller software. The Driver management structure refers to management of abstract interfaces interacted with a protocol in controller software, when personalized processing of a special protocol does not exist, driver interface management refers to Driver interfaces in a target interface group, and when personalized processing of the special protocol exists, the Driver interfaces are added to the Driver management structure in a registration mode through rewriting the personalized interfaces. The device management structure refers to management of protocol instance channel information supported in a communication module on the system in controller software, and is a storage structure used as different types of protocol processing link information.
It should be further noted that, the obtaining the target protocol through the preset instance callback interface, determining protocol configuration data corresponding to the target protocol, determining a target interface index in the first management structure according to the configuration data, and before determining a target channel index in the second management structure, further includes: adding a target interface group to the first management structure, and judging whether to create a personalized download interface; the target interface group comprises a plurality of functional interfaces; if yes, initializing the personalized download interface to the first management structure to finish interface initialization; providing the device number, the channel number and the interface function to the second management structure so as to complete channel initialization. That is, after the system is started, as shown in fig. 3, drv interface initialization is performed, and a target interface group is added to a Driver management structure, if a personalized interface is created, the created personalized interface is added to the Driver management structure, so that interface initialization is completed, and interfaces included in the target interface group correspond to different types of protocols. After the drv itfinit is completed, the communication module is put on line, and as shown in fig. 4, devlnstanceinit (device channel initialization) is performed, and the device number, the channel number, and the interface function are provided to the device management structure so as to complete the channel initialization.
Step S12, binding the target interface index, the target channel index and the protocol configuration data to a preset protocol management structure.
In this embodiment, the target interface index, the target channel index and the protocol configuration data are bound to a preset protocol management structure, that is, after determining the target interface index in the Driver management structure and the target channel index in the device management structure by the protocol configuration data, the target interface index, the target channel index and the protocol configuration data need to be bound to the preset protocol management structure so as to invoke the protocol configuration data in different protocol layers. It should be noted that if no personalized processing interface is registered during initialization, the protocol is bound with the Driver interface in the target interface group according to the index corresponding to the protocol. And then searching a corresponding equipment instance channel index in the equipment management structure according to the equipment channel and the protocol type information in the configuration protocol, and binding the equipment instance channel index in the protocol instance management structure, wherein the binding process is shown in fig. 5.
And S13, calling a target downloading interface through the target interface index in the preset protocol management structure, analyzing the protocol configuration data through the target downloading interface, and determining the configuration data corresponding to the protocol to be downloaded from the analyzed protocol configuration data.
In this embodiment, a target downloading interface is called through a target interface index, the protocol configuration data is parsed through the target downloading interface, and a specific implementation method of the configuration data corresponding to the protocol to be downloaded is determined as follows: invoking a target downloading interface of the target interface group in the first management structure according to the target interface index in the preset protocol management structure; analyzing the protocol configuration data through a downloading function in the target downloading interface, and determining configuration data corresponding to a protocol to be downloaded from the analyzed protocol configuration data. That is, the target interface index in the preset protocol management structure is used for determining a target downloading interface capable of analyzing the configuration data, and it is required to be explained that the target interface index needs to be selected according to the type of the protocol, and after the target downloading interface is determined, the function in the target downloading interface is used for analyzing the protocol configuration data so as to determine the configuration data corresponding to the protocol to be downloaded.
Step S14, a target sending interface is called through the target channel index in the preset protocol management structure, and the configuration data corresponding to the protocol to be downloaded is sent to a preset protocol main card through the target sending interface, so that the preset protocol main card downloads the corresponding protocol according to the received configuration data.
In this embodiment, a target sending interface is called through the target channel index in the preset protocol management structure, and the configuration data corresponding to the protocol to be downloaded is sent to a preset protocol main card through the target sending interface, so that the preset protocol main card downloads the corresponding protocol according to the received configuration data. That is, a target channel index in a preset protocol management structure to be called is determined according to a protocol type, a corresponding target sending interface is determined through the target channel index, and configuration data corresponding to a protocol to be downloaded, which is obtained through analysis of a target downloading interface, is sent to a protocol main card by utilizing the target sending interface, so that the protocol main card downloads the corresponding protocol after receiving the configuration data.
It should be noted that, after the preset protocol main card downloads the corresponding protocol according to the received configuration data, the method further includes: judging whether the number of the protocols which are downloaded completely reaches the preset number of the protocols or not; if the number of the preset protocols is not reached, re-jumping to the step of acquiring the target protocol through the callback interface of the preset instance so as to download the next protocol; and ending the protocol downloading if the preset number of protocols is reached. That is, after downloading the current protocol, determining whether all the protocols to be downloaded are downloaded by judging whether the number of the downloaded protocols reaches the preset number of the protocols, if so, determining that all the protocols to be downloaded are downloaded, and if not, re-jumping to the step of obtaining the target protocol through the callback interface of the preset instance so as to perform downloading operation of the next protocol.
It can be seen that in this embodiment, a target protocol is first obtained through a preset instance callback interface, protocol configuration data corresponding to the target protocol is determined, a target interface index is determined in a first management structure and a target channel index is determined in a second management structure according to the protocol configuration data, and the target interface index, the target channel index and the protocol configuration data are bound to a preset protocol management structure. And then, calling a target downloading interface through the target interface index in the preset protocol management structure, analyzing the protocol configuration data through the target downloading interface, determining the configuration data corresponding to the protocol to be downloaded from the analyzed protocol configuration data, and finally, calling a target sending interface through the target channel index in the preset protocol management structure, and sending the configuration data corresponding to the protocol to be downloaded to a preset protocol main card through the target sending interface so that the preset protocol main card downloads the corresponding protocol according to the received configuration data. Therefore, the interface to be used can be determined through the preset index, the protocol data is analyzed through the determined interface, and the analyzed data is transmitted to the preset protocol main card, so that the protocol main card downloads the corresponding protocol according to the received configuration data after receiving the data. In this way, different types of protocols can be downloaded through the same set of processes and download interfaces, so that different processes are prevented from being adopted for different protocols, compatibility of a protocol main card when different protocols are downloaded is improved, and redundancy of codes when multiple protocols are downloaded is effectively reduced.
Referring to fig. 6, the embodiment of the invention discloses a protocol downloading method, which comprises the following steps:
step S21, calling a read input data function interface in a target interface group in a first management structure according to a target interface index in a preset protocol management structure, and processing periodic input data of a target protocol through the read input data function interface to obtain processed periodic input data.
In this embodiment, a read input data function interface in a target interface group in a first management structure is called according to a target interface index in a preset protocol management structure, and periodic input data of a target protocol is processed through the read input data function interface, so as to obtain processed periodic input data. That is, when the periodic input data in the protocol main card is read through the callback interface of the preset instance, the read input data function interface in the target interface group in the Driver management structure is called according to the target interface index in the preset protocol management structure, and it is required to be explained that the read input data function interface corresponds to the current protocol to be downloaded, and after the read input data function interface is determined, the periodic input data of the target protocol is processed through the read input data function interface so as to obtain the processed periodic input data.
Step S22, a read input function interface in a second management structure is obtained through a target channel index in the preset protocol management structure, and the processed periodic input data is written into a preset input data area through the read input function interface.
In this embodiment, the read input function interface in the second management structure is obtained through the target channel index in the preset protocol management structure, and the processed periodic input data is written into the preset input data area through the read input function interface. That is, after the processed periodic input data processed through the input data function interface is obtained, the read input function interface in the device management structure can be called through the target channel index in the preset protocol management structure, the processed periodic input data is read from the device channel through the read input function interface, and then the read processed periodic input data is written into the preset input data area according to the offset table in the configuration data.
It should be noted that, the protocol downloading method in the present application further has a processing function of periodically outputting data, and the specific implementation method thereof is as follows: invoking a write output data function interface in the target interface group in the first management structure according to the target interface index, and processing the periodic output data of the target protocol through the write output data function interface to obtain processed periodic output data; and acquiring a write output function interface in the second management structure through the target channel index in the preset protocol management structure, and writing the processed periodic output data into a target channel protocol through the write output function interface. When the periodic output data in the protocol main card is read through a preset instance callback interface, a write output data function interface in a target interface group in a Driver management structure is called according to a target interface index in the preset protocol management structure, the periodic output data of a target protocol is processed through the write output data function interface to obtain processed periodic output data, then a write output function interface in a device management structure is called through a target channel index in the preset protocol management structure, the processed periodic output data is read from a device channel through the write output function interface, and then the read processed periodic output data is written into a target channel protocol.
It can be seen that, in this embodiment, the read input data function interface in the target interface group in the first management structure is called according to the target interface index in the preset protocol management structure, and the periodic input data of the target protocol is processed through the read input data function interface, so as to obtain the processed periodic input data, then the read input function interface in the second management structure is obtained through the target channel index in the preset protocol management structure, and the processed periodic input data is written into the preset input data area through the read input function interface, and the periodic output data can be processed through the write output data function interface, and the processed periodic output data is written into the target channel protocol through the write output function interface. In this way, the protocol downloading method in the application can also process the periodic input data and the periodic output data, so that the function of the protocol downloading method in the application is effectively expanded, the periodic input data of different protocols can be processed through one set of methods, and the complexity of the system and the redundancy of codes are effectively reduced.
Referring to fig. 7, the embodiment of the invention discloses a protocol downloading method, which comprises the following steps:
step S31, calling a read diagnosis data function interface in the target interface group in the first management structure according to a target interface index in a preset protocol management structure, and processing diagnosis data in a target protocol through the read diagnosis data function interface to obtain processed diagnosis data.
In this embodiment, a read diagnostic data function interface in the target interface group in the first management structure is called according to a target interface index in a preset protocol management structure, and diagnostic data in the target protocol is processed through the read diagnostic data function interface, so as to obtain processed diagnostic data. That is, when the periodic diagnostic data in the protocol main card is read through the callback interface of the preset instance, the read diagnostic data function interface in the target interface group in the Driver management structure is called according to the target interface index in the preset protocol management structure, and it is required to be explained that the read diagnostic data function interface corresponds to the current protocol to be downloaded, and after the read diagnostic data function interface is determined, the periodic diagnostic data of the target protocol is processed through the read diagnostic data function interface so as to obtain the processed periodic diagnostic data.
Step S32, a read diagnosis function interface in a second management structure is obtained through a target channel index in a preset protocol management structure, and the processed diagnosis data is written into a preset diagnosis data area by utilizing the read diagnosis function interface.
In this embodiment, the read diagnostic function interface in the second management structure is obtained through the target channel index in the preset protocol management structure, and the processed diagnostic data is written into the preset diagnostic data area by using the read diagnostic function interface. That is, after the processed periodic diagnostic data processed through the read diagnostic data function interface is obtained, the read diagnostic function interface in the device management structure can be called through the target channel index in the preset protocol management structure, the processed periodic diagnostic data is read from the device channel through the read diagnostic function interface, and then the read processed periodic diagnostic data is written into the preset diagnostic data area according to the offset table in the configuration data.
Therefore, the protocol downloading method in the application can also process the periodic diagnosis end data through interfaces in the Driver management structure and the equipment management structure, effectively expands the functions of the protocol downloading method in the application, processes the periodic diagnosis data of different protocols through a set of methods, and effectively improves the compatibility when integrating different protocols.
Referring to fig. 8, the embodiment of the invention discloses a protocol downloading method, which comprises the following steps:
step S41, calling a target state data function interface in a target interface group in a first management structure according to a target interface index in a preset protocol management structure, and processing state data in a target protocol through the target state data function interface to obtain processed state data.
In this embodiment, a target state data function interface in the target interface group in the first management structure is called according to the target interface index in the preset protocol management structure, and state data in the target protocol is processed through the target state data function interface to obtain processed state data. That is, when the state of the protocol main card is set and/or acquired through the callback interface of the preset instance, the target state data function interface in the target interface group in the Driver management structure can be called according to the target interface index in the preset protocol management structure, and it is required to be explained that the target state data function interface corresponds to the current protocol to be downloaded, and after the target state data function interface is determined, the state data of the target protocol is processed through the target state data function interface, so as to obtain the processed state data.
Step S42, obtaining a target state function interface in a second management structure through a target channel index in a preset protocol management structure, and setting and/or obtaining the processed state data according to the target state function interface so as to complete state setting and/or obtaining of the target protocol.
In this embodiment, the target state function interface in the second management structure is obtained through a target channel index in a preset protocol management structure, and the processed state data is set and/or obtained according to the target state function interface, so as to complete state setting and/or obtaining for the target protocol. That is, after the processed state data processed through the target state data function interface is obtained, the target state function interface in the device management structure can be called through the target channel index in the preset protocol management structure, and the processed state data is set and/or acquired according to the target state function interface, so that the state setting for the current target protocol and/or the acquisition of the current target protocol state are completed.
Therefore, in this embodiment, the target state data function interface in the target interface group in the first management structure is called according to the target interface index in the preset protocol management structure, and the state data in the target protocol is processed through the target state data function interface to obtain processed state data, and then the target state function interface in the second management structure is obtained through the target channel index in the preset protocol management structure, and the processed state data is set and/or obtained according to the target state function interface, so as to complete the state setting and/or obtaining for the target protocol. Thus, the function of the protocol downloading method in the application is effectively expanded.
Referring to fig. 9, an embodiment of the present invention discloses a protocol downloading device, including:
the index determining module 11 is configured to obtain a target protocol through a preset instance callback interface, determine protocol configuration data corresponding to the target protocol, determine a target interface index in a first management structure according to the configuration data, and determine a target channel index in a second management structure;
a data binding module 12, configured to bind the target interface index, the target channel index, and the protocol configuration data to a preset protocol management structure;
the data analysis module 13 is configured to invoke a target download interface through the target interface index in the preset protocol management structure, analyze the protocol configuration data through the target download interface, and determine configuration data corresponding to a protocol to be downloaded from the analyzed protocol configuration data;
and the protocol downloading module 14 is configured to invoke a target sending interface through the target channel index in the preset protocol management structure, and send configuration data corresponding to the protocol to be downloaded to a preset protocol main card through the target sending interface, so that the preset protocol main card determines that the corresponding protocol has been downloaded according to the received configuration data.
In the application, a target protocol is acquired through a preset instance callback interface, protocol configuration data corresponding to the target protocol is determined, a target interface index is determined in a first management structure according to the protocol configuration data, a target channel index is determined in a second management structure, and the target interface index, the target channel index and the protocol configuration data are bound to a preset protocol management structure. And then, calling a target downloading interface through the target interface index in the preset protocol management structure, analyzing the protocol configuration data through the target downloading interface, determining the configuration data corresponding to the protocol to be downloaded from the analyzed protocol configuration data, and finally, calling a target sending interface through the target channel index in the preset protocol management structure, and sending the configuration data corresponding to the protocol to be downloaded to a preset protocol main card through the target sending interface so that the preset protocol main card downloads the corresponding protocol according to the received configuration data. Therefore, the interface to be used can be determined through the preset index, the protocol data is analyzed through the determined interface, and the analyzed data is transmitted to the preset protocol main card, so that the protocol main card downloads the corresponding protocol according to the received configuration data after receiving the data. In this way, different types of protocols can be downloaded through the same set of processes and download interfaces, so that different processes are prevented from being adopted for different protocols, compatibility of a protocol main card when different protocols are downloaded is improved, and redundancy of codes when multiple protocols are downloaded is effectively reduced.
In some embodiments, the protocol downloading method may further include:
the interface judging module is used for adding the target interface group to the first management structure and judging whether to create a personalized download interface or not; the target interface group comprises a plurality of functional interfaces;
the interface initialization module is used for initializing the personalized download interface to the first management structure when the personalized download interface is created so as to finish interface initialization;
and the channel initialization module is used for providing the equipment number, the channel number and the interface function for the second management structure so as to finish channel initialization.
In some embodiments, the data parsing module 13 may specifically include:
an interface calling unit, configured to call a target download interface of the target interface group in the first management structure according to the target interface index in the preset protocol management structure;
and the data analysis unit is used for analyzing the protocol configuration data through a downloading function in the target downloading interface and determining the configuration data corresponding to the protocol to be downloaded from the analyzed protocol configuration data.
In some embodiments, the protocol downloading apparatus may further include:
The input data processing module is used for calling the read input data function interface in the target interface group in the first management structure according to the target interface index in the preset protocol management structure, and processing the periodic input data of the target protocol through the read input data function interface to obtain the processed periodic input data;
the input data writing module is used for acquiring a read input function interface in the second management structure through the target channel index in the preset protocol management structure, and writing the processed periodic input data into a preset input data area through the read input function interface;
the output data processing module is used for calling a write output data function interface in the target interface group in the first management structure according to the target interface index, and processing the periodic output data of the target protocol through the write output data function interface to obtain the processed periodic output data;
and the output data writing module is used for acquiring a write output function interface in the second management structure through the target channel index in the preset protocol management structure, and writing the processed periodic output data into a target channel protocol through the write output function interface.
In some embodiments, the protocol downloading apparatus may further include:
the diagnostic data processing module is used for calling a read diagnostic data function interface in the target interface group in the first management structure according to the target interface index in the preset protocol management structure, and processing diagnostic data in the target protocol through the read diagnostic data function interface to obtain processed diagnostic data;
the diagnostic data writing module is used for acquiring a read diagnostic function interface in the second management structure through the target channel index in the preset protocol management structure, and writing the processed diagnostic data into a preset diagnostic data area by utilizing the read diagnostic function interface.
In some embodiments, the protocol downloading apparatus may further include:
the state data processing module is used for calling a target state data function interface in the target interface group in the first management structure according to the target interface index in the preset protocol management structure, and processing state data in the target protocol through the target state data function interface to obtain processed state data;
The state data setting module is used for acquiring the target state function interface in the second management structure through a target channel index in a preset protocol management structure, and setting and/or acquiring the processed state data according to the target state function interface so as to complete state setting and/or acquiring aiming at the target protocol.
In some embodiments, the protocol downloading apparatus may further include:
the number judging module is used for judging whether the number of the protocols which are subjected to protocol downloading reaches the preset number of the protocols;
the step jump module is used for re-jumping to the step of acquiring the target protocol through the callback interface of the preset instance to perform the downloading operation of the next protocol when the preset protocol number is not reached yet;
and the downloading ending module is used for ending the protocol downloading when the preset protocol quantity is reached.
Further, the embodiment of the present application further discloses an electronic device, and fig. 10 is a block diagram of an electronic device 20 according to an exemplary embodiment, where the content of the figure is not to be considered as any limitation on the scope of use of the present application.
Fig. 10 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. Wherein the memory 22 is configured to store a computer program that is loaded and executed by the processor 21 to implement the relevant steps in the protocol downloading method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and computer programs 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the protocol downloading method performed by the electronic device 20 as disclosed in any of the previous embodiments.
Further, the application also discloses a computer readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements the protocol downloading method disclosed previously. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing has outlined the detailed description of the preferred embodiment of the present application, and the detailed description of the principles and embodiments of the present application has been provided herein by way of example only to facilitate the understanding of the method and core concepts of the present application; meanwhile, as those skilled in the art will have modifications in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. A method for downloading a protocol, comprising:
acquiring a target protocol through a preset instance callback interface, determining protocol configuration data corresponding to the target protocol, determining a target interface index in a first management structure and determining a target channel index in a second management structure according to the protocol configuration data;
binding the target interface index, the target channel index and the protocol configuration data to a preset protocol management structure;
invoking a target downloading interface through the target interface index in the preset protocol management structure, analyzing the protocol configuration data through the target downloading interface, and determining configuration data corresponding to a protocol to be downloaded from the analyzed protocol configuration data;
And calling a target sending interface through the target channel index in the preset protocol management structure, and sending configuration data corresponding to the protocol to be downloaded to a preset protocol main card through the target sending interface so that the preset protocol main card downloads the corresponding protocol according to the received configuration data.
2. The method for downloading a protocol according to claim 1, wherein the obtaining a target protocol through a preset instance callback interface, determining protocol configuration data corresponding to the target protocol, determining a target interface index in a first management structure according to the configuration data, and before determining a target channel index in a second management structure, further comprises:
adding a target interface group to the first management structure, and judging whether to create a personalized download interface; the target interface group comprises a plurality of functional interfaces;
if yes, initializing the personalized download interface to the first management structure to finish interface initialization;
providing the device number, the channel number and the interface function to the second management structure so as to complete channel initialization.
3. The protocol downloading method according to claim 2, wherein the calling the target downloading interface through the target interface index in the preset protocol management structure, analyzing the protocol configuration data through the target downloading interface, and determining the configuration data corresponding to the protocol to be downloaded from the analyzed protocol configuration data includes:
Invoking a target downloading interface of the target interface group in the first management structure according to the target interface index in the preset protocol management structure;
analyzing the protocol configuration data through a downloading function in the target downloading interface, and determining configuration data corresponding to a protocol to be downloaded from the analyzed protocol configuration data.
4. The protocol downloading method as claimed in claim 2, further comprising:
invoking a read input data function interface in the target interface group in the first management structure according to the target interface index in the preset protocol management structure, and processing periodic input data of the target protocol through the read input data function interface to obtain processed periodic input data;
acquiring a read input function interface in the second management structure through the target channel index in the preset protocol management structure, and writing the processed periodic input data into a preset input data area through the read input function interface;
invoking a write output data function interface in the target interface group in the first management structure according to the target interface index, and processing the periodic output data of the target protocol through the write output data function interface to obtain processed periodic output data;
And acquiring a write output function interface in the second management structure through the target channel index in the preset protocol management structure, and writing the processed periodic output data into a target channel protocol through the write output function interface.
5. The protocol downloading method as claimed in claim 2, further comprising:
calling a read diagnosis data function interface in the target interface group in the first management structure according to the target interface index in the preset protocol management structure, and processing diagnosis data in the target protocol through the read diagnosis data function interface to obtain processed diagnosis data;
and acquiring a read diagnosis function interface in the second management structure through the target channel index in the preset protocol management structure, and writing the processed diagnosis data into a preset diagnosis data area by utilizing the read diagnosis function interface.
6. The protocol downloading method as claimed in claim 2, further comprising:
invoking a target state data function interface in the target interface group in the first management structure according to the target interface index in the preset protocol management structure, and processing state data in the target protocol through the target state data function interface to obtain processed state data;
And acquiring the target state function interface in the second management structure through a target channel index in a preset protocol management structure, and setting and/or acquiring the processed state data according to the target state function interface so as to complete the state setting and/or acquiring of the target protocol.
7. The protocol downloading method according to any one of claims 1 to 6, wherein after the preset protocol main card downloads the corresponding protocol according to the received configuration data, the method further comprises:
judging whether the number of the protocols which are downloaded completely reaches the preset number of the protocols or not;
if the number of the preset protocols is not reached, re-jumping to the step of acquiring the target protocol through the callback interface of the preset instance so as to download the next protocol;
and ending the protocol downloading if the preset number of protocols is reached.
8. A protocol downloading apparatus, comprising:
the index determining module is used for acquiring a target protocol through a preset instance callback interface, determining protocol configuration data corresponding to the target protocol, determining a target interface index in a first management structure according to the configuration data, and determining a target channel index in a second management structure;
The data binding module is used for binding the target interface index, the target channel index and the protocol configuration data to a preset protocol management structure;
the data analysis module is used for calling a target downloading interface through the target interface index in the preset protocol management structure, analyzing the protocol configuration data through the target downloading interface, and determining configuration data corresponding to a protocol to be downloaded from the analyzed protocol configuration data;
and the protocol downloading module is used for calling a target sending interface through the target channel index in the preset protocol management structure and sending the configuration data corresponding to the protocol to be downloaded to a preset protocol main card through the target sending interface so that the preset protocol main card can determine that the corresponding protocol is downloaded according to the received configuration data.
9. An electronic device, comprising:
a memory for storing a computer program;
processor for executing the computer program to implement the protocol downloading method according to any one of claims 1 to 7.
10. A computer readable storage medium for storing a computer program which when executed by a processor implements the protocol downloading method according to any one of claims 1 to 7.
CN202211520198.7A 2022-11-30 2022-11-30 Protocol downloading method, device, equipment and storage medium Pending CN116566969A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211520198.7A CN116566969A (en) 2022-11-30 2022-11-30 Protocol downloading method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211520198.7A CN116566969A (en) 2022-11-30 2022-11-30 Protocol downloading method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116566969A true CN116566969A (en) 2023-08-08

Family

ID=87502527

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211520198.7A Pending CN116566969A (en) 2022-11-30 2022-11-30 Protocol downloading method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116566969A (en)

Similar Documents

Publication Publication Date Title
CN109164783B (en) Vehicle diagnosis method, apparatus, device, and medium
US20170262263A1 (en) Process and system for the generation of an operating program in the form of a mobile application that is capable of operating on a mobile device
CN113741936A (en) Parallel flashing method and device based on UDS protocol, vehicle and computer readable storage medium
FI120286B (en) A method and device arrangement for managing a server-client environment
CN115329170A (en) Webpage crawling method, device, equipment and storage medium
CN108810000B (en) Method and device for generating serialization and deserialization API
CN106294119B (en) Test scheduling system and method and terminal equipment
CN103561082A (en) Compressing request processing method and server
CN111124417B (en) Industrial control program compiling method and device, computer equipment and storage medium
US7907619B2 (en) Method, system and program product for adapting to protocol changes
CN116566969A (en) Protocol downloading method, device, equipment and storage medium
CN115934130A (en) ECU (electronic control Unit) upgrading method, device, equipment and medium
CN107911442B (en) Receiving response interface interaction method and device, computer equipment and storage medium
CN115755867A (en) Vehicle diagnosis method and related device
CN111740972B (en) Method, device, equipment and storage medium for updating communication protocol stack information
CN102063083A (en) Multi-ECU (Electronic Control Unit) time-shared downloading method
CN111722870B (en) Driving configuration method, device and equipment of electronic control unit and storage medium
CN114785685B (en) Software differential upgrading method and device, electronic equipment and readable storage medium
CN109783756B (en) Website creation method, server and computer readable storage medium
CN112083998B (en) Dynamic configuration method and device for task parameters in RTP of VxWorks system
CN108804101B (en) Method and device for creating interface element, storage medium and mobile terminal
CN114785685A (en) Software differential upgrading method and device, electronic equipment and readable storage medium
CN116107603A (en) Firmware upgrading method and device, storage medium and electronic equipment
US7478137B1 (en) Lightweight messaging with and without hardware guarantees
CN115640097A (en) Application program virtualization method and system, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination