CN114928899B - Physical link establishment method and electronic equipment - Google Patents
Physical link establishment method and electronic equipment Download PDFInfo
- Publication number
- CN114928899B CN114928899B CN202210841718.8A CN202210841718A CN114928899B CN 114928899 B CN114928899 B CN 114928899B CN 202210841718 A CN202210841718 A CN 202210841718A CN 114928899 B CN114928899 B CN 114928899B
- Authority
- CN
- China
- Prior art keywords
- communication interface
- count value
- interface module
- physical link
- electronic device
- 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.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/14—Direct-mode setup
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/11—Allocation or use of connection identifiers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/30—Connection release
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The embodiment of the application provides a method for establishing a physical link and electronic equipment, wherein the method is executed by first electronic equipment, the first electronic equipment comprises a first communication interface module and a first service module, and second electronic equipment comprises a second communication interface module, and the method comprises the following steps: the first communication interface module receives a first connection request sent by the first service module, wherein the first connection request is used for indicating the first communication interface module to establish a first physical link; responding to the first connection request, and acquiring a first total count value by the first communication interface module; and under the condition that the first total count value is greater than 0, the first communication interface module sends a first multiplexing connection request to the second communication interface module, and adds one to the first total count value, wherein the first multiplexing connection request is used for requesting the second communication interface module to multiplex a first physical link. The method can realize the multiplexing of the physical link.
Description
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method for establishing a physical link and an electronic device.
Background
Short-distance wireless communication technologies between devices, such as wireless fidelity peer to peer (Wi-Fi p2 p) technology, bluetooth (BT) technology, etc., provide great convenience to users. Taking Wi-Fi p2p technology as an example, two devices can establish a Wi-Fi p2p physical link based on the Wi-Fi p2p technology and further establish a logical link, so that data can be directly transmitted between the two devices to complete services such as file transmission, screen projection, online games and the like.
In the related art, a Wi-Fi p2p physical link between devices is established through a communication module in an Application (APP). However, at the same time, the Wi-Fi p2p physical links that a device can establish are limited, typically 1 or 2. If the Wi-Fi p2p physical link between two current devices is occupied by one application program and other application programs need to transmit data, the Wi-Fi p2p physical link can be obtained only in a preempting, reestablishing or waiting mode, and the problem of low efficiency exists.
Disclosure of Invention
The application provides a physical link establishing method and electronic equipment, which can realize multiplexing of a physical link and solve the problem of low physical link establishing efficiency.
In a first aspect, the present application provides a method for establishing a physical link, where the method is performed by a first electronic device, the first electronic device includes a first communication interface module and a first service module, and a second electronic device includes a second communication interface module, and the method includes: the first communication interface module receives a first connection request sent by the first service module, wherein the first connection request is used for indicating the first communication interface module to establish a first physical link; responding to the first connection request, the first communication interface module acquires a first total count value, wherein the first total count value is stored in the first electronic device and represents the effective request times of the first electronic device and the second electronic device to the first physical link, the effective request times are obtained by counting the effective connection request times and the effective disconnection request times, and the initial value of the first total count value is 0; and under the condition that the first total count value is greater than 0, the first communication interface module sends a first multiplexing connection request to the second communication interface module, and adds one to the first total count value, wherein the first multiplexing connection request is used for requesting the second communication interface module to multiplex a first physical link.
The first total count value is greater than 0, which indicates that the number of valid requests of the first physical link by the current first electronic device and the second electronic device is greater than 0, indicating that the current first physical link is established, and thus the first physical link can be multiplexed.
Optionally, the first connection request may include one or more of service identification information corresponding to the first service module, physical address information of the second electronic device, a link type of the first physical link, and the like. The service identification information may be, for example, a Process Identification (PID) corresponding to the first service module. The link type may be, for example, one of a Wi-Fi p2p link, a bluetooth Basic Rate (BR) link, a bluetooth Socket (Socket) link, or a bluetooth Enhanced Data Rate (EDR) link, etc.
Optionally, the first multiplexing connection request may include one or more of physical address information of the first electronic device and a link identifier of the first physical link.
Optionally, the first communication interface module may directly add one to the first total count value when it is determined that the first total count value is greater than 0, or add one to the first total count value after receiving the first multiplexing reply message sent by the second communication interface module.
According to the method for establishing the physical link, the first communication interface module and the second communication interface module are used for realizing the unified establishment and management of the physical link between the first electronic device and the second electronic device, and the first communication interface module and the second communication interface module are used as managers of the physical link and can acquire all information of the physical link, so that the physical link can be multiplexed when needed, waiting or reestablishing the physical link is not needed, the problem of low establishment efficiency of the physical link is solved, the efficiency of data transmission between the devices is improved, and the user experience is improved. Meanwhile, the utilization rate of the physical link is improved by multiplexing the physical link, and resources and power consumption are saved. In addition, the method manages the effective request times of the first physical link simply and conveniently by managing the first total count value, namely manages the use condition of the first physical link by the first electronic device and the second electronic device, so that when the first physical link needs to be used, whether the first physical link is established or not can be accurately known by judging whether the first total count value is 0 or not, and whether the first physical link can be multiplexed or not. And whether the first physical link is used or not and whether the first physical link needs to be disconnected can be timely and accurately obtained through the first total counting value, so that the physical link can be timely disconnected as required. In summary, the method provided by the embodiment can improve the management efficiency and accuracy of the physical link between the first electronic device and the second electronic device, thereby improving the data transmission efficiency. In addition, in the method, after the first multiplexing connection request is sent, the first total counting value is added by one, and the first total counting value is updated, so that the accuracy of the first total counting value is ensured.
In a possible implementation, the method further includes: under the condition that the first total count value is equal to 0, the first communication interface module sends a second connection request to the second communication interface module, wherein the second connection request is used for requesting to establish a first physical link with the second communication interface module; and in response to receiving the connection success information sent by the second communication interface module, the first communication interface module adds one to the first total count value, and the connection success information represents that the first physical link is successfully established.
The first total count value is equal to 0, which indicates that the number of valid requests of the first physical link by the current first electronic device and the current second electronic device is 0, indicating that the current first physical link is not established, and therefore, the first communication interface module sends a second connection request to the second communication interface module to establish the first physical link.
In the implementation mode, the successful connection information sent by the second communication interface module is received, the first connection request is indicated to be an effective connection request, the first total count value is added by one, the first total count value is updated, and the accuracy of the first total count value is ensured.
In a possible implementation, the method further includes: and in response to receiving a second multiplexing connection request sent by the second communication interface module, the first communication interface module adds one to the first total count value, and the second multiplexing connection request is used for requesting the first communication interface module to multiplex the first physical link.
Specifically, a service module in the second electronic device sends a connection request (fourth connection request) to the second communication interface module, and the second communication interface module sends the second multiplexing connection request to the first communication interface module when determining that the second total count value is greater than 0. And the second total count value is stored in the second electronic device and represents the effective request times of the first electronic device and the second electronic device to the first physical link. And the first communication interface module receives a second multiplexing connection request sent by the second communication interface module and adds one to the first total count value. Then, the first communication interface module may further send a second multiplexing reply message to the second communication interface module, and the second communication interface module adds one to the second total count value after receiving the second multiplexing reply message.
In this implementation manner, when the second electronic device multiplexes the first physical link, the first total count value is also updated, and the first total count value is incremented by one, so that the accuracy of the first total count value is further ensured, and the accuracy of the management of the first physical link is ensured.
In one possible implementation manner, in a case that the first total count value is greater than 0, the method further includes: the first communication interface module adds one to the first service count value, and the first service count value represents the number of times of effective requests of the first service module to the first physical link.
In a possible implementation, the method further includes: the first communication interface module receives a first disconnection request sent by the first service module, wherein the first disconnection request is used for indicating the first communication interface module to disconnect a first physical link; in response to the first disconnection request, the first communication interface module decrements the first total count value by one if the first traffic count value is greater than 0; and under the condition that the first total count value is reduced by one and then is equal to 0, the first communication interface module sends a second disconnection request to the second communication interface module, wherein the second disconnection request is used for requesting the second communication interface module to disconnect the first physical link.
Optionally, the first disconnection request may include one or more of service identification information of the first service module, a link identification of the first physical link, and the like. The first service count value is greater than 0, indicating that the first disconnect request is a valid disconnect request.
In one possible implementation manner, in response to the first disconnection request, in a case where the first traffic count value is greater than 0, the method further includes: the first communication interface module decrements the first traffic count value by one.
In the above several implementation manners, when the first service module requests to disconnect the physical link, it is determined that the first service count value corresponding to the first service module is greater than 0, that is, when it is determined that the first disconnection request is an effective disconnection request, the first total count value and the first service count value are respectively decremented by one. Upon determining that the first traffic count value is equal to 0, i.e., the disconnect request is an invalid disconnect request, the disconnect request is not processed. Therefore, the accuracy of the first service count value and the first total count value can be ensured, and the accuracy of physical link management is improved. In addition, in the method, the first physical link is disconnected only when the first total count value after being subtracted by one is 0, the first physical link is multiplexed to the maximum extent, and the utilization rate of the first physical link is improved. And no matter which service module initiates the establishment of the first physical link, as long as the first total count value after the subtraction is 0 when the effective disconnection request is received, the first physical link is disconnected. Therefore, the disconnection of the first physical link is not limited by the service module initiating the connection, the situation that the connection initiated by a certain service module can only be disconnected by the service module is prevented, the independence among the service modules is ensured, and the stability and the reliability of the service function of the electronic equipment are improved.
In one possible implementation manner, in response to the first disconnection request, in a case where the first total count value is less than one and greater than 0, the method further includes: and the first communication interface module sends a count-down instruction to the second communication interface module, wherein the count-down instruction is used for indicating that the second total count value is decreased by one, and the second total count value is stored in the second electronic equipment and represents the effective request times of the first electronic equipment and the second electronic equipment to the first physical link.
In the implementation manner, when the condition of disconnecting the first physical link is not met, the first communication interface module sends a count-down instruction to the second communication interface module to synchronously update the second total count value in the second electronic device, so that the accuracy of the second total count value is ensured, the second electronic device can accurately know the current effective request times for the first physical link, and can conveniently know whether the first physical link can be multiplexed or disconnected, and the accuracy of managing the first physical link is improved.
In a possible implementation manner, the first electronic device further includes a second service module, and the method further includes: the first communication interface module receives a third connection request sent by the second service module, wherein the third connection request is used for indicating the first communication interface module to establish a first physical link; responding to the third connection request, and acquiring a first total count value by the first communication interface module; and under the condition that the first total count value is greater than 0, the first communication interface module sends a first multiplexing connection request to the second communication interface module, and adds one to the first total count value and the second service count value respectively, wherein the second service count value represents the effective request times of the second service module to the first physical link.
Optionally, the third connection request may be similar to the first connection request, and the difference is that the service identification information in the third connection request is the service identification information corresponding to the second service module.
In this implementation manner, when other service modules (second service modules) except the first service module in the first electronic device initiate a connection request for the first physical link, if it is determined that the first total count value is greater than 0, that is, it is determined that the first physical link already exists, the first total count value is updated, and a second service count value corresponding to the second service module is updated. That is to say, in this implementation, in addition to the first service module being capable of multiplexing the first physical link, other service modules are also capable of multiplexing the first physical link module, and the count value is updated after multiplexing, so that the accuracy of the count value is ensured, and the accuracy of managing the first physical link is improved.
In a possible implementation manner, the second electronic device further includes a third service module and a fourth service module, and the method further includes: the first service module establishes a logical link with the third service module based on the first physical link according to the network address information of the second electronic device and the port information of the third service module; and the second service module establishes a logical link with the fourth service module based on the first physical link according to the network address information of the second electronic device and the port information of the fourth service module.
In this implementation, the first service module establishes a logical link with the third service module based on the first physical link, and the second service module establishes a logical link with the fourth service module based on the first physical link. That is to say, different service modules share a physical link, but their respective logical links are independent, so that the independence of data transmission of each service module can be ensured, when a problem occurs in a certain logical link or service port, other logical links will not be affected, other services will not be affected, and the stability of the service function of the electronic device is improved.
In a second aspect, the present application provides a method for establishing a physical link, configured to establish a first physical link between a first electronic device and a second electronic device, where the method is performed by the second electronic device, the first electronic device includes a first communication interface module, and the second electronic device includes a second communication interface module, and the method includes: the second communication interface module receives a first multiplexing connection request sent by the first communication interface module, wherein the first multiplexing connection request is used for requesting the second communication interface module to multiplex a first physical link; the second communication interface module responds to the first multiplexing connection request, and adds one to a second total count value, the second total count value is stored in the second electronic device and represents the effective request times of the first electronic device and the second electronic device to the first physical link, the effective request times are obtained by counting the effective connection request times and the effective disconnection request times, and the initial value of the second total count value is 0.
In a possible implementation manner, the second electronic device further includes a fifth service module, and the method further includes: the second communication interface module receives a fourth connection request of the fifth service module, wherein the fourth connection request is used for indicating the second communication interface module to establish a first physical link; in response to the fourth connection request, the second communication interface module sends a second multiplexing connection request to the first communication interface module and adds one to the second total count value when the second total count value is greater than 0, where the second multiplexing connection request is used to request the first communication interface module to multiplex the first physical link.
In a possible implementation manner, before the second communication interface module receives the first multiplexing connection request sent by the first communication interface module, the method further includes: the second communication interface module receives a connection request sent by the first communication interface module; the second communication interface module responds to the connection request and establishes a first physical link with the first communication interface module; the second communication interface module adds one to the second total count value; and the second communication interface module sends connection success information to the first communication interface module, wherein the connection success information represents that the first physical link is successfully established.
In a possible implementation, the method further includes: the second communication interface module receives a second disconnection request sent by the first communication interface module; the second communication interface module decrements the second total count value by one and disconnects the first physical link in response to the second disconnect request.
In a possible implementation, the method further includes: the second communication interface module receives a count-down instruction sent by the first communication interface module; the second communication interface module decrements the second total count value by one in response to the decrement count instruction.
The method for establishing a physical link provided in the second aspect of the present application corresponds to the method for establishing a physical link provided in the first aspect, and the specific implementation manner and the beneficial effects are similar and will not be described again.
In a third aspect, the present application provides an apparatus, which is included in an electronic device, and which has a function of implementing a behavior of the electronic device in the first aspect and the possible implementation manners of the first aspect. The functions may be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above-described functions. Such as a receiving module or unit, a processing module or unit, etc.
In a fourth aspect, the present application provides an apparatus, which is included in an electronic device, and which has a function of implementing the behavior of the electronic device in the second aspect and possible implementations of the second aspect. The functions may be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above-described functions. Such as a receiving module or unit, a processing module or unit, etc.
In a fifth aspect, the present application provides a system for establishing a physical link, including a first electronic device and a second electronic device, where the first electronic device is configured to execute any one of the methods in the technical solutions of the first aspect, and the second electronic device is configured to execute any one of the methods in the technical solutions of the first aspect.
In a sixth aspect, the present application provides an electronic device, comprising: a processor, a memory, and an interface; the processor, the memory and the interface cooperate with each other to enable the electronic device to perform any one of the methods of the first aspect or the second aspect.
In a seventh aspect, the present application provides a chip comprising a processor. The processor is adapted to read and execute the computer program stored in the memory to perform the method of the first aspect and any possible implementation thereof or to perform the method of the second aspect and any possible implementation thereof.
Optionally, the chip further comprises a memory, and the memory is connected with the processor through a circuit or a wire.
Further optionally, the chip further comprises a communication interface.
In an eighth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the processor is enabled to execute any one of the methods in the technical solutions of the first aspect or the second aspect.
In a ninth aspect, the present application provides a computer program product comprising: computer program code for causing an electronic device to perform any of the methods of the first aspect or the second aspect when the computer program code runs on the electronic device.
Drawings
FIG. 1 is a block diagram illustrating an example of an application program in an electronic device according to the related art;
FIG. 2 is a block diagram of an application program in an electronic device according to another embodiment of the related art;
FIG. 3 is a block diagram of an example electronic device according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an example of an electronic device 100 according to an embodiment of the present disclosure;
fig. 5 is a block diagram of a software structure of the electronic device 100 according to an embodiment of the present disclosure;
fig. 6 is a flowchart illustrating an example of a method for establishing a physical link according to an embodiment of the present application;
fig. 7 is a schematic diagram illustrating information interaction and a change of a count value involved in initially establishing a physical link according to an embodiment of the present application;
fig. 8 is a flowchart illustrating another method for establishing a physical link according to an embodiment of the present application;
fig. 9 is a schematic diagram illustrating an example of information interaction and count value change involved in reestablishing a physical link according to an embodiment of the present disclosure;
fig. 10 is a flowchart illustrating a method for establishing a physical link according to another embodiment of the present application;
fig. 11 is a schematic diagram illustrating information interaction and count value change involved in reestablishing a physical link according to another embodiment of the present application;
fig. 12 is a flowchart illustrating a method for establishing a physical link according to another embodiment of the present application;
fig. 13 is a schematic diagram illustrating information interaction and count value change involved in reestablishing a physical link according to another embodiment of the present application;
fig. 14 is a schematic flowchart of an example of disconnecting a physical link according to an embodiment of the present application;
fig. 15 is a schematic diagram illustrating information interaction and count value change involved in breaking a physical link according to an embodiment of the present application;
fig. 16 is a schematic diagram illustrating information interaction and count value change involved in breaking a physical link according to another embodiment of the present application;
fig. 17 is a schematic diagram illustrating information interaction and count value change involved in breaking a physical link according to another embodiment of the present application;
fig. 18 is a schematic diagram illustrating information interaction and count value change involved in breaking a physical link according to another embodiment of the present application;
fig. 19 is a timing diagram illustrating an example of establishment and disconnection of a physical link according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the description of the embodiments herein, "/" means "or" unless otherwise specified, for example, a/B may mean a or B; "and/or" herein is merely an association describing an associated object, and means that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality" means two or more than two.
In the following, the terms "first", "second" and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", and "third" may explicitly or implicitly include one or more of the features.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless otherwise specifically stated.
In order to better understand the method provided by the embodiments of the present application, the following first analyzes the technical problem to be solved by the present application.
Currently, many service scenarios of electronic devices use short-range wireless communication technology between devices, such as file transfer, screen projection, online game, and the like between devices. Short-range wireless communication technologies between devices include Wi-Fi p2p technology, bluetooth technology, and the like.
In the related art, a physical link is mainly established by an application program in an electronic device based on a wireless communication technology. Specifically, referring to fig. 1, fig. 1 is a block diagram illustrating an application program in an electronic device in the related art. As shown in fig. 1, the electronic device a includes applications A1, A2, and A3, which are capable of establishing physical links (also referred to as physical channels, physical data transmission channels, etc.) with applications B1, B2, and B3 in the electronic device B, respectively. The application programs A1, A2, A3, B1, B2, and B3 include a service module and a communication module, respectively. And the application program establishes a physical link with a communication module of the application program of the opposite terminal through a communication module of the application program.
However, in the physical link established in the above manner, since different application programs in the same electronic device cannot mutually acquire information of the physical link established by the other application program, link multiplexing cannot be achieved, and more time and/or power consumption is required in the physical link establishment phase, which results in low efficiency. Specifically, taking the establishment of a Wi-Fi p2p physical link as an example, the application scenario analysis is as follows:
referring to fig. 2, it is assumed that application A1 and application B1 are gallery a and gallery B, respectively, and application A2 and application B2 are game a and game B, respectively. In response to the photo sharing operation of the user in the gallery A, the communication module of the gallery A and the communication module of the gallery B establish a Wi-Fi p2p physical link, and the photo is transmitted based on the physical link. At this point, the user again initiates an online request in game A. Since gallery a and gallery B are occupying the Wi-Fi p2p physical link, game a and game B can only acquire the Wi-Fi p2p physical link by preempting or waiting (shown as waiting in fig. 2) in the case where electronic device a and electronic device B support only 1 Wi-Fi p2p physical link established at the same time. Through the preemption mode, the photo transmission is interrupted, the transmission efficiency of the photo is reduced, and the user experience is influenced. By waiting, more time is consumed and the efficiency is low. Under the condition that the electronic device A and the electronic device B support 2 Wi-Fi p2p physical links to be established at the same time, the game A and the game B can reestablish one Wi-Fi p2p physical link, but the reestablishment of the Wi-Fi p2p physical link also needs time consumption, the efficiency is low, and the power consumption of the electronic device is increased.
Similarly, the bluetooth physical link also has the above problem, and is not described herein.
In summary, the method for establishing a physical link in the related art has the problems of low efficiency, influence on user experience, large power consumption of the device, and the like.
For example, fig. 3 is a schematic block diagram of an example of an electronic device according to an embodiment of the present disclosure. As shown in fig. 3, in the embodiment of the present application, both the electronic device a and the electronic device B include a communication interface program (also referred to as a communication interface module), where the communication interface program in the electronic device a is referred to as a communication interface program a, and the communication interface program in the electronic device B is referred to as an interface program B. According to the method for establishing the physical link, the communication interface program A and the communication interface program B are used for realizing the unified establishment and management of the physical link between the electronic equipment A and the electronic equipment B, and the communication interface program A and the communication interface program B are used as managers of the physical link and can acquire all information of the physical link, so that the physical link can be multiplexed when needed, the physical link does not need to be waited or reestablished, the problem of low establishment efficiency of the physical link is solved, the efficiency of data transmission between equipment is improved, and the user experience is improved. Meanwhile, the utilization rate of the physical link is improved by multiplexing the physical link, and resources and power consumption are saved.
The method for establishing the physical link provided in the embodiment of the present application may be applied to an electronic device, such as a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), and the like, in which an Application (APP) may be installed.
For example, fig. 4 is a schematic structural diagram of an example of the electronic device 100 according to the embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 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 key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identity 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 application does not specifically limit the electronic device 100. In other embodiments of the present application, electronic 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.
The controller may be, among other things, a neural center and a command center of the electronic device 100. The controller 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 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, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
It should be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only an illustration, and does not limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The wireless communication function of the electronic 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. The structure of the antenna 1 and the antenna 2 in fig. 4 is only an example. Each antenna in the electronic 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 to the electronic 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 passed 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 electronic 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 the embodiment of the present application, the surrounding electronic devices may be discovered through the wireless communication module 160, and a physical link may be established.
In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 and antenna 2 is coupled to wireless communication module 160 so that electronic device 100 can communicate with networks and other devices through wireless communication techniques. Is free of
The line 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. GNSS may include Global Positioning System (GPS), global navigation satellite system (GLONASS), beidou satellite navigation system (BDS), quasi-zenith satellite system (QZSS), and/or Satellite Based Augmentation System (SBAS).
The electronic device 100 implements display functions via 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 electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the memory capability of the electronic 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 processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. 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, phone book, etc.) created during use of the electronic 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 software system of the electronic device 100 may employ a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes an Android system with a layered architecture as an example, and exemplarily illustrates a software structure of the electronic device 100.
Fig. 5 is a block diagram of a software structure of the electronic device 100 according to the embodiment of the present application. 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. 5, the application package may include applications such as camera, gallery, calendar, phone call, map, navigation, WLAN, bluetooth, music, video, short message, 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. 5, the application framework layers may include a window manager, content provider, view system, phone manager, resource manager, notification manager, and communication interface program, among others.
Among other things, the communication interface program, also referred to as a communication interface module, middleware application, etc., is used to provide an interface for cross-device communication for one or more application programs (e.g., gallery, video, etc.) in the electronic device 100, establish a physical link with other electronic devices, and implement management (including multiplexing, disconnecting, etc.) of the physical link. Alternatively, the communication interface program may be, for example, a "super-terminal" capability in the electronic device 100.
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 communication functions of the electronic device 100. Such as management of call status (including on, off, etc.).
The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like.
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, etc.
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.
For convenience of understanding, before the method for establishing the physical link provided in the embodiments of the present application is specifically described, terms and definitions that may be involved in the method are described.
1. Business module
The service module is a module for realizing a certain service function in an application program. In the embodiment of the present application, the electronic device may include one or more application programs, and each application program may include one or more service modules, where each service module is used to implement a different service function. For example, a note module and a to-do module may be included in the memo application. In the embodiment of the application, when a service module needs to establish a physical link with other electronic devices, a connection request can be initiated to a communication interface program.
2. Efficient connection request
In the embodiment of the present application, for a connection request initiated by a certain service module, if a corresponding physical link is successfully established or a corresponding physical link is successfully multiplexed in response to the connection request, the connection request is referred to as an effective connection request.
For example, a service module a in a certain device sends a connection request X to a communication interface program, where the connection request X is used to instruct the communication interface program to establish a physical link X1, and in response to the connection request X, if the communication interface program successfully establishes the physical link X1 or successfully multiplexes the physical link X1, the connection request X is called an effective connection request, and is also called an effective connection request of the service module a to the physical link X1; if the communication interface program does not successfully establish the physical link X1 and does not successfully multiplex the physical link X1, the connection request X is called an invalid connection request, and the connection request is also called an invalid connection request of the service module a to the physical link X1.
3. Active disconnect request
In the embodiment of the application, for a certain service module, adding 1 to a corresponding service count value every time an effective connection request of the service module to a certain physical link is added, receiving a disconnection request of the service module to the physical link every time, and if the current service count value is greater than 0, determining that the disconnection request is an effective disconnection request; and if the current service count value is equal to 0, determining that the disconnection request is an invalid disconnection request.
4. Number of valid requests
The number of valid requests is obtained by counting the number of valid connection requests and the number of valid disconnection requests of a certain physical link. It will be appreciated that the number of active requests is essentially the total number of active connection requests currently being made to a physical link minus the total number of active disconnection requests made to that physical link. For example, at the current time, the total number of valid connection requests of the module a to the physical link x1 is 5, and the total number of valid connection requests of the module a to the physical link x1 is 3, so that the current number of valid requests is 2.
5. Service counter value
The service count value, also called as a service connection count value, a service connection count or a service reference (reference) value, represents the number of valid requests currently requested by a service to a physical link. Specifically, the service count value is obtained by counting the number of times of the effective connection request and the effective disconnection request of the physical link by the service module, the service count value is increased by 1 when the service module increases the effective connection request of the physical link once, and the service count value is decreased by 1 when the service module increases the effective disconnection request of the physical link once.
6. Total count value
The total count value, also referred to as a total connection count value, a total connection count or a total reference (reference) value, etc., represents the total number of valid requests for a physical link by two devices (e.g., electronic device a and electronic device B) at both ends of the physical link. Specifically, the total count value is obtained by counting the effective connection requests of each service module in the two devices at the two ends of the physical link to the physical link and the effective disconnection times of each service module in the two devices to the physical link, the total count value is increased by 1 for each increase of the effective connection request of any service module in the two devices to the physical link, and the total count value is decreased by 1 for each increase of the effective disconnection request of any service module in the two devices to the physical link.
The total count value is a dynamically changing value. In the embodiment of the present application, the initial value of the total count value is 0, that is, the total count value is a positive integer greater than or equal to 0. A total count value greater than 0 indicates that a physical link exists and that there is currently a valid connection request indicating that there may be traffic currently using or will soon be needed to use the physical link. The total count value is 0, which indicates that the physical link is not established or the physical link is disconnected.
The following embodiments of the present application will specifically explain a method for establishing a physical link provided by the embodiments of the present application by taking an electronic device having a structure shown in fig. 4 and 5 as an example, and combining the drawings and an application scenario.
In the following embodiments, the following description is continued by taking the example of establishing a physical link between the electronic device a and the electronic device B. The physical links established by the method provided in the embodiment of the present application include, but are not limited to, a Wi-Fi p2p link, a bluetooth Basic Rate (BR) link, a bluetooth Socket (Socket) link, or a bluetooth Enhanced Data Rate (EDR) link, and the like, and the following embodiments all use the Wi-Fi p2p link as an example for description, and other types of physical links are similar to this and are not described again.
In the following embodiments, an example is given in which an application A1 in an electronic device a includes a service module A1, an application A2 includes a service module A2, an application B1 in an electronic device B includes a service B1, and an application B2 includes a service B2.
In the embodiment of the application, the establishment of the physical link includes two situations of initially requesting to establish the physical link and again requesting to establish the physical link. In addition, the present application further relates to a disconnection process of a physical link, and in combination with the embodiments, taking an electronic device a and an electronic device B as examples, the following describes establishment, multiplexing, and disconnection processes of a first physical link, which is any type of physical link, respectively.
1) Initial request to establish physical link
Fig. 6 is a flowchart illustrating an example of a method for establishing a physical link according to an embodiment of the present application, where the method includes:
s101, a business module A1 of an application program A1 in the electronic device A sends a first connection request to the communication interface program A, wherein the first connection request is used for indicating the communication interface program A and the electronic device B to establish a first physical link.
First, it should be noted that, before this step is executed, the electronic device a has completed device discovery, and the service module a1 receives a connection instruction of the user. The connection instruction is used for instructing the electronic device a to establish a first physical link with the electronic device B. The connection instruction may include physical address information of the peer device, a link type, and the like. Here, the home device is an electronic device a, and the peer device is an electronic device B. The physical address information may be, for example, a Media Access Control (MAC) address or the like. The link type refers to a type of a physical link that needs to be established, for example, a Wi-Fi p2p link, a BR link, a Socket connection, or an EDR link. In the embodiment of the application, the link type is a Wi-Fi p2p link.
In response to the connection instruction of the user, the service module a1 generates a first connection request and sends the first connection request to the communication interface program a. It is understood that, during the operation of the application A1, each service module may be established with at least one process. Optionally, the service module a1 may send the first connection request to the communication interface program a through inter-process communication based on the corresponding process.
Optionally, the first connection request may include service identification information corresponding to the service module a1, physical address information of the peer device, a link type, and the like. The service identification information is used for identifying different service modules so as to distinguish the source of each first connection request. The service identifiers of the service modules in different application programs are different, and the service identifiers of different service modules in the same application program are also different. The service identification information may be, for example, a Process Identification (PID) corresponding to the service module, for example, in this embodiment, the service identification information in the first connection request is a PID of a process corresponding to the service module a 1.
S102, the communication interface program A responds to the first connection request and determines whether a total count value A corresponding to a first physical link in the electronic equipment A is 0 or not.
It is understood that one or more physical links may be established between the electronic device a and the electronic device B at the same time, and that the same type of physical link may be established multiple times. In the embodiment of the present application, each established physical link may be provided with a unique identifier (hereinafter referred to as a link identifier) to distinguish from other physical links. The form and content of the link identifier are not limited, and for example, the link identifier may include device MAC addresses of the local device and the peer device and a preset link number. Each physical link may correspond to a total count value. In this embodiment, the total count value corresponding to the first physical link stored in the electronic device a is referred to as a total count value a, or referred to as a total count value a of the electronic device a.
In this embodiment, the first physical link is initially requested to be established, so that the total count value a is 0, and step S103 is executed.
S103, the communication interface program A generates a second connection request according to the first connection request, and sends the second connection request to the communication interface program B of the electronic device B, wherein the second connection request is used for requesting to establish a first physical link with the electronic device B.
Optionally, the second connection request may include physical address information, a link identifier, and the like of the electronic device a, so that the opposite device obtains the physical address information of the local device, and distinguishes the first physical link from other physical links after the first physical link is established. In addition, the second connection request may further include other information required to establish the physical link, for example, in this embodiment, when the link type is a Wi-Fi p2p link, the second connection request may include a connection role, and the connection role may be a Group Owner (GO) or a Group Client (GC).
Optionally, the second connection request may be in a JSON (javascript object notation) format, as shown in table 1 (not including connection role and link identifier):
TABLE 1
Optionally, the communication interface program a may send the second connection request to the communication interface program B of the electronic device B based on a communication channel negotiated in advance between the electronic device a and the electronic device B according to the network address information of the peer device in the first connection request. Wherein, different types of physical links have different communication channels. It can be understood that other information or requests between the communication interface program a and the communication interface program B in this embodiment of the present application, for example, a disconnection request, a multiplexing connection request, a connection success information, a count reduction instruction, a multiplexing reply information, and the like, may be transmitted through a communication channel negotiated in advance, and details of the subsequent embodiments are not described again.
S104, the communication interface program B in the electronic equipment B responds to the second connection request and establishes a first physical link with the communication interface program B.
Specifically, the communication interface program B may determine the type of the first physical link that needs to be established according to the communication channel that receives the second connection request. In this embodiment, the link type of the first physical link is determined to be a Wi-Fi p2p link according to the communication channel receiving the second connection request. The communication interface program B establishes a first physical link with the communication interface program B based on a communication protocol (Wi-Fi p2p protocol) according to the physical address information of the electronic equipment A in the second connection request.
In some other embodiments, after the first physical link is established, device trust may be further performed. The process of device trust may be as follows: the communication interface program a sends a device credit granting request to the communication interface program B, where the device credit granting request may include user information of the electronic device a, and the user information may be, for example, account information of a preset platform logged in the device, such as account information of an X cloud platform. And the communication interface program B responds to the equipment authorization request, compares the user information of the electronic equipment A with the user information of the electronic equipment B, determines whether the user information and the user information are consistent, and passes authorization and authentication of the electronic equipment A if the user information and the user information are consistent. The safety and reliability of the first physical link between the electronic device A and the electronic device B are ensured through device credit granting.
S105, the communication interface program B adds 1 to the total count value B corresponding to the first physical link in the electronic equipment B.
The total count value B is a total count value corresponding to the first physical link stored in the electronic device B, and is also referred to as a total count value B of the electronic device B. After the communication interface program B and the communication interface program a successfully establish the first physical link, 1 may be added to the total count value B.
S106, the communication interface program B sends connection success information to the communication interface program A.
The connection success information characterizes a successful establishment of the first physical link. Optionally, the connection success information may also carry a link identifier of the first physical link, and the connection success information may also carry information of the second connection request, and the like.
S107, the communication interface program A receives the connection success information, adds 1 to the total counting value A, and adds 1 to the service counting value a1 corresponding to the service module a 1.
Optionally, after receiving the connection success information, the communication interface program a may determine, according to information of the second connection request in the connection success information, an initiating service module of the first connection request corresponding to the second connection request, and add 1 to a service count value corresponding to the service module. Specifically, the communication interface program a may establish a corresponding relationship between the second connection request and the first connection request, and when the connection success information of the second connection request is received, determine the corresponding first connection request according to the second connection request, so as to obtain the service module initiating the connection request this time, and add 1 to the service count value corresponding to the service module. In this embodiment, the service initiating module is a service module a1, a service count value corresponding to the service module a1 is referred to as a service count value a1, and 1 is added to the service count value a 1.
In this embodiment, the total count value a of the electronic device a is managed, so that the number of times of valid requests of the first physical link is managed simply and conveniently, that is, the use condition of the first physical link by the electronic device a and the electronic device B is managed, and therefore, when the first physical link needs to be used, whether the first physical link is established or not can be accurately known by judging whether the total count value a is 0 or not, and whether the first physical link can be multiplexed or not. In addition, whether the first physical link is used or not and whether the first physical link needs to be disconnected or not can be timely and accurately known through the total count value, and the physical link can be conveniently and timely disconnected when needed. In summary, the method provided by the embodiment can improve the efficiency and accuracy of managing the first physical link, and thus improve the efficiency of data transmission between the electronic device a and the electronic device B. In addition, in this embodiment, after the first physical link is successfully established, 1 is added to the service count value a1 corresponding to the service module a1 and the total count value a of the electronic device a, respectively, so as to update the count value, thereby ensuring the accuracy of the count value.
It is understood that after the first physical link is successfully established, the service module a1 may establish a logical link with the relevant service module in the electronic device B based on the first physical link, thereby forming a data transmission channel. For example, after the first physical link is successfully established, the service module a1 may establish a logical link between the service module a1 and the service module B1 based on the first physical link according to the network address information of the electronic device B and the port information of the service module B1 in the electronic device B. The network address information may be, for example, an IP address, and the port information may be, for example, a port number.
For example, fig. 7 is a schematic diagram illustrating information interaction and a change of a count value involved in initially establishing a physical link according to an embodiment of the present application. As shown in fig. 7, a service module a1 in the electronic device a transmits a first connection request to the communication interface program a. The communication interface program a determines a total count value a in response to the first connection request. As shown in fig. 7, in this embodiment, for the first time, the first physical link is requested to be established, the service count value a1 corresponding to the service module a1 is 0, the total count value a of the electronic device a is also 0, and the total count value B of the electronic device B is also 0. Thus, the communication interface program a determines that the total count value a is 0, that is, determines that the current first connection request is the initial connection request, and the communication interface program a transmits the second connection request to the communication interface program B of the electronic device B. The communication interface program B establishes a first physical link with the communication interface program a in response to the second connection request, and adds 1 to the total count value B, which changes from 0 to 1. The communication interface program B transmits connection success information to the communication interface program a, and upon receiving the connection success information, the communication interface program a adds 1 to the traffic count value a1 and 1 to the total count value a, changes the traffic count value a1 from 0 to 1, and changes the total count value a from 0 to 1.
2) Requesting again the establishment of a physical link
After establishing the first physical link according to the procedure of 1) above, the service module may also request establishment of the physical link again, i.e. initiate a connection request again. Reinitiating the connection request includes three cases: (1) the service module a1 initiates a connection request again; (2) other service modules (except the service module a 1) in the electronic equipment A initiate connection requests; (3) and a service module in the electronic equipment B initiates a connection request. The following describes three cases, respectively.
(1) The service module a1 initiates a connection request again
Exemplarily, fig. 8 is a schematic flowchart of a method for establishing another physical link according to an embodiment of the present application, where the method includes:
s201, a business module A1 of an application program A1 in the electronic device A sends a first connection request to the communication interface program A, and the first connection request is used for indicating the communication interface program A and the electronic device B to establish a first physical link.
Optionally, the first connection request is the same as the foregoing embodiment, and is not described again.
S202, the communication interface program a determines whether the total count value a of the current electronic device a is 0 in response to the first connection request.
The total count value a is greater than 0, indicating that the first physical link already exists. In this embodiment, the total count value of the electronic device a is 1, and step S203 is executed.
S203, the communication interface program a sends a first multiplexing connection request to the communication interface program B of the electronic device B, where the first multiplexing connection request is used to request the communication interface program B to multiplex a first physical link.
Optionally, the first multiplexing connection request may include physical address information of the electronic device a and a link identifier of the first physical link. The link identification facilitates the communication interface program B to know which physical link the physical link needs to be multiplexed is.
Optionally, the first multiplexing connection request may be in JSON format, as shown in table 2 (without link id):
TABLE 2
S204, the communication interface program B in the electronic equipment B responds to the first multiplexing connection request, and adds 1 to the total counting value B of the electronic equipment B.
S205, the communication interface program B sends the first reply message to the communication interface program a.
And after adding 1 to the total count value B, the communication interface program B sends first multiplexing reply information to the communication interface program A to represent that the first physical link is reusable.
S206, the communication interface program a receives the first multiplexing reply message, adds 1 to the total count value a of the electronic device a, and adds 1 to the service count value a1 corresponding to the service module a 1.
It will be appreciated that in some other embodiments, communication interface program B may not send the first multiplexed reply message to communication interface program a. The communication interface program B directly adds 1 to the total count value a and adds 1 to the traffic count value a1 after sending the first multiplex connection request to the communication interface program B.
For example, fig. 9 is a schematic diagram illustrating information interaction and count value change involved in reestablishing a physical link according to an embodiment of the present application. As shown in fig. 9, a service module a1 in the electronic device a transmits a first connection request to the communication interface program a. The communication interface program a determines a total count value a of the electronic device a in response to the first connection request. As shown in fig. 9, in this embodiment, the service count value a1 corresponding to the service module a1 is 1, the total count value a of the electronic device a is also 1, and the total count value of the electronic device B is also 1. Thus, the communication interface program a determines that the total count value a is greater than 0, that is, determines that the current connection request is a reconnection request, and the communication interface program a transmits a first multiplexed connection request to the communication interface program B of the electronic device B. The communication interface program B adds 1 to the total count value B in response to the first multiplex connection request, the total count value B changing from 1 to 2. The communication interface program B sends the first reply message to the communication interface program a, and the communication interface program a, upon receiving the first reply message, adds 1 to the traffic count value a1 and adds 1 to the total count value a, where the traffic count value a1 changes from 1 to 2 and the total count value a changes from 1 to 2.
(2) Other service modules in the electronic equipment A initiate connection requests
In this embodiment, the following embodiments shown in fig. 8 and fig. 9 are described by taking an example in which the service module A2 of the application A2 initiates a connection request to the communication interface program a.
Exemplarily, fig. 10 is a schematic flowchart of a method for establishing a physical link according to another embodiment of the present application, where the method includes:
s301, the service module A2 of the application program A2 in the electronic device a sends a third connection request to the communication interface program a, where the third connection request is used to request to instruct the communication interface program a to establish a first physical link with the electronic device B.
The third connection request is similar to the first connection request, and is different in that the service identification information in the third connection request is service identification information corresponding to the service module a2.
S302, the communication interface program a determines whether the total count value a of the current electronic device a is 0 in response to the third connection request.
In this embodiment, the total count value of the electronic device a is 2, which indicates that the first physical link exists, and step S303 is executed.
S303, the communication interface program a sends a first multiplexing connection request to the communication interface program B of the electronic device B, where the first multiplexing connection request is used to request the communication interface program B to multiplex a first physical link.
The first multiplexing connection request is the same as the above embodiment, and is not described again.
S304, the communication interface program B in the electronic equipment B responds to the first multiplexing connection request, and adds 1 to the total counting value B of the electronic equipment B.
S305, the communication interface program B sends the first reply multiplexing message to the communication interface program a.
S306, the communication interface program a receives the first multiplexing reply message, adds 1 to the total count value a of the electronic device a, and adds 1 to the service count value a2 corresponding to the service module a2.
In this embodiment, the service count value corresponding to the service module a2 is referred to as a service count value a2.
The above process is similar to the process shown in the embodiment corresponding to fig. 8, and is not described again.
For example, fig. 11 is a schematic diagram of information interaction and count value change involved in reestablishing a physical link according to another example provided in the embodiment of the present application. As shown in fig. 11, the service module a2 in the electronic device a transmits a third connection request to the communication interface program a. The communication interface program a determines the total count value a of the electronic device a in response to the third connection request. As shown in fig. 11, in this embodiment, a service count value a1 corresponding to a current service module a1 is 2, a service count value a2 corresponding to a service module a2 is 0, a total count value a of an electronic device a is 2, and a total count value B of an electronic device B is 2. Thus, the communication interface program a determines that the total count value a is greater than 0, that is, determines that the current connection request is a reconnection request, and the communication interface program a transmits a first multiplexed connection request to the communication interface program B of the electronic device B. The communication interface program B adds 1 to the total count value B in response to the first multiplex connection request, and the total count value B changes from 2 to 3. The communication interface program B sends the first reply message to the communication interface program a, and after receiving the first reply message, the communication interface program a adds 1 to the traffic count value a2 and adds 1 to the total count value a, the traffic count value a2 changes from 0 to 1, the total count value a changes from 2 to 3, and the traffic count value a1 remains 2.
In this embodiment, the total count value a is incremented by 1 after the first multiplexing reply message is received, and the total count value a is also incremented by 1 when the second multiplexing request is received. That is to say, no matter the service module in the electronic device a multiplexes the first physical link, or the service module in the electronic device B multiplexes the first physical link, the total count value a is updated, and meanwhile, the total count value B is also updated synchronously, so that the accuracy of the total count value a and the total count value B is ensured, and the accuracy of managing the first physical link is further ensured.
It should be noted that, in this embodiment, a process of multiplexing a first physical link when initiating connection with another service module in the electronic device a is described by taking the service module A2 in the application A2 as an example. In other embodiments, when other service modules different from the service module A1 in the application A1, for example, the service module a3 in the application A1, initiate a service connection request, the implementation process is the same as the above process. That is, the implementation process is the same as the above process as long as the service module different from the service module a1 is defined as another service module, regardless of whether the application is the same or not.
In addition, it is understood that after the multiplexing request for the first physical link is completed through the above process, the service module a2 may establish a logical link with two service modules in the electronic device B based on the first physical link, thereby forming a data transmission channel. For example, after the step S305 is completed, the service module a2 may establish a logical link between the service module a2 and the service module B2 based on the first physical link according to the network address information of the electronic device B and the port information of the service module B2 in the electronic device B. It should be noted that, in the foregoing embodiment, the service module a1 establishes a logical link with the service module b1 based on the first physical link, and in this embodiment, the service module a2 establishes a logical link with the service module b2 based on the first physical link. That is to say, in the embodiment of the present application, different service modules share a physical link, but respective logical links are independent, so that independence of data transmission of each service module can be ensured, when a problem occurs in a certain logical link or service port, other logical links are not affected, other services are not affected, and stability of service functions of electronic equipment is improved.
(3) Service module in electronic equipment B initiates connection request
In this embodiment, following the embodiments shown in fig. 10 and fig. 11, a service module B1 of an application program B1 in an electronic device B initiates a connection request to a communication interface program B as an example.
Exemplarily, fig. 12 is a schematic flowchart of a method for establishing a physical link according to another embodiment of the present application, where the method includes:
s401, a business module B1 of an application program B1 in the electronic device B sends a fourth connection request to the communication interface program B, and the fourth connection request is used for requesting to indicate the communication interface program B to establish a first physical link with the electronic device A.
Optionally, the fourth connection request may include physical address information and a link type of the peer device. Here, the peer device refers to the electronic device a.
S402, the communication interface program B determines whether the total count value B of the current electronic device B is 0 in response to the fourth connection request.
In this embodiment, the total count value of the electronic device B is 3, which indicates that the first physical link exists, and step S403 is executed.
S403, the communication interface program B sends a second multiplexing connection request to the communication interface program a of the electronic device a, where the second multiplexing connection request is used to request the communication interface program a to multiplex the first physical link.
The second multiplexing connection request is similar to the first multiplexing connection request, and is different in that the physical address information carried in the second multiplexing connection request is the physical address information of the electronic device B.
S404, in response to the second multiplexing connection request, the communication interface program a in the electronic device a adds 1 to the total count value a of the electronic device a and the service count value b1 corresponding to the service module b1, respectively.
S405, the communication interface program a sends the second multiplexing reply message to the communication interface program B.
S406, the communication interface program B receives the second multiplexing reply message and adds 1 to the total count value B of the electronic equipment B.
The above process is similar to the process shown in the embodiment corresponding to fig. 10, and is not described again.
For example, fig. 13 is a schematic diagram of information interaction and count value change involved in reestablishing a physical link according to another example provided in the embodiment of the present application. As shown in fig. 13, the service module B1 in the electronic device B transmits a fourth connection request to the communication interface program B. The communication interface program B determines the total count value B of the electronic device B in response to the fourth connection request. As shown in fig. 13, in this embodiment, a service count value a1 corresponding to a current service module a1 is 2, a service count value a2 corresponding to the service module a2 is 1, a total count value a of the electronic device a is 3, a total count value B of the electronic device B is 3, and a service count value B1 corresponding to the service module B1 is 0. Thus, the communication interface program B determines that the total count value B is greater than 0, that is, determines that the current connection request is a reconnection request, and the communication interface program B transmits a second multiplexed connection request to the communication interface program a of the electronic device a. The communication interface program a adds 1 to the total count value a, which changes from 3 to 4, in response to the second multiplex connection request. Then, the communication interface program a transmits the second reply multiplexing message to the communication interface program B, and the communication interface program B, upon receiving the second reply multiplexing message, adds 1 to the traffic count value B1 and adds 1 to the total count value B, whereby the traffic count value B1 changes from 0 to 1 and the total count value B changes from 3 to 4.
3) Breaking physical links
In this embodiment, following the embodiments shown in fig. 12 and fig. 13, taking the service module a1 initiating a disconnection request as an example, a process of disconnecting the first physical link is further described.
Fig. 14 is a schematic flowchart of an example of a process for disconnecting a physical link according to an embodiment of the present application, where the method includes:
s501, a business module A1 of an application program A1 in the electronic device A sends a first disconnection request to the communication interface program A, wherein the first disconnection request is used for indicating the communication interface program A to disconnect a first physical link with the electronic device B.
Optionally, the first disconnection request may include service identification information corresponding to the service module a1, physical address information of the peer device, a link identification of the first physical link, and the like.
S502, the communication interface program A responds to the first disconnection request and determines whether a service count value a1 corresponding to the current service module a1 is 0 or not; if not, go to step S503; if yes, no operation is executed.
It will be appreciated that in some cases, although some traffic modules have a traffic count value of 0, for a particular reason, the traffic module may still send a first disconnect request to the communication interface program. For example, special reasons such as: the service count value is 0 but the user still operates the first disconnection request, or the service module detects that the first physical connection still exists according to a preset flow, and so on. In this case, the first disconnection request is considered to be an invalid connection request.
Specifically, when receiving the first disconnection request, the communication interface program a determines whether the corresponding service count value a1 is 0, and if the corresponding service count value a1 is 0, it indicates that the service module a1 has not initiated the first connection request, or all the first disconnection requests corresponding to the service module a1 have been processed, it indicates that the current first disconnection request is an invalid disconnection request, and it does not subtract 1 from the service count value a1, nor subtract 1 from the total count value a, that is, it does not perform any operation. If the service count value a1 is greater than 0, it indicates that the current first disconnection request is a valid disconnection request.
And S503, subtracting 1 from the total count value A and the service count value a1 of the electronic device A respectively.
S504, the communication interface program A determines whether the total count value A obtained after subtracting 1 is 0; if yes, executing steps S505 and S506; if not, steps S507 and S508 are executed.
The total count value a after subtracting 1 is 0, which indicates that no service needs to reuse the first physical link at present, and the first physical link may be disconnected, and steps S505 and S506 are executed. The total count value a after subtracting 1 is not 0, which indicates that other services still need to use the first physical link, and only the count value needs to be updated, and the first physical link is not disconnected, and steps S507 and S508 are executed.
And S505, the communication interface program A generates a second disconnection request according to the first disconnection request, and sends the second disconnection request to the communication interface program B in the electronic equipment B.
Optionally, the second disconnection request includes physical address information of the electronic device a and a link identifier of the first physical link.
Optionally, the second disconnect request may be in JSON format, as shown in table 3 (without link id):
TABLE 3
S506, in response to the second disconnection request, the communication interface program B in the electronic device B subtracts 1 from the total count value B of the electronic device B, and disconnects the first physical link with the communication interface program a.
And S507, the communication interface program A sends a count-down instruction to the communication interface program B of the electronic equipment B, wherein the count-down instruction is used for instructing the communication interface program B to reduce the total count value B of the electronic equipment B.
And S508, the communication interface program B responds to the count-down instruction and subtracts 1 from the total count value B of the electronic equipment B.
It should be noted that, in the embodiment of the present application, the service module a1 in the electronic device a initiates the first disconnection request as an example for description, and a process of initiating the first disconnection request by other service modules (for example, the service module a 2) in the electronic device a and a process of initiating the first disconnection request by a service module (for example, the service module B1) in the electronic device B are similar to these processes, and are not described again.
The following describes information interaction and count value change related to the disconnection of a physical link in several different scenarios where the service count value and the total count value correspond to each other, respectively, with reference to the accompanying drawings.
For example, fig. 15 is a schematic diagram of information interaction and count value change involved in breaking a physical link according to an embodiment of the present application. In this embodiment, a disconnection request (referred to as a third disconnection request) is initiated by the service module a2, and when the third disconnection request is initiated, the total count value a of the electronic device a is 4, the service count value a1 is 2, the service count value a2 is 1, the total count value B of the electronic device B is 4, and the service count value B1 is 1.
As shown in fig. 15, the service module a2 in the electronic device a transmits a third disconnection request to the communication interface program a. The third disconnection request is used for instructing the communication interface program a to disconnect the first physical link, and is different from the first disconnection request in that the service identification information carried in the third disconnection instruction is different. The communication interface program a determines whether the current traffic count value a2 is 0 in response to the third disconnection request. In this embodiment, the current traffic count value a2 is 1 and is greater than 0, so the communication interface program a subtracts 1 from the total count value a and the traffic count value a2, the total count value a changes from 4 to 3, and the traffic count value a2 changes from 1 to 0. Thereafter, the communication interface program a determines whether the total count value a after subtracting 1 is 0. In this embodiment, the total count value a after subtracting 1 is 3, which is greater than 0, and therefore, the communication interface program a sends a count-down instruction to the communication interface program B of the electronic device B. The communication interface program B subtracts 1 from the total count value B in response to the down-count instruction, and the total count value B changes from 4 to 3.
For example, fig. 16 is a schematic diagram of information interaction and count value change involved in breaking a physical link according to another embodiment of the present application. This embodiment is continued with the embodiment shown in fig. 15, and is described by taking an example in which the service module a2 initiates a third disconnection request. That is, when the service module a2 initiates the third disconnection request, the total count value a of the electronic device a is 3, the service count value a1 is 2, the service count value a2 is 0, the total count value B of the electronic device B is 3, and the service count value B1 is 1.
As shown in fig. 16, the service module a2 in the electronic device a transmits a third disconnection request to the communication interface program a. The communication interface program a determines whether the current traffic count value a2 is 0 in response to the third disconnection request. In this embodiment, the current service count value a2 is 0, so the communication interface program a determines that the third disconnection request is an invalid disconnection request, and does not perform any processing.
For example, fig. 17 is a schematic diagram of information interaction and count value change involved in breaking a physical link according to another embodiment of the present application. This embodiment is described next to the embodiment shown in fig. 16, taking an example that the service module B1 in the electronic device B initiates a disconnection request (referred to as a fourth disconnection request). That is, when the service module B1 initiates the fourth disconnection request, the total count value a of the electronic device a is 3, the service count value a1 is 2, the service count value a2 is 0, the total count value B of the electronic device B is 3, and the service count value B1 is 1.
As shown in fig. 17, the service module B1 in the electronic device B transmits a fourth disconnection request to the communication interface program B. The fourth disconnect request is for instructing communication interface program B to disconnect the first physical link. The communication interface program B determines whether the total count value B is 0 in response to the fourth disconnection request. In this embodiment, the total count value B is 3 and greater than 0, so the communication interface program B subtracts 1 from the total count value B and the traffic count value B1, the total count value a changes from 3 to 2, and the traffic count value B1 changes from 1 to 0. Thereafter, the communication interface program B determines whether the total count value B after subtracting 1 is 0. In this embodiment, the total count value B after being decremented by 1 is 2, which is greater than 0, and therefore, the communication interface program B sends a count-down instruction to the communication interface program a of the electronic device a. The communication interface program B subtracts 1 from the total count value a in response to the count-down instruction, and changes the total count value a from 3 to 2.
Illustratively, fig. 18 is a schematic diagram of information interaction and count value change involved in breaking a physical link according to another example provided in the embodiment of the present application. In this embodiment, a service module a1 initiates a first disconnection request, and when the first disconnection request is initiated, a total count value a of an electronic device a is 1, a service count value a1 is 1, a service count value a2 is 0, a total count value B of an electronic device B is 1, and a service count value B1 is 0.
As shown in fig. 18, the service module a1 in the electronic device a transmits a first disconnection request to the communication interface program a. The communication interface program a determines whether the current traffic count value a1 is 0 in response to the first disconnection request. In this embodiment, the current traffic count value a1 is 1 and is greater than 0, so the communication interface program a subtracts 1 from the total count value a and the traffic count value a1, the total count value a changes from 1 to 0, and the traffic count value a1 changes from 1 to 0. Thereafter, the communication interface program a determines whether the total count value a after subtracting 1 is 0. In this embodiment, the total count value a subtracted by 1 is 0, and therefore, the communication interface program a makes a second disconnection request to the communication interface program B of the electronic device B. The communication interface program B responds to the second disconnection instruction, disconnects the first physical link, and subtracts 1 from the total count value B, and the total count value B is changed from 1 to 0.
The connection and disconnection process of the first physical link described above is generally described below with reference to fig. 19.
Exemplarily, fig. 19 is a timing diagram of establishment and disconnection of a physical link according to an embodiment of the present application, as shown in fig. 19, at a first time point t1, a service module a1 initiates a first connection request to establish the first physical link, a service count value a1 corresponding to the service module a1 is added by 1, a total count value a of an electronic device a is added by 1, and a total count value B of an electronic device B is added by 1. At this time, the traffic count value a1=1, the total count value a =1, and the total count value B =1.
At a second time point t2, the service module a2 initiates a third connection request, the first physical link is multiplexed, the service count value corresponding to the service module a2 is increased by 1, the total count value a of the electronic device a is increased by 1, and the total count value B of the electronic device B is increased by 1. At this time, the traffic count value a1=1, the traffic count value a2=1, the total count value a =2, and the total count value B =2.
At a third time point t3, the service module a1 initiates a first disconnection request, and the current service count value a1=1, so that the first disconnection request is an effective disconnection request, the service count value a1 corresponding to the service module a1 is subtracted by 1, the total count value a of the electronic device a is subtracted by 1, and the total count value B of the electronic device B is subtracted by 1. At this time, traffic count value a1=0, traffic count value a2=1, total count value a =1, and total count value B =1. However, the total count value a after subtracting 1 is greater than 0, and thus the first physical link continues to be maintained, i.e., the first physical link is not disconnected.
At a third time point t4, the service module a1 initiates a first disconnection request, and the current service count value a1=0, so that the first disconnection request is an invalid disconnection request, the count values of the service modules and the total count value are kept unchanged, and the first physical link is kept continuously. At this time, traffic count value a1=0, traffic count value a2=1, total count value a =1, and total count value B =1.
At a fifth time point t5, the service module a2 initiates a third disconnection request, and the current service count value a2=1, so that the third disconnection request is an effective disconnection request, the service count value a2 corresponding to the service module a2 is decremented by 1, the total count value a of the electronic device a is decremented by 1, and the total count value B of the electronic device B is decremented by 1. At this time, traffic count value a1=0, traffic count value a2=0, total count value a =0, and total count value B =0. Also, the total count value a after subtracting 1 is equal to 0, thus disconnecting the first physical link.
In the method provided by the embodiment of the present application, when the service module requests to disconnect the physical link, the service count value corresponding to the service module is determined. And if the current service count value is 0, determining that the current disconnection request is an invalid disconnection request, and not processing the current disconnection request. Therefore, the accuracy of the service count value and the total count value can be ensured, and the accuracy of physical link management is improved. In addition, in the method, the first physical link is disconnected only when the total count value after 1 is subtracted is 0, the first physical link is multiplexed to the maximum extent, and the utilization rate of the first physical link is improved. Furthermore, as can be seen from fig. 19, although the first physical link is established in response to the first connection request initiated by the service module a1 for the first time at the time point t1, the first physical link is finally successfully disconnected in response to the disconnection request initiated by the service module a2. That is, no matter which service module initiates the establishment of the first physical link, as long as the total count value obtained by subtracting 1 after receiving a valid disconnection request is 0, the first physical link is disconnected. Therefore, the disconnection of the first physical link is not limited by the service module initiating the connection, the situation that the connection initiated by a certain service module can only be disconnected by the service module is prevented, the independence among the service modules is ensured, and the stability and the reliability of the service function of the electronic equipment are improved.
The above details an example of the method for establishing a physical link provided in the embodiment of the present application. It will be appreciated that the electronic device, in order to implement the above-described functions, comprises corresponding hardware and/or software modules for performing the respective functions. Those of skill in the art would readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, with the embodiment described in connection with the particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiment of the present application, the electronic device may be divided into the functional modules according to the method example, for example, the functional modules may be divided into the functional modules corresponding to the functions, such as the detection unit, the processing unit, the display unit, and the like, or two or more functions may be integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, in the embodiment of the present application, the division of the module is schematic, and is only one logic function division, and there may be another division manner in actual implementation.
It should be noted that all relevant contents of each step related to the above method embodiment may be referred to the functional description of the corresponding functional module, and are not described herein again.
The electronic device provided by the embodiment is used for executing the establishment method of the physical link, so that the same effect as the implementation method can be achieved.
In case of an integrated unit, the electronic device may further comprise a processing module, a storage module and a communication module. The processing module can be used for controlling and managing the action of the electronic equipment. The memory module may be used to support the electronic device in executing stored program codes and data, etc. The communication module can be used for supporting the communication between the electronic equipment and other equipment.
The processing module may be a processor or a controller. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. A processor may also be a combination of computing functions, e.g., a combination comprising one or more microprocessors, digital Signal Processing (DSP) and microprocessors, or the like. The storage module may be a memory. The communication module may specifically be a radio frequency circuit, a bluetooth chip, a Wi-Fi chip, or other devices that interact with other electronic devices.
In an embodiment, when the processing module is a processor and the storage module is a memory, the electronic device according to this embodiment may be a device having a structure shown in fig. 4.
An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the processor is enabled to execute the method for establishing a physical link according to any of the above embodiments.
The embodiments of the present application further provide a computer program product, which when running on a computer, causes the computer to execute the above related steps to implement the method for establishing a physical link in the above embodiments.
In addition, embodiments of the present application also provide an apparatus, which may be specifically a chip, a component or a module, and may include a processor and a memory connected to each other; the memory is used for storing computer execution instructions, and when the apparatus runs, the processor may execute the computer execution instructions stored by the memory, so that the chip executes the method for establishing a physical link in the above method embodiments.
The electronic device, the computer-readable storage medium, the computer program product, or the chip provided in this embodiment are all configured to execute the corresponding method provided above, so that the beneficial effects achieved by the electronic device, the computer-readable storage medium, the computer program product, or the chip may refer to the beneficial effects in the corresponding method provided above, and are not described herein again.
Through the description of the above embodiments, those skilled in the art will understand that, for convenience and simplicity of description, only the division of the above functional modules is used as an example, and in practical applications, the above function distribution may be completed by different functional modules as needed, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, a module or a unit may be divided into only one logic function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another apparatus, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed to a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (15)
1. A method for establishing a physical link between a first electronic device and a second electronic device, the method being performed by the first electronic device, wherein the first electronic device includes a first communication interface module and a first service module, and the second electronic device includes a second communication interface module, the method comprising:
the first communication interface module receives a first connection request sent by the first service module, wherein the first connection request is used for indicating the first communication interface module to establish the first physical link;
responding to the first connection request, the first communication interface module acquires a first total count value, wherein the first total count value is stored in the first electronic device and represents the number of times of effective requests of service modules in the first electronic device and the second electronic device to the first physical link, the number of times of effective requests is obtained by counting the number of times of effective connection requests and the number of times of effective disconnection requests, and the initial value of the first total count value is 0; the effective disconnection request refers to a disconnection request sent by any service module under the condition that the count value of any service module is greater than 0;
when the first total count value is greater than 0, the first communication interface module sends a first multiplexing connection request to the second communication interface module, and adds a first service count value and the first total count value by one respectively, where the first multiplexing connection request is used to request the second communication interface module to multiplex the first physical link, and the first service count value represents the number of times of effective requests of the first service module for the first physical link;
the first communication interface module receives a first disconnection request sent by the first service module, where the first disconnection request is used to instruct the first communication interface module to disconnect the first physical link;
in response to the first disconnection request, the first communication interface module decrements the first traffic count value and the first total count value by one, respectively, if the first traffic count value is greater than 0.
2. The method of claim 1, further comprising:
when the first total count value is equal to 0, the first communication interface module sends a second connection request to the second communication interface module, where the second connection request is used to request the second communication interface module to establish the first physical link;
and in response to receiving the connection success information sent by the second communication interface module, the first communication interface module adds one to the first total count value, and the connection success information represents that the first physical link is successfully established.
3. The method of claim 1, further comprising:
in response to receiving a second multiplexing connection request sent by the second communication interface module, the first communication interface module adds one to the first total count value, and the second multiplexing connection request is used to request the first communication interface module to multiplex the first physical link.
4. The method of claim 1, wherein after the first communication interface module decrements the first traffic count value and the first total count value by one, the method further comprises:
and under the condition that the first total count value is reduced by one and then is equal to 0, the first communication interface module sends a second disconnection request to the second communication interface module, wherein the second disconnection request is used for requesting the second communication interface module to disconnect the first physical link.
5. The method of claim 1, wherein after the first communication interface module decrements the first traffic count value and the first total count value by one, the method further comprises:
and under the condition that the first total count value is less than 0 by one, the first communication interface module sends a count-down instruction to the second communication interface module, wherein the count-down instruction is used for indicating that a second total count value is less than one, and the second total count value is stored in the second electronic device and represents the effective request times of the first electronic device and the second electronic device for the first physical link.
6. The method of any of claims 1-5, wherein the first electronic device further comprises a second service module, the method further comprising:
the first communication interface module receives a third connection request sent by the second service module, where the third connection request is used to instruct the first communication interface module to establish the first physical link;
responding to the third connection request, and acquiring the first total count value by the first communication interface module;
and when the first total count value is greater than 0, the first communication interface module sends the first multiplexing connection request to the second communication interface module, and adds one to the first total count value and a second service count value respectively, wherein the second service count value represents the effective request times of the second service module to the first physical link.
7. The method of claim 6, wherein the second electronic device further comprises a third service module and a fourth service module, and wherein the method further comprises:
the first service module establishes a logical link with the third service module based on the first physical link according to the network address information of the second electronic device and the port information of the third service module;
and the second service module establishes a logical link with the fourth service module based on the first physical link according to the network address information of the second electronic device and the port information of the fourth service module.
8. A method for establishing a physical link, configured to establish a first physical link between a first electronic device and a second electronic device, the method being performed by the second electronic device, wherein the first electronic device includes a first communication interface module and a first service module, and the second electronic device includes a second communication interface module, the method comprising:
the second communication interface module receives a first multiplexing connection request sent by the first communication interface module, wherein the first multiplexing connection request is used for requesting the second communication interface module to multiplex the first physical link; when the first communication interface module receives a first connection request sent by the first service module, the first communication interface module respectively adds one to a first service count value and a first total count value; when the first communication interface module receives a first disconnection request sent by the first service module, and the first service count value and the first total count value are respectively reduced by one under the condition that the first service count value is greater than 0; the first connection request is used for indicating the first communication interface module to establish the first physical link, the first disconnection request is used for indicating the first communication interface module to disconnect the first physical link, the first total count value is stored in the first electronic device and represents the number of effective requests of service modules in the first electronic device and the second electronic device to the first physical link, the number of effective requests is obtained by counting the number of effective connection requests and the number of effective disconnection requests, the initial value of the first total count value is 0, the effective disconnection request refers to a disconnection request sent by any service module when the count value of any service module is greater than 0, and the first service count value represents the number of effective requests of the first service module to the first physical link;
and the second communication interface module adds one to a second total count value in response to the first multiplexing connection request, where the second total count value is stored in the second electronic device and represents the number of times of valid requests of service modules in the first electronic device and the second electronic device to the first physical link, and an initial value of the second total count value is 0.
9. The method of claim 8, wherein the second electronic device further comprises a fifth service module, the method further comprising:
the second communication interface module receives a fourth connection request of the fifth service module, where the fourth connection request is used to instruct the second communication interface module to establish the first physical link;
in response to the fourth connection request, the second communication interface module sends a second multiplexing connection request to the first communication interface module and adds one to the second total count value when the second total count value is greater than 0, where the second multiplexing connection request is used to request the first communication interface module to multiplex the first physical link.
10. The method of claim 8, wherein before the second communication interface module receives the first multiplexing connection request sent by the first communication interface module, the method further comprises:
the second communication interface module receives a connection request sent by the first communication interface module;
the second communication interface module establishing the first physical link with the first communication interface module in response to the connection request;
the second communication interface module adds one to the second total count value;
and the second communication interface module sends connection success information to the first communication interface module, wherein the connection success information represents that the first physical link is successfully established.
11. The method according to any one of claims 8 to 10, further comprising:
the second communication interface module receives a second disconnection request sent by the first communication interface module;
the second communication interface module decrements the second total count value by one and disconnects the first physical link in response to the second disconnect request.
12. The method according to any one of claims 8 to 10, further comprising:
the second communication interface module receives a count-down instruction sent by the first communication interface module;
the second communication interface module decrements the second total count value by one in response to the decrement count instruction.
13. A system for establishing a physical link, comprising a first electronic device configured to perform the method according to any one of claims 1 to 7 and a second electronic device configured to perform the method according to any one of claims 8 to 12.
14. An electronic device, comprising: a processor, a memory, and an interface;
the processor, the memory, and the interface cooperate to cause the electronic device to perform the method of any of claims 1-12.
15. A computer-readable storage medium, in which a computer program is stored which, when executed by a processor, causes the processor to carry out the method of any one of claims 1 to 12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210841718.8A CN114928899B (en) | 2022-07-18 | 2022-07-18 | Physical link establishment method and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210841718.8A CN114928899B (en) | 2022-07-18 | 2022-07-18 | Physical link establishment method and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114928899A CN114928899A (en) | 2022-08-19 |
CN114928899B true CN114928899B (en) | 2022-10-28 |
Family
ID=82815883
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210841718.8A Active CN114928899B (en) | 2022-07-18 | 2022-07-18 | Physical link establishment method and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114928899B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102724132A (en) * | 2012-06-29 | 2012-10-10 | 杭州迪普科技有限公司 | Method and device for improving transmission control protocol (TCP) connection multiplexing processing efficiency |
CN103023987A (en) * | 2012-11-27 | 2013-04-03 | 蓝盾信息安全技术股份有限公司 | Multiplexing method based on transmission control protocol (TCP) connection |
CN114679732A (en) * | 2020-12-24 | 2022-06-28 | 华为技术有限公司 | Method and electronic equipment for data transmission under Wi-Fi direct connection |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6597698B1 (en) * | 1997-12-19 | 2003-07-22 | Telefonaktiebolaget Lm Ericsson (Publ) | Coordinated cell discharge from ATM queue |
CN100401807C (en) * | 2004-11-25 | 2008-07-09 | 华为技术有限公司 | Creation for shared link in digit group system |
US10932313B2 (en) * | 2016-12-24 | 2021-02-23 | Huawei Technologies Co., Ltd. | Wireless connection switching method and terminal |
CN111131224B (en) * | 2019-12-20 | 2022-08-09 | 成都华为技术有限公司 | Method for maintaining connection and storage device |
-
2022
- 2022-07-18 CN CN202210841718.8A patent/CN114928899B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102724132A (en) * | 2012-06-29 | 2012-10-10 | 杭州迪普科技有限公司 | Method and device for improving transmission control protocol (TCP) connection multiplexing processing efficiency |
CN103023987A (en) * | 2012-11-27 | 2013-04-03 | 蓝盾信息安全技术股份有限公司 | Multiplexing method based on transmission control protocol (TCP) connection |
CN114679732A (en) * | 2020-12-24 | 2022-06-28 | 华为技术有限公司 | Method and electronic equipment for data transmission under Wi-Fi direct connection |
Also Published As
Publication number | Publication date |
---|---|
CN114928899A (en) | 2022-08-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110602686B (en) | Method for using remote SIM module and electronic equipment | |
CN113645715B (en) | Method and terminal device for monitoring link | |
CN115348630B (en) | Multi-device cooperation method and related device | |
CN114968384B (en) | Function calling method and device | |
US20240196454A1 (en) | File sharing method and terminal device | |
CN114489529A (en) | Screen projection method of electronic device, medium thereof and electronic device | |
CN115130085A (en) | Login authentication method and electronic equipment | |
CN113645608B (en) | Data transmission method and data transmission device | |
CN114928899B (en) | Physical link establishment method and electronic equipment | |
CN114928898B (en) | Method and device for establishing session based on WiFi direct connection | |
CN115002842B (en) | Data transmission method, electronic equipment and readable storage medium | |
CN115802516A (en) | Wi-Fi direct communication method and device | |
CN115278642A (en) | Method for acquiring information of SIM card, electronic equipment and terminal equipment | |
CN117479344B (en) | Bluetooth connection method, electronic equipment and readable storage medium | |
CN117014984B (en) | Communication method, electronic device, and computer-readable storage medium | |
CN116708533B (en) | Connection switching method, terminal device, communication system, and readable storage medium | |
CN116709584B (en) | Method for connecting car machine and terminal equipment | |
CN114916017B (en) | Data transmission method, electronic equipment and readable storage medium | |
CN116709582B (en) | Method for assisting conversation and electronic equipment | |
CN117119097B (en) | Method, equipment and storage medium for incoming call resonance | |
EP4415415A1 (en) | Method for reducing power consumption, and electronic device | |
CN118264709A (en) | Service discovery method and electronic equipment | |
CN118283026A (en) | File transmission method and electronic equipment | |
CN117956061A (en) | Data transmission method and terminal equipment | |
CN118368321A (en) | Link processing method and electronic equipment |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |