Automatic access method for multiple types of interfaces

By establishing a three-level architecture and configuration files for complex systems, automatic access to the electrical interfaces of complex systems is achieved, solving the problem of low efficiency in manual debugging in existing technologies and improving the automation and consistency of interface debugging.

CN122634901APending Publication Date: 2026-08-25FOSHAN BIJIASUO INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610808498.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-05
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

In existing technologies, the design and debugging of electrical interfaces for complex systems rely on manual code modification, which leads to high workload, error-proneness, low efficiency, and a lack of unified abstract models and automatic adaptation mechanisms, making it unable to adapt to combined scenarios of various operating systems and hardware architectures.

Method used

A three-tier architecture of operating system, electrical interface, and protocol encoding/decoding is established. This architecture is abstracted and decoupled through configuration files, and a unified software framework is built to enable automatic interface access. This includes standardized feature libraries at the operating system level, electrical interface level, and protocol encoding/decoding level, supporting dynamic configuration and automated data processing.

Benefits of technology

It achieves modularity and composability for accessing electrical interfaces of complex systems, lowers the debugging threshold, improves the work efficiency of designers and users, and has good cross-platform versatility and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122634901A_ABST
    Figure CN122634901A_ABST
Patent Text Reader

Abstract

This invention belongs to the field of electrical design and testing technology for complex systems, specifically an automatic access method for multiple types of interfaces. The method includes: abstracting the access process of commonly used electrical interfaces based on the operating system in complex systems, establishing a three-level architecture: operating system level, electrical interface level, and protocol encoding / decoding level; designing three-level configuration files for each of the three levels, separating the configuration files from the program code; and constructing a software framework based on the configuration files to read the configuration files and automatically create electrical interfaces, perform read / write operations, and monitor data. This invention, by establishing a three-level architecture and external configuration files, achieves the separation of configuration information from program code. Designers and users can complete interface adaptation without modifying the source code. The unified software framework improves the consistency and reliability of interface access design, significantly enhancing the efficiency and versatility of interface debugging in complex systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electrical design and testing technology for complex systems, specifically to an automatic access method for multiple types of interfaces. Background Technology

[0002] Complex systems (such as aerospace electronic systems, large-scale industrial control systems, communication base station equipment, and multi-node distributed systems) are generally characterized by a large number of electrical interfaces, small cluster size, diverse interface protocols, and diversified operating platforms and operating systems. Furthermore, complex systems are typically a process of gradual assembly and integration, requiring read / write access to various electrical interfaces, data debugging, and communication verification at each stage.

[0003] In existing technologies, the aforementioned work often relies on professional system designers to develop interface drivers and design protocol encoding / decoding based on the current state of the system. Specifically, whenever a new electrical interface is added to the system, the operating system platform is changed, or the communication protocol is adjusted, designers need to rewrite or modify the underlying code, including the operating system adaptation layer code, interface driver code, and protocol parsing code.

[0004] However, with social progress and increasingly stringent customer demands, traditional targeted development and debugging methods have the following technical shortcomings: Firstly, professional designers are constantly modifying designs and responding to changes, resulting in a high workload and a high risk of human error. Whenever interface parameters or protocols change, the relevant code needs to be recompiled, linked, and deployed, leading to long iteration cycles.

[0005] Secondly, interface users (such as system integration testers and field debugging engineers) often lack the professional design capabilities for low-level driver development and protocol encoding and decoding. They cannot complete the interface adaptation work independently and can only wait for the designers to modify the code for verification. This makes the debugging work highly dependent on the designers' schedules, which seriously reduces the overall work efficiency of complex systems.

[0006] Third, when faced with a combination of multiple operating systems (Windows, Linux, iOS, Android, etc.), multiple hardware architectures (x86, DSP, SPARC, ARM, etc.), and multiple electrical interfaces (network port, serial port, IO, PCI, PCI-E, ISA, etc.), existing technologies lack a unified abstract model and automatic adaptation mechanism. Each combination change requires redevelopment, lacking universality and reusability.

[0007] Therefore, there is an urgent need to establish an efficient and reliable design method for automatic access to multiple types of interfaces, which can automatically perform hardware access and software protocol matching, while improving the efficiency of interface debugging for designers and users, and solving the practical problem of time-consuming interface debugging. Summary of the Invention

