Method and apparatus for data transmission

By introducing a first mapping table at the communication end, only the indication information of the changed member variables in the target serializable structure variable is updated, which solves the latency problem caused by full serialization in the prior art and achieves more efficient data transmission.

CN118829978BActive Publication Date: 2025-11-07YINWANG INTELLIGENT TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202280093299.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-30
Publication Date
2025-11-07
Estimated Expiration
2042-03-30

AI Technical Summary

Technical Problem

In existing serialization processes, even if only one byte in the structure data is modified, the entire data needs to be reserialized, resulting in excessively long data transmission delays for applications at the communication end.

Method used

By introducing a first mapping table into the target structure variable to be serialized, only the indication information of the member variables that have been updated is updated, thereby identifying and reserializing only the changed data in the protocol layer entity, without repeatedly serializing the unchanged data.

Benefits of technology

It reduces the latency of serialization processing, lowers the data transmission latency of applications in the communication terminal, and improves data transmission efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118829978B_ABST
    Figure CN118829978B_ABST
Patent Text Reader

Abstract

The application provides a data transmission method and device. In the technical scheme, when the content of a target to-be-serialized structure variable in an application is serialized, if the data in any one member variable in the target to-be-serialized structure variable is updated, the value of the indication information corresponding to the any one member variable in the first mapping table is updated from an initial value to a target value, so that the member variable that may be changed is determined based on the mapping relationship between different indication information in the first mapping table and different member variables and whether the value of each indication information in the first mapping table is the target value, so that the operating system can only re-serialize the data in the determined member variable that may be changed, thereby reducing the transmission delay when the data in the target to-be-serialized structure variable is transmitted.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of communication, and more particularly, to a data transmission method and apparatus. BACKGROUND

[0002] Scalable Service Oriented Middleware over Internet Protocol (SOME / IP) is an application layer communication protocol based on Ethernet. In an intelligent vehicle, different platforms or different communication terminals can perform data interaction based on SOME / IP and the like. Specifically, the SOME / IP protocol includes serializing data in a structure variable defined by an application program in a communication terminal, and then encapsulating and transmitting the serialized data. The serializing refers to sorting data (also referred to as structure data) in the structure variable defined by the application program according to a defined rule to obtain a byte sequence, and then encapsulating the sorted byte sequence into a payload of a SOME / IP message and sending it to a network. That is, the serializing can be considered as serializing parallel structure data into serial data and then sending it to the network.

[0003] However, in the current serializing, even if only one byte in the structure data is modified, the modified data needs to be completely serialized again, resulting in a problem of prolonging the data transmission delay in the application program in the communication terminal.

[0004] Therefore, how to reduce the data transmission delay in the application program in the communication terminal becomes a technical problem to be solved urgently. SUMMARY

[0005] Embodiments of the present application provide a data transmission method and apparatus, which can reduce the processing delay when serializing data in an application program in a communication terminal, so as to realize reducing the data transmission delay in the application program in the communication terminal.

[0006] In a first aspect, the present application provides a data transmission method, comprising: determining a target to-be-serialized structure variable corresponding to to-be-sent data, the target to-be-serialized structure variable comprising n sub-structures, each of the n sub-structures comprising one or more member variables, the one or more member variables being of a structure member variable type or a non-structure member variable type, wherein for a sub-structure i comprising a structure member variable, a sub-structure j corresponding to the structure member variable is a lower-level sub-structure of the sub-structure i, n is a positive integer, and i and j are positive integers less than or equal to n; when data in a first member variable in the target to-be-serialized structure variable is updated, updating a value of first indication information corresponding to the first member variable in a first mapping table from an initial value to a target value, the first mapping table comprising k indication information, different indication information in the k indication information corresponding to different member variables in the target to-be-serialized structure variable, and a value of each indication information in the k indication information indicating whether data in a corresponding member variable is updated, the initial value indicating no update, and the target value indicating update, k being a positive integer; and sending data in the target to-be-serialized structure variable and the first mapping table.

[0007] The data transmission method provided by the embodiments of the present application can be used to determine a target to-be-serialized structure variable after an application determines the target to-be-serialized structure variable, and when data in a certain member variable in the target to-be-serialized structure variable is updated, update a value of indication information corresponding to the member variable in a first mapping table from an initial value to a target value, and then send data in the target to-be-serialized structure variable and the first mapping table to a protocol layer entity in an operating system.

[0008] It can be understood that after the protocol layer in the operating system receives data in the target to-be-serialized structure variable and the first mapping table sent by the application, the protocol layer can determine the member variable in which data is possibly updated based on a correspondence between different indication information in the first mapping table and different member variables and whether a value of each indication information in the first mapping table is the target value. Further, for the protocol layer entity in the operating system, after the member variable in which data is possibly updated is determined, the data in the determined member variable in which data is possibly updated can be re-serialized, and the data in the member variable in which data is not updated can be directly used from data that has been serialized to a buffer before. That is, in the technical solution provided by the present application, all data in the target to-be-serialized structure variable does not need to be serialized, thereby reducing a time delay problem caused by serialization processing and further reducing a transmission time delay of data in the target to-be-serialized structure variable.

[0009] In a possible implementation manner of the first aspect, the updating the value of the first indication information corresponding to the first member variable in the first mapping table from an initial value to a target value comprises: if the data in the first member variable is updated and does not affect the offset of the starting address in the memory of any one of the other member variables in the target serialization-expected structure variable, updating the value of the first indication information from the initial value to a first target value, and the first target value indicates that the data in the member variable is updated and does not affect the offset of the starting address in the memory of any one of the other member variables in the target serialization-expected structure variable.

[0010] It can be understood that when the data in the first member variable in the target serialization-expected structure variable is updated, there are usually two cases. In the first case, the data in the first member variable is updated, but the update does not affect the offset of the starting address in the memory of the other member variables. In the second case, the update affects the offset of the starting address in the memory of the other member variables.

[0011] Therefore, in this implementation manner, if the first member variable does not affect the offset of the starting address in the memory of the other member variables when the data in the first member variable is updated, the value of the indication information corresponding to the first member variable in the first mapping table is updated to the first target value, so that the protocol layer entity in the operating system can determine that the corresponding member variable does not affect the offset of the starting address in the memory of the other member variables when the data in the member variable is updated based on the first target value.

[0012] In a possible implementation manner of the first aspect, the updating the value of the first indication information corresponding to the first member variable in the first mapping table from an initial value to a target value comprises: if the data in the first member variable is updated and affects the offset of the starting address in the memory of any one of the other member variables in the target serialization-expected structure variable, updating the value of the first indication information from the initial value to a second target value, and the second target value indicates that the data in the member variable is updated and affects the offset of the starting address in the memory of any one of the other member variables in the target serialization-expected structure variable.

[0013] In the implementation, if the first member variable affects the offset of the starting address in the memory of any one of the other member variables in the target structure variable to be serialized when data in the first member variable is updated, the value of the indication information corresponding to the first member variable in the first mapping table is updated to the second target value, so that the protocol layer entity in the operating system can determine that the corresponding member variable does not affect the offset of the starting address in the memory of the other member variables when data in the corresponding member variable is updated based on the second target value.

[0014] With reference to the first aspect, in a possible implementation, the updating of the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value to the first target value or the second target value includes: calling a stub function when data in the first member variable is updated, the stub function being configured to update the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value to the first target value or the second target value.

[0015] In the implementation, the value of the first indication information corresponding to the first member variable in the first mapping table can be updated from the initial value to the first target value or the second target value by calling the stub function when data in the first member variable is updated.

[0016] With reference to the first aspect, in a possible implementation, the updating of the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value to the first target value or the second target value includes: triggering a memory protection unit (MPU) or a memory management unit (MMU) to jump into a preset processing function when data in the first member variable is updated, the preset processing function being configured to update the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value to the first target value or the second target value.

[0017] In the implementation, the value of the first indication information corresponding to the first member variable in the first mapping table can be updated from the initial value to the first target value or the second target value by triggering the hardware when data in the first member variable is updated.

[0018] With reference to the first aspect, in a possible implementation, the method further includes: when data in the first member variable in the target structure variable to be serialized is not updated, not updating the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value to the target value.

[0019] In the implementation, when the data in the first member variable is not updated, the value of the indication information corresponding to the first member variable in the first mapping table is not updated to the target value. Therefore, when the protocol layer entity in the operating system serializes the content of the first member variable, it is determined that the data in the first member variable is not updated based on the value of the indication information corresponding to the first member variable in the first mapping table being not the target value, so that the data in the first member variable is not serialized, the time delay of re-serializing the data in the first member variable is avoided, the time delay of serializing the overall data in the target to-be-serialized structure variable is reduced, and the data transmission time delay of the application program in the communication terminal is further reduced.

[0020] With reference to the first aspect, in a possible implementation, the initial value is 0, the first target value is 1, and the second target value is 2.

[0021] In a second aspect, the present application provides a data transmission method, comprising: receiving data in a target to-be-serialized structure variable and a first mapping table, the target to-be-serialized structure variable comprising n sub-structures, each sub-structure comprising one or more member variables, the type of the one or more member variables being a structure member variable or a non-structure member variable, wherein for a sub-structure i comprising a structure member variable, the sub-structure j corresponding to the structure member variable is a lower-level sub-structure of the sub-structure i, the first mapping table comprising k indication information, different indication information in the k indication information corresponding to different member variables in the target to-be-serialized structure variable, the value of each indication information in the k indication information being an initial value or a target value, the initial value indicating that the data in the corresponding member variable is not updated, the target value indicating that the data is updated, n being a positive integer, i and j being positive integers less than or equal to n, and k being a positive integer; and serializing the data in a target non-structure member variable in the target to-be-serialized structure variable corresponding to the indication information in the first mapping table with the value being the target value.

[0022] The data transmission method provided in the embodiment can determine the target non-structure member variable in which data updating is likely to occur, based on the correspondence between the different indication information and the different member variables in the first mapping table and whether the value of each indication information in the first mapping table is the target value, after the protocol layer entity in the operating system receives the data in the target to-be-serialized structure variable sent by the application program and the first mapping table. Further, for the protocol layer entity in the operating system, after the target non-structure member variable in which change is likely to occur is determined, only the data in the target non-structure member variable can be re-serialized, and for the non-structure member variable in which no data updating occurs, the data that has been serialized to the buffer before can be directly used. That is, in the technical solution provided in the application, all the data in the target to-be-serialized structure variable does not need to be serialized, thereby reducing the time delay problem caused by the serialization processing, and further reducing the transmission time delay of the data in the target to-be-serialized structure variable.

[0023] With reference to the second aspect, in a possible implementation manner, the target value is a first target value, and the first target value indicates that the data in the member variable is updated but does not affect the offset of the starting address in the memory of any one of the other member variables in the target to-be-serialized structure variable.

[0024] With reference to the second aspect, in a possible implementation manner, the serialization of the data in the target non-structure member variable in the target to-be-serialized structure variable corresponding to the indication information with the first target value in the first mapping table comprises: serializing the data in the target non-structure member variable into a sub-buffer corresponding to the target non-structure member variable in a preset buffer, the preset buffer comprising z sub-buffers, each sub-buffer corresponding to a non-structure member variable in the target to-be-serialized structure variable, and each sub-buffer being used to store the data in the corresponding non-structure member variable.

[0025] It can be understood that when the data in a certain non-structure member variable is updated, but the update does not affect the offset of the starting address in the memory of the other member variables, when the data in the certain non-structure member variable is serialized, only the data in the certain non-structure member variable needs to be re-serialized into a sub-buffer corresponding to the certain non-structure member variable in a preset buffer.

[0026] In view of this, in the implementation manner, when a protocol layer entity in the operating system serializes data in a certain non-structure member variable in a target to-be-serialized structure variable, if the value of the corresponding indication information of the certain non-structure member variable in the first mapping table is the first target value, the protocol layer entity in the operating system can determine that data update of the certain non-structure member variable does not affect the offset corresponding to the starting address in the memory of other member variables, and thus the certain non-structure member variable can be directly re-serialized into the sub-buffer corresponding to the target member variable in the preset buffer.

[0027] With reference to the second aspect, in a possible implementation manner, the target value is a second target value, and the second target value indicates that data in a member variable is updated and affects the offset corresponding to the starting address in the memory of any one of other member variables in the target to-be-serialized structure variable.

[0028] With reference to the second aspect, in a possible implementation manner, serializing data in a target non-structure member variable in the target to-be-serialized structure variable corresponding to the indication information with the second target value in the first mapping table comprises: serializing the data in the target non-structure member variable into a sub-buffer corresponding to the target non-structure member variable in the preset buffer, and moving data in a second non-structure member variable corresponding to a sub-buffer in the preset buffer to a target buffer, the value of the corresponding indication information of the second non-structure member variable in the first mapping table is the initial value, and the sub-buffer corresponding to the second non-structure member variable in the preset buffer is located after the sub-buffer corresponding to the target non-structure member variable in the preset buffer, the preset buffer comprises z sub-buffers, each sub-buffer corresponds to a non-structure member variable in the target to-be-serialized structure variable, and each sub-buffer is used to store data in the corresponding non-structure member variable, and the target buffer is located after the sub-buffer corresponding to the target non-structure member variable.

