Protocol stack architecture, protocol stack data processing method, electronic equipment and storage medium

By adopting a layered protocol stack architecture and data processing method in communication power supply equipment, the protocol and link are decoupled, and the compatibility and portability of the protocol stack are achieved, which solves the problem of binding protocols and links in the prior art, and reduces development and maintenance costs.

CN119728804APending Publication Date: 2025-03-28ZTE CORP
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311287497.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-27
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The existing networking method between communication power supply and battery, power supply and FSU, power supply and network management is relatively simple and solidified, and it is difficult to cope with the application scenario needs of multi-protocol and multi-links, resulting in the binding of protocol and link, high development costs and complex maintenance.

Method used

The protocol stack architecture of the application layer, protocol layer, parsing layer and link layer that is independently layered and isolated from each other is adopted. The application layer preconfigures the protocol information and link information to realize the free combination and configuration of different protocols and different communication links, and decouple the application protocol and communication links.

Benefits of technology

It realizes clear hierarchy, strong compatibility, intelligent management, and strong portability of the protocol stack, reduces maintenance costs, supports compatibility of different hardware platforms, and adapts to changeable application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728804A_ABST
    Figure CN119728804A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a protocol stack architecture, a protocol stack data processing method, electronic equipment and a storage medium. The protocol stack architecture comprises an application layer which is set to configure protocol information and / or link information and monitor data receiving of a link layer; the protocol layer is set to extract first effective data of a received data frame based on configured protocol information; the first valid data is data needing to be transmitted; the parsing layer is configured to parse the first valid data and store and / or forward the parsed first valid data; the link layer is configured to manage link control information of the communication link and receive data based on the configured link information. According to the scheme of the embodiment, the protocol and the communication link are decoupled, free combination and configuration of different protocols and communication links are realized, variable application scenes can be dealt with, and the maintenance cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communication power supplies, and in particular to a protocol stack architecture, a protocol stack data processing method, an electronic device, and a storage medium. Background Art

[0002] With the rapid development of communication technology and Internet of Things technology, operators and tower operators have higher and higher requirements for the intelligence of communication power supplies, batteries and energy storage products. At present, the previous networking methods between communication power supplies and batteries, power supplies and FSU (Field Supervision Unit), and power supplies and network management are relatively simple and solidified, which is difficult to cope with the current multi-protocol and multi-link application scenario requirements. Summary of the invention

[0003] Embodiments of the present disclosure provide a protocol stack architecture, a protocol stack data processing method, an electronic device, and a storage medium.

[0004] In a first aspect, an embodiment of the present disclosure provides a protocol stack architecture, which may include: an application layer, a protocol layer, a parsing layer, and a link layer;

[0005] The application layer is configured to configure the protocol information and / or link information and monitor the data reception of the link layer;

[0006] The protocol layer is configured to extract first valid data of a received data frame based on the registered protocol information; the first valid data is data to be transmitted;

[0007] The parsing layer is configured to parse the first valid data, and store and / or forward the parsed first valid data;

[0008] The link layer is configured to manage link control information of a communication link and receive data based on the configured link information.

[0009] In a second aspect, an embodiment of the present disclosure provides a protocol stack data processing method, based on the protocol stack architecture, the method comprising:

[0010] Configuring protocol information and / or link information through the application layer;

[0011] Monitoring, by the application layer, whether the first communication link in the configured link information has data received;

[0012] In the case where the first communication link receives data, reading the original data frame received by the first communication link through the link layer, and sending the original data frame to the protocol layer;

[0013] The protocol layer extracts the first valid data in the original data frame based on the configured protocol information, and sends the first valid data to the parsing layer; the first valid data is the data to be transmitted;

[0014] The parsing layer parses the data content of the first valid data, and stores the parsed first valid data or forwards the parsed first valid data through the second communication link in the link information.

[0015] In a third aspect, an embodiment of the present disclosure provides an electronic device, the electronic device comprising:

[0016] one or more processors;

[0017] A memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the protocol stack data processing method;

[0018] One or more input / output I / O interfaces are connected between the processor and the memory and are configured to implement information interaction between the processor and the memory.

[0019] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the protocol stack data processing method is implemented.

[0020] The disclosed embodiment realizes a lightweight protocol stack by setting up an application layer, a protocol layer, a parsing layer and a link layer that are independently layered and isolated from each other. Through the different hierarchical division of labor among the application layer, the protocol layer, the parsing layer and the link layer in the protocol stack, the protocol stack has many advantages such as clear hierarchy, strong compatibility, intelligent management and strong portability. In addition, by pre-configuring the protocol information and / or the link information at the application layer, the free combination and configuration of different protocols and different communication links are realized, and the decoupling of the application protocol and the communication link is realized, so that the protocol stack can support compatibility with different hardware platforms and realize the configurable management of protocols and hardware device resources, so as to cope with various application scenarios such as protocols and links and reduce maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In the accompanying drawings of the embodiments of the present disclosure:

[0022] Figure 1 A block diagram of the protocol stack architecture provided for an embodiment of the present disclosure;

[0023] Figure 2 A schematic diagram of a configuration table embodiment provided in an embodiment of the present disclosure;

[0024] Figure 3 A flow chart of a protocol stack data processing method provided by an embodiment of the present disclosure;

[0025] Figure 4 A schematic diagram of a protocol stack data processing method provided in an embodiment of the present disclosure;

[0026] Figure 5 A block diagram of the electronic device provided in the embodiment of the present disclosure;

[0027] Figure 6 A block diagram of the computer-readable storage medium provided for an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, the communication perception data processing method and computer-readable storage medium provided by the embodiments of the present disclosure are described in detail below in conjunction with the accompanying drawings.

[0029] The present disclosure will be described more fully below with reference to the accompanying drawings, but the embodiments shown may be embodied in different forms, and the present disclosure should not be construed as being limited to the embodiments set forth below. On the contrary, the purpose of providing these embodiments is to make the present disclosure thorough and complete, and will enable those skilled in the art to fully understand the scope of the present disclosure.

[0030] The accompanying drawings of the embodiments of the present disclosure are used to provide a further understanding of the embodiments of the present disclosure, and constitute a part of the specification, and are used together with the detailed embodiments to explain the present disclosure, and do not constitute a limitation of the present disclosure. By describing the detailed embodiments with reference to the accompanying drawings, the above and other features and advantages will become more apparent to those skilled in the art.

[0031] The present disclosure may be described with reference to plan views and / or cross-sectional views by means of ideal schematic views of the present disclosure. Therefore, the exemplary illustrations may be modified according to manufacturing techniques and / or tolerances.

[0032] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.

[0033] The terms used in the present disclosure are only used to describe specific embodiments and are not intended to limit the present disclosure. The term "and / or" as used in the present disclosure includes any and all combinations of one or more related enumerated items. The singular forms "one" and "the" as used in the present disclosure are also intended to include plural forms, unless the context clearly indicates otherwise. The terms "including", "made of..." as used in the present disclosure specify the presence of the features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof.

[0034] Unless otherwise defined, all terms (including technical and scientific terms) used in this disclosure have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined in this disclosure.

[0035] The present disclosure is not limited to the embodiments shown in the drawings, but includes modifications of the configurations formed based on the manufacturing process. Therefore, the regions illustrated in the drawings have schematic properties, and the shapes of the regions shown in the drawings illustrate the specific shapes of the regions of the elements, but are not intended to be limiting.

[0036] With the rapid development of communication technology and Internet of Things technology, operators and tower operators have higher and higher requirements for the intelligence of communication power supplies, batteries and energy storage products. In the past, the networking methods between communication power supplies and batteries, power supplies and FSU (Field Supervision Unit), and power supplies and network management were relatively simple and solidified, such as the well-known serial port, CAN (Controller Area Network) and wired IP (Internet Protocol) links. When faced with the more complex working conditions of the current new products, such as CSU (Central SupervisionUnit, centralized control unit, power management system software) master-slave management, integrated power parallel management, different customer protocol selection, the existing software framework cannot effectively meet these complex requirements; secondly, for the same protocol, due to the influence of the on-site environment, different networking methods need to be adopted to connect with external devices. A typical scenario is the connection between the power supply and the energy network management. In some on-site scenarios, the power supply communicates with the wireless main device through 485, and the power supply data is transmitted to the background network management through the wireless main device in IP mode. However, if the on-site main device is not a self-developed product, the power supply is required to communicate directly with the network management through a 4G (fourth-generation communication technology) wireless module or a wired network. Under the current protocol architecture, the 485 link and network link data are separated, and two identical protocols need to be developed based on different links, which brings repeated manpower and time investment, and leads to the proliferation of customized versions and the continuous growth of maintenance costs.

[0037] In summary, the original link and protocol bundling method can no longer meet the current usage scenarios of complex power services and changeable working conditions. In view of this, the embodiments of the present disclosure provide a lightweight protocol stack that isolates the link layer, protocol layer, parsing layer and application layer for communication between power products in order to meet the unknown and increasingly changeable power product networking scenarios.

[0038] The disclosed embodiment realizes a lightweight protocol stack by setting up an application layer, a protocol layer, a parsing layer and a link layer that are independently layered and isolated from each other. Through the different hierarchical division of labor among the application layer, the protocol layer, the parsing layer and the link layer in the protocol stack, the protocol stack has many advantages such as clear hierarchy, strong compatibility, intelligent management and strong portability. In addition, by pre-registering the protocol information and / or the link information at the application layer, the free combination and configuration of different protocols and different communication links are realized, and the decoupling of the application protocol and the communication link is realized, so that the protocol stack can support compatibility with different hardware platforms and realize the configurable management of protocols and hardware device resources.