[0008] To address the shortcomings of existing technologies, this invention provides an automatic access method for multiple types of interfaces, thus resolving the problems mentioned below.

[0009] To achieve the above objectives, the present invention provides the following technical solution: An automatic access method for multiple interface types includes the following steps: Step 1: Abstract the electrical interface access process based on the operating system in complex systems into a three-level architecture that is decoupled from each other: operating system level, electrical interface level, and protocol encoding / decoding level; establish standardized feature libraries for each corresponding level and solidify the common processing logic of each level; Step 2: For the three-tier architecture, design operating system-level configuration files, electrical interface-level configuration files, and protocol codec-level configuration files that are completely separated from the program code; the configuration files are stored in structured text format and support dynamic loading and updates; Step 3: Construct a unified software framework based on a three-level configuration file. The software framework automatically reads and verifies the configuration file, and completes interface instantiation, parameter configuration, automatic data encoding and decoding, sending and receiving, and full-dimensional status monitoring based on the configuration information, without modifying the underlying source code. Furthermore, the specific method for establishing the operating system-level feature library is as follows: Classify commonly used operating system platforms for complex systems and establish operating system category characteristics, including Windows, Linux, iOS, Android, VxWorks, and QNX; solidify file system access interfaces, memory mapping methods, and hardware and software interrupt handling functions for the same type of operating system; Establish bit width category features to distinguish the differences in internal variable length and memory alignment rules caused by 8-bit, 16-bit, 32-bit, 64-bit, and 128-bit bit widths; establish platform category features to distinguish the little-endian encoding of x86 and DSP, the big-endian encoding of SPARC, PowerPC, and some ARM, as well as the mixed encoding. The above features are combined to form a system-level feature library, which automatically completes operating system matching, byte order conversion and memory parameter settings based on feature identifiers.

[0010] Furthermore, the specific method for establishing the electrical interface-level feature library is as follows: Commonly used electrical interfaces in complex systems are classified into network ports, serial ports, I / O ports, TTL level interfaces, RS-485 interfaces, CAN interfaces, PCI interfaces, PCI-E interfaces, ISA interfaces, and USB interfaces. Standardized electrical parameter features are extracted for each type of electrical interface: network port parameters include IP address, port number, network connection method, and timeout; serial port parameters include serial port number, baud rate, data bits, stop bits, parity bits, and flow control method; PCI / PCI-E interface parameters include bus number, device number, function number, read / write status address, data address, and interrupt number; I / O port parameters include input / output direction, level threshold, and pull-up / pull-down configuration. The above features are combined to form an interface-level feature library, including interface name, interface type features, and interface parameter features; the interface parameter features are stored in a key-value pair structure and support parameter expansion.

[0011] Furthermore, the specific method for establishing the protocol codec-level feature library is as follows: Electrical interface communication protocols are classified by direction, including single-receive type, single-transmit type, bidirectional transceiver type, and half-duplex type; Classified by frequency, it includes fixed frequency type, variable frequency type, event-triggered type and no frequency type; Based on data length, the data types are categorized into fixed-length, variable-length, and variable-length fields with specified lengths. According to the verification method, it includes fixed value verification, sum verification, XOR verification, CRC8 / CRC16 / CRC32 verification, and MD5 verification; Based on encoding method, it can be classified into fixed encoding, escape character encoding, Base64 encoding, and JSON encoding; The above features are combined to form a protocol-level feature library, which is recorded in tabular form: interface name, data reception type, data reception frequency, data reception length, data reception flag group, data transmission type, data transmission frequency, data transmission length, data transmission flag group, verification method, and encoding method. The flag group consists of frame header flag, frame tail flag, address flag, and function code flag. The flag group has a constraint relationship with the data transmission and reception length: when frame header and frame tail flags are present, the data transmission and reception length is the number of bytes between the frame header and frame tail; when length field flag is present, the data transmission and reception length is determined by the length field value.