[0029] It can be understood that when a certain non-structure member variable is updated and affects the offset corresponding to the starting address in the memory of other member variables, the data in the certain non-structure member variable cannot be re-serialized into the preset buffer.

[0030] In view of this, in the implementation manner, when a protocol layer in an operating system serializes content of a certain non-structure member variable in a target structure variable to be serialized, if a value of corresponding indication information of the certain non-structure member variable in the first mapping table is a second target value, the protocol layer entity in the operating system can determine that the certain non-structure member variable will also affect an offset corresponding to a starting address of another member variable in the memory when data of the certain non-structure member variable is updated. At this time, the protocol layer entity in the operating system re-serializes data in the certain non-structure member variable to a sub-buffer corresponding to the certain non-structure member variable in a preset buffer, and also moves data in a second non-structure member variable corresponding to the sub-buffer after the sub-buffer corresponding to the target member variable from an original sub-buffer to a target buffer. It should be understood that the second non-structure member variable refers to a member variable that is not updated. It can be understood that in this implementation manner, the correctness of data in the second non-structure member variable can be ensured.

[0031] With reference to the second aspect, in a possible implementation manner, the target structure variable to be serialized is one of p structure variables to be serialized, and a buffer used when the p structure variables to be serialized are serialized is the preset buffer.

[0032] In this implementation manner, the p structure variables to be serialized can share the same preset buffer, so that the size of a buffer set for the p structure variables to be serialized can be reduced, thereby saving the resource of the buffer.

[0033] With reference to the second aspect, in a possible implementation manner, the serialization of data in the target non-structure member variable corresponding to the indication information with the value being the target value in the first mapping table includes: if the target structure variable to be serialized is a structure variable to be serialized with the highest sending frequency among the p structure variables to be serialized, re-serializing data of the target sub-structure variable to a preset buffer.

[0034] With reference to the second aspect, in a possible implementation manner, the initial value is 0, the first target value is 1, and the second target value is 2.

[0035] In a third aspect, the present application provides a device for data transmission, comprising: a processing module configured to determine a target to-be-serialized structure variable corresponding to to-be-sent data, wherein the target to-be-serialized structure variable comprises n sub-structures, each of the n sub-structures comprises one or more member variables, the one or more member variables are of a structure member variable or a non-structure member variable, for a sub-structure i comprising a structure member variable, a sub-structure j corresponding to the structure member variable is a lower sub-structure of the sub-structure i, n is a positive integer, i and j are positive integers less than or equal to n; the processing module is further configured to update a value of first indication information corresponding to a first member variable in the first mapping table from an initial value to a target value when data in the first member variable in the target to-be-serialized structure variable is updated, the first mapping table comprises k indication information, different indication information in the k indication information corresponds to different member variables in the target to-be-serialized structure variable, a value of each indication information in the k indication information indicates whether data in a corresponding member variable is updated, the initial value indicates that no update occurs, the target value indicates that update occurs, and k is a positive integer; and a transceiver module configured to send data in the target to-be-serialized structure variable and the first mapping table.

[0036] With reference to the third aspect, in a possible implementation, the processing module is specifically configured to: if the data in the first member variable is updated and does not affect an offset of a starting address in memory corresponding to any one of the other member variables in the target to-be-serialized structure variable, update the value of the first indication information from the initial value to a first target value, and the first target value indicates that the data in the member variable is updated but does not affect the offset of the starting address in memory corresponding to any one of the other member variables in the target to-be-serialized structure variable.

[0037] With reference to the third aspect, in a possible implementation, the processing module is specifically configured to: if the data in the first member variable is updated and affects an offset of a starting address in memory corresponding to any one of the other member variables in the target to-be-serialized structure variable, update the value of the first indication information from the initial value to a second target value, and the second target value indicates that the data in the member variable is updated and affects the offset of the starting address in memory corresponding to any one of the other member variables in the target to-be-serialized structure variable.

[0038] In a possible implementation manner of the third aspect, the processing module is specifically configured to: when data in the first member variable is updated, invoke a stub function, the stub function being configured to update a value of first indication information corresponding to the first member variable in the first mapping table from an initial value to a first target value or a second target value.

[0039] In a possible implementation manner of the third aspect, the processing module is specifically configured to: when data in the first member variable is updated, trigger a memory protection unit (MPU) or a memory management unit (MMU) to jump into a preset processing function, the preset processing function being configured to update a value of first indication information corresponding to the first member variable in the first mapping table from an initial value to a first target value or a second target value.

[0040] In a possible implementation manner of the third aspect, the processing module is specifically configured to: when data in the first member variable in the target to-be-serialized structure variable is not updated, not update a value of first indication information corresponding to the first member variable in the first mapping table from an initial value to a target value.

[0041] In a possible implementation manner of the third aspect, the initial value is 0, the first target value is 1, and the second target value is 2.

[0042] In a fourth aspect, the present application provides a data transmission apparatus, comprising: a transceiver module configured to receive data in a target to-be-serialized structure variable and a first mapping table, the target to-be-serialized structure variable comprising n sub-structures, each sub-structure comprising one or more member variables, the one or more member variables being structure member variables or non-structure member variables, wherein for a sub-structure i comprising a structure member variable, a sub-structure j corresponding to the structure member variable is a lower-level sub-structure of the sub-structure i, the first mapping table comprising k indication information, different indication information in the k indication information corresponding to different member variables in the target to-be-serialized structure variable, a value of each indication information in the k indication information being an initial value or a target value, the initial value indicating that data in the corresponding member variable is not updated, the target value indicating that the data is updated, n being a positive integer, i and j being positive integers less than or equal to n, and k being a positive integer; and a processing module configured to serialize data in a target non-structure member variable in the target to-be-serialized structure variable corresponding to indication information with the target value in the first mapping table.

[0043] With reference to the fourth aspect, in a possible implementation manner, the target value is a first target value, and the first target value indicates that data in a member variable is updated but does not affect an offset of a corresponding starting address in memory of any one of other member variables in the target structure variable to be serialized.

[0044] With reference to the fourth aspect, in a possible implementation manner, the processing module is specifically configured to serialize data in the target non-structure member variable into a sub-buffer corresponding to the target non-structure member variable in a preset buffer, the preset buffer including z sub-buffers, each of the sub-buffers corresponding to one non-structure member variable in the target structure variable to be serialized, and each of the sub-buffers being configured to store data in the corresponding non-structure member variable.

[0045] With reference to the fourth aspect, in a possible implementation manner, the target value is a second target value, and the second target value indicates that data in a member variable is updated and affects an offset of a corresponding starting address in memory of any one of other member variables in the target structure variable to be serialized.

[0046] With reference to the fourth aspect, in a possible implementation manner, the processing module is specifically configured to serialize data in the target non-structure member variable into a sub-buffer corresponding to the target non-structure member variable in a preset buffer, and move data in a sub-buffer corresponding to a second non-structure member variable to a target buffer, a value of indication information corresponding to the second non-structure member variable in the first mapping table being the initial value, and the sub-buffer corresponding to the second non-structure member variable in the preset buffer being located after the sub-buffer corresponding to the target non-structure member variable in the preset buffer, the preset buffer including z sub-buffers, each of the sub-buffers corresponding to one non-structure member variable in the target structure variable to be serialized, and each of the sub-buffers being configured to store data in the corresponding non-structure member variable, and the target buffer being located after the sub-buffer corresponding to the target non-structure member variable.

[0047] With reference to the fourth aspect, in a possible implementation manner, the target structure variable to be serialized is one of p structure variables to be serialized, and buffers used when the p structure variables to be serialized are serialized are all the preset buffer.

[0048] In a possible implementation manner of the fourth aspect, the processing module is specifically configured to: if the target to-be-serialized structure variable is the to-be-serialized structure variable with the highest sending frequency among the p to-be-serialized structure variables, re-serializing data of the target sub-structure variable into a preset buffer.

[0049] In a possible implementation manner of the fourth aspect, the initial value is 0, the first target value is 1, and the second target value is 2.

[0050] In the fifth aspect, the application provides a terminal device, including the apparatus in the fourth aspect or the fifth aspect.

[0051] In the sixth aspect, the application provides an apparatus for data transmission, including a memory and a processor; the memory is configured to store program instructions; and the processor is configured to invoke the program instructions in the memory to execute the method in the first aspect or the second aspect or any possible implementation manner thereof.

[0052] In the seventh aspect, the application provides a computer readable medium, which stores program codes for computer execution, and the program codes include instructions for executing the method in the first aspect or the second aspect or any possible implementation manner thereof.

[0053] In the eighth aspect, the application provides a computer program product, which includes computer program codes, and when the computer program codes run on a computer, the computer program codes make the computer implement the method in the first aspect or the second aspect or any possible implementation manner thereof.

[0054] The technical effects brought by any implementation manner of the third aspect to the eighth aspect can refer to the technical effects brought by any possible implementation manner of the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0055] Figure 1 An application scenario provided for the embodiments of the application;

[0056] Figure 2 A structural schematic diagram of serializing data of a structure type variable corresponding to a structure type provided by the application;

[0057] Figure 3 A structural schematic diagram of a system architecture provided for the embodiments of the application;

[0058] Figure 4 A flow schematic diagram of a data transmission method provided for the embodiments of the application;

[0059] Figure 5 A structural diagram of a mapping relationship between a first mapping table and a member variable provided by an embodiment of the present application;

[0060] Figure 6 A structural diagram of a mapping relationship between a first mapping table and a member variable provided by an embodiment of the present application;

[0061] Figure 7 A structural diagram of a mapping relationship between a first mapping table and a member variable provided by an embodiment of the present application;

[0062] Figure 8 A structural diagram of a mapping relationship between a first mapping table and a member variable provided by another embodiment of the present application;

[0063] Figure 9 A process diagram of serialization provided by an embodiment of the present application;

[0064] Figure 10 A structural diagram of re-serialization provided by an embodiment of the present application;

[0065] Figure 11 A structural diagram of re-serialization provided by an embodiment of the present application;

[0066] Figure 12 A structural diagram of re-serialization provided by an embodiment of the present application;

[0067] Figure 13 A process diagram of inserting a stub function provided by the present application;

[0068] Figure 14 A process diagram of updating a value of corresponding indication information in a first mapping table using a hardware trigger provided by the present application;

[0069] Figure 15 A process diagram of updating a first mapping table provided by the present application;

[0070] Figure 16 A structural diagram of sharing a preset buffer provided by the present application;

[0071] Figure 17 A process diagram of sharing a preset buffer provided by an embodiment of the present application;

[0072] Figure 18 A structural diagram of a serialization device provided by an embodiment of the present application;

[0073] Figure 19 A structural diagram of a terminal device provided by an embodiment of the present application;

[0074] Figure 20 The structural diagram of a serialization device provided for another embodiment of the present application. DETAILED DESCRIPTION

[0075] With the acceleration of automatic driving, digital networking and electrification in the automotive field, the demand for interconnection between internal components of a vehicle and between the vehicle and external networks is increasingly rich. Therefore, in order to solve the data exchange between various vehicle-mounted devices in the vehicle, achieve data sharing and avoid excessive occupation of limited vehicle space as much as possible, it is inevitable to introduce vehicle network communication technology in the vehicle system.

[0076] As fieldbus technology, the controller area network (CAN) and the local interconnect network (LIN) have been widely used in the automotive field to realize data communication between internal controllers, actuators and various detection devices of a vehicle. However, with the development of drive-by-wire and multimedia technologies, CAN and LIN have been unable to meet the bandwidth demand. Ethernet has been promoted in automotive applications due to its high real-time performance, strong scalability and large communication data volume. If the entire vehicle network is replaced by Ethernet, the original sensor devices need to be completely replaced. Since CAN bus and LIN bus have price advantages and traditional compatibility, the mainstream technology of the current vehicle network is to take Ethernet as the backbone and be compatible with CAN and LIN.

[0077] Next, an application scenario to which the embodiments of the present application can be applied will be described in combination with Figure 1 It is first stated herein that the application scenario provided by the present application only takes the vehicle network taking Ethernet as the backbone and being compatible with CAN as an example, but does not constitute a limitation on the application scenario of the present application. For example, the application scenario can also be a vehicle network taking Ethernet as the backbone and being compatible with LIN or a vehicle network taking Ethernet as the backbone and being compatible with CAN and LIN.

[0078] As Figure 1As shown in the prior art, in the current automotive technology field, the vehicle 10 can carry a variety of vehicle-mounted devices 11 inside, and different functions can be realized through the vehicle-mounted devices 11. For example, the vehicle-mounted device 11 can be an electronic control unit (ECU). Since the software and hardware of the vehicle-mounted device 11 can usually be set independently of the vehicle, in order to facilitate unified management of the vehicle-mounted devices 11 in the vehicle 10, the international standard ISO 11898: Controller Area Network (CAN) protocol technology from the International Organization for Standardization (ISO) has been widely applied. Among them, the CAN protocol technology is the main communication protocol for in-vehicle communication at present, and the CAN protocol technology requires that the vehicle-mounted device 11 be connected to the CAN bus and communicate using the CAN protocol. For example, Figure 1 In the example shown, the vehicle-mounted device A, the vehicle-mounted device B,..., and the vehicle-mounted device X all support the CAN protocol and are connected to the CAN bus, thereby constructing a vehicle-mounted network including the CAN bus and the vehicle-mounted device A, the vehicle-mounted device B,..., and the vehicle-mounted device X. Through the vehicle-mounted network, the vehicle-mounted devices 11 in the vehicle 10 can be managed. Alternatively, in the example of the embodiment shown, Figure 1 In the example of the embodiment shown, the CAN bus includes, but is not limited to, a power system CAN bus, a comfort system CAN bus, a body system CAN bus, and an infotainment system CAN bus of the vehicle 10, etc.

