[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN114077502A - Method for establishing data transmission channel, terminal system and storage medium - Google Patents

Method for establishing data transmission channel, terminal system and storage medium Download PDF

Info

Publication number
CN114077502A
CN114077502A CN202010816673.XA CN202010816673A CN114077502A CN 114077502 A CN114077502 A CN 114077502A CN 202010816673 A CN202010816673 A CN 202010816673A CN 114077502 A CN114077502 A CN 114077502A
Authority
CN
China
Prior art keywords
terminal
communication
application
inter
channel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010816673.XA
Other languages
Chinese (zh)
Inventor
张帮明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010816673.XA priority Critical patent/CN114077502A/en
Publication of CN114077502A publication Critical patent/CN114077502A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0442Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload wherein the sending and receiving network entities apply asymmetric encryption, i.e. different keys for encryption and decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Stored Programmes (AREA)

Abstract

Provided are a method of establishing a data transmission channel, a terminal system, and a computer-readable storage medium. The method for establishing the data transmission channel comprises the following steps: the method comprises the steps that a first application program sends a device connection request to a first communication interface program in a first terminal so as to establish a device-to-device communication channel for connecting the first terminal and a second terminal; and at least based on successful establishment of the inter-device communication channel, the first application program 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 program 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 jointly form a data transmission channel between the first application program and the second application program. Through the implementation mode of the application, the communication module can be simplified or not arranged in the distributed application program, so that the labor cost of program development is reduced.

Description

Method for establishing data transmission channel, terminal system and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method for establishing a data transmission channel, a terminal system, and a computer-readable storage medium.
Background
Along with the popularization of various intelligent terminal devices, more and more cross-device distributed applications are promoted. The distributed application comprises application programs located on different terminals, and the application programs on the different terminals exchange service data through communication channels among devices, so that the application programs cooperate with each other to complete a task.
In order to implement inter-device communication, in the prior art, an application program of a distributed application includes, in addition to a service module for implementing its own service, a communication module for implementing inter-device communication. Thus, the structure of the program is complicated, and the development process of the program also costs much labor.
Disclosure of Invention
Embodiments of the present application provide a method, a terminal system and a computer-readable storage medium for establishing a data transmission channel, which are described in various aspects below, and embodiments and advantages of the various aspects below are mutually referenced.
In a first aspect, an embodiment of the present application provides a method for establishing a data transmission channel, configured to establish a data transmission channel between a first application program of a first terminal and a second application program in a second terminal; the method comprises the following steps: the method comprises the steps that a first application program sends a device connection request to a first communication interface program in a first terminal, wherein the device connection request is used for indicating the first communication interface program to establish an inter-device communication channel for connecting the first terminal and a second terminal; the first communication interface program establishes communication connection with a second communication interface program in a second terminal based on an inter-device communication protocol so as to establish an inter-device communication channel; and at least based on successful establishment of the inter-device communication channel, the first application program 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 program 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 jointly form a data transmission channel between the first application program and the second application program.
According to the implementation mode of the application, the application program on the terminal does not need to directly realize cross-device communication, but the task of the cross-device communication is given to the communication interface program on the terminal for execution, so that the setting or non-setting of the communication module in the application program can be simplified, and the labor cost of program development is reduced. In addition, the embodiment of the application can reduce the relevance between the application and the communication modes supported by the terminal, thereby improving the portability of the application.
In some embodiments, at least based on the success of the establishment of the inter-device communication channel, the first application program and the first communication interface program establish a first inter-process communication channel based on the inter-process communication mechanism, and the second communication interface program and the second application program establish a second inter-process communication channel based on the inter-process communication mechanism, including; establishing a first interprocess communication channel between a first application program and a first communication interface program at least based on successful establishment of the communication channel between the devices; the first communication interface program transmits the message established by the first interprocess communication channel to the second communication interface program; in response to receiving the message that the first interprocess communication channel has been established, the second communication interface program establishes a second interprocess communication channel with the second application.
According to the implementation mode of the application, the first interprocess communication channel is an actively created interprocess communication channel, and after the first interprocess communication channel is successfully created, the creation of the second interprocess communication channel is triggered.
In some embodiments, the first communication interface program passes the message that the first interprocess communication channel is established to the second communication interface program, further comprising: the message which is transmitted to the second communication interface program by the first communication interface program and is established by the first interprocess communication channel comprises a first channel number; the first channel number is a channel number that is assigned by the first communication interface program to the first inter-process communication channel and is used for uniquely identifying the first inter-process communication channel.
In some embodiments, 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 number setting rule, the second channel number being a channel number for uniquely identifying the second inter-process communication channel.
In some embodiments, the set number setting rule is such that the first channel number and the second channel number have different parities and such that there is a set difference between the first channel number and the second channel number.
According to the embodiment of the application, when the terminal has the actively created virtual channel and the passively created virtual channel, the problem of channel number conflict can be avoided.
In some embodiments, the set difference is 1.
In some embodiments, the method further comprises: the first terminal sends a device credit authorization request to a second communication interface program of the second terminal through the first communication interface program so that the second communication interface program can carry out credit authorization on the first terminal; and based on the fact that the second communication interface program passes the credit authorization of the first terminal, the first application program and the first communication interface program establish a first inter-process communication channel, and the second communication interface program and the second application program establish a second inter-process communication channel.
According to the embodiment of the application, the safety of service data transmission can be improved.
In some embodiments, a device credit granting request sent by a first terminal to a second terminal includes user account information of the first terminal; the second terminal carries out credit authorization on the first terminal, and the method comprises the following steps: the second communication interface program judges 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 credit authorization of the first terminal; and 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 acquires the credit authorization information from the first terminal so as to determine whether the credit authorization of the first terminal passes or not according to the credit authorization information.
In some embodiments, the method further comprises: the first communication interface program sends a first secret key to the second communication interface program through the inter-device communication channel, and the first secret key is used for encrypting data sent by the second application program to the first application program; and/or the second communication interface program sends a second secret key to the first communication interface program through the inter-device communication channel, wherein the second secret key is used for encrypting data sent by the first application program to the second application program.
According to the embodiment of the application, the safety of service data transmission can be improved.
In some embodiments, the first key or the second key is a public key of an asymmetric key pair.
In some embodiments, the device connection request sent by the first application program to the first communication interface program includes communication address information of the second terminal; the method further comprises the following steps: the first application program sends a device discovery request to the first communication interface program; in response to receiving the device discovery request, the first communication interface program starts a device scanning function of the first terminal to acquire device information of at least one candidate connection terminal of the first terminal, wherein the device information of the candidate connection terminal at least comprises communication address information of the candidate connection terminal, and the at least one candidate connection terminal comprises a second terminal; the first communication interface program sends device information of at least one candidate connection terminal to the first application program; the first application determines the equipment information of the second terminal according to the equipment information of at least one candidate connection terminal and determines the content of the equipment connection request according to the equipment information of the second terminal; according to the content, the first application program sends a device connection request to a first communication interface program in the first terminal.
In some embodiments, the device information of the candidate connection terminal device further includes device identification information of the candidate connection terminal, a communication connection manner supported by the candidate connection terminal, a version of an operating system of the candidate connection terminal, and/or a list of applications supported by the candidate connection terminal.
In some embodiments, the method further comprises: the first communication interface program assigns a device number for uniquely identifying each candidate connection terminal to each candidate connection terminal.
In some embodiments, the second communication interface program stores an application registration list, and the application registration list includes an application identifier of the second application; the second communication interface program and the second application program establish a second interprocess communication channel based on the interprocess communication mechanism, which comprises the following steps: the second communication interface program receives the application identifier of the first application program sent by the first communication interface program, and determines the second application program as the application program for carrying out service interaction with the first application program according to the application identifier of the first application program and the application program registration list; based on determining that the second application is an application for business interaction with the first application, the second communication interface program establishes a second interprocess communication channel with the second application.
In some embodiments, the method is further configured to establish a data transmission channel between a third application of the first terminal and a fourth application of the second terminal, and the method further includes: the third application program sends a device connection request to the first communication interface program so as to determine that a communication channel between the devices is established according to the reply message of the first communication interface program; and at least based on the determination of the inter-device communication channel for establishment, the third application program 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 program 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 program and the fourth application program.
According to the embodiment of the application, a plurality of communication application programs on the terminal can communicate with the opposite terminal device through the communication interface program, so that the communication module can be prevented from being repeatedly developed by each application program, and the repetition and waste of development workload can be avoided.
In some embodiments, the first communication interface program determines an order of transmission of traffic data for the first application and traffic data for the third application in the inter-device communication channel according to the priority level of the first application and the priority level of the third application.
According to the embodiment of the application, the communication interface program can conveniently manage the transmission priority of each application program, the transmission of the service data with high real-time requirement is preferentially ensured, and the user experience is improved.
In some embodiments, the priority level of the first application is determined by the first application or by the first communication interface program; alternatively, the priority level of the third application is determined by the third application or by the first communication interface program.
In some embodiments, the interprocess communication mechanism is a pipe communication mechanism.
In some embodiments, the inter-device communication protocol is any one of: a local area network communication protocol; a bluetooth communication protocol; Wi-Fi P2P communication protocol.
In a second aspect, an embodiment of the present application provides a terminal system, which includes a first terminal and a second terminal, where the first terminal is configured to execute the steps executed by the first terminal in the method provided in any embodiment of the first aspect of the present application, and the second terminal is configured to execute the steps executed by the second terminal in the method provided in any embodiment of the first aspect of the present application. The beneficial effects that can be achieved by the second aspect can refer to the beneficial effects of the method provided by any one of the embodiments of the first aspect, and are not described herein again.
In a third aspect, the present application provides a computer-readable storage medium, in which instructions are stored, and when executed on a computer, the instructions may cause the computer to perform the method provided in any one of the embodiments of the first aspect of the present application. The beneficial effects that can be achieved by the third aspect can refer to the beneficial effects of the method provided by any one of the embodiments of the first aspect, and are not described herein again.
Drawings
Fig. 1 is a schematic view of an application scenario according to an embodiment of the present application;
FIG. 2 is a prior art application module architecture diagram;
fig. 3 is a first schematic structural diagram of a data transmission channel according to an embodiment of the present disclosure;
fig. 4 is another application scenario provided by an embodiment of the present application;
fig. 5 is a schematic structural diagram of a terminal device provided in an embodiment of the present application;
fig. 6 is a software architecture diagram of a terminal device according to an embodiment of the present application;
fig. 7 is a first flowchart of a method for establishing a data transmission channel according to an embodiment of the present application;
fig. 8a is a second flowchart of a data transmission channel establishing method according to an embodiment of the present application;
FIG. 8b is a first schematic diagram of an apparatus selection interface provided in an embodiment of the present application;
fig. 9a is a third flowchart of a data transmission channel establishing method according to an embodiment of the present application;
fig. 9b is a schematic diagram of a device selection interface provided in the embodiment of the present application;
fig. 10a is a fourth flowchart of a data transmission channel establishing method according to an embodiment of the present application;
fig. 10b is a schematic diagram of a PIN code input interface provided in an embodiment of the present application;
fig. 11a is a fifth flowchart of a method for establishing a data transmission channel according to an embodiment of the present application;
fig. 11b is a schematic diagram of a virtual channel numbering method according to an embodiment of the present disclosure;
fig. 12 is a sixth flowchart of a data transmission channel establishing method according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of a data transmission channel according to an embodiment of the present application;
fig. 14 shows a block diagram of a terminal device provided in an embodiment of the present application;
fig. 15 shows a schematic structural diagram of a System on Chip (SoC) according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, specific embodiments of the present application will be described in detail with reference to the accompanying drawings.
The embodiment of the present application is to provide a method for establishing a data transmission channel, and fig. 1 shows an application scenario of the embodiment of the present application. Referring to fig. 1, a user a and a user B respectively perform an online game of "tank war" by controlling a terminal a and a terminal B, and in order that the user a and the user B can share the same game progress, a "tank war" interface on the terminal a and a "tank war" interface on the terminal B can present a synchronized game state. For example, when a user A operates (e.g., presses a forward key) on terminal A to control a game item action (e.g., control a tank to go forward), a "tank battle" interface on terminal B can synchronize the action of the game item, so that the user of terminal A and the user of terminal B can control the same game through different terminals, thereby achieving the purpose of online game.
An example of a cross-device distributed application is given in fig. 1 by taking the online game application "tank battle" as an example. In the field of terminal technology, applications distributed on different terminals and cooperating with each other through data exchange to accomplish a task are referred to as "distributed applications".
Through distributed application, mutual sharing of computing power and peripheral resources can be achieved among different terminals, and therefore convenience is brought to daily life of people. For example, through screen cooperation application, cooperation input and mirror image reverse control between two different terminals (for example, between a mobile phone and a car machine, between a tablet and a notebook computer, and the like) can be realized; through intelligent home interactive application, an intelligent life scene can be constructed, for example, a user can use a mobile phone as an input peripheral of an intelligent screen (i.e. the mobile phone is used as a keyboard of the intelligent screen); through distributed file storage application, cross-device storage of massive files and the like can be achieved.
The cross-device distributed application relies on data interaction among each other to realize the cooperation of each other, and the data interaction is realized through a communication connection between terminals. In the prior art, in order to implement mutual cooperation between distributed applications, program modules of each distributed application include a communication module for implementing inter-device communication in addition to a service module for implementing its own service.
Taking the game application "tank war" shown in fig. 1 as an example, in the prior art, the functions implemented by the service module of "tank war" include: setting a game stage, creating and destroying props (e.g., tanks, bullets, etc.) in the game, controlling actions of the props (e.g., controlling tanks to move forward when a user presses a forward button), counting player scores, and the like. The functions of the communication module include: when a game is started, equipment scanning is carried out to discover opposite terminal equipment (in the figure 1, the opposite terminal equipment of a terminal A is a terminal B), and after the opposite terminal equipment is discovered, data connection is established with a tank war application on the opposite terminal equipment; status information of the game (e.g., location of the tank, frequency of firing rounds and type of rounds from the tank, score of the player, etc.) is sent to the peer device as the game progresses so that the "tank war" application on the peer device can update the game interface in real time.
That is to say, in the prior art, the application program of the distributed application is used for implementing its own service, and also involves details of communication among a plurality of devices, so the structure of the program is cumbersome, and the development process of the program also costs much labor. In addition, in order to perform inter-device communication by using the local communication function, the communication module of the distributed application is configured to match the communication mode of the terminal (for example, when the terminal supports WiFi P2P communication, the communication module of the distributed application is configured to implement WiFi P2P communication), and the communication modes supported by the terminals may not be the same, which makes the compatibility and portability of the distributed application poor.
Additionally, in some scenarios, there may be multiple distributed applications on the terminal device. Fig. 2 shows a communication manner between distributed applications in this scenario in the prior art. Referring to fig. 2, terminal a has distributed applications a1, a2, A3 thereon, and terminal B has distributed applications B1, B2, B3 thereon that are paired with distributed applications a1, a2, A3, respectively. Each application includes a service module and a communication module, and the application performs data exchange with the application of the opposite device through its own communication module (for example, the application a1 performs data exchange with the application B1 through its own communication module), so that each distributed application needs to separately develop its own communication module, which results in duplication and waste of development workload.
Therefore, the present application provides a method for establishing a data transmission channel, which is used to solve the above technical problem. In the embodiment of the application, a communication interface program for realizing cross-device communication is arranged in the terminal device, and when the distributed application on the terminal needs to perform service interaction with the paired application on the opposite terminal device, the cross-device communication is realized through the communication interface program on the terminal, rather than the cross-device communication through a communication module of the terminal.
The method provided by the embodiment of the present application is described by taking the game application "tank battle" shown in fig. 1 as an example, but it is understood that the embodiment of the present application can also be applied to other distributed application programs. In addition, for convenience of description, the application of "tank war" in terminal a will be hereinafter referred to as "tank war a", and the application of "tank war" in terminal a will be hereinafter referred to as "tank war B").
When the "tank war a" needs to establish a service connection with the "tank war B", the tank war a first transmits a device connection request to a communication interface program a (herein referred to as "interface a" or "first communication interface program") in the terminal a. After receiving a device connection request sent by the tank warfare a, the interface a establishes an inter-device communication channel (also called a physical channel) with a communication interface program B (herein called "interface B" or "second communication interface program") in the terminal B based on an inter-device transmission protocol. After the physical channel is successfully established, the interface a and the application a establish a cross-process communication channel (referred to as a "virtual channel a" or a "first inter-process communication channel" herein) based on an inter-process communication mechanism, and the interface B and the application B establish another cross-process communication channel (referred to as a "virtual channel B" or a "second inter-process communication channel" herein) based on an inter-process communication mechanism. Thus, as shown in fig. 3, data is transferred from the "tank battle a" of the terminal a to the "tank battle B" from left to right via the virtual channel a, the physical channel and the virtual channel B in this order. The virtual channel A, the physical channel and the virtual channel B can jointly form a data transmission channel P for connecting the tank war A and the tank war B so as to realize data interaction between the tank war A and the tank war B.
In the embodiment of the application, the distributed application on the terminal does not need to directly realize cross-device communication, but the task of the cross-device communication is given to the communication interface program on the terminal for execution, so that the setting or non-setting of the communication module in the distributed application program can be simplified, and the labor cost of program development is reduced. In addition, the embodiment of the application can also reduce the relevance between the distributed application program and the communication modes supported by the terminal, thereby improving the portability of the distributed application program.
Although the above describes a case where two terminal devices each have one distributed application, the embodiments of the present application may also be applied to a scenario where a terminal device has a plurality of distributed applications. Referring to fig. 4, in the embodiment of the present application, a terminal a has distributed applications a1, a2, and A3 thereon, and a terminal B has distributed applications B1, B2, and B3 that are paired with the distributed applications a1, a2, and A3, respectively. And each distributed application is communicated with the matched application on the opposite terminal device through a communication interface program on the terminal. For example, when an application a1 in a terminal a needs to communicate with an application B1 in a terminal B, the application a1 first transmits service data to an interface a through a virtual channel (i.e., an inter-process communication channel), then transmits the service data to the interface B through a physical channel (i.e., an inter-device communication channel) by the interface a, and finally transmits the service data to the application B1 through the virtual channel by the interface B. Through the implementation mode, the situation that each distributed communication module needs to be repeatedly developed can be avoided, and the repetition and waste of development workload are avoided.
In addition, in the manner shown in fig. 4, the present application can also save communication resources (e.g., port number resources) in the terminal. Specifically, since the cross-device communication among the multiple applications can be realized through one physical channel (the operating system only needs to allocate the port number to the physical channel), port number resources in the system can be saved compared with the situation that in the prior art (as shown in fig. 2), the physical channel is established by each application (the operating system needs to allocate the port number to each physical channel).
Furthermore, because a plurality of applications in the terminal perform cross-device communication through the communication interface program, the communication interface program can conveniently manage the transmission priority of each application, preferentially ensure the transmission of service data with high real-time requirements, and improve user experience.
The application fields of the embodiments of the present application are described above by taking distributed applications as examples, but it is understood that the embodiments of the present application can also be applied to other communication applications besides distributed applications, for example, an email application, a browser application, a map application, a weather application, and the like.
The specific type of the terminal devices (terminal a and terminal B) is not limited in this application, and the terminal devices may be a portable computer, a tablet computer, a mobile phone, a wearable electronic device (e.g., a watch, a head-mounted device, etc.), a portable media player, an electronic book reading device, an industrial control device, a streaming media client device, etc.
The terminal a and the terminal B may be the same type of device (for example, both the terminal a and the terminal B are mobile phones) or different types of devices (for example, the terminal a is a mobile phone, and the terminal B is a tablet). In addition, terminal a and terminal B may be devices of the same user, or may be devices of different users.
It is to be understood that terminal a and terminal B should be peer-to-peer devices, that is, terminal a and terminal B should support at least one common communication manner (for example, terminal a and terminal B both support WiFi P2P communication manner). On this basis, the actual communication mode of the terminal a and the terminal B is not limited in the present application, and the terminal a and the terminal B may communicate with each other in a single communication mode, for example, in a bluetooth, a local area network (wired or wireless mode), or a cellular network; communication can also be carried out through various communication modes, for example, Bluetooth communication is carried out between the application A1 of the terminal A and the application B1 of the terminal B, and local area network communication is carried out between the application A2 of the terminal A and the application B2 of the terminal B; it is also possible to use different communication methods in different phases of the traffic connection, for example, bluetooth communication in the device discovery phase and WiFi P2P communication in the traffic data transmission phase (Hu communication method)awei ShareTMThe communication method employed).
Fig. 5 shows a schematic structural diagram of the terminal device 100 provided in the embodiment of the present application. The terminal device 100 may be implemented as a terminal a or a terminal B.
The 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, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identification Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It is to be understood that the illustrated structure of the embodiment of the present invention does not specifically limit the terminal device 100. In other embodiments of the present application, terminal device 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The processor can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (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.
The I2C interface is a bi-directional synchronous serial bus that includes a serial data line (SDA) and a Serial Clock Line (SCL). In some embodiments, processor 110 may include multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces, respectively. For example: the processor 110 may be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through an I2C bus interface to implement the touch function of the terminal device 100.
The I2S interface may be used for audio communication. In some embodiments, processor 110 may include multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 via an I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may communicate audio signals to the wireless communication module 160 via the I2S interface, enabling answering of calls via a bluetooth headset.
The PCM interface may 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 may be coupled by a PCM bus interface. In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to implement a function of answering a call through a bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus used for asynchronous communications. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is generally used to connect the processor 110 with the wireless communication module 160. For example: the processor 110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 170 may transmit the audio signal to the wireless communication module 160 through a UART interface, so as to realize the function of playing music through a bluetooth headset.
MIPI interfaces may be used to connect processor 110 with peripheral devices such as display screen 194, camera 193, and the like. The MIPI interface includes a Camera Serial Interface (CSI), a Display Serial Interface (DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the capture function of terminal device 100. The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the terminal device 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal and may also be configured as a data signal. In some embodiments, a GPIO interface may be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, and the like.
It should be understood that the interface connection relationship between the modules according to the embodiment of the present invention is only an exemplary illustration, and does not limit the structure of the terminal device 100. In other embodiments of the present application, the terminal device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The USB connector 130 is a connector conforming to the USB standard specification, and may be used to connect the terminal device 100 and a peripheral device, and specifically may be a standard USB connector (e.g., Type C connector), a Mini USB connector, a Micro USB connector, or the like. The USB connector 130 may be used to connect a charger to charge the terminal device 100, and may also be used to transmit data between the terminal device 100 and a peripheral device. And the earphone can also be used for connecting an earphone and playing audio through the earphone. The connector may also be used to connect other electronic devices, such as AR devices and the like. In some embodiments, processor 110 may support a Universal Serial Bus (Universal Serial Bus), which may have a standard specification of USB1.x, USB2.0, USB3.x, USB 4.
The wireless communication function of the terminal device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in terminal device 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution including 2G/3G/4G/5G wireless communication applied on the terminal device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 150 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional modules, independent of the processor 110.
The wireless communication module 160 may provide a solution for wireless communication applied to the terminal device 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 150 and the antenna 2 is coupled to the wireless communication module 160 so that the terminal device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), General Packet Radio Service (GPRS), code division multiple access (code division multiple access, CDMA), Wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), Long Term Evolution (LTE), LTE, BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc. The GNSS may include a Global Positioning System (GPS), a global navigation satellite system (GLONASS), a beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and/or a Satellite Based Augmentation System (SBAS).
The terminal device 100 implements a display function by the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may adopt a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the terminal device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
The terminal device 100 may implement a shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, the application processor, and the like.
The ISP is used to process the data fed back by the camera 193. For example, when a photo is taken, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converting into an image visible to naked eyes. The ISP can also carry out algorithm optimization on the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The light sensing element converts the optical signal into an electrical signal, which is then passed to the ISP where it is converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into image signal in standard RGB, YUV and other formats. In some embodiments, the terminal device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process digital image signals and other digital signals. For example, when the terminal device 100 selects a frequency point, the digital signal processor is used to perform fourier transform or the like on the frequency point energy.
Video codecs are used to compress or decompress digital video. The terminal device 100 may support one or more video codecs. In this way, the terminal device 100 can play or record video in a plurality of encoding formats, such as: moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, and the like.
The NPU is a neural-network (NN) computing processor that processes input information quickly by using a biological neural network structure, for example, by using a transfer mode between neurons of a human brain, and can also learn by itself continuously. The NPU can implement applications such as intelligent recognition of the terminal device 100, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the storage capability of the terminal device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in an external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, a phonebook, etc.) created during use of the terminal device 100, and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like. The processor 110 executes various functional applications of the terminal device 100 and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor. The 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 the terminal a in the method of establishing a data transmission channel provided by the embodiments of the present application; when the terminal device 100 is implemented as terminal B, the instructions stored in the internal memory 121 may include: instructions which, when executed by at least one of the processors, cause the terminal device 100 to carry out the steps performed by terminal B in the method of establishing a data transmission channel provided by the embodiments of the present application.
The software system of the terminal device 100 may adopt a hierarchical architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes a hierarchical architecture system as an example, and exemplifies a software structure of the terminal device 100.
Fig. 6 is a block diagram of the software configuration of the terminal device 100 according to the embodiment of the present invention.
The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system library, and a kernel layer from top to bottom.
The application layer may include a series of application packages.
As shown in fig. 6, the application package may include applications such as camera, gallery, calendar, phone call, map, navigation, WLAN, bluetooth, music, video, short message, tank war, etc.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions.
As shown in FIG. 6, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, communication interface program, and the like. Among other things, the communication interface program is used to provide an interface for cross-device communication for one or more communication applications (e.g., gallery application, tank warfare application) in the terminal device 100, and to establish a virtual channel with the communication application, and so on. When the terminal device 100 is implemented as a terminal a, the communication interface program is implemented as an interface a provided in the embodiment of the present application; when the terminal device 100 is implemented as the terminal a, the communication interface program is implemented as the interface B provided in the embodiment of the present application.
The window manager is used for managing window programs. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
The view system includes visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
The phone manager is used to provide the communication function of the terminal device 100. Such as management of call status (including on, off, etc.).
The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a short dwell, and does not require user interaction. Such as a notification manager used to inform download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scroll bar text at the top status bar of the system, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, prompting text information in the status bar, sounding a prompt tone, vibrating the electronic device, flashing an indicator light, etc.
The Android Runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling and managing an Android system.
The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface managers (surface managers), Media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), and the like.
The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
The media library supports a variety of commonly used audio, video format playback and recording, and still image files, among others. The media library may support a variety of audio-video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, and the like.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
[ EXAMPLES one ]
A specific embodiment of the present application will be described below by taking as an example a scenario shown in fig. 1 (a scenario in which a user a and a user B play an online game of "tank battle" via a terminal a (as a first terminal) and a terminal B (as a second terminal)). In the present embodiment, "tank war a (as a first application program)" is used as an application for initiating a connection, and "tank war B (as a second application program)" is used as an application for accepting a connection.
Referring to fig. 7, in order to establish the data transmission channel P shown in fig. 3, the method for establishing the data transmission channel P provided in this embodiment includes the following stages:
s110: a device discovery phase. And the terminal A starts the equipment scanning function to discover the terminal B and acquire the communication address information of the terminal B.
S120: a physical channel establishment phase. Based on the acquired communication address information of the terminal B, the terminal a establishes a physical channel (as an inter-device communication channel) with the terminal B.
S130: and (5) equipment trust phase. In order to improve the security of the service data transmission, the terminal B performs trust authentication on the terminal a, and determines whether to establish a further connection with the terminal a (i.e., whether to establish the virtual channel in step S500) based on the trust authentication result.
S140: and a key exchange stage. The terminal a and the terminal B exchange a secret key for encrypting the service data, so as to further improve the security of service data transmission.
S150: and a virtual channel establishing stage. Based on the successful establishment of the physical channel in step S200 and based on the authentication of the terminal B by the credit granting to the terminal a in step S300, the tank warfare a establishes a virtual channel a (as a first inter-process communication channel) with the interface a (as a first communication interface program), and the tank warfare B establishes a virtual channel B (as a second inter-process communication channel) with the interface B (as a second communication interface program). The virtual channel a, the virtual channel B, and the physical channel established between the interface a and the interface B in step S120 form a data transmission channel P between the tank fighter a and the tank fighter B.
After the data transmission channel P is established between the tank war A and the tank war B through the steps, the tank war A and the tank war B can transmit service data through the data transmission channel P.
The specific steps of each stage will be described below.
Referring to fig. 8a, the device discovery phase S110 comprises the following steps:
s111: the tank war a sends a device discovery request to interface a.
The tank warfare A responds to the equipment discovery instruction of the user, and sends an equipment discovery request to the interface A, for example, after the user A opens a game application 'tank warfare A' on the terminal A and clicks a 'search equipment' button on a game interface, the tank warfare A sends the equipment discovery request to the interface A. In this embodiment, the tank warfare a sends a device discovery request to an Interface a by calling an Application Programming Interface (API) function startDiscovery () provided by the Interface a.
S112: in response to receiving a device discovery request transmitted from the tank fighter a, the interface a performs device discovery.
The interface a turns on the device scanning function of the terminal a in response to receiving the device discovery request of the tank warfare a to acquire device information of the candidate connection terminal. For example, the interface a starts a WiFi scanning function of the terminal a to receive a WiFi broadcast message externally sent by the terminal B. After receiving the WiFi broadcast message of the terminal B, the interface a may obtain the device information of the terminal B carried in the broadcast message by analyzing the broadcast message.
In this embodiment, the interface a may turn on multiple scanning functions of the terminal a, for example, simultaneously turn on a bluetooth scanning function and a WiFi scanning function of the terminal a, so as to perform device discovery in multiple forms.
The interface a scans the acquired device information of the candidate connection terminal as the device information exposed to the outside by the candidate connection terminal, for example, the device information exposed to the outside by the candidate connection terminal in a broadcast form (for example, WiFi broadcast, bluetooth broadcast, local area network broadcast, etc.).
The device information of the candidate connection terminal at least includes communication address information of the candidate connection terminal, for example, network address information (for example, IP address, port number) of the candidate connection terminal, and physical address information (for example, MAC address of the candidate connection terminal) of the candidate connection terminal, so that the interface a can establish communication connection with the candidate connection terminal according to the acquired communication address information of the candidate connection terminal.
In some embodiments, the device information of the candidate connection terminal includes device identification information of the candidate connection terminal, for example, a device name of the candidate connection terminal, a user name of the candidate connection terminal, and the like, so as to facilitate the user to identify the candidate connection terminal.
In some embodiments, the device information of the candidate connection terminal device further includes a communication connection mode supported by the candidate connection terminal, a list of applications supported by the candidate connection terminal, and the like, so as to facilitate the user to select a candidate connection terminal that wishes to establish a connection from among the candidate connection terminals.
In some embodiments, the device information of the candidate connection terminal further includes a version of an operating system of the candidate connection terminal, and the user may determine a version of a communication interface program of the candidate connection terminal (e.g., interface B of terminal B) according to the version of the operating system of the candidate connection terminal to determine whether the version of the communication interface program of the present terminal can be compatible with the version of the communication interface program of the candidate connection terminal (generally, forward compatibility).
In some embodiments, the interface a assigns each candidate connection terminal an apparatus number for uniquely identifying the candidate connection terminal (e.g., the interface a assigns the candidate connection terminals numbers in the order in which they are discovered) so as to identify the candidate connection terminals during the subsequent communication connection.
S113: and the interface A sends the equipment discovery result to the tank warfare A.
The interface a transmits the device information of the candidate connection terminal found in step S112 to the tank fighter a, and specifically, the interface a transmits the device information of the candidate connection terminal to the tank fighter a through a callback function registered in the tank fighter a in the startDiscovery ().
After receiving the device information of the candidate connection terminal sent by the interface A, the tank warfare A generates a device selection interface, and a user can select the candidate connection terminal which wants to establish connection through the device selection interface.
Fig. 8b is a device selection interface generated by the tank warfare a in this embodiment, and the device selection interface includes the device identification information of the 3 candidate connection terminals discovered in step S112 (for example, the device name "Nova 4" of the candidate connection terminal) and the supported communication connection mode (for example, WiFi P2P, bluetooth).
In other embodiments, other device information of the candidate connection terminal, for example, a version number of the operating system, a list of supported applications, and the like, may also be displayed on the device selection interface.
The device discovery stage S110 is configured to discover candidate connection terminals capable of establishing communication connection, and acquire device information of the candidate connection terminals. After acquiring the device information of the candidate connection terminal, the method provided in this embodiment enters a physical channel establishing stage S120.
Referring to fig. 9a, the physical channel establishing stage S120 provided in this embodiment includes the following steps:
s121: the tank warfare A sends a device connection request to the interface A, and the device connection request is used for indicating the interface A to establish a physical channel for connecting the terminal A and the terminal B.
Referring to fig. 9B, the candidate connection terminal desired to establish a connection selected by the user on the device selection interface is Nova4 (corresponding to terminal B of the present embodiment), and the communication mode desired to establish a connection is WiFi P2P mode. In response to the user's selection operation, the tank warfare a transmits a device connection request to the interface a to instruct the interface a to establish a physical channel for connecting the terminal a and the terminal B through the WiFi P2P communication protocol. In this embodiment, the tank warfare a sends a device discovery request to the Interface a by calling an Application Programming Interface (API) function connect () provided by the Interface a.
The equipment connection request sent by the tank warfare A to the interface A comprises the communication address information of the terminal B and/or the equipment number of the terminal B, so that the interface A establishes communication connection with the interface B according to the received equipment connection request.
S122: interface a establishes a communication connection with interface B based on an inter-device communication protocol to establish a physical channel for connecting terminal a and terminal B.
After receiving a device connection request sent by the tank warfare A, the interface A establishes communication connection between devices and the interface B through a WiFi P2P protocol, and the establishment of a physical channel is completed.
In this embodiment, the interface a and the interface B establish a communication connection based on the WiFi P2P communication protocol, but the application is not limited thereto, and in other embodiments, the interface a and the interface B may also establish a communication connection based on other inter-device communication protocols, for example, a local area network communication protocol, a bluetooth communication protocol, and the like.
After a physical channel between the terminal A and the terminal B is established, the terminal B performs credit authorization on the terminal A in order to ensure the security of subsequent service data transmission.
Referring to fig. 10a, the device trust phase S130 provided in this embodiment includes the following steps:
s131: the interface A sends a device credit granting request to the interface B through a physical channel, wherein the device credit granting request comprises user account information of the terminal A;
s132: the interface B judges whether the received user account information of the terminal A is consistent with the user account information of the terminal B, and if so, the interface B passes the credit authorization of the terminal A; if the two are not matched, step S133 is executed to further acquire the trust authentication information of the terminal a, so as to further authenticate the terminal a.
That is, the credit granting method provided in this embodiment is divided into a same account credit granting method and a different account credit granting method. When the user account information of the terminal A is consistent with that of the terminal B, the interface B judges that the user of the terminal A is the same as that of the terminal B, belongs to safe equipment, and the same account number credit granting mode is adopted to grant the credit to the terminal A, namely the credit granting authentication of the terminal A is directly passed.
When the user account information of the terminal A is inconsistent with the user account information of the terminal B, the interface B judges that the terminal A is equipment needing further authentication, so that the terminal A is trusted by adopting a different account number trust method, namely whether the terminal A passes the trust authentication of the terminal A is determined according to the trust authentication information from the terminal A.
S133: the interface B acquires the credit authorization information from the terminal A to determine whether the credit authorization of the terminal A is passed.
In this embodiment, the interface B sends a PIN code acquisition request to the interface a to trigger the interface a to generate a PIN code input interface as shown in fig. 10B. After that, the interface a transmits a PIN code (as one example of credit authentication information) input by the user to the interface B. After receiving the PIN code from the terminal A, the interface B determines whether the PIN code passes the credit authorization of the terminal A or not according to the PIN code, for example, when the received PIN code is consistent with the PIN code of the terminal B, the interface B passes the credit authorization of the terminal A and sends a message that the credit authorization passes to the interface A; otherwise, the terminal A does not pass the credit authorization.
In other embodiments, the interface a may also perform trust authentication on the terminal a through other manners. For example, in a "scanning" manner, specifically, the terminal a obtains the pairing information (the pairing information may be device information of the terminal B) included in the two-dimensional code by scanning the two-dimensional code displayed by the terminal B (the interface B may be used to generate the two-dimensional code), and then the interface a sends the obtained pairing information (as an example of the credit authorization information) to the interface B. After receiving the pairing information from the interface A, the interface B determines whether the pairing information passes the credit authorization of the terminal A.
In addition, in the embodiment, at least after the terminal a is authenticated by the credit authorization of the interface B, the interface a sends a notice that the physical channel is successfully created to the tank warfare a. For example, the interface a transmits a notice of the success of physical channel creation to the tank warfare a through a callback function of the tank warfare a registered in connect (). However, the present application is not limited thereto, and in some embodiments, after the physical channel is successfully created, the interface a sends a notification that the physical channel is successfully created to the tank fighter a.
Next, the process of the key exchange stage S140 provided in this embodiment is described, specifically:
the interface A generates a pair of asymmetric secret keys A, a private key in the asymmetric secret keys A is stored locally, and a public key (serving as a first secret key) in the asymmetric secret keys A is sent to the interface B through a physical channel; in the subsequent service data transmission process, the interface B encrypts the service data sent to the interface A through a public key in the asymmetric secret key A, and the interface A decrypts the encrypted data from the interface B through a locally stored private key after receiving the encrypted data.
The interface B generates a pair of asymmetric secret keys B, a private key in the asymmetric secret keys B is stored locally, and a public key (serving as a second secret key) in the asymmetric secret keys B is sent to the interface A through a physical channel; in the subsequent service data transmission process, the interface A encrypts the service data sent to the interface B through a public key in the asymmetric secret key A, and the interface B decrypts the encrypted data from the interface A through a locally stored private key after receiving the encrypted data.
In this embodiment, the secret key exchanged by the interface a and the interface B is a public key in the asymmetric secret key, so that the transmission of the private key in the communication channel can be avoided, and the security of the secret key can be improved.
But the application is not limited thereto. For example, in other embodiments, interface a may also generate symmetric key a and send symmetric key a to interface B through a physical channel.
The following describes the procedure of the virtual channel establishing stage S150 provided in this embodiment.
In the virtual channel establishing stage S150 provided in this embodiment, based on the successful creation of a physical channel for connecting the terminal a and the terminal B (physical channel establishing stage S120), and based on the interface B through the trust authentication for the terminal a (device trust stage S130), a virtual channel a is established between the tank warfare a and the interface a based on the inter-process communication mechanism, and a virtual channel B is established between the interface B and the tank warfare B based on the inter-process communication mechanism.
That is, in this embodiment, it is assumed that the following steps S151 to S155 are started when the physical channel for connecting the terminal a and the terminal B is successfully created and the interface B performs the trust authentication for the terminal a. However, the present application is not so limited and in other embodiments, steps S151-S155 may be opened based only on the successful creation of a physical channel.
In this embodiment, the inter-process communication mechanism may be a memory sharing mechanism, a socket mechanism, a pipeline mechanism, etc., and the pipeline mechanism is described as an example below.
Referring to fig. 11a, after the physical channel is successfully created and the interface B passes the trust authentication of the terminal a, the virtual channel establishing stage S150 of the embodiment includes the following steps:
s151: the tank warfare A and the interface A create a virtual channel A.
When the tank war A needs to send service data to the tank war B, the tank war A creates a pipeline PipeA based on a pipeline mechanism. After the pipeline PipeA is created, the tank fighter A may obtain file descriptors (also referred to as "handles") for the two endpoints of the pipeline PipeA (PipeA [0] and PipeA [1], respectively). The file descriptor for endpoint PipeA [0] is denoted Afd0 and the file descriptor for endpoint PipeA [1] is denoted Afd 1. According to the pipe mechanism, data can be written to/read from the pipe by performing write/read operations on file descriptors of pipe endpoints.
After acquiring the file descriptors of the two endpoints of the pipe PipeA, the tank fighter A saves the file descriptor of one endpoint (e.g., the file descriptor Afd0 of the endpoint PipeA [0 ]), and transmits the file descriptor of the other endpoint (e.g., the file descriptor Afd1 of the endpoint PipeA [1]) to the interface A, so as to complete the creation of the virtual channel A.
In this embodiment, the pipe is created by the tank war a, but the present application is not limited thereto, and in another embodiment, the pipe may be created by the interface a.
S152: the interface A allocates a channel number for the virtual channel A, and the channel number is used for uniquely identifying the virtual channel A.
S153: the interface A sends a message that the virtual channel A is established to the interface B to trigger the terminal B side to establish the virtual channel B. Specifically, the interface a sends a message that the virtual channel a has been established to the interface B through the physical channel, and the message carries the channel number of the virtual channel a.
S154: in response to receiving a message that virtual channel a has been established, interface B creates virtual channel B with tank war B.
After receiving the message that the virtual channel a has been established, the interface B creates a pipe based on the pipe mechanism. After the pipe PipeB is created, interface B may retrieve the file descriptors (also referred to as "handles") of the two endpoints of the pipe PipeB (PipeB [0] and PipeB [1], respectively). The file descriptor for endpoint PipeB [0] is denoted Bfd0 and the file descriptor for endpoint PipeB [1] is denoted Bfd 1.
Interface B, after acquiring the file descriptors of the two endpoints of pipe, saves the file descriptor of one of the endpoints (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 warrior B to complete the creation of virtual channel B.
In this embodiment of the application, an application registration list is stored in the communication interface program (e.g., interface a or interface B), the application registration list includes an application identifier (e.g., an application name) of an application program that has been registered in the communication interface program, and the communication interface program may determine, according to the application registration list, an application program that is in the local computer and is used for pairing (i.e., performing service interaction) with an application program of a peer device.
For example, the application program registration list stored in interface B includes the application identifier of tank war B (for example, the application name "tank war" of tank war B), and interface B can acquire the application identifier of tank war a from interface a (for example, the application name "tank war" of tank war a, which can be carried in a message that interface a sends virtual channel a to interface B that virtual channel a has been established). After receiving the application identifier of the application program A, the interface B determines that the tank war B is an application matched with the tank war A according to the application identifier of the application program A and an application program registration list stored in the interface B, and therefore the file descriptor Bfd1 of the endpoint PipeB [1] of the pipeline PipeB is sent to the tank war B so as to establish a virtual channel B with the tank war B.
In this embodiment, the pipe is created by the interface B, but the present application is not limited thereto, and in another embodiment, the pipe may be created by the tank wars B.
S155: the interface B allocates a channel number for the virtual channel B, and the channel number is used for uniquely identifying the virtual channel B.
Specifically, the interface B determines the channel number of the virtual channel B according to the channel number of the virtual channel a and a predetermined number setting rule. For consistency of description, the numbering scheme is described in detail below.
The method for creating a virtual channel is described above by taking an example that a terminal a side first establishes a virtual channel a, and then triggers a terminal B side to establish a virtual channel B, but the present application is not limited thereto, and in other embodiments, a terminal B side may first establish a virtual channel B, and then notify an interface a of a message that the virtual channel B has been established, so as to trigger the terminal a to establish the virtual channel a.
After the virtual channel A and the virtual channel B are established, the virtual channel A, the physical channel and the virtual channel B are sequentially connected to form a data transmission channel P for connecting the tank war A and the tank war B, and the tank war A and the tank war B can perform data interaction based on the data transmission channel P. The explanation will be given by taking an example in which the tank war a transmits data D to the tank war B.
Terminal a side: first, the tank fighter a writes data D to the pipe (by writing to the file identifier Afd0), and the interface a reads data D from the other end of the pipe (by reading to the file identifier Afd 1); then, the interface A encrypts the data D through a public key in the asymmetric secret key B, adds a channel number of the virtual channel A to the head of the data D, and sends the data D to the interface B through a physical channel;
terminal B side: after receiving the data D, the interface B analyzes the channel number of the virtual channel A carried in the data packet, and encrypts the data D through a private key in the asymmetric secret key B; after that, the interface B writes the decrypted data D into the pipeline PipeB, and the tank war B reads the data D from the other end of the pipeline PipeB, thereby realizing the transmission of the data B from the tank war A to the tank war B.
It should be noted that the present embodiment is an exemplary illustration of the technical solution of the present application, and those skilled in the art may make other modifications. For example, in another embodiment, in the device discovery phase, the tank wars a may discover the terminal B through its own program module instead of discovering the terminal B through the interface a; as another example, when the service data does not need to be encrypted, the step of the key exchange stage may be omitted.
In addition, in order to realize concurrent transmission, a plurality of data transmission channels P can be established between the tank war A and the tank war B, and each data transmission channel P is used for transmitting a single file.
Referring to fig. 11B, the tank war a and the tank war B include 6 data transmission channels P (respectively denoted as channel P1-channel P6), and the physical channels between the data transmission channels P are shared, and the virtual channels are independent. For example, the data transmission channel P1 includes a virtual channel a1, a physical channel and a virtual channel B1 connected in sequence; the data transmission channel P2 comprises a virtual channel A2, a physical channel and a virtual channel B2 which are connected in sequence; the data transmission channels P3-P6 are analogized and are not described in detail.
In fig. 11B, the active end of each data transmission channel P, which initiates a service connection, is marked with a solid circle, that is, the virtual channel tank warfare a in the data transmission channels P1, P3, and P5 is initiated to be created, and the virtual channel tank warfare B in the data transmission channels P2, P4, and P6 is initiated to be created.
When both the actively created virtual channel and the passively created virtual channel exist in the terminal, a problem of channel number collision may occur, thereby possibly causing an error in data transmission. For example, tank fighter a actively creates virtual channel a1, interface a numbering virtual channel a1 as a; after that, interface a receives the notification sent by interface B that terminal B establishes virtual channel B2, and the number of virtual channel B2 is also a, at this time, tank war a (or interface a) is triggered to establish virtual channel a2, if interface a sets the number of virtual channel a2 to a according to the number a of virtual channel B2, then the numbers of virtual channel a1 and virtual channel a2 will collide. Thus, when interface A receives data from virtual channel B2, it cannot be determined whether the data was transmitted through virtual channel A1 or virtual channel A2.
Therefore, the embodiment of the application provides a numbering setting rule for numbering virtual channels. According to the number setting rule of the present embodiment, the number of the virtual lane at the active end (the end that initiates virtual lane creation) and the number of the virtual lane at the slave end (the end that passively triggers virtual lane creation) have different parity, and the number of the virtual lane at the active end and the number of the virtual lane at the slave end have a set difference. For example, referring to fig. 11b (the channel numbers of the virtual channels are shown in the small brackets), 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) which are 1 greater than the numbers of the active virtual channels. The present application is not so limited and in other embodiments, the difference may be other values, for example, + 5; or the number of the driving end virtual channel is an odd number, and the number of the driven end virtual channel is an even number with a set difference value with the driving end.
The channel number setting rule provided by the embodiment can effectively avoid the problem of number conflict of the virtual channel. For example, when interface B receives data with channel number 4, it can determine that the data comes from the virtual channel actively established by interface a, and since the number of the slave virtual channel is 1 greater than the number of the master virtual channel, interface B should hand the data to the virtual channel with number "5" (i.e. virtual channel B3); for another example, when interface B receives data with lane number 5, it may determine that the data comes from a virtual lane passively established by interface a, and since the number of the active side virtual lane is 1 less than the number of the passive side, interface B should hand the data to the virtual lane with number "4" (i.e., virtual lane B4).
In summary, with the method for establishing a data transmission channel provided by this embodiment, a communication application program (for example, a distributed application "tank battle") on a terminal does not need to directly implement cross-device communication, but instead, the task of cross-device communication is handed over to a communication interface program (for example, interface a, interface B) on the terminal for execution, so that the setting or non-setting of a communication module in the communication application program can be simplified, thereby reducing the labor cost for program development. In addition, the embodiment of the application can also reduce the relevance between the distributed application program and the communication modes supported by the terminal, thereby improving the portability of the distributed application program.
[ example two ]
First embodiment takes a tank battle a and a tank battle B as an example, and introduces the step of establishing a data transmission channel P for the 1 st application that establishes a data transmission channel between a terminal a and a terminal B. As described above (fig. 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 the terminal a and the terminal B, and therefore, a second embodiment 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 1 st application of the terminal a and the terminal B.
Specifically, the method for establishing a data transmission channel provided in this embodiment is described below by taking a gallery application as an example. That is, how a data transmission channel is established between the gallery application on the terminal a and the gallery application on the terminal B after the data transmission channel has been established between the tank fighter a and the tank fighter B will be described below. It is to be understood that the present embodiment may be applied to applications other than a gallery application.
For convenience of description, the gallery application on terminal a will be referred to herein as "gallery a (as the third application)", and the gallery application on terminal B will be referred to as "gallery B (as the fourth application)".
Referring to fig. 12, the method for establishing a data transmission channel according to this embodiment includes:
s210: the device discovery stage includes steps S211 to S213, specifically:
s211: in response to a picture sharing instruction input by a user, a gallery A on a terminal A sends a device discovery request to an interface A;
s212: in response to receiving the device discovery request sent by the gallery A, the interface A starts the device scanning function of the terminal A to acquire the device information of the candidate connection terminal.
S213: and the interface A sends the equipment discovery result to the gallery A, and the gallery A displays an equipment selection interface.
The process of the device discovery stage S210 in this embodiment is substantially the same as that of the device discovery stage S110 in the first embodiment, and therefore, other details of the device discovery stage S210 in this embodiment may refer to the description in the first embodiment and are not repeated.
S220: the physical channel confirmation stage includes step S221 and step S222, and specifically includes:
s221: the gallery A sends a device connection request to the interface A, and the device connection request is used for indicating the interface A to establish a physical channel for connecting the terminal A and the terminal B.
S222: interface a returns a notification to gallery a that the physical channel has been created. Since the physical channel is already established and the terminal B has granted the trust to the terminal a in the first embodiment, when the interface a receives the device connection request sent by the gallery a, a notification that the physical channel has been created is returned to the gallery a.
S230: the virtual channel establishing stage includes steps S231 to S235, specifically:
s231: gallery A creates a virtual channel C (as a third interprocess communication channel) with interface A. Based on confirming that the physical channel is created, when gallery A needs to send a picture file to gallery B, virtual channel C is established.
S232: the interface A allocates a channel number for the virtual channel C, and the channel number is used for uniquely identifying the virtual channel C.
S233: and the interface A sends a message that the virtual channel C is established to the interface B to trigger the terminal B side to establish the virtual channel D. The message sent by the interface a to the interface B and established by the virtual channel a includes the channel number of the virtual channel C.
S234: in response to receiving the message that virtual channel C has been established, interface B creates virtual channel D (as a fourth interprocess communication channel) with gallery B.
S235: and the interface B allocates a channel number for the virtual channel D, and the channel number is used for uniquely identifying the virtual channel D. Specifically, the interface B determines the channel number of the virtual channel D according to the channel number of the virtual channel C and the number setting rule described in the first embodiment.
The process of the virtual channel establishing stage S230 in this embodiment is substantially the same as that of the virtual channel establishing stage S150 in the first embodiment, and therefore, other details of the virtual channel establishing stage S230 in this embodiment may refer to the description in the first embodiment and are not repeated.
Referring to fig. 13, after the virtual channel C and the virtual channel D are established, the virtual channel C, the physical channel, and the virtual channel D are sequentially connected to form a data transmission channel for connecting the gallery a and the gallery B, and the gallery a and the gallery B may perform data interaction based on the data transmission channel.
In this embodiment, a plurality of communication applications (for example, tank war a and gallery a on terminal a) on the terminal can communicate with the opposite terminal device through interface a, so that each distributed application can be prevented from repeatedly developing a communication module, and the repetition and waste of development workload can be avoided.
Because the terminal B has already granted the credit to the terminal a in the process of establishing the data transmission channel between the tank war a and the tank war B, when the data transmission channel is established by the subsequent pairing applications (for example, the gallery a and the gallery B) on the terminal a and the terminal B, the credit granting process of the terminal B to the terminal a does not have to be repeated, and compared with the situation that the credit granting process is repeated once when the communication connection is established between the pairing applications in the prior art, the connection process between the pairing applications can be simplified.
Similarly, in the process of establishing a data transmission channel between the tank war a and the tank war B, the terminal a and the terminal B respectively receive a secret key from an opposite terminal device, and the terminal can encrypt service data of subsequent pairing applications (for example, gallery a and gallery B) on the terminal a and the terminal B through the received secret key. In this way, when the subsequent paired applications of the terminal a and the terminal B establish the data transmission channel, it is not necessary to repeat the key exchange process, so that the connection process between the paired applications can be further simplified.
The present embodiment can also save communication resources (e.g., port number resources) in the terminal. Specifically, since the present embodiment can implement cross-device communication between multiple applications (for example, the tank warfare a and the gallery a on the terminal a) through one physical channel (the operating system only needs to allocate a port number to the physical channel), port number resources in the system can be saved compared with a case in which each application establishes a physical channel (the operating system needs to allocate a port number to each physical channel) in the prior art (as shown in fig. 2).
In addition, because a plurality of applications in the terminal carry out cross-device communication through the communication interface program, the communication interface program can conveniently manage the transmission priority of each application, preferentially ensure the transmission of service data with high real-time requirement, and improve the user experience.
For example, when the tank warfare A and the gallery A in the terminal A need to transmit data through a physical channel at the same time, the interface A determines the order of transmission of service data according to the priority levels of the tank warfare A and the gallery A. In the embodiment, the tank warfare A has higher requirement on the real-time performance of data, so the priority level of the tank warfare A is higher; the gallery A has low requirement on data real-time performance, so the priority level of the gallery A is low. Therefore, when the tank fighter a and the gallery a in the terminal a need to transmit data through the physical channel at the same time, the interface a determines to transmit the service data of the tank fighter a first and then transmit the service data of the gallery a after a certain time delay (e.g., 2 s).
In this embodiment, the priority level of the application may be determined by the application itself, or may be determined by a communication interface program in the terminal where the application is located. For example, the priority ranking of the tank fighter a may be determined by the tank fighter a itself, or may be determined by the interface a.
Referring now to fig. 14, shown is a block diagram of a terminal device 400 in accordance with one embodiment of the present application. The end device 400 may include one or more processors 401 coupled to a controller hub 403. For at least one embodiment, the controller hub 403 communicates with the processor 401 via a multi-drop Bus such as a Front Side Bus (FSB), a point-to-point interface such as a QuickPath Interconnect (QPI), or similar connection 406. Processor 401 executes instructions that control 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 separate chips) (not shown), where the GMCH includes a Memory and a Graphics Controller and is coupled to the IOH.
The terminal device 400 may also include a coprocessor 402 and memory 404 coupled to the controller hub 403. Alternatively, one or both of the memory and GMCH may be integrated within the processor (as described herein), with the memory 404 and coprocessor 402 coupled directly to the processor 401 and controller hub 403, with the controller hub 403 and IOH in a single chip.
The Memory 404 may be, for example, a Dynamic Random Access Memory (DRAM), a Phase Change Memory (PCM), or a combination of the two. Memory 404 may include one or more tangible, non-transitory computer-readable media for storing data and/or instructions therein. A computer-readable storage medium has stored therein instructions, and in particular, temporary and permanent copies of the instructions. When the instructions are executed on a computer, the computer is caused to execute the method disclosed in the first embodiment and/or the second embodiment.
The terminal apparatus 400 shown in fig. 14 may be implemented as a terminal a and a 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 steps of the method as performed by terminal a in the method illustrated in fig. 7, 8a, 9a, 10a, 11a, 12. 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 processor, cause terminal B to perform the steps as performed by terminal B in the methods shown in fig. 7, 8a, 9a, 10a, 11a, 12.
In one embodiment, the coprocessor 402 is a special-purpose processor, such as, for example, a high-throughput MIC (man Integrated Core) processor, a network or communication processor, compression engine, graphics processor, GPGPU (General-purpose computing on graphics processing unit), embedded processor, or the like. The optional nature of coprocessor 402 is represented in FIG. 14 by dashed lines.
In one embodiment, the terminal device 400 may further include a Network Interface Controller (NIC) 406. The network interface 406 may include a transceiver to provide a radio interface for the terminal device 400 to communicate with any other suitable device (e.g., front end module, antenna, etc.). In various embodiments, the network interface 406 may be integrated with other components of the terminal device 400. The network interface 406 may implement the functions of the communication unit in the above-described embodiments.
The terminal device 400 may further include an Input/Output (I/O) device 405. I/O405 may include: a user interface designed to enable a user to interact with the terminal device 400; the design of the peripheral component interface enables peripheral components to also interact with the terminal device 400; and/or sensors are designed to determine environmental conditions and/or location information associated with the terminal device 400.
It is noted that fig. 14 is merely exemplary. That is, although it is shown in fig. 14 that the terminal device 400 includes a plurality of devices such as a processor 401, a controller hub 403, a memory 404, etc., in practical applications, a device using the methods of the present application may include only a part of the devices of the terminal device 400, for example, may include only the processor 401 and the network interface 406. The nature of the alternative device in fig. 14 is shown in dashed lines.
Referring now to fig. 15, shown is a block diagram of a SoC (System on Chip) 500 in accordance with an embodiment of the present application. In fig. 15, like parts have the same reference numerals. In addition, the dashed box is an optional feature of more advanced socs. In fig. 15, the SoC500 includes: an interconnect unit 550 coupled to the processor 510; a system agent unit 580; a bus controller unit 590; an integrated memory controller unit 540; a set 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; a Direct Memory Access (DMA) unit 560. In one embodiment, coprocessor 520 comprises a special-purpose processor, such as, for example, a network or communication processor, compression engine, GPGPU (General-purpose computing on graphics processing units, General-purpose computing on a graphics processing unit), high-throughput MIC processor, or embedded processor, among others.
Static Random Access Memory (SRAM) unit 530 may include one or more tangible, non-transitory computer-readable media for storing data and/or instructions. A computer-readable storage medium has stored therein instructions, and in particular, temporary and permanent copies of the instructions. The instructions, when executed on a computer, cause the computer to perform the methods disclosed in embodiment one and/or embodiment two above.
The socs shown in fig. 15 may be provided in the terminal a and the terminal B, respectively. When the SoC is provided in terminal a, a Static Random Access Memory (SRAM) unit 530 has stored therein instructions that may include: instructions that, when executed by at least one of the processors, cause terminal a to perform the steps of the method as performed by terminal a in the method illustrated in fig. 7, 8a, 9a, 10a, 11a, 12. When the SoC is set in the terminal B, the Static Random Access Memory (SRAM) unit 530 stores therein instructions, which may include: instructions that, when executed by at least one processor, cause terminal B to perform the steps as performed by terminal B in the methods shown in fig. 7, 8a, 9a, 10a, 11a, 12.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. The symbol "/" indicates a relationship in which the associated object is an or.
The method embodiments of the present application may be implemented in software, magnetic, firmware, etc.
Program code may be applied to input instructions to perform the functions described herein and generate output information. The output information may be applied to one or more output devices in a known manner. For purposes of this application, a 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.
The program code may be implemented in a high level procedural or object oriented programming language to communicate with a processing system. The program code can also be implemented in assembly or machine language, if desired. Indeed, the mechanisms described herein are not limited in scope to any particular programming language. In any case, the language may be a compiled or interpreted language.
One or more aspects of at least one embodiment may be implemented by representative instructions stored on a computer-readable storage medium, which represent various logic in a processor, which when read by a machine causes the machine to fabricate logic to perform the techniques described herein. These representations, known as "IP (Intellectual Property) cores," may be stored on a tangible computer-readable storage medium and provided to a number of customers or production facilities to load into the manufacturing machines that actually manufacture the logic or processors.
In some cases, an instruction converter may be used to convert instructions from a source instruction set to a target instruction set. For example, the instruction converter may transform (e.g., using a static binary transform, a dynamic binary transform including dynamic compilation), morph, emulate, or otherwise convert the instruction into one or more other instructions to be processed by the core. The instruction converter may be implemented in software, hardware, firmware, or a combination thereof. The instruction converter may be on the processor, off-processor, or partially on and partially off-processor.