[0039] The protocol stack architecture and protocol stack data processing method of the embodiments of the present disclosure can be implemented by any electronic device such as a terminal device or a server that requires multi-protocol and multi-link data communication. The terminal device may include but is not limited to: vehicle-mounted equipment, user equipment (User Equipment, UE), mobile devices, computing devices, wearable devices, etc., for example, including but not limited to cellular phones, cordless phones, personal digital assistants (Personal Digital Assistant, PDA), portable computers, etc.

[0040] The protocol stack data processing method of the embodiment of the present disclosure may be implemented by a processor calling a computer-readable program instruction stored in a memory, or may be implemented by a server.

[0041] The embodiments of the present disclosure can be applied to, but not limited to, power supply equipment (such as communication power supply equipment) and power conversion products derived from the software and hardware of the power supply equipment, such as communication power supplies, communication batteries, communication energy storage products, photovoltaic inverter products, and mixed use scenarios of mutual communication, etc. It is also suitable for the working conditions of integrated power supply parallel operation and lithium battery parallel operation.

[0042] The following is a detailed introduction to the embodiments of the present disclosure.

[0043] The present disclosure provides a protocol stack architecture 100, such as Figure 1 As shown, it may include: an application layer 101, a protocol layer 102, a parsing layer 103 and a link layer 104; the application layer 101, the protocol layer 102, the parsing layer 103 and the link layer 104 are independently layered and isolated from each other;

[0044] The application layer 101 is configured to configure the protocol information and / or link information and monitor the data reception of the link layer;

[0045] The protocol layer 102 is configured to extract first valid data from the received data frame based on the configured protocol information; the first valid data is data to be transmitted;

[0046] The parsing layer 103 is configured to parse the first valid data and store and / or forward the parsed first valid data;

[0047] The link layer 104 is configured to manage link control information of the communication link and receive data based on the configured link information.

[0048] In the disclosed embodiment, the application layer 101 may also be configured to generate a response data packet in response to a received data frame and monitor the data transmission of the link layer;

[0049] The protocol layer 102 may also be configured to encapsulate the response data frame based on the configured protocol information and the response data packet;

[0050] The parsing layer 103 may also be configured to encapsulate the second valid data of the response based on the response data packet; the second valid data is the data to be transmitted;

[0051] The link layer 104 may also be configured to send data based on the configured link information.

[0052] In the embodiments of the present disclosure, a lightweight protocol stack system architecture with software and hardware decoupling, protocol and link decoupling, and strong compatibility and expandability is provided to meet the requirements of intelligent protocol management, flexible on-site configuration, and rapid response to demand changes of communication equipment (such as power supply equipment). The protocol system architecture may include but is not limited to the following four parts: application layer, protocol layer, parsing layer, and link layer. The functional characteristics of each layer are described in detail below.

[0053] In the embodiment of the present disclosure, the application layer 101 is further configured to: perform information interaction with the main program based on a heartbeat mechanism to maintain the normal function of the application layer.

[0054] In the embodiment of the present disclosure, the application layer 101 configures the protocol information and / or link information, which may include:

[0055] The application layer may configure the protocol information and / or link information based on a preset configuration table before data is sent or received.

[0056] In the embodiment of the present disclosure, the application layer 101 may uniformly manage the protocol information and / or link information through a configuration table, for example, including but not limited to registering, uninstalling and maintaining the protocol information and / or link information through a configuration table.

[0057] In the embodiments of the present disclosure, taking into account factors such as the differences in protocol frame structures, the numerous interactive commands, and the diversity of communication links, in order to adapt to the flexible configuration of protocols and communication links in different application scenarios, the content of the protocol information and / or link information can be configured as a unified template, such as the configuration table mentioned above. Based on the configuration table, the user can fill in the protocol information and link information required on site in the configuration table to implement the configuration of the protocol information and link information, establish a one-to-one mapping between protocols and communication links and the encapsulation of protocol commands, so as to achieve a mix of different protocols and different links.

[0058] In the disclosed embodiment, a filling interface may be provided in the configuration table so that the user can fill in the protocol information and link information to be configured in the configuration table. A selection interface may also be provided in the configuration table so that the configuration table can maintain a variety of protocol information and a variety of link information, and determine the configuration required by the user based on the user's selection of the required protocol information and link information.

[0059] In the disclosed embodiment, the application layer 101 configures the protocol information and / or link information means that: when there is only one protocol and multiple communication links, only the required link information can be configured in the configuration table; when there is only one communication link and multiple protocols, only the required protocol information can be configured in the configuration table; when there are multiple protocols and communication links, both the protocol information and the link information can be configured in the configuration table. In a detailed embodiment, the configuration table can be set according to the requirements, and the detailed content of the configuration table is not limited.

[0060] In the embodiments of the present disclosure, Figure 2 As shown, the configuration table may include, but is not limited to, any one or more of the following information: device information, protocol information, link information, cache information, polling information, and deregistration information.

[0061] In the embodiment of the present disclosure, the device information may include, but is not limited to, any one or more of the following: device type identification and / or device number;

[0062] The protocol information may include but is not limited to any one or more of the following: a protocol type identifier, a protocol configuration table, and a protocol command table; the protocol configuration table is used to indicate the configured protocol, and the protocol command table is used to indicate the configured protocol command information; the protocol command information includes a protocol command identifier;

[0063] The link information may include, but is not limited to, any one or more of the following: a link creation command identifier, a selected communication link identifier, selected communication link information, a backup link identifier, and backup link information;

[0064] The deregistration information may include, but is not limited to: a deregistration table; the deregistration table is used to indicate the deregistered communication link identifier and protocol type identifier;

[0065] The buffer information may include, but is not limited to: the send buffer size and / or the receive buffer size;

[0066] The training information may include but is not limited to: a non-training command table and / or a training command table.

[0067] In the disclosed embodiment, the device type identifier can be used to indicate the identifier corresponding to the device running the protocol (compatible with the device type in the old protocol), and the number of devices can be used to indicate the number or maximum number of access devices supporting the protocol.

[0068] In the embodiments of the present disclosure, the protocol type identifier may be used to indicate a unique ID (identity identifier) ​​that identifies the running protocol, such as A indicating the 1363 protocol, B indicating the underlying communication protocol, and so on.

[0069] In the disclosed embodiment, the protocol configuration table may include but is not limited to: protocol items (for example, CAN protocol, COM (cluster communication port, serial communication port, referred to as serial port) protocol, IP protocol, etc.), device number items and base address items.

[0070] In the embodiment of the present disclosure, the protocol command table may include: command ID (i.e., the protocol command identifier), command type, command header, command tail, command sending mode, command execution success processing, command execution failure processing, command parsing items (which may include but are not limited to: command parsing, post-parsing processing, command encapsulation, and pre-encapsulation processing).

[0071] In an embodiment of the present disclosure, a link creation command identifier is used to indicate different link creation commands; a selected communication link identifier is used to indicate a selected communication link; selected communication link information is used to describe information of the selected communication link; a backup link identifier is used to indicate one or more backup links; and backup link information is used to describe one or more backup links.

[0072] In the disclosed embodiment, the sending buffer size is used to indicate the sending buffer size of the protocol DATA (data) segment; the receiving buffer size is used to indicate the receiving buffer size of the protocol DATA segment.

[0073] In the disclosed embodiment, the non-polling command table refers to a non-periodic instruction table, such as a table of parameter settings and control instructions; the polling command table refers to a periodic instruction table.

[0074] In the embodiment of the present disclosure, the deregistration table may indicate the deregistered communication link identifiers and protocol type identifiers, for example: CAN1, CAN2, COM1, Protocol 1, etc.

[0075] In the disclosed embodiment, based on the above configuration table, the protocol and the communication link can be used freely in combination, and the mapping relationship between the communication device web (Internet) or host computer configuration protocol and the communication link can be reflected in the user manual.

[0076] In the disclosed embodiment, the protocol layer 102 is responsible for extracting and encapsulating the content of a complete frame of data of different protocols.

[0077] In the disclosed embodiment, the protocol layer 102 is used to determine and extract a frame of valid data (i.e., the data information that the user wants to transmit) from the received original data frame, and then pass it to the parsing layer 103 for processing; or, completely assemble the data frame to be responded to and transfer it to the link layer 104.

[0078] In the embodiment of the present disclosure, the extraction and packaging of a complete data frame vary greatly depending on the protocol. The protocol layer 102 of the embodiment of the present disclosure also has the function of fragmenting and reassembling data packets, so that data extraction and packaging can be performed according to different protocols.

[0079] In the embodiment of the present disclosure, when the protocol configured in the configuration table is a currently unsupported protocol, coding development can be performed at the protocol layer to add a processing function for the protocol.

[0080] In the disclosed embodiment, the parsing layer 103 plays a central role in the protocol stack, and is mainly responsible for parsing and encapsulating the content of the first valid data of different protocols.

[0081] In the disclosed embodiment, the parsing layer 103 may put the parsed first valid data into a designated memory or solidify it in a storage space, or assemble the parsed first valid data into a package and transmit it to the protocol layer 102 .

[0082] In the embodiments of the present disclosure, for different protocols, the execution program corresponding to the parsing layer can be abstracted and interfaced (for example, it can be set as a callable function, which greatly reduces the work of re-encoding due to changes in the protocol data content.

[0083] In the embodiment of the present disclosure, the link layer 104 is responsible for managing the link information of the communication device.

[0084] In the embodiments of the present disclosure, communication equipment may include but is not limited to communication power supply equipment, and the communication link of the power supply equipment may include but is not limited to any one or more of the following: a serial interface, a CAN interface, and a network interface; wherein the network interface may include a wired network interface and a wireless network interface (for example, including but not limited to wireless 4G, 5G, and wireless fidelity WIFI).

[0085] In the embodiment of the present disclosure, the link control information of the communication link may include but is not limited to any one or more of the following: link initialization configuration, link handle opening, link handle closing, and source data reading and writing functions.

[0086] In the embodiments of the present disclosure, the execution programs of the application layer, protocol layer, parsing layer and link layer can all be functionalized so as to implement the functions of the layer by means of function calls.

[0087] In the embodiments of the present disclosure, by summarizing and analyzing the networking methods of communication devices and the communication methods with external devices, a software system framework and protocol management solution that supports multiple links and multiple protocols and can be flexibly matched is provided, which greatly solves the current communication equipment, such as power products, which requires repetitive work of redeveloping protocols due to link problems.

[0088] The disclosed embodiment also provides a protocol stack data processing method. Based on the above protocol stack architecture, the implementation subject of this method can be the control unit of any electronic device that requires multi-protocol and multi-link data communication, for example, it can include but is not limited to power supply equipment (such as communication power supply equipment), power conversion products derived from the software and hardware of power supply equipment, integrated power supply parallel and lithium battery parallel control unit. Figure 3 As shown, the method may include steps S11-S15:

[0089] S11. Configure protocol information and / or link information through the application layer.

[0090] In the embodiment of the present disclosure, configuring the protocol information and / or link information through the application layer may include:

[0091] The application layer provides a preset configuration table, and configures the protocol information and / or link information by acquiring the protocol information and / or link information filled in the configuration table.

[0092] In the embodiment of the present disclosure, the protocol information and link information can be configured by calling the aforementioned configuration table through a preset configuration function, which will not be described in detail here.

[0093] In the embodiments of the present disclosure, before implementing the protocol stack data processing method of the embodiments of the present disclosure, corresponding hardware level settings can be performed in advance according to the communication link to be configured, for example, connecting the corresponding communication link interface, setting the corresponding hardware parameters, etc.

[0094] In the embodiments of the present disclosure, a hardware level setting embodiment is given below. Since the site monitoring SCU (site management unit, including software and hardware) product has both RS485 serial port COM0, CAN0 communication port and wired network port LAN0, the embodiment of the present disclosure can be described based on the SCU, and a computer (such as a host computer), RS485 communication cable, CAN box and network cable can be prepared.

[0095] In the disclosed embodiment, after the SCU is powered on and running, the mapping relationship between protocol A and serial port COM0 can be configured in the configuration table, and the two ends of the RS485 cable can be connected to COM0 of the SCU and a computer (such as a host computer) respectively. The serial port assistant parameters on the computer side are set to be consistent with COM0, the serial port assistant tool is opened, and a query analog command of protocol A is sent through the computer. The serial port tool assistant on the computer can receive the response data frame from the SCU.

[0096] In the embodiment of the present disclosure, while keeping protocol A unchanged, if the communication link is modified and changed to be connected to the CAN0 communication port, the mapping relationship between protocol A and CAN0 is modified in the configuration table, and the two ends of the CAN box cable are respectively connected to the CAN0 port of the SCU and the computer (such as the host computer), the CAN host computer software of the computer is opened, and the query analog command of protocol A is sent, and the CAN host computer software of the computer can receive the response data frame of the SCU.

[0097] In the disclosed embodiment, if protocol A is changed to protocol B and the communication link is modified to connect to the LAN0 port, the mapping relationship between protocol B and LAN0 is modified in the configuration table, and the two ends of the network cable are respectively connected to the LAN0 port of the SCU and the network port of the computer (such as the host computer), and the computer static IP and the SCU network port IP are set in the same network segment. The TCP (Transmission Control Protocol) assistant is opened on the computer and set to client mode. A socket link is established with the SCU server. The TCP assistant sends the query analog command of protocol B and can receive the response data frame from the SCU.

[0098] In the embodiments of the present disclosure, the above embodiments are only the scenario embodiments based on SCU. The protocol stack architecture and the corresponding data processing method of the embodiments of the present disclosure can be applied to any communication device, such as a power supply device, and can be applied to the management unit of the communication device. When the hardware is connected, the communication link of the communication device can be connected to the communication link of the target device to be communicated, for example, the power supply device is connected to the host computer.

[0099] In the embodiments of the present disclosure, Figure 4 As shown, the detailed data sending and receiving process based on the above settings can be described as follows.

[0100] S12. Monitor, through the application layer, whether the first communication link in the configured link information has data received.

[0101] In the disclosed embodiment, a receiving function may be pre-set in the application layer, such as a cmd_rcv(dev_inst, cmd_buff) function, through which it may be detected whether the first communication link bound to the detection parameter dev_inst has data received.

[0102] In the embodiment of the present disclosure, when it is configured in the configuration table that communication is performed through a first communication link (the first communication link may be any communication link), it may be detected whether data is received in the first communication link.

[0103] S13. When data is received on the first communication link, the original data frame received on the first communication link is read through the link layer, and the original data frame is sent to the protocol layer.

[0104] In the disclosed embodiment, a link layer receiving function may be pre-set in the application layer, such as linklayer_recv(dev_inst->link_inst), where dev_inst->link_inst is used to indicate that the detection parameter dev_inst is bound to the communication link link_inst (as the first communication link mentioned above), and the link layer receiving function may be called through the application layer so that the link layer receiving function reads the original data frame received by the bound communication link and sends the original data frame to the protocol layer.

[0105] S14. The protocol layer extracts the first valid data in the original data frame based on the configured protocol information, and sends the first valid data to the parsing layer.

[0106] In the embodiment of the present disclosure, the first valid data is data that needs to be transmitted.

[0107] In the embodiment of the present disclosure, before the protocol layer extracts the first valid data in the original data frame, the method may further include:

[0108] The protocol layer searches for a first parsing function that matches the protocol type identifier according to the protocol type identifier configured in the configuration table;

[0109] The protocol layer detects the integrity of the original data frame according to the first parsing function.

[0110] In the disclosed embodiment, a protocol layer receiving function may be pre-set in the protocol layer, such as protocol_layer_rcv(dev_inst, cmd_buff), and the protocol layer receiving function may be called through the application layer, so that the protocol layer receiving function queries a matching first parsing function according to the protocol corresponding to the protocol type identifier recorded in the detection parameter dev_inst. The first parsing function may determine whether the received original data frame is complete. If the original data frame is complete, it indicates that the original data frame matches the protocol corresponding to the protocol type identifier. If the original data frame is incomplete, it indicates that the original data frame does not match the protocol corresponding to the protocol type identifier.

[0111] In the embodiment of the present disclosure, the configured protocol information includes a protocol command identifier; the protocol layer extracts valid data in the original data frame based on the configured protocol information and sends the valid data to the parsing layer, including:

[0112] Determining the configured protocol based on the protocol command identifier;

[0113] Extracting a complete data frame of first valid data from the original data frame according to the protocol;

[0114] The complete data frame of the first valid data is sent to the parsing layer together with the protocol command identifier.

[0115] In the disclosed embodiment, the cmd_buff parameter may record a protocol command identifier, extract the first valid data frame according to the protocol command identifier, and send the first valid data frame and the protocol command identifier together to the parsing layer for use by the parsing layer.

[0116] S15. The parsing layer parses the data content of the first valid data, and stores the parsed first valid data or forwards the parsed first valid data through the second communication link in the link information.

[0117] In the disclosed embodiment, a parsing layer receiving function, such as parse_layer_rcv(dev_inst, cmd_buff), may be pre-set in the parsing layer, and the parsing layer receiving function may be called by the application layer to parse the content of the valid data.

[0118] In the embodiment of the present disclosure, the parsing layer parses the data content of the valid data, which may include:

[0119] The parsing layer determines, according to the protocol command identifier, whether the second parsing function associated with the protocol command identifier is a user-defined function;

[0120] When the second parsing function is not a user-defined function, the second parsing function is called from a preset general parsing function set; or, when the second parsing function is a user-defined function, the second parsing function is called from a preset user-defined parsing function set;

[0121] By calling the second parsing function, the contents of the data segments corresponding to the protocol command identifiers in the data frames of valid data are parsed one by one.

[0122] In the disclosed embodiment, by calling the parsing layer receiving function parse_layer_rcv(dev_inst,cmd_buff); it can be determined whether the parsing function associated with the protocol command identifier recorded in cmd_buff (such as the second parsing function mentioned above) is customized. If it is customized, the customized function is used to parse the content of the first valid data frame. If it is not customized, the second parsing function is confirmed to be the universal parsing function universal_parse(), and the universal parsing function universal_parse() can be executed. For example, the data parsing function parse_data() in the universal parsing function can be used to complete the parsing of the data segment content corresponding to the protocol command identifier in the data frame of the first valid data in the previous text one by one (the protocol command identifier can be reflected in the configuration table of the application layer, and the data segment content corresponding to the protocol command identifier can include the data segment information, order and size associated with the protocol command identifier, etc.), thereby realizing the parsing of the first valid data.

[0123] In the embodiment of the present disclosure, the parsing layer may store or forward the parsed first valid data, and at this point, the data receiving process based on the protocol stack of the embodiment of the present disclosure ends.

[0124] In the embodiment of the present disclosure, after storing the parsed first valid data or forwarding the valid data through the second communication link configured in the link layer, the method may further include:

[0125] Creating a response data packet through the application layer, the response data packet includes multiple data segments;

[0126] The parsing layer fills the data segment corresponding to the parsing layer with data information of the second valid data according to the protocol information, and the protocol layer fills the data segment corresponding to the protocol layer with non-data information according to the protocol information to obtain a response data frame; the second valid data is the data to be transmitted;

[0127] The link layer sends a response data frame based on the first communication link to respond to the received data.

[0128] In the embodiment of the present disclosure, the multiple data segments may include valid data segments and non-valid data segments.

[0129] In the disclosed embodiment, the processing flow of the response frame is opposite to the receiving process. The application layer can pre-set a sending function, for example, a cmd_send() class function, and start the packaging of the response data by starting the sending function. Through the sending function, a response data packet can be created and sent to the parsing layer.

[0130] In the disclosed embodiment, the parsing layer may pre-set a parsing layer sending function, for example, parse_layer_send(), which may be called by the application layer. The parsing layer sending function parse_layer_send() fills the valid data segment content in the response data packet according to the configured protocol based on the protocol command identifier passed previously, thereby realizing general or custom packet assembly.

[0131] In the disclosed embodiment, the parse_layer_send() function can be called to determine whether to use a general parsing function to fill the valid data segment in the response data packet according to the protocol command identifier? If yes, the general parsing function is used to fill the valid data segment in the response data packet; if not, the custom parsing function is used to fill the valid data segment in the response data packet.

[0132] In the disclosed embodiment, the protocol layer may pre-set a protocol layer sending function, for example, protocol_layer_send(). Based on the response data packet of the application layer, the protocol layer sending function may complete the filling of the content of the non-valid data segment in the response data packet, package a complete frame of data, obtain a response data frame, and send the response data frame to the link layer.

[0133] In the disclosed embodiment, the link layer may pre-set a link layer sending function, for example, linklayer_send(dev_inst->link_inst), to implement sending of a complete response data frame according to the link information transmitted by the input parameter dev_inst.

[0134] In the embodiments of the present disclosure, the current power supply product protocols are bundled with links, and protocol development is increasing, resulting in the proliferation of version customization, chaotic protocol management, and the inability to meet intelligent needs. The embodiments of the present disclosure at least have the following beneficial effects:

[0135] 1. The protocol and communication link are completely decoupled to meet different application scenarios and provide diversified solutions;

[0136] 2. Supported protocols can be dynamically loaded and unloaded according to demand, significantly shortening the process of re-releasing previous protocol versions;

[0137] 3. It can greatly reduce the proliferation of software branches and reduce maintenance costs;

[0138] 4. It can seamlessly connect to communication equipment (such as power supply equipment) and parallel scenarios to meet the ever-changing differentiated needs;

[0139] 5. The protocol stack has strong compatibility and can be seamlessly ported to other hardware environments;

[0140] 6. The development time and manpower investment for new protocols are reduced by more than 30% compared to traditional solutions.

[0141] The present disclosure also provides an electronic device 200, such as Figure 5 As shown, the electronic device 200 includes:

[0142] One or more processors 201;

[0143] A memory 202, on which one or more programs are stored. When the one or more programs are executed by one or more processors 201, the one or more processors 201 implement the protocol stack data processing method;

[0144] One or more input / output I / O interfaces 203 are connected between the processor 201 and the memory 202 and are configured to implement information interaction between the processor 201 and the memory 202 .

[0145] Among them, the processor 201 is a device with data processing capabilities, including but not limited to a central processing unit (CPU) and the like; the memory 202 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) 203 is connected between the processor 201 and the memory 202, and can realize information interaction between the processor 201 and the memory 202, including but not limited to a data bus (Bus) and the like.

[0146] In some embodiments, the processor 201 , the memory 202 , and the I / O interface 203 are connected to each other via a bus 204 , and further connected to other components of the computing device.

[0147] In the embodiment of the present disclosure, the electronic device may include but is not limited to: a power supply device, such as a communication power supply device.

[0148] The present disclosure also provides a computer-readable storage medium 300. Figure 6As shown, a computer program is stored on the computer-readable storage medium 300, and when the computer program is executed by the processor, the protocol stack data processing method is implemented.

[0149] Those skilled in the art will appreciate that all or some of the functional modules / units disclosed above may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0150] In hardware implementations, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation.

[0151] Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit (CPU), a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-temporary medium) and a communication medium (or temporary medium). As known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH) or other disk storage; read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical disk storage; magnetic cassettes, magnetic tapes, disk storage or other magnetic storage; any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0152] The present disclosure has disclosed example embodiments, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly stated, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.

Claims

1. A protocol stack architecture, characterized in that: include: Application layer, protocol layer, parsing layer and link layer; The application layer, the protocol layer, the parsing layer and the link layer are independently layered and isolated from each other; The application layer is configured to configure the protocol information and / or link information and monitor the data reception of the link layer; The protocol layer is configured to extract first valid data from a received data frame based on the configured protocol information; the first valid data is data to be transmitted; The parsing layer is configured to parse the first valid data, and store and / or forward the parsed first valid data; The link layer is configured to manage link control information of a communication link and receive data based on the configured link information.

2. The protocol stack architecture according to claim 1, characterized in that: The application layer configures the protocol information and / or link information, including: The application layer configures the protocol information and / or the link information based on a preset configuration table before sending or receiving data.

3. The protocol stack architecture according to claim 2, characterized in that: The configuration table includes any one or more of the following information: device information, the protocol information, the link information, cache information, polling information, and deregistration information.

4. The protocol stack architecture according to claim 3, characterized in that: The device information includes any one or more of the following: device type identification and / or device number; The protocol information includes any one or more of the following: a protocol type identifier, a protocol configuration table, and a protocol command table; the protocol configuration table is used to indicate the configured protocol, the protocol command table is used to indicate the configured protocol command information, and the protocol command information includes a protocol command identifier; The link information includes any one or more of the following: a link creation command identifier, a selected communication link identifier, selected communication link information, a backup link identifier, and backup link information; The deregistration information includes: a deregistration table; the deregistration table is used to indicate the communication link identifier and protocol type identifier that have been deregistered; The buffer information includes: a sending buffer size and / or a receiving buffer size; The round-robin training information includes: a non-round-robin training command table and / or a round-robin training command table.

5. The protocol stack architecture according to any one of claims 1 to 4, characterized in that: The communication link includes any one or more of the following: a serial interface, a controller area network (CAN) interface, and a network interface; The link control information includes any one or more of the following: link initialization configuration, link handle opening, link handle closing, and source data reading and writing functions.

6. The protocol stack architecture according to any one of claims 1 to 4, characterized in that: The application layer is further configured to generate a response data packet when responding to the received data frame, and monitor the data transmission of the link layer; The protocol layer is further configured to encapsulate the response data frame based on the configured protocol information and the response data packet; The parsing layer is further configured to encapsulate second valid data of the response based on the response data packet; the second valid data is data to be transmitted; The link layer is also configured to send data based on the configured link information.

7. The protocol stack architecture according to any one of claims 1 to 4, characterized in that: The application layer is also configured to perform information interaction with a preset main program based on a heartbeat mechanism to maintain the normal function of the application layer.

8. A protocol stack data processing method, characterized in that: Based on the protocol stack architecture according to any one of claims 1 to 7, the method comprises: Configuring protocol information and / or link information through the application layer; Monitoring, by the application layer, whether the first communication link in the configured link information has data received; In the case where the first communication link receives data, reading the original data frame received by the first communication link through the link layer, and sending the original data frame to the protocol layer; The protocol layer extracts the first valid data in the original data frame based on the configured protocol information, and sends the first valid data to the parsing layer; the first valid data is the data to be transmitted; The parsing layer parses the data content of the first valid data, and stores the parsed first valid data or forwards the parsed first valid data through the second communication link in the link information.

9. The protocol stack data processing method according to claim 8, characterized in that: The configuring of the protocol information and / or link information through the application layer includes: The application layer provides a preset configuration table, and configures the protocol information and / or link information by acquiring the protocol information and / or link information filled in the configuration table.

10. The protocol stack data processing method according to claim 8, characterized in that: Before the protocol layer extracts the first valid data in the original data frame, the method further includes: The protocol layer searches for a first parsing function that matches the protocol type identifier according to the protocol type identifier configured in the configuration table; The protocol layer detects the integrity of the original data frame according to the first parsing function.

11. The protocol stack data processing method according to claim 8, characterized in that: The protocol information includes a protocol command identifier; The protocol layer extracts first valid data from the original data frame based on the configured protocol information, and sends the first valid data to the parsing layer, including: Determining a configured protocol based on the protocol command identifier; Extracting a complete data frame of the first valid data from the original data frame according to the protocol; The complete data frame of the first valid data is sent to the parsing layer together with the protocol command identifier.

12. The protocol stack data processing method according to claim 11, characterized in that: The parsing layer parses the data content of the first valid data, including: The parsing layer determines, according to the protocol command identifier, whether a second parsing function associated with the protocol command identifier is a user-defined function; In the case where the second parsing function is not a user-defined function, calling the second parsing function in a preset general parsing function set, or, in the case where the second parsing function is a user-defined function, calling the second parsing function in a preset user-defined parsing function set; By calling the second parsing function, the contents of the data segments corresponding to the protocol command identifiers in the data frame of the first valid data are parsed one by one.

13. The protocol stack data processing method according to claim 8, characterized in that: After storing the parsed first valid data or forwarding the first valid data through a second communication link configured in the link layer, the method further includes: Creating a response data packet through the application layer, wherein the response data packet includes a plurality of data segments; The parsing layer fills the data segment corresponding to the parsing layer with data information of the second valid data according to the protocol information, and the protocol layer fills the data segment corresponding to the protocol layer with non-data information according to the protocol information, to obtain a response data frame; the second valid data is the data to be transmitted; The link layer sends the response data frame based on the first communication link to respond to the received data.

14. An electronic device, characterized in that: The electronic device comprises: one or more processors; A memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the protocol stack data processing method according to any one of claims 8 to 13; One or more input / output I / O interfaces are connected between the processor and the memory and are configured to implement information interaction between the processor and the memory.

15. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the protocol stack data processing method according to any one of claims 8 to 13.

Citation Information

Cited By

  • Protocol stack architecture, protocol stack data processing method, electronic device, and storage medium

    EP4776603A1