[0079] At the same time, with the continuous development of communication technology and automotive technology, more and more Internet-connected vehicle-mounted devices 11 are connected to the vehicle-mounted network inside the vehicle 10 by the manufacturer of the vehicle 10 or the user of the vehicle 10, thereby providing more functions such as navigation, remote system upgrade, and autonomous driving for the vehicle and its users through the Internet-connected vehicle-mounted devices. The Internet-connected vehicle-mounted device 11 needs to support the Ethernet protocol to access the Internet, and if the vehicle-mounted device 11 supporting the Ethernet protocol is directly connected to the CAN bus inside the vehicle, it cannot communicate with other vehicle-mounted devices 11 supporting the CAN protocol. Therefore, the switch 12 and the gateway 13 are introduced inside the vehicle 10 to realize communication between the vehicle-mounted device 11 supporting the Ethernet protocol and the vehicle-mounted device 11 supporting the CAN protocol. For example, in Figure 1In the example shown, the vehicle-mounted devices 1, 2,..., x support the Ethernet protocol, the vehicle-mounted devices A, B,..., X all support the CAN protocol, and the switch 12 is configured to perform packet exchange functions for data supporting the Ethernet protocol, so that the vehicle-mounted devices 1, 2,..., x send communication data in the Ethernet protocol to the gateway 13 through the switch 12, and the gateway 13 is configured to convert the communication data in the Ethernet protocol into communication data in the CAN protocol and send the communication data in the CAN protocol to the CAN bus, so that the corresponding vehicle-mounted devices among the vehicle-mounted devices A, B,..., X can receive the communication data in the CAN protocol through the CAN bus; or, the vehicle-mounted devices A, B,..., X can send communication data in the CAN protocol to the gateway 13, and the gateway 13 is configured to convert the communication data in the CAN protocol into communication data in the Ethernet protocol and send the communication data in the Ethernet protocol to the switch 12, so that the switch 12 sends the communication data in the Ethernet protocol to the corresponding vehicle-mounted devices among the vehicle-mounted devices 1, 2,..., x.

[0080] Specifically, in the automobile 100 shown, Figure 1 In the automobile 100 shown, for a vehicle-mounted device that needs to communicate using Ethernet, first, the data (also referred to as structure data) in a structure variable defined by an application (APP) in the vehicle-mounted device needs to be serialized based on a protocol such as SOME / IP in the operating system, then encapsulated according to a transmission protocol such as SOME / IP, and then converted into a packet that can be transmitted in Ethernet through a transmission control protocol / internet protocol (TCP / IP), so that the data of the application in the communication device can be transmitted in Ethernet. The vehicle-mounted device receiving the packet deserializes the payload in the packet through a protocol layer entity such as SOME / IP in the operating system, obtains data in the form of a structure, and provides the data to the application on the vehicle-mounted device, thereby realizing communication between vehicle-mounted devices.

[0081] It should be noted that, in general, an application needs to use structure data, and therefore needs to create a variable, i.e., a structure variable. That is, the structure variable obtains structure data after taking a value. It can be understood that the value of the structure variable may be different at different times. That is, the structure data may be different at different times.

[0082] It should be understood that a variable of a struct type can include one or more member variables, each of which can be of a basic data type or an array type whose elements are of a basic data type, or of a struct type or an array type whose elements are of a struct type. The basic data type can include an 8-bit, 16-bit, or 32-bit unsigned integer type (uint8, uint16, or uint32), an 8-bit, 16-bit, or 32-bit signed integer type (sint8, sint16, or sint32), a 32-bit or 64-bit floating point type (float32 or float64), a character type (char), a Boolean type (boolean), and the like, without limitation. For example, a variable of a struct type struct A includes uint32 a, uint16 b[3], float32 c, and struct D, where struct D includes uint8 dd and char de.

[0083] It is explained herein that a member variable of a struct type or an array type whose elements are of a struct type is also referred to as a struct member variable, and a member variable that is not of a struct type or an array type whose elements are of a struct type, such as a member variable of a basic data type or an array type whose elements are of a basic data type, is also referred to as a non-struct member variable.

[0084] In one possible representation of a variable of a struct type, one or more sub-structs can be used to represent the variable of the struct type. Each of the sub-structs can include one or more non-struct member variables, and some or all of the sub-structs can further include a struct member variable as a variable of a corresponding sub-struct. For example, Figure 2As shown, the structure variable x of the structure type of structure_1 includes substructure_1, substructure_2 and substructure_3. Among them, substructure_1 includes non-structure member variable a and non-structure member variable b[3], and a structure member variable c, wherein the structure member variable c of the structure type of structure_2 corresponds to substructure_2, substructure_2 includes non-structure member variable d[2], non-structure member variable e and a structure member variable f, wherein the structure member variable f of the structure type of structure_3 corresponds to substructure_3, and substructure_3 includes non-structure member variable g[2] and non-structure member variable h. It can be seen that substructure_3 is a lower-level substructure of substructure_2, substructure_2 is a lower-level substructure of substructure_1 and an upper-level substructure of substructure_3, and substructure_1 is an upper-level substructure of substructure_2 and a first-level substructure of the structure variable x. If a tree-shaped identification structure variable is used, the substructure corresponds to the root node of a tree or a sub-tree, and the non-structure variable corresponds to the leaf node of the tree.

[0085] More specifically, in the automobile 100 shown, Figure 1 In the automobile 100 shown, for the vehicle-mounted devices that need to use Ethernet for communication, when the data (structure data) in the structure variable defined by the application program is encapsulated based on the SOME / IP protocol in the operating system, the data in the structure variable is first subjected to serialization processing. The serialization processing refers to sorting the data in the structure variable according to certain rules, and then encapsulating the sorted objects into the payload of the SOME / IP message in a certain form and sending them to the network.

[0086] As an example, Figure 3 A communication architecture between vehicle-mounted devices is provided in the embodiments of the present application. As shown in Figure 3 As shown, the backbone network is a high-speed Ethernet between each gateway 201 and each domain controller 202, and the gateway 201 accesses sensors or actuators that do not support Ethernet communication through the CAN network. The gateway 201 can be regarded as a device that can convert data conforming to the CAN protocol into data conforming to the Ethernet protocol. In the vehicle-mounted network, each node (i.e., each gateway 201 or each domain controller 202) on the backbone network first subjects the data in the structure variable defined by the application program in the node to serialization processing based on the SOME / IP protocol in the operating system when communicating.

[0087] For example, in the automobile 100 shown, Figure 3In the illustrated architecture schematic, when the gateway 201 sends the value of the application-defined structure variable at a certain time (structure data) to the domain controller 202 for processing, the gateway 201 encapsulates the structure data using the SOME / IP protocol and the TCP / IP protocol, and then transmits the encapsulated structure data to the domain controller 202 for processing via Ethernet; after the domain controller 202 completes the processing, the domain controller 202 encapsulates the operation result using the SOME / IP protocol and the TCP / IP protocol, and then transmits the encapsulated operation result to the gateway 201 via Ethernet. When the gateway 201 encapsulates the structure data using the SOME / IP protocol, the SOME / IP protocol in the operating system of the gateway 201 first sorts the structure data according to a certain rule to serialize the structure data into serial data, and then transmits the serialized data to the network.

[0088] For ease of understanding, the following describes the serialization of the structure variable x in the structure variable to be serialized. Figure 2 As shown in the structure variable x, the structure variable x includes a sub-structure variable _1, the sub-structure variable _1 includes three member variables, two non-structure member variables a and b[3], and a structure member variable c, wherein the structure member variable c of the structure type structure_2 corresponds to a sub-structure variable _2, the sub-structure variable _2 includes three member variables, two non-structure member variables d[2] and e, and a structure member variable f, wherein the structure member variable f of the structure type structure_3 corresponds to a sub-structure variable _3, and the sub-structure variable _3 includes two non-structure member variables g[2] and h. Figure 2 When the data in the structure variable x is serialized, the data in the variable a is first placed in the buffer, then the data in the variable b[3] is placed in the buffer after the data in the variable a is placed in the buffer, the data in the variable d[2] is placed in the buffer after the data in the variable b[3] is placed in the buffer, the data in the variable e is placed in the buffer after the data in the variable d[2] is placed in the buffer, the data in the variable g[2] is placed in the buffer after the data in the variable e is placed in the buffer, and finally, the data in the variable h is placed in the buffer after the data in the variable g[2] is placed in the buffer, thereby completing the serialization of the data in the structure variable x.

[0089] For example, assume that at the current time, the value of variable a in the above structure variable x is 1, the values of variables b[3] are 2, 3, and 4 respectively, the values of d[2] are 5 and 6, the value of variable e is 7, the values of g[2] are 8 and 9, and the value of variable h is 10 (0x0a). It should be understood that all the variables in the above structure variable have obtained the structure data after the values are taken at the time. Then, when the structure data of the above structure variable at the current time is serialized, 1 corresponding to variable a can be first placed into the buffer, 2 corresponding to variable b[3] can be placed into the buffer after 1 corresponding to variable a is placed into the buffer, 3 corresponding to variable b[3] can be placed into the buffer after 2 corresponding to variable b[3] is placed into the buffer, 4 corresponding to variable b[3] can be placed into the buffer after 3 corresponding to variable b[3] is placed into the buffer, 5 corresponding to variable d[2] can be placed into the buffer after 4 corresponding to variable b[3] is placed into the buffer, 6 corresponding to variable d[2] can be placed into the buffer after 5 corresponding to variable d[2] is placed into the buffer, 7 corresponding to variable e can be placed into the buffer after 6 corresponding to variable d[2] is placed into the buffer, 8 corresponding to g[2] can be placed into the buffer after 7 corresponding to variable e is placed into the buffer, 9 corresponding to g[2] can be placed into the buffer after 8 corresponding to g[2] is placed into the buffer, and finally, 10 corresponding to variable h can be placed into the buffer after 9 corresponding to g[2] is placed into the buffer, so as to complete the serialization of the structure data. The byte stream of the data in the buffer in hexadecimal representation is "0102030405060708090a".

[0090] However, in the above serialization processing method, even if only one byte of the data (structure data) in the structure variable defined by the application program is changed (for example, the data in a certain non-structure member variable is changed), the SOME / IP protocol in the operating system still needs to re-serialize all the data in the structure variable when serializing the data in the structure variable defined by the application program, resulting in a long serialization processing time problem, and further resulting in a long data transmission time problem of the structure variable defined by the application program.

[0091] For example, still taking the structure variable x defined by the application program as an example, assume that at the current time, the value of variable a in the above structure variable x is 1, the values of variables b[3] are 2, 3, and 4 respectively, the values of d[2] are 5 and 6, the value of variable e is 7, the values of g[2] are 8 and 9, and the value of variable h is 10 (0x0a). It should be understood that all the variables in the above structure variable have obtained the structure data after the values are taken at the time. Then, when the structure data of the above structure variable at the current time is serialized, 1 corresponding to variable a can be first placed into the buffer, 2 corresponding to variable b[3] can be placed into the buffer after 1 corresponding to variable a is placed into the buffer, 3 corresponding to variable b[3] can be placed into the buffer after 2 corresponding to variable b[3] is placed into the buffer, 4 corresponding to variable b[3] can be placed into the buffer after 3 corresponding to variable b[3] is placed into the buffer, 5 corresponding to variable d[2] can be placed into the buffer after 4 corresponding to variable b[3] is placed into the buffer, 6 corresponding to variable d[2] can be placed into the buffer after 5 corresponding to variable d[2] is placed into the buffer, 7 corresponding to variable e can be placed into the buffer after 6 corresponding to variable d[2] is placed into the buffer, 8 corresponding to g[2] can be placed into the buffer after 7 corresponding to variable e is placed into the buffer, 9 corresponding to g[2] can be placed into the buffer after 8 corresponding to g[2] is placed into the buffer, and finally, 10 corresponding to variable h can be placed into the buffer after 9 corresponding to g[2] is placed into the buffer, so as to complete the serialization of the structure data. The byte stream of the data in the buffer in hexadecimal representation is "0102030405060708090a". Figure 2For example, the data to be sent by the application is represented by a structure variable x, the application provides the data to be sent to the operating system for serialization, and the protocol entity, such as SOME / IP, in the operating system needs to serialize all the data in the member variables of the structure variable x at the current time according to the structure definition of the structure variable x, and sequentially copy the data in the member variables to the buffer, that is, the data in the member variable a is serialized to the buffer first, then the data in the member variable b[3] is serialized to the buffer, and so on, until the data in the member variable h is serialized to the buffer. Assuming that the data in the member variable e in the structure variable x is updated at the current time, and the data in other member variables is not updated, the current serialization manner is not efficient. When there are many member variables in the structure, and relatively few member variables have data changes, the serialization time delay of the current operating system is large, thereby causing a high data transmission time delay of the application.