Claims (21)

1. A method for establishing data transmission channel is used for establishing a data transmission channel between a first application program of a first terminal and a second application program in a second terminal; characterized in that the method comprises:
the first application program sends a device connection request to a first communication interface program in the first terminal, wherein the device connection request is used for indicating 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 communication connection with a second communication interface program in the second terminal based on an inter-device communication protocol so as to establish the inter-device communication channel;
based at least on successful establishment of the inter-device communication channel, the first application program 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 program 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 the data transmission channel between the first application program and the second application program.
2. The method of claim 1, wherein the establishing based on at least the inter-device communication channel is successful, wherein the first application program and the first communication interface program establish a first inter-process communication channel based on an inter-process communication mechanism, and wherein 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 first application program and the first communication interface program establish the first inter-process communication channel at least based on the successful establishment of the inter-device communication channel;
the first communication interface program transmits the message of which the first interprocess communication channel is established to the second communication interface program;
in response to receiving the 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.
3. The method of claim 2, wherein the first communication interface program passes the message that the first interprocess communication channel is established to the second communication interface program, further comprising:
the message which is transmitted to the second communication interface program by the first communication interface program and is established by the first interprocess communication channel comprises a first channel number; the first channel number is a channel number that is allocated by the first communication interface program to the first inter-process communication channel and is used for uniquely identifying the first inter-process communication channel.
4. The method according to claim 3, wherein 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 number setting rule, the second channel number being a channel number for uniquely identifying the second inter-process communication channel.
5. The method according to claim 4, wherein the predetermined number setting rule is such that the first channel number and the second channel number have different parities and such that there is a set difference between the first channel number and the second channel number.
6. The method of claim 5, wherein the set difference is 1.
7. The method of claim 1, further comprising:
the first terminal sends a device credit granting request to the second communication interface program of the second terminal through the first communication interface program, so that the second communication interface program grants a credit for authenticating the first terminal; and,
based on the fact that the second communication interface program passes the credit authorization of the first terminal, the first application program and the first communication interface program establish the first inter-process communication channel, and the second communication interface program and the second application program establish the second inter-process communication channel.
8. The method according to claim 7, wherein the device credit granting request sent by the first terminal to the second terminal includes user account information of the first terminal; the second terminal performs credit authorization on the first terminal, and the method comprises the following steps:
the second communication interface program judges 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 credit authorization of the first terminal;
and 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 acquires the credit authorization information from the first terminal so as to determine whether the credit authorization of the first terminal passes according to the credit authorization information.
9. The method of claim 1, further comprising:
the first communication interface program sends a first secret key to the second communication interface program through the inter-device communication channel, wherein the first secret key is used for encrypting data sent by the second application program to the first application program; and/or the presence of a gas in the gas,
and the second communication interface program sends a second secret key to the first communication interface program through the inter-device communication channel, wherein the second secret key is used for encrypting data sent by the first application program to the second application program.
10. The method of claim 9, wherein the first key or the second key is a public key of an asymmetric key pair.
11. The method according to claim 1, wherein the device connection request sent by the first application program to the first communication interface program includes communication address information of the second terminal; the method further comprises the following steps:
the first application program sending a device discovery request to the first communication interface program;
in response to receiving the device discovery request, the first communication interface program starts a device scanning function of the first terminal to acquire device information of at least one candidate connection terminal of the first terminal, where the device information of the candidate connection terminal at least includes communication address information of the candidate connection terminal, and the at least one candidate connection terminal includes the second terminal;
the first communication interface program transmitting device information of the at least one candidate connection terminal to the first application program;
the first application determines the equipment information of the second terminal according to the equipment information of the at least one candidate connection terminal, and determines the content of the equipment connection request according to the equipment information of the second terminal;
and according to the content, the first application program sends a device connection request to a first communication interface program in the first terminal.
12. The method according to claim 11, wherein the device information of the candidate connection terminal device further includes device identification information of the candidate connection terminal, a communication connection mode supported by the candidate connection terminal, a version of an operating system of the candidate connection terminal, and/or a list of applications supported by the candidate connection terminal.
13. The method of claim 11, further comprising:
the first communication interface program allocates, to each of the candidate connection terminals, a device number for uniquely identifying each of the candidate connection terminals.
14. The method according to claim 1, wherein the second communication interface program stores an application registration list, and the application registration list includes an application identifier of the second application; the second communication interface program and the second application program establish a second interprocess communication channel based on an interprocess communication mechanism, including:
the second communication interface program receives an application identifier of a first application program sent by a first communication interface program, and determines that the second application program is an application program for performing service interaction with the first application program according to the application identifier of the first application program and the application program registration list;
based on determining that the second application is an application for business interaction with the first application, the second communication interface program establishes the second interprocess communication channel with the second application.
15. The method according to claim 1, wherein the method is further configured to establish a data transmission channel between a third application of the first terminal and a fourth application of the second terminal, and the method further comprises:
the third application program sends a device connection request to the first communication interface program so as to determine that the communication channel between the devices is established according to the reply message of the first communication interface program;
based at least on determining the inter-device communication channel to establish, the third application program 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 program 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 program and the fourth application program.
16. The method of claim 15, wherein the first communication interface program determines an order of transmission of the traffic data for the first application and the traffic data for the third application in the inter-device communication channel according to the priority level of the first application and the priority level of the third application.
17. The method of claim 16,
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.
18. The method of claim 1, wherein the interprocess communication mechanism is a pipe communication mechanism.
19. The method of claim 1, wherein the inter-device communication protocol is any one of: a local area network communication protocol; a bluetooth communication protocol; Wi-Fi P2P communication protocol.
20. A terminal system comprising a first terminal and a second terminal, wherein the first terminal is configured to perform the steps of any of claims 1 to 19 performed by the first terminal, and the second terminal is configured to perform the steps of any of claims 1 to 19 performed by the second terminal.
21. A computer-readable storage medium having stored thereon instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 19.
CN202010816673.XA 2020-08-14 2020-08-14 Method for establishing data transmission channel, terminal system and storage medium Pending CN114077502A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010816673.XA CN114077502A (en) 2020-08-14 2020-08-14 Method for establishing data transmission channel, terminal system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010816673.XA CN114077502A (en) 2020-08-14 2020-08-14 Method for establishing data transmission channel, terminal system and storage medium

