Data transmission method, device, electronic device, and readable storage medium
By establishing a communication connection between the application and the kernel, and using functional tags to encapsulate data packets, the memory usage problem caused by the increase of functional modules is solved, and more efficient memory utilization and flexible access methods are achieved.
Patent Information
- Application Number
- CN202211561795.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-06
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2042-12-06
AI Technical Summary
With the increase of functional modules, the number of functional nodes in the operating system increases, occupying a large amount of memory, resulting in a system burden.
Through the unified functional node, the communication connection between the application and the kernel is established. The application encapsulates the functional data into a packet including the functional tag and sends it to the kernel. The kernel parses the tag and calls the corresponding module for operation. The application only needs to access multiple functional modules through the unified node.
Reduces the need for the operating system to create multiple functional nodes, saves memory, and improves access flexibility and efficiency.
Smart Images

Figure CN116089115B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information transmission technology, and in particular to a data transmission method, device, electronic device, and readable storage medium. Background Art
[0002] The operating system of a terminal device, such as an in-car system, is generally based on the Android system and consists of applications and a kernel. When a user needs to use a certain function of an application, such as adjusting the volume, data needs to be transmitted between the application and the kernel.
[0003] In the prior art, data is generally transmitted in a file manner. The kernel creates a file node so that applications in the user space can access the kernel function module corresponding to the file node. The file node can also be called a feature node or a function node.
[0004] However, as the number of functional modules increases, the corresponding functional nodes increase, occupying a large amount of memory of the operating system and bringing a burden to the operating system. Summary of the Invention
[0005] The present invention provides a data transmission method, device, electronic device, and readable storage medium, aiming to solve the problem that as the number of functional modules increases, the corresponding functional nodes increase, occupying a large amount of memory of the operating system and bringing a burden to the operating system.
[0006] A first aspect of the present invention provides a data transmission method applied to a terminal device, wherein the operating system of the terminal device includes an application, a kernel, and a unified function node, and the method includes:
[0007] The unified function node establishes a communication connection between the application and the kernel; the application encapsulates the first function data into a first function data packet, and sends the first function data packet to the kernel through the communication connection, wherein the first function data packet includes at least one first function tag; the kernel receives the first function data packet, and parses each first function tag from the first function data packet; the kernel calls each first function module corresponding to each first function tag to perform an operation.
[0008] In the present invention, the inventor creatively establishes a communication connection between an application and a kernel through a unified function node, allowing the application to access the kernel's first function module. When the application sends data to the kernel, the application encapsulates the first function data into a first function data packet and sends the first function data packet to the kernel through the communication connection. The first function data packet includes at least one first function tag, which identifies the first data function packet by the first function tag. Each first function tag corresponds to a first function module of the kernel. Therefore, when the kernel receives the first function data packet and parses each first function tag from the first function data packet, the kernel can call each first function module corresponding to each first function tag to perform data query or data setting operations on the first function module according to each first function tag. The application only needs to access each first function module of the kernel corresponding to each first function tag through the unified function node. Furthermore, when the application needs to access multiple function modules of the kernel, the kernel does not need to create multiple function nodes, saving operating system memory. In addition, the first function data packet includes at least one first function tag, each first function tag corresponding to each first function module of the kernel. The application can access multiple first function modules of the kernel at once through the unified function node, making the access method more flexible.
[0009] Optionally, the first function data includes a query data request and at least one query function tag;
[0010] The kernel calls each first function module corresponding to each first function label to perform operations, including:
[0011] The kernel calls each of the first function modules corresponding to each of the query function tags to perform a query, and obtains query result data returned by each of the first function modules in response to the query data request;
[0012] The method further comprises:
[0013] The kernel encapsulates the query result data and each query function tag into a first return data packet, and sends the first return data packet to the application;
[0014] The application parses the first returned data packet to obtain the query result data and each of the query function tags.
[0015] Optionally, the first function data includes a setting data request and at least one setting function tag;
[0016] The kernel calls each first function module corresponding to each first function label to perform operations, including:
[0017] The kernel calls each of the first function modules corresponding to each of the setting function tags, and sets each of the first function modules according to the setting data request;
[0018] The method further comprises:
[0019] The kernel sends the setting result of each of the first functional modules to the application;
[0020] The application receives the setting result.
[0021] Optionally, the application encapsulates the first function data into a first function data packet, including:
[0022] The application encapsulates the first function data into the first function data packet in a preset format; the preset format is a format of transmission data specified by the unified interface protocol;
[0023] The kernel receives the first functional data packet and parses each first functional tag from the first functional data packet, including:
[0024] The core receives the first functional data packet and parses each of the first functional tags from the first functional data packet according to a parsing method corresponding to the preset format.
[0025] Optionally, the first function data packet includes a packet header, at least one first function tag, the byte length occupied by the data values of each first function module corresponding to each first function tag, and the data values of each first function module corresponding to each first function tag.
[0026] Optionally, the packet header includes a target feature value;
[0027] After the kernel receives the first functional data packet, the method further includes:
[0028] The kernel parses the target feature value from the first functional data packet, and discards the first functional data packet if the target feature value does not match a preset feature value, and sends an error prompt to the application.
[0029] Optionally, the first functional data packet further includes a packet tail, wherein the packet tail includes a target end flag;
[0030] After the kernel receives the first functional data packet, the method further includes:
[0031] The kernel parses the target end flag from the first functional data packet, and discards the first functional data packet if the target end flag does not match a preset end flag, and sends an error prompt to the application.
[0032] A second aspect of the present invention provides a data transmission apparatus, applied to a terminal device, wherein the operating system of the terminal device includes an application, a kernel, and a unified function node, and the apparatus includes:
[0033] a connection module, configured to control the unified function node to establish a communication connection between the application and the kernel;
[0034] a data sending module, configured to control the application to encapsulate the first function data into a first function data packet, and send the first function data packet to the kernel through the communication connection, wherein the first function data packet includes at least one first function tag;
[0035] a data receiving module, configured to control the core to receive the first function data packet and parse each of the first function tags from the first function data packet;
[0036] The operation module is used to control the kernel to call each first function module corresponding to each first function label to perform an operation.
[0037] According to a third aspect of the present invention, an electronic device is provided, comprising a processor and a memory, wherein the memory stores a program that can be run on the processor, and when the program is executed by the processor, the steps of the data transmission method of the present invention are implemented.
[0038] According to a fourth aspect of the present invention, a readable storage medium is provided, on which a program is stored. When the program is executed by a processor, the steps of the data transmission method of the present invention are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0040] Figure 1 A flowchart showing the steps of a data transmission method according to an embodiment of the present invention is shown;
[0041] Figure 2 A schematic diagram of querying and setting data in a data transmission method according to an embodiment of the present invention is shown;
[0042] Figure 3 A schematic diagram showing a first function data packet in a preset format according to an embodiment of the present invention is shown;
[0043] Figure 4 A schematic diagram showing a header of a first function data packet in a preset format according to an embodiment of the present invention;
[0044] Figure 5 A schematic diagram showing a first function data packet in a preset format for querying data according to an embodiment of the present invention is shown;
[0045] Figure 6 A schematic diagram showing a first return data packet in a preset format for returning query data according to an embodiment of the present invention is shown;
[0046] Figure 7 A schematic diagram showing a first functional data packet for setting a preset format of data in an embodiment of the present invention is shown;
[0047] Figure 8 A data transmission device in an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0048] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0049] The embodiment of the present invention provides a data transmission method, which is applied to a terminal device, wherein the operating system of the terminal device includes an application, a kernel, and a unified function node. Figure 1 , Figure 1 A flowchart of a data transmission method according to an embodiment of the present invention is shown, including:
[0050] Step 101: The unified function node establishes a communication connection between the application and the kernel.
[0051] In step 102 , the application encapsulates the first functional data into a first functional data packet, and sends the first functional data packet to the kernel through the communication connection, where the first functional data packet includes at least one first functional tag.
[0052] Step 103: The kernel receives the first functional data packet and parses the first functional data packet to obtain each first functional tag.
[0053] Step 104: the kernel calls each first function module corresponding to each first function label to perform an operation.
[0054] The inventors discovered that when a user uses a terminal device, if the user needs to use a certain function of an application, such as adjusting the volume, data needs to be transmitted between the application and the kernel. The kernel creates a corresponding function node so that the application can access the function module of the kernel corresponding to the function node. As the number of function modules increases, the number of corresponding function nodes increases, occupying a large amount of memory of the operating system and bringing a burden to the operating system. In the present invention, the inventor creatively establishes a communication connection between an application and a kernel through a unified function node, allowing the application to access the kernel's first function module. When the application sends data to the kernel, the application encapsulates the first function data into a first function data packet and sends the first function data packet to the kernel through the communication connection. The first function data packet includes at least one first function tag, which identifies the first data function packet by the first function tag. Each first function tag corresponds to a first function module of the kernel. Therefore, when the kernel receives the first function data packet and parses each first function tag from the first function data packet, the kernel can call each first function module corresponding to each first function tag to perform data query or data setting operations on the first function module according to each first function tag. The application only needs to access each first function module of the kernel corresponding to each first function tag through the unified function node. Furthermore, when the application needs to access multiple function modules of the kernel, the kernel does not need to create multiple function nodes, saving operating system memory. In addition, the first function data packet includes at least one first function tag, each first function tag corresponding to each first function module of the kernel. The application can access multiple first function modules of the kernel at once through the unified function node, making the access method more flexible.
[0055] In the present invention, the terminal device can be a mobile phone based on the Android system, a smart wearable device, or a vehicle-mounted terminal device. Optionally, the first functional module includes a display functional module, a camera functional module, an audio functional module, and a system functional module.
[0056] Optionally, the first function data includes a query data request and at least one query function tag; the kernel calls each first function module corresponding to each first function tag to perform an operation, including: the kernel calls each first function module corresponding to each query function tag to query, and obtains the query result data returned by each first function module for the query data request; the method also includes: the kernel encapsulates the query result data and each query function tag into a first return data packet, and sends the first return data packet to the application; the application parses the query result data and each query function tag from the first return data packet. Figure 2 , Figure 2 A schematic diagram of querying and setting data in a data transmission method according to an embodiment of the present invention is shown.
[0057] When an application needs to query the data of a functional module of the kernel, the first functional data includes a query data request and at least one query function tag. The first functional data is identified by the query function tag. The kernel calls each first functional module corresponding to each query function tag to perform a query according to the query function tag. After obtaining the query result data returned by each first functional module in response to the query data request, the kernel encapsulates the query result data and each query function tag into a first return data packet, and sends the first return data packet to the application. The first return data packet is identified by the query function tag. The application parses the query result data and each query function tag from the first return data packet. The application confirms the query result data corresponding to the query function tag according to the query function tag. The application only needs to access each first functional module of the kernel corresponding to each query function tag through a unified functional node. Furthermore, when the application needs to query the data of multiple functional modules of the kernel, the kernel does not need to create multiple functional nodes, thereby saving the memory of the operating system.
[0058] Optionally, the first function data includes a setting data request and at least one setting function tag; the kernel calls each first function module corresponding to each first function tag to perform an operation, including: the kernel calls each first function module corresponding to each setting function tag, and sets each first function module according to the setting data request; the method further includes: the kernel sends the setting result of each first function module to the application; and the application receives the setting result. Figure 2 , Figure 2 A schematic diagram of querying and setting data in a data transmission method according to an embodiment of the present invention is shown.
[0059] When an application needs to set the data of a functional module of the kernel, the first functional data includes a setting data request and at least one setting function tag. The first functional data is identified by the setting function tag. The kernel calls each first functional module corresponding to each first functional tag according to the setting function tag, and sets each first functional module according to the setting data request. After the setting is completed, the kernel sends the setting result of each first functional module to the application. The application receives the setting result. The application only needs to access each first functional module of the kernel corresponding to each setting function tag through a unified function node. Furthermore, when the application needs to set the data of multiple functional modules of the kernel, the kernel does not need to create multiple function nodes, saving the memory of the operating system.
[0060] Optionally, the application encapsulates the first function data into a first function data packet, including: the application encapsulates the first function data into a first function data packet in a preset format; the preset format is the format of the transmission data specified by the unified interface protocol; the kernel receives the first function data packet and parses out each first function tag from the first function data packet, including: the kernel receives the first function data packet and parses out each first function tag from the first function data packet according to the parsing method corresponding to the preset format.
[0061] The application encapsulates the first function data into a first function data packet in a preset format. The kernel receives the first function data packet and parses each first function tag from the first function data packet according to a parsing method corresponding to the preset format. This encapsulation and parsing according to the preset format allows the kernel to accurately and quickly parse the first function tags according to the parsing method corresponding to the preset format, and then operate the functional modules corresponding to each first function tag based on the parsed first function tags. Optionally, after receiving the first function data packet, if the first function data packet does not conform to the preset format, the kernel discards the first function data packet; if the first function data packet conforms to the preset format, the kernel proceeds to the next step.
[0062] Optionally, the first function data packet includes a packet header, at least one first function tag, the byte length occupied by the data values of each first function module corresponding to each first function tag, and the data values of each first function module corresponding to each first function tag.
[0063] The first function data packet includes a header, which can identify the first function data packet. Whether the first function data packet contains a header can be used to determine whether it is false data. Specifically, if the first function data packet does not contain a header, the data can be discarded. If the first function data packet contains a header, the next step is performed. The first function data packet includes at least one first function tag, which identifies the first function data packet. When the kernel receives the first function data packet and parses each first function tag from the first function data packet, the kernel can call each first function module corresponding to each first function tag to perform operations based on each first function tag. The first function data packet includes the byte length of the data value of each first function module corresponding to each first function tag. Each data value occupies one byte. The number of data values can be determined based on this byte length. If there are multiple data values in the first function data packet, the format of the first function data packet can be verified. The first function data packet includes the data value of each first function module corresponding to each first function tag. The kernel can set the data of each first function module based on the data value of each first function module.
[0064] Optionally, the preset format of the first function data packet refers to Figure 3 , Figure 3 A schematic diagram illustrates a first function data packet in a preset format according to an embodiment of the present invention. The total length of the first function data packet is set to M. Bytes 1 to 6 are the header, byte 7 is the first function tag, and byte 8 is the byte length of the data value of the first function module, which is set to N, where N is an integer greater than or equal to 1. Byte 9 is the data value 1. If N is greater than 1, bytes 8+N are the data value N. Bytes 7 to 8+N constitute the first function data group. If there are X first function data groups in total, first function data group 2 through first function data group X are stored sequentially starting from bytes 9+N. The format of first function data groups 2 through first function data group X is the same as that of the first function data group. Bytes M-1 and M are end markers. Optionally, M does not exceed 1024 to prevent the total length of the first function data packet from being too large and reducing transmission speed. Optionally, if N is greater than 1, data values 1 through N are stored in little-endian format.
[0065] Optionally, the packet header includes a target characteristic value; after the kernel receives the first functional data packet, the method also includes: the kernel parses the target characteristic value from the first functional data packet, and if the target characteristic value does not match the preset characteristic value, discards the first functional data packet and sends an error prompt to the application.
[0066] The packet header includes a target characteristic value, which identifies the first functional data packet. The kernel parses the target characteristic value from the first functional data packet. If the target characteristic value does not match a preset characteristic value, the first functional data packet is discarded and an error message is sent to the application. This prevents malicious applications from transmitting false data to the kernel, thereby increasing the security of the operating system. Optionally, the target characteristic value is P. If the target characteristic value is not P, the first functional data packet is discarded and an error message is sent to the application.
[0067] Optionally, the packet header includes 6 bytes in the following format: the first byte is the target feature value; the second byte is the protocol version number; the third byte is the data type; the fourth byte is the reserved byte; the fifth byte is the high byte of the length obtained by removing the header and the end flag length from the total length of the first functional data packet in the preset format; the sixth byte is the low byte of the length obtained by removing the header and the end flag length from the total length of the first functional data packet in the preset format. The protocol version number can be defined independently, for example, the protocol version number can be defined as 0x01; the data type can be defined independently, and is used by the kernel and application to determine the purpose of the first function data packet. For example, the data type when querying data can be defined as 0x12. Specifically, the application needs to query the data of the kernel's functional module. The first functional data includes a query data request and at least one query function tag. The application encapsulates the first functional data into a first functional data packet. The data type in the packet header is 0x12. After the kernel receives the first functional data packet, it can determine that the first functional data packet is used to query the data of the first functional module based on the data type of 0x12; the data type when setting data can be defined as 0x14. Specifically, the application needs to set the data of the kernel's functional module. The first functional data includes a set data request and at least one set function tag. The application encapsulates the first functional data into a first functional data packet. The data type in the packet header is 0x14. After the kernel receives the first functional data packet, it can determine that the first functional data packet is used to set the data of the first functional module based on the data type of 0x14. The 4th byte is a reserved byte. When the data type of the 3rd byte exceeds 256, the 3rd and 4th bytes can form a new data type to distinguish the data. Reference Figure 4 , Figure 4 A schematic diagram shows a packet header of a first function data packet in a preset format according to an embodiment of the present invention.
[0068] Optionally, the first functional data packet also includes a packet tail, which includes a target end flag; after the kernel receives the first functional data packet, the method also includes: the kernel parses the target end flag from the first functional data packet, and if the target end flag does not match the preset end flag, the first functional data packet is discarded and an error prompt is sent to the application.
[0069] The first functional data packet also includes a packet tail, which includes a target end flag. The target end flag can identify the first functional data packet. The kernel parses the target end flag from the first functional data packet. When the target end flag does not match the preset end flag, the first functional data packet is discarded and an error prompt is sent to the application. This can prevent malicious applications from transmitting false data to the kernel, thereby increasing the security of the operating system. Optionally, the preset end flag is 0xFF. The kernel parses the target end flag from the first functional data packet. When the target end flag is not 0xFF, the first functional data packet is discarded and an error prompt is sent to the application. When the preset end flag is 0xFF, the first functional tag cannot be set to 0xFF to avoid errors in the encapsulation and parsing process of the first functional data packet.
[0070] Optionally, the application needs to query the data of the kernel's functional modules. The first functional data includes a query data request and at least one query function tag. The application encapsulates the first functional data into a first functional data packet in a preset format. The first functional data packet in the preset format does not include the data values of each first functional module. Figure 5 , Figure 5 A schematic diagram of a first function data packet in a preset format for querying data according to an embodiment of the present invention is shown. In the figure, flag1 and flag2 represent first function tags, length represents the byte length of the data value of the first function module, NULL represents a null byte, the first XX from the left represents the high byte of the total length of the first function data packet in the preset format minus the header and end marker length, and the second XX from the left represents the low byte of the total length of the first function data packet in the preset format minus the header and end marker length.
[0071] Optionally, the kernel encapsulates the query result data and each query function tag into a first return data packet in a preset format, referring to Figure 6 , Figure 6 A schematic diagram of a first return data packet in a preset format for returning query data in an embodiment of the present invention is shown. The first return data packet in the preset format includes a header, which includes a data type. The data type when returning query data can be defined as 0x13. Specifically, the kernel encapsulates the query result data and various query function tags into the first return data packet. The data type in the header is 0x13. After the application parses the query result data and various query function tags from the first return data packet, it can determine that the first return data packet is used to return data for querying the first functional module based on the data type of 0x13. In the figure, value1 and valueN represent the data values of the first functional module.
[0072] Optionally, the application needs to set the data of the kernel function module, the first function data includes a setting data request and at least one setting function tag, and the application encapsulates the first function data into a first function data packet in a preset format, referring to Figure 7 , Figure 7 A schematic diagram of a first functional data packet for setting a preset format of data in an embodiment of the present invention is shown.
[0073] Optionally, a query interface is predefined, and the first function data includes a query data request and at least one query function tag. When the application encapsulates the first function data into a first function data packet and sends the first function data packet to the kernel through a communication connection, the application calls the query interface and sends the first function data packet to the query interface, which then sends the data to the kernel. The kernel calls each first function module corresponding to each query function tag to perform a query and obtains query result data returned by each first function module for the query data request. When the kernel encapsulates the query result data and each query function tag into a first return data packet and sends the first return data packet to the application, the kernel calls the query interface and sends the first return data packet to the query interface, which then sends the data to the application. The specific code of the query interface is as follows:
[0074] int qg_CPCS_diag_query(char*in_buf,char*out_buf)
[0075] In which, in_buf represents the first functional data packet encapsulated by the first functional data including the query data request and at least one query function tag, and out_buf represents the output first return data packet.
[0076] Optionally, a setting interface is predefined, and the first function data includes a setting data request and at least one setting function tag. When the application encapsulates the first function data into a first function data packet and sends the first function data packet to the kernel through a communication connection, the application calls the setting interface, sends the first function data packet to the setting interface, and the setting interface then sends it to the kernel. The kernel calls each first function module corresponding to each setting function tag and sets each first function module according to the setting data request. When the kernel sends the setting result of each first function module to the application, the kernel calls the setting interface, sends the setting result to the setting interface, and the setting interface then sends it to the application. The specific code of the setting interface is: int qg_CPCS_get_value(char*flv_buf,char*out_value,QG_CPCS_FLAG_FUNC_ENUM flag,QG_CPCS_PKG_TYPE_ENUM type)
[0077] Among them, flv_buf represents the first function data packet encapsulated with the first function data including the setting data request and at least one setting function tag; out_value represents the data value of the first function module in the output first function data packet. When there are multiple data values of the first function modules, the data values of the multiple first function modules are stored in little-endian mode. When the byte length occupied by the data value of the first function module occupies one byte, one byte can represent 256 numbers, and the maximum byte length is 256. The data values of multiple first function modules can occupy a maximum of 256 bytes; QG_CPCS_FLAG_FUNC_ENUM represents the enumeration definition value of the defined first function tag, and inputs the first function tag to be set; QG_CPCS_PKG_TYPE_ENUM represents the data type in flv_buf, which is used to check whether the data type in the first function data packet is a predefined data type.
[0078] Optionally, a packaging interface is pre-defined on the application side, and the application calls the packaging interface to encapsulate the first functional data into a first functional data packet. Optionally, an unpacking interface is pre-defined on the application side, and the application calls the unpacking interface to parse the query result data and each query function tag from the first return data packet. Optionally, a packaging interface is pre-defined on the kernel side, and the kernel calls the packaging interface to encapsulate the query result data and each query function tag into a first return data packet. Optionally, an unpacking interface is pre-defined on the kernel side, and the kernel calls the unpacking interface to parse each first function tag from the first functional data packet. Pre-defining the packaging interface and unpacking interface facilitates packaging and parsing by the application and the kernel. When packaging and parsing, the application and the kernel only need to call the corresponding interface to achieve data packaging and parsing.
[0079] The embodiment of the present invention provides a data transmission device, which is applied to a terminal device. The operating system of the terminal device includes an application, a kernel, and a unified function node. Figure 8 , Figure 8 A data transmission device according to an embodiment of the present invention is shown, comprising:
[0080] The connection module S01 is used to control the unified function node to establish a communication connection between the application and the kernel;
[0081] a data sending module S02, configured to control the application to encapsulate the first function data into a first function data packet, and send the first function data packet to the kernel through a communication connection, wherein the first function data packet includes at least one first function tag;
[0082] A data receiving module S03 is configured to control the kernel to receive a first function data packet and parse each first function tag from the first function data packet;
[0083] The operation module S04 is used to control the kernel to call each first function module corresponding to each first function label to perform an operation.
[0084] The connection module S01 controls the unified function node to establish a communication connection between the application and the kernel, allowing the application to access the kernel's function modules. The data sending module S02 controls the application to encapsulate the first function data into a first function data packet and send the first function data packet to the kernel through the communication connection. The first function data packet includes at least one first function tag, and the first data function packet is identified by the first function tag. The data receiving module S03 controls the kernel to receive the first function data packet and parse out each first function tag from the first function data packet. The operation module S04 controls the kernel to call each first function module corresponding to each first function tag to perform operations according to each first function tag. The application only needs to access each first function module of the kernel corresponding to each first function tag through the unified function node. Furthermore, when the application needs to access multiple function modules of the kernel, the kernel does not need to create multiple function nodes, saving the memory of the operating system.
[0085] Optionally, the data transmission device further includes a query module, which is used to generate a query data request and at least one query function tag in the first function data. Optionally, the operation module S04 includes: a query acquisition unit, which is used to control the kernel to call each first function module corresponding to each query function tag to perform a query, and obtain the query result data returned by each first function module in response to the query data request. Optionally, the data transmission device further includes a query return module, which is used to control the kernel to encapsulate the query result data and each query function tag into a first return data packet, and send the first return data packet to the application; the data transmission device further includes a query receiving module, which is used to control the application to parse the query result data and each query function tag from the first return data packet.
[0086] Optionally, the data transmission device further includes a setting module configured to generate a setting data request and at least one setting function tag in the first function data. Optionally, the operation module S04 further includes a setting unit configured to control the kernel to call each first function module corresponding to each setting function tag and to set each first function module according to the setting data request. Optionally, the data transmission device further includes a setting receiving module configured to control the application to receive the setting result.
[0087] Optionally, the data sending module S02 includes: a preset format encapsulation unit configured to control the application to encapsulate the first function data into a first function data packet in a preset format; the preset format is a transmission data format specified by the unified interface protocol. Optionally, the data receiving module S03 includes: a preset format parsing unit configured to control the kernel to receive the first function data packet and parse each first function tag from the first function data packet according to a parsing method corresponding to the preset format.
[0088] Optionally, the data transmission device also includes a preset format module, which is used to generate a packet header, at least one first function tag, the byte length occupied by the data values of each first function module corresponding to each first function tag, and the data values of each first function module corresponding to each first function tag in the first function data packet.
[0089] Optionally, the data transmission device further includes a target characteristic value module configured to generate a target characteristic value in a packet header. Optionally, the data transmission device further includes a target characteristic value verification module configured to control the kernel to parse the target characteristic value from the first functional data packet and, if the target characteristic value does not match a preset characteristic value, discard the first functional data packet and send an error message to the application.
[0090] Optionally, the data transmission device further includes a target end flag module configured to generate a packet trailer in the first functional data packet and a target end flag in the packet trailer. Optionally, the data transmission device further includes a target end flag verification module configured to control the kernel to parse the target end flag from the first functional data packet, and if the target end flag does not match a preset end flag, discard the first functional data packet and send an error prompt to the application.
[0091] An embodiment of the present invention also provides an electronic device, including a processor and a memory, wherein the memory stores a program that can be run on the processor. When the program is executed by the processor, the various steps of the above-mentioned data transmission method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0092] An embodiment of the present invention also provides a readable storage medium, which stores a program. When the program is executed by a processor, it implements the various steps of the above-mentioned data transmission method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0093] It should be noted that the relevant parts of the aforementioned method, device, electronic device, and readable storage medium can refer to each other and can achieve the same or similar effects.
[0094] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0095] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0096] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0097] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.
Claims
1. A data transmission method, characterized in that: Applied to a terminal device, the operating system of the terminal device includes an application, a kernel, and a unified function node, and the method includes: The unified function node establishes a communication connection between the application and the kernel; The application encapsulates the first function data into a first function data packet, and sends the first function data packet to the kernel through the communication connection, wherein the first function data packet includes at least one first function tag; the first function data includes a query data request and at least one query function tag, a set data request and at least one set function tag; The kernel receives the first functional data packet and parses each first functional tag from the first functional data packet; The kernel calls each first function module corresponding to each first function label to perform an operation; The first functional data packet includes a packet header, at least one first functional tag, the byte length occupied by the data value of each first functional module corresponding to each first functional tag, and the data value of each first functional module corresponding to each first functional tag.
2. The data transmission method according to claim 1, wherein: The first function data includes a query data request and at least one query function tag; The kernel calls each first function module corresponding to each first function label to perform operations, including: The kernel calls each of the first function modules corresponding to each of the query function tags to perform a query, and obtains query result data returned by each of the first function modules in response to the query data request; The method further comprises: The kernel encapsulates the query result data and each query function tag into a first return data packet, and sends the first return data packet to the application; The application parses the first returned data packet to obtain the query result data and each of the query function tags.
3. The data transmission method according to claim 1, wherein: The first function data includes a setting data request and at least one setting function tag; The kernel calls each first function module corresponding to each first function label to perform operations, including: The kernel calls each of the first function modules corresponding to each of the setting function tags, and sets each of the first function modules according to the setting data request; The method further comprises: The kernel sends the setting result of each of the first functional modules to the application; The application receives the setting result.
4. The data transmission method according to any one of claims 1 to 3, characterized in that: The application encapsulates the first function data into a first function data packet, including: The application encapsulates the first function data into the first function data packet in a preset format; the preset format is a format of transmission data specified by the unified interface protocol; The kernel receives the first functional data packet and parses each first functional tag from the first functional data packet, including: The core receives the first functional data packet and parses each of the first functional tags from the first functional data packet according to a parsing method corresponding to the preset format.
5. The data transmission method according to claim 1, wherein: The packet header includes a target characteristic value; After the kernel receives the first functional data packet, the method further includes: The kernel parses the target feature value from the first functional data packet, and discards the first functional data packet if the target feature value does not match a preset feature value, and sends an error prompt to the application.
6. The data transmission method according to claim 1, wherein: The first functional data packet further includes a packet tail, wherein the packet tail includes a target end flag; After the kernel receives the first functional data packet, the method further includes: The kernel parses the target end flag from the first functional data packet, and discards the first functional data packet if the target end flag does not match a preset end flag, and sends an error prompt to the application.
7. A data transmission device, characterized in that: Applied to a terminal device, the operating system of the terminal device includes an application, a kernel, and a unified function node, and the apparatus includes: a connection module, configured to control the unified function node to establish a communication connection between the application and the kernel; a data sending module, configured to control the application to encapsulate first function data into a first function data packet, and send the first function data packet to the kernel through the communication connection, wherein the first function data packet includes at least one first function tag; the first function data includes a query data request and at least one query function tag, a set data request and at least one set function tag; a data receiving module, configured to control the core to receive the first function data packet and parse each of the first function tags from the first function data packet; an operation module, configured to control the kernel to call each first function module corresponding to each first function label to perform an operation; The first functional data packet includes a packet header, at least one first functional tag, the byte length occupied by the data value of each first functional module corresponding to each first functional tag, and the data value of each first functional module corresponding to each first functional tag.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program that can be run on the processor, and when the program is executed by the processor, the steps of the data transmission method according to any one of claims 1 to 6 are implemented.
9. A readable storage medium, characterized in that The readable storage medium stores a program, and when the program is executed by the processor, the steps of the data transmission method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Information transmission method, terminal equipment and storage medium
CN114416402A
Method, system, and program for executing data transfer requests
US20050240941A1