[0092] In view of this, the embodiments of the present application provide a data transmission method and device. In the data transmission method provided by the present application, when the data in a certain member variable in a structure variable to be serialized changes, the value of the indication information in the mapping table that has a mapping relationship with the member variable is updated from an initial value to a target value, so that the protocol layer entity in the operating system can know which member variable in the structure variable to be serialized has data that may change based on the mapping table, thereby enabling the operating system to serialize the data in other member variables that do not change based on SOME / IP and other protocols, and only re-serialize the data in the member variable that changes to the buffer, thereby reducing the time delay of the serialization process, and further reducing the data transmission time delay of the application in the communication device.

[0093] It is explained here that the embodiments of the present application do not limit the specific software architecture of the in-vehicle network. For example, the software architecture of the in-vehicle network can be a service-oriented software architecture.

[0094] The following will be described in conjunction with Figure 4 The data transmission method provided by the present application will be described. Specifically, the execution subject of the serialization method provided by the embodiments of the present application can be any communication device. For example, the communication device is the gateway shown in Figure 1 , or a switch, or another electronic control unit in the in-vehicle network that has a similar function to the gateway.

[0095] Figure 4 The flowchart of the data transmission method provided by an embodiment of the present application is shown in Figure 4As shown, the method includes S401, S402, S403 and S404. Among them, S401, S402 and S403 are executed by an application in the communication device, S404 is executed by an operating system in the communication device, and specifically, S404 is executed by a protocol layer entity in the operating system in the communication device.

[0096] S401, determining a target to-be-serialized structure variable corresponding to the to-be-sent data.

[0097] The application obtains the to-be-sent data and determines a target to-be-serialized structure variable corresponding to the to-be-sent data. The target to-be-serialized structure variable includes n sub-structures, each of the n sub-structures includes one or more member variables, the type of the one or more member variables is a structure member variable or a non-structure member variable, for a sub-structure i including a structure member variable, a sub-structure j corresponding to the structure member variable is a lower-level sub-structure of the sub-structure i, n is a positive integer, and i and j are positive integers less than or equal to n.

[0098] In this embodiment, the target to-be-serialized structure variable refers to a variable of a structure type that needs to be serialized. The data used by the application is data in the form of a structure, which is indicated by a structure variable. When the application and another application communicate through an Ethernet protocol, the to-be-sent data in the form of a structure needs to be serialized into a byte sequence by a protocol layer entity of an operating system. The concept and detailed description of the serialization process can be referred to the description in the above part of the present application, which will not be described here.

[0099] The target to-be-serialized structure variable is a structure variable corresponding to the to-be-sent data.

[0100] In this embodiment, the target to-be-serialized structure variable includes n sub-structures, and each sub-structure includes one or more member variables. Specifically, the type of the one or more member variables in this embodiment can be a structure member variable or a non-structure member variable. The concepts of member variables, structure member variables and non-structure member variables can be referred to the related description in the above part of the present application, which will not be described here.

[0101] In addition, in this embodiment, for a sub-structure i including a structure member variable in the target to-be-serialized structure variable, a sub-structure j corresponding to the structure member variable is a lower-level sub-structure of the sub-structure i, n is a positive integer, and i and j are positive integers less than or equal to n.

[0102] Exemplarily, when Figure 2When the application-defined structure variable shown is defined as a target to-be-serialized structure variable, the target to-be-serialized structure variable is x, and specifically, the target to-be-serialized structure variable x includes substructure_1, for substructure_1, includes non-structure member variable unit32 a, non-structure member variable unit32b[3], and structure member variable c of structure_2, where structure member variable c of structure_2 corresponds to substructure_2, substructure_2 includes non-structure member variable unit32 d[2], non-structure member variable float e, and structure member variable f of structure_3, where structure member variable f of structure_3 corresponds to substructure_3, and substructure_3 includes non-structure member variable float32 g[2] and non-structure member variable unit32 h. In this example, for substructure_1 including structure member variable c, substructure_2 can be considered as a lower-level substructure of substructure_1, and for substructure_2 including structure member variable f, substructure_3 can be considered as a lower-level substructure of substructure_2.

[0103] It is explained herein that, Figure 2 The structure variable shown is only an example and does not constitute a limitation of the application.

[0104] It is explained herein that, in this application, non-structure member variables and / or structure member variables are also referred to as member variables.

[0105] S402, when data in a first member variable in the target to-be-serialized structure variable is updated, update the value of first indication information corresponding to the first member variable in the first mapping table from an initial value to a target value, the first mapping table includes k indication information, different indication information in the k indication information corresponds to different member variables in the target to-be-serialized structure variable, the value of each indication information in the k indication information indicates whether the data in the corresponding member variable is updated, the initial value indicates that no update has occurred, and the target value indicates that an update has occurred, and k is a positive integer.

[0106] In this embodiment, the first member variable is any one of all member variables included in the target to-be-serialized structure variable. It should be understood that the first member variable can be a non-structure member variable or a structure member variable.

[0107] In this embodiment, when the data in the first member variable is updated (also referred to as being changed, being modified, or being altered), the value of the first indication information corresponding to the first member variable in the first mapping table is updated from the initial value to the target value. In this embodiment, the first mapping table includes k indication information, different indication information in the k indication information corresponds to different member variables in the target to-be-serialized structure body variable, and the value of each indication information in the k indication information indicates whether the data in the corresponding member variable is updated.

[0108] It can be understood that, when the data in a certain member variable is updated, the value of the indication information corresponding to the member variable in which the data is updated in the first mapping table is updated from the initial value to the target value. Therefore, by the value of each indication information in different indication information in the first mapping table, it can be determined which member variables in which the data is updated, that is, by the first mapping table, it can be tracked which member variables in the target to-be-serialized structure body variable in which the data is updated.

[0109] It is explained that, the specific forms of the initial value and the target value are not limited in the embodiments of the present application. For example, the initial value can be in a numerical form or other forms, and the target value can also be in a numerical form or other forms. The other forms are, for example, an alphabetical form, a special symbol form, and the like.

[0110] In a possible manner, one or more bits can be used to represent one indication information. The initial value is 0, and the target value can be 1, or the initial value is 1, and the target value is 0. When multiple bits are used to represent one indication information, the initial value and the target value can also be set to other values, as long as the two values are different, and the embodiments of the present application are not limited in this regard.

[0111] In the embodiments of the present application, the specific correspondence between different indication information in the k indication information in the first mapping table and different member variables in the target to-be-serialized structure body variable is not limited.

[0112] In a possible implementation manner, one indication information in the first mapping table can correspond to one non-structure member variable in the target to-be-serialized structure body variable. That is, one indication information in the first mapping table corresponds to one non-structure member variable in the target to-be-serialized structure body variable. It can be understood that, in this mapping relationship, each indication information in the first mapping table can be used to track one non-structure member variable.

[0113] Exemplarily, Figure 5 A structure diagram of the mapping relationship between the first mapping table provided by the embodiments of the present application and the member variables is shown. As Figure 5As shown, the first mapping table includes 6 types of indication information (such as...). Figure 5 The indication information is 1, 2, 3, 4, 5 and 6). Among them, indication information 1 corresponds to the non-structure member variable unit32 a in the target structure variable to be serialized, indication information 2 corresponds to the non-structure member variable unit32 b[3], indication information 3 corresponds to the non-structure member variable unit32 d[2], indication information 4 corresponds to the non-structure member variable float e in the target structure variable to be serialized, indication information 5 corresponds to the non-structure member variable float32 g[2], and indication information 6 corresponds to the non-structure member variable unit32 h. Then, if the data in a certain non-structure member variable changes, the value of the indication information corresponding to that non-structure member variable in the first mapping table is updated from the initial value to the target value. For example, when Figure 5 When the non-structure member variable float e in the first mapping table changes, the indicator information 4 corresponding to the non-structure member variable float e is updated from the initial value to the target value (e.g., from 0 to 1). It can be understood that under this correspondence, whether the value of indicator information 1 is the target value can be used to track whether the data in the non-structure member variable float e has changed, whether the value of indicator information 2 is the target value can be used to track whether the data in the non-structure member variable unit32 b[3] has changed, whether the value of indicator information 3 is the target value can be used to track whether the data in unit32 d[2] has changed, whether the value of indicator information 4 is the target value can be used to track whether the data in the non-structure member variable float e has changed, whether the value of indicator information 5 is the target value can be used to track whether the data in float32 g[2] has changed, and whether the value of indicator information 6 is the target value can be used to track whether the data in unit32 h has changed.

[0114] In another possible approach, when designing the correspondence between different indications among the k indications and different member variables in the target serializable structure variable, the substructure can also be used as the corresponding unit.

[0115] It should be understood that when a sub-structure is taken as a corresponding unit, for a certain sub-structure (supposedly referred to as a second sub-structure), when the second sub-structure includes a structure member variable, essentially, a change in the structure member variable in the second sub-structure is still a change in a non-structure member or data in a non-structure member in the sub-structure corresponding to the structure member variable that changes. Therefore, in this application, when a sub-structure is taken as a corresponding unit, if a structure member variable in a certain sub-structure changes, it is considered that data in a lower sub-structure of the certain sub-structure changes.

[0116] Therefore, when a sub-structure is taken as a monitoring unit, in the specific corresponding relationship between the different indication information in the k indication information in the first mapping table and the different member variables in the target to-be-serialized structure variable, all non-structure member variables under one sub-structure in the target to-be-serialized and the structure member variables in the upper sub-structure of the one sub-structure can be corresponding to one indication information in the first mapping table. It is explained that in this application, all non-structure member variables under one sub-structure in the target to-be-serialized and the structure member variables in the upper sub-structure of the one sub-structure corresponding to one indication information in the first mapping table are also referred to as the corresponding relationship between one indication information and one sub-structure.

[0117] As an example, Figure 6 A structure diagram of the mapping relationship between the first mapping table and the member variables provided by one embodiment of the application is shown. It is explained that this example takes n = 3 as an example for illustration, which does not constitute a limitation of the application.

[0118] As Figure 6 shown, the first mapping table includes three indication information (such as indication information 1, indication information 2 and indication information 3 in Figure 6 ). Among them, indication information 1 corresponds to non-structure member variable unit32 a and non-structure member variable unit32 b[3] in sub-structure_1 in the target to-be-serialized structure variable, indication information 2 corresponds to non-structure member variable unit32 d[2], non-structure member variable float e in sub-structure_2 and structure member variable c in sub-structure_1, and indication information 3 corresponds to non-structure member variable float32 g[2] and unit32 h in sub-structure_3. Then, when data of a certain member variable in a certain sub-structure is updated, the value of the indication information corresponding to the certain member variable in the first mapping table is updated from the initial value to the target value. For example, when Figure 6When the non-structure member variable float e in the sub-structure body_1 changes, since the non-structure member variable float e corresponds to the indication information 2 in the first mapping table, the value of the indication information 2 in the first mapping table is updated from the initial value to the target value (for example, from 0 to 1). It can be understood that in this mapping relationship, whether the value of the indication information 1 is the target value can be used to track whether the data in all non-structure members in the sub-structure body_1 changes, whether the value of the indication information 2 is the target value can be used to track whether the data in all non-structure members in the sub-structure body_2 changes, and whether the value of the indication information 3 is the target value can be used to track whether the data in all non-structure members in the sub-structure body_3 changes.

[0119] As another example, Figure 7 A structure diagram of a mapping relationship between a first mapping table and member variables provided for another embodiment of the present application is shown. It is explained that this example takes n=2 as an example for illustration, which does not constitute a limitation of the present application.

[0120] As Figure 7 shown, the indication information 1 included in the first mapping table has a corresponding relationship with the non-structure member variable unit32 a, the non-structure member variable unit32 b[3], the structure member variable c, the non-structure member variable unit32 d[2], and the non-structure member variable float e. Then, as long as the data in any one of the member variables is updated, the value of the corresponding indication information in the first mapping table needs to be updated from the initial value to the target value. For example, whether the data in the non-structure member variable float e in the sub-structure body_1 is updated or the data in the non-structure member variable unit32 b[3] is updated, at this time, since the non-structure member variable float e and the non-structure member variable unit32 b[3] both have a corresponding relationship with the indication information 1 in the first mapping table, the value of the indication information 1 in the first mapping table is updated from the initial value to the target value (for example, from 0 to 1). It can be understood that in this corresponding relationship, whether the value of the indication information 1 is the target value can be used to track whether the contents in the non-structure member variable unit32 a, the non-structure member variable unit32 b[3], the structure member variable c, the structure member variable c, the non-structure member variable unit32 d[2], and the non-structure member variable float e are updated, that is, whether the data in all non-structure members in the sub-structure body_1 and the data in all non-structure members in the sub-structure body_2 are updated. Figure 7

[0121] As another example,​Figure 8 The mapping relationship between the first mapping table and the member variables provided by the embodiment of the present application is shown in the structural diagram. It is explained that the example takes 3 as an example for illustration, which does not constitute a limitation of the present application.

[0122] As shown in Figure 8 , the indication information 1 included in the first mapping table has a corresponding relationship with the non-structure member variable unit32 a, the non-structure member variable unit32 b[3], the structure member variable c, the non-structure member variable unit32 d[2] and the non-structure member variable float e, while the indication information 2 included in the first mapping table corresponds to the structure member variable f in the sub-structure 2 and the non-structure member variable float32 g[2] and the non-structure member variable unit32 h in the sub-structure_3. Then, if the content of a certain non-structure member variable in a certain sub-structure changes, the value of the indication information corresponding to the certain sub-structure in the first mapping table is updated from the initial value to the target value. For example, when the content of the non-structure member variable float e in the sub-structure_1 changes or the content of the non-structure member variable unit32 b[3] changes, since the sub-structure corresponding to the non-structure member variable float e and the sub-structure corresponding to the non-structure member variable unit32 b[3] both correspond to the indication information 1 in the first mapping table, the value of the indication information 1 in the first mapping table is updated from the initial value to the target value. While when the data in the non-structure member variable float32 g[2] in the sub-structure_3 changes, since the sub-structure corresponding to the non-structure member variable float32 g[2] corresponds to the indication information 2 in the first mapping table, the value of the indication information 2 in the first mapping table is updated from the initial value to the target value. It can be understood that under this mapping relationship, whether the data in all non-structure member variables in the sub-structure_1 and the sub-structure_2 changes can be tracked by whether the value of the indication information 1 is the target value, and whether the data in all non-structure member variables in the sub-structure_3 changes can be tracked by whether the value of the indication information 2 is the target value. Figure 8 Figure 8

[0123] It is explained that the above five implementation schemes are only structural diagrams of the corresponding relationship between the first mapping table and the member variables, and do not constitute a limitation of the present application.

[0124] S403, send the data in the target to-be-serialized structure variable and the first mapping table to the operating system, and correspondingly, the operating system receives the data in the target to-be-serialized structure variable and the first mapping table.

[0125] ​​In a possible implementation, the application program sends the data and the first mapping table to the operating system through an interface call provided by the operating system for the application program.

[0126] S404, serialize the data in the target non-structure member variable in the target to-be-serialized structure variable corresponding to the indication information with the value as the target value in the first mapping table.

[0127] As can be seen from S402, no matter what the specific mapping relationship between the first mapping table and the member variables in the target to-be-serialized structure variable is, as long as the data in a member variable is updated, the application program updates the value of the indication information corresponding to the member variable in the first mapping table from the initial value to the target value. In other words, as long as the value of a certain indication information in the first mapping table is updated from the initial value to the target value, it can be determined that the data in the member variable corresponding to the indication information is possibly updated. That is, for the protocol layer entity in the operating system, it can be determined through the first mapping table which member variables in the target to-be-serialized structure variable are possibly updated. Specifically, since the protocol layer entity in the operating system serializes the data in the non-structure member variable in the sub-structure when serializing, for the protocol layer entity in the operating system, it can be determined through the first mapping table which target non-structure member variables in the target to-be-serialized structure variable are possibly updated.

[0128] It can be understood that for the non-structure member variable whose data is possibly updated, the data in the non-structure member variable whose data is updated should be re-serialized into the preset buffer. For the non-structure member variable whose data is not updated, the content stored in the preset buffer before can be directly used.

[0129] Therefore, in the embodiment, when the protocol layer entity in the operating system determines through the first mapping table which target non-structure member variables in the target to-be-serialized structure variable are possibly updated, when serializing the data in the target to-be-serialized structure variable, only the data in the target member variable in the target to-be-serialized structure variable corresponding to the indication information with the value as the target value in the first mapping table is serialized, and the data in the member variable in the target to-be-serialized structure variable corresponding to the indication information with the value as the initial value in the first mapping table is not serialized.

[0130] Specifically, in an implementation, Figure 9 A process diagram of serialization is provided for the embodiment of the application. As shown in Figure 9 the figure, when the operating system receives the data in the target to-be-serialized structure variable and the first mapping table, the operating system determines through the first mapping table which target non-structure member variables in the target to-be-serialized structure variable are possibly updated, and then serializes the data in the target non-structure member variable in the target to-be-serialized structure variable corresponding to the indication information with the value as the target value in the first mapping table.Figure 9 S901) and calls the serialization function (S902) in the first mapping table, and then, starting from the first sub-structure, first judges whether the value of the indication information of the non-structure member variable in the current sub-structure to be serialized in the corresponding first mapping table is the target value (S903), and when the value of the indication information in the corresponding first mapping table is the target value, re-serializes the data in the non-structure member variable in the sub-structure into the corresponding sub-buffer (S905); and when the value of the indication information in the corresponding first mapping table is not the target value, further judges whether the sub-structure includes a structure member variable (S904), and in the case of including a structure member variable, takes the sub-structure corresponding to the structure member variable as the current sub-structure (S906), and continues to execute from the above S903. Figure 9 Figure 9 Figure 9 Figure 9 Figure 9

[0131] That is, in the embodiment, when serializing a certain non-structure member variable, if the value of the indication information corresponding to the non-structure member variable in the first mapping table is the target value, the data in the non-structure member variable is serialized, and if it is not the target value, the data in the non-structure member variable is not serialized.

[0132] ​​​​​The method for data transmission provided in the embodiments of the present application, after the application determines the target to-be-serialized structure variable, when the data in a certain member variable in the target to-be-serialized structure variable is updated, the value of the indication information corresponding to the member variable in the first mapping table is updated from the initial value to the target value, and then the data in the target to-be-serialized structure variable and the first mapping table are sent to the protocol layer entity in the operating system. It can be understood that, after the protocol layer entity in the operating system receives the data in the target to-be-serialized structure variable and the first mapping table sent by the application, based on the correspondence between the different indication information in the first mapping table and the different member variables and whether the value of each indication information in the first mapping table is the target value, the target non-structure member variable that may have data updated can be determined. Further, for the protocol layer entity in the operating system, after the target non-structure member variable that may have changed is determined, only the data in the target non-structure member variable that may have data updated is re-serialized, and for the non-structure member variable that has no data updated, the data that has been serialized to the buffer before can be directly used. That is, in the technical solution provided in the present application, all the data in the target to-be-serialized structure variable does not need to be serialized, thereby reducing the time delay problem caused by the serialization processing, and further reducing the transmission time delay of the data in the target to-be-serialized structure variable.

[0133] It can be understood that, for the first member variable, the variation degree of the data in the first member variable includes two cases. The first case is that the data in the first member variable is updated and does not affect the offset of the starting address in the memory corresponding to any one of the other member variables in the target to-be-serialized structure variable; the second case is that the data in the first member variable is updated and affects the offset of the starting address in the memory corresponding to any one of the other member variables in the target to-be-serialized structure variable. It should be understood that the length-variable array and the string may change the offset of the starting address in the memory corresponding to each member variable in the sub-structure.

[0134] As an optional embodiment, in order to let the operating system determine the type of data update that occurs to the corresponding target non-structure member variable through the value of each indication information, when the data in the first member variable is updated but does not affect the offset of the corresponding starting address in the memory of any one of the other member variables in the target to-be-serialized structure variable, the value of the first indication information can be updated from the initial value to the first target value, and the first target value indicates that the data in the member variable is updated but does not affect the offset of the corresponding starting address in the memory of any one of the other member variables in the target to-be-serialized structure variable. Correspondingly, for the protocol layer entity in the operating system, the data in the target non-structure member variable corresponding to the indication information with the value of the first target value in the first mapping table in the target to-be-serialized structure variable is serialized, including: serializing the data in the target non-structure member variable into a sub-buffer corresponding to the target non-structure member variable in a preset buffer, the preset buffer including z sub-buffers, each sub-buffer corresponding to one non-structure member variable in the target to-be-serialized structure variable, and each sub-buffer being used to store the data in the corresponding non-structure member variable.

[0135] In this embodiment, the preset buffer refers to a preset cache space for storing the serialization result of the data in the target to-be-serialized structure variable after serialization.

[0136] In this embodiment, the preset buffer includes z sub-buffers, each sub-buffer corresponding to one non-structure member variable in the target to-be-serialized structure variable, and each sub-buffer being used to store the data in the corresponding non-structure member variable.

[0137] Specifically, in the embodiment, when a protocol layer entity in the operating system serializes data in a certain non-structure member variable in the target structure variable to be serialized, if the value of the indication information corresponding to the certain non-structure member variable in the first mapping table is the first target value, the protocol layer entity in the operating system can determine that the data in the certain non-structure member variable is updated but does not affect the offset of the starting address in the memory corresponding to any one of the other member variables in the target structure variable to be serialized. That is, the data update in the non-structure member variable does not affect the other sub-structure. Therefore, in the embodiment, when the data in the certain non-structure member variable is serialized, the previous sub-buffer can still be used. In view of this, in the embodiment, when the data in the target non-structure member variable corresponding to the indication information with the value of the first target value in the first mapping table in the target structure variable to be serialized is serialized, the data in the target non-structure member variable is still serialized into the previous corresponding sub-buffer.

[0138] Exemplarily, Figure 10 A re-serialization structural schematic diagram is provided for an embodiment of the present application. In the example, the initial value of each indication information is 0, and the first target value is 1. As shown in Figure 10As shown, it is assumed that the target to-be-serialized structure variable includes five sub-structure bodies, which are referred to as sub-structure body 1, sub-structure body 2, sub-structure body 3, sub-structure body 4 and sub-structure body 5. In addition, sub-structure body 1 corresponds to indication information 1 in the first mapping table and sub-buffer 1 in the preset buffer, sub-structure body 2 corresponds to indication information 2 in the first mapping table and sub-buffer 2 in the preset buffer, sub-structure body 3 corresponds to indication information 3 in the first mapping table and sub-buffer 3 in the preset buffer, sub-structure body 4 corresponds to indication information 4 in the first mapping table and sub-buffer 4 in the preset buffer, and sub-structure body 5 corresponds to indication information 5 in the first mapping table and sub-buffer 5 in the preset buffer. It is assumed that the data in a non-structure member variable in sub-structure body 3 of the five sub-structure bodies is updated but does not affect the offset of the starting address in the memory corresponding to any one of the other member variables in the target to-be-serialized structure variable. At this time, the value of indication information 3 in the first mapping table is changed from 0 to 1. In this case, when the protocol layer entity in the operating system serializes the data in the target to-be-serialized structure variable, since the values of indication information 1, indication information 2, indication information 4 and indication information 5 in the first mapping table are all 0 and only the value of indication information 3 is 1, the protocol layer entity in the operating system can determine that the data in the sub-structure bodies corresponding to indication information 1, indication information 2, indication information 4 and indication information 5 has not been updated, and the data in sub-structure body 3 corresponding to indication information 3 may have been changed. Therefore, the protocol layer entity in the operating system can only re-serialize the data in all non-structure member variables in sub-structure body 3 to the corresponding sub-buffer 3 when serializing, and does not serialize the data in sub-structure body 1, sub-structure body 2, sub-structure body 4 and sub-structure body 5, but directly uses the content previously stored in the corresponding sub-buffer.

[0139] Herein, Figure 10The shown example is only introduced taking an example that each indication information in the first mapping table corresponds to one sub-structure body. In a specific implementation, each indication information can also correspond to multiple sub-structure bodies. It should be understood that when each indication information corresponds to multiple sub-structure bodies, at this time, when the data in the target to-be-serialized structure body variable is serialized, if the value of a certain indication information is the first target value, at this time, the sub-structure bodies corresponding to the first target value should all be re-serialized into the corresponding sub-buffer. For example, when a certain indication information (assuming it is called the second indication information) corresponds to two sub-structure bodies, if the data in the non-structure member variable in any one of the two sub-structure bodies is updated but does not affect the offset of the starting address in the memory corresponding to any one of the other member variables in the target to-be-serialized structure body variable, the value of the corresponding second indication information in the first mapping table is updated to the first target value. At this time, when the content of the target to-be-serialized structure body variable is serialized by the protocol layer entity in the operating system, the data in all non-structure member variables included in the two sub-structure bodies will be re-serialized.

[0140] For ease of understanding, still taking Figure 10 as an example for introduction. In this example, it is assumed that Figure 10 sub-structure body 1 in the first mapping table corresponds to indication information 1 in the first mapping table and sub-buffer 1 in the preset buffer, sub-structure body 2 corresponds to indication information 3 in the first mapping table and sub-buffer 2 in the preset buffer, sub-structure body 3 corresponds to indication information 3 in the first mapping table and sub-buffer 3 in the preset buffer, sub-structure body 4 corresponds to indication information 4 in the first mapping table and sub-buffer 4 in the preset buffer, and sub-structure body 5 corresponds to indication information 5 in the first mapping table and sub-buffer 5 in the preset buffer. At this time, when the data in a certain non-structure member variable in sub-structure body 3 is updated, the value of indication information 3 in the first mapping table is updated from 0 to 1. Then, since indication information 3 corresponds to all non-structure member variables in sub-structure body 2 and sub-structure body 3, when the data in the target to-be-serialized structure body variable is serialized by the protocol layer entity in the operating system, in addition to re-serializing the data in all non-structure member variables included in sub-structure body 2 into sub-buffer 2 in the preset buffer, the data in all non-structure member variables included in sub-structure body 3 is also re-serialized into sub-buffer 3 in the preset buffer.

