A method, device and medium for implementing middleware processing of a communication board
By introducing middleware processing methods on the communication board, the problem of inflexible data processing requirements between the communication board and the logic board is solved, achieving more efficient data processing and simplified platform maintenance.
Patent Information
- Application Number
- CN202211652116.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-21
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-12-21
AI Technical Summary
In existing railway signaling systems, the data processing requirements between communication boards and logic boards are inflexible, resulting in long data transmission times and inconvenient platform maintenance.
Middleware processing methods are introduced on the communication board. By registering processing functions and configuration files, special processing logic of the application can be implemented, supporting periodic and non-periodic tasks, and processing is independent of the logic board.
It improves the flexibility of the communication board and the versatility of the platform, reduces data transmission time, and simplifies the platform maintenance process.
Smart Images

Figure CN115964194B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to train signal control systems, and more particularly to a method, apparatus, and medium for implementing middleware processing on a communication board. Background Technology
[0002] Currently, a two-out-of-two architecture-based secure communication platform is widely used in the railway signaling field. Specific business logic is developed based on this secure platform for specific applications. A secure communication platform generally consists of a logic board and a communication board. The logic board implements secure data comparison functions, while the communication board implements basic data transmission and reception functions via network, serial port, or CAN bus communication methods. The logic board and communication board are connected through an internal network or bus.
[0003] Since most business logic involves security features, security platforms typically only expose interfaces on the logic board for application development. However, applications sometimes have special requirements for data processing on the communication board. For example, some functions may not involve security and can be processed outside the logic board to reduce the time spent transmitting data back and forth between the communication and logic boards; or special processing may be required on the communication data before security processing or before sending it to peripherals. In these cases, the platform either has to internally customize the application's special requirements or place these functions on the logic board, but such implementations are not flexible enough and are not conducive to platform maintenance. Summary of the Invention
[0004] The purpose of this invention is to overcome the defects of the prior art by providing a method, device and medium for implementing middleware processing on a communication board.
[0005] The objective of this invention can be achieved through the following technical solutions:
[0006] According to a first aspect of the present invention, a method for implementing middleware processing on a communication board is provided, the method comprising the following steps:
[0007] Step S1: Initialize the communication board middleware;
[0008] Step S2: When the communication board receives a message from the peripheral device, it determines whether the application has registered a corresponding processing function for the message. If a corresponding processing function has been registered, it is passed to the middleware for special processing; otherwise, it is sent directly to the logic board.
[0009] Step S3: When a message to be sent to a peripheral is received from the logic board, it is determined whether the application has registered a corresponding processing function for the message. If a corresponding processing function is registered, it is passed to the middleware for special processing; otherwise, it is sent directly to the peripheral.
[0010] As a preferred technical solution, step S1 specifically includes:
[0011] Step S11: Call the interface provided by the application to obtain whether the special processing of the application on the communication board requires a relevant configuration file;
[0012] Step S12: If a configuration file is required, request the relevant configuration file from the logic board and provide it to the application through the interface;
[0013] Step S13: Call the initialization interface provided by the application to perform the relevant application initialization;
[0014] Step S14: If the application needs to create a task for special processing of a certain message type, then create the relevant task.
[0015] As a preferred technical solution, the configuration files in step S11 are uniformly managed on the logic board.
[0016] As a preferred technical solution, the initialization in step S13 includes registering message types that need to be specially processed in the middleware, and providing relevant parameters and processing functions required for special processing.
[0017] As a preferred technical solution, the relevant parameters include whether a task or thread needs to be created, whether it is a periodic task, the task's wake-up period, priority, and stack size.
[0018] As a preferred technical solution, the processing function includes a processing function for messages received from peripherals, a processing function for messages received from the logic board that need to be sent to peripherals, and a main logic processing function.
[0019] As a preferred technical solution, step S2 is as follows:
[0020] Step S21: Determine whether the message type received from the peripheral device is a type that the application registered and needs to be specially processed in the middleware;
[0021] Step S22: If the message type requires special processing by the middleware, call the interface provided by the application to send the message to the application; otherwise, send it directly to the logic board.
[0022] Step S23: If the application needs to perform special processing on this message type in the task, and the task is not a periodic task, then directly release the semaphore to wake up the task and let the application process the message; in the task, call the main logic processing function registered by the application.
[0023] As a preferred technical solution, in step S23, for periodic tasks, the semaphore is periodically released to wake up the task during a timed interrupt.
[0024] As a preferred technical solution, in step S23, in the main logic processing function, after the application processes the message passed from the platform, it continues to call the platform's interface to send it to the logic board as needed, or directly returns the corresponding message to the peripheral device, or performs any other special processing.
[0025] As a preferred technical solution, step S3 is as follows:
[0026] Step S31: Determine whether the message type received from the logic board and that needs to be sent to the peripheral is a type that the application registered and needs to be specially processed in the middleware.
[0027] Step S32: If the message type requires special processing by the middleware, call the interface provided by the application to send the message to the application; otherwise, send it directly to the peripheral device.
[0028] Step S33: If the application needs to perform special processing on the message type in the task, and the task is not a periodic task, then directly release the semaphore to wake up the task and let the application process the message; in the task, call the main logical processing function registered by the application. In the main logical processing function, after the application processes the message passed in by the platform, it calls the platform's interface to send the message to the peripheral device.
[0029] As a preferred technical solution, in step S33, for periodic tasks, a semaphore is periodically released during a timed interrupt to wake up the task.
[0030] According to a second aspect of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the program to implement the method described thereon.
[0031] According to a third aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described thereon.
[0032] Compared with the prior art, the present invention has the following advantages:
[0033] 1. This invention designs a method for middleware processing on a communication board. Special processing of relevant message types can be achieved by registering corresponding processing functions for each type on the communication board. The specific processing logic can be defined by the application itself. For complex processing logic, corresponding tasks can be created, which can be periodically executed tasks or non-periodic tasks. Configuration files can be provided or not required during processing, providing great flexibility.
[0034] 2. This invention separates the basic communication functions of the platform communication board from the specific requirements of applications, thus maintaining the versatility of the platform's functions;
[0035] 3. If the platform itself needs to handle message types in a special way on the communication board, it can register the corresponding processing functions just like an application, without the need for iterative development of new versions, which is beneficial to the maintenance of the platform. Attached Figure Description
[0036] Figure 1 A flowchart of the initialization process of the communication board middleware;
[0037] Figure 2 A flowchart of the middleware processing procedure for receiving messages from peripherals;
[0038] Figure 3 A flowchart illustrating the middleware processing procedure for receiving messages from the logic board that need to be sent to peripherals;
[0039] Figure 4 This is a flowchart illustrating the specific process of the method of the present invention. Detailed Implementation
[0040] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0041] like Figure 1 As shown, a method for implementing middleware processing on a communication board includes:
[0042] Step S1: Initialize the communication board middleware;
[0043] Step S2: When a message is received from the peripheral device, determine whether the application has registered a corresponding processing function for the message. If a corresponding processing function is registered, pass it to the middleware for special processing; otherwise, send it directly to the logic board.
[0044] Step S3: When a message to be sent to a peripheral is received from the logic board, it is determined whether the application has registered a corresponding processing function for the message. If a corresponding processing function is registered, it is passed to the middleware for special processing; otherwise, it is sent directly to the peripheral.
[0045] The specific steps of S1 are as follows:
[0046] Step S11: Call the interface provided by the application to obtain whether the special processing of the application on the communication board requires relevant configuration files (configuration files are uniformly managed on the platform logic board to reduce the dispersion of data storage and facilitate the replacement of configuration files).
[0047] Step S12: If a configuration file is required, request the relevant configuration file from the logic board and provide it to the application through the interface;
[0048] Step S13: Call the initialization interface provided by the application to perform the relevant initialization of the application, including registering message types that need to be specially processed in the middleware, providing relevant parameters and processing functions required for special processing, such as whether a task (thread) needs to be created, whether it is a periodic task, the task's wake-up period, priority, stack size, etc. The processing functions include processing functions for messages received from peripherals, processing functions for messages received from the logic board that need to be sent to peripherals, and the main logic processing function.
[0049] Step S14: If the application needs to create a task for special processing of a certain message type, then create the relevant task.
[0050] The specific steps of S2 are as follows:
[0051] Step S21: Determine whether the message type received from the peripheral device is a type that the application registered and needs to be specially processed in the middleware;
[0052] Step S22: If the message type requires special processing by the middleware, call the interface provided by the application to send the message to the application; otherwise, send it directly to the logic board.
[0053] Step S23: If the application needs to perform special processing on this message type within a task, and the task is not a periodic task, then the semaphore is released directly to wake up the task and allow the application to process the message. For periodic tasks, the semaphore is released periodically to wake up the task within a timer interrupt. Within the task, the application's registered main logic processing function is called. In the main logic processing function, after processing the message from the platform, the application can, as needed, continue to call the platform's interface to send it to the logic board, or directly return the corresponding message to the peripheral device (without going through the logic board), or perform any other special processing, providing great flexibility.
[0054] The specific steps of S3 are as follows:
[0055] Step S31: Determine whether the message type received from the logic board that needs to be sent to the peripheral device is a type that the application registered and needs to be specially processed in the middleware;
[0056] Step S32: If the message type requires special processing by the middleware, call the interface provided by the application to send the message to the application; otherwise, send it directly to the peripheral device.
[0057] Step S33: If the application needs to perform special processing on this message type within a task, and the task is not a periodic task, then the semaphore is released directly to wake up the task and allow the application to process the message. For periodic tasks, the semaphore is released periodically to wake up the task within a timer interrupt. Within the task, the application's registered main logic processing function is called. In the main logic processing function, after processing the message received from the platform, the application calls the platform's interface to send it to the peripheral device.
[0058] refer to Figure 2-4 To illustrate the technical solution of the present invention, firstly, refer to... Figure 2 This describes the initialization process of the communication board middleware. Based on this, refer to... Figure 3 This section describes the processing procedure of the communication board middleware when receiving messages. For Figure 4 Since the processing of messages by the communication board middleware is very similar to that of receiving messages, it will not be described in detail here.
[0059] First refer to Figure 2 The initialization process of the communication board middleware processing method of the present invention is described, including the following steps:
[0060] Step 100: Call the interface provided by the application to obtain whether the application needs relevant configuration files when processing special types of messages on the communication board;
[0061] Step 101: If a configuration file is required, request the corresponding configuration file from the logic board and provide it to the application;
[0062] Step 102: Call the initialization interface provided by the application. In this interface, the application can read the configuration file to perform related initialization work, register message types requiring special processing by the communication board middleware, and register message receiving, sending, and main logical processing functions for each message type. If message processing requires task creation, relevant task parameters must also be provided, including task priority, stack size, whether periodic execution is required, and the period value. The application-registered receiving function is called when the communication board receives a message of the corresponding type from a peripheral device to transmit the message to the application. The registered sending function is called when the communication board receives a message of the corresponding type from the logic board to be sent to a peripheral device to transmit the message to the application. The main logical processing function is executed in the created processing task. In the main logical processing function, the application can obtain the messages that need to be processed from the platform, perform corresponding processing operations, and call the platform's interface to send the processed messages back to the platform, including sending them to the logic board or to peripheral devices.
[0063] Step 103: For message types that require the creation of processing tasks, the platform creates the corresponding tasks based on the parameters provided by the application.
[0064] First refer to Figure 3 This paper introduces the message receiving process of the communication board middleware processing method of the present invention. Since the sending and receiving processes are very similar, only the message receiving process is described. The sending process follows the same principle. The specific steps are as follows:
[0065] Step 104: The communication board receives messages from the peripheral device;
[0066] Step 105: Determine whether this type of message requires special processing by the communication board middleware;
[0067] Step 106: If no special processing is required from the communication board middleware, send it directly to the logic board; otherwise, proceed to the next step.
[0068] Step 107: Call the receiving and processing function of this type registered by the application to send the message to the application;
[0069] Step 108: If a processing task has been created for this message type and the task is not a periodic task, then release the semaphore to wake up the task; if it is a periodic task, then do not release the semaphore here, and release the semaphore periodically in the timer interrupt according to the period length of the task.
[0070] Step 109: The application processes the message, with at least two processing methods: If no processing task has been created for this message type, it can be processed directly in the receiving processing function; if a task has been created, it can be processed in the task's main logical processing function. The specific processing procedure and results can be defined by the application itself. For messages requiring the processing results to be sent to the logic board or peripherals, the platform provides interfaces for the application to call.
[0071] The above is an introduction to the method embodiments. The following embodiments using electronic devices and storage media will further illustrate the solution of the present invention.
[0072] The electronic device of this invention includes a central processing unit (CPU), which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) or loaded from a storage unit into random access memory (RAM). The RAM may also store various programs and data required for device operation. The CPU, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.
[0073] Multiple components in the device are connected to the I / O interface, including: input units such as keyboards and mice; output units such as various types of displays and speakers; storage units such as disks and optical discs; and communication units such as network interface cards (NICs), modems, and wireless transceivers. The communication unit allows the device to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0074] The processing unit executes the various methods and processes described above, such as methods S1 to S3. For example, in some embodiments, methods S1 to S3 may be implemented as computer software programs tangibly contained in a machine-readable medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed on the device via ROM and / or a communication unit. When the computer program is loaded into RAM and executed by the CPU, one or more steps of methods S1 to S3 described above may be performed. Alternatively, in other embodiments, the CPU may be configured to execute methods S1 to S3 by any other suitable means (e.g., by means of firmware).
[0075] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0076] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0077] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0078] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for implementing middleware processing on a communication board, characterized in that, The method includes the following steps: Step S1: Initialize the communication board middleware; Step S2: When the communication board receives a message from the peripheral device, it determines whether the application has registered a corresponding processing function for the message. If a corresponding processing function has been registered, it passes the message to the middleware for special processing; otherwise, it sends the message directly to the logic board. Step S3: When a message to be sent to a peripheral is received from the logic board, determine whether the application has registered a corresponding processing function for the message. If a corresponding processing function has been registered, the message is passed to the middleware for special processing; otherwise, it is sent directly to the peripheral.
2. The method for implementing middleware processing on a communication board according to claim 1, characterized in that, The specific steps of S1 are as follows: Step S11: Call the interface provided by the application to obtain whether the special processing of the application on the communication board requires a relevant configuration file; Step S12: If a configuration file is required, request the relevant configuration file from the logic board and provide it to the application through the interface; Step S13: Call the initialization interface provided by the application to perform the relevant application initialization; Step S14: If the application needs to create a task for special processing of a certain message type, then create the relevant task.
3. The method for implementing middleware processing on a communication board according to claim 2, characterized in that, The configuration files in step S11 are uniformly managed on the logic board.
4. A method for implementing middleware processing on a communication board according to claim 2, characterized in that, The initialization in step S13 includes registering message types that require special processing in the middleware, and providing the relevant parameters and processing functions required for special processing.
5. A method for implementing middleware processing on a communication board according to claim 4, characterized in that, The relevant parameters include whether a task or thread needs to be created, whether it is a periodic task, the task's wake-up cycle, priority, and stack size.
6. A method for implementing middleware processing on a communication board according to claim 4, characterized in that, The processing functions include processing functions for messages received from peripherals, processing functions for messages received from the logic board that need to be sent to peripherals, and a main logic processing function.
7. A method for implementing middleware processing on a communication board according to claim 1, characterized in that, The specific steps of S2 are as follows: Step S21: Determine whether the message type received from the peripheral device is a type that the application registered and needs to be specially processed in the middleware; Step S22: If the message type requires special processing by the middleware, call the interface provided by the application to send the message to the application; otherwise, send it directly to the logic board. Step S23: If the application needs to perform special processing on this message type in the task, and the task is not a periodic task, then directly release the semaphore to wake up the task and let the application process the message; in the task, call the main logic processing function registered by the application.
8. A method for implementing middleware processing on a communication board according to claim 7, characterized in that, In step S23, for periodic tasks, the semaphore is periodically released to wake up the task during a timer interrupt.
9. A method for implementing middleware processing on a communication board according to claim 7, characterized in that, In step S23, in the main logic processing function, after the application processes the message passed from the platform, it continues to call the platform's interface to send it to the logic board as needed, or directly returns the corresponding message to the peripheral device, or performs any other special processing.
10. A method for implementing middleware processing on a communication board according to claim 1, characterized in that, The specific steps of S3 are as follows: Step S31: Determine whether the message type received from the logic board and that needs to be sent to the peripheral is a type that the application registered and needs to be specially processed in the middleware. Step S32: If the message type requires special processing by the middleware, call the interface provided by the application to send the message to the application; otherwise, send it directly to the peripheral device. Step S33: If the application needs to perform special processing on this message type in the task, and the task is not a periodic task, then directly release the semaphore to wake up the task and let the application process the message; in the task, call the main logical processing function registered by the application. In the main logical processing function, after the application processes the message passed in by the platform, it calls the platform's interface to send the message to the peripheral device.
11. A method for implementing middleware processing on a communication board according to claim 10, characterized in that, In step S33, for periodic tasks, the semaphore is periodically released to wake up the task during a timer interrupt.
12. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 11.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Communication board hot plug method for a trackside safety platform
CN109800197A
CAN bus communication method for security computer
CN112398711A