A data transmission device based on a binder mechanism and an implementation method thereof

CN115480933BActive Publication Date: 2026-09-29FORYOU GENERAL ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211014623.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-23
Publication Date
2026-09-29
Estimated Expiration
2042-08-23

AI Technical Summary

Technical Problem

然而,在linux系统中,各中间件通过IPC进行通信,因此无法如QNX系统中那样直接通过系统命令行输入来测试系统发送数据到目标设备,导致系统调试效率低,增加了开发周期,不利于新产品的快速上市

Benefits of technology

[0048]本发明的有益效果在于:本发明通过创建binder通信模块的复用机制,在交互进程、收发进程之间建立binder端口连接,将交互指令中的第一预设类型参数转换为第二预设类型参数并装入到vector类型容器中,然后通过binder机制传给收发进程,再发送给通讯模块,并由通讯模块通过预定的通讯协议发送给目标设备,实现了在linux系统中可以直接通过系统命令行输入来测试系统发送数据到目标设备,提高了调试效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115480933B_ABST
    Figure CN115480933B_ABST
Patent Text Reader

Abstract

The application provides a data transmission device based on a binder mechanism and an implementation method thereof. By creating a multiplexing mechanism of a binder communication module, a binder port connection is established between an interactive process and a transceiving process, a first preset type parameter in an interactive instruction is converted into a second preset type parameter and is loaded into a vector type container, then the binder mechanism is used to transmit the second preset type parameter to the transceiving process, the second preset type parameter is transmitted to the communication module, and the communication module transmits the second preset type parameter to a target device through a predetermined communication protocol, so that the system can directly test the transmission of data from the system to the target device through a system command line input in a Linux system, and the debugging efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data transmission technology, and in particular to a data transmission device based on the binder mechanism and its implementation method. Background Technology

[0002] Traditional QNX systems communicate via the PPS protocol, allowing users to directly test data transmission to the target device by entering the corresponding PPS value in the system command line. However, in Linux systems, middleware communicate via IPC, making it impossible to directly test data transmission to the target device via the system command line as in QNX systems. This results in low system debugging efficiency, increased development time, and hinders the rapid launch of new products. Summary of the Invention

[0003] This invention provides a data transmission device and its implementation method based on the binder mechanism, aiming to overcome the deficiencies in the prior art and enable the system to send data to the target device directly through system command line input in the Linux system, thereby improving debugging efficiency.

[0004] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0005] This invention provides a data transmission device based on the binder mechanism, comprising:

[0006] The system includes several secure containers and a binder communication module connected thereto, as well as a transceiver module, a transceiver process, and a communication interface connected in sequence. The transceiver module is also connected to the binder communication module.

[0007] The secure container, transceiver module, and transceiver process are located at the application layer, the binder communication module is located at the kernel layer, and the communication interface is located at the physical layer.

[0008] The plurality of security containers are used to isolate each interaction process, and each security container includes an interaction process and a parameter conversion module;

[0009] The interaction process is used to receive interaction commands input from the interactive interface and forward them to the parameter conversion module, or to receive parameters converted by the parameter conversion module and send them to the interactive interface for display.

[0010] The parameter conversion module is used to convert the received first preset type parameter into a second preset type parameter;

[0011] The transceiver module is used to send the second preset type parameter to the transceiver process through the corresponding binder port;

[0012] The transceiver process is used to convert the second preset type parameter into a level type that the communication module can recognize and then send it to the communication module, or to receive data from the communication module and convert it into the second preset type parameter;

[0013] The communication module is used to provide a communication hardware interface to the outside world;

[0014] The binder communication module is set in the Linux system kernel layer. It is used to open the binder service, provide IPC communication for the interaction process and the sending and receiving process, and register a callback function for death notification.

[0015] Specifically, the parameter conversion module is used to convert the argv parameter into an int type parameter.

[0016] Specifically, the communication module is a UART or I2C interface.

[0017] Furthermore, the binder communication module is also used to register callback functions for death notifications.

[0018] Another aspect of the present invention provides a method for implementing a data transmission device based on the binder mechanism, comprising:

[0019] Step 1: Create a reuse mechanism for the binder communication module;

[0020] Step 2: The binder communication module starts the binder service and establishes a binder port connection between the interaction process and the send / receive process.

[0021] Step 3: The interactive process receives the interactive instructions input from the interactive interface and sends them to the parameter conversion module;

[0022] Step 4: The parameter conversion module obtains the first preset type parameter in the interaction command and converts it into the second preset type parameter;

[0023] Step 5: The parameter conversion module loads the second preset type parameter into a vector type container;

[0024] Step 6: The send / receive module transmits the vector container to the send / receive process via the binder mechanism;

[0025] Step 7: The transmitting and receiving process converts the second preset type parameter in the vector container into a level signal that the communication module can recognize and then sends it to the communication module;

[0026] Step 8: The communication module sends the level signal to the target device through a predetermined communication protocol.

[0027] Specifically, step 1 includes:

[0028] Step 101: Create a target namespace, which is a separate namespace corresponding to each security container;

[0029] Step 102: Encapsulate the global variables of the entity node and the global variable of UID corresponding to Service Manager in the binder driver into local variables associated with the target namespace;

[0030] Step 103: Associate the process information record structure binder_proc with the target namespace;

[0031] Step 104: Register a Service Manager for each security container;

[0032] Step 105: The Service Manager stores the names of the registered interactive processes in the service list related to the target namespace.

[0033] Specifically, the binder communication module enabling the binder service includes:

[0034] Step 201: Port the binder driver, service manager, and binder library from Android to the Linux system;

[0035] Step 202: Open the binder driver file and create a process information record structure binder_proc in the kernel space;

[0036] Step 203: Set the binder driver context manager;

[0037] Step 204: Start the loop to detect service requests in real time.

[0038] Specifically, step 4 includes: the parameter conversion module obtains a first preset type parameter by parsing the main function in the interactive instruction.

[0039] Specifically, step 4 includes: the parameter conversion module converts the argv parameter into an int type parameter according to the ASCII encoding rules.

[0040] Furthermore, following step 2, the following is also included:

[0041] Step 21: Register the callback function for death notification in the binder communication module;

[0042] The process after step 7 also includes:

[0043] Step 71: The binder communication module determines whether the connection of the binder port between the interaction process and the sending and receiving process is broken. If yes, proceed to the next step; otherwise, return to step 3.

[0044] Step 72: The binder communication module calls back the death notification to reconnect.

[0045] Specifically, step 71 includes: determining whether the connection between the binder ports of the interactive process and the sending / receiving process is broken by using the binder.isBinderAlive() method.

[0046] Specifically, step 72 includes:

[0047] Reconnection is achieved through the onServiceDisconnected callback.

[0048] The beneficial effects of this invention are as follows: By creating a reuse mechanism for the binder communication module, this invention establishes a binder port connection between the interaction process and the sending and receiving process, converts the first preset type parameter in the interaction command into a second preset type parameter and loads it into a vector type container, and then transmits it to the sending and receiving process through the binder mechanism, and then sends it to the communication module, which in turn sends it to the target device through a predetermined communication protocol. This enables the testing of sending data to the target device directly through system command line input in the Linux system, thus improving debugging efficiency. Attached Figure Description

[0049] Figure 1 This is a schematic diagram of the data transmission device based on the binder mechanism of the present invention;

[0050] Figure 2 This is a flowchart illustrating the implementation method of the data transmission device based on the binder mechanism of the present invention. Detailed Implementation

[0051] The embodiments of the present invention are described in detail below with reference to the accompanying drawings. The drawings are for reference and illustration only and do not constitute a limitation on the scope of protection of the present invention.

[0052] In the process described in the specification, claims, or drawings of this invention, each step is numbered (e.g., step 10, 20, etc.). These numbers are used only to distinguish the steps and do not represent any execution order. It should be noted that the terms "first," "second," etc., used herein are only for distinguishing the objects being described and do not represent a chronological order, nor do they indicate that "first," "second," etc., are different types.

[0053] Example 1

[0054] like Figure 1 As shown, this embodiment provides a data transmission device based on the binder mechanism, including:

[0055] The system includes several secure containers and a binder communication module connected thereto, as well as a transceiver module, a transceiver process, and a communication interface connected in sequence. The transceiver module is also connected to the binder communication module.

[0056] The secure container, transceiver module, and transceiver process are located at the application layer, the binder communication module is located at the kernel layer, and the communication interface is located at the physical layer.

[0057] The plurality of security containers are used to isolate each interaction process, and each security container includes an interaction process and a parameter conversion module;

[0058] The interaction process is used to receive interaction commands input from the interactive interface and forward them to the parameter conversion module, or to receive parameters converted by the parameter conversion module and send them to the interactive interface for display.

[0059] The parameter conversion module is used to convert the received first preset type parameter into a second preset type parameter;

[0060] The transceiver module is used to send the second preset type parameter to the transceiver process through the corresponding binder port;

[0061] The transceiver process is used to convert the second preset type parameter into a level type that the communication module can recognize and then send it to the communication module, or to receive data from the communication module and convert it into the second preset type parameter;

[0062] The communication module is used to provide a communication hardware interface to the outside world;

[0063] The binder communication module is set in the Linux system kernel layer. It is used to open the binder service, provide IPC communication for the interaction process and the sending and receiving process, and register a callback function for death notification.

[0064] In this embodiment, the parameter conversion module is used to convert the argv parameter into an int type parameter.

[0065] In this embodiment, the communication module includes a UART and an I2C interface.

[0066] In another embodiment of the invention, the binder communication module is also used to register a callback function for death notification.

[0067] Example 2

[0068] like Figure 2 As shown, this embodiment provides a method for implementing a data transmission device based on the binder mechanism, including:

[0069] Step 1: Create a reuse mechanism for the binder communication module.

[0070] In this embodiment, step 1 includes:

[0071] Step 101: Create a target namespace, which is a separate namespace corresponding to each security container;

[0072] In practice, the target namespace is created using the create_new_namespaces() function.

[0073] By creating a separate namespace for each secure container, the interactive processes running within them do not interfere with each other, thus improving system stability.

[0074] Step 102: Encapsulate the global variables of the entity node and the global variable of UID corresponding to Service Manager in the binder driver into local variables associated with the target namespace;

[0075] Step 103: Associate the process information record structure binder_proc with the target namespace;

[0076] Step 104: Register a Service Manager for each security container;

[0077] Step 105: The Service Manager stores the names of the registered interactive processes in the service list related to the target namespace.

[0078] Step 2: The binder communication module starts the binder service and establishes a binder port connection between the interaction process and the send / receive process.

[0079] In this embodiment, the process of enabling the binder service by the binder communication module includes:

[0080] Step 201: Port the binder driver, service manager, and binder library from Android to the Linux system.

[0081] The binder driver operates in the Linux kernel space and is responsible for establishing binder communication between processes so that data can be transferred between them.

[0082] The binder library includes binder function interfaces corresponding to various functions involved in the interaction process, and each binder function interface implements a specific function.

[0083] Step 202: Open the binder driver file and create a process information record structure binder_proc in the kernel space.

[0084] Step 203: Set the binder driver context manager.

[0085] Step 204: Start the loop to detect service requests in real time.

[0086] Step 3: The interactive process receives the interactive instructions input from the interactive interface and sends them to the parameter conversion module.

[0087] Step 4: The parameter conversion module obtains the first preset type parameter in the interaction instruction and converts it into the second preset type parameter.

[0088] In this embodiment, step 4 includes: the parameter conversion module obtains a first preset type parameter by parsing the main function in the interactive instruction.

[0089] In this embodiment, the first preset type parameter is an argv parameter, and the second preset type parameter is an int parameter.

[0090] In this embodiment, step 4 includes: the parameter conversion module converts the argv parameter into an int type parameter according to the ASCII encoding rules.

[0091] In this embodiment, the int type parameter is a hex type parameter.

[0092] Step 5: The parameter conversion module loads the second preset type parameter into a vector type container.

[0093] In this embodiment, the vector type container is implemented in C++.

[0094] Step 6: The send / receive module transmits the vector container to the send / receive process via the binder mechanism.

[0095] Step 7: The sending and receiving process converts the second preset type parameter in the vector container into a level signal that the communication module can recognize and then sends it to the communication module.

[0096] Step 8: The communication module sends the level signal to the target device through a predetermined communication protocol.

[0097] In specific implementation, the communication protocol is adapted to the communication module, such as UART, I2C protocol, etc.

[0098] Example 3

[0099] Unlike Example 2, this example further includes the following after step 2:

[0100] Step 21: Register the callback function for death notification in the binder communication module.

[0101] The process after step 7 also includes:

[0102] Step 71: The binder communication module determines whether the connection between the binder port of the interaction process and the sending and receiving process is broken. If yes, proceed to the next step; otherwise, return to step 3.

[0103] In this embodiment, step 71 includes: determining whether the connection of the binder port between the interactive process and the sending / receiving process is broken by using the binder.isBinderAlive() method.