[0012] Furthermore, the specific design method of the three-level configuration file is as follows: The operating system configuration file includes the OS type, platform bit width, byte order, platform architecture, and memory page size; The electrical interface configuration file includes the interface's unique identifier, interface name, interface type, interface parameter list, interface priority, and timeout period. The protocol configuration file includes associated interface identifiers, data direction, send / receive frequency, length type, flag group configuration, verification algorithm parameters, encoding method parameters, and escape character mapping table; The configuration file supports incremental modification. To add a new interface or protocol, you only need to add the corresponding configuration section without modifying the original configuration content. It also supports configuration file version management and rollback.

[0013] Furthermore, the software framework of the present invention includes the following functional modules: Configuration parsing module: responsible for reading the three-level configuration file, performing syntax and semantic validation, and converting the configuration information into an internal unified data structure; Interface Management Module: Maintains the system interface linked list and is responsible for the creation, opening, closing, destruction, and dynamic adjustment of interface parameters; Protocol encoding / decoding module: It has a built-in general verification algorithm library and encoding algorithm library, which automatically completes the encoding and decoding of data frames according to the protocol configuration; Data caching module: Allocates independent circular receive and send buffers for each interface, and supports dynamic configuration of buffer size; The transmission scheduling module enables fixed-frequency timed transmission, variable-frequency adaptive transmission, and event-triggered transmission based on the transmission frequency configuration. Status monitoring and alarm module: Real-time statistics of interface operation indicators, and triggers multi-level alarms when the indicators exceed the threshold; Log recording module: Records logs for the entire process, including configuration changes, interface status, data transmission and reception, errors and exceptions, and supports log classification and export.

[0014] Furthermore, the software framework performs the following operations: The configuration parsing module reads the three-level configuration file and verifies the correctness of the file format, the completeness of required fields, the validity of parameter values, and the rationality of feature constraint relationships. The interface management module establishes a system interface linked list based on the verified configuration, traverses the linked list one by one to call the corresponding underlying driver function to set the interface parameters, create send and receive buffers and open the interface; The protocol encoding and decoding module establishes a read mapping, performs frame synchronization, verification, and decoding on the raw data in the receive buffer, and extracts valid data; it also establishes a send mapping, encoding the data to be sent into data frames that conform to the protocol specifications. The sending scheduling module reads data frames from the sending buffer and sends them through the corresponding interface according to the sending frequency configured in the protocol; The status monitoring and alarm module provides real-time statistics on indicators such as the number of received bytes, the number of valid frames, the number of verification errors, the number of lost packets, and the frequency deviation. An alarm is triggered when the verification error rate exceeds 5% or the interface fails to open three times in a row. The logging module writes all operations and status information to a log file, and supports filtering and querying by time, interface, and level.

[0015] Furthermore, this invention also includes a feature transfer and constraint mechanism between levels: Operating system-level byte order characteristics are automatically passed to the protocol encoding / decoding module for byte order conversion of data frames; The interface type characteristics at the electrical interface level constrain the maximum data frame length of the protocol encoding / decoding module; The transmit / receive frequency characteristics at the protocol encoding / decoding level constrain the interrupt handling priority of the interface management module.

[0016] Furthermore, this invention also includes a feature library expansion mechanism: By adding new operating system entries and corresponding processing functions to the system-level feature library, adaptation to new operating systems can be achieved. By adding new interface types and corresponding parameter templates and driver interfaces to the interface-level feature library, adaptation to newly added electrical interfaces can be achieved. By adding new verification and encoding algorithms to the protocol encoding / decoding module, adaptation to new communication protocols is achieved; all extensions do not require modification of the core software framework code.

[0017] Furthermore, the design of the access features between the levels in this invention includes: Operating system characteristics: OS type, platform bit width, platform architecture type; Electrical interface characteristics: interface name, interface type, interface parameter list; Data frame encoding / decoding characteristics: data direction, frequency, length type, check method, and encoding type; Based on the above three levels of features, a file reading and correctness verification mechanism is established for each level of features, and classification and matching are carried out step by step starting from the operating system level.

