Method for switching communication mode and switching device for communication mode
Patent Information
- Application Number
- CN202011068870.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-30
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2040-09-30
Smart Images

Figure CN114339812B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communications, and more particularly to a method and apparatus for switching communication modes. Background Technology
[0002] With the development of internet technology and the increasing intelligence of home network products, the demand for communication between smart devices is also growing. For example, screen mirroring allows people to share their screens by projecting the image displayed on their mobile phones onto a large-screen TV.
[0003] Currently, there are two main ways for devices to communicate: one is local area network communication in the mode of wireless access point (AP), and the other is peer-to-peer (P2P) communication.
[0004] However, once devices have selected a communication method to connect, if network congestion occurs, the connection between the devices must be disconnected, and a new communication method must be manually selected. For example, when using wireless fidelity (WiFi) for screen mirroring, if network congestion occurs, the user must disconnect the current service and reconnect using the P2P method. Summary of the Invention
[0005] This application provides a communication mode switching method and a communication mode switching device, which can realize the rapid switching of terminal devices from one communication mode to another, and further, can avoid the transmission interruption of business data due to link switching.
[0006] Firstly, this application provides a method for switching communication modes. The method includes: a first terminal device receiving first communication parameters from a second terminal device via a first communication mode, the first communication parameters including communication parameters used by the second terminal device when communicating via a second communication mode; the first communication mode being one of an access point (AP) based communication mode and a point-to-point (P2P) communication mode; the second communication mode being another of a P2P communication mode and an AP-based communication mode; the first terminal device sending second communication parameters to the second terminal device via the first communication mode, the second communication parameters including communication parameters used by the first terminal device when communicating via the second communication mode; and the first terminal device communicating with the second terminal device via the second communication mode based on the first and second communication parameters.
[0007] The communication mode switching method provided in this application allows a terminal device to send communication parameter information of its communication in another communication mode to the other end while in one communication mode, thereby enabling the terminal device to quickly switch from the first communication mode to the second communication mode.
[0008] In conjunction with the first aspect, in one possible implementation, the first terminal device receives a first communication parameter from the second terminal device through a first communication mode, including: when the first terminal device experiences congestion during communication through the first communication mode or when the remaining resources in the first communication mode are less than the transmission resources required for the first service data to be sent by the first terminal device, the first terminal device receives the first communication parameter through the first communication mode.
[0009] In conjunction with the first aspect, in one possible implementation, when the first communication mode is an AP-based communication mode, the first communication parameter includes at least one of the following parameters: the media access control MAC address, channel parameters, or Internet IP address of the second terminal device, and the second communication parameter includes at least one of the following parameters: the MAC address, channel parameters, or IP address of the first terminal device.
[0010] In conjunction with the first aspect, in one possible implementation, when the first communication mode is a P2P communication mode, the first communication parameter includes at least the IP address of the second terminal device when it acts as the receiving end, and the second communication parameter includes the IP address of the first terminal device.
[0011] In conjunction with the first aspect, in one possible implementation, the first terminal device communicates with the second terminal device via a second communication mode based on first and second communication parameters, including: the first terminal device sending second service data to the second terminal device via the second communication mode based on the first and second communication parameters. Accordingly, the method further includes: the first terminal device sending the second service data to the second terminal device via the first communication mode.
[0012] The communication mode switching method provided in this application enables the terminal device to switch between the first and second communication modes after obtaining the communication parameter information of the sending and receiving ends of the second communication mode through the first communication mode. Furthermore, it simultaneously transmits second service data in both the first and second communication modes, and also achieves uninterrupted communication between the first and second communication modes.
[0013] In conjunction with the first aspect, in one possible implementation, after the first terminal device communicates with the second terminal device through a second communication mode based on the first communication parameters and the second communication parameters, the method further includes: the first terminal device releasing the communication link of the first communication mode.
[0014] Secondly, this application provides a communication mode switching device, comprising: a receiving module, configured to receive first communication parameters from a second terminal device through a first communication mode, the first communication parameters including communication parameters of the second terminal device when communicating through a second communication mode, the first communication mode being one of an access point (AP) based communication mode and a point-to-point (P2P) communication mode, and the second communication mode being another of a P2P communication mode and an AP based communication mode; a sending module, configured to send second communication parameters to the second terminal device through the first communication mode, the second communication parameters including communication parameters of the communication mode switching device when communicating through the second communication mode; and a communication module, configured to communicate with the second terminal device through the second communication mode according to the first communication parameters and the second communication parameters.
[0015] In conjunction with the second aspect, in one possible implementation, the receiving module is specifically used to: receive first communication parameters from the second terminal device when communication in the first communication mode is congested or the remaining resources in the first communication mode are less than the transmission resources required by the first service data to be sent by the communication mode switching device.
[0016] In conjunction with the second aspect, in one possible implementation, when the first communication mode is an AP-based communication mode, the first communication parameter includes at least one of the following parameters: the media access control MAC address, channel parameters, or Internet IP address of the second terminal device, and the second communication parameter includes at least one of the following parameters: the MAC address, channel parameters, or IP address of the first terminal device to which the communication mode switching device belongs.
[0017] In conjunction with the second aspect, in one possible implementation, when the first communication mode is a P2P communication mode, the first communication parameter includes at least the IP address of the second terminal device when it acts as the receiving end, and the second communication parameter includes the IP address of the first terminal device to which the communication mode switching device belongs.
[0018] In conjunction with the second aspect, in one possible implementation, the communication module is specifically used to: transmit second service data to the second terminal device via a second communication mode, based on the first communication parameters and the second communication parameters, via the sending module. Correspondingly, the sending module is also used to: transmit the second service data to the second terminal device via the first communication mode.
[0019] In conjunction with the second aspect, in one possible implementation, the communication module is further configured to: release the communication link of the first communication mode after communicating with the second terminal device through the second communication mode according to the first communication parameters and the second communication parameters.
[0020] Thirdly, this application provides a communication mode switching device, comprising: a memory, a processor, and a communication interface; the memory is used to store program instructions; the processor is used to call the program instructions in the memory to execute the communication mode switching method as described in the first aspect or any possible implementation thereof.
[0021] Fourthly, this application provides a chip including at least one processor and a communication interface, the communication interface and at least one processor being interconnected via a line, the at least one processor being used to run a computer program or instructions to perform a communication mode switching method as described in the first aspect or any of the possible implementations thereof.
[0022] Fifthly, this application provides a terminal device including at least one processor and a communication interface, the communication interface and the at least one processor being interconnected via a line, the at least one processor being configured to run a computer program or instructions to perform a communication mode switching method as described in the first aspect or any of its possible implementations. Attached Figure Description
[0023] Figure 1 A schematic diagram of a communication system provided in one embodiment of this application;
[0024] Figure 2 A schematic diagram illustrating the process of establishing a P2P connection is provided for one embodiment of this application;
[0025] Figure 3 A schematic flowchart illustrating a communication mode switching method provided in one embodiment of this application;
[0026] Figure 4 A schematic flowchart illustrating a communication mode switching method provided in another embodiment of this application;
[0027] Figure 5 A schematic diagram illustrating the process of establishing a P2P connection is provided for another embodiment of this application;
[0028] Figure 6 A schematic flowchart illustrating a communication mode switching method provided in yet another embodiment of this application;
[0029] Figure 7 A schematic diagram illustrating communication link switching for a screen mirroring service provided in one embodiment of this application;
[0030] Figure 8 A schematic diagram of the structure of a communication mode switching device provided in an embodiment of this application;
[0031] Figure 9 This is a schematic diagram of the structure of an apparatus provided in another embodiment of this application. Detailed Implementation
[0032] To facilitate understanding, the relevant terms used in this application will be explained first.
[0033] 1. Wireless AP
[0034] A wireless access point (AP) is essentially a wireless hub used by wireless devices to connect to an existing wired network. It relays data between the wired network and the wireless devices. An AP connects directly to a router, which in turn connects to a modem, allowing the wireless devices to connect to the internet. Wireless APs are primarily used in medium to large-sized environments. A typical environment usually has multiple wireless access points to ensure network coverage. For example, in a medium-sized office with desktop computers, laptops, and tablets, the desktop computers are connected to the router via Ethernet cables. To enable the laptops and tablets to connect to the network wirelessly, the office can use wireless APs. These APs can be placed in key locations, each connected to the router via an Ethernet cable. Once a connection is established, each AP emits a wireless signal, allowing laptops and tablets to wirelessly join the network. Simultaneously, all devices are connected to the same network.
[0035] 2. Point-to-point connection
[0036] P2P connections, also known as peer-to-peer connections, refer to communication between two hosts where there is no distinction between service requesters and service providers. Application processes distributed across the network edge are equal and are called peers. Peers communicate directly with each other; each peer is both a service requester and a service provider. For example, as long as two hosts are running peer-to-peer software, they can communicate equally and can download shared documents already on each other's hard drives. The essence of P2P connections is decentralization, meaning service is distributed, because servers are not concentrated in a few server computers but distributed across a large number of peer computers, which are not owned by service providers. Furthermore, one of the most prominent characteristics of P2P connections is their scalability. Because each additional peer increases both the service requester and the service provider, system performance does not decrease with increasing scale.
[0037] 3. Real-time streaming protocol
[0038] Real-Time Streaming Protocol (RTSP) is an application-layer protocol in the Internet Protocol (IP) architecture that controls the transmission of real-time data. This protocol defines how one-to-many applications can efficiently transmit multimedia data via the Internet Protocol (IP). Architecturally, RTSP sits above the Real-Time Transport Protocol (RTP) and Real-Time Transmission Control Protocol (RTC), and it uses either Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) to complete data transmission.
[0039] When using RTSP, both the client and server can send requests, meaning RTSP is bidirectional. Because RTSP is bidirectional, both the client and server can send requests during use. RTSP is primarily used as a multimedia streaming protocol to control audio or video, and it allows multiple streaming requests to be controlled simultaneously. The network communication protocol used for transmission is not within the scope of its definition.
[0040] Figure 1 This is a schematic diagram of a communication system provided according to an embodiment of this application. Figure 1 As shown, the communication system of this application may include terminal device 110, terminal device 120 and AP 130.
[0041] Among them, terminal device 110 may include smartphones, tablets or smart wearable devices, etc., and terminal device 120 may include smartphones, tablets, smart TVs or smart printers, etc.
[0042] Terminal device 110 and terminal device 120 can communicate through different communication modes. For example, terminal device 110 can communicate with terminal device 120 through a communication mode based on AP 130. Alternatively, terminal device 110 and terminal device 120 can communicate through a P2P communication mode.
[0043] The following example illustrates how terminal device 110 communicates with terminal device 120 via AP 130 using a mobile phone and terminal device 110 as a smart TV. For instance, both the mobile phone and the smart TV must have wireless capabilities (physical network card or chip), and both must be connected to the same wireless router. This means the mobile phone initiating the service request and the smart TV receiving the service information must be on the same local area network (LAN), i.e., their IP addresses must be on the same network segment. For example, consider screen mirroring between a mobile phone and a smart TV. Modern smart TVs integrate miniature, lightweight audio-visual systems. Simply connect the smart TV and the mobile phone to the same wireless network, enable screen mirroring in the TV's settings, and operate the mobile phone or tablet. The router will forward the data sent by the mobile phone and the relevant service information to the smart TV. At this point, both the mobile phone and the TV display the same screen.
[0044] The following example illustrates communication between terminal device 110 and terminal device 120 via P2P communication mode. In this mode, communication between terminal devices does not require router support; the connection is established directly between the sender and receiver via P2P functionality. For example, in the case of communication between terminal device 110 (a smartphone) and terminal device 120 (a smart TV), a P2P-enabled smartphone can directly connect to a P2P-enabled smart TV, and the smartphone can then transmit its screen or media resources to the smart TV for display or playback.
[0045] Figure 1 In the communication system shown, after terminal device 110 and terminal device 120 select a communication mode, if congestion occurs due to a large number of services at a certain moment, or if a new service will cause congestion between services, the current service must be disconnected and reconnected. Resuming service transmission in this way results in a long recovery time. For example, mobile screen mirroring can communicate based on wireless AP mode or P2P mode. However, once a communication connection is established and the transmission stream begins, switching from P2P to wireless AP or vice versa is not supported. If network congestion occurs, the service must be disconnected and reconnected.
[0046] As an example, if network congestion occurs in AP-based communication mode, the current connection needs to be disconnected and a new P2P communication mode needs to be selected for communication. Figure 2 This is a schematic diagram illustrating the process of establishing a P2P connection according to one embodiment of this application. Figure 2As shown, if the first terminal device wants to communicate with the second terminal device through P2P, it needs to go through the processes of P2P scanning (not shown in the figure), provision discovery (PD), group owner (GO) negotiation, WiFi protected setup (WPS) authentication and group establishment.
[0047] The process includes: PD (Programming Request) and PD (Programming Response) messages, primarily to determine the WiFi Simple Configuration (WSC) method used by both parties; GO (Go) negotiation, involving at least one transmission of GON (Go Request) and GON (Go Response) messages to negotiate parameters such as the channel determined by the GO device; after successful P2P GO negotiation, the second terminal device sends a connection request to the first terminal device, for example, by sending an NL80211_CMD_NEW_STAION message; and WPS (Wide-Side Authentication) includes the Extended Authentication Protocol (ESP). The transmission of authentication protocol (EAP) request messages, EAP response messages, WSC / Start messages, WSC_MSG:M1 messages, WSC_MSG:M2 messages, and / or WSC_Done messages; after successful WPS authentication, P2P group establishment begins; if EAP fails, it indicates that extended authentication has failed, i.e., P2P connection establishment has failed; then the connection is disconnected and restarted, for example, by resending NL80211_CMD_NEW_STAION, and then a four-way handshake is performed. This four-way handshake is a necessary step before P2P connection establishment to verify whether the other party's key is correct. After the four-way handshake is successful, the group handshake AP-STA is established and the connection is successful.
[0048] Figure 2 The specific implementation process of each step in the illustrated embodiment can be found in the description in related technologies, and will not be repeated here. Figure 2 As shown in the process diagram, the first terminal device disconnects from the WiFi connection and re-establishes the P2P connection, which requires many related processes and causes significant latency. For example, the P2P scanning process takes a considerable amount of time.
[0049] To address the aforementioned problems, this application provides a new method and apparatus for switching communication modes. In the proposed solution, the terminal device sends its communication parameters (when communicating in another communication mode) to the peer device while in the current communication mode. This saves the communication time required for the terminal device to re-search for the peer device's communication parameters after disconnecting the current communication link, thereby reducing communication latency between terminal devices.
[0050] Figure 3 This is a schematic flowchart illustrating a communication mode switching method provided in one embodiment of this application. Figure 3 As shown, the method in this embodiment may include:
[0051] S301. The first terminal device receives first communication parameters from the second terminal device through a first communication mode. The first communication parameters include communication parameters when the second terminal device communicates through the second communication mode. The first communication mode is one of an access point (AP) based communication mode and a point-to-point (P2P) communication mode. The second communication mode is another of a P2P communication mode and an AP based communication mode.
[0052] In this embodiment, the first terminal device can represent the device that initiates the service, and the second terminal device can represent the device that receives the service. For example, the first terminal device can be a sending end device such as a mobile phone or tablet computer that initiates the screen mirroring service, and the second terminal device can be a receiving end device such as a smart TV or desktop computer that receives the screen mirroring service.
[0053] As an example, one example of a first terminal device is terminal device 110, and one example of a second terminal device is terminal device 120.
[0054] Optionally, the second terminal device can represent the device that initiates the service, and the first terminal device can represent the device that receives the service. For example, the second terminal device can be a sending device such as a mobile phone or tablet computer that initiates the screen mirroring service, and the first terminal device can be a receiving device such as a smart TV or desktop computer that receives the screen mirroring service.
[0055] As an example, the first terminal device is terminal device 120, and the second terminal device is terminal device 110.
[0056] In this embodiment, the first communication mode represents the mode in which the first terminal device and the second terminal device are communicating, and the second communication mode represents the desired communication mode.
[0057] In this embodiment, the first communication parameters received by the first terminal device include information about the second terminal device, such as network status information of the second terminal device. Since the device initiating the service and the device receiving the service remain the same regardless of whether it is the first communication mode or the second communication mode, the first communication parameters also represent information of the receiving end in the second communication mode.
[0058] In one possible implementation, when the first communication mode is AP communication mode and the second communication mode is P2P communication mode, the first communication parameter represents the current information of the second terminal device when the first terminal device and the second terminal device are communicating in AP mode.
[0059] As an example, when the second communication mode is a P2P-based communication mode, the first communication parameter may include at least one of the following parameters: the media access control address (MAC) address, channel parameter, or IP address of the second terminal device, and the second communication parameter may include at least one of the following parameters: the MAC address, channel parameter, or IP address of the first terminal device.
[0060] As an example, channel parameters can include channels within the 2.4 GHz or 5 GHz frequency band. For instance, there are 3 available channels in the 2.4 GHz band, characterized by a narrow bandwidth, low data rate, and high interference; while there are currently 13 available channels in the 5 GHz band.
[0061] In another possible implementation, when the first communication mode is a P2P communication mode and the second communication mode is an AP communication mode, the first communication parameter represents the current information of the second terminal device when the first terminal device and the second terminal device are communicating in P2P mode. P2P communication modes include, but are not limited to, Bluetooth connection, bit torrent (BT) download, or direct wireless connection.
[0062] As another example, when the second communication mode is an AP-based communication mode, the first communication parameter may include at least the IP address of the second terminal device when it acts as the receiving end.
[0063] It should be noted that during the operation of the first terminal device and the second terminal device, when the first communication mode is the AP-based communication mode, the first communication parameters received by the first terminal device from the second terminal device through the communication link of the first communication mode are not static. They can be actively updated or periodically or non-periodically according to the current state of the AP.
[0064] S302, the first terminal device sends second communication parameters to the second terminal device through a first communication mode, the second communication parameters including the communication parameters when the first terminal device communicates through the second communication mode.
[0065] In this embodiment, the second communication parameters received by the second terminal device may include information about the first terminal device, such as network status information of the first terminal device.
[0066] In one possible implementation, when the first communication mode is an AP-based communication mode and the second communication mode is a P2P communication mode, the second communication parameter represents the current information of the first terminal device when the first terminal device and the second terminal device are communicating in AP mode.
[0067] For example, when the second communication mode is a P2P-based communication mode, the second communication parameters may include at least one of the following parameters: the IP address of the first terminal device.
[0068] In another possible implementation, when the first communication mode is P2P communication mode and the second communication mode is AP communication mode, the second communication parameter represents the current information of the first terminal device when the first terminal device and the second terminal device are communicating in P2P mode.
[0069] For example, when the second communication mode is the AP communication mode, the second communication parameter may include the IP address of the first terminal device.
[0070] It should be noted that during the operation of the first terminal device and the second terminal device, when the first communication mode is the AP-based communication mode, the second communication parameters sent by the first terminal device to the second terminal device through the first communication mode are not static. The second communication parameters sent by the first terminal device to the second terminal device can be actively updated or periodically or non-periodically according to the current state of the AP.
[0071] S303. The first terminal device communicates with the second terminal device through the second communication mode according to the first communication parameters and the second communication parameters.
[0072] In one possible implementation, when the first communication mode is an AP-based communication mode and the second communication mode is a P2P communication mode, the first terminal device communicates with the second terminal device on the P2P communication mode communication link based on the first communication parameters received from the second terminal device through the AP-based communication link and the second communication parameters sent through the AP-based communication link.
[0073] In another possible implementation, when the first communication mode is a P2P communication mode and the second communication mode is an AP-based communication mode, the first terminal device communicates with the second terminal device on the AP-based communication mode communication link based on the first communication parameters received from the second terminal device through the P2P communication mode communication link and the second communication parameter information sent through the P2P mode communication link.
[0074] The communication mode switching method provided in this embodiment obtains the communication parameter information of the sending and receiving ends in the first communication mode, thereby enabling the terminal device to communicate from the first communication mode to the second communication mode. Since the relevant parameters for communication between the sending and receiving ends in the first communication mode are directly obtained from the first communication mode, the delay or even network disconnection caused by switching from the first communication mode to the second communication mode is avoided, thus achieving fast communication.
[0075] As an optional embodiment, the first terminal device receiving the first communication parameters from the second terminal device through the first communication mode may include: when the first terminal device experiences congestion during communication through the first communication mode or when the remaining resources in the first communication mode are less than the transmission resources required for the first service data to be sent by the first terminal device, the first terminal device receives the first communication parameters through the first communication mode.
[0076] In this embodiment, congestion refers to a situation where the resource demand of the transmitted service data exceeds the resource capacity of the communication link under the current communication mode. In computer networks, link capacity, buffers in switching nodes, and processors are all network resources. Congestion can manifest as decreased throughput at the sending end, increased packet latency, and so on. For example, assuming a network with 100Mbps bandwidth, and several terminal devices at the sending end all need to send data to the receiving end, if the combined network resources used by the sending end exceed the 100Mbps bandwidth that the link can carry, congestion will occur, potentially even leading to router deadlock.
[0077] In one possible implementation, the first terminal device can dynamically read the status of the network interface card (NIC) to check the current service congestion situation. This dynamic reading can be done at regular intervals, for example, every two minutes.
[0078] In another possible implementation, the first terminal device can dynamically sense new services, such as predicting whether there is a congestion conflict between the new service and existing services before starting a new service. For example, if the network is currently using 50% of its bandwidth resources, and a new service needs to be loaded, such as a screen mirroring service requiring 50 Mbps bandwidth, and the network resources exceed 95% after the screen mirroring service is loaded, then it can be said that there is a congestion conflict between the screen mirroring service and existing services. In practical applications, those skilled in the art can choose an appropriate method to determine whether a congestion conflict exists based on actual needs.
[0079] Figure 4 A schematic flowchart illustrating a communication mode switching method provided in another embodiment of this application. The method of this embodiment may include:
[0080] S401. The first terminal device receives a first communication parameter from the second terminal device through the communication mode of the AP. The first communication parameter includes at least one of the following parameters: the MAC address, channel parameter, or IP address of the second terminal device.
[0081] Optionally, the first communication parameter may also include a status, such as a WSC configuration method, or whether the current second terminal device is in a temporary group or a permanent group.
[0082] In this embodiment, since the sending end and receiving end remain unchanged regardless of whether it is the first communication mode based on AP communication mode or the second communication mode based on P2P communication mode, the information received by the first terminal device from the second terminal device through the communication link based on AP communication mode represents the information of the receiving end in the second communication mode based on P2P communication mode.
[0083] In one possible implementation, when the first terminal device determines that the first communication mode is congested or that the remaining resources on the first communication mode are less than the transmission resources required by the first terminal device's first pending service, the first terminal device can send a request message to the second terminal device. This request message informs the second terminal device to return its current network status to the first terminal device. The first communication mode based on the AP forwards the request message sent by the first terminal device to the second terminal device with which it is communicatively connected. The second terminal device responds to the request by returning a detection report to the first terminal device through the first communication mode based on the AP. This detection report may include the second terminal device's MAC address, IP address, or current channel information parameters. For example, channel information may include operating frequency, channel quality, etc.
[0084] S402, the first terminal device sends second communication parameters to the second terminal device through a first communication mode based on AP communication mode, including at least one of the following parameters: MAC address, channel parameters or IP address when the first terminal device acts as the sender.
[0085] Similar to step S401, since the sending end and receiving end remain unchanged regardless of whether it is the first communication mode based on AP communication mode or the second communication mode based on P2P communication mode, the second communication parameters sent by the first terminal device through the AP communication mode represent the information of the sending end in the P2P communication mode.
[0086] In one possible implementation, when the first terminal device determines that the first communication mode is congested or that the remaining resources in the first communication mode are less than the transmission resources required by the first terminal device's first service to be sent, the first terminal device can inform the second terminal device of the current network status. This report may include the first terminal device's MAC address, IP address, or current channel information parameters. For example, channel information may include operating frequency, channel quality, etc.
[0087] S403. The first terminal device communicates with the second terminal device through P2P communication mode according to the first communication parameters and the second communication parameters.
[0088] In this embodiment, step S403 can be referred to the above. Figure 3 The relevant descriptions of the embodiments shown will not be repeated here.
[0089] The communication mode switching method provided in this embodiment obtains the communication parameter information of the sender and receiver in the P2P communication mode through the AP-based communication mode, thereby enabling the terminal device to communicate from the AP communication mode to the P2P communication mode. Since the relevant parameters for communication between the sender and receiver in the P2P communication mode are directly obtained from the first communication mode, the latency or even network disconnection caused by switching from the AP-based communication mode to the P2P communication mode is avoided, thus achieving fast communication from the AP communication mode to the P2P communication mode.
[0090] For example, the first terminal device can obtain the MAC, status, channel and other information of the second terminal device as a group client (GC) through the AP-based communication link, and the second terminal device can obtain the MAC, status, channel and other information of the first terminal device as a GO through the AP-based communication mode. That is, the first terminal device and the second terminal device have obtained the communication parameter information of the other end device through the AP-based communication mode.
[0091] Figure 5 This is a schematic diagram illustrating the process of establishing a P2P connection, provided for another embodiment of this application. Figure 5 As shown, in the AP-based communication mode, the second terminal device transmits its MAC address, status, or channel information (as a GC in the P2P communication mode) to the first terminal device via the AP-based communication mode, such as... Figure 5 As shown in step S501, the first terminal device transmits its MAC address, status, or channel information (as of the GC in P2P communication mode) to the second terminal device via AP-based communication mode, such as... Figure 5 As shown in step S502, the P2P communication mode starts the P2P group establishment based on the current information of the first terminal device and the second terminal device, and then confirms the connection through a four-step handshake.
[0092] Depend on Figure 5 As can be seen from the embodiments shown, the first terminal device and the second terminal device can skip the scanning, GO negotiation and WPS authentication stages required by the traditional P2P communication mode, and directly establish a P2P communication mode based on the known first communication parameters and second communication parameters, thereby enabling communication between the first terminal device and the second terminal device quickly.
[0093] Figure 6 A schematic flowchart illustrating a communication mode switching method provided in another embodiment of this application. The method of this embodiment includes:
[0094] S601. The first terminal device receives a first communication parameter from the second terminal device through a communication link in P2P communication mode. The first communication parameter includes at least the IP address of the second terminal device when it is the receiving end.
[0095] S602, the first terminal device sends a second communication parameter to the second terminal device through a P2P communication link, wherein the second communication parameter includes at least the IP address of the first terminal device when it is the sender.
[0096] S603. The first terminal device communicates with the second terminal device through an AP-based communication mode based on the first communication parameters and the second communication parameters.
[0097] Steps S601 to S602 in this embodiment are similar to those in the previous embodiment. Figure 4 Steps S401 to S402 in the illustrated embodiment. Since the sending and receiving ends remain unchanged regardless of whether it is P2P communication mode or AP-based communication mode, the information received by the first terminal device from the second terminal device through P2P communication mode represents the information of the receiving end in AP-based communication mode. The first terminal device sends the second communication parameters through P2P communication mode, representing the information of the sending end in AP-based communication mode. Step S603 in this embodiment can be referred to... Figure 3 Step S303 in the illustrated embodiment will not be repeated here.
[0098] The communication mode switching method provided in this embodiment obtains the communication parameter information of the sender and receiver in the AP-based communication mode through the P2P communication mode, realizing the terminal device's communication from the P2P communication mode to the AP-based communication mode. Since the relevant parameters for communication between the sender and receiver in the AP-based communication mode are directly obtained from the first communication mode, the latency or even network disconnection caused by switching from the P2P communication mode to the AP-based communication mode is avoided, thus achieving fast communication from the P2P communication mode to the AP-based communication mode.
[0099] Based on the above embodiments, as an optional embodiment, the first terminal device and the second terminal device communicate with each other through a second communication mode according to the first communication parameters and the second communication parameters. This may include: the first terminal device sending second service data to the second terminal device through the second communication mode according to the first communication parameters and the second communication parameters. Accordingly, the method may further include: the first terminal device sending second service data to the second terminal device through the first communication mode.
[0100] In other words, the first terminal device simultaneously sends the service data of the second service to the second terminal device through both the first and second communication modes. This service data is referred to as the second service data. This ensures the reliability of the second service data transmission.
[0101] Since communication between terminal devices is actually communication between a certain service, before the first terminal device and the second terminal device communicate through the second communication mode according to the first communication parameters and the second communication parameters, it is necessary to notify the second service that the second communication mode has been successfully established. Then, the second service data is sent to the second terminal device through the second communication mode. Correspondingly, the first terminal device sends the second service data to the second terminal device through the first communication mode, so as to realize the communication of the second service in the second communication mode.
[0102] Optionally, after the first terminal device communicates with the second terminal device through the second communication mode based on the first communication parameters and the second communication parameters, the process may further include: the first terminal device releasing the first communication mode.
[0103] In one feasible solution, after the first terminal device and the second terminal device communicate in the second communication mode, the second communication mode will notify the first communication mode of the switchover completion. Upon receiving the notification from the second communication mode, the first communication mode will disconnect the current connection.
[0104] For ease of understanding, this embodiment uses the example of switching from AP-based communication mode to P2P communication mode in mobile screen mirroring service. It should be noted that the method provided in this application can be applied to different business operations, including but not limited to screen mirroring services. Furthermore, in this embodiment, the screen mirroring terminal can be a mobile device with a built-in or external wireless network card, thereby enabling communication between the screen-mirrored terminal and the screen mirroring terminal, further realizing screen mirroring between them. The screen-mirrored terminal can be a smart TV, desktop computer, etc. Once the screen-mirrored terminal and the screen mirroring terminal establish a connection, the screen mirroring terminal can open the corresponding media file.
[0105] Figure 7 This is a schematic diagram illustrating communication link switching for a screen mirroring service provided in one embodiment of this application, as shown below. Figure 7 As shown in the diagram, the basic interconnect module can be considered the management module for terminal devices, mainly used for service discovery and connection. The system service processes can be considered as described in the Android architecture diagram (such as the application layer, framework layer, runtime library, or kernel). Figure 7The screen mirroring module shown first detects congestion or predicts that the deployment of this service will cause congestion conflicts with existing services on the communication link based on the AP communication mode. It obtains the MAC address, channel parameters, or IP information of the first terminal device as the sender (GO) through the AP link, and the MAC address, channel parameters, or IP information of the second terminal device as the receiver (GC) through the AP link. The MAC address, channel parameters, or IP information of the first terminal device as the sender (GO) can be referred to as the first communication parameters, and the MAC address, channel parameters, or IP information of the second terminal device as the receiver (GC) can be referred to as the second communication parameters. Then, the sender can skip the traditional P2P negotiation process and perform P2P negotiation based on the first and second communication parameters to establish a second communication mode of P2P communication mode.
[0106] Since the primary communication channel is the screen projection service module, the P2P communication mode is successfully established. At this point, the screen projection service module establishes an RTSP path based on the P2P communication mode to negotiate screen projection service parameters. Once the RTSP is successfully established, the service stream begins to be sent in P2P communication mode. Simultaneously, the target device is notified via the RTSP protocol that this transmission stream is the primary service stream and an M4 REQ is sent for switching. The M4 REQ can be understood as SET_PARAMETER, for example, a negotiation message in the RTSP protocol. At this time, the target device receives service streams from both the AP-based communication mode and the P2P communication mode. After successfully parsing the P2P communication mode, the target device begins to decode only the P2P communication mode service stream. It then informs the basic interconnection module to switch from the first communication mode to the second communication mode and notifies the AP-based communication mode service stream to be closed via RTSP.
[0107] The communication mode switching method provided in this embodiment achieves communication between the terminal device and the second communication mode after obtaining the communication parameter information of the sending and receiving ends of the second communication mode through the first communication mode. Furthermore, after notifying the successful establishment of the second communication mode for the second service, the second service data is sent simultaneously in both the first and second communication modes. Therefore, in addition to achieving rapid communication between the first and second communication modes, it also achieves uninterrupted communication between the first and second communication modes.
[0108] It should be noted that any of the above embodiments can be implemented alone, or at least two of the above embodiments can be combined in any way, and there is no limitation thereto.
[0109] It is understood that in the above embodiments, the operations and steps implemented by the terminal device can also be implemented by components (such as chips or circuits) that can be used in the terminal device, and the embodiments of this application do not limit this.
[0110] Figure 8 This is a schematic diagram of the communication mode switching device provided in an embodiment of this application. Figure 8 The communication mode switching device shown can be used to execute the communication mode switching method described in any of the foregoing embodiments.
[0111] like Figure 8 As shown, the communication mode switching device 800 of this embodiment includes: a receiving module 801, a sending module 802, and a communication module 803. The receiving module 801 is used to receive first communication parameters from the second terminal device through a first communication mode; the sending module 802 is used to send second communication parameters to the second terminal device through the first communication mode; and the communication module 803 is used to communicate with the second terminal device.
[0112] As an example, the receiving module 801 can be used to perform... Figures 3 to 6 The receiving step in any of the communication mode switching methods described herein. For example, receiving module 801 is used to execute S301.
[0113] As another example, the sending module 802 can be used to perform... Figures 3 to 6 The receiving step in any of the communication mode switching methods described herein. For example, the transmitting module 802 is used to execute S301.
[0114] In one possible implementation, when communication in the first communication mode is congested or the remaining resources in the first communication mode are less than the transmission resources required for the first service data to be sent by the communication mode switching device, the receiving module 801 receives the first communication parameters from the second terminal device.
[0115] In one possible implementation, when the first communication mode is an AP-based communication mode, the first communication parameter includes at least one of the following parameters: the media access control MAC address, channel parameters, or Internet IP address of the second terminal device, and the second communication parameter includes at least one of the following parameters: the MAC address, channel parameters, or IP address of the first terminal device to which the communication mode switching device belongs.
[0116] In one possible implementation, when the first communication mode is a P2P communication mode, the first communication parameter includes at least the IP address of the second terminal device when it is the receiving end, and the second communication parameter includes the IP address of the first terminal device to which the communication mode switching device belongs.
[0117] In one possible implementation, the communication module 803 is specifically used to: transmit second service data to the second terminal device via a second communication mode, based on first communication parameters and second communication parameters, via the sending module 802. Correspondingly, the sending module 802 is also used to: transmit the second service data to the second terminal device via the first communication mode.
[0118] In one possible implementation, the communication module 803 is further configured to: release the communication link of the first communication mode after communicating with the second terminal device through the second communication mode according to the first communication parameters and the second communication parameters.
[0119] Figure 9 This is a schematic diagram of the structure of an apparatus provided in another embodiment of this application. Figure 9 The apparatus shown can be used to perform the communication mode switching method described in any of the foregoing embodiments.
[0120] like Figure 9 As shown, the device 900 in this embodiment includes: a memory 901, a processor 902, and a communication interface 903.
[0121] Optionally, the memory 901 is used to store program instructions. The memory 901 may be, but is not limited to, random access memory, read-only memory, erasable programmable read-only memory, or portable read-only memory.
[0122] As an example, memory 901 may store information such as the MAC address of the second terminal device in S401 as the receiving end.
[0123] Optionally, the processor 902 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The processor may also be a combination that implements computational functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, etc.
[0124] As an example, the processor 902 can be used to read the program stored in the memory 901 and execute the scheme of any of the above method embodiments.
[0125] Optionally, the communication interface 903 is used for communication by the terminal device. As an example, the communication interface 903 can be used to perform... Figures 3 to 6 The communication steps in any of the communication mode switching methods described herein.
[0126] As an example, communication interface 903 is used to execute S303.
[0127] This application also provides a chip including at least one processor and a communication interface, wherein the communication interface and at least one processor are interconnected via a line, and the at least one processor is used to run computer programs or instructions.
[0128] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0129] It should be noted that the module division in this embodiment is illustrative and represents only one logical functional division; in actual implementation, there may be other division methods. The functional modules in this embodiment can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules can be implemented in hardware or as software functional modules.
[0130] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0131] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0132] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0133] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for switching communication modes, characterized in that, include: The first terminal device receives first communication parameters from the second terminal device through a first communication mode. The first communication parameters include communication parameters when the second terminal device communicates through a second communication mode. The first communication parameters include information of the second terminal device. The first communication mode is one of an access point (AP) based communication mode and a point-to-point (P2P) communication mode. The second communication mode is the other of the P2P communication mode and the AP based communication mode. The first communication mode and the second communication mode are different. The first terminal device sends a second communication parameter to the second terminal device through the first communication mode. The second communication parameter includes the communication parameters when the first terminal device communicates through the second communication mode. The first terminal device sends second service data to the second terminal device through the second communication mode based on the first communication parameters and the second communication parameters, and the first terminal device sends the second service data to the second terminal device through the first communication mode.
2. The method according to claim 1, characterized in that, The first terminal device receives first communication parameters from the second terminal device through a first communication mode, including: When the first terminal device experiences congestion during communication via the first communication mode, or when the remaining resources in the first communication mode are less than the transmission resources required for the first service data to be sent by the first terminal device, the first terminal device receives the first communication parameters via the first communication mode.
3. The method according to claim 1 or 2, characterized in that, When the first communication mode is the AP-based communication mode, the first communication parameter includes at least one of the following parameters: the media access control MAC address, channel parameter, or Internet IP address of the second terminal device, and the second communication parameter includes at least one of the following parameters: the MAC address, channel parameter, or IP address of the first terminal device.
4. The method according to claim 1 or 2, characterized in that, When the first communication mode is the P2P communication mode, the first communication parameters include at least the IP address of the second terminal device when it is the receiving end, and the second communication parameters include the IP address of the first terminal device.
5. The method according to any one of claims 1 to 4, characterized in that, After the first terminal device communicates with the second terminal device through the second communication mode based on the first communication parameters and the second communication parameters, the method further includes: The first terminal device releases the communication link of the first communication mode.
6. A communication mode switching device, characterized in that, include: The receiving module is configured to receive first communication parameters from a second terminal device through a first communication mode. The first communication parameters include communication parameters when the second terminal device communicates through a second communication mode, and the first communication parameters include information of the second terminal device. The first communication mode is one of an access point (AP) based communication mode and a point-to-point (P2P) communication mode, and the second communication mode is the other of the P2P communication mode and the AP based communication mode. The first communication mode and the second communication mode are different. The sending module is used to send a second communication parameter to the second terminal device through the first communication mode. The second communication parameter includes the communication parameters when the communication mode switching device communicates through the second communication mode. A communication module is used to send second service data to the second terminal device through the second communication mode according to the first communication parameters and the second communication parameters, and the communication mode switching device sends the second service data to the second terminal device through the first communication mode.
7. The apparatus according to claim 6, characterized in that, The receiving module is specifically used for: When communication in the first communication mode is congested or the remaining resources in the first communication mode are less than the transmission resources required by the first service data to be sent by the switching device of the communication mode, the receiving module receives the first communication parameters from the second terminal device.
8. The apparatus according to claim 6 or 7, characterized in that, When the first communication mode is the AP-based communication mode, the first communication parameter includes at least one of the following parameters: the media access control MAC address, channel parameter, or Internet IP address of the second terminal device, and the second communication parameter includes at least one of the following parameters: the MAC address, channel parameter, or IP address of the first terminal device to which the communication mode switching device belongs.
9. The apparatus according to claim 6 or 7, characterized in that, When the first communication mode is the P2P communication mode, the first communication parameter includes at least the IP address of the second terminal device when it is the receiving end, and the second communication parameter includes the IP address of the first terminal device to which the communication mode switching device belongs.
10. The apparatus according to any one of claims 6 to 9, characterized in that, The communication module is also used for: After communicating with the second terminal device through the second communication mode according to the first communication parameters and the second communication parameters, the communication link of the first communication mode is released.
11. A communication mode switching device, characterized in that, include: Memory, processor, and communication interface; The memory is used to store program instructions; The processor is used to invoke program instructions in the memory to execute the communication mode switching method as described in any one of claims 1 to 5.
12. A chip, characterized in that, It includes at least one processor and a communication interface, the communication interface and the at least one processor being interconnected via a line, the at least one processor being used to run a computer program or instructions to perform the communication mode switching method as described in any one of claims 1 to 5.
13. A computer-readable storage medium, characterized in that, The device stores computer instructions that, when executed by a processor, cause the processor to implement the communication mode switching method as described in any one of claims 1 to 5.
14. A computer program product, characterized in that, Includes computer instructions that, when executed by a processor, cause the processor to implement the communication mode switching method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Wireless connection switching method and terminal
CN109479226A