[0104] Step 72: The binder communication module calls back the death notification to reconnect.

[0105] In this embodiment, step 72 includes:

[0106] Reconnection is achieved through the onServiceDisconnected callback.

[0107] The above-disclosed embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Therefore, any equivalent variations made in accordance with the claims of the present invention are still within the scope of the present invention.

Claims

1. A data transmission device based on the binder mechanism, characterized in that, include: The system includes several secure containers and a binder communication module connected thereto, as well as a transceiver module, a transceiver process, and a communication interface connected in sequence. The transceiver module is also connected to the binder communication module. The secure container, transceiver module, and transceiver process are located at the application layer, the binder communication module is located at the kernel layer, and the communication interface is located at the physical layer. The plurality of security containers are used to isolate each interaction process, and each security container includes an interaction process and a parameter conversion module; The interaction process is used to receive interaction commands input from the interactive interface and forward them to the parameter conversion module, or to receive parameters converted by the parameter conversion module and send them to the interactive interface for display. The parameter conversion module is used to convert the received first preset type parameter into a second preset type parameter, that is, to convert the argv parameter into an int type parameter; The transceiver module is used to send the second preset type parameter to the transceiver process through the corresponding binder port; The transceiver process is used to convert the second preset type parameter into a level type that the communication module can recognize and then send it to the communication module, or to receive data from the communication module and convert it into the second preset type parameter; The communication module is used to provide a communication hardware interface to the outside world; The binder communication module is set in the Linux system kernel layer. It is used to open the binder service, provide IPC communication for the interaction process and the sending and receiving process, and register a callback function for death notification.

2. The data transmission device based on the binder mechanism according to claim 1, characterized in that, The communication module has a UART and I2C interface.

3. A method for implementing a data transmission device based on the binder mechanism, characterized in that, include: Step 1: Create a reuse mechanism for the binder communication module; Step 2: The binder communication module starts the binder service and establishes a binder port connection between the interaction process and the send / receive process. Step 3: The interactive process receives the interactive instructions input from the interactive interface and sends them to the parameter conversion module; Step 4: The parameter conversion module obtains the first preset type parameter in the interaction command and converts it into the second preset type parameter; Step 5: The parameter conversion module loads the second preset type parameter into a vector type container; Step 6: The send / receive module transmits the vector container to the send / receive process via the binder mechanism; Step 7: The transmitting and receiving process converts the second preset type parameter in the vector container into a level signal that the communication module can recognize and then sends it to the communication module; Step 8: The communication module sends the level signal to the target device through a predetermined communication protocol; The binder communication module enables the binder service by: Step 201: Port the binder driver, service manager, and binder library from Android to the Linux system; Step 202: Open the binder driver file and create a process information record structure binder_proc in the kernel space; Step 203: Set the binder driver context manager; Step 204: Start the loop to detect service requests in real time; Step 4 includes: the parameter conversion module converts the argv parameter into an int type parameter according to the ASCII encoding rules.

4. The implementation method of the data transmission device based on the binder mechanism according to claim 3, characterized in that, Step 1 includes: Step 101: Create a target namespace, which is a separate namespace corresponding to each security container; Step 102: Encapsulate the global variables of the entity node and the global variable of UID corresponding to Service Manager in the binder driver into local variables associated with the target namespace; Step 103: Associate the process information record structure binder_proc with the target namespace; Step 104: Register a Service Manager for each security container; Step 105: The Service Manager stores the names of the registered interactive processes in the service list related to the target namespace.

5. The implementation method of the data transmission device based on the binder mechanism according to claim 3, characterized in that, Step 4 includes: the parameter conversion module obtains the first preset type parameter by parsing the main function in the interactive instruction.

6. The implementation method of the data transmission device based on the binder mechanism according to claim 3, characterized in that, Following step 2, the following is also included: Step 21: Register the callback function for death notification in the binder communication module; The process after step 7 also includes: Step 71: The binder communication module determines whether the connection of the binder port between the interaction process and the sending and receiving process is broken. If yes, proceed to the next step; otherwise, return to step 3. Step 72: The binder communication module calls back the death notification to reconnect.

Citation Information

Patent Citations

  • Process debugging method and device based on virtual file system and computer equipment

    CN109491759A

  • Multiplexing method and device of inter-process communication IPC mechanism based on binder driving

    CN111339541A