Methods for establishing data transmission channels, terminal systems, and storage media

By setting up a communication interface program on the terminal device and establishing a data transmission channel using inter-process and inter-device communication mechanisms, the problems of cumbersome structure and high development cost of distributed applications are solved, and development is simplified, portability and security are improved.

CN114077502BActive Publication Date: 2026-04-03HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-14
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In existing technologies, distributed applications need to implement their own business logic and communication between devices, resulting in cumbersome program structures, high development costs, and poor compatibility and portability.

Method used

By setting up a communication interface program on the terminal device, cross-device communication can be achieved. The application does not need to directly handle communication tasks, and data transmission channels are established by utilizing inter-process and inter-device communication mechanisms.

Benefits of technology

It simplifies the application development process, reduces labor costs, improves portability and communication method independence, avoids redundant development of communication modules, saves system resources, and improves the security of business data transmission and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114077502B_ABST
    Figure CN114077502B_ABST
Patent Text Reader

Abstract

This application provides a method for establishing a data transmission channel, a terminal system, and a computer-readable storage medium. The method for establishing a data transmission channel includes: a first application sending a device connection request to a first communication interface program in a first terminal to establish an inter-device communication channel for connecting the first terminal and a second terminal; at least based on the successful establishment of the inter-device communication channel, the first application and the first communication interface program establish a first inter-process communication channel based on an inter-process communication mechanism, and the second communication interface program and the second application establish a second inter-process communication channel based on an inter-process communication mechanism, so that the first inter-process communication channel, the inter-device communication channel, and the second inter-process communication channel together form a data transmission channel between the first application and the second application. Through the embodiments of this application, the setup of a communication module in a distributed application can be simplified or eliminated, thereby reducing the human resource cost of program development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a method for establishing a data transmission channel, a terminal system, and a computer-readable storage medium. Background Technology

[0002] With the widespread adoption of various smart terminal devices, more and more cross-device distributed applications have emerged. Distributed applications include applications located on different terminals. These applications exchange business data through inter-device communication channels, and then collaborate to complete a task.

[0003] To enable communication between devices, existing technologies typically include not only business modules for implementing their own functions but also communication modules for facilitating inter-device communication. This results in a complex program structure and requires significant human resources for development. Summary of the Invention

[0004] Some embodiments of this application provide a method for establishing a data transmission channel, a terminal system, and a computer-readable storage medium. The following describes this application from multiple aspects, and the embodiments and beneficial effects of the following aspects can be referred to each other.

[0005] In a first aspect, embodiments of this application provide a method for establishing a data transmission channel, used to establish a data transmission channel between a first application on a first terminal and a second application on a second terminal; the method includes: the first application sending a device connection request to a first communication interface program on the first terminal, the device connection request being used to instruct the first communication interface program to establish an inter-device communication channel for connecting the first terminal and the second terminal; the first communication interface program establishing a communication connection with a second communication interface program on the second terminal based on an inter-device communication protocol, thereby establishing an inter-device communication channel; at least based on the successful establishment of the inter-device communication channel, the first application and the first communication interface program establishing a first inter-process communication channel based on an inter-process communication mechanism, and the second communication interface program and the second application establishing a second inter-process communication channel based on an inter-process communication mechanism, so that the first inter-process communication channel, the inter-device communication channel, and the second inter-process communication channel together form a data transmission channel between the first application and the second application.

[0006] According to the embodiments of this application, the application on the terminal does not need to directly implement cross-device communication. Instead, the task of cross-device communication is delegated to the communication interface program on the terminal. In this way, the application can simplify the setup or eliminate the need for a communication module, thereby reducing the manpower cost of program development. In addition, the embodiments of this application can also reduce the correlation between the application and the communication methods supported by the terminal, thereby improving the portability of the application.

[0007] In some implementations, at least based on the successful establishment of the inter-device communication channel, the first application and the first communication interface program establish a first inter-process communication channel based on an inter-process communication mechanism, and the second communication interface program and the second application establish a second inter-process communication channel based on an inter-process communication mechanism, including: at least based on the successful establishment of the inter-device communication channel, the first application and the first communication interface program establish the first inter-process communication channel; the first communication interface program transmits a message indicating that the first inter-process communication channel has been established to the second communication interface program; in response to receiving the message indicating that the first inter-process communication channel has been established, the second communication interface program and the second application establish the second inter-process communication channel.

[0008] According to the implementation of this application, the first inter-process communication channel is an actively created inter-process communication channel. After the first inter-process communication channel is successfully created, the creation of the second inter-process communication channel is triggered.

[0009] In some implementations, the first communication interface program transmits a message indicating that the first inter-process communication channel has been established to the second communication interface program, further including: the message indicating that the first inter-process communication channel has been established transmitted from the first communication interface program to the second communication interface program includes a first channel number; the first channel number is a channel number assigned by the first communication interface program to the first inter-process communication channel for unique identification of the first inter-process communication channel.

[0010] In some implementations, the second communication interface program assigns a second channel number to the second inter-process communication channel according to the first channel number and a predetermined numbering rule. The second channel number is a channel number used to uniquely identify the second inter-process communication channel.

[0011] In some implementations, the numbering rules are set such that the first channel number and the second channel number have different parity, and that there is a set difference between the first channel number and the second channel number.

[0012] According to the embodiments of this application, when there are both actively created virtual channels and passively created virtual channels in the terminal, the problem of channel number conflict may be avoided.

[0013] In some implementations, the difference is set to 1.

[0014] In some implementations, the method further includes: a first terminal sending a device trust request to a second communication interface program of a second terminal through a first communication interface program, so that the second access interface program can perform trust authentication on the first terminal; and, based on the determination that the second communication interface program has passed the trust authentication of the first terminal, a first application program establishes a first inter-process communication channel with the first communication interface program, and the second communication interface program establishes a second inter-process communication channel with the second application program.

[0015] According to the embodiments of this application, the security of business data transmission can be improved.

[0016] In some implementations, the device trust request sent by the first terminal to the second terminal includes the user account information of the first terminal; the second terminal performs trust authentication on the first terminal, including: a second communication interface program determining whether the user account information of the first terminal is the same as the user account information of the second terminal; if the user account information of the first terminal is the same as the user account information of the second terminal, the second communication interface program passes the trust authentication of the first terminal; if the user account information of the first terminal is different from the user account information of the second terminal, the second communication interface program obtains the trust authentication information from the first terminal to determine whether to pass the trust authentication of the first terminal based on the trust authentication information.

[0017] In some implementations, the method further includes: a first communication interface program sending a first key to a second communication interface program via an inter-device communication channel, the first key being used to encrypt data sent from the second application to the first application; and / or, the second communication interface program sending a second key to the first communication interface program via an inter-device communication channel, the second key being used to encrypt data sent from the first application to the second application.

[0018] According to the embodiments of this application, the security of business data transmission can be improved.

[0019] In some implementations, the first key or the second key is the public key in an asymmetric key pair.

[0020] In some implementations, the device connection request sent by the first application to the first communication interface program includes the communication address information of the second terminal; the method further includes: the first application sending a device discovery request to the first communication interface program; in response to receiving the device discovery request, the first communication interface program activating the device scanning function of the first terminal to obtain device information of at least one candidate connection terminal of the first terminal, the device information of the candidate connection terminal including at least the communication address information of the candidate connection terminal, and the at least one candidate connection terminal including the second terminal; the first communication interface program sending the device information of at least one candidate connection terminal to the first application; the first application determining the device information of the second terminal based on the device information of the at least one candidate connection terminal, and determining the content of the device connection request based on the device information of the second terminal; according to the content, the first application sending a device connection request to the first communication interface program in the first terminal.

[0021] In some implementations, the device information of the candidate connection terminal device may also include the device identification information of the candidate connection terminal, the communication connection methods supported by the candidate connection terminal, the version of the operating system of the candidate connection terminal, and / or the list of applications supported by the candidate connection terminal.

[0022] In some implementations, the method further includes: a first communication interface program assigning a device number to each candidate connection terminal to uniquely identify each candidate connection terminal.

[0023] In some implementations, the second communication interface program stores an application registration list, which includes the application identifier of the second application. The second communication interface program and the second application establish a second inter-process communication channel based on an inter-process communication mechanism, including: the second communication interface program receiving the application identifier of the first application sent by the first communication interface program, and determining, based on the application identifier of the first application and the application registration list, that the second application is an application used to interact with the first application; based on the determination that the second application is an application used to interact with the first application, the second communication interface program establishes a second inter-process communication channel with the second application.

[0024] In some embodiments, the method is further used to establish a data transmission channel between a third application of a first terminal and a fourth application of a second terminal. The method further includes: the third application sending a device connection request to a first communication interface program to determine that the inter-device communication channel has been established based on the reply message from the first communication interface program; at least based on the determination that the inter-device communication channel has been established, the third application and the first communication interface program establish a third inter-process communication channel based on an inter-process communication mechanism, and trigger the second communication interface program and the fourth application to establish a fourth inter-process communication channel based on an inter-process communication mechanism, so that the third inter-process communication channel, the inter-device communication channel, and the fourth inter-process communication channel together form a data transmission channel between the third application and the fourth application.

[0025] According to the embodiments of this application, multiple communication applications on the terminal can communicate with the peer device through the communication interface program, which can avoid the repeated development of communication modules by each application and avoid duplication and waste of development work.

[0026] In some implementations, the first communication interface program determines the transmission order of service data for the first application and service data for the third application in the inter-device communication channel based on the priority level of the first application and the priority level of the third application.

[0027] According to the embodiments of this application, the communication interface program can conveniently manage the transmission priority of each application, giving priority to the transmission of business data with high real-time requirements, thereby improving the user experience.

[0028] In some implementations, the priority level of the first application is determined by the first application or by the first communication interface program; or, the priority level of the third application is determined by the third application or by the first communication interface program.

[0029] In some implementations, the inter-process communication mechanism is a pipe communication mechanism.

[0030] In some implementations, the device communication protocol is any of the following: local area network communication protocol; Bluetooth communication protocol; Wi-Fi P2P communication protocol.

[0031] Secondly, embodiments of this application provide a terminal system, including a first terminal and a second terminal. The first terminal is used to execute the steps performed by the first terminal in any embodiment of the method provided in the first aspect of this application, and the second terminal is used to execute the steps performed by the second terminal in any embodiment of the method provided in the first aspect of this application. The beneficial effects achievable in this second aspect can be referred to the beneficial effects of the method provided in any embodiment of the first aspect, and will not be repeated here.

[0032] Thirdly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method provided in any embodiment of the first aspect of this application. The beneficial effects achievable through this third aspect can be referenced to the beneficial effects of the method provided in any embodiment of the first aspect, and will not be repeated here. Attached Figure Description

[0033] Figure 1 This is a schematic diagram illustrating an application scenario for an embodiment of this application;

[0034] Figure 2 This is a diagram of the application module structure of existing technology;

[0035] Figure 3 Schematic diagram of the data transmission channel provided in the embodiments of this application Figure 1 ;

[0036] Figure 4 This is another application scenario provided by the embodiments of this application;

[0037] Figure 5 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application;

[0038] Figure 6 The software architecture diagram of the terminal device provided in the embodiments of this application;

[0039] Figure 7 The flow of the data transmission channel establishment method provided in the embodiments of this application Figure 1 ;

[0040] Figure 8a The flow of the data transmission channel establishment method provided in the embodiments of this application Figure 2 ;

[0041] Figure 8b A schematic diagram of the device selection interface provided in the embodiments of this application. Figure 1 ;

[0042] Figure 9a The flow of the data transmission channel establishment method provided in the embodiments of this application Figure 3 ;

[0043] Figure 9b A schematic diagram of the device selection interface provided in the embodiments of this application. Figure 2 ;

[0044] Figure 10a The flow of the data transmission channel establishment method provided in the embodiments of this application Figure 4 ;

[0045] Figure 10bThis is a schematic diagram of the PIN code input interface provided in an embodiment of this application;

[0046] Figure 11a The flow of the data transmission channel establishment method provided in the embodiments of this application Figure 5 ;

[0047] Figure 11b A schematic diagram of the virtual channel numbering method provided in the embodiments of this application;

[0048] Figure 12 The flow of the data transmission channel establishment method provided in the embodiments of this application Figure 6 ;

[0049] Figure 13 Schematic diagram of the data transmission channel provided in the embodiments of this application Figure 2 ;

[0050] Figure 14 A block diagram of a terminal device provided in an embodiment of this application is shown;

[0051] Figure 15 A schematic diagram of the structure of a System on Chip (SoC) provided in an embodiment of this application is shown. Detailed Implementation

[0052] The specific embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0053] This application provides a method for establishing a data transmission channel. Figure 1 An application scenario illustrating an embodiment of this application is shown. (Reference) Figure 1 Users A and B play the online game "Tank Battle" using terminals A and B respectively. To ensure that users A and B can share the same game progress, the "Tank Battle" interfaces on terminals A and B can be synchronized. For example, when user A operates on terminal A (e.g., presses the forward button) to control a game item's action (e.g., moving a tank forward), the "Tank Battle" interface on terminal B can synchronize that action. This allows users on terminals A and B to control the same game through different terminals, thus achieving the purpose of online gaming.

[0054] Figure 1 The online game "Tank Battle" (or "Tank Battle") exemplifies a cross-device distributed application. In the field of terminal technology, applications distributed across different terminals that collaborate to complete a task through data exchange are called "distributed applications."

[0055] Through distributed applications, different terminals can share computing power and peripheral resources, bringing convenience to people's daily lives. For example, screen collaboration applications enable collaborative input and mirroring control between two different terminals (e.g., between a mobile phone and a car infotainment system, or between a tablet and a laptop); smart home interaction applications can build intelligent living scenarios, such as allowing users to use their mobile phones as input peripherals for smart screens (i.e., using the mobile phone as a keyboard for the smart screen); and distributed file storage applications enable cross-device storage of massive amounts of files.

[0056] Cross-device distributed applications rely on data interaction to achieve collaboration, and this data interaction is achieved through communication connections between terminals. In existing technologies, to achieve collaboration between distributed applications, each distributed application's program modules include not only business modules for implementing its own business logic but also communication modules for enabling inter-device communication.

[0057] by Figure 1 Taking the game application "Tank Battle" as an example, the functions implemented by the business module in the existing technology of "Tank Battle" include: setting game levels, creating and destroying in-game items (e.g., tanks, bullets, etc.), controlling the actions of items (e.g., controlling the tank to move forward when the user presses the forward button), and calculating player scores. The functions of the communication module include: discovering the other end device through device scanning when the game starts (…). Figure 1 In this process, terminal A's peer device is terminal B, and after discovering the peer device, it establishes a data connection with the "Tank Battle" application on the peer device; during the game, it sends the game status information (such as the tank's position, the frequency and type of bullets fired by the tank, the player's score, etc.) to the peer device so that the "Tank Battle" application on the peer device can update the game interface in real time.

[0058] In other words, in existing technologies, distributed applications, besides implementing their own business logic, also involve numerous details of inter-device communication. This makes the program structure quite complex and the development process costly in terms of manpower. Furthermore, to utilize local communication functions for inter-device communication, the communication module of the distributed application is configured to match the communication method of the local terminal (for example, when the local terminal supports WiFi P2P communication, the communication module of the distributed application is configured to implement WiFi P2P communication). However, the communication methods supported by different terminals may vary, resulting in poor compatibility and portability of distributed applications.

[0059] In addition, in some scenarios, a terminal device may have multiple distributed applications. Figure 2This illustrates the communication methods between distributed applications in this scenario in the prior art. (Reference) Figure 2 Terminal A has distributed applications A1, A2, and A3, while terminal B has distributed applications B1, B2, and B3, which are paired with A1, A2, and A3, respectively. Each application includes a business module and a communication module. Applications exchange data with applications on the other end of the device through their own communication modules (for example, application A1 exchanges data with application B1 through its own communication module). This means that each distributed application needs to develop its own separate communication module, resulting in duplication and waste of development effort.

[0060] To address this issue, this application provides a method for establishing a data transmission channel. In this embodiment, the terminal device includes a communication interface program for cross-device communication. When a distributed application on the terminal needs to interact with a paired application on a peer device, cross-device communication is achieved through this communication interface program on the terminal, rather than through its own communication module.

[0061] by Figure 1 The method provided in this application is illustrated using the game application "Tank Battle" as an example. However, it is understood that this application can also be applied to other distributed applications. Furthermore, for ease of description, the "Tank Battle" application on terminal A will be referred to as "Tank Battle A" and the "Tank Battle" application on terminal A will be referred to as "Tank Battle B".

[0062] When "Tank Battle A" needs to establish a service connection with "Tank Battle B", Tank Battle A first sends a device connection request to the communication interface program A (referred to as "Interface A" or "First Communication Interface Program" in this document) in terminal A. After receiving the device connection request from Tank Battle A, Interface A establishes an inter-device communication channel (also known as a "physical channel") with the communication interface program B (referred to as "Interface B" or "Second Communication Interface Program" in this document) based on the inter-device transmission protocol. After the physical channel is successfully established, Interface A and Application A establish a cross-process communication channel (referred to as "Virtual Channel A" or "First Inter-Process Communication Channel" in this document) based on the inter-process communication mechanism, and Interface B and Application B establish another cross-process communication channel (referred to as "Virtual Channel B" or "Second Inter-Process Communication Channel" in this document) based on the inter-process communication mechanism. Thus, as... Figure 3 As shown, data is transmitted from left to right from "Tank Battle A" on terminal A, sequentially through virtual channel A, physical channel, and virtual channel B to "Tank Battle B". Virtual channel A, physical channel, and virtual channel B together form a data transmission channel P for connecting Tank Battle A and Tank Battle B, enabling data interaction between Tank Battle A and Tank Battle B.

[0063] In this embodiment, the distributed application on the terminal does not need to directly implement cross-device communication. Instead, the task of cross-device communication is delegated to the communication interface program on the terminal. This simplifies the setup of the distributed application or eliminates the need for a communication module, thereby reducing the manpower cost of program development. Furthermore, this embodiment can reduce the dependence between the distributed application and the communication methods supported by the terminal, thus improving the portability of the distributed application.

[0064] Although the above describes a scenario where two terminal devices each have one distributed application, the implementation method of this application can also be applied to scenarios where a terminal device has multiple distributed applications. (Reference) Figure 4 In this embodiment, terminal A has distributed applications A1, A2, and A3, and terminal B has distributed applications B1, B2, and B3, which are paired with distributed applications A1, A2, and A3, respectively. Each distributed application communicates with its paired application on the peer device through a communication interface program on the terminal. For example, when application A1 in terminal A needs to communicate with application B1 in terminal B, application A1 first transmits business data to interface A through a virtual channel (i.e., an inter-process communication channel), then interface A transmits the business data to interface B through a physical channel (i.e., an inter-device communication channel), and finally interface B transmits the business data to application B1 through a virtual channel. This embodiment avoids the need for redundant development of communication modules for each distributed application, thus preventing duplication and waste of development work.

[0065] In addition, through Figure 4 As illustrated, this application can also save communication resources (e.g., port number resources) in the terminal. Specifically, since this application can realize cross-device communication between multiple applications through a single physical channel (the operating system only needs to allocate a port number for this physical channel), compared with existing technologies (such as... Figure 2 As shown, each application establishes its own physical channel (the operating system needs to allocate a port number for each physical channel), which can save port number resources in the system.

[0066] Furthermore, since multiple applications in the terminal communicate across devices through the communication interface program, the communication interface program can easily manage the transmission priority of each application, prioritizing the transmission of business data with high real-time requirements and improving the user experience.

[0067] The above describes the application scenarios of the embodiments of this application using distributed applications as an example. However, it is understood that the embodiments of this application can also be applied to other communication applications besides distributed applications, such as email applications, browser applications, map applications, weather applications, etc.

[0068] This application does not limit the specific types of terminal devices (terminal A and terminal B). Terminal devices can be portable computers, tablets, mobile phones, wearable electronic devices (such as watches, head-mounted devices, etc.), portable media players, e-book reading devices, industrial control equipment, streaming media client devices, etc.

[0069] Terminal A and Terminal B can be the same type of device (e.g., both are mobile phones) or different types of devices (e.g., Terminal A is a mobile phone and Terminal B is a tablet). Furthermore, Terminal A and Terminal B can be devices belonging to the same user or devices belonging to different users.

[0070] It is understood that terminal A and terminal B should be peer devices, meaning that terminal A and terminal B should support at least one common communication method (e.g., both terminal A and terminal B support WiFi P2P communication). Based on this, this application does not limit the actual communication method between terminal A and terminal B. Terminal A and terminal B can communicate using a single communication method, such as Bluetooth, a local area network (wired or wireless), or a cellular network; or they can communicate using multiple communication methods, for example, application A1 of terminal A and application B1 of terminal B can communicate via Bluetooth, and application A2 of terminal A and application B2 of terminal B can communicate via a local area network; different communication methods can also be used at different stages of the service connection, such as Bluetooth communication during the device discovery stage and WiFi P2P communication (Huawei Share) during the service data transmission stage. TM (Communication method used).

[0071] Figure 5 A schematic diagram of the structure of a terminal device 100 provided in an embodiment of this application is shown. The terminal device 100 can be implemented as terminal A or terminal B.

[0072] Terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) connector 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0073] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the terminal device 100. In other embodiments of this application, the terminal device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0074] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.

[0075] The processor can generate operation control signals based on the instruction opcode and timing signals to control the instruction fetching and execution.

[0076] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0077] In some embodiments, the processor 110 may include one or more interfaces. These interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, and a subscriber identity module (SIM) interface.

[0078] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C buses. The processor 110 can couple to the touch sensor 180K, charger, flash, camera 193, etc., through different I2C bus interfaces. For example, the processor 110 can couple to the touch sensor 180K through the I2C interface, enabling the processor 110 and the touch sensor 180K to communicate through the I2C bus interface, thereby realizing the touch function of the terminal device 100.

[0079] The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface to enable the function of answering phone calls through a Bluetooth headset.

[0080] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via the PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering phone calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0081] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface to enable music playback through Bluetooth headphones.

[0082] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI) and a display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to enable the shooting function of the terminal device 100. The processor 110 and the display screen 194 communicate via the DSI interface to enable the display function of the terminal device 100.

[0083] The GPIO interface can be configured via software. It can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to a camera 193, a display screen 194, a wireless communication module 160, an audio module 170, a sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0084] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the terminal device 100. In other embodiments of this application, the terminal device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0085] USB connector 130 is a USB standard-compliant connector used to connect terminal device 100 to peripheral devices. Specifically, it can be a standard USB connector (e.g., Type-C), Mini USB, Micro USB, etc. USB connector 130 can be used to connect a charger to charge terminal device 100, and can also be used for data transfer between terminal device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This connector can also be used to connect other electronic devices, such as AR devices. In some implementations, processor 110 can support Universal Serial Bus (USB), with standards such as USB 1.x, USB 2.0, USB 3.x, and USB 4.

[0086] The wireless communication function of the terminal device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0087] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.

[0088] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the terminal device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0089] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.

[0090] The wireless communication module 160 can provide solutions for wireless communication applications on the terminal device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0091] In some embodiments, antenna 1 of terminal device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling terminal device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0092] Terminal device 100 implements display functions through a GPU, display screen 194, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0093] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, terminal device 100 may include one or N displays 194, where N is a positive integer greater than 1.

[0094] Terminal device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0095] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0096] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the terminal device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0097] A digital signal processor (DSP) is used to process digital signals. Besides digital image signals, it can also process other digital signals. For example, when terminal device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.

[0098] Video codecs are used to compress or decompress digital video. Terminal device 100 may support one or more video codecs. Thus, terminal device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG 2, MPEG 3, MPEG 4, etc.

[0099] NPU stands for Neural Network (NN) Computing Processor. By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in terminal devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0100] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the terminal device 100. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.

[0101] Internal memory 121 can be used to store computer executable program code, which includes instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of terminal device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications and data processing of terminal device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory located in the processor. Terminal device 100 may be implemented as terminal A or terminal B. When the terminal device 100 is implemented as terminal A, the instructions stored in the internal memory 121 may include: instructions that, when executed by at least one of the processors, cause the terminal device 100 to perform the steps performed by terminal A in the method for establishing a data transmission channel provided in the embodiments of this application; when the terminal device 100 is implemented as terminal B, the instructions stored in the internal memory 121 may include: instructions that, when executed by at least one of the processors, cause the terminal device 100 to perform the steps performed by terminal B in the method for establishing a data transmission channel provided in the embodiments of this application.

[0102] The software system of terminal device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses a layered architecture system as an example to exemplify the software structure of terminal device 100.

[0103] Figure 6 This is a software structure block diagram of the terminal device 100 according to an embodiment of the present invention.

[0104] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0105] The application layer can include a series of application packages.

[0106] like Figure 6 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, SMS, and tank battle.

[0107] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0108] like Figure 6 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, communication interface program, etc. The communication interface program provides an interface for cross-device communication for one or more communication applications (e.g., a gallery application, a tank battle application) in the terminal device 100, and is used to establish virtual channels with the communication applications. When the terminal device 100 is implemented as terminal A, the communication interface program is implemented as interface A provided in this embodiment; when the terminal device 100 is implemented as terminal A, the communication interface program is implemented as interface B provided in this embodiment.