[0141] As an optional embodiment, in order to enable the operating system to determine, through each indication information, that the data update of the corresponding target non-structure member variable is likely to be that type of update. Therefore, in specific implementation, when the data in the first member variable is updated and affects the offset of the starting address in memory of any one of the other member variables in the target to-be-serialized structure variable, the value of the first indication information is updated from the initial value to a second target value, the second target value indicating that the data in the member variable is updated and affects the offset of the starting address in memory of any one of the other member variables in the target to-be-serialized structure variable. Correspondingly, for the protocol layer entity in the operating system, serializing the data in the target non-structure member variable corresponding to the indication information with the second target value in the first mapping table in the target to-be-serialized structure variable includes: serializing the data in the target non-structure member variable into a sub-buffer corresponding to the target non-structure member variable in a preset buffer, and moving the data in the sub-buffer corresponding to the second non-structure member variable to a target buffer, the value of the indication information corresponding to the second non-structure member variable in the first mapping table being the initial value, and the sub-buffer corresponding to the second non-structure member variable in the preset buffer being located after the sub-buffer corresponding to the target non-structure member variable in the preset buffer, the preset buffer including z sub-buffers, each sub-buffer corresponding to a non-structure member variable in the target to-be-serialized structure variable, and each sub-buffer being used to store the data in the corresponding non-structure member variable, the target buffer being located after the sub-buffer corresponding to the target non-structure member variable.

[0142] It can be understood that, when the protocol layer entity in the operating system serializes the data in a certain non-structure member variable in the target to-be-serialized structure variable, if the value of the indication information corresponding to the certain non-structure member variable in the first mapping table is the second target value, the protocol layer entity in the operating system can determine that: the data in the certain member variable is updated and affects the offset of the starting address in memory of any one of the other member variables in the target to-be-serialized structure variable. It can be understood that, in this case, when the data in the certain non-structure member variable in the target to-be-serialized structure variable is serialized, the data in the other non-structure member variables also needs to be considered.

[0143] It can be understood that, when the protocol layer entity in the operating system serializes the data in a certain non-structure member variable in the target to-be-serialized structure variable, if the value of the indication information corresponding to the certain non-structure member variable in the first mapping table is the second target value, the protocol layer entity in the operating system can determine that: the data in the certain member variable is updated and affects the offset of the starting address in memory of any one of the other member variables in the target to-be-serialized structure variable. It can be understood that, in this case, when the data in the certain non-structure member variable in the target to-be-serialized structure variable is serialized, the data in the other non-structure member variables also needs to be considered.

[0144] Exemplarily, Figure 11This is a structural schematic diagram of reserialization provided for one embodiment of this application. In this example, the initial value of each indication message is 0, and the second target value is 2. Figure 11 As shown, assume the target structure variable to be serialized includes five substructures, named substructure 1, substructure 2, substructure 3, substructure 4, and substructure 5. Furthermore, substructure 1 corresponds to indicator information 1 in the first mapping table and sub-buffer 1 in the preset buffer; substructure 2 corresponds to indicator information 2 in the first mapping table and sub-buffer 2 in the preset buffer; substructure 3 corresponds to indicator information 3 in the first mapping table and sub-buffer 3 in the preset buffer; substructure 4 corresponds to indicator information 4 in the first mapping table and sub-buffer 4 in the preset buffer; and substructure 5 corresponds to indicator information 5 in the first mapping table and sub-buffer 5 in the preset buffer. Now, suppose the data in the non-structure member variable of substructure 3 is updated, affecting the offset of the starting address of any member variable in the target structure variable to be serialized in memory. In this case, the value of indicator information 3 in the first mapping table will first be changed from 0 to 2. In this scenario, when the protocol layer entity in the operating system serializes the data in the target structure variable to be serialized, since the values ​​of indication information 1, indication information 2, indication information 4, and indication information 5 in the first mapping table are all 0, and only indication information 3 has a value of 2, the protocol layer entity in the operating system can determine that the data in all non-structure member variables of the substructures corresponding to indication information 1, indication information 2, indication information 4, and indication information 5 has not been updated, while the data in substructure 3 corresponding to indication information 3 may have been updated, and the update of the data in substructure 3 may affect the data in substructure 4 and substructure 5. For example, the substructure... 3. The updated data requires more cache space than before, which will affect the data of the substructure stored in sub-buffers 4 and 5 after the original sub-buffer 3. Therefore, in this embodiment, when the protocol layer entity in the operating system performs serialization, it can skip serializing the data in all non-structure member variables of the substructure located before substructure 3, directly using the data previously stored in the corresponding sub-buffer, and only reserialize the data in substructure 3 to the corresponding sub-buffer. After that, the data in the original sub-buffers 4 and 5 is moved to the target buffer, which is located after the sub-buffer corresponding to substructure 3. It is understood that this implementation method can guarantee the accuracy of the data in sub-buffers 4 and 5.

[0145] As an optional embodiment, there can also be a case where no data in any one of the sub-structures in the target structure variable to be serialized is updated, i.e. no data in all non-structure member variables in the target structure variable to be serialized is updated. For example, when the communication device broadcasts, the data sent to each client is all the same. In this embodiment, when no data in any one of the sub-structures is updated, the first mapping table is not updated. It can be understood that in this case, when the protocol layer entity in the operating system serializes the data in the target structure variable to be serialized, since it can be determined from the first mapping table that the data in the target structure variable to be serialized is not updated, the protocol layer entity in the operating system will not serialize the data in the target structure variable to be serialized, but can directly use the data in the corresponding buffer of the target structure variable to be serialized.

[0146] Exemplarily, Figure 12 A structural diagram of re-serialization is provided for an embodiment of the present application. In this example, the initial value of each indication information is 0. As shown in Figure 12 the target structure variable to be serialized includes five sub-structures, which are referred to as sub-structure 1, sub-structure 2, sub-structure 3, sub-structure 4 and sub-structure 5. In addition, sub-structure 1 corresponds to indication information 1 in the first mapping table and sub-buffer 1 in the preset buffer, sub-structure 2 corresponds to indication information 2 in the first mapping table and sub-buffer 2 in the preset buffer, sub-structure 3 corresponds to indication information 3 in the first mapping table and sub-buffer 3 in the preset buffer, sub-structure 4 corresponds to indication information 4 in the first mapping table and sub-buffer 4 in the preset buffer, and sub-structure 5 corresponds to indication information 5 in the first mapping table and sub-buffer 5 in the preset buffer. It is assumed that the contents of the five sub-structures are not updated. In this case, when the protocol layer entity in the operating system serializes the data in the target structure variable to be serialized, since the values of indication information 1, indication information 2, indication information 3, indication information 4 and indication information 5 in the first mapping table are all 0, the protocol layer entity in the operating system can determine that the data in sub-structure 1, sub-structure 2, sub-structure 3, sub-structure 4 and sub-structure 5 is not changed. Therefore, in this embodiment, when the protocol layer entity in the operating system serializes, it can directly use the data stored in sub-buffer 1, sub-buffer 2, sub-buffer 3, sub-buffer 4 and sub-buffer 5 as the serialization result at the current time.

[0147] In the embodiment, when the data in the target serialization structure variable does not change, the first mapping table is not updated. Therefore, when the protocol layer in the operating system serializes the data in the target serialization structure variable, the data in the target serialization structure variable is not re-serialized, so that the time delay of re-serializing the data in the target serialization structure variable is saved, the time delay of serializing the data in the target serialization structure variable is reduced, and the data transmission time delay in the application program is further reduced.

[0148] As can be seen from the above embodiment, when the data in the first member variable in the target serialization structure variable is updated, the value of the first indication information corresponding to the first member variable in the first mapping table is updated from the initial value to the target value. It is explained that in the embodiment of the application, the specific way of updating the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value to the target value when the data in the first member variable is updated is not limited.

[0149] As an example, in the first implementation manner, updating the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value to the first target value or the second target value comprises: calling a stub function when the data in the first member variable is updated, the stub function being configured to update the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value to the first target value or the second target value. That is, in this implementation manner, when the data in the first member variable is updated, the stub function can be directly called, and the function of the stub function is to update the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value.

[0150] It should be understood that, in order to realize that the stub function can be called when the content of the first member variable changes, the stub function needs to be inserted first. In specific implementation, the stub function (which can also be regarded as a code for detecting whether the content of the target serialization structure variable changes) can be inserted in the process of compiling the source program written by the developer to realize serialization of the data in the target serialization structure variable by the compiler. Specifically, Figure 13 A process diagram for inserting a stub function provided by the application is shown in FIG. 1. Figure 13 As shown in FIG. 1, the method for inserting the stub function by the compiler comprises the following steps.

[0151] S1301, obtaining a source program.

[0152] The source program is used to serialize the data in the target serialization structure variable into a preset buffer. It can be understood that the source program includes a plurality of instructions.

[0153] S1302, a configuration file is acquired, and the configuration file includes a target structure variable to be serialized.

[0154] The target structure variable to be serialized is a structure variable that needs to be serialized. It can be understood that the structure variable that needs to be serialized usually includes a plurality of sub-structures, and each sub-structure can include a member variable. For details, reference can be made to the description in the foregoing text of the present application, which will not be repeated here.

[0155] S1303, the compiler analyzes instructions in the source program.

[0156] S1304, it is judged whether the instruction is a memory access instruction. If yes, S1305 is executed, otherwise, S1307 is executed.

[0157] S1305, it is judged whether the content indicated by the instruction is related to the target structure variable to be serialized. If yes, S1306 is executed, otherwise, S1307 is executed.

[0158] The content indicated by the instruction is related to the target structure variable to be serialized, which means that the content of the instruction execution involves the target structure variable to be serialized, and the content indicated by the instruction is not related to the target structure variable to be serialized, which means that the content of the instruction execution does not involve the target structure variable to be serialized.

[0159] S1306, a stub function is inserted.

[0160] The concept of the stub function can be referred to the description in the above embodiments of the present application, which will not be repeated here.

[0161] S1307, the next instruction in the source program is acquired.

[0162] It can be seen that in this embodiment, after the compiler completes the compilation of the source program, the stub function can be inserted into the code after the compilation of the source program, so that the final compiled code includes not only the code obtained after the compilation of the source program, but also the stub function code. The stub function code is used to update the value of the indication information corresponding to the certain member variable in the target structure variable to be serialized from the initial value to the target value when the data in the certain member variable changes. It can be understood that when the data in the certain member variable in the target structure variable to be serialized is updated, the inserted stub function will be called, so that the stub function updates the corresponding indication information in the first mapping table.

[0163] It is explained that by inserting the stub function in the process of compiling by the compiler, additional code will be introduced in the code after the compilation, therefore, in order to minimize the performance and memory overhead of inserting the stub function itself, in the implementation, the stub function can be inserted only when the target to be serialized structure variable has a write operation, so as to minimize the range of plugging; or, the inline function or embedded assembly can be used to reduce the processing overhead of the stub function; or, when the memory resource is insufficient, the stub function can be generated only for the specific to-be-serialized structure variable for the application program.

[0164] In this implementation, the stub function for updating the indication information of the first mapping table can be inserted in the process of compiling the source program by the compiler, so that the stub function can be called to update the corresponding indication information in the first mapping table when the data in a certain member variable in the target to-be-serialized structure variable changes.

[0165] As another example, in the second implementation, the update of the indication information in the first mapping table can also be implemented in some hardware triggered manner. For example, in order to implement the update of the indication information in the first mapping table, the target to-be-serialized structure variable can be set to read-only mode by MPU or MMU when the target to-be-serialized variable is initialized. Then when the application program has a write operation on the target to-be-serialized structure variable, the MPU / MMU is triggered to jump to the preset processing function to implement the operation of updating the first mapping table in the processing function. Exemplarily, as shown in Figure 14 , first, the target to-be-serialized structure variable is set to read-only mode by MPU or MMU after the initialization of the target to-be-serialized structure variable is completed (such as step 1 in Figure 14 ). It can be understood that when the application program has a write operation on a certain member variable of the target to-be-serialized structure variable, that is, the data in the certain member variable is updated (such as step 2 in Figure 14 ), the MPU / MMU will be triggered to jump to the preset processing function, so that the preset processing function can be used to update the first mapping table (such as step 3 in Figure 14 ).

[0166] It can be seen that in this embodiment, the MMU / MPU can be used to update the first mapping table, so as to monitor the change of the content of the target to-be-serialized structure variable.

[0167] However, in actual application, there can be a case that the MPU / MMU resource is limited. In view of this, the third implementation mode for updating the first mapping table is provided in the embodiment. In the third implementation mode provided in the present application, on the basis of inserting the stub function in the process of compiling by the compiler in the first implementation mode, the indirect access tracking capability of the sub-structure variable is further added. In the implementation mode, the core idea is to introduce reference analysis in the process of compiling the source program, then find all indirect reference points of the target structure variable to be serialized, and then perform stub detection.