[0018] This invention provides an automatic access method for multiple types of interfaces. Compared with existing technologies, it has the following advantages: 1. By establishing a three-tier architecture of operating system, electrical interface, and protocol encoding / decoding, the multi-dimensional variation factors of electrical interface access in complex systems are decoupled and abstracted, realizing the modularity and composability of interface access design; 2. By converting the three-tier architecture into an external configuration file, the separation of configuration information and program code is achieved. Designers and users can complete the interface adaptation without modifying the source code, which greatly reduces the technical threshold for debugging. 3. By building a unified software program framework, the entire process from configuration file reading, automatic interface creation, parameter setting, data sending and receiving to status monitoring is automated, which improves the consistency and reliability of interface access design; 4. This method can improve the efficiency of interface debugging for both designers and users. Designers do not need to modify the code for each interface change, and users can independently complete the interface adaptation by modifying the configuration file, thus solving the practical problem of time-consuming interface debugging. 5. This method is applicable to various operating system platforms such as Windows, Linux, iOS, and Android, various hardware architectures such as x86, DSP, SPARC, and ARM, and various electrical interface types, and has good cross-platform versatility and scalability. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the three-level architecture of the automatic access method for multiple types of interfaces of the present invention; Figure 2 This is a schematic diagram illustrating the relationship between the three-level configuration file and the software framework of this invention; Figure 3 This is a flowchart illustrating the software program framework of the present invention. Figure 4 This is a schematic diagram illustrating the composition of the system-level feature library of the present invention; Figure 5 This is a schematic diagram illustrating the composition of the electrical interface-level feature library of the present invention; Figure 6 This is a schematic diagram of the field structure of the protocol encoding / decoding level feature library of this invention.

[0020] In the diagram: 100 - Operating system level, 200 - Electrical interface level, 300 - Protocol encoding / decoding level, 101 - Operating system category characteristics, 102 - Bit width category characteristics, 103 - Platform category characteristics, 201 - Interface name, 202 - Interface type characteristics, 203 - Interface parameter characteristics, 301 - Data direction, 302 - Frequency, 303 - Length type, 304 - Check method, 305 - Encoding method. Detailed Implementation

[0021] 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 embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] Example 1 like Figure 1As shown, this embodiment provides an automatic access method for multiple types of interfaces. This method is mainly designed for read and write access to commonly used electrical interfaces on operating system platforms in complex systems. Its core lies in establishing a three-level architecture design method of operating system + electrical interface + protocol encoding / decoding. By modifying the external configuration file, access to interfaces with different operating systems, types, and parameters, and automatic sending and receiving of data frames can be achieved.

[0023] Specifically, this method includes the following three main steps: Step 1: Establish a three-tier architecture The common electrical interface access process based on the operating system in complex systems is abstracted to establish a three-level architecture: operating system level 100, electrical interface level 200, and protocol encoding / decoding level 300.

[0024] like Figure 4 As shown, the operating system level 100 is used to classify and feature-design access methods for different operating systems. Specifically, it includes: (1) Classify the commonly used operating system platforms for complex systems and establish operating system category characteristics 101. Different operating systems, such as Windows, Linux, iOS, and Android, have different file systems and access methods. By solidifying the hardware and software interrupt access methods and mapping the corresponding processing functions of the same type of operating system, the differences in system-level characteristics can be effectively reduced and the consistency of the design can be improved.

[0025] (2) Establish bit width category features 102. Different bit widths corresponding to the same type of operating system, such as 8 bits, 16 bits, 32 bits, 64 bits, and 128 bits, will result in different lengths of internal variables, which need to be distinguished at the system level.

[0026] (3) Establish platform category characteristics 103. The same type of operating system may run on different system architectures. For example, x86 and DSP use typical little-endian encoding, while SPARC and some ARM use big-endian encoding. The difference in encoding has a significant impact on external communication. Therefore, platform category characteristics are established for automatic adaptation.

[0027] The above three features together constitute a system-level feature library, which can be automatically matched and parameter set by the operating system based on the feature identifier.

[0028] like Figure 5 As shown, the electrical interface level 200 is used to classify and characterize commonly used electrical interfaces in complex systems. Complex systems inevitably have multiple electrical interfaces, which may include various types. Specifically, these include: (1) Classify commonly used electrical interfaces, including network ports, serial ports, IO ports, TTL level interfaces, PCI interfaces, PCI-E interfaces, ISA interfaces, etc.

[0029] (2) Extract the electrical parameter features for each type of electrical interface. The parameters of the network port mainly include IP address, port number, network connection mode TCP, UDP, CAN, Websocket, etc.; the parameters of the serial port mainly include serial port number / name, baud rate; the parameters of the PCI and ISA interfaces mainly include read / write status address, data address, etc.

[0030] (3) Establish an interface-level feature library, including interface name 201, interface type feature 202, and interface parameter feature 203. The interface parameter feature uses identifiers to separate multiple parameters. The parameters of each interface are arranged in a fixed order to facilitate program parsing.

[0031] like Figure 6 As shown, the protocol codec level 300 is used for classifying and characterizing electrical interface communication protocols. Specifically, it includes: (1) Classified by direction: single-receive type, single-transmit type, bidirectional send and receive type, etc.

[0032] (2) Classified by frequency: fixed frequency type, variable frequency type and no frequency type.

[0033] (3) Classified by length: fixed length type and variable length type.

[0034] (4) Classified by verification method: fixed value verification, cyclic verification, sum verification, CRC verification, etc.

[0035] (5) Classified by encoding method: fixed encoding and dynamic encoding.

[0036] Because different types of interfaces may have exclusive or non-exclusive attributes, to unify characteristics, the actual situation of the send / receive direction and the data send / receive relationship of the interface needs to be presented side-by-side. The protocol-level feature library records the following fields in tabular form: interface name, data reception type, data reception frequency, data reception length, data reception flag group, data transmission type, data transmission frequency, data transmission length, and data transmission flag group. Among them, the flag group consists of zero to multiple groups, and the flag group has a constraint relationship with the data transmission / receive length, and the data transmission / receive length also has a constraint relationship with the data transmission / receive type.

[0037] Step 2: Create a three-level configuration file For the aforementioned three-tier architecture, operating system-level configuration files, electrical interface-level configuration files, and protocol codec-level configuration files are designed respectively. These three configuration files are stored as external, independent files in formats such as XML, JSON, or INI, completely separated from the program code.

[0038] The operating system configuration file includes: OS type, platform bit width, platform encoding type, etc.

[0039] The electrical interface configuration file includes: interface name, interface type, and interface parameter list. The interface parameter list is stored in the form of key-value pairs or a fixed-order parameter array.

[0040] The protocol configuration file includes: data direction, frequency, length type, verification method, encoding type, etc.

[0041] After determining the architecture of the operating system and hardware platform, electrical interfaces can be added, deleted, and modified by altering the aforementioned three-level configuration files. This also enables automatic matching of different software protocol encoding / decoding methods. This design transforms interface configuration from code modification to configuration file editing, significantly lowering the operational barrier.

[0042] Step 3: Build a configuration file-based software framework like Figure 2 and Figure 3 As shown, a software framework is constructed that can read interface configuration files based on a three-tier architecture and automatically create interfaces and perform data sending and receiving based on the configuration files. Specifically, it includes the following sub-steps: (3.1) Read the three-level configuration file and validate its validity. The validation includes checking whether the file format is correct, whether the required fields are complete, and whether the parameter values ​​are within the valid range.

[0043] (3.2) Establish a system interface linked list based on the verified configuration file. The interface linked list is a dynamic data structure used to store information on all electrical interfaces that the current system needs to open and manage. Each linked list node corresponds to an electrical interface and contains the three-level configuration information of that interface.

[0044] (3.3) Traverse the system interface linked list, set the interface parameters one by one, and create send and receive buffers. For different types of interfaces, call the corresponding underlying driver configuration function according to their characteristic parameters.

[0045] (3.4) Open the electrical interfaces one by one. If the opening fails, record the error log and decide whether to retry or skip based on the configuration.

[0046] (3.5) Establish a read mapping, automatically cache the received data information, and automatically perform data frame decoding. The decoding process is performed according to the verification method and encoding method in the protocol configuration file.

[0047] (3.6) Establish a transmission mapping, automatically perform data frame encoding processing, and then automatically transmit interface data according to frequency information. For periodically transmitted data, a timer can be started to transmit at a set frequency; for event-triggered data, it is transmitted immediately when the transmission queue is not empty.

[0048] (3.7) Establish interface data reception status monitoring, and statistical indicators include: received byte count, valid frame count, check error count, frequency anomaly record, etc.

[0049] (3.8) Establish interface data sending status monitoring, and the statistical indicators include: number of bytes sent and number of valid frames.

[0050] Through the aforementioned standard procedures and steps, a unified software framework has been established, improving the consistency and reliability of interface access design. Both professional designers and field users can quickly adapt the required interfaces by configuring external configuration files, enabling data testing and debugging at both ends of the interface, and easily obtaining data consistency and error rate results.

[0051] Example 2 This embodiment, based on Embodiment 1, further describes the design method for inter-level access features in a three-tier architecture.

[0052] The characteristics of the three layers—operating system level, electrical interface level, and protocol encoding / decoding level—are abstracted and unified, and the access characteristics between the layers are designed to enable the rapid selection and combination of different systems, interfaces, and protocols through layered combination.

[0053] The specific content of the three-layer features includes: Operating system characteristics: OS type, platform bit width, platform encoding type, etc. Electrical interface characteristics: serial number / name, type, parameter list, etc.; Data frame encoding and decoding characteristics: data direction, frequency, length type, check method, encoding type, etc.

[0054] Based on the above three levels of characteristics, a file reading and correctness verification mechanism is established for each level. Classification and matching are performed level by level, starting from the operating system level: first, the operating system type, bit width, and encoding method of the current platform are determined according to the operating system configuration file; then, each interface is created one by one according to the electrical interface configuration file; finally, the corresponding data transmission and reception protocol is configured for each interface according to the protocol configuration file.

[0055] Access relationships between layers are transmitted through a unified data structure. Operating system-level characteristic parameters affect the driver calling method at the electrical interface level, and electrical interface-level characteristic parameters affect the data reading and writing method at the protocol encoding and decoding level. The three form an organic whole.

[0056] Example 3 This embodiment provides a specific application example based on the above method.

[0057] During the integration and debugging of a complex communication system, the system includes one gigabit Ethernet port (UDP protocol) and two RS-232 serial ports, with a baud rate of 115200, fixed-length frames, and parity check. It runs on a Linux operating system based on the ARM architecture (64-bit, big-endian encoding).

[0058] According to the method of the present invention, the operation steps are as follows: (1) Write the operating system configuration file with the following content: OS type = Linux, bit width = 64 bits, hardware architecture type = ARM64, and the corresponding encoding type = big endian.

[0059] (2) Write the electrical interface configuration file, the content of which is: Interface 1 name=eth0, type=network port, parameter=[IP=192.168.1.100, port=8080, protocol=UDP]; Interface 2 name=ttyS0, type=serial port, parameter=[baud rate=115200, data bits=8, stop bits=1]; Interface 3 name=ttyS1, type=serial port, parameter=[baud rate=115200, data bits=8, stop bits=1].

[0060] (3) Write the protocol configuration file, the content of which is as follows: Interface 1 (eth0), receive type = receive number + transmit number, receive frequency = no frequency, receive length = variable length, transmit frequency = no frequency, transmit length = variable length, check method = fixed check (header check + tail check); Interface 2 (ttyS0), receive type = receive number + transmit number, receive frequency = fixed 100Hz, receive length = fixed length 64 bytes, transmit frequency = fixed 100Hz, transmit length = fixed length 64 bytes, check method = fixed check (header check) + checksum; Interface 3 (ttyS1), receive type = single receive, receive frequency = variable frequency, receive length = variable length, transmit type = none, check method = fixed check (header check + tail check).

[0061] (4) Place the above three configuration files in the configuration directory specified by the program and start the software framework.

[0062] (5) The software framework automatically reads and verifies the configuration file, establishes an interface linked list containing 3 interfaces, opens the network port and two serial ports in sequence, creates a transmit and receive buffer, establishes a read mapping and a send mapping, and starts automatic data transmission and reception.

[0063] (6) Debuggers can view the statistical information such as the number of bytes sent and received, the number of valid frames, and the number of verification errors of each interface in real time through the monitoring interface provided by the software framework.

[0064] During this process, the debugging personnel do not need to write any code; they can complete the adaptation of all interfaces simply by editing three configuration files. When it is necessary to modify the interface parameters (such as changing the serial port baud rate to 921600) or add a new CAN interface, only the corresponding configuration file needs to be modified and the software framework restarted; there is no need to recompile the program.

