Protocol stack attribute modification method and device
By obtaining target calibration attributes in the software architecture of the on-board ECU and establishing an address mapping table, the problem of cumbersome adjustment of protocol stack attributes in the existing technology is solved, and a more efficient development process is achieved and labor costs are reduced.
Patent Information
- Application Number
- CN202411929921.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-12-25
AI Technical Summary
In the software architecture of existing on-board ECUs, the adjustment of the communication protocol stack attributes requires reconfiguring the underlying software and updating the communication description file, resulting in cumbersome development process, long time and high labor costs.
By obtaining the target calibration attributes, finding the corresponding preset attribute calibration list, determining the attribute array in the protocol stack, and modifying its constant type to variable type, establishing an address mapping table to modify the protocol stack attributes.
The modification process of protocol stack attributes is simplified, the workload of engineers is reduced, labor costs are reduced, and development efficiency is improved.
Smart Images

Figure CN119676326A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automotive electronics technology, and in particular to a method and device for modifying protocol stack attributes. Background Art
[0002] The vehicle communication protocol stack is a set of protocols for inter-vehicle communication, which defines the protocols and specifications required for data exchange and communication within and between vehicles. Therefore, in the actual vehicle model development process, it is inevitable to adjust some signals and message properties of the communication protocol stack.
[0003] Among them, the software architecture of most existing on-board ECUs usually adopts the Automotive Open System Architecture (AUTOSAR), but the various attributes in the AUTOSAR software architecture are statically configured, and according to the existing on-board communication protocol stack development process, any adjustment of communication attributes needs to be modified accordingly based on the communication requirements, and the communication description file needs to be updated, the underlying software also needs to be reconfigured, and the code also needs to be reintegrated and debugged, resulting in the entire development process involving a large number of engineers, high labor costs, and the attribute adjustment process is cumbersome and time-consuming, which undoubtedly brings a large workload to engineers. Summary of the invention
[0004] Based on the above-mentioned deficiencies of the prior art, the present application provides a method and device for modifying protocol stack attributes to solve the problem of heavy workload for engineers brought about by the prior art.
[0005] In order to achieve the above objectives, this application provides the following technical solutions:
[0006] The first aspect of the present application provides a method for modifying a protocol stack attribute, comprising:
[0007] Obtain a target calibratable attribute, and search for a target preset attribute calibration list corresponding to the target calibratable attribute from all preset attribute calibration lists;
[0008] Based on the target calibratable attribute, determining an attribute array in a protocol stack; wherein the attribute array is composed of a plurality of protocol stack attributes;
[0009] Modify the constant type of the attribute array to a variable type, obtain a target attribute array, and store the target attribute array in RAM;
[0010] According to the target preset attribute calibration list, an address mapping table of the target attribute array is established; wherein the address mapping table includes a mapping relationship between the target preset attribute calibration list and the target attribute array, and the number of index numbers in the address mapping table is the same as the number of calibratable attributes in the target preset attribute calibration list, and one index number in the address mapping table corresponds to one calibratable attribute in the target preset attribute calibration list;
[0011] Modify a plurality of the protocol stack attributes in the target attribute array according to the address mapping table and the target preset attribute calibration list.
[0012] Optionally, in the above-mentioned method for modifying a protocol stack attribute, modifying a plurality of the protocol stack attributes in the target attribute array according to the address mapping table and the target preset attribute calibration list includes:
[0013] Obtaining a first calibratable attribute from the target preset attribute calibration list;
[0014] Obtaining an index number corresponding to the first calibratable attribute from the address mapping table, and searching the target attribute array for a protocol stack attribute corresponding to the first calibratable attribute and the index number;
[0015] Assigning a value corresponding to the first calibratable attribute to the protocol stack attribute;
[0016] Detecting whether the first calibratable attribute is the last calibratable attribute in the attribute calibration list;
[0017] If the first calibratable attribute is not the last calibratable attribute in the attribute calibration list, obtaining the next calibratable attribute of the first calibratable attribute from the target preset attribute calibration list;
[0018] Determine the next calibratable attribute as the first calibratable attribute, return to execute to obtain the index number corresponding to the first calibratable attribute from the address mapping table, and search the protocol stack attribute corresponding to the first calibratable attribute and the index number from the target attribute array, until the first calibratable attribute is the last calibratable attribute in the attribute calibration list.
[0019] Optionally, in the above-mentioned method for modifying the protocol stack attributes, establishing the address mapping table of the target attribute array according to the target preset attribute calibration list includes:
[0020] Acquire all calibratable attributes from the target preset attribute calibration list;
[0021] Create index numbers of all identifiable attributes;
[0022] An address mapping table is established according to all index numbers, and the address mapping table is determined as the address mapping table of the target attribute array.
[0023] Optionally, in the above-mentioned method for modifying the protocol stack attributes, the method for establishing the preset attribute calibration list includes:
[0024] Get all calibrable attributes corresponding to all communication messages;
[0025] According to the data types of all the calibratable attributes corresponding to all the communication messages, all the calibratable attributes corresponding to the communication messages are classified respectively to obtain a set of calibratable attributes corresponding to each of the data types;
[0026] According to all the calibratable attribute sets, a plurality of corresponding preset attribute calibration lists are generated respectively; wherein one calibratable attribute set corresponds to one preset attribute calibration list.
[0027] Optionally, in the above-mentioned method for modifying the protocol stack attribute, determining the attribute array in the protocol stack based on the target calibratable attribute includes:
[0028] Obtaining a configuration file corresponding to the target calibratable attribute from a protocol stack;
[0029] Searching the configuration file for an attribute array corresponding to the target calibratable attribute;
[0030] Using a preset code to index the target calibratable attribute, obtaining an index array corresponding to the target calibratable attribute;
[0031] Determine whether the attribute array is consistent with the index array;
[0032] If the attribute array is consistent with the index array, determining the attribute array corresponding to the target calibratable attribute as the attribute array in the protocol stack;
[0033] If the attribute array is inconsistent with the index array, the index array is determined as the attribute array in the protocol stack.
[0034] A second aspect of the present application provides a device for modifying a protocol stack attribute, including:
[0035] An attribute acquisition unit, used for acquiring a target calibratable attribute, and searching for a target preset attribute calibration list corresponding to the target calibratable attribute from all preset attribute calibration lists;
[0036] An array determination unit, configured to determine an attribute array in a protocol stack based on the target calibratable attribute; wherein the attribute array is composed of a plurality of protocol stack attributes;
[0037] A type modification unit, used for modifying the constant type of the attribute array to a variable type, obtaining a target attribute array, and storing the target attribute array in a RAM;
[0038] An address establishing unit, used to establish an address mapping table of the target attribute array according to the target preset attribute calibration list; wherein the address mapping table includes a mapping relationship between the target preset attribute calibration list and the target attribute array, and the number of index numbers in the address mapping table is the same as the number of calibratable attributes in the target preset attribute calibration list, and one index number in the address mapping table corresponds to one calibratable attribute in the target preset attribute calibration list;
[0039] The attribute modification unit is used to modify the plurality of protocol stack attributes in the target attribute array according to the address mapping table and the target preset attribute calibration list.
[0040] Optionally, in the above-mentioned device for modifying protocol stack attributes, the attribute modification unit includes:
[0041] A first acquisition unit, configured to acquire a first calibratable attribute from the target preset attribute calibration list;
[0042] A first search unit, configured to obtain an index number corresponding to the first calibratable attribute from the address mapping table, and search the target attribute array for a protocol stack attribute corresponding to the first calibratable attribute and the index number;
[0043] an assignment unit, configured to assign a value corresponding to the first calibratable attribute to the protocol stack attribute;
[0044] a detection unit, configured to detect whether the first calibratable attribute is the last calibratable attribute in the attribute calibration list;
[0045] a second acquiring unit, configured to acquire a next calibratable attribute of the first calibratable attribute from the target preset attribute calibration list if the first calibratable attribute is not the last calibratable attribute in the attribute calibration list;
[0046] The attribute determination unit is used to determine the next calibratable attribute as the first calibratable attribute, and return to execute to obtain the index number corresponding to the first calibratable attribute from the address mapping table, and search the protocol stack attribute corresponding to the first calibratable attribute and the index number from the target attribute array, until the first calibratable attribute is the last calibratable attribute in the attribute calibration list.
[0047] Optionally, in the above-mentioned device for modifying protocol stack attributes, the address establishing unit includes:
[0048] A third acquisition unit, configured to acquire all calibratable attributes from the target preset attribute calibration list;
[0049] A creation unit, used to create index numbers of all the calibratable attributes;
[0050] The first determining unit is used to establish an address mapping table according to all index numbers, and determine the address mapping table as the address mapping table of the target attribute array.
[0051] Optionally, in the above-mentioned device for modifying the protocol stack attribute, it also includes:
[0052] A fourth acquisition unit, used to acquire all calibrable attributes corresponding to all communication messages;
[0053] A classification unit, used to classify all calibratable attributes corresponding to the communication messages according to the data types of all calibratable attributes corresponding to all the communication messages, to obtain a set of calibratable attributes corresponding to each data type;
[0054] The generating unit is used to generate a plurality of corresponding preset attribute calibration lists according to all the calibratable attribute sets respectively; wherein one calibratable attribute set corresponds to one preset attribute calibration list.
[0055] Optionally, in the above-mentioned device for modifying protocol stack attributes, the array determination unit includes:
[0056] A fifth acquisition unit, configured to acquire a configuration file corresponding to the target calibratable attribute from a protocol stack;
[0057] A second search unit, used for searching the attribute array corresponding to the target calibratable attribute from the configuration file;
[0058] An indexing unit, used to index the target calibratable attribute using a preset code to obtain an index array corresponding to the target calibratable attribute;
[0059] A judging unit, used for judging whether the attribute array is consistent with the index array;
[0060] A second determining unit, configured to determine the attribute array corresponding to the target calibratable attribute as the attribute array in the protocol stack if the attribute array is consistent with the index array;
[0061] The third determining unit is configured to determine the index array as the attribute array in the protocol stack if the attribute array is inconsistent with the index array.
[0062] The present application provides a method for modifying a protocol stack attribute, which obtains a target calibratable attribute, and searches for a target preset attribute calibration list corresponding to the target calibratable attribute from all preset attribute calibration lists, and then determines an attribute array in the protocol stack based on the target calibratable attribute. Wherein, the attribute array is composed of multiple protocol stack attributes, and then the constant type of the attribute array is modified to a variable type to obtain a target attribute array, and the target attribute array is stored in RAM, and then an address mapping table of the target attribute array is established according to the target preset attribute calibration list. Wherein, the address mapping table contains a mapping relationship between the target preset attribute calibration list and the target attribute array, and the number of index numbers in the address mapping table is the same as the number of calibratable attributes in the target preset attribute calibration list, and an index number in the address mapping table corresponds to a calibratable attribute in the target preset attribute calibration list, and finally, according to the address mapping table and the target preset attribute calibration list, multiple protocol stack attributes in the target attribute array are modified. Therefore, the calibrated attributes of the pre-calibrated target can be used to find the corresponding attribute calibration list and attribute array, and then the position mapping is performed based on the attribute calibration list and the established mapping table, and then the value obtained by the position mapping is overwritten into the protocol stack attribute in the attribute array, which effectively completes the modification of the calibration data, simplifies the entire process of attribute modification, and effectively solves the problem of heavy workload for engineers. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0064] Figure 1 A flowchart of a method for modifying a protocol stack attribute provided in an embodiment of the present application;
[0065] Figure 2 A schematic diagram of a process for establishing a preset attribute calibration list provided in an embodiment of the present application;
[0066] Figure 3A flowchart of a method for determining an attribute array provided in an embodiment of the present application;
[0067] Figure 4 A structural diagram of a data type modification provided in an embodiment of the present application;
[0068] Figure 5 A schematic diagram of the structure of an address mapping list provided in an embodiment of the present application;
[0069] Figure 6 A flowchart of a method for establishing an address mapping table provided in an embodiment of the present application;
[0070] Figure 7 A flowchart of another method for modifying protocol stack attributes provided in an embodiment of the present application;
[0071] Figure 8 A structural diagram of an address mapping process diagram provided in an embodiment of the present application;
[0072] Fig. 9 A schematic diagram of the structure of a device for modifying protocol stack attributes provided in another embodiment of the present application. DETAILED DESCRIPTION
[0073] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0074] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0075] The present application embodiment provides a method for modifying a protocol stack attribute, such as Figure 1 As shown, the specific steps include:
[0076] S101: Acquire a target calibratable attribute, and search for a target preset attribute calibration list corresponding to the target calibratable attribute from all preset attribute calibration lists.
[0077] It should be noted that the specific selection of calibratable attributes can be divided into two parts: first, based on actual needs, the calibration personnel or system engineers can calibrate the attributes that need to be modified according to the vehicle model or working conditions during the actual calibration process. Secondly, it is necessary to clarify these calibration attributes and whether the calibratable function can be realized on the protocol stack, because only by clarifying the calibratable attributes can the development object of the calibratable function be clarified, and subsequent vehicle-mounted development can be carried out.
[0078] For example, the calibration attributes can be the ID, data length, CAN / CANfd attributes of COM communication. The baud rate and sampling point of the CAN channel. The PGN, target address, and source address of the J1939 long message communication. The ID number, data length, read and write attributes of the diagnostic DID, the DTC code of the fault DTC, the number of fault confirmation and recovery times, and the cycle type. The ID range segment, node address, time parameters, etc. of the network management can all be achieved through calibration.
[0079] Therefore, the target calibratable attribute in step S101 refers to the attribute that the calibrator or system engineer currently modifies according to the vehicle model or working condition.
[0080] It should also be noted that the preset attribute list is established to clarify the calibrable attributes, and to clarify the development objects of the calibrable attributes and their sorting order. For example, the calibrable attribute ID of the CAN sent message, in the preset attribute list, it is clear that the ID needs to be modified. The ID is the attribute of the CAN message. The development project has a total of 2 CAN channels, each with 100 frames of CAN sent messages, and then it needs to be arranged in the order of sending messages to obtain the preset attribute list, such as the CANID attribute list shown in Table 1:
[0081] Table 1
[0082] ID of CAN1MSG1 CAN1MSG2 ID ID of CAN1MSG3 … CAN1MSG100 ID CAN2MSG1 ID CAN2MSG2 ID CAN2MSG3 ID … CAN2MSG100 ID
[0083] It should also be noted that in the embodiment of the present application, a type of calibrable attribute corresponds to a preset attribute list. For example, the calibrable attribute of data length, then the preset attribute list only contains the data length and does not contain the ID. Therefore, when you want to modify an attribute, the list will no longer contain other types of irrelevant attributes, so you can flexibly and effectively locate the attribute you want to calibrate quickly, thereby realizing the modification of the protocol stack attributes.
[0084] Optionally, the present application embodiment provides a method for establishing a preset attribute calibration list, such as Figure 2 As shown, the following steps are included:
[0085] S201. Obtain all calibratable attributes corresponding to all communication messages.
[0086] Specifically, to obtain all the calibrable attributes corresponding to the communication message, it is usually necessary to parse and analyze the protocol stack. The protocol stack defines the structure and fields of the communication message, and each field may have some calibrable attributes. First, the protocol stack needs to be parsed to understand the structure and field meaning of the communication message, and then identify the fields in each communication message, and determine the meaning and purpose of each field. These fields may include message headers, data fields, check fields, etc. For each field, the calibrator or system engineer determines its calibrable attributes. These attributes may include data types, value ranges, units, sampling rates, parsing methods, etc. Then, for each field, extract its calibrable attribute information. Then associate all the attributes with the corresponding fields to obtain all the calibrable attributes.
[0087] S202: Classify all calibratable attributes corresponding to all communication messages according to their data types, and obtain a set of calibratable attributes corresponding to each data type.
[0088] It should be noted that in order to better organize and manage these calibratable attributes and facilitate subsequent data processing, all calibratable attributes need to be classified according to data types.
[0089] S203: Generate corresponding multiple preset attribute calibration lists according to all calibrable attribute sets.
[0090] Among them, a set of calibrable attributes corresponds to a preset attribute calibration list.
[0091] It is understandable that, through the generated preset attribute calibration list, the calibrator or system engineer can more conveniently select the attribute to be modified according to the data type for calibration, thereby effectively speeding up the efficiency of calibrating the attributes.
[0092] S102: Determine an attribute array in a protocol stack based on the target calibratable attribute.
[0093] Among them, the attribute array consists of multiple protocol stack attributes.
[0094] It should be noted that in the embodiment of the present application, the AUTOSAR software architecture is used as the scenario application. Therefore, if you want to modify the attributes in the AUTOSAR protocol stack accordingly according to the attributes that need to be modified according to the vehicle model or working conditions, that is, the target calibrable attributes, it is necessary to clarify which protocol stack attributes in the AUTOSAR protocol stack are affected by the target calibrable attributes, so as to complete the development of the vehicle communication protocol stack. Therefore, it is necessary to determine the attribute array in the AUTOSAR protocol stack according to the target calibrable attributes, that is, the array composed of which protocol stack attributes in the AUTOSAR protocol stack are affected.
[0095] Optionally, in another embodiment of the present application, a specific implementation of step S102 is as follows: Figure 3 As shown, the following steps are included:
[0096] S301. Obtain a configuration file corresponding to a target calibrable attribute from a protocol stack.
[0097] Specifically, if you want to know which attribute array in the AUTOSAR protocol stack is affected by the target calibratable attribute, you need to start from the source, that is, find out which configuration file in the protocol stack is configured based on the target calibratable attribute, so that you can then find the attribute array in the AUTOSAR protocol stack related to the target attribute from the configuration file.
[0098] S302: Search the configuration file for an attribute array corresponding to the target calibratable attribute.
[0099] It should be noted that the configuration file corresponding to the target calibratable attribute records all data related to the target calibratable attribute, including relevant data in the AUTOSAR protocol stack. Therefore, according to the configuration file found in step S301, the attribute array in the AUTOSAR protocol stack corresponding to the target calibratable attribute can be found from the configuration file.
[0100] S303: Use a preset code to index the target calibratable attribute to obtain an index array corresponding to the target calibratable attribute.
[0101] Specifically, in order to further determine whether the attribute array corresponding to the target calibratable attribute found from the configuration file is accurate, it is also necessary to read the code of the AUTOSAR protocol stack, because in the code of each level in the protocol stack, there will be statements for verifying or indexing the target calibratable attribute, so that through the verification or indexing statements, the accurate target calibratable attribute can be found to affect the array composed of multiple protocol stack attributes in the AUTOSAR protocol stack, that is, the attribute array.
[0102] S304: Determine whether the attribute array is consistent with the index array.
[0103] It is understandable that in order to verify whether the attribute array found from the configuration file is accurate, it is necessary to further determine whether the attribute array is consistent with the index array. If the attribute array is consistent with the index array, it means that the attribute array found from the configuration file is accurate, so step S305 is executed. If the attribute array is inconsistent with the index array, it means that the attribute array found from the configuration file is inaccurate, so step S306 is executed.
[0104] S305: Determine the attribute array corresponding to the target calibratable attribute as the attribute array in the protocol stack.
[0105] It can be understood that when the attribute array is consistent with the index array, it means that the protocol stack attribute in the attribute array found from the configuration file is the attribute to be modified accordingly later, so step S305 needs to be executed.
[0106] S306: Determine the index array as an attribute array in the protocol stack.
[0107] Specifically, when the attribute array is inconsistent with the index array, it means that the protocol stack attributes in the attribute array found in the configuration file are not the attributes to be modified accordingly subsequently. The index array is the array composed of multiple protocol stack attributes in the AUTOSAR protocol stack affected by the target calibrable attributes. Therefore, the index array needs to be determined as the attribute array in the protocol stack for subsequent modifications.
[0108] S103: Modify the constant type of the attribute array to a variable type, obtain a target attribute array, and store the target attribute array into RAM.
[0109] It should be emphasized that in the AUTOSAR software architecture, attribute arrays are stored in the FLASH space as constant types, which makes it impossible to modify the attribute arrays in the FLASH space. Therefore, in the embodiment of the present application, the constant type of the attribute array is modified to a variable type by modifying the data type and stored in the RAM, so that the attribute array can be modified in the RAM. Among them, the variable type refers to the variable type that can be changed at runtime.
[0110] For example, see Figure 4 As shown, in the FLASH space, AUTOSAR attribute array 1, AUTOSAR attribute array 2 and AUTOSAR attribute array 3 are arrays related to the calibratable attributes, AUTOSAR attribute array A, AUTOSAR attribute array B and AUTOSAR attribute array C are arrays not related to the calibratable attributes. After the data type is modified, AUTOSAR attribute array 1, AUTOSAR attribute array 2 and AUTOSAR attribute array 3 are stored in RAM.
[0111] S104: Establish an address mapping table of the target attribute array according to the target preset attribute calibration list.
[0112] It should be noted that since the target calibratable attribute usually has multiple different entities, each entity has its own calibratable attribute of the same type as the target calibratable attribute stored in the target preset attribute calibration list, and each entity corresponds to a protocol stack attribute in the attribute array, so the target preset attribute calibration list contains the target calibratable attribute and the calibratable attribute of the same type corresponding to each entity. For example, the target calibratable attribute is CANID, and the calibratable attributes of the same type corresponding to multiple different entities are the ID of the first message of CAN1, the ID of the second message of CAN1, and the ID of the third message of CAN1, etc. Therefore, the target preset attribute calibration list stores the ID of the first message of CAN1, the ID of the second message of CAN1, and the ID of the third message of CAN1, etc.
[0113] Therefore, it is necessary to correspond all the calibratable attributes in the target preset attribute calibration list to the protocol stack attributes in the attribute array one by one, so as to complete the replacement of the calibration data, and then to complete the development of the communication protocol stack. Therefore, in the embodiment of the present application, by adopting the position mapping method, all the calibratable attributes in the target preset attribute calibration list are respectively corresponded to the protocol stack attributes in the attribute array one by one, so it is necessary to establish an address mapping table of the target attribute array accordingly based on all the data in the target preset attribute calibration list.
[0114] Among them, the address mapping table contains the mapping relationship between the target preset attribute calibration list and the target attribute array, and the number of index numbers in the address mapping table is the same as the number of calibrable attributes in the target preset attribute calibration list, and an index number in the address mapping table corresponds to a calibrable attribute in the target preset attribute calibration list.
[0115] For example, you can refer to Figure 5 As shown in the content, the number of elements in the address mapping table will be the same as the user attribute calibration list (i.e., the target preset attribute calibration list), and will correspond to it one by one. In addition, the address mapping table also stores the subscript index number of the attribute array (i.e., the AUTOSAR attribute array). The mapping relationship between the user attribute calibration list and the AUTOSAR attribute array is established through the address mapping table.
[0116] Optionally, in another embodiment of the present application, a specific implementation of step S104 is as follows: Figure 6 As shown, the following steps are included:
[0117] S601. Obtain all calibratable attributes from a target preset attribute calibration list.
[0118] S602: Create index numbers for all identifiable attributes.
[0119] Specifically, in order to ensure that all calibratable attributes in the target preset attribute calibration list can correspond one by one to the protocol stack attributes in the attribute array, it is necessary to create corresponding index numbers for all calibratable attributes based on the subscript index numbers of all protocol stack attributes in the attribute array.
[0120] S603: Create an address mapping table according to all index numbers, and determine the address mapping table as the address mapping table of the target attribute array.
[0121] Optionally, the buildAddressMap function may be used to build the address mapping table according to the index number. Of course, other building methods may also be used, and the embodiment of the present application is not limited to the method of using a function.
[0122] S105: modify multiple protocol stack attributes in the target attribute array according to the address mapping table and the target preset attribute calibration list.
[0123] Specifically, according to the numerical values corresponding to all calibratable attributes in the target preset attribute calibration list and the index numbers corresponding to all calibratable attributes in the address mapping table, the multiple protocol stack attributes in the target attribute array are modified one by one.
[0124] Optionally, in another embodiment of the present application, a specific implementation of step S105 is as follows: Figure 7 As shown, the following steps are included:
[0125] S701: Obtain the first calibrable attribute from the target preset attribute calibration list.
[0126] It should be noted that there will be multiple different entities for a calibratable attribute, and each entity corresponds to a protocol stack attribute in the attribute array. Therefore, it is necessary to loop these entities from the first to the last to ensure that the attributes from the first to the last entity are replaced.
[0127] For example, the attribute may be calibrated as the ID of COM communication, and the multiple different entities may be the ID of COM communication 1, the ID of COM communication 2, the ID of COM communication 3, and so on.
[0128] S702: Obtain an index number corresponding to a first calibratable attribute from an address mapping table, and search a target attribute array for a protocol stack attribute corresponding to the first calibratable attribute and the index number.
[0129] It can be understood that in the embodiment of the present application, the protocol stack attribute in the AUTOSAR protocol stack corresponding to the calibrable attribute can be accurately found through position mapping. Therefore, it is necessary to find the corresponding subscript index number from the target attribute array according to the first calibrable attribute and its corresponding index number. At this time, the protocol stack attribute corresponding to the subscript index number is the protocol stack attribute in the AUTOSAR protocol stack that needs to be modified accordingly by the first calibrable attribute.
[0130] For example, you can refer to Figure 8 As shown in the content, the user attribute list is a target preset attribute calibration list. Therefore, according to the first user attribute 1 in the user attribute list, which is the first calibrable attribute and the corresponding index number 1 in the array 1 address mapping table, the corresponding third AUTOSAR attribute array 1 element, which is the protocol stack attribute, can be found from the AUTOSAR attribute array 1.
[0131] S703: Assign the numerical value corresponding to the first calibratable attribute to the protocol stack attribute.
[0132] S704: Detect whether the first calibratable attribute is the last calibratable attribute in the attribute calibration list.
[0133] It should be noted that, since it is necessary to ensure that the first to the last calibratable attributes in the target preset attribute calibration list are replaced in order to complete the data replacement of the attribute array, it is necessary to further detect whether the first calibratable attribute is the last calibratable attribute in the attribute calibration list. If the first calibratable attribute is not the last calibratable attribute in the attribute calibration list, it means that the last calibratable attribute has not been replaced, so step S705 needs to be executed at this time.
[0134] Optionally, if the first calibratable attribute is the last calibratable attribute in the attribute calibration list, it means that the first calibratable attribute to the last calibratable attribute in the target preset attribute calibration list have been replaced, so the process ends at this time.
[0135] S705: Obtain the next calibratable attribute of the first calibratable attribute from the target preset attribute calibration list.
[0136] It is understandable that when the first calibratable attribute is not the last calibratable attribute in the attribute calibration list, it is necessary to continue the replacement operation, so it is necessary to obtain the next calibratable attribute of the first calibratable attribute from the target preset attribute calibration list, that is, execute step S706.
[0137] S706: Determine the next calibratable attribute as the first calibratable attribute.
[0138] Specifically, when the next calibratable attribute is determined as the first calibratable attribute, it is necessary to return to step S702 until the first calibratable attribute is the last calibratable attribute in the attribute calibration list. This completes the replacement of the calibration data, and compared with the calibration function of AUROSAR, the calibratable attributes and target preset attribute calibration lists of the embodiment of the present application are more centralized, and the calibration personnel do not need to know the structure and function of the AUTOSAR array, and do not need to have any understanding of the AUTOSAR core code, and can also complete the attribute calibration well.
[0139] The present application provides a method for modifying a protocol stack attribute, which obtains a target calibratable attribute, and searches for a target preset attribute calibration list corresponding to the target calibratable attribute from all preset attribute calibration lists, and then determines an attribute array in the protocol stack based on the target calibratable attribute. Wherein, the attribute array is composed of multiple protocol stack attributes, and then the constant type of the attribute array is modified to a variable type to obtain a target attribute array, and the target attribute array is stored in RAM, and then an address mapping table of the target attribute array is established according to the target preset attribute calibration list. Wherein, the address mapping table contains a mapping relationship between the target preset attribute calibration list and the target attribute array, and the number of index numbers in the address mapping table is the same as the number of calibratable attributes in the target preset attribute calibration list, and an index number in the address mapping table corresponds to a calibratable attribute in the target preset attribute calibration list, and finally, according to the address mapping table and the target preset attribute calibration list, multiple protocol stack attributes in the target attribute array are modified. Therefore, the corresponding attribute calibration list and attribute array can be found through the calibrated attributes of the pre-calibrated target, and then the position mapping is performed based on the attribute calibration list and the established mapping table, and then the value obtained by the position mapping is overwritten into the protocol stack attribute in the attribute array, which effectively completes the modification of the calibration data and simplifies the entire process of attribute modification, effectively solving the problem of bringing huge workload to engineers.
[0140] Another embodiment of the present application provides a device for modifying a protocol stack attribute, such as Fig. 9 As shown, it includes the following units:
[0141] The attribute acquisition unit 901 is used to acquire a target calibratable attribute and search for a target preset attribute calibration list corresponding to the target calibratable attribute from all preset attribute calibration lists.
[0142] The array determination unit 902 is used to determine the attribute array in the protocol stack based on the target calibratable attribute, wherein the attribute array is composed of a plurality of protocol stack attributes.
[0143] The type modification unit 903 is used to modify the constant type of the attribute array to a variable type, obtain a target attribute array, and store the target attribute array into the RAM.
[0144] The address establishing unit 904 is used to establish an address mapping table of the target attribute array according to the target preset attribute calibration list. The address mapping table includes a mapping relationship between the target preset attribute calibration list and the target attribute array, and the number of index numbers in the address mapping table is the same as the number of calibrable attributes in the target preset attribute calibration list, and one index number in the address mapping table corresponds to one calibrable attribute in the target preset attribute calibration list.
[0145] The attribute modification unit 905 is used to modify the multiple protocol stack attributes in the target attribute array according to the address mapping table and the target preset attribute calibration list.
[0146] It should be noted that the specific working process of the above-mentioned units in the embodiment of the present application can refer to steps S101 to S105 in the above-mentioned method embodiment, and will not be repeated here.
[0147] Optionally, in a device for modifying a protocol stack attribute provided in another embodiment of the present application, the attribute modification unit 905 includes:
[0148] The first acquisition unit is used to acquire a first calibrable attribute from the target preset attribute calibration list.
[0149] The first search unit is used to obtain the index number corresponding to the first calibratable attribute from the address mapping table, and search the protocol stack attribute corresponding to the first calibratable attribute and the index number from the target attribute array.
[0150] The assignment unit is used to assign the numerical value corresponding to the first calibratable attribute to the protocol stack attribute.
[0151] The detection unit is used to detect whether the first calibratable attribute is the last calibratable attribute in the attribute calibration list.
[0152] The second acquisition unit is configured to acquire the next calibratable attribute of the first calibratable attribute from the target preset attribute calibration list if the first calibratable attribute is not the last calibratable attribute in the attribute calibration list.
[0153] The attribute determination unit is used to determine the next calibratable attribute as the first calibratable attribute, and return to execute to obtain the index number corresponding to the first calibratable attribute from the address mapping table, and search the protocol stack attribute corresponding to the first calibratable attribute and the index number from the target attribute array, until the first calibratable attribute is the last calibratable attribute in the attribute calibration list.
[0154] Optionally, in a device for modifying a protocol stack attribute provided in another embodiment of the present application, the address establishing unit 904 includes:
[0155] The third acquisition unit is used to acquire all calibratable attributes from the target preset attribute calibration list.
[0156] Creation unit, used to create index numbers of all calibrable attributes.
[0157] The first determining unit is used to establish an address mapping table according to all index numbers, and determine the address mapping table as the address mapping table of the target attribute array.
[0158] Optionally, a device for modifying a protocol stack attribute provided in another embodiment of the present application further includes:
[0159] The fourth acquisition unit is used to acquire all calibrable attributes corresponding to all communication messages.
[0160] The classification unit is used to classify all the calibrable attributes corresponding to the communication messages according to the data types of all the calibrable attributes corresponding to all the communication messages, and obtain a set of calibrable attributes corresponding to each data type.
[0161] The generating unit is used to generate a plurality of corresponding preset attribute calibration lists according to all calibratable attribute sets, wherein one calibratable attribute set corresponds to one preset attribute calibration list.
[0162] Optionally, in a device for modifying a protocol stack attribute provided by another embodiment of the present application, the array determining unit 902 includes:
[0163] The fifth acquisition unit is used to acquire a configuration file corresponding to the target calibrable attribute from the protocol stack.
[0164] The second search unit is used to search the attribute array corresponding to the target calibratable attribute from the configuration file.
[0165] The index unit is used to index the target calibratable attribute using a preset code to obtain an index array corresponding to the target calibratable attribute.
[0166] The judgment unit is used to judge whether the attribute array is consistent with the index array.
[0167] The second determining unit is configured to determine the attribute array corresponding to the target calibratable attribute as the attribute array in the protocol stack if the attribute array is consistent with the index array.
[0168] The third determining unit is configured to determine the index array as the attribute array in the protocol stack if the attribute array is inconsistent with the index array.
[0169] It should be noted that the specific working process of each unit provided in the above embodiments of the present application can refer to the corresponding steps in the above method embodiments, and will not be repeated here.
[0170] In summary, the present application provides a device for modifying protocol stack attributes, which obtains target calibratable attributes, and searches for a target preset attribute calibration list corresponding to the target calibratable attributes from all preset attribute calibration lists, and then determines the attribute array in the protocol stack based on the target calibratable attributes. Wherein, the attribute array is composed of multiple protocol stack attributes, and then the constant type of the attribute array is modified to a variable type to obtain a target attribute array, and the target attribute array is stored in RAM, and then an address mapping table of the target attribute array is established according to the target preset attribute calibration list. Wherein, the address mapping table contains the mapping relationship between the target preset attribute calibration list and the target attribute array, and the number of index numbers in the address mapping table is the same as the number of calibratable attributes in the target preset attribute calibration list, and an index number in the address mapping table corresponds to a calibratable attribute in the target preset attribute calibration list, and finally, according to the address mapping table and the target preset attribute calibration list, multiple protocol stack attributes in the target attribute array are modified. Therefore, the corresponding attribute calibration list and attribute array can be found through the calibrated attributes of the pre-calibrated target, and then the position mapping is performed based on the attribute calibration list and the established mapping table, and then the value obtained by the position mapping is overwritten into the protocol stack attribute in the attribute array, which effectively completes the modification of the calibration data and simplifies the entire process of attribute modification, effectively solving the problem of bringing huge workload to engineers.
[0171] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0172] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for modifying a protocol stack attribute, characterized in that: include: Obtain a target calibratable attribute, and search for a target preset attribute calibration list corresponding to the target calibratable attribute from all preset attribute calibration lists; Based on the target calibratable attribute, determining an attribute array in a protocol stack; wherein the attribute array is composed of a plurality of protocol stack attributes; Modify the constant type of the attribute array to a variable type, obtain a target attribute array, and store the target attribute array in RAM; According to the target preset attribute calibration list, an address mapping table of the target attribute array is established; wherein the address mapping table includes a mapping relationship between the target preset attribute calibration list and the target attribute array, and the number of index numbers in the address mapping table is the same as the number of calibratable attributes in the target preset attribute calibration list, and one index number in the address mapping table corresponds to one calibratable attribute in the target preset attribute calibration list; Modify a plurality of the protocol stack attributes in the target attribute array according to the address mapping table and the target preset attribute calibration list.
2. The method according to claim 1, characterized in that The step of modifying the plurality of protocol stack attributes in the target attribute array according to the address mapping table and the target preset attribute calibration list includes: Obtaining a first calibratable attribute from the target preset attribute calibration list; Obtaining an index number corresponding to the first calibratable attribute from the address mapping table, and searching the target attribute array for a protocol stack attribute corresponding to the first calibratable attribute and the index number; Assigning a value corresponding to the first calibratable attribute to the protocol stack attribute; Detecting whether the first calibratable attribute is the last calibratable attribute in the attribute calibration list; If the first calibratable attribute is not the last calibratable attribute in the attribute calibration list, obtaining the next calibratable attribute of the first calibratable attribute from the target preset attribute calibration list; Determine the next calibratable attribute as the first calibratable attribute, return to execute to obtain the index number corresponding to the first calibratable attribute from the address mapping table, and search the protocol stack attribute corresponding to the first calibratable attribute and the index number from the target attribute array, until the first calibratable attribute is the last calibratable attribute in the attribute calibration list.
3. The method according to claim 1, characterized in that The step of establishing an address mapping table of the target attribute array according to the target preset attribute calibration list includes: Acquire all calibratable attributes from the target preset attribute calibration list; Create index numbers of all identifiable attributes; An address mapping table is established according to all index numbers, and the address mapping table is determined as the address mapping table of the target attribute array.
4. The method according to claim 1, characterized in that: The method for establishing the preset attribute calibration list includes: Get all calibrable attributes corresponding to all communication messages; According to the data types of all the calibratable attributes corresponding to all the communication messages, all the calibratable attributes corresponding to the communication messages are classified respectively to obtain a set of calibratable attributes corresponding to each of the data types; According to all the calibratable attribute sets, a plurality of corresponding preset attribute calibration lists are generated respectively; wherein one calibratable attribute set corresponds to one preset attribute calibration list.
5. The method according to claim 1, characterized in that The step of determining an attribute array in a protocol stack based on the target calibratable attribute comprises: Obtaining a configuration file corresponding to the target calibratable attribute from a protocol stack; Searching the configuration file for an attribute array corresponding to the target calibratable attribute; Using a preset code to index the target calibratable attribute, obtaining an index array corresponding to the target calibratable attribute; Determine whether the attribute array is consistent with the index array; If the attribute array is consistent with the index array, determining the attribute array corresponding to the target calibratable attribute as the attribute array in the protocol stack; If the attribute array is inconsistent with the index array, the index array is determined as the attribute array in the protocol stack.
6. A device for modifying protocol stack attributes, characterized in that: include: An attribute acquisition unit, used for acquiring a target calibratable attribute, and searching for a target preset attribute calibration list corresponding to the target calibratable attribute from all preset attribute calibration lists; An array determination unit, configured to determine an attribute array in a protocol stack based on the target calibratable attribute; wherein the attribute array is composed of a plurality of protocol stack attributes; A type modification unit, used for modifying the constant type of the attribute array to a variable type, obtaining a target attribute array, and storing the target attribute array in a RAM; An address establishing unit, used to establish an address mapping table of the target attribute array according to the target preset attribute calibration list; wherein the address mapping table includes a mapping relationship between the target preset attribute calibration list and the target attribute array, and the number of index numbers in the address mapping table is the same as the number of calibratable attributes in the target preset attribute calibration list, and one index number in the address mapping table corresponds to one calibratable attribute in the target preset attribute calibration list; The attribute modification unit is used to modify the plurality of protocol stack attributes in the target attribute array according to the address mapping table and the target preset attribute calibration list.
7. The device according to claim 6, characterized in that The attribute modification unit includes: A first acquisition unit, configured to acquire a first calibratable attribute from the target preset attribute calibration list; A first search unit, configured to obtain an index number corresponding to the first calibratable attribute from the address mapping table, and search the target attribute array for a protocol stack attribute corresponding to the first calibratable attribute and the index number; an assignment unit, configured to assign a value corresponding to the first calibratable attribute to the protocol stack attribute; a detection unit, configured to detect whether the first calibratable attribute is the last calibratable attribute in the attribute calibration list; a second acquiring unit, configured to acquire a next calibratable attribute of the first calibratable attribute from the target preset attribute calibration list if the first calibratable attribute is not the last calibratable attribute in the attribute calibration list; The attribute determination unit is used to determine the next calibratable attribute as the first calibratable attribute, and return to execute to obtain the index number corresponding to the first calibratable attribute from the address mapping table, and search the protocol stack attribute corresponding to the first calibratable attribute and the index number from the target attribute array, until the first calibratable attribute is the last calibratable attribute in the attribute calibration list.
8. The device according to claim 6, characterized in that The address establishing unit comprises: A third acquisition unit, configured to acquire all calibratable attributes from the target preset attribute calibration list; A creation unit, used to create index numbers of all the calibratable attributes; The first determining unit is used to establish an address mapping table according to all index numbers, and determine the address mapping table as the address mapping table of the target attribute array.
9. The device according to claim 6, characterized in that Also includes: A fourth acquisition unit, used to acquire all calibrable attributes corresponding to all communication messages; A classification unit, used to classify all calibratable attributes corresponding to the communication messages according to the data types of all calibratable attributes corresponding to all the communication messages, to obtain a set of calibratable attributes corresponding to each data type; The generating unit is used to generate a plurality of corresponding preset attribute calibration lists according to all the calibratable attribute sets respectively; wherein one calibratable attribute set corresponds to one preset attribute calibration list.
10. The device according to claim 6, characterized in that The array determination unit comprises: A fifth acquisition unit, configured to acquire a configuration file corresponding to the target calibratable attribute from a protocol stack; A second search unit, used for searching the attribute array corresponding to the target calibratable attribute from the configuration file; An indexing unit, used to index the target calibratable attribute using a preset code to obtain an index array corresponding to the target calibratable attribute; A judging unit, used for judging whether the attribute array is consistent with the index array; A second determining unit, configured to determine the attribute array corresponding to the target calibratable attribute as the attribute array in the protocol stack if the attribute array is consistent with the index array; The third determining unit is configured to determine the index array as the attribute array in the protocol stack if the attribute array is inconsistent with the index array.
Citation Information
Patent Citations
Method for automatically mapping Modbus protocol data to OPCUA address space
CN112311808A
Network access method, computing device and computing device cluster
CN118900289A
Method for implementing protocol stack to support multiple product shapes
CN1652541A
Method, media gateway and network system for realizing network address translation
WO2010045809A1
Method and device for forwarding packet
WO2017156908A1