Search

CN-116126565-B - Method, device, equipment and medium for transmitting kernel data based on TCP loop

CN116126565BCN 116126565 BCN116126565 BCN 116126565BCN-116126565-B

Abstract

The application provides a kernel data transmission method, device, equipment and medium based on a TCP loop, which are used for completing the construction of a communication link between a target android upper layer and a target kernel after the connection between the target android upper layer and the target user layer is established based on a corresponding TCP loop address, acquiring target data reading parameters corresponding to a kernel data acquisition instruction by the target user layer and sending the target data reading parameters to the target kernel, acquiring target kernel data by the target kernel based on the target data reading parameters and sending the target kernel data to the target user layer, and sending the target kernel data to the target android upper layer by the target user layer. The method and the device realize that the HAL layer and the Frameworks layer corresponding to the application program are not required to be configured in the intelligent terminal in advance, and the corresponding fixed TCP loop address and different port numbers are configured for each application program, so that the whole development and adaptation process is simplified, the development efficiency and the expandability are improved, and the development cost is reduced.

Inventors

  • Liao Kehua
  • Liang Shuju
  • FANG YIJIA

Assignees

  • 深圳市康冠商用科技有限公司

Dates

Publication Date
20260512
Application Date
20230306

Claims (10)

  1. 1. The kernel data transmission method based on the TCP loop is characterized by comprising the following steps of: the method comprises the steps of responding to a kernel data acquisition instruction, acquiring a target android upper layer corresponding to the kernel data acquisition instruction, wherein the target android upper layer is a user interaction interface of a target application program, and the kernel data acquisition instruction is generated when interface elements of the user interaction interface are clicked; The method comprises the steps of obtaining a target kernel corresponding to a target android upper layer and a target user layer corresponding to the target kernel, determining the target kernel corresponding to the target android upper layer and the target user layer corresponding to the target kernel based on a preset mapping relation between the android upper layer and the kernel, wherein the mapping relation comprises a plurality of kernels and a plurality of android upper layers respectively corresponding to each kernel; the target android upper layer establishes communication connection with the target user layer based on the corresponding TCP loop address and target port number; The target user layer acquires target data reading parameters corresponding to the kernel data acquisition instruction and sends the target data reading parameters to the target kernel; The target kernel acquires target kernel data based on the target data reading parameters and sends the target kernel data to the target user layer according to a preset data stream sending strategy; and the target user layer sends the target kernel data to the target android upper layer.
  2. 2. The method of claim 1, wherein prior to the step of fetching a target android upper layer corresponding to a kernel data fetch instruction in response to the kernel data fetch instruction, the method further comprises: and presetting a mapping relation between an android upper layer and a kernel.
  3. 3. The method of claim 1, wherein the target android upper layer establishes a communication connection with the target user layer based on the corresponding TCP loop address and target port number, comprising: the target user layer creates a Socket server; The target android upper layer creates a Socket client and acquires a port number corresponding to the Socket client; and the Socket server establishes communication connection with the Socket client based on the port number corresponding to the Socket client and the TCP loop back address.
  4. 4. The method of claim 1, wherein the target user layer obtains a target data read parameter corresponding to the kernel data obtaining instruction and sends the target data read parameter to the target kernel, comprising: The target user layer acquires data reading parameters based on an input/output interface, takes the data reading parameters as target data reading parameters corresponding to the kernel data acquisition instruction, and sends the target data reading parameters to the target kernel.
  5. 5. The method of claim 1, wherein prior to the step of the target kernel obtaining target kernel data based on the target data reading parameters and sending the target kernel data to the target user layer according to a preset data stream sending policy, the method further comprises: the target kernel correspondingly creates a unidirectional circular linked list based on target data reading parameters, wherein the unidirectional circular linked list is used for storing kernel data with preset data size acquired by the target kernel; And the target kernel acquires a data storage space address corresponding to the target data reading parameter.
  6. 6. The method of claim 5, wherein the data stream transmission policy is used for the target kernel to transmit target kernel data to the target user layer based on a preset data transmission period; The target kernel acquires target kernel data based on the target data reading parameters and sends the target kernel data to the target user layer according to a preset data stream sending strategy, and the method comprises the following steps: the target kernel acquires target kernel data from the data storage space address based on the target data reading parameters and stores the target kernel data to the unidirectional circular linked list; the target kernel preprocesses the target kernel data stored in the unidirectional circular linked list based on a preset data preprocessing strategy so as to update the target kernel data stored in the unidirectional circular linked list; And the target kernel transmits the target kernel data to the target user layer according to the data stream transmission strategy.
  7. 7. The method of claim 6, wherein after the step of sending the target kernel data to the target user layer according to the data stream sending policy, the method further comprises: Deleting the target kernel data stored in the unidirectional circular linked list to empty the unidirectional circular linked list.
  8. 8. A TCP loop-based kernel data transmission apparatus, comprising: The target android upper layer determining unit is used for responding to the kernel data obtaining instruction and obtaining a target android upper layer corresponding to the kernel data obtaining instruction, wherein the target android upper layer is a user interaction interface of a target application program, and the kernel data obtaining instruction is generated when an interface element of the user interaction interface is clicked; The target bottom layer acquisition unit is used for acquiring a target kernel corresponding to the target android upper layer and a target user layer corresponding to the target kernel; the method comprises the steps of determining a target kernel corresponding to a target android upper layer and a target user layer corresponding to the target kernel based on a preset mapping relation between the android upper layer and the kernels, wherein the mapping relation comprises a plurality of kernels and a plurality of android upper layers respectively corresponding to each kernel; The communication establishing unit is used for establishing communication connection between the target android upper layer and the target user layer based on the corresponding TCP loop address and the target port number; the reading parameter acquisition unit is used for acquiring target data reading parameters corresponding to the kernel data acquisition instruction by the target user layer and sending the target data reading parameters to the target kernel; The first kernel data sending unit is used for the target kernel to obtain target kernel data based on the target data reading parameters and send the target kernel data to the target user layer according to a preset data stream sending strategy; and the kernel data second sending unit is used for sending the target kernel data to the target android upper layer by the target user layer.
  9. 9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the TCP loop-based kernel data transmission method as claimed in any one of claims 1 to 7 when executing the computer program.
  10. 10. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when executed by a processor, causes the processor to perform the TCP loop-based kernel data transmission method according to any of claims 1-7.

Description

Method, device, equipment and medium for transmitting kernel data based on TCP loop Technical Field The present application relates to the field of kernel data transmission technologies, and in particular, to a method, an apparatus, a device, and a medium for transmitting kernel data based on a TCP loop. Background Currently, operating systems installed on intelligent terminals (such as smartphones, tablet computers and the like) mainly include an android operating system, a hong Mongolian operating system and an iOS operating system (i.e. an operating system developed by apple corporation). Taking the installation of the android system in the intelligent terminal as an example, when an upper application program needs to acquire kernel data, the adaptation of HAL (the full name of HAL is Hardware Abstract Layer, which represents a hardware abstraction layer) and Frameworks (a framework layer) located in a communication link between the kernel and the android application program to the android application program needs to be completed in the android system, and an interface corresponding to the android application program needs to be correspondingly added on Frameworks. If a plurality of application programs are further installed on the intelligent terminal provided with the android system, the application programs all have the requirement of calling kernel data, and corresponding HAL layers and Frameworks layers are adapted to the application programs, so that the whole development and adaptation process is complex, and the development cost is increased. Disclosure of Invention The embodiment of the application provides a method, a device, equipment and a medium for transmitting kernel data based on a TCP loop, which aim to solve the problems that when a plurality of application programs in an android system all have the requirement of calling kernel data in the prior art, corresponding HAL layers and Frameworks layers are adapted to the plurality of application programs, so that the whole development and adaptation process is complex, and the development cost is increased. In a first aspect, an embodiment of the present application provides a method for transmitting kernel data based on a TCP loop, including: responding to a kernel data acquisition instruction, and acquiring a target android upper layer corresponding to the kernel data acquisition instruction; Acquiring a target kernel corresponding to the target android upper layer and a target user layer corresponding to the target kernel; the target android upper layer establishes communication connection with the target user layer based on the corresponding TCP loop address and target port number; The target user layer acquires target data reading parameters corresponding to the kernel data acquisition instruction and sends the target data reading parameters to the target kernel; The target kernel acquires target kernel data based on the target data reading parameters and sends the target kernel data to the target user layer according to a preset data stream sending strategy; and the target user layer sends the target kernel data to the target android upper layer. In a second aspect, an embodiment of the present application provides a kernel data transmission device based on a TCP loop, including: The target android upper layer determining unit is used for responding to the kernel data obtaining instruction and obtaining a target android upper layer corresponding to the kernel data obtaining instruction; the target bottom layer acquisition unit is used for acquiring a target kernel corresponding to the target android upper layer and a target user layer corresponding to the target kernel; The communication establishing unit is used for establishing communication connection between the target android upper layer and the target user layer based on the corresponding TCP loop address and the target port number; the reading parameter acquisition unit is used for acquiring target data reading parameters corresponding to the kernel data acquisition instruction by the target user layer and sending the target data reading parameters to the target kernel; The first kernel data sending unit is used for the target kernel to obtain target kernel data based on the target data reading parameters and send the target kernel data to the target user layer according to a preset data stream sending strategy; and the kernel data second sending unit is used for sending the target kernel data to the target android upper layer by the target user layer. In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements the method for transmitting kernel data based on TCP loop according to the first aspect when executing the computer program. In a fourth aspect, an embodiment of the present application further pr