[0109] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.

[0110] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.

[0111] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0112] The phone manager is used to provide communication functions for terminal device 100. For example, it manages call status (including connection, hang-up, etc.).

[0113] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0114] The Android Runtime consists of core libraries and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.

[0115] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.

[0116] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0117] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

[0118] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0119] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

[0120] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0121] A 2D graphics engine is a graphics engine for 2D drawing.

[0122] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.

[0123] Example 1

[0124] The following is Figure 1 Taking the scenario shown (user A and user B playing the online game "Tank Battle" via terminal A (as the first terminal) and terminal B (as the second terminal) as an example, this application provides a specific embodiment. In this embodiment, "Tank Battle A (as the first application)" is used as the application that initiates the connection, and "Tank Battle B (as the second application)" is used as the application that accepts the connection.

[0125] refer to Figure 7 In order to establish such Figure 3 The data transmission channel P shown in this embodiment, and the method for establishing the data transmission channel P provided in this embodiment, include the following stages:

[0126] S110: Device discovery phase. Terminal A activates the device scanning function to discover Terminal B and obtain Terminal B's communication address information.

[0127] S120: Physical channel establishment phase. Based on the obtained communication address information of terminal B, terminal A and terminal B establish a physical channel (as an inter-device communication channel).

[0128] S130: Device Trust Granting Phase. To improve the security of business data transmission, Terminal B performs trust authentication on Terminal A and determines whether to establish a further connection with Terminal A (i.e., whether to establish the virtual channel in step S500) based on the trust authentication result.

[0129] S140: Key exchange phase. Terminal A and Terminal B exchange keys used to encrypt business data to further improve the security of business data transmission.

[0130] S150: Virtual Channel Establishment Stage. Based on the successful establishment of the physical channel in step S200, and based on the authentication of terminal B to terminal A in step S300, Tank Battle A establishes virtual channel A (as the first inter-process communication channel) with interface A (as the first communication interface program), and Tank Battle B establishes virtual channel B (as the second inter-process communication channel) with interface B (as the second communication interface program). Virtual channels A and B, together with the physical channel established between interface A and interface B in step S120, form the data transmission channel P between Tank Battle A and Tank Battle B.

[0131] After establishing a data transmission channel P between Tank Battle A and Tank Battle B through the above steps, Tank Battle A and Tank Battle B can transmit business data through the data transmission channel P.

[0132] The specific steps for each stage are explained below.

[0133] refer to Figure 8a The device discovery phase S110 includes the following steps:

[0134] S111: Tank Battle A sends a device discovery request to interface A.

[0135] In response to a user's device discovery command, Tank Battle A sends a device discovery request to Interface A. For example, after User A opens the game application "Tank Battle A" on Terminal A and clicks the "Search Devices" button on the game interface, Tank Battle A sends a device discovery request to Interface A. In this embodiment, Tank Battle A sends the device discovery request to Interface A by calling the Application Programming Interface (API) function startDiscovery() provided by Interface A.

[0136] S112: In response to receiving a device discovery request sent by Tank Battle A, interface A performs device discovery.

[0137] In response to a device discovery request received from Tank Battle A, Interface A activates its device scanning function to obtain device information of candidate connecting terminals. For example, Interface A activates Terminal A's WiFi scanning function to receive WiFi broadcast messages sent by Terminal B. After receiving Terminal B's WiFi broadcast message, Interface A can parse the broadcast message to obtain the device information of Terminal B carried within it.

[0138] In this embodiment, interface A can enable multiple scanning functions of terminal A, such as simultaneously enabling Bluetooth scanning and WiFi scanning functions of terminal A to perform various forms of device discovery.

[0139] The device information of the candidate connection terminal obtained by interface A through device scanning is the device information exposed to the outside world by the candidate connection terminal. For example, the device information exposed to the outside world by the candidate connection terminal through broadcast (e.g., WiFi broadcast, Bluetooth broadcast, LAN broadcast, etc.).

[0140] The device information of the candidate connection terminal includes at least the communication address information of the candidate connection terminal, such as the network address information (e.g., IP address, port number) and the physical address information (e.g., MAC address) of the candidate connection terminal. In this way, interface A can establish a communication connection with the candidate connection terminal based on the obtained communication address information of the candidate connection terminal.

[0141] In some embodiments, the device information of the candidate connection terminal includes the device identification information of the candidate connection terminal, such as the device name of the candidate connection terminal, the username of the candidate connection terminal, etc., so as to facilitate the user to identify the candidate connection terminal.

[0142] In some embodiments, the device information of the candidate connection terminal device may also include the communication connection methods supported by the candidate connection terminal, a list of applications supported by the candidate connection terminal, etc., so as to facilitate the user to select the candidate connection terminal from the candidate connection terminals to establish a connection.

[0143] In some embodiments, the device information of the candidate connection terminal also includes the version of the operating system of the candidate connection terminal. The user can determine the version of the communication interface program of the candidate connection terminal (e.g., interface B of terminal B) based on the version of the operating system of the candidate connection terminal, so as to determine whether the version of the communication interface program of the user terminal is compatible with the version of the communication interface program of the candidate connection terminal (usually backward compatible).

[0144] In some embodiments, interface A assigns a device number to each candidate connection terminal to uniquely identify each candidate connection terminal (e.g., interface A assigns numbers to candidate connection terminals in the order they are discovered) so as to identify each candidate connection terminal during subsequent communication connection processes.

[0145] S113: Interface A sends the device discovery result to Tank Battle A.

[0146] Interface A sends the device information of the candidate connection terminals discovered in step S112 to Tank Battle A. Specifically, Interface A sends the device information of the candidate connection terminals to Tank Battle A through the callback function registered in startDiscovery() of Tank Battle A.

[0147] After receiving the device information of the candidate connection terminals sent by interface A, Tank Battle A generates a device selection interface, through which users can select the candidate connection terminals they wish to establish a connection with.

[0148] Figure 8b The device selection interface generated by Tank Battle A in this embodiment includes device identification information (e.g., the device name of the candidate connection terminal "Nova4") and supported communication connection methods (e.g., WiFi P2P, Bluetooth) for the three candidate connection terminals discovered in step S112.

[0149] In other embodiments, the device selection interface may also display other device information for the candidate connection terminal, such as the operating system version number and a list of supported applications.

[0150] The device discovery phase S110 is used to discover candidate connection terminals that can establish a communication connection and to obtain the device information of the candidate connection terminals. After obtaining the device information of the candidate connection terminals, the method provided in this embodiment enters the physical channel establishment phase S120.

[0151] Reference Figure 9a The physical channel establishment phase S120 provided in this embodiment includes the following steps:

[0152] S121: Tank Battle A sends a device connection request to interface A. The device connection request is used to instruct interface A to establish a physical channel for connecting terminal A and terminal B.

[0153] refer to Figure 9b The user selects Nova4 (corresponding to terminal B in this embodiment) as the candidate terminal to establish a connection on the device selection interface, and the desired communication method is WiFi P2P. In response to the user's selection, Tank Battle A sends a device connection request to interface A, instructing interface A to establish a physical channel for connecting terminal A and terminal B via the WiFi P2P communication protocol. In this embodiment, Tank Battle A sends a device discovery request to interface A by calling the Application Programming Interface (API) function connect() provided by interface A.

[0154] The device connection request sent by Tank Battle A to Interface A includes the communication address information and / or device number of Terminal B, so that Interface A can establish a communication connection with Interface B based on the received device connection request.

[0155] S122: Interface A establishes a communication connection with Interface B based on the inter-device communication protocol to establish a physical channel for connecting Terminal A and Terminal B.

[0156] After receiving the device connection request sent by Tank Battle A, Interface A establishes a device communication connection with Interface B through the WiFi P2P protocol, thus completing the creation of the physical channel.

[0157] In this embodiment, interface A and interface B establish a communication connection based on the WiFi P2P communication protocol. However, this application is not limited to this. In other embodiments, interface A and interface B may also establish a communication connection based on other inter-device communication protocols, such as local area network communication protocols, Bluetooth communication protocols, etc.

[0158] After establishing a physical channel between terminal A and terminal B, terminal B performs authentication on terminal A to ensure the security of subsequent business data transmission.

[0159] refer to Figure 10a The device trust granting stage S130 provided in this embodiment includes the following steps:

[0160] S131: Interface A sends a device authorization request to interface B through a physical channel. The device authorization request includes the user account information of terminal A.

[0161] S132: Interface B determines whether the received user account information of terminal A is consistent with the user account information of terminal B. If they are consistent, then terminal A is authorized and authenticated. If they are inconsistent, then step S133 is executed to further obtain the authorization and authentication information of terminal A, thereby further authenticating terminal A.

[0162] In other words, the credit granting methods provided in this embodiment are divided into same-account credit granting and different-account credit granting. When the user account information of terminal A and terminal B is consistent, interface B determines that the user of terminal A is the same user as the local machine (i.e., terminal B), and is a secure device. Therefore, the same-account credit granting method is used to grant credit to terminal A, that is, the credit authentication of terminal A is directly passed.

[0163] When the user account information of terminal A and terminal B is inconsistent, interface B determines that terminal A is a device that needs further authentication, and thus uses the different account authorization method to authorize terminal A, that is, determines whether to pass the authorization authentication of terminal A based on the authorization authentication information from terminal A.

[0164] S133: Interface B obtains the trust authentication information from terminal A to determine whether to pass the trust authentication of terminal A.

[0165] In this embodiment, interface B sends a PIN code retrieval request to interface A to trigger interface A to generate a PIN code. Figure 10b The PIN code input interface is shown. Then, interface A sends the user-entered PIN code (as an example of authentication information) to interface B. Upon receiving the PIN code from terminal A, interface B determines whether to pass authentication for terminal A based on the PIN code. For example, if the received PIN code matches the PIN code of terminal B, authentication for terminal A is passed, and an authentication success message is sent to interface A; otherwise, authentication for terminal A is failed.

[0166] In other embodiments, interface A can also authenticate terminal A through other means. For example, the "scan-to-authenticate" method, specifically, terminal A obtains the pairing information (which may be device information of terminal B) included in the QR code by scanning a QR code displayed by terminal B (interface B can be used to generate the QR code). Then, interface A sends the obtained pairing information (as an example of authentication information) to interface B. After receiving the pairing information from interface A, interface B determines whether to authenticate terminal A.

[0167] Furthermore, in this embodiment, at least after terminal A has passed the authentication and trust of interface B, interface A sends a notification of successful physical channel creation to Tank Battle A. For example, interface A sends the notification of successful physical channel creation to Tank Battle A through a callback function registered in connect() of Tank Battle A. However, this application is not limited to this; in some embodiments, interface A sends the notification of successful physical channel creation to Tank Battle A immediately after the physical channel is successfully created.

[0168] The following describes the key exchange phase S140 process provided in this embodiment, specifically:

[0169] Interface A generates a pair of asymmetric keys A, stores the private key of asymmetric key A locally, and sends the public key of asymmetric key A (as the first key) to interface B through a physical channel. In subsequent business data transmission, interface B encrypts the business data sent to interface A using the public key of asymmetric key A, and interface A decrypts the encrypted data received from interface B using the private key stored locally.

[0170] Interface B generates a pair of asymmetric keys B, stores the private key of asymmetric key B locally, and sends the public key of asymmetric key B (as a second key) to interface A through a physical channel. During subsequent business data transmission, interface A encrypts the business data sent to interface B using the public key of asymmetric key A, and interface B decrypts the encrypted data received from interface A using the private key stored locally.

[0171] In this embodiment, the key exchanged between interface A and interface B is the public key in an asymmetric key, which can avoid the transmission of the private key in the communication channel, thereby improving the security of the key.

[0172] However, this application is not limited to this. For example, in other embodiments, interface A may also generate a symmetric key A and send the symmetric key A to interface B through a physical channel.

[0173] The following describes the process of the virtual channel establishment phase S150 provided in this embodiment.

[0174] In the virtual channel establishment phase S150 provided in this embodiment, based on the successful creation of a physical channel for connecting terminal A and terminal B (physical channel establishment phase S120), and based on the authentication of terminal A by interface B (device authentication phase S130), virtual channel A is established between tank battle A and interface A based on an inter-process communication mechanism, and virtual channel B is established between interface B and tank battle B based on an inter-process communication mechanism.

[0175] In this embodiment, the successful creation of a physical channel for connecting terminal A and terminal B, and the authentication of terminal A by interface B, are prerequisites for enabling steps S151 to S155. However, this application is not limited to this; in other embodiments, steps S151 to S155 may be enabled solely based on the successful creation of the physical channel.

[0176] In this embodiment, the inter-process communication mechanism can be a memory sharing mechanism, a socket mechanism, a pipe mechanism, etc. The pipe mechanism will be used as an example for the following description.

[0177] refer to Figure 11a Once a physical channel is successfully created and interface B has passed the authentication of terminal A, the virtual channel establishment phase S150 of this embodiment includes the following steps:

[0178] S151: Tank Battle A and Interface A create a virtual channel A.

[0179] When Tank Battle A needs to send business data to Tank Battle B, Tank Battle A creates a pipe, Pipe A, based on the pipe mechanism. After creating Pipe A, Tank Battle A can obtain the file descriptors (also called "handles") of the two endpoints of Pipe A (PipeA[0] and PipeA[1]). In this paper, the file descriptor of endpoint PipeA[0] is denoted as Afd0, and the file descriptor of endpoint PipeA[1] is denoted as Afd1. According to the pipe mechanism, data can be written to the pipe / read from the pipe by performing write / read operations on the file descriptors of the pipe endpoints.

[0180] After obtaining the file descriptors of the two endpoints of Pipe A, Tank Battle A saves the file descriptor of one endpoint (e.g., file descriptor Afd0 of endpoint Pipe A[0]) and sends the file descriptor of the other endpoint (e.g., file descriptor Afd1 of endpoint Pipe A[1]) to interface A to complete the creation of virtual channel A.

[0181] In this embodiment, Pipe A is created by Tank Battle A, but this application is not limited to this. In another embodiment, Pipe A can also be created by interface A.

[0182] S152: Interface A assigns a channel number to virtual channel A, which is used to uniquely identify virtual channel A.

[0183] S153: Interface A sends a message to Interface B indicating that virtual channel A has been established, thereby triggering the establishment of virtual channel B on the terminal B side. Specifically, Interface A sends the message indicating that virtual channel A has been established to Interface B through the physical channel, and the message carries the channel number of virtual channel A.

[0184] S154: In response to receiving the message that virtual channel A has been established, interface B and Tank Battle B create virtual channel B.

[0185] After receiving the message that virtual channel A has been established, interface B creates pipe PipeB based on the pipe mechanism. After creating pipe PipeB, interface B can obtain the file descriptors (also called "handles") of the two endpoints of pipe PipeB (PipeB[0] and PipeB[1]). In this paper, the file descriptor of endpoint PipeB[0] is denoted as Bfd0, and the file descriptor of endpoint PipeB[1] is denoted as Bfd1.

[0186] After obtaining the file descriptors of the two endpoints of Pipe B, Interface B saves the file descriptor of one endpoint (e.g., file descriptor Bfd0 of endpoint Pipe B[0]) and sends the file descriptor of the other endpoint (e.g., file descriptor Bfd1 of endpoint Pipe B[1]) to Tank Battle B to complete the creation of virtual channel B.

[0187] In this embodiment of the application, the communication interface program (e.g., interface A, interface B) stores an application registration list. The application registration list includes the application identifier (e.g., application name) of the application that has been registered in the communication interface program. The communication interface program can determine the application on the local machine that is used to pair with the application of the peer device (i.e. to perform business interaction) based on the application registration list.

[0188] For example, the application registration list stored in interface B includes the application identifier of Tank Battle B (e.g., the application name of Tank Battle B is "Tank Battle"). Interface B can obtain the application identifier of Tank Battle A from interface A (e.g., the application name of Tank Battle A is "Tank Battle", which can be carried in the message sent by interface A to interface B that virtual channel A has been established). After receiving the application identifier of application A, interface B determines that Tank Battle B is the application paired with Tank Battle A based on the application identifier of application A and the application registration list stored in interface B, and then sends the file descriptor Bfd1 of the endpoint Pipe B[1] of Pipe B to Tank Battle B to establish virtual channel B with Tank Battle B.

[0189] In this embodiment, PipeB is created by interface B, but this application is not limited to this. In another embodiment, PipeB can also be created by Tank Battle B.

[0190] S155: Interface B assigns a channel number to virtual channel B, which is used to uniquely identify virtual channel B.

[0191] Specifically, interface B determines the channel number of virtual channel B based on the channel number of virtual channel A and a predetermined numbering rule. For the sake of clarity, the numbering rule will be explained in detail below.

[0192] The above describes the method of creating a virtual channel by taking the example of terminal A first establishing a virtual channel A and then triggering terminal B to establish a virtual channel B. However, this application is not limited to this. In other embodiments, terminal B may first establish a virtual channel B and then notify interface A of the established virtual channel B to trigger terminal A to establish a virtual channel A.

[0193] After virtual channel A and virtual channel B are established, virtual channel A, the physical channel, and virtual channel B are sequentially connected to form a data transmission channel P for connecting Tank Battle A and Tank Battle B. Tank Battle A and Tank Battle B can interact with each other based on data transmission channel P. The following example illustrates how Tank Battle A sends data D to Tank Battle B.

[0194] On terminal A: First, Tank Battle A writes data D to pipe Pipe A (by performing a write operation on file identifier Afd0), and interface A reads data D from the other end of pipe Pipe A (by performing a read operation on file identifier Afd1); then, interface A encrypts data D using the public key in asymmetric key B, adds the channel number of virtual channel A to the header of data D, and sends data D to interface B through the physical channel;

[0195] On the terminal B side: After receiving data D, interface B parses out the channel number of virtual channel A carried in the data packet, and encrypts data D using the private key in asymmetric key B; then, interface B writes the decrypted data D into pipe Pipe B, and Tank Battle B reads data D from the other end of pipe Pipe B, thereby realizing the transmission of data B from Tank Battle A to Tank Battle B.

[0196] It should be noted that this embodiment is an exemplary description of the technical solution of this application, and those skilled in the art can make other modifications. For example, in another embodiment, during the device discovery phase, Tank Battle A can discover terminal B through its own program module, rather than through interface A; or, when it is not necessary to encrypt business data, the key exchange phase can be omitted.

[0197] In addition, to achieve concurrent transmission, multiple data transmission channels P can be established between Tank Battle A and Tank Battle B, with each data transmission channel P used to transmit a single file.

[0198] refer to Figure 11bThe Tank Battle A and Tank Battle B systems consist of six data transmission channels P (denoted as channels P1 to P6). The physical channels between these channels P are shared, while the virtual channels are independent. For example, data transmission channel P1 includes a virtual channel A1, a physical channel, and a virtual channel B1 connected in sequence; data transmission channel P2 includes a virtual channel A2, a physical channel, and a virtual channel B2 connected in sequence; and so on for data transmission channels P3 to P6.

[0199] Figure 11b In this context, the active end that initiates the service connection is marked with a solid circle at one end of each data transmission channel P. That is, the virtual channel Tank Battle A in data transmission channels P1, P3, and P5 is initiated and created, and the virtual channel Tank Battle B in data transmission channels P2, P4, and P6 is initiated and created.

[0200] When a terminal has both actively created and passively created virtual channels, channel number conflicts may occur, potentially leading to data transmission errors. For example, Tank Battle A actively creates virtual channel A1, and interface A assigns virtual channel A1 the number 'a'. Later, interface A receives a notification from interface B that terminal B has established virtual channel B2, also numbered 'a'. At this point, Tank Battle A (or interface A) is triggered to establish virtual channel A2. If interface A sets the number of virtual channel A2 to 'a' based on the original number 'a', then the numbering of virtual channel A1 and virtual channel A2 will conflict. Consequently, when interface A receives data from virtual channel B2, it will be unable to determine whether to transmit the data via virtual channel A1 or virtual channel A2.

[0201] Therefore, this application provides a numbering rule for assigning numbers to virtual channels. According to this rule, the numbers of the active (initiating) virtual channel and the passive (passively triggered) virtual channel have different parity, and the numbers of the active and passive virtual channels have a predetermined difference. For example, refer to... Figure 11b (The numbers in parentheses represent the channel numbers of each virtual channel). The numbers of the active virtual channels are all even numbers (2n), and the numbers of the passive virtual channels are odd numbers (2n+1) that are one greater than the active channel number. However, this application is not limited to this. In other embodiments, the difference can be other values, such as +5; or, the numbers of the active virtual channels are odd numbers, and the numbers of the passive virtual channels are even numbers that have a set difference from the active channel number.

[0202] The channel numbering rules provided in this embodiment can effectively avoid virtual channel number conflicts. For example, when interface B receives data with channel number 4, it can be determined that the data comes from a virtual channel actively established by interface A. Since the number of the slave virtual channel is 1 greater than the number of the active channel, interface B should deliver the data to the virtual channel with number "5" (i.e., virtual channel B3). Similarly, when interface B receives data with channel number 5, it can be determined that the data comes from a virtual channel passively established by interface A. Since the number of the active virtual channel is 1 less than the number of the slave channel, interface B should deliver the data to the virtual channel with number "4" (i.e., virtual channel B4).

[0203] In summary, the method for establishing a data transmission channel provided in this embodiment eliminates the need for communication applications on the terminal (e.g., the distributed application "Tank Battle") to directly implement cross-device communication. Instead, the task of cross-device communication is delegated to the communication interface program on the terminal (e.g., interface A, interface B). This simplifies the setup of the communication application or eliminates the need for a communication module, thereby reducing the manpower cost of program development. Furthermore, the embodiments of this application can reduce the correlation between the distributed application and the communication methods supported by the terminal, thereby improving the portability of the distributed application.

[0204]

Example 2

[0205] Example 1 uses Tank Battle A and Tank Battle B as examples to introduce the steps for establishing a data transmission channel P between the first pair of applications in establishing a data transmission channel between terminal A and terminal B. As described above ( Figure 4 The method for establishing a data transmission channel provided in this application can establish a data transmission channel between multiple pairs of distributed applications on terminal A and terminal B. Therefore, Embodiment 2 of this application introduces a method for establishing a data transmission channel between other paired applications after a data transmission channel has been established between the first pair of applications on terminal A and terminal B.

[0206] Specifically, the following uses a gallery application as an example to introduce the method for establishing a data transmission channel provided in this embodiment. That is, the following will describe how to establish a data transmission channel between the gallery application on terminal A and the gallery application on terminal B after a data transmission channel has been established between Tank Battle A and Tank Battle B. It can be understood that this embodiment can be applied to other applications besides gallery applications.

[0207] For ease of description, this article refers to the gallery application on terminal A as "Gallery A (as a third application)" and the gallery application on terminal B as "Gallery B (as a fourth application)".

[0208] refer to Figure 12The method for establishing a data transmission channel provided in this embodiment includes:

[0209] S210: Device discovery phase, including steps S211 to S213, specifically:

[0210] S211: In response to the user's input image sharing command, the image library A on terminal A sends a device discovery request to interface A;

[0211] S212: In response to receiving a device discovery request sent by library A, interface A enables the device scanning function of terminal A to obtain device information of candidate connected terminals.

[0212] S213: Interface A sends the device discovery result to Gallery A, and Gallery A displays the device selection interface.

[0213] The device discovery phase S210 of this embodiment is substantially the same as the device discovery phase S110 of Embodiment 1. Therefore, other undescribed details of the device discovery phase S210 of this embodiment can be found in the description in Embodiment 1, and will not be repeated here.

[0214] S220: Physical channel confirmation stage, including steps S221 and S222, specifically:

[0215] S221: Library A sends a device connection request to interface A. The device connection request is used to instruct interface A to establish a physical channel for connecting terminal A and terminal B.

[0216] S222: Interface A returns a notification to Library A that the physical channel has been created. Since a physical channel has already been established in Implementation Example 1, and Terminal B has already granted trust to Terminal A, when Interface A receives a device connection request sent by Library A, it returns a notification to Library A that the physical channel has been created.

[0217] S230: Virtual channel establishment phase, including steps S231 to S235, specifically:

[0218] S231: Image library A and interface A create a virtual channel C (as a third-party inter-process communication channel). Based on the confirmation that the physical channel has been created, when image library A needs to send image files to image library B, the virtual channel C is established.

[0219] S232: Interface A assigns a channel number to virtual channel C, which is used to uniquely identify virtual channel C.

[0220] S233: Interface A sends a message to Interface B indicating that virtual channel C has been established, thereby triggering the establishment of virtual channel D on the terminal B side. The message sent by Interface A to Interface B indicating that virtual channel A has been established includes the channel number of virtual channel C.

[0221] S234: In response to receiving a message that virtual channel C has been established, interface B and library B create virtual channel D (as a fourth inter-process communication channel).

[0222] S235: Interface B assigns a channel number to virtual channel D, which is used to uniquely identify virtual channel D. Specifically, interface B determines the channel number of virtual channel D based on the channel number of virtual channel C and the numbering rules described in Embodiment 1.

[0223] The virtual channel establishment stage S230 of this embodiment is essentially the same as the virtual channel establishment stage S150 of Embodiment 1. Therefore, other undescribed details of the virtual channel establishment stage S230 of this embodiment can be found in the description in Embodiment 1, and will not be repeated here.

[0224] refer to Figure 13 After virtual channel C and virtual channel D are established, virtual channel C, physical channel and virtual channel D are connected in sequence to form a data transmission channel for connecting library A and library B. Library A and library B can interact with each other based on this data transmission channel.

[0225] In this embodiment, multiple communication applications on the terminal (e.g., Tank Battle A and Gallery A on terminal A) can communicate with the peer device through interface A, which avoids the need for each distributed application to repeatedly develop communication modules, thus avoiding duplication and waste of development work.

[0226] Since terminal B has already granted trust to terminal A during the establishment of the data transmission channel between Tank Battle A and Tank Battle B, it is unnecessary to repeat the trust process of terminal B to terminal A when establishing a data transmission channel between subsequent paired applications (e.g., Gallery A and Gallery B) on terminal A and terminal B. Compared with the existing technology where the trust process is repeated every time a communication connection is established between paired applications, the connection process between paired applications can be simplified.

[0227] Similarly, during the establishment of a data transmission channel between Tank Battle A and Tank Battle B, terminals A and B each receive a key from the peer device. The terminals can then use this key to encrypt the business data of subsequent paired applications (e.g., Gallery A and Gallery B) on terminals A and B. This eliminates the need for subsequent paired applications of terminals A and B to repeat the key exchange process when establishing a data transmission channel, further simplifying the connection process between paired applications.

[0228] This embodiment can also save communication resources in the terminal (e.g., port number resources). Specifically, since this embodiment can realize cross-device communication between multiple applications (e.g., Tank Battle A and Gallery A on Terminal A) through a single physical channel (the operating system only needs to allocate a port number for this physical channel), compared with existing technologies (such as... Figure 2 As shown, each application establishes its own physical channel (the operating system needs to allocate a port number for each physical channel), which can save port number resources in the system.

[0229] In addition, since multiple applications in the terminal communicate across devices through the communication interface program, the communication interface program can easily manage the transmission priority of each application, giving priority to the transmission of business data with high real-time requirements, thereby improving the user experience.

[0230] For example, when Tank Battle A and Gallery A in Terminal A need to transmit data simultaneously through a physical channel, Interface A determines the order of data transmission based on the priority levels of Tank Battle A and Gallery A. In this embodiment, Tank Battle A has a higher priority level because it has higher requirements for data real-time performance; while Gallery A has lower requirements for data real-time performance, so it has a lower priority level. Therefore, when Tank Battle A and Gallery A in Terminal A need to transmit data simultaneously through a physical channel, Interface A determines to transmit the service data of Tank Battle A first, and then transmit the service data of Gallery A after a certain delay (e.g., 2 seconds).

[0231] In this embodiment, the priority level of an application can be determined by the application itself or by the communication interface program in the terminal where the application resides. For example, the priority level of Tank Battle A can be determined by Tank Battle A itself or by interface A.

[0232] Now for reference Figure 14The diagram shows a block diagram of a terminal device 400 according to one embodiment of this application. The terminal device 400 may include one or more processors 401 coupled to a controller hub 403. In at least one embodiment, the controller hub 403 communicates with the processor 401 via a multi-branch bus such as a Front Side Bus (FSB), a point-to-point interface such as a QuickPath Interconnect (QPI), or a similar connection 406. The processor 401 executes instructions controlling general types of data processing operations. In one embodiment, the controller hub 403 includes, but is not limited to, a Graphics & Memory Controller Hub (GMCH) (not shown) and an Input / Output Hub (IOH) (which may be on a separate chip) (not shown), wherein the GMCH includes memory and a graphics controller and is coupled to the IOH.

[0233] The terminal device 400 may also include a coprocessor 402 and a memory 404 coupled to a controller hub 403. Alternatively, one or both of the memory and the GMCH may be integrated within the processor (as described in this application), with the memory 404 and the coprocessor 402 directly coupled to the processor 401 and the controller hub 403, which is located on a single chip with the IOH.

[0234] Memory 404 may be, for example, Dynamic Random Access Memory (DRAM), Phase Change Memory (PCM), or a combination of both. Memory 404 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. The computer-readable storage medium stores instructions, specifically, temporary and permanent copies of those instructions. When executed on a computer, the instructions cause the computer to perform the methods disclosed in Embodiment 1 and / or Embodiment 2 described above.

[0235] like Figure 14 The terminal device 400 shown can be implemented as terminal A and terminal B respectively. When terminal device 400 is implemented as terminal A, the instructions stored in memory 404 may include: instructions that, when executed by at least one of the processors, cause terminal A to perform the following actions: Figure 7 , Figure 8a , Figure 9a , Figure 10a , Figure 11a , Figure 12The instructions for the steps performed by terminal A in the method shown. When terminal device 400 is implemented as terminal B, the instructions stored in memory 404 may include: instructions that, when executed by at least one of the processors, cause terminal B to perform the following steps: Figure 7 , Figure 8a , Figure 9a , Figure 10a , Figure 11a , Figure 12 The instructions for the steps implemented by terminal B in the method shown.

[0236] In one embodiment, coprocessor 402 is a dedicated processor, such as, for example, a high-throughput MIC (Many Integrated Core) processor, a network or communication processor, a compression engine, a graphics processor, a GPGPU (General-purpose computing on graphics processing units), or an embedded processor, etc. Optional properties of coprocessor 402 are indicated by dashed lines. Figure 14 middle.

[0237] In one embodiment, terminal device 400 may further include a network interface (NIC) 406. Network interface 406 may include a transceiver for providing a radio interface for terminal device 400 to communicate with any other suitable device (such as a front-end module, antenna, etc.). In various embodiments, network interface 406 may be integrated with other components of terminal device 400. Network interface 406 can implement the functions of the communication unit in the above embodiments.

[0238] Terminal device 400 may further include input / output (I / O) devices 405. I / O 405 may include: a user interface designed to enable a user to interact with terminal device 400; a peripheral component interface designed to enable peripheral components to also interact with terminal device 400; and / or sensors designed to determine environmental conditions and / or location information related to terminal device 400.

[0239] It is worth noting that, Figure 14 This is merely an example. That is, although... Figure 14 The diagram shows that the terminal device 400 includes multiple devices such as a processor 401, a controller hub 403, and a memory 404. However, in actual applications, devices using the methods of this application may include only a portion of the devices in the terminal device 400. For example, it may include only the processor 401 and the network interface 406. Figure 14 The properties of the optional devices are shown by dashed lines.

[0240] Now for reference Figure 15 The diagram shown is a block diagram of a SoC (System on Chip) 500 according to an embodiment of this application. Figure 15 In the diagram, similar components share the same reference numerals. Additionally, dashed boxes are an optional feature for more advanced SoCs. Figure 15 In this SoC 500, the following components are included: an interconnect unit 550 coupled to the processor 510; a system proxy unit 580; a bus controller unit 590; an integrated memory controller unit 540; a group or one or more coprocessors 520, which may include integrated graphics logic, an image processor, an audio processor, and a video processor; a static random-access memory (SRAM) unit 530; and a direct memory access (DMA) unit 560. In one embodiment, the coprocessor 520 includes a dedicated processor, such as, for example, a network or communication processor, a compression engine, a GPGPU (General-purpose computing on graphics processing units), a high-throughput MIC processor, or an embedded processor.

[0241] Static Random Access Memory (SRAM) cell 530 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. The computer-readable storage medium stores instructions, specifically, temporary and permanent copies of those instructions. When executed on a computer, the instructions cause the computer to perform the methods disclosed in Embodiment 1 and / or Embodiment 2 described above.

[0242] like Figure 15 The SoC shown can be installed in terminal A and terminal B respectively. When the SoC is installed in terminal A, static random access memory (SRAM) cell 530 stores instructions that may include: causing terminal A to perform, when executed by at least one of the processors, the following actions: Figure 7 , Figure 8a , Figure 9a , Figure 10a , Figure 11a , Figure 12 The instructions for the steps performed by terminal A in the method shown. When the SoC is installed in terminal B, instructions are stored in static random access memory (SRAM) cell 530, which may include: causing terminal B to perform the following steps when executed by at least one of the processors. Figure 7 , Figure 8a , Figure 9a , Figure 10a , Figure 11a , Figure 12 The instructions for the steps implemented by terminal B in the method shown.

[0243] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The symbol " / " indicates that the related objects have an "or" relationship.

[0244] All methods and implementations of this application can be implemented in the form of software, magnetic files, firmware, etc.

[0245] Program code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.

[0246] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this paper are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0247] One or more aspects of at least one embodiment can be implemented by representational instructions stored on a computer-readable storage medium, the instructions representing various logics in a processor, which, when read by a machine, cause the machine to create logic for performing the techniques described herein. These representations, referred to as “IP (Intellectual Property) cores,” can be stored on a tangible computer-readable storage medium and provided to multiple customers or production facilities for loading into manufacturing machines that actually manufacture the logic or processor.

[0248] In some cases, an instruction translator can be used to translate instructions from a source instruction set to a target instruction set. For example, an instruction translator can transform (e.g., using static binary transformation, including dynamically compiled dynamic binary transformation), morph, emulate, or otherwise translate instructions into one or more other instructions that will be processed by the core. Instruction translators can be implemented in software, hardware, firmware, or a combination thereof. Instruction translators can be on the processor, off the processor, or partially on and partially off the processor.

Claims

1. A method for establishing data transmission channels, used to establish multiple data transmission channels between a first application on a first terminal and a second application on a second terminal; characterized in that, The method includes: The first application sends a device connection request to the first communication interface program in the first terminal. The device connection request is used to instruct the first communication interface program to establish an inter-device communication channel for connecting the first terminal and the second terminal. The first communication interface program establishes a communication connection with the second communication interface program in the second terminal based on the inter-device communication protocol, so as to establish the inter-device communication channel; Based at least on the successful establishment of the inter-device communication channel, the first application and the first communication interface program establish a first inter-process communication channel and a third inter-process communication channel based on the inter-process communication mechanism, and the second communication interface program and the second application establish a second inter-process communication channel and a fourth inter-process communication channel based on the inter-process communication mechanism, so that the first inter-process communication channel, the inter-device communication channel, and the second inter-process communication channel together form the first data transmission channel among the multiple data transmission channels between the first application and the second application, and the third inter-process communication channel, the inter-device communication channel, and the fourth inter-process communication channel together form the second data transmission channel among the multiple data transmission channels; Wherein, the establishment of at least the inter-device communication channel is successful, and the first application and the first communication interface program establish a first inter-process communication channel and a third inter-process communication channel based on an inter-process communication mechanism, and the second communication interface program and the second application program establish a second inter-process communication channel and a fourth inter-process communication channel based on an inter-process communication mechanism, including: At least based on the successful establishment of the inter-device communication channel, the first application and the first communication interface program establish the first inter-process communication channel; The first communication interface program transmits a message that the first inter-process communication channel has been established to the second communication interface program. The message includes a first channel number used to uniquely identify the first inter-process communication channel. In response to receiving a message that the first inter-process communication channel has been established, the second communication interface program establishes the second inter-process communication channel with the second application program, and assigns a second channel number to the second inter-process communication channel to uniquely identify the second inter-process communication channel; The second application establishes the fourth inter-process communication channel with the second communication interface program; The second communication interface program transmits a message that the fourth inter-process communication channel has been established to the first communication interface program. The message includes a fourth channel number used to uniquely identify the fourth inter-process communication channel. In response to receiving a message that the fourth inter-process communication channel has been established, the first communication interface program establishes the third inter-process communication channel with the first application program, and assigns a third channel number to the third inter-process communication channel for unique identification. Wherein, the first channel number and the fourth channel number have the same parity, the first channel number and the second channel number have different parity, there is a set difference between the first channel number and the second channel number, and there is the set difference between the fourth channel number and the third channel number.

2. The method according to claim 1, characterized in that, The set difference value is 1.

3. The method according to claim 1, characterized in that, The method further includes: The first terminal sends a device authorization request to the second communication interface program of the second terminal through the first communication interface program, so that the second access interface program can perform authorization authentication on the first terminal; and... Based on the determination that the second communication interface program has passed the trust authentication of the first terminal, the first application establishes the first inter-process communication channel with the first communication interface program, and the second communication interface program establishes the second inter-process communication channel with the second application.

4. The method according to claim 3, characterized in that, The device trust request sent by the first terminal to the second terminal includes the user account information of the first terminal; the second terminal performs trust authentication on the first terminal, including: The second communication interface program determines whether the user account information of the first terminal is the same as the user account information of the second terminal; If the user account information of the first terminal is the same as that of the user account information of the second terminal, the second communication interface program will authenticate the first terminal. If the user account information of the first terminal is different from that of the user account information of the second terminal, the second communication interface program obtains the credit authentication information from the first terminal to determine whether to pass the credit authentication of the first terminal based on the credit authentication information.

5. The method according to claim 1, characterized in that, The method further includes: The first communication interface program sends a first key to the second communication interface program through the inter-device communication channel. The first key is used to encrypt data sent from the second application to the first application; and / or, The second communication interface program sends a second key to the first communication interface program through the device communication channel. The second key is used to encrypt the data sent from the first application to the second application.

6. The method according to claim 5, characterized in that, The first key or the second key is the public key in an asymmetric key pair.

7. The method according to claim 1, characterized in that, The device connection request sent by the first application to the first communication interface program includes the communication address information of the second terminal; the method further includes: The first application sends a device discovery request to the first communication interface program; In response to receiving the device discovery request, the first communication interface program enables the device scanning function of the first terminal to obtain device information of at least one candidate connected terminal of the first terminal. The device information of the candidate connected terminal includes at least the communication address information of the candidate connected terminal, and the at least one candidate connected terminal includes the second terminal. The first communication interface program sends device information of the at least one candidate connection terminal to the first application. The first application determines the device information of the second terminal based on the device information of the at least one candidate connection terminal, and determines the content of the device connection request based on the device information of the second terminal; According to the content, the first application sends a device connection request to the first communication interface program in the first terminal.

8. The method according to claim 7, characterized in that, The device information of the candidate connection terminal device also includes the device identification information of the candidate connection terminal, the communication connection methods supported by the candidate connection terminal, the operating system version of the candidate connection terminal, and / or the list of applications supported by the candidate connection terminal.

9. The method according to claim 7, characterized in that, The method further includes: The first communication interface program assigns a device number to each of the candidate connection terminals to uniquely identify each candidate connection terminal.

10. The method according to claim 1, characterized in that, The second communication interface program stores an application registration list, which includes the application identifier of the second application. The second communication interface program and the second application program establish a second inter-process communication channel based on an inter-process communication mechanism, including: The second communication interface program receives the application identifier of the first application sent by the first communication interface program, and determines the second application as an application used to perform business interactions with the first application based on the application identifier of the first application and the application registration list; Based on the determination that the second application is an application used to interact with the first application, the second communication interface program establishes a second inter-process communication channel with the second application.

11. The method according to claim 1, characterized in that, The method is also used to establish a data transmission channel between a third application on the first terminal and a fourth application on the second terminal, the method further comprising: The third application sends a device connection request to the first communication interface program to determine that the communication channel between the devices has been established based on the reply message from the first communication interface program. Based at least on the determination of the inter-device communication channel, the third application and the first communication interface program establish a third inter-process communication channel based on the inter-process communication mechanism, and trigger the second communication interface program and the fourth application to establish a fourth inter-process communication channel based on the inter-process communication mechanism, so that the third inter-process communication channel, the inter-device communication channel and the fourth inter-process communication channel together form a data transmission channel between the third application and the fourth application.

12. The method according to claim 11, characterized in that, The first communication interface program determines the transmission order of service data for the first application and service data for the third application in the inter-device communication channel based on the priority level of the first application and the priority level of the third application.

13. The method according to claim 12, characterized in that, The priority level of the first application is determined by the first application itself or by the first communication interface program; or, The priority level of the third application is determined by the third application or by the first communication interface program.

14. The method according to claim 1, characterized in that, The inter-process communication mechanism is a pipe communication mechanism.

15. The method according to claim 1, characterized in that, The communication protocol between the devices can be any one of the following: local area network communication protocol; Bluetooth communication protocol; Wi-Fi P2P communication protocol.

16. A terminal system, comprising a first terminal and a second terminal, characterized in that, The first terminal is used to perform the steps executed by the first terminal in any one of the methods of claims 1 to 15, and the second terminal is used to perform the steps executed by the second terminal in any one of the methods of claims 1 to 15.

17. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the method described in any one of claims 1 to 15.

Citation Information

Patent Citations

  • Communication method and system for mobile phone and computer equipment

    CN107483696A

  • Stand-alone machine program operation method and device, equipment and storage medium

    CN110162255A