Data transmission method and device
By pre-storing the message data encapsulated by static data and dynamic data in the storage area and sending it at intervals, the complexity and inefficiency problems caused by real-time construction and encapsulation in traditional data transmission methods are solved, and efficient dynamic structure data transmission is achieved.
Patent Information
- Application Number
- CN202511001264.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-10-10
AI Technical Summary
Traditional data transmission methods require real-time construction and packaging when processing dynamic structured data, which increases system complexity and processing time and is inefficient.
By pre-storing the message data encapsulated by static data and dynamic data in multiple storage areas and sending them at preset time intervals, the complex process of real-time construction and encapsulation of dynamic structure data is avoided.
It greatly reduces the time and complexity of real-time processing, improves the transmission efficiency of dynamic structure data, and meets diverse data transmission needs.
Smart Images

Figure CN120768893A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data transmission method and device. Background Art
[0002] With the rapid development of information technology, the demand for data transmission is becoming increasingly diversified, especially in the fields of industrial automation, Internet of Things, cloud computing, etc., the application of dynamic structured data is becoming more and more extensive.
[0003] However, traditional data transmission methods often require real-time data construction and packaging at the sending end when processing this dynamically structured data, increasing system complexity and processing time. This is particularly true in application scenarios where different dynamically structured data must be frequently sent. The complexity and time-consuming process of constructing and packaging dynamic data structures in real time leads to low data transmission efficiency.
[0004] Therefore, the existing technology has the problem of low transmission efficiency of dynamic structure data. Summary of the Invention
[0005] The embodiments of the present application provide a data transmission method and device, which can avoid the complex process of real-time construction and encapsulation of dynamic structure data, greatly reduce the time and complexity of real-time processing, and improve the transmission efficiency of dynamic structure data.
[0006] In a first aspect, an embodiment of the present application provides a data transmission method, applied to a data sending device, the method comprising:
[0007] In response to the data sending request, obtaining target static data corresponding to the static variable in the data sending request;
[0008] Determining, among a plurality of preset storage areas, a target storage area corresponding to target static data according to a preset correspondence between static data and storage areas, wherein the target storage area stores at least one target message data, the target message data being obtained by encapsulating target static data corresponding to static variables and target dynamic data corresponding to dynamic variables;
[0009] According to the preset sending time interval, the target message data is read from the target storage area and sent.
[0010] Based on the same inventive concept, in a second aspect, an embodiment of the present application further provides a data transmission method, applied to a data receiving device, the method comprising:
[0011] Upon receiving target message data, the target message data is split into target static data and target dynamic data according to information of a preset static variable structure, wherein the target message data is target static data corresponding to the static variable in the data sending request obtained by the data sending device in response to the data sending request; a target storage area corresponding to the target static data is determined among a plurality of preset storage areas according to a preset correspondence between static data and storage areas, wherein at least one target message data is stored in the target storage area, and the target message data is obtained by encapsulating the target static data corresponding to the static variable and the target dynamic data corresponding to the dynamic variable; and the target message data are read one by one from the target storage area and sent according to a preset sending time interval;
[0012] In the preset correspondence between static data and dynamic variable structures, information of a target dynamic variable structure corresponding to the target static data is obtained;
[0013] Based on the information of the target dynamic variable structure, the target dynamic data is split to obtain at least one first target dynamic data and at least one second target dynamic data, wherein the first target dynamic data is data corresponding to the first sub-dynamic variable of the first level, and the second target dynamic data is data corresponding to the second sub-dynamic variable of the first level, the first sub-dynamic variable is a nested type variable, and the second sub-dynamic variable is a non-nested type variable;
[0014] The third page displays information about the first target dynamic data and information about the second target dynamic data.
[0015] Based on the same inventive concept, in a third aspect, an embodiment of the present application further provides a data transmission device, which is applied to a data sending device. The device includes:
[0016] An acquisition module, configured to acquire, in response to a data sending request, target static data corresponding to a static variable in the data sending request;
[0017] a determination module, configured to determine, from a plurality of preset storage areas, a target storage area corresponding to target static data based on a preset correspondence between static data and storage areas, wherein the target storage area stores at least one target message data, the target message data being obtained by encapsulating target static data corresponding to static variables and target dynamic data corresponding to dynamic variables;
[0018] The sending module is used to read the target message data from the target storage area and send them according to the preset sending time interval.
[0019] Based on the same inventive concept, in a fourth aspect, an embodiment of the present application further provides a data transmission device, which is applied to a data receiving device. The device includes:
[0020] A splitting module is configured to, upon receiving target message data, split the target message data into target static data and target dynamic data according to information of a preset static variable structure, wherein the target message data is target static data corresponding to static variables in a data sending request obtained by a data sending device in response to a data sending request; determine, among a plurality of preset storage areas, a target storage area corresponding to the target static data according to a preset correspondence between static data and storage areas, wherein at least one target message data is stored in the target storage area, and the target message data is obtained by encapsulating the target static data corresponding to the static variable and the target dynamic data corresponding to the dynamic variable; and read the target message data one by one from the target storage area and send them according to a preset sending time interval;
[0021] An acquisition module, configured to acquire information of a target dynamic variable structure corresponding to target static data in a preset correspondence relationship between static data and dynamic variable structures;
[0022] The splitting module is further used to split the target dynamic data based on the information of the target dynamic variable structure to obtain the first target dynamic data and the second target dynamic data;
[0023] The display module is configured to display information about the first target dynamic data and information about the second target dynamic data on a third page.
[0024] The data transmission method and device provided by the embodiments of the present application, the method is applied to a data sending device, and the data sending device can acquire target static data corresponding to a static variable in a data sending request in the case that the data sending request is received. The target static data is a static data specified by a user in a plurality of static data corresponding to the static variable. Then, in a plurality of storage areas set in advance, a target storage area corresponding to the target static data is determined according to a preset correspondence relationship between the static data and the storage area, and at least one target message data is pre-stored in the target storage area. Since the target message data is obtained by encapsulating the target static data and target dynamic data corresponding to a dynamic variable, that is, the message data encapsulated based on the static data and the dynamic data can be pre-stored in the storage area, and the message data in different storage areas can cover dynamic data of different structures, that is, different dynamic structure data is pre-stored in different storage areas, thereby meeting diversified data transmission requirements and being capable of flexibly adapting to the sending requirements of various dynamic structure data. Therefore, different storage areas can store message data encapsulated based on dynamic data of different structures. Then, every preset sending time interval, a target message data is read from the target storage area and sent out. Therefore, in the data transmission process, the device does not need to construct and encapsulate data in real time, but directly reads the pre-encapsulated message data from the target storage area for sending, avoids the complex process of constructing and encapsulating dynamic structure data in real time, greatly reduces the real-time processing time and complexity, and improves the transmission efficiency of the dynamic structure data. BRIEF DESCRIPTION OF DRAWINGS
[0025] Other features, objects, and advantages of the present application will become more apparent from the following detailed description of non-limiting embodiments thereof as taken in conjunction with the accompanying drawings, in which like references denote like features, and in which:
[0026] Figure 1 is a flowchart of the data transmission method provided by the embodiments of the present application;
[0027] Figure 2 is another flowchart of the data transmission method provided by the embodiments of the present application;
[0028] Figure 3 is another flowchart of the data transmission method provided by the embodiments of the present application;
[0029] Figure 4 is another flowchart of the data transmission method provided by the embodiments of the present application;
[0030] Figure 5 is another flowchart of the data transmission method provided by the embodiments of the present application;
[0031] Figure 6 This is another flow chart of the data transmission method provided in the embodiment of the present application;
[0032] Figure 7 This is a data structure diagram of dynamic structure data in the data transmission method provided in the embodiment of the present application;
[0033] Figure 8 This is another data structure diagram of dynamic structure data in the data transmission method provided in the embodiment of the present application;
[0034] Figure 9 This is another flow chart of the data transmission method provided in the embodiment of the present application;
[0035] Figure 10 This is a structural diagram of a data transmission device provided in an embodiment of the present application;
[0036] Figure 11 This is another structural diagram of the data transmission device provided in an embodiment of the present application;
[0037] Figure 12 This is a structural diagram of a data transmission device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only configured to explain the present application and are not configured to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present application by illustrating the examples of the present application.
[0039] It should be noted that the relative terms, such as first and second, and the like are used herein only to distinguish one entity or operation from another, and do not necessarily require or imply any actual such relationship or order between or among these entities or operations. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by an "includes" statement does not exclude the existence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0040] It should be understood that the term "and / or" used herein only describes an association relationship of associated objects, which means that there can be three relationships, for example, A and / or B can represent the three cases of A alone, A and B together, and B alone. In addition, the character " / " herein generally represents an "or" relationship between the front and rear associated objects.
[0041] Various modifications and changes can be made to the present application without departing from the spirit or scope of the application. It is therefore intended that the present application cover all modifications and changes as fall within the scope of the corresponding claims (claimed technical solutions) and their equivalents. It should be noted that the embodiments provided by the present application can be combined with each other without contradiction.
[0042] Before describing the technical solutions provided by the embodiments of the present application, in order to facilitate the understanding of the embodiments of the present application, the present application first specifically describes the problems existing in the related art:
[0043] With the rapid development of information technology, the demand for data transmission is increasingly diversified, especially in the fields of industrial automation, Internet of Things, cloud computing, etc. The application of dynamic structure data is becoming more and more widespread.
[0044] However, the data transmission method in the related art often needs real-time data construction and encapsulation at the sending end when processing these dynamic structure data, which increases the complexity and processing time of the system. Especially in application scenarios that need to frequently send different dynamic structure data, the process of real-time construction and encapsulation of dynamic data structure is complex and time-consuming, thus leading to low data transmission efficiency. Therefore, the related art has the problem of low transmission efficiency of dynamic structure data.
[0045] Based on this, the embodiments of the present application provide a data transmission method and device that can avoid the complex process of real-time construction and encapsulation of dynamic structure data, greatly reducing the time and complexity of real-time processing, and improving the transmission efficiency of dynamic structure data.
[0046] The data transmission method provided in the embodiments of the present application is described in detail below with reference to the accompanying drawings.
[0047] Figure 1 This is a flow chart of a data transmission method provided by an embodiment of the present application. Figure 1 As shown, the method may include steps S110 to S170.
[0048] S110 , the data sending device obtains target static data corresponding to the static variable in the data sending request in response to the data sending request.
[0049] The data sending request is a request input by a user to send dynamic structure data, and includes target static data corresponding to static variables.
[0050] The dynamic structure data includes a structure-unchanged part and a structure-changing part. The structure-unchanged part includes static data corresponding to static variables, and the structure-changing part includes dynamic data corresponding to dynamic variables.
[0051] Specifically, when the data sending device receives a data sending request from a user, the target static data corresponding to the static variable input by the user is obtained.
[0052] For example, different static data may correspond to dynamic data of different structures, so the user may input target static data according to actual needs to generate dynamic data of a specific structure corresponding to the target static data.
[0053] S120, the data sending device determines, in a plurality of preset storage areas, a target storage area corresponding to the target static data according to a correspondence between preset static data and storage areas, wherein at least one target message data is stored in the target storage area, and the target message data is obtained by encapsulating the target static data corresponding to the static variables and the target dynamic data corresponding to the dynamic variables.
[0054] The storage area stores multiple message data with the same structure. Each message data is a byte array formed by pre-encapsulating static data corresponding to static variables and dynamic data corresponding to dynamic variables. The dynamic data contained in the message data stored in the same storage area has the same structure, while the dynamic data contained in the message data stored in different storage areas has different structures.
[0055] The preset correspondence between static data and storage areas is the correspondence between all possible values of static variables (all static data) generated in advance and multiple storage areas, that is, there is a one-to-one correspondence between the static data of static variables and storage areas.
[0056] Specifically, the data sending device can locate the target storage area storing the target message data in multiple preset storage areas based on the correspondence between the preset static data and the storage area. The target message data has a specific data structure corresponding to the target static data. The target message data is obtained by encapsulating the "target static data" corresponding to the static variable and the "target dynamic data having a specific structure corresponding to the target static data" corresponding to the dynamic variable.
[0057] S130: The data sending device reads and sends target message data from the target storage area according to a preset sending time interval.
[0058] Among them, the preset sending time interval can be set according to user needs, and this is not limited in the embodiments of the present application.
[0059] Specifically, after the data sending device finds the target buffer corresponding to the target static data, it can read the target message data one by one from the target storage area and send them out according to the preset sending time interval.
[0060] S140 , when receiving the target message data, the data receiving device splits the target message data into target static data and target dynamic data according to the preset static variable structure information.
[0061] The information of the preset static variable structure may include the position information of the static variable in the message data and the length information of the static variable. For example, the first byte of the message data is the static data corresponding to the static variable.
[0062] Specifically, when receiving the target message data, the data receiving device can extract the target static data and the target dynamic data from the target message data according to the preset static variable structure information. For example, the first byte of the target message data is the target static data, and the remaining bytes are the target dynamic data.
[0063] S150: The data receiving device obtains information of a target dynamic variable structure corresponding to target static data in a preset correspondence between static data and dynamic variable structures.
[0064] The preset correspondence between static data and dynamic variable structures refers to a one-to-one correspondence between the static data and the dynamic variable structure. Similarly, since the preset correspondence between static data and storage areas refers to a one-to-one correspondence between static data and storage areas, the static data and the dynamic variable structure also have a one-to-one correspondence. In other words, there is a one-to-one correspondence between the static data, dynamic variable structure, and storage area.
[0065] Specifically, the data receiving device may obtain information of a specific structure corresponding to the target static data, that is, information of the target dynamic variable structure, from a preset correspondence between static data and dynamic variable structures.
[0066] S160. The data receiving device splits the target dynamic data based on the information of the target dynamic variable structure to obtain at least one first target dynamic data and at least one second target dynamic data, wherein the first target dynamic data is the data corresponding to the first sub-dynamic variable of the first level, and the second target dynamic data is the data corresponding to the second sub-dynamic variable of the first level, the first sub-dynamic variable is a nested type variable, and the second sub-dynamic variable is a non-nested type variable.
[0067] Among them, the data corresponding to the nested type variable of the first level (first sub-dynamic variable) can be called the first target dynamic data, and the data corresponding to the non-nested type variable of the first level (second sub-dynamic variable) can be called the second target dynamic data.
[0068] Specifically, after the data receiving device splits the target message data into target static variables and target dynamic variables, it can further split the target dynamic variables. When splitting the target dynamic variables, it can only split them into multiple first-level data, that is, into multiple "first target dynamic data corresponding to the first-level nested type variables (first sub-dynamic variables)" and multiple "second target dynamic data corresponding to the first-level non-nested type variables (second sub-dynamic variables)."
[0069] S170: The data receiving device displays information about the first target dynamic data and information about the second target dynamic data on a third page.
[0070] Specifically, after receiving the message data, the data receiving device may only disassemble the data of the first layer, and display the information of the first target dynamic data and the information of the second target dynamic data obtained by disassembly to the user for viewing.
[0071] According to the data transmission method provided by the embodiment of the present application, the data sending device can obtain the target static data corresponding to the static variable in the data sending request when receiving the data sending request, the target static data being one static data specified by the user from the plurality of static data corresponding to the static variable. Then, the data sending device determines the target storage area corresponding to the target static data from the plurality of preset storage areas according to the preset correspondence between the static data and the storage area, the target storage area having at least one target message data stored in advance, and since the target message data is obtained by encapsulating the target static data and the target dynamic data corresponding to the dynamic variable, that is, the message data based on the encapsulation of the static data and the dynamic data can be stored in the storage area in advance, the message data in different storage areas can cover dynamic data of different structures, that is, different dynamic structure data is stored in different storage areas in advance, thereby meeting the diversified data transmission requirements and flexibly adapting to the sending requirements of various dynamic structure data. Therefore, different storage areas can store message data encapsulated based on dynamic data of different structures. Then, every preset sending time interval, a target message data is read from the target storage area and sent out, so that in the data transmission process, the data sending device does not need to construct and encapsulate the data in real time, but directly reads the pre-encapsulated message data from the target storage area for sending, avoiding the complex process of real-time construction and encapsulation of dynamic structure data, greatly reducing the real-time processing time and complexity, and improving the transmission efficiency of dynamic structure data. Next, the data receiving device can obtain the information of the specific structure corresponding to the target static data, that is, the information of the target dynamic variable structure, in the preset correspondence between the static data and the dynamic variable structure, and based on the information, the target message data can be split into the target static variable and the target dynamic variable, and the target dynamic variable can be further split, and when the target dynamic variable is split, it can be split into a plurality of first-level data, that is, a plurality of "first target dynamic data corresponding to the first-level nested type variable (first sub-dynamic variable)" and a plurality of "second target dynamic data corresponding to the first-level non-nested type variable (second sub-dynamic variable)", and displayed in the third page. For example, the first-level nested type variable (first sub-dynamic variable) includes a structure type variable Struct1, and after the data receiving device receives the message data, only the first-level data is split, the data corresponding to the structure type variable Struct1 is not split, and the data corresponding to the structure type variable Struct1 is directly displayed as a whole in the third page, and when the data is used, the second-level split is performed, and so on, and the split of all data is not completed at the beginning of receiving the data, thereby reducing the pressure of data unpacking.
[0072] The following will be described in combination with Figure 2This section describes the process of generating the correspondence between preset static data and storage areas.
[0073] Figure 2 This is another flow chart of the data transmission method provided in the embodiment of the present application.
[0074] In some embodiments, as Figure 2 As shown, before the data sending device determines the target storage area corresponding to the target static data in a plurality of preset storage areas according to the preset correspondence between static data and storage areas in step S120, the data transmission method may further include steps S181 and S182.
[0075] S181: The data sending device obtains each static data corresponding to the static variable and establishes multiple storage areas, wherein the storage areas correspond to the static data one by one.
[0076] Specifically, the data sending device can obtain each static data corresponding to the user-defined static variable and establish a storage area corresponding to the static data. For example, if there are 10 static data corresponding to the static variable, 10 storage areas can be created, and each static data can correspond to one storage area.
[0077] S182: The data sending device generates a preset correspondence between the static data and the storage areas based on the static data and the multiple storage areas.
[0078] Specifically, after creating the storage area, the data sending device may generate a preset correspondence between the static data and the storage area based on each static data and the multiple storage areas.
[0079] The embodiment of the present application obtains all possible values of static variables (various static data), establishes storage areas, and generates a correspondence between preset static data and storage areas. It can provide an independent storage area for dynamic structure data of each structure, so that message data of different structures can be stored in the corresponding buffer in advance, and then the corresponding target buffer can be quickly found according to the target static data input by the user, and the message data can be taken from the target buffer and sent, avoiding the complex process of real-time construction and encapsulation of dynamic structure data, greatly reducing the time and complexity of real-time processing, and improving the transmission efficiency of dynamic structure data.
[0080] The following combination Figures 3-5 This section describes the specific process of storing message data of different structures in different storage areas.
[0081] Figure 3 This is another flow chart of the data transmission method provided in the embodiment of the present application.
[0082] In some embodiments, as Figure 3As shown, the data transmission method can further include steps S191-S195.
[0083] S191, the data sending device displays a first page, and in response to a first input in the first page, obtains a preset correspondence between static data and variable structure in the first input.
[0084] Specifically, the user can input the correspondence between the preset static data and the variable structure in the first page.
[0085] In one example, the user can input the correspondence between the preset static data and the variable structure in the first page, as shown in Table 1, the static data corresponding to the static variable is 1, 2, 3,..., and different static data corresponds to different variable structure.
[0086] Table 1
[0087]
[0088]
[0089] S192, the data sending device obtains information of a first variable structure corresponding to a first static data in the preset correspondence between the static data and the variable structure, wherein the first static data is any one of the static data.
[0090] The first static data can be any one of the static data. That is, steps S192-S195 can be performed on any one static data to generate packet data of a specific structure corresponding to each static data and store it in a designated storage area.
[0091] Specifically, after the user defines the correspondence between the static data and the variable structure, the data sending device can establish a plurality of buffer areas, and the plurality of buffer areas have a one-to-one correspondence with each static data defined by the user, at this time, different structure data can be stored in the storage area. First, the information of the first variable structure corresponding to the first static data can be obtained in the correspondence between the static data and the variable structure input by the user, to guide the data sending device to generate which structure data.
[0092] S193, the data sending device constructs at least one first dynamic data corresponding to the dynamic variable according to the information of the first variable structure.
[0093] The dynamic data constructed according to the first variable structure can be referred to as first dynamic data.
[0094] Specifically, the data sending device may construct a plurality of first dynamic data corresponding to the dynamic variable according to the information of the first variable structure, and the plurality of first dynamic data have the same first variable structure.
[0095] S194: The data sending device encapsulates the first static data and the first dynamic data respectively based on the information of the first variable structure to obtain at least one first message data.
[0096] Specifically, the first static data and the first dynamic data may be concatenated according to the first variable structure to obtain message data, which may be referred to as first message data.
[0097] S195: The data sending device stores at least one first message data in a first storage area, where the first storage area is a storage area corresponding to the first static data in a preset correspondence relationship between static data and storage areas.
[0098] Specifically, a storage area corresponding to the first static data may be obtained from a preset correspondence between static data and storage areas. The storage area may be referred to as a first storage area. The first message data may then be stored in the first storage area.
[0099] The embodiments of the present application can flexibly handle diverse message data construction requirements. Through user-defined correspondence between static data and variable structures, the data sending device can automatically generate message data of a specific structure and accurately store it in a designated storage area. Then, when the user makes a data sending request, the target message data is directly read from the designated target storage area according to the target static data in the data sending request and sent out, avoiding the complex process of real-time construction and encapsulation of dynamic structure data and improving the efficiency of data transmission.
[0100] Figure 4 This is another flow chart of the data transmission method provided in the embodiment of the present application.
[0101] In some embodiments, as Figure 4 As shown, in step S193, the data sending device constructs at least one first dynamic data corresponding to the dynamic variable according to the information of the first variable structure, which may include steps S1931 to S1933.
[0102] S1931: The data sending device displays the second page.
[0103] Specifically, when constructing the first dynamic data, the total duration and time interval for constructing the first dynamic data can be defined by the user. First, the second page is displayed, and the user enters the total duration and time interval for constructing the first dynamic data. The total duration can be called the excitation duration, and the time interval can be called the excitation time interval.
[0104] S1932: The data sending device obtains information about the excitation duration and the excitation time interval in response to the second input in the second page.
[0105] Specifically, the user may input information about the incentive duration and the incentive time interval in the second page.
[0106] For example, you can use a stimulus template to generate data. When the static data corresponding to a static variable is 1, the stimulus duration is 5 seconds; when the static data corresponding to the static variable is 2, the stimulus duration is 3 seconds; and when the static data corresponding to the static variable is 3, the stimulus duration is 10 seconds. The stimulus interval can be set to 10ms. The stimulus template can be run and will continue to send data at the stimulus interval for the duration of the stimulus duration until you click Stop.
[0107] S1933: The data sending device constructs first dynamic data corresponding to the dynamic variable according to the information of the first variable structure within the excitation duration and with the excitation time interval as a period, and obtains at least one first dynamic data.
[0108] Specifically, after the user customizes the information of the excitation duration and the excitation time interval, the data sending device can use the excitation duration as the total duration to construct the first dynamic data corresponding to the dynamic variable according to the information of the first variable structure every excitation time interval, thereby obtaining a preset number of first dynamic data, which is equal to the excitation duration divided by the excitation time interval.
[0109] The embodiment of the present application allows the user to customize the total duration and time interval of the dynamic data construction, so that the data sending device can periodically generate first dynamic data that conforms to the first variable structure based on these parameters, thereby improving the flexibility and customization of data transmission, and ensuring that the generated dynamic data not only meets specific structural requirements, but also meets the user's needs for data generation frequency and total amount.
[0110] Figure 5 This is another flow chart of the data transmission method provided in the embodiment of the present application.
[0111] In some embodiments, as Figure 5 As shown, the variable structure information includes static variable structure information and dynamic variable structure information. Step S194, based on the first variable structure information, the data sending device encapsulates the first static data and the first dynamic data to obtain at least one first message data, which may include steps S1941 to S1943.
[0112] S1941: The data sending device converts first static data into a first byte array based on the static variable structure information in the first variable structure information.
[0113] The information of the static variable structure may include information such as the location, length, and type of the static variable. The type information may include nested types and non-nested types.
[0114] The information of the dynamic variable structure may include information such as the location, length, and type of the dynamic variable.
[0115] Specifically, the data may be packaged into a byte array for storage. The static data may be first converted into a byte array, which may be referred to as a first byte array.
[0116] S1942: The data sending device converts at least one first dynamic data into a second byte array based on the information of the dynamic variable structure in the information of the first variable structure.
[0117] Specifically, the dynamic data may be converted into a byte array, which may be referred to as a second byte array.
[0118] S1943: The data sending device combines the first byte array with the second byte array to obtain at least one third byte array, where the third byte array is the first message data.
[0119] Specifically, the first byte array and the second byte array can be combined to obtain a third byte array, and the third byte array is the first message data. In this cycle, multiple first message data can be generated and stored in the first storage area.
[0120] The embodiment of the present application can efficiently generate message data by converting static data and dynamic data into byte arrays respectively and encapsulating and combining them.
[0121] Figure 6 This is another flow chart of the data transmission method provided in the embodiment of the present application.
[0122] In some embodiments, as Figure 6 As shown, the target dynamic variable structure information includes the location information, length information, and type information of the N first-level sub-dynamic variables nested in the dynamic variable. Step S160, in which the data receiving device splits the target dynamic data based on the target dynamic variable structure information to obtain at least one first target dynamic data and at least one second target dynamic data, may include steps S161 and S162.
[0123] S161 , the data receiving device classifies N first-level sub-dynamic variables according to type information to obtain first sub-dynamic variables and second sub-dynamic variables.
[0124] The information of the dynamic variable structure includes the position information, length information and type information of the N first-level sub-dynamic variables nested in the dynamic variable.
[0125] For example, Figure 7 As shown, the static variable is an enumeration variable, and the dynamic variable is a union variable. When the enumeration variable is 1, the structure variable 1 in the union variable takes effect. At this time, the N first-level sub-dynamic variables include double-precision variables and label variables. When the enumeration variable is 2, the structure variable 2 in the union variable takes effect. When the enumeration variable is 3, the structure variable 3 in the union variable takes effect.
[0126] For example, Figure 8 As shown, the static variables are enumeration variables, and the dynamic variables are union variables. When the enumeration variable is 1, structure variable 1 in union variable 1 takes effect, and structure variable 4 in union variable 2 takes effect. At this point, the N first-level sub-dynamic variables include double-precision variables, label variables, and structure variable 4. When the enumeration variable is 2, structure variable 1 in union variable 1 takes effect, and structure variable 5 in union variable 2 takes effect. And so on.
[0127] Specifically, the data receiving device classifies the N first-level sub-dynamic variables according to the type information to obtain the first sub-dynamic variable and the second sub-dynamic variable.
[0128] S162: The data receiving device splits the target dynamic data according to the position information and length information of the first sub-dynamic variable and the position information and length information of the second sub-dynamic variable to obtain first target dynamic data corresponding to the first sub-dynamic variable and second target dynamic data corresponding to the second sub-dynamic variable.
[0129] Specifically, after splitting the message data into static data and dynamic data, you can continue to split the dynamic data, using the first-level sub-dynamic variable as the minimum splitting unit, to split the dynamic data into data corresponding to N first-level sub-dynamic variables. If the first-level sub-dynamic variable is a nested type variable, do not split it further and further split it according to subsequent user needs.
[0130] The data receiving device of the embodiment of the present application can efficiently and accurately classify and split the target dynamic data based on the detailed information (including position, length and type) in the dynamic variable structure, thereby obtaining the first target dynamic data and the second target dynamic data. It can flexibly adapt to the changes in the dynamic data structure under different static variable states, ensure that the data is correctly parsed and processed, and support delayed splitting of nested type variables to meet the specific needs of users, thereby improving the flexibility and processing efficiency of data transmission.
[0131] Figure 9 This is another flow chart of the data transmission method provided in the embodiment of the present application.
[0132] In some embodiments, as Figure 9 As shown, the target dynamic variable structure information also includes the structure information of each variable nested in the first sub-dynamic variable. The data transmission method may further include steps S210 and S220.
[0133] S210 , in response to the third input in the third page, the data receiving device splits the first target dynamic data based on the structural information of each variable nested in the first sub-dynamic variable to obtain a plurality of third target dynamic data.
[0134] Specifically, when the user views the split first layer of data on the page, if there is a need for further splitting, for example, there is a structure variable in the first layer of variables, the user can only see the overall data of the structure variable during the initial display. When the user wants to view the data corresponding to each variable in the structure variable, he can enter the viewing requirements in the third page. At this time, the data receiving device will further split the structure variable.
[0135] S220: The data receiving device displays the third target dynamic data on the third page.
[0136] Specifically, the data receiving device may display the structure variables of the first layer on a page after splitting them.
[0137] In the embodiment of the present application, by including the structural information of each variable nested in the first sub-dynamic variable, the data receiving device can respond to the user's further splitting requirements in the third page, perform more detailed splitting of the first target dynamic data, obtain multiple third target dynamic data, and display them on the page, thereby enhancing the user's ability to view and understand the data, and improving the flexibility of data transmission and processing and user experience.
[0138] In one embodiment, the data transmission method may include:
[0139] 1) Design dynamic data structure, please refer to Figure 7 orFigure 8 .
[0140] Firstly, define the data transmitted in the network as a message, and the message is a dynamic data structure. Define the smallest designable structure in the design message as a domain (or called variable). According to the use of the message, the following domains are defined: label domain (label variable), Boolean domain (Boolean variable), enumeration domain (enumeration variable), integer domain (integer variable), double precision domain (double precision variable), structure body domain (structure body variable), and union body domain (union body variable). The first five domains are basic domain structures, and the last two types are data combination structures. The dynamic data structure is composed of the above several domains, and the instruction data (corresponding to the data of static variables) can be defined by the label domain, the Boolean domain, the enumeration domain, and the dynamic data (corresponding to the data of dynamic variables) can be defined by any of the above domains.
[0141] It should be noted that the structure body domain can be formed by combining the label domain, the Boolean domain, the enumeration domain, the integer domain, and the double precision domain, and is mainly used in the dynamic data structure to represent different data structures corresponding to different instruction data values.
[0142] It should also be noted that the union body domain can be composed of multiple structure body domains, and a complete dynamic data structure is composed of instruction data and dynamic structure data, for example: an enumeration domain + union body domain can completely define a dynamic data structure.
[0143] 2) Data pre-storage
[0144] Firstly, design the data sending thread and the data receiving thread, and the two threads run independently, and the threads can be actively started and closed by the user.
[0145] Then, design an excitation template on the data sending device, and design the instruction data in the dynamic data structure according to the actual scene, the available values, and the excitation time of the values in advance. The excitation template can generate data according to the data structure. Then the generated data of different structures can be stored in the storage area, and can be directly taken when needed. By pre-packaging and caching each structure, the time problem can be solved by using space. The storage area can be a cache area.
[0146] 3) Data transmission
[0147] After the thread is started, data is retrieved from the cached storage area and sent according to the preset sending cycle sequence. The receiving thread of each dynamic data structure is relatively independent. When receiving data (binary stream data transmitted back from the network, that is, byte array), only the first-level data structure is parsed. The deeper structure is parsed again when it is viewed in detail (when triggered by the user on the software interface). This saves performance and the workload of deep data parsing, which is then distributed to subsequent operations. The first-level data structure includes label fields, Boolean fields, enumeration fields, integer fields, and double-precision fields. The deeper structure can include structure fields and union fields.
[0148] Finally, since the threads for sending and receiving data are independent and do not affect each other, users can open multiple threads as needed to meet real-time requirements.
[0149] The embodiments of the present application can flexibly adapt to the data structure requirements corresponding to different static data values by designing a dynamic data structure; the data pre-storage strategy allows data to be prepared and cached in advance, using space in exchange for time efficiency; and the independent data sending and receiving threads and layered parsing strategy ensure the high efficiency and real-time performance of data transmission, while reducing the system burden and optimizing performance.
[0150] In one example, the packing algorithm uses the Javolution algorithm to perform the packing operation, and the byte array obtained after packing is stored in the storage area for subsequent use.
[0151] It's important to note that the Javolution algorithm works by encapsulating the values set for each element in a data structure according to a fixed data structure (which specifies the position and length of each value within the data structure), ultimately yielding a byte array whose length matches the length of the data structure. The unpacking process is the opposite: first, a byte array is taken, and then, based on the position and length of each element in the data structure, the specific value of the element is parsed from the byte array and assigned to the element, achieving unpacking.
[0152] The Javolution algorithm is used to unpack the first layer of data. The unpacking algorithm for the union domain requires a separate design. The first-level parsing result is a byte array displayed on the page, without specifying the values of each subfield. When the user accesses the data, the second level of parsing is performed, and so on. Parsing of all data is not completed upon initial access. By designing appropriate interactive methods within the software interface, user needs are met and the aforementioned unpacking algorithm is addressed. Furthermore, to enhance user usability, filtering of command data is implemented, allowing users to view individual messages in a targeted manner, thereby reducing the burden of data unpacking.
[0153] The embodiment of the present application adopts the Javolution algorithm for packing and unpacking, which can efficiently convert the data structure into a byte array and store it. At the same time, it parses the data in layers according to user needs, reduces the unpacking pressure, and improves the user usability through the interactive design of the software interface, supporting targeted viewing of messages.
[0154] Based on the same inventive concept, the embodiment of the present application also provides a data transmission device, which is applied to a data sending device, such as Figure 10 As shown, the apparatus 1000 may include an acquisition module 1010, a determination module 1020, and a sending module 1030:
[0155] An acquisition module 1010 is configured to acquire, in response to a data transmission request, target static data corresponding to a static variable in the data transmission request;
[0156] a determination module 1020 configured to determine, from a plurality of preset storage areas, a target storage area corresponding to target static data based on a preset correspondence between static data and storage areas, wherein the target storage area stores at least one target message data, the target message data being obtained by encapsulating target static data corresponding to static variables and target dynamic data corresponding to dynamic variables;
[0157] The sending module 1030 is configured to read and send target message data from the target storage area according to a preset sending time interval.
[0158] The data transmission device provided in the embodiment of the present application is applied to a data sending device. The data sending device can obtain the target static data corresponding to the static variable in the data sending request when receiving a data sending request. The target static data is a static data specified by the user among the multiple static data corresponding to the static variable. Then, in multiple pre-set storage areas, according to the correspondence between the preset static data and the storage area, the target storage area corresponding to the target static data is determined. At least one target message data is pre-stored in the target storage area, and since the target message data is obtained by encapsulating the target static data and the target dynamic data corresponding to the dynamic variable, that is, the storage area can pre-store message data obtained by encapsulating static data and dynamic data. The message data in different storage areas can cover dynamic data of different structures, that is, different dynamic structure data is pre-stored in different storage areas, thereby meeting the diverse data transmission needs and being able to flexibly adapt to the transmission needs of various dynamic structure data. Therefore, different storage areas can store message data obtained by encapsulating dynamic data of different structures. Then, every preset sending time interval, a target message data is read from the target storage area and sent out. Therefore, during the data transmission process, the device no longer needs to perform real-time data construction and encapsulation, but directly reads the pre-encapsulated message data from the target storage area for transmission, avoiding the complex process of real-time construction and encapsulation of dynamic structure data, greatly reducing the time and complexity of real-time processing, and improving the transmission efficiency of dynamic structure data.
[0159] Each module in the data transmission device provided in the embodiment of the present application can realize Figures 1-5 The functions of each step of the provided data transmission method and its ability to achieve corresponding technical effects are described briefly and will not be elaborated here.
[0160] Based on the same inventive concept, the embodiment of the present application also provides a data transmission device, which is applied to a data receiving device, such as Figure 11 As shown, the apparatus 1100 may include a splitting module 1110, an acquiring module 1120, and a displaying module 1130:
[0161] The splitting module 1110 is configured to, upon receiving target message data, split the target message data into target static data and target dynamic data according to information of a preset static variable structure, wherein the target message data is target static data corresponding to static variables in a data transmission request obtained by a data transmitting device in response to a data transmission request; determine, from a plurality of preset storage areas, a target storage area corresponding to the target static data according to a preset correspondence between static data and storage areas, wherein at least one target message data is stored in the target storage area, and the target message data is obtained by encapsulating the target static data corresponding to the static variable and the target dynamic data corresponding to the dynamic variable; and read the target message data one by one from the target storage area and send them according to a preset sending time interval;
[0162] An acquisition module 1120 is configured to acquire information of a target dynamic variable structure corresponding to target static data in a preset correspondence relationship between static data and dynamic variable structures;
[0163] The splitting module 1110 is further configured to split the target dynamic data based on the target dynamic variable structure information to obtain first target dynamic data and second target dynamic data;
[0164] The display module 1130 is configured to display information about the first target dynamic data and information about the second target dynamic data on the third page.
[0165] Each module in the data transmission device provided in the embodiment of the present application can realize Figures 6-9 The functions of each step of the provided data transmission method and its ability to achieve corresponding technical effects are described briefly and will not be elaborated here.
[0166] Figure 12 A schematic diagram of the hardware structure of the data transmission device provided in an embodiment of the present application is shown.
[0167] The data transmission device may include a processor 1201 and a memory 1202 storing computer program instructions.
[0168] Specifically, the processor 1201 may include a central processing unit (CPU) or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0169] Memory 1202 may include a large capacity memory for data or instructions. By way of example and not limitation, memory 1202 may include a hard disk drive (HDD), a floppy disk drive, flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 1202 may include removable or non-removable (or fixed) media. Where appropriate, memory 1202 may be internal or external to a data transmission device. In certain embodiments, memory 1202 is a non-volatile solid-state memory.
[0170] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present disclosure.
[0171] The processor 1201 implements any one of the data transmission methods in the above embodiments by reading and executing computer program instructions stored in the memory 1202 .
[0172] In one example, the data transmission device may further include a communication interface 1203 and a bus 1204. Figure 12 As shown, the processor 1201 , the memory 1202 , and the communication interface 1203 are connected via a bus 1204 and communicate with each other.
[0173] The communication interface 1203 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0174] The bus 1204 includes hardware, software, or both that couples components of a data transmission device to each other. By way of example and not limitation, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Linear Predictive Coding (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (Peripheral Component Interconnect-X, PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VESA Local Bus, VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, the bus 1204 may include one or more buses. Although embodiments herein describe and illustrate a particular bus, this application contemplates any suitable bus or interconnect.
[0175] The device can execute the data transmission method of the embodiment of the present application based on each unit / component in the data transmission device, thereby realizing the combination of Figures 1-9 Describes the method of data transmission.
[0176] In addition, in conjunction with the data transmission method in the above embodiments, the present application embodiment may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any of the data transmission methods in the above embodiments is implemented.
[0177] It should be understood that the present application is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and illustrated as examples. However, the method process of the present application is not limited to the specific steps described and illustrated. Those skilled in the art can make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present application.
[0178] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps. In other words, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0179] The above is only a specific implementation method of the present application. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the scope of protection of the present application is not limited to this. Any technician familiar with this technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the scope of protection of this application.
Claims
1. A data transmission method, characterized in that: Applied to a data sending device, the method includes: In response to a data sending request, obtaining target static data corresponding to the static variable in the data sending request; Determining, among a plurality of preset storage areas, a target storage area corresponding to the target static data according to a preset correspondence between static data and storage areas, wherein the target storage area stores at least one target message data, the target message data being obtained by encapsulating the target static data corresponding to the static variable and the target dynamic data corresponding to the dynamic variable; According to the preset sending time interval, the target message data are read from the target storage area and sent respectively.
2. The method according to claim 1, characterized in that Before determining, among the plurality of preset storage areas, a target storage area corresponding to the target static data according to a preset correspondence between static data and storage areas, the method further includes: Acquire each static data corresponding to the static variable, and establish a plurality of storage areas, wherein the storage areas correspond one to one to the static data; Based on the various static data and the multiple storage areas, a correspondence between the preset static data and the storage areas is generated.
3. The method according to claim 2, characterized in that Also includes: Displaying a first page, and in response to a first input in the first page, acquiring a correspondence between static data and a variable structure preset in the first input; In the preset correspondence between static data and variable structures, information of a first variable structure corresponding to first static data is obtained, wherein the first static data is any one of the static data; Constructing at least one first dynamic data corresponding to the dynamic variable according to the information of the first variable structure; Based on the information of the first variable structure, encapsulate the first static data and the first dynamic data respectively to obtain at least one first message data; The at least one first message data is stored in a first storage area, wherein the first storage area is a storage area corresponding to the first static data in the preset correspondence between static data and storage areas.
4. The method according to claim 3, characterized in that The step of constructing at least one first dynamic data corresponding to the dynamic variable according to the information of the first variable structure includes: Display the second page; In response to a second input in the second page, acquiring information about the excitation duration and the excitation time interval in the second input; During the excitation duration, the excitation time interval is used as a period, and in each period, first dynamic data corresponding to the dynamic variable is constructed according to information of the first variable structure to obtain at least one first dynamic data.
5. The method according to claim 3, characterized in that The variable structure information includes information about a static variable structure and information about a dynamic variable structure; and based on the first variable structure information, the first static data and the first dynamic data are respectively encapsulated to obtain at least one first message data, including: Converting the first static data into a first byte array based on the information of the static variable structure in the information of the first variable structure; Based on the information of the dynamic variable structure in the information of the first variable structure, convert the at least one first dynamic data into a second byte array respectively; The first byte array is combined with the second byte array respectively to obtain at least one third byte array, where the third byte array is the first message data.
6. A data transmission method, characterized in that: Applied to a data receiving device, the method includes: Upon receiving target message data, the target message data is split into target static data and target dynamic data according to information of a preset static variable structure, wherein the target message data is target static data corresponding to the static variables in the data sending request obtained by the data sending device in response to the data sending request; a target storage area corresponding to the target static data is determined among a plurality of preset storage areas according to a preset correspondence between static data and storage areas, wherein at least one target message data is stored in the target storage area, and the target message data is obtained by encapsulating the target static data corresponding to the static variable and the target dynamic data corresponding to the dynamic variable; and the target message data are read one by one from the target storage area and sent according to a preset sending time interval; In the preset correspondence relationship between static data and dynamic variable structures, obtaining information of a target dynamic variable structure corresponding to the target static data; Based on the information of the target dynamic variable structure, the target dynamic data is split to obtain at least one first target dynamic data and at least one second target dynamic data, wherein the first target dynamic data is data corresponding to the first sub-dynamic variable of the first level, and the second target dynamic data is data corresponding to the second sub-dynamic variable of the first level, the first sub-dynamic variable is a nested type variable, the second sub-dynamic variable is a non-nested type variable, and the dynamic variable is nested with N sub-dynamic variables of the first level; The information of the first target dynamic data and the information of the second target dynamic data are displayed on the third page.
7. The method according to claim 6, characterized in that The target dynamic variable structure information includes the position information, length information, and type information of N first-level sub-dynamic variables nested in the dynamic variable; the target dynamic data is split based on the target dynamic variable structure information to obtain at least one first target dynamic data and at least one second target dynamic data, including: Classify the N first-level sub-dynamic variables according to the type information to obtain a first sub-dynamic variable and a second sub-dynamic variable; According to the position information and length information of the first sub-dynamic variable and the position information and length information of the second sub-dynamic variable, the target dynamic data is split to obtain the first target dynamic data corresponding to the first sub-dynamic variable and the second target dynamic data corresponding to the second sub-dynamic variable.
8. The method according to claim 7, characterized in that The target dynamic variable structure information also includes the structure information of each variable nested in the first sub-dynamic variable; the method further includes: In response to a third input in the third page, the first target dynamic data is split based on the structural information of each variable nested in the first sub-dynamic variable to obtain a plurality of third target dynamic data; The third target dynamic data is displayed on the third page.
9. A data transmission device, characterized in that: Applied to a data sending device, the apparatus comprises: an acquisition module, configured to acquire, in response to a data sending request, target static data corresponding to a static variable in the data sending request; a determination module, configured to determine, from a plurality of preset storage areas, a target storage area corresponding to the target static data according to a preset correspondence between static data and storage areas, wherein the target storage area stores at least one target message data, the target message data being obtained by encapsulating the target static data corresponding to the static variable and the target dynamic data corresponding to the dynamic variable; The sending module is used to read the target message data from the target storage area and send them according to a preset sending time interval.
10. A data transmission device, characterized in that: Applied to a data receiving device, the apparatus comprises: a splitting module configured to, upon receiving target message data, split the target message data into target static data and target dynamic data according to information of a preset static variable structure, wherein the target message data is target static data corresponding to static variables in a data sending request obtained by a data sending device in response to the data sending request; determine, among a plurality of preset storage areas, a target storage area corresponding to the target static data according to a preset correspondence between static data and storage areas, wherein at least one target message data is stored in the target storage area, and the target message data is obtained by encapsulating the target static data corresponding to the static variable and the target dynamic data corresponding to the dynamic variable; and read the target message data one by one from the target storage area and send them according to a preset sending time interval; An acquisition module, configured to acquire information of a target dynamic variable structure corresponding to the target static data in a preset correspondence relationship between static data and dynamic variable structures; The splitting module is further configured to split the target dynamic data based on the information of the target dynamic variable structure to obtain first target dynamic data and second target dynamic data; The display module is configured to display information about the first target dynamic data and information about the second target dynamic data on a third page.