[0065] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0066] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for automatic access to multiple types of interfaces, characterized in that, Includes the following steps: Step 1: Abstract the electrical interface access process based on the operating system in a complex system into a three-level architecture that is decoupled from each other: operating system level, electrical interface level, and protocol encoding / decoding level; Establish standardized feature libraries for each corresponding level and solidify the common processing logic for each level; Step 2: For the three-tier architecture, design operating system-level configuration files, electrical interface-level configuration files, and protocol codec-level configuration files that are completely separated from the program code; the configuration files are stored in structured text format and support dynamic loading and updates; Step 3: Construct a unified software framework based on a three-level configuration file. The software framework automatically reads and verifies the configuration file, and completes interface instantiation, parameter configuration, automatic data encoding and decoding, sending and receiving, and full-dimensional status monitoring based on the configuration information, without modifying the underlying source code.

2. The automatic access method for multiple types of interfaces according to claim 1, characterized in that, The specific method for establishing the operating system-level feature library is as follows: Classify commonly used operating system platforms for complex systems and establish operating system category characteristics, including Windows, Linux, iOS, Android, VxWorks, and QNX; solidify file system access interfaces, memory mapping methods, and hardware and software interrupt handling functions for the same type of operating system; Establish bit width category features to distinguish the differences in internal variable length and memory alignment rules caused by 8-bit, 16-bit, 32-bit, 64-bit, and 128-bit bit widths; establish platform category features to distinguish the little-endian encoding of x86 and DSP, the big-endian encoding of SPARC, PowerPC, and some ARM, as well as the mixed encoding. The above features are combined to form a system-level feature library, which automatically completes operating system matching, byte order conversion and memory parameter settings based on feature identifiers.

3. The automatic access method for multiple types of interfaces according to claim 2, characterized in that, The specific method for establishing the electrical interface-level feature library is as follows: Commonly used electrical interfaces in complex systems are classified into network ports, serial ports, I / O ports, TTL level interfaces, RS-485 interfaces, CAN interfaces, PCI interfaces, PCI-E interfaces, ISA interfaces, and USB interfaces. For each type of electrical interface, standardized electrical parameter features are extracted: Network port parameters include IP address, port number, network connection method, and timeout; serial port parameters include serial port number, baud rate, data bits, stop bits, parity bits, and flow control method; PCI / PCI-E interface parameters include bus number, device number, function number, read / write status address, data address, and interrupt number; I / O port parameters include input / output direction, level threshold, and pull-up / pull-down configuration. The above features are combined to form an interface-level feature library, including interface name, interface type features, and interface parameter features; the interface parameter features are stored in a key-value pair structure and support parameter expansion.

4. The automatic access method for multiple types of interfaces according to claim 3, characterized in that, The specific method for establishing the protocol codec-level feature library is as follows: Electrical interface communication protocols are classified by direction, including single-receive type, single-transmit type, bidirectional transceiver type, and half-duplex type; Classified by frequency, it includes fixed frequency type, variable frequency type, event-triggered type and no frequency type; Based on data length, the data types are categorized into fixed-length, variable-length, and variable-length fields with specified lengths. According to the verification method, it includes fixed value verification, sum verification, XOR verification, CRC8 / CRC16 / CRC32 verification, and MD5 verification; Based on encoding method, it can be classified into fixed encoding, escape character encoding, Base64 encoding, and JSON encoding; The above features are combined to form a protocol-level feature library, which is recorded in tabular form: interface name, data reception type, data reception frequency, data reception length, data reception flag group, data transmission type, data transmission frequency, data transmission length, data transmission flag group, verification method, and encoding method. The flag group consists of frame header flag, frame tail flag, address flag, and function code flag. The flag group has a constraint relationship with the data transmission and reception length: when frame header and frame tail flags are present, the data transmission and reception length is the number of bytes between the frame header and frame tail; when length field flag is present, the data transmission and reception length is determined by the length field value.

5. The automatic access method for multiple types of interfaces according to claim 4, characterized in that, The specific design method for the three-level configuration file is as follows: The operating system configuration file includes the OS type, platform bit width, byte order, platform architecture, and memory page size; The electrical interface configuration file includes the interface's unique identifier, interface name, interface type, interface parameter list, interface priority, and timeout period. The protocol configuration file includes associated interface identifiers, data direction, send / receive frequency, length type, flag group configuration, verification algorithm parameters, encoding method parameters, and escape character mapping table; The configuration file supports incremental modification. To add a new interface or protocol, you only need to add the corresponding configuration section without modifying the original configuration content. Supports configuration file version management and rollback.

6. The automatic access method for multiple types of interfaces according to claim 5, characterized in that, The software framework includes the following functional modules: Configuration parsing module: responsible for reading the three-level configuration file, performing syntax and semantic validation, and converting the configuration information into an internal unified data structure; Interface Management Module: Maintains the system interface linked list and is responsible for the creation, opening, closing, destruction, and dynamic adjustment of interface parameters; Protocol encoding / decoding module: It has a built-in general verification algorithm library and encoding algorithm library, which automatically completes the encoding and decoding of data frames according to the protocol configuration; Data caching module: Allocates independent circular receive and send buffers for each interface, and supports dynamic configuration of buffer size; The transmission scheduling module enables fixed-frequency timed transmission, variable-frequency adaptive transmission, and event-triggered transmission based on the transmission frequency configuration. Status monitoring and alarm module: Real-time statistics of interface operation indicators, and triggers multi-level alarms when the indicators exceed the threshold; Log recording module: Records logs for the entire process, including configuration changes, interface status, data transmission and reception, errors and exceptions, and supports log classification and export.

7. The automatic access method for multiple types of interfaces according to claim 6, characterized in that, The software framework performs the following operations: The configuration parsing module reads the three-level configuration file and verifies the correctness of the file format, the completeness of required fields, the validity of parameter values, and the rationality of feature constraint relationships. The interface management module establishes a system interface linked list based on the verified configuration, traverses the linked list one by one to call the corresponding underlying driver function to set the interface parameters, create send and receive buffers and open the interface; The protocol encoding and decoding module establishes a read mapping, performs frame synchronization, verification, and decoding on the raw data in the receive buffer, and extracts valid data; it also establishes a send mapping, encoding the data to be sent into data frames that conform to the protocol specifications. The sending scheduling module reads data frames from the sending buffer and sends them through the corresponding interface according to the sending frequency configured in the protocol; The status monitoring and alarm module provides real-time statistics on indicators such as the number of received bytes, the number of valid frames, the number of verification errors, the number of lost packets, and the frequency deviation. An alarm is triggered when the verification error rate exceeds 5% or the interface fails to open three times in a row. The logging module writes all operations and status information to a log file, and supports filtering and querying by time, interface, and level.

8. The automatic access method for multiple types of interfaces according to claim 7, characterized in that, It also includes inter-level feature transfer and constraint mechanisms: Operating system-level byte order characteristics are automatically passed to the protocol encoding / decoding module for byte order conversion of data frames; The interface type characteristics at the electrical interface level constrain the maximum data frame length of the protocol encoding / decoding module; The transmit / receive frequency characteristics at the protocol encoding / decoding level constrain the interrupt handling priority of the interface management module.

9. The automatic access method for multiple types of interfaces according to claim 8, characterized in that, It also includes a feature library expansion mechanism: By adding new operating system entries and corresponding processing functions to the system-level feature library, adaptation to new operating systems can be achieved. By adding new interface types and corresponding parameter templates and driver interfaces to the interface-level feature library, adaptation to newly added electrical interfaces can be achieved. By adding new verification and encoding algorithms to the protocol encoding / decoding module, adaptation to new communication protocols is achieved; all extensions do not require modification of the core software framework code.

10. The automatic access method for multiple types of interfaces according to claim 9, characterized in that: The design of access features between the hierarchical levels includes: Operating system characteristics: OS type, platform bit width, platform architecture type; Electrical interface characteristics: interface name, interface type, interface parameter list; Data frame encoding / decoding characteristics: data direction, frequency, length type, check method, and encoding type; Based on the above three levels of features, a file reading and correctness verification mechanism is established for each level of features, and classification and matching are carried out step by step starting from the operating system level.