[0168] Specifically, as shown in Figure 15 , the compiler acquires the source program (S1501 in Figure 15 ) and acquires the configuration file (S1502 in Figure 15 ), then the compiler reads in the source code and the configuration file (S1503 in Figure 15 ) and initializes the variable symbol set S as the data to be serialized quickly (S1504 in Figure 15 ); thereafter, the compiler analyzes the instructions in the source program from the first instruction and sets the flag as error (S1605 in Figure 15 ), then judges whether it is an address taking instruction (S1506 in Figure 15 ), when it is an address taking instruction, further judges whether the variable related to the instruction references the variable in the set S (S1507 in Figure 15 ), when it is the case, the symbol after taking value is added to the set S and the flag is set as correct (S1508 in Figure 15 ), then the next instruction in the source program is acquired (S1509 in Figure 15 ), and whether all instructions are analyzed is judged (S1510 in Figure 15 ), when all instructions are analyzed, whether the flag is correct is judged (S1511 in Figure 15 ), in the case that the flag is correct, the memory access is performed on the symbol in S and the stub function is inserted (S1512 in Figure 16 ).

[0169] For example, assuming that the data to be serialized to be monitored is d, and the type of d is a structure of C language. Then, for the variable x = &d, the access to x will also change the value of d, and therefore x needs to be put into the set S; further, for the variable y = x, the access to y will also change the value of d, and therefore y needs to be put into the set S. This is a recursive process, and the set S is continuously expanded until all references to the variable d are included in the set S.

[0170] The above describes the implementation of updating the first mapping table and the detailed implementation process of selective serialization based on whether the value of each indication information in the first mapping table is the target value after updating the first mapping table. It is explained that, in general, the target structure variable to be serialized described above can be only one of the p structure variables to be serialized. In this case, the preset buffer needs to be allocated for the p structure variables to be serialized.

[0171] However, in some scenarios, for example, some hardware resources are limited or memory resources may be insufficient, it may not be possible to allocate sufficient preset buffers for each structure variable to be serialized. To solve this problem, in the present application, the memory sharing mechanism and the replacement mechanism of the preset buffer are used to solve the problem.

[0172] Exemplarily, Figure 16 The structural diagram of sharing the preset buffer is provided in the present application. As shown in Figure 17 , the preset buffer is shared by the structure variable 1 to be serialized and the structure variable 2 to be serialized. Specifically, Figure 17 The process diagram of sharing the preset buffer provided by the embodiment of the present application is shown. As shown in Figure 17 , when the contents of the plurality of structure variables to be serialized are serialized, it can include: randomly selecting one structure variable to be serialized to occupy the preset buffer (S1701 in Figure 17 ), then other structure variables to be serialized enter the waiting queue (S1702 in Figure 17 ), then the frequency of sending the structure variable to be serialized in the recent period of time is counted (S1703 in Figure 17 ), and finally the structure variable to be serialized with the highest sending frequency occupies the preset buffer (S1704 in Figure 1 ).

[0173] It is explained that, in the above embodiments, the value of each indication information in the first mapping table is used to track the change of each variable in the target structure variable to be serialized. It should be understood that, as long as the implementation of indicating the change of the member variable in the target structure variable to be serialized by one indication information, it should belong to the concept of the present application.

[0174] Exemplarily, the structure of the differential serialization instruction chain table can be used to indicate the change of each variable in the target structure variable to be serialized. Specifically, the differential serialization instruction chain table includes five parts:

[0175] part_src_addr: represents the start address of the part in the data to be serialized which has changed, for example, when x.y in the data to be serialized x has changed, part_src_addr records the address of x.y;

[0176] part_type: represents the type of the part in the data to be serialized which has changed, for example, when x.y in the data to be serialized x has changed, part_type records the type of x.y;

[0177] part_dst_addr: represents the relative address of the part in the data to be serialized which has changed in the Serialization Buffer after serialization

[0178] whole_addr: represents the address of the complete data to be serialized;

[0179] next: represents the next item of the differential serialization instruction linked list.

[0180] As can be seen from the foregoing embodiments, whether using the insertion method or using the hardware-assisted monitoring method, the processing function will be called to update the first mapping table when the data to be serialized is found to have changed. In the present embodiment, when the structure of the differential serialization instruction linked list is used to indicate the change of each variable in the target data structure to be serialized, the processing function no longer updates the first mapping table, but adds a new item in the global differential serialization instruction linked list. Then, when performing serialization processing, the differential serialization instruction linked list will be traversed, and then when “whole_addr” is found to be equal to the address of the data to be serialized, the incremental serialization will be performed according to the indication of the four-tuple in the serialization instruction linked list.

[0181] It should be noted that the foregoing embodiments of the present application only illustrate the serialization of the SOME / IP protocol when introducing the scenarios, but it is explained that the data transmission method provided by the embodiments of the present application can not only be applied to the serialization of the SOME / IP protocol, but also can be applied to some other protocols which need to be serialized, for example, can also be applied to the data distribution protocol (data distribution service, DDS) and the like.

[0182] In addition, the serialization method proposed in the present application is not limited to the above Figure 18The vehicle-mounted network in the embodiment shown can also be applied to any communication protocol that needs to be serialized. For example, the Internet of Things (IOT) industry is developing rapidly today, and different embedded devices are interconnected through network protocols. For example, in a smart home scenario, a mobile phone can control a microwave oven, an air conditioner, and a smart lamp, and a central control unit can quickly open doors and windows and remotely alarm when detecting a gas leak. In such a scenario, the central processing unit (CPU) in the electric control unit has limited computing power and high requirements for latency. Therefore, the scheme in the present application can also reduce CPU computing power consumption and latency during serialization, thereby improving the response speed of home appliances, ensuring the safety, reliability, and user experience of the smart home scenario. For another example, in industrial production, a large number of components also need to be interconnected, such as temperature and light sensors that need to transmit real-time temperature and light to a central control unit, which commands the production line according to this information. In such a scenario, it is very important to reduce communication latency and CPU overhead, so the fast serialization method in the present application can also be used.

[0183] The above mainly introduces the method provided by the embodiment of the present application. It can be understood that, in order to realize the above functions, each device contains the hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiments disclosed in the present application, the present application can be realized in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0184] The embodiment of the present application can divide the functional modules of each device according to the above method examples. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be realized in the form of hardware or software functional module. It should be noted that the division of modules in the embodiment of the present application is illustrative, and is only a logical functional division. Actual implementation can have another division method.

[0185] In the case of dividing each functional module according to each function, Figure 18 The structure schematic diagram of the data transmission device provided by an embodiment of the present application is shown. As shown in the figure, the device 1800 includes a processing module 1801 and a transceiver module 1802. Figure 19 The device 1800 includes a processing module 1801 and a transceiver module 1802.

[0186] In a first embodiment, the processing module 1801 is configured to: determine a target to-be-serialized structure variable corresponding to to-be-sent data, the target to-be-serialized structure variable including n sub-structures, each of the n sub-structures including one or more member variables, the one or more member variables being of a structure member variable type or a non-structure member variable type, wherein for a sub-structure i including a structure member variable, a sub-structure j corresponding to the structure member variable is a lower-level sub-structure of the sub-structure i, n is a positive integer, and i and j are positive integers less than or equal to n; and when data in a first member variable in the target to-be-serialized structure variable is updated, update a value of first indication information corresponding to the first member variable in a first mapping table from an initial value to a target value, the first mapping table including k indication information, different indication information in the k indication information corresponding to different member variables in the target to-be-serialized structure variable, and a value of each indication information in the k indication information indicating whether data in a corresponding member variable is updated, the initial value indicating no update, and the target value indicating update, k being a positive integer. The transceiver 1802 is configured to send data in the target to-be-serialized structure variable and the first mapping table.

[0187] In a possible implementation, the processing module 1801 is specifically configured to: if the data in the first member variable is updated without affecting an offset of a starting address in memory corresponding to any one of other member variables in the target to-be-serialized structure variable, update the value of the first indication information from the initial value to a first target value, the first target value indicating that data in a member variable is updated without affecting the offset of the starting address in memory corresponding to any one of other member variables in the target to-be-serialized structure variable.

[0188] In a possible implementation, the processing module 1801 is specifically configured to: if the data in the first member variable is updated without affecting an offset of a starting address in memory corresponding to any one of other member variables in the target to-be-serialized structure variable, update the value of the first indication information from the initial value to a first target value, the first target value indicating that data in a member variable is updated without affecting the offset of the starting address in memory corresponding to any one of other member variables in the target to-be-serialized structure variable.

[0189] In a possible implementation, the processing module 1801 is specifically configured to: when data in the first member variable is updated, invoke a stub function, and the stub function is used to update a value of first indication information corresponding to the first member variable in the first mapping table from an initial value to a first target value or a second target value.

[0190] In a possible implementation, the processing module 1801 is specifically configured to: when data in the first member variable is updated, trigger a memory protection unit (MPU) or a memory management unit (MMU) to jump into a preset processing function, and the preset processing function is used to update the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value to the first target value or the second target value.

[0191] In a possible implementation, the processing module 1801 is specifically configured to: when data in the first member variable in the target to-be-serialized structure variable is not updated, not update the value of the first indication information corresponding to the first member variable in the first mapping table from the initial value to the target value.

[0192] In a possible implementation, the initial value is 0, the first target value is 1, and the second target value is 2.

[0193] In a second embodiment, the transceiving module 1802 is configured to receive data in a target to-be-serialized structure variable and a first mapping table, the target to-be-serialized structure variable includes n sub-structures, each sub-structure includes one or more member variables, the one or more member variables are of a structure member variable type or a non-structure member variable type, for a sub-structure i including a structure member variable, a sub-structure j corresponding to the structure member variable is a lower-level sub-structure of the sub-structure i, the first mapping table includes k indication information, different indication information in the k indication information corresponds to different member variables in the target to-be-serialized structure variable, a value of each indication information in the k indication information is an initial value or a target value, the initial value indicates that data in the corresponding member variable is not updated, the target value indicates that the data is updated, n is a positive integer, i and j are positive integers less than or equal to n, and k is a positive integer; and the processing module 1801 is configured to serialize data in a target non-structure member variable in the target to-be-serialized structure variable corresponding to indication information with the target value in the first mapping table.

[0194] In a possible implementation, the target value is a first target value, and the first target value indicates that data in a member variable is updated but does not affect an offset of a starting address in memory corresponding to any one of other member variables in the target to-be-serialized structure variable.

[0195] In a possible implementation, the processing module 1801 is specifically configured to serialize the data in the target non-structure member variable into a sub-buffer corresponding to the target non-structure member variable in a preset buffer, the preset buffer including z sub-buffers, each of the sub-buffers corresponding to one non-structure member variable in the target structure variable to be serialized, and each of the sub-buffers being configured to store data in the corresponding non-structure member variable.

[0196] In a possible implementation, the target value is a second target value, and the second target value indicates an offset of a starting address in memory of any one of other member variables in the target structure variable to be serialized, which is affected by an update of data in the member variable.

[0197] In a possible implementation, the processing module 1801 is specifically configured to serialize the data in the target non-structure member variable into a sub-buffer corresponding to the target non-structure member variable in the preset buffer, and move data in a sub-buffer corresponding to a second non-structure member variable to a target buffer, a value of indication information corresponding to the second non-structure member variable in the first mapping table being the initial value, and the sub-buffer corresponding to the second non-structure member variable in the preset buffer being located after the sub-buffer corresponding to the target non-structure member variable in the preset buffer, the preset buffer including z sub-buffers, each of the sub-buffers corresponding to one non-structure member variable in the target structure variable to be serialized, and each of the sub-buffers being configured to store data in the corresponding non-structure member variable, and the target buffer being located after the sub-buffer corresponding to the target non-structure member variable.

[0198] In a possible implementation, the target structure variable to be serialized is one of p structure variables to be serialized, and the buffer used when the p structure variables to be serialized are serialized is the preset buffer.

[0199] In a possible implementation, the processing module 1801 is specifically configured to re-serialize data of the target sub-structure variable into a preset buffer, if the target structure variable to be serialized is a structure variable to be serialized with the highest sending frequency among the p structure variables to be serialized.

[0200] In a possible implementation, the initial value is 0, the first target value is 1, and the second target value is 2.

[0201] Figure 19A structure schematic diagram of a terminal device 1900 is provided in the present application. For the convenience of description, Figure 19 Only the main components of the terminal device are shown. As shown in the figure, Figure 19 The terminal device 1900 includes a processor, a memory, a control circuit, an antenna and an input / output device. The terminal device 1900 can execute the above-mentioned method.

[0202] The processor is mainly used for processing communication protocols and communication data, controlling the whole terminal device, executing software programs, processing data of the software programs, for example, for controlling the terminal device to perform the actions described in the above-mentioned method embodiments. The memory is mainly used for storing software programs and data. The control circuit is mainly used for converting baseband signals and radio frequency signals and processing radio frequency signals. The control circuit and the antenna together can also be called a transceiver, which is mainly used for transmitting and receiving radio frequency signals in the form of electromagnetic waves. The input / output device, such as a touch screen, a display screen, a keyboard, etc., is mainly used for receiving user input data and outputting data to the user.