Publications (1)

Publication Number Publication Date
CN114077502A true CN114077502A (en) 2022-02-22

Family

ID=80280527

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010816673.XA Pending CN114077502A (en) 2020-08-14 2020-08-14 Method for establishing data transmission channel, terminal system and storage medium

Country Status (1)

Country Link
CN (1) CN114077502A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114356678A (en) * 2022-03-17 2022-04-15 北京奇立软件技术有限公司 Method and system for acquiring hardware information of equipment
CN115842852A (en) * 2022-09-15 2023-03-24 北京国基科技股份有限公司 Inter-node communication method, system, storage medium and electronic equipment
WO2023202241A1 (en) * 2022-04-21 2023-10-26 华为云计算技术有限公司 Communication method and related product
WO2024198451A1 (en) * 2023-03-31 2024-10-03 华为技术有限公司 Data transmission method, apparatus, vehicle and device
WO2024260185A1 (en) * 2023-06-20 2024-12-26 华为技术有限公司 Data transmission method, terminal, and system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1409236A (en) * 2001-09-28 2003-04-09 讯宝科技公司 Method for keeping software connection between applied program during working of mobile computer terminal communication in radio network
CN102137123A (en) * 2010-01-25 2011-07-27 腾讯科技(北京)有限公司 Device and method for realizing process-to-process communication of different application programs on mobile terminal
CN107483696A (en) * 2017-07-12 2017-12-15 武汉卡比特信息有限公司 A kind of mobile phone and the communication means and system of computer equipment
CN107786411A (en) * 2017-10-19 2018-03-09 上海前隆信息科技有限公司 Inter-application communication tunnel connection/verification method/system, medium and equipment
CN109167827A (en) * 2018-08-21 2019-01-08 奇酷互联网络科技(深圳)有限公司 Method, computer equipment and the storage medium of mobile terminal synchronization application
CN110162255A (en) * 2019-05-30 2019-08-23 腾讯科技(深圳)有限公司 Operation method, device, equipment and the storage medium of stand-alone program
WO2020051916A1 (en) * 2018-09-14 2020-03-19 华为技术有限公司 Method for transmitting information and electronic device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1409236A (en) * 2001-09-28 2003-04-09 讯宝科技公司 Method for keeping software connection between applied program during working of mobile computer terminal communication in radio network
CN102137123A (en) * 2010-01-25 2011-07-27 腾讯科技(北京)有限公司 Device and method for realizing process-to-process communication of different application programs on mobile terminal
CN107483696A (en) * 2017-07-12 2017-12-15 武汉卡比特信息有限公司 A kind of mobile phone and the communication means and system of computer equipment
CN107786411A (en) * 2017-10-19 2018-03-09 上海前隆信息科技有限公司 Inter-application communication tunnel connection/verification method/system, medium and equipment
CN109167827A (en) * 2018-08-21 2019-01-08 奇酷互联网络科技(深圳)有限公司 Method, computer equipment and the storage medium of mobile terminal synchronization application
WO2020051916A1 (en) * 2018-09-14 2020-03-19 华为技术有限公司 Method for transmitting information and electronic device
CN110162255A (en) * 2019-05-30 2019-08-23 腾讯科技(深圳)有限公司 Operation method, device, equipment and the storage medium of stand-alone program

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114356678A (en) * 2022-03-17 2022-04-15 北京奇立软件技术有限公司 Method and system for acquiring hardware information of equipment
CN114356678B (en) * 2022-03-17 2022-06-14 北京奇立软件技术有限公司 Method and system for acquiring hardware information of equipment
WO2023202241A1 (en) * 2022-04-21 2023-10-26 华为云计算技术有限公司 Communication method and related product
CN115842852A (en) * 2022-09-15 2023-03-24 北京国基科技股份有限公司 Inter-node communication method, system, storage medium and electronic equipment
WO2024198451A1 (en) * 2023-03-31 2024-10-03 华为技术有限公司 Data transmission method, apparatus, vehicle and device
WO2024260185A1 (en) * 2023-06-20 2024-12-26 华为技术有限公司 Data transmission method, terminal, and system

Similar Documents

Publication Publication Date Title
CN114077502A (en) Method for establishing data transmission channel, terminal system and storage medium
EP4002108B1 (en) Application start method and electronic device
EP4084486A1 (en) Cross-device content projection method, and electronic device
CN113687803B (en) Screen projection method, screen projection source, screen projection destination, screen projection system and storage medium
WO2020192714A1 (en) Device control page display method, related apparatus and system
CN112291764A (en) Content connection method, system and electronic equipment
JP2023510368A (en) Wireless communication method and device having wireless communication function
WO2021073428A1 (en) Account number binding method, device and system
CN112860445B (en) A method and terminal for data sharing between a quick application and a native application
CN114554463A (en) Bluetooth communication method, Bluetooth broadcasting method, Bluetooth device, and storage medium
CN113676879A (en) A method, electronic device and system for sharing information
CN116244008B (en) Application launch methods, electronic devices and storage media
CN115130085A (en) Login authentication method and electronic equipment
WO2021227942A1 (en) Information sharing method, electronic devices and system
US20210127431A1 (en) Electronic device for transmitting data to external electronic device not connected thereto, and operation method of electronic device
CN114928898B (en) Method and device for establishing session based on WiFi direct connection
WO2022206770A1 (en) Method for collaborative work of applications between devices, and device
CN113608753A (en) Application uninstalling method, application recovery method, electronic device and storage medium
CN115022873B (en) Device communication method, device and storage medium
CN113950048B (en) Connection establishment method, electronic device and storage medium
US20230308604A1 (en) Video call making method, terminal device, and storage medium
WO2022188812A1 (en) Method for synchronizing software features between devices, and electronic device
CN119052323A (en) Card display method, device, system and storage medium
WO2024037040A9 (en) Data processing method and electronic device
WO2023207758A1 (en) Data processing method and apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination