Someip code generation method and device, computer terminal and storage medium

CN115129395BActive Publication Date: 2026-09-22BEI DOU ZHI LIAN KE JI YOU XIAN GONG SI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210817464.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-12
Publication Date
2026-09-22
Estimated Expiration
2042-07-12

AI Technical Summary

Technical Problem

而SOMEIP接口需求可以通过生成工具CommonAPI自动生成,但需要自己编写满足于前提的两个条件,也就是需要完成配置文件fdil与fdepl的编写,而编写的过程过于繁琐

Benefits of technology

[0024]本发明实施例公开了一种SOMEIP代码生成方法、装置、计算机终端及存储介质,该方法包括建立配置矩阵,所述配置矩阵内包括相关数据包的格式数据;逐个读取所述配置矩阵中各个数据包的格式数据,并且将读取到的格式数据分为第一类格式数据和第二类格式数据;将第一类格式数据按照第一类文件格式,写入所属数据包的第一类文件中,将第二类格式数据按照第二类文件格式,写入所属数据包的第二类文件中;根据所有的所述第一类文件和所述第二类文件,生成SOMEIP代码。使得用户不用自己编写配置文件,使得配置文件的生成自动化,使得SOMEIP代码生成自动化。极大提高工作效率,将参数统一规范写在配置矩阵中,不仅清晰明了,同时后续修改只需改变矩阵中的相关参数就可直接生成所需的源代码进行调用。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115129395B_ABST
    Figure CN115129395B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a SOMEIP code generation method and device, a computer terminal and a storage medium. The method comprises: establishing a configuration matrix, wherein the configuration matrix comprises format data of related data packets; reading the format data of each data packet in the configuration matrix one by one, and dividing the read format data into first type format data and second type format data; writing the first type format data into a first type file of the corresponding data packet according to a first type file format, and writing the second type format data into a second type file of the corresponding data packet according to a second type file format; and generating SOMEIP code according to all the first type files and the second type files. The user does not need to write the configuration file, the generation of the configuration file is automated, and the generation of the SOMEIP code is automated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of code generation, and more particularly to a SOMEIP code generation method, apparatus, computer terminal, and storage medium. Background Technology

[0002] Currently, with the continuous development of automotive intelligence, connectivity, electrification, and sharing, in this era of electronic information technology, automobiles are also gradually improving in terms of electronics. Furthermore, the widespread development of big data, vehicle networking, intelligent assistance, and autonomous driving has led to increasingly higher requirements for in-vehicle bandwidth and performance. In the past, in-vehicle networks primarily based on the CAN bus, communication was signal-oriented, meaning communication was based on the sender's needs. When the sender detected a change in signal value or the transmission cycle was over, it would send information without considering whether the receiver needed it. SOMEIP (Scalable service-Oriented Middleware over IP) is different; it only sends data when the receiver requests it. The advantage of this method is that it avoids excessive unnecessary data on the bus, thus reducing the load. While SOMEIP interface requirements can be automatically generated using the CommonAPI tool, it requires manual writing to meet two prerequisites: the configuration files fdil and fdepl, a process that is quite cumbersome. Summary of the Invention

[0003] Firstly, this application provides a SOMEIP code generation method, including:

[0004] Establish a configuration matrix, which includes the format data of relevant data packets;

[0005] The format data of each data packet in the configuration matrix is ​​read one by one, and the read format data is divided into a first type of format data and a second type of format data;

[0006] Write the first type of format data into the first type of file of the data packet according to the first type of file format, and write the second type of format data into the second type of file of the data packet according to the second type of file format;

[0007] Generate SOMEIP code based on all the first type of files and the second type of files.

[0008] Furthermore, generating SOMEIP code based on all the first type of files and the second type of files includes:

[0009] The contents of the first type of file and the second type of file are read using the commapi tool, and the first type of file and the second type of file are used as configuration files to generate the corresponding SOMEIP code.

[0010] Furthermore, the step of reading the format data of each data packet in the configuration matrix one by one includes:

[0011] Based on the packet name, read the format data related to each packet one by one, and cache the format data locally for parsing.

[0012] Furthermore, the step of dividing the read format data into a first type of format data and a second type of format data includes:

[0013] The data content of the methods, events, and attribute information in the format data is parsed, and the corresponding data content is classified into the first type of format data or the second type of format data.

[0014] Furthermore, the configuration matrix includes a first matrix and a second matrix, wherein the first matrix stores the data structure of the data packet, and the second matrix stores the specific content of each data type of the data packet.

[0015] Furthermore, the data structure of the data packet includes various combinations of packet name, interface name, interface ID, interface version, event group ID, transmission type, domain type, element name, protocol, input / output, parameter name, and parameter reference.

[0016] Furthermore, the first type of file is the fild configuration file, and the second type of file is the fdepl configuration file.

[0017] Secondly, this application provides a SOMEIP code generation apparatus, comprising:

[0018] An initialization module is used to establish a configuration matrix, which includes the format data of relevant data packets;

[0019] The classification module is used to read the format data of each data packet in the configuration matrix one by one, and to divide the read format data into a first type of format data and a second type of format data.

[0020] The configuration module writes the first type of format data into the first type of file of the corresponding data packet according to the first type of file format, and writes the second type of format data into the second type of file of the corresponding data packet according to the second type of file format;

[0021] The generation module is used to generate SOMEIP code based on all the first type of files and the second type of files.

[0022] Thirdly, this application provides a computer terminal, including a processor and a memory, wherein the memory stores a computer program, and the computer program executes the SOMEIP code generation method when it is run on the processor.

[0023] Fourthly, this application provides a readable storage medium storing a computer program that executes the SOMEIP code generation method when run on a processor.

[0024] This invention discloses a SOMEIP code generation method, apparatus, computer terminal, and storage medium. The method includes establishing a configuration matrix, which includes format data of relevant data packets; reading the format data of each data packet in the configuration matrix one by one, and classifying the read format data into a first type of format data and a second type of format data; writing the first type of format data into a first type file of the corresponding data packet according to a first type of file format, and writing the second type of format data into a second type file of the corresponding data packet according to a second type of file format; and generating SOMEIP code based on all the first type of files and the second type of files. This automates the generation of configuration files and SOMEIP code, eliminating the need for users to write configuration files themselves. It greatly improves work efficiency by standardizing the parameters in the configuration matrix, making it clear and easy to understand. Subsequent modifications only require changing the relevant parameters in the matrix to directly generate the required source code for use. Attached Figure Description

[0025] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope of protection of the present invention. In the various drawings, similar components are numbered similarly.

[0026] Figure 1 This paper illustrates a flowchart of a SOMEIP code generation method according to an embodiment of this application.

[0027] Figure 2 A schematic diagram of the configuration matrix of an embodiment of this application is shown;

[0028] Figure 3 A schematic diagram of a SOMEIP code generation device according to an embodiment of this application is shown. Detailed Implementation

[0029] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0030] The components of the embodiments of the invention described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0031] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of the invention, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.

[0032] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0033] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of the invention pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be interpreted as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of the invention.

[0034] The technical solution of this application is applied to the code generation of SOMEIP, an IP-based, scalable, service-oriented middleware. It provides a service-oriented communication interface, including a client and a server. SOMEIP only sends data when a request is made; otherwise, it does not send data, similar to the Direct mode of a COM module. This eliminates unnecessary data on the bus and reduces bus load.

[0035] To write the implementation code for SOMEIP, two configuration files, fidl and fdepl, need to be written first. The technical solution in this application is used to automatically generate these two configuration files, thereby automatically generating the required SOMEIP code.

[0036] Example 1

[0037] like Figure 1 As shown, a SOMEIP code generation method of this application includes the following steps:

[0038] Step S100: Establish a configuration matrix, which includes the format data of relevant data packets.

[0039] Before generating the configuration file, a configuration matrix needs to be generated first. This configuration matrix is ​​used to record the various formats of the data packets used.

[0040] For example, a data packet may have configuration parameters such as packet name, interface name, interface ID, interface version, event group ID, transport type, domain type, element name, protocol, input / output, parameter name, and parameter reference. These parameters standardize the structure of a data packet, enabling the data packet to interact with data according to the agreed protocol.

[0041] The configuration matrix includes a first matrix and a second matrix. The first matrix stores the data structure of the data packet, and the second matrix stores the specific content of each data type of the data packet. The elements corresponding to each row and column of the first matrix and the second matrix are the same, but the stored values ​​are different.

[0042] Specifically, such as Figure 2 The diagram shown is a schematic of the first matrix of this configuration matrix. For ease of display, only a portion of the elements are shown.

[0043] Figure 2 The document stores descriptions of two data packets, namely BAIC.TBOX and BAIC.HUM.

[0044] BAIC.TBOX occupies the second and third rows of the matrix, indicating that the packet can work under both BasrInformation and GNSSInformation interfaces, and can be sent and received under both interfaces.

[0045] The fourth line, BAIC.HUM, indicates that it operates under the RemoteVedioControl interface.

[0046] The second matrix is ​​similar in form to the first matrix, but it stores the specific details of the data types of each data packet, such as whether the data type is a structure or an enumeration. If it is a structure, each data member needs to be described. If the member is just a normal type or an array, the specific range is shown. If the nested structure contains multiple members, the specific details of each member also need to be described later.

[0047] This configuration matrix can be generated using Excel or a similar spreadsheet.

[0048] Step S200: Read the format data of each data packet in the configuration matrix one by one, and divide the read format data into a first type of format data and a second type of format data.

[0049] After generating the above configuration matrix, it is necessary to read the format data in this configuration matrix in order to generate the two types of configuration files required in the end. Therefore, it is necessary to parse the data packets being read and classify the format data in the data packets.

[0050] At the same time, a configuration file specific to each data packet needs to be generated, so the format data of each data packet in the configuration matrix needs to be read one by one.

[0051] Because the contents of the fidl and fdepl configuration files are different, the required data content is also different. Therefore, it is necessary to classify the data types of the regions, and the classification method is based on the differences between the two configuration files.

[0052] Therefore, the first type of format data and the second type of format data mentioned above correspond to the content required in the fidl and fdepl configuration files, respectively. Specifically, the first type of format data can be the format data required in the fidl configuration file, and the second type of format data is the format data required in the fdepl configuration file.

[0053] Similarly, such as Figure 2 As shown, because the same data packet can have different data structures and parameter configurations, a data packet may occupy multiple rows. Therefore, in an optional embodiment, the number of rows occupied by the data packet is first calculated, and then the data is read row by row by counting, and the data is classified once after each row is read.

[0054] When analyzing the structure of the data packet, the analysis proceeds step by step according to the interface of the data packet. Under each interface, there will be three types of information: the method, the event, and the attribute. Similarly, the above methods, events, and attributes will also have different types, which will derive more data packet data structures. Therefore, a data packet will occupy multiple lines. Each time, only one specific method, event, and attribute is parsed and then classified. When the parsing of one interface is completed, the analysis will jump to the position of the next interface to continue parsing.

[0055] It should be noted that because the configuration matrix includes a first matrix and a second matrix, for the same data packet, both matrices are read and classified simultaneously. Only when the data of the same data packet in both matrices has been read and classified will the reading and classification of the next data packet begin.

[0056] To reduce the pressure of reading file data, the format data related to each data packet can be read one by one according to the packet name, and the format data can be cached locally for subsequent parsing and classification operations.

[0057] Specifically, a data packet has multiple interfaces. When the interface is parsed as a method, information such as input / output and parameter attributes is extracted. If it is a field, information such as attributes and read / write permissions is extracted. If it is an event, information such as output and group is extracted. In this way, the data structure is extracted in a targeted manner.

[0058] Step S300: Write the first type format data into the first type file of the data packet according to the first type file format, and write the second type format data into the second type file of the data packet according to the second type file format.

[0059] When the first type of data obtained from the above steps is extracted, it is directly written into the first type file corresponding to the current data packet. Similarly, when the second type of data is extracted, it will also be directly written into the second type file corresponding to the current data packet.

[0060] The first type of file and the second type of file mentioned above are the fidl configuration file and the fdepl configuration file, respectively. The first type of file has the file format of the fidl configuration file, and the second type of file has the file format of the fdepl configuration file.

[0061] The write operation in this step can be performed synchronously with the classification operation described above. That is, when reading and classifying a data packet, each data packet is classified and the above write operation is performed on that data. If the format data of the current data packet is classified, it means that all the data has been written, and the fidl configuration file and fdepl configuration file corresponding to the data packet are generated.

[0062] Specifically, the data after classification can be stored in a string first. After all the formatted data of the data packet has been classified and written, the string can be output as a file stream to generate the corresponding configuration file.

[0063] It is important to know that this step is used to generate the first type of file and the second type of file, and the generation of these two files is not sequential; they are generated synchronously. That is, the synchronous process begins when the data of the configuration matrix is ​​read, and the corresponding configuration file is generated when a data packet is parsed.

[0064] For example, in a configuration matrix, there are 6 data packets. Starting from the first data packet, the contents of each data packet are read one by one. When the first data packet is parsed, a corresponding fidl configuration file and fdepl configuration file are generated. Then, the process jumps to the second data packet and starts a new round of parsing and generation operations. In the end, 6 pairs of fidl configuration files and fdepl configuration files are generated, which correspond to the structure data of the above 6 data packets. This configuration file can be used to generate SOMEIP code.

[0065] Step S400: Generate SOMEIP code based on all the first type of files and the second type of files.

[0066] After obtaining the fidl and fdepl configuration files, you can use the CommonAPI tool to automatically generate SOMEIP code.

[0067] There will be multiple configuration files, each representing the structure data of a data packet. When it is necessary to add, delete, or modify the structure type of a data packet, you only need to modify the data packet structure data stored in the above configuration matrix to update the data packet data, and then re-execute the above generation steps. The entire SOMEIP code generation is automated.

[0068] This application provides a SOMEIP code generation method. By generating a configuration matrix, which stores the structure data of relevant data packets, the matrix storage simplifies parsing and maintenance of the configuration matrix. After parsing the data, the required configuration file can be generated synchronously according to its format. Once the configuration file is obtained, SOMEIP code is automatically generated using the CommonAPI tool. Furthermore, subsequent code maintenance requires minimal technical intervention; simply changing the data packet format data in the table updates the code. This reduces repetitive work and time costs for technical personnel, making the development, maintenance, and application of the code simpler and more automated.

[0069] Example 2

[0070] like Figure 3 As shown, this application provides a SOMEIP code generation apparatus, comprising:

[0071] Initialization module 10 is used to establish a configuration matrix, which includes the format data of relevant data packets;

[0072] The classification module 20 is used to read the format data of each data packet in the configuration matrix one by one, and to divide the read format data into a first type of format data and a second type of format data.

[0073] Configuration module 30 writes the first type of format data into the first type of file of the data packet according to the first type of file format, and writes the second type of format data into the second type of file of the data packet according to the second type of file format;

[0074] The generation module 40 is used to generate SOMEIP code based on all the first type of files and the second type of files.

[0075] Thirdly, this application provides a computer terminal, including a processor and a memory, wherein the memory stores a computer program, and the computer program executes the SOMEIP code generation method when it is run on the processor.

[0076] Fourthly, this application provides a readable storage medium storing a computer program that executes the SOMEIP code generation method when run on a processor.

[0077] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, as an alternative implementation, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0078] In addition, the functional modules or units in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0079] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0080] 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 changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A SOMEIP code generation method, characterized in that, include: Establish a configuration matrix, which includes the format data of relevant data packets; The format data of each data packet in the configuration matrix is ​​read one by one, and the read format data is divided into a first type of format data and a second type of format data; Write the first type of format data into the first type of file of the data packet according to the first type of file format, and write the second type of format data into the second type of file of the data packet according to the second type of file format; Generate SOMEIP code based on all the first type of files and the second type of files; The step of reading the format data of each data packet in the configuration matrix one by one includes: Based on the packet name, read the format data related to each packet one by one, and cache the format data locally for parsing; The process of dividing the read formatted data into a first type of formatted data and a second type of formatted data includes: Parse the data content of the methods, events, and attribute information in the formatted data, and classify the corresponding data content into the first type of formatted data or the second type of formatted data; The first type of file is the fild configuration file, and the second type of file is the fdepl configuration file.

2. The SOMEIP code generation method according to claim 1, characterized in that, The step of generating SOMEIP code based on all the first type of files and the second type of files includes: The contents of the first type of file and the second type of file are read using the commapi tool, and the first type of file and the second type of file are used as configuration files to generate the corresponding SOMEIP code.

3. The SOMEIP code generation method according to claim 1, characterized in that, The configuration matrix includes a first matrix and a second matrix. The first matrix stores the data structure of the data packet, and the second matrix stores the specific content of each data type of the data packet.

4. The SOMEIP code generation method according to claim 3, characterized in that, The data structure of the data packet includes various combinations of packet name, interface name, interface ID, interface version, event group ID, transport type, domain type, element name, protocol, input / output, parameter name, and parameter reference.

5. A SOMEIP code generation device, characterized in that, include: An initialization module is used to establish a configuration matrix, which includes the format data of relevant data packets; The classification module is used to read the format data of each data packet in the configuration matrix one by one, and to divide the read format data into a first type of format data and a second type of format data. The configuration module writes the first type of format data into the first type of file of the corresponding data packet according to the first type of file format, and writes the second type of format data into the second type of file of the corresponding data packet according to the second type of file format; The generation module is used to generate SOMEIP code based on all the first type of files and the second type of files; The step of reading the format data of each data packet in the configuration matrix one by one includes: Based on the packet name, read the format data related to each packet one by one, and cache the format data locally for parsing; The process of dividing the read formatted data into a first type of formatted data and a second type of formatted data includes: Parse the data content of the methods, events, and attribute information in the formatted data, and classify the corresponding data content into the first type of formatted data or the second type of formatted data; The first type of file is the fild configuration file, and the second type of file is the fdepl configuration file.

6. A computer terminal, characterized in that, It includes a processor and a memory, the memory storing a computer program that, when run on the processor, executes the SOMEIP code generation method according to any one of claims 1 to 4.

7. A readable storage medium, characterized in that, It stores a computer program that, when run on a processor, executes the SOMEIP code generation method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • SOMEIP communication intermediate layer code implementation method and system

    CN111475149A

  • SOMEIP communication intermediate layer implementation method and system based on SOA architecture of vehicle-mounted Android system

    CN113407362A