[0203] When the terminal device is powered on, the processor can read the software program in the storage unit, interpret and execute the instructions of the software program, and process the data of the software program. When data needs to be sent wirelessly, the processor performs baseband processing on the data to be sent, and outputs the baseband signal to the radio frequency circuit. The radio frequency circuit converts the baseband signal into a radio frequency signal, and transmits the radio frequency signal in the form of electromagnetic waves through the antenna. When data is sent to the terminal device, the radio frequency circuit receives the radio frequency signal through the antenna, converts the radio frequency signal into a baseband signal, and outputs the baseband signal to the processor. The processor converts the baseband signal into data and processes the data.

[0204] Those skilled in the art can understand that, for the convenience of description, Figure 19 Only one memory and one processor are shown. In actual terminal devices, there can be multiple processors and memories. The memory can also be called a storage medium or a storage device, etc., and the embodiments of the present application do not limit this.

[0205] As an optional implementation manner, the processor can include a baseband processor and a central processor. The baseband processor is mainly used for processing communication protocols and communication data, and the central processor is mainly used for controlling the whole terminal device, executing software programs, and processing data of the software programs. Figure 19The processor integrates the functions of a baseband processor and a central processing unit (CPU). Those skilled in the art will understand that the baseband processor and CPU can also be independent processors interconnected via technologies such as buses. It will also be understood that a terminal device can include multiple baseband processors to adapt to different network standards, and multiple CPUs to enhance its processing capabilities. The various components of the terminal device can be connected via various buses. The baseband processor can also be described as a baseband processing circuit or a baseband processing chip. Similarly, the CPU can be described as a central processing circuit or a central processing chip. The function of processing communication protocols and communication data can be built into the processor or stored as software programs in a storage unit, with the processor executing the software programs to implement the baseband processing function.

[0206] For example, in Figure 19 In this embodiment, the antenna and control circuit with transceiver functions can be regarded as the transceiver unit 1901 of the terminal device 1900, and the processor with processing functions can be regarded as the processing unit 1902 of the terminal device 1900. For example... Figure 19 As shown, the terminal device 1900 includes a transceiver unit 1901 and a processing unit 1902. The transceiver unit can also be referred to as a transceiver, transceiver device, or transceiver apparatus. Optionally, the device in the transceiver unit 1901 used to implement the receiving function can be considered as a receiving unit, and the device in the transceiver unit 1901 used to implement the transmitting function can be considered as a transmitting unit; that is, the transceiver unit 1901 includes a receiving unit and a transmitting unit. For example, the receiving unit can also be referred to as a receiver, receiver circuit, or receiving device, and the transmitting unit can be referred to as a transmitter, transmitter, or transmitting circuit.

[0207] Figures 4 to 18 The terminal device 1900 shown can achieve Figure 20 The various processes of the method are illustrated. The operations and / or functions of each module in the terminal device 1900 are respectively for implementing the corresponding processes in the above method embodiments. For details, please refer to the description in the above method embodiments; to avoid repetition, detailed descriptions are appropriately omitted here.

[0208] Figure 20 This is a structural schematic diagram of a data transmission apparatus provided in another embodiment of this application. Figure 20 The apparatus shown can be used to perform the method described in any of the foregoing embodiments.

[0209] like Figures 4 to 18 As shown, the device 2000 of this embodiment includes: a memory 2001, a processor 2002, a communication interface 2003, and a bus 2004. The memory 2001, processor 2002, and communication interface 2003 are interconnected via the bus 2004.

[0210] The memory 2001 can be a read only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 2001 can store a program, and when the program stored in the memory 2001 is executed by the processor 2002, the processor 2002 is configured to perform Figures 4 to 18 each step of the method shown.

[0211] The processor 2002 can be a general central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits, configured to perform related programs to implement the method shown in the present application. Figures 4 to 18

[0212] The processor 2002 can also be an integrated circuit chip with a processing capability of signals. In the implementation process, each step of the method of the embodiment of the present application Figures 4 to 18 may be completed by the integrated logic circuit of hardware in the processor 2002 or the instruction in the form of software.

[0213] The processor 2002 mentioned above can also be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Each method, step and logic block disclosed in the embodiment of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor.

[0214] The steps of the method disclosed in the embodiment of the present application can be directly embodied as hardware decoding processor for execution, or executed by the combination of hardware and software modules in the decoding processor. The software module can be located in the random access memory, the flash memory, the read only memory, the programmable read only memory or the electrically erasable programmable memory, the register or other mature storage medium in the art. The storage medium is located in the memory 2001, and the processor 2002 reads the information in the memory 2001, and combines the hardware to complete the functions required by the units included in the device of the present application, for example, each step / function of the embodiment shown Figures 4 to 18 may be executed.

[0215] ​The communication interface 2003 can use, but is not limited to, a transceiver such as a transceiver to realize the communication between the device 2000 and other devices or communication networks.

[0216] The bus 2004 can include a path for transmitting information between various components (for example, the memory 2001, the processor 2002, the communication interface 2003) of the device 2000.

[0217] It should be understood that the device 2000 shown in the embodiments of the present application can be an electronic device, or can also be a chip configured in an electronic device.

[0218] The above embodiments can be implemented, wholly or partially, by software, hardware, firmware, or any combination thereof. When implemented by software, the above embodiments can be implemented, wholly or partially, in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are wholly or partially generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (for example, infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. containing a set of one or more available media. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state disk.

[0219] It should be understood that the term "and / or" herein merely describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the three cases of A alone, A and B together, and B alone, where A and B can be singular or plural. In addition, the character " / " herein generally represents that the associated objects before and after are an "or" relationship, but can also represent an "and / or" relationship, which can be understood in the context before and after.

[0220] In this application, "at least one" means one or more, "multiple" means two or more. "At least one of the following (a)" or the like means any combination of these items, including single (a) or multiple (a) any combination. For example, at least one of a, b, or c, can represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c can be single or multiple.

[0221] It should be understood that the size of the sequence number of the above-mentioned processes does not mean the order of execution in various embodiments of the present application. The execution order of the processes should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0222] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0223] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the above-mentioned system, device and unit can be referred to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0224] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be realized by other ways. For example, the above-described device embodiments are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed units can be indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other form.

[0225] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0226] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.

[0227] The functions, if implemented in the form of software function units and sold or used as independent products, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in part, or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk, and various program codes that can be stored in the medium.

[0228] The above is merely specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which shall be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method of data transmission, characterized by, The method comprises the following steps: determining a target to-be-serialized structure variable corresponding to to-be-sent data, the target to-be-serialized structure variable comprising n sub-structures, each of the n sub-structures comprising one or more member variables, the one or more member variables being of a structure member variable type or a non-structure member variable type, wherein, for a sub-structure i comprising a structure member variable, a sub-structure j corresponding to the structure member variable is a lower-level sub-structure of the sub-structure i, n is a positive integer, and i and j are positive integers less than or equal to n; updating, when data in a first member variable in the target to-be-serialized structure variable is updated, a value of first indication information corresponding to the first member variable in a first mapping table from an initial value to a target value, the first mapping table comprising k indication information, different indication information in the k indication information corresponding to different member variables in the target to-be-serialized structure variable, and a value of each indication information in the k indication information indicating whether data in a corresponding member variable is updated, the initial value indicating that no update occurs, and the target value indicating that an update occurs, k being a positive integer; sending data in the target to-be-serialized structure variable and the first mapping table.

2. The method of claim 1, wherein, The updating of the value of the first indication information in the first mapping table corresponding to the first member variable from the initial value to the target value comprises: if the data in the first member variable is updated without affecting an offset of a starting address in memory of any one of other member variables in the target to-be-serialized structure variable, updating the value of the first indication information from the initial value to a first target value, the first target value indicating that the data in the member variable is updated but does not affect the offset of the starting address in memory of any one of the other member variables in the target to-be-serialized structure variable.

3. The method of claim 1, wherein, The updating of the value of the first indication information in the first mapping table corresponding to the first member variable from the initial value to the target value comprises: if the data in the first member variable is updated to affect the offset of the starting address in memory of any one of the other member variables in the target to-be-serialized structure variable, updating the value of the first indication information from the initial value to a second target value, the second target value indicating that the data in the member variable is updated and affects the offset of the starting address in memory of any one of the other member variables in the target to-be-serialized structure variable.

4. The method according to claim 2 or 3, characterized in that, The updating of the value of the first indication information in the first mapping table corresponding to the first member variable from the initial value to the first target value or the second target value comprises: when the data in the first member variable is updated, calling a stub function, the stub function being configured to update the value of the first indication information in the first mapping table corresponding to the first member variable from the initial value to the first target value or the second target value.

5. The method according to claim 2 or 3, characterized in that, The updating of the value of the first indication information in the first mapping table corresponding to the first member variable from the initial value to the first target value or the second target value comprises: When data in the first member variable is updated, trigger the memory protection unit (MPU) or the memory management unit (MMU) to jump into a preset processing function, and the preset processing function is used to update the value of the first indication information corresponding to the first member variable in the first mapping table from an initial value to a first target value or a second target value.

6. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: When data in the first member variable in the target to-be-serialized structure variable is not updated, the value of the first indication information corresponding to the first member variable in the first mapping table is not updated from the initial value to the target value.

7. The method of claim 6, wherein, The initial value is 0, the first target value is 1, and the second target value is 2.

8. A method of data transmission, characterized by Comprise: receive data in a target to-be-serialized structure variable and a first mapping table, the target to-be-serialized structure variable comprising n sub-structures, each sub-structure comprising one or more member variables, the one or more member variables being of a structure member variable type or a non-structure member variable type, wherein for a sub-structure i comprising a structure member variable, a sub-structure j corresponding to the structure member variable is a lower-level sub-structure of the sub-structure i, the first mapping table comprising k indication information, different indication information in the k indication information corresponding to different member variables in the target to-be-serialized structure variable, the value of each indication information in the k indication information being an initial value or a target value, the initial value indicating that data in the corresponding member variable is not updated, the target value indicating that the data is updated, n being a positive integer, i and j being positive integers less than or equal to n, and k being a positive integer; serialize data in a target non-structure member variable in the target to-be-serialized structure variable corresponding to indication information with the target value in the first mapping table.

9. The method of claim 8, wherein, The target value is a first target value, and the first target value indicates that data in a member variable is updated but does not affect the offset of the starting address in memory corresponding to any one of other member variables in the target to-be-serialized structure variable.

10. The method of claim 9, wherein, serializing data in a target non-structure member variable in the target to-be-serialized structure variable corresponding to indication information with the first target value in the first mapping table, comprising: serializing the data in the target non-structure member variable into a sub-buffer corresponding to the target non-structure member variable in a preset buffer, the preset buffer comprising z sub-buffers, each sub-buffer corresponding to a non-structure member variable in the target to-be-serialized structure variable, and each sub-buffer being used to store data in the corresponding non-structure member variable.

11. The method of claim 8, wherein, The target value is a second target value, and the second target value indicates that data in a member variable is updated and affects the offset of the starting address in memory corresponding to any one of other member variables in the target to-be-serialized structure variable.

12. The method of claim 11, wherein, serializing data in a target non-structure member variable corresponding to indication information in the first mapping table having a value of a second target value in the target structure variable to be serialized, including: serializing the data in the target non-structure member variable into a sub-buffer in a preset buffer corresponding to the target non-structure member variable, and moving data in a sub-buffer corresponding to a second non-structure member variable in the preset buffer to a target buffer, the second non-structure member variable having a value of the initial value in indication information in the first mapping table, and the sub-buffer corresponding to the second non-structure member variable in the preset buffer being located after the sub-buffer corresponding to the target non-structure member variable in the preset buffer, the preset buffer including z sub-buffers, each sub-buffer corresponding to a non-structure member variable in the target structure variable to be serialized, each sub-buffer being used to store data in the corresponding non-structure member variable, the target buffer being located after the sub-buffer corresponding to the target non-structure member variable.

13. The method according to claim 10 or 12, characterized in that, The target structure variable to be serialized is one of p structure variables to be serialized, and the buffer used when the p structure variables to be serialized are serialized is the preset buffer.

14. The method of claim 13, wherein, serializing data in a target non-structure member variable corresponding to indication information in the first mapping table having a value of a second target value in the target structure variable to be serialized, including: If the target structure variable to be serialized is a structure variable to be serialized with the highest transmission frequency among the p structure variables to be serialized, the data in the target non-structure member variable is re-serialized into the preset buffer.

15. The method of any one of claims 8-10, wherein, The initial value is 0, and the first target value is 1.

16. The method of any one of claims 11-12, wherein, The initial value is 0, and the second target value is 2.

17. An apparatus for data transmission, the apparatus comprising: A module for performing the method of any one of claims 1 to 7 or the method of any one of claims 8 to 16.

18. A terminal device, comprising: An apparatus for data transmission according to claim 17.

19. A computer-readable storage medium, characterized in that, The computer-readable medium stores instructions for a computer to execute, when the instructions are executed, causing the method of any one of claims 1 to 7 or the method of any one of claims 8 to 16 to be executed.

20. A computer program product, comprising therein computer program instructions, characterized in that, The computer program instructions, when running on a computer, cause the computer to execute the method of any one of claims 1 to 7 or the method of any one of claims 8 to 16.

Citation Information

Patent Citations

  • Data increment updating method and device based on data model layer and computer equipment

    CN112416957A

  • Information processing device, method, and program

    WO2020158347A1