Communication method and apparatus, electronic device, storage medium, and computer program product
By evaluating the distance and signal quality between terminal devices and dynamically switching communication modes, the problem of unstable communication between terminal devices in closed environments is solved, thus improving the stability and reliability of communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING XIAOMI MOBILE SOFTWARE CO LTD
- Filing Date
- 2024-11-29
- Publication Date
- 2026-05-29
AI Technical Summary
Terminal devices experience a decline in communication quality in enclosed or signal-impenetrable environments, and may even be unable to establish a stable communication connection.
By determining the distance and signal quality between terminal devices, the communication method is dynamically adjusted, switching to a more suitable communication method to maintain a stable connection.
It improves the stability and reliability of communication between terminal devices, reduces the possibility of communication interruption, and realizes intelligent communication environment assessment and adaptive adjustment.
Smart Images

Figure CN122120932A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of communication technology, and in particular to a communication method, apparatus, electronic device, storage medium, and computer program product. Background Technology
[0002] With the advancement of technology, mobile phones, tablets, computers, and other terminal devices have gradually become important communication devices in people's lives. People use these devices for information exchange and communication, and the smooth communication between these devices highly depends on stable communication signals. However, in actual use, terminal devices often encounter situations where the communication signal is weak or unreceived, especially when the device is moved to enclosed environments or places where signals are difficult to penetrate, such as basements or elevators. In these places, the communication signal is blocked or attenuated by physical obstacles, leading to a decrease in communication quality and even the inability to establish a stable communication connection. Therefore, maintaining the stability of communication between terminal devices has become an urgent problem to be solved. Summary of the Invention
[0003] To overcome the problems existing in related technologies, this disclosure provides a communication method, apparatus, electronic device, storage medium, and computer program product.
[0004] According to a first aspect of the present disclosure, a communication method is provided, the method comprising:
[0005] Determine the distance between the first terminal and the second terminal with which a communication connection has been established, as well as the signal quality between the first terminal and the second terminal; wherein the first terminal and the second terminal have established the communication connection based on a first communication method;
[0006] Based on the distance between the first terminal and the second terminal and the signal quality, it is determined whether the first terminal and the second terminal maintain communication in the first communication mode or switch to the second communication mode.
[0007] In some embodiments, the communication distance supported by the first communication method is greater than the communication distance supported by the second communication method. The step of determining whether the first terminal and the second terminal should maintain communication using the first communication method or switch to the second communication method based on the distance between the first terminal and the second terminal and the signal quality includes:
[0008] In response to the distance between the first terminal and the second terminal being greater than or equal to a preset distance threshold, it is determined that the first terminal and the second terminal maintain communication in the first communication method;
[0009] In response to the distance between the first terminal and the second terminal being less than the preset distance threshold, based on the signal quality of the first terminal and the second terminal communicating in the first communication mode, it is determined whether to maintain communication in the first communication mode or switch to communication in the second communication mode.
[0010] In some embodiments, the signal quality includes signal strength, and determining whether to maintain communication in the first communication mode or switch to the second communication mode based on the signal quality of the communication between the first terminal and the second terminal using the first communication mode includes:
[0011] In response to the signal strength of the first communication method being less than a first preset signal strength threshold, it is determined to switch to the second communication method.
[0012] In response to the signal strength of the first communication method being greater than or equal to the first preset signal strength threshold, based on the signal strength of the first communication method, it is determined whether to maintain communication using the first communication method or switch to communication using the second communication method.
[0013] In some embodiments, the method further includes:
[0014] In response to the distance between the first terminal and the second terminal being less than the preset distance threshold, if a communication connection has been established based on the first communication method, a communication connection between the first terminal and the second terminal is established based on the second communication method.
[0015] The step of determining whether to maintain communication using the first communication method or switch to the second communication method based on the signal strength of the first communication method includes:
[0016] In response to the signal strength of the first communication method being greater than a second preset signal strength threshold, it is determined to maintain communication using the first communication method; wherein the second preset signal strength threshold is greater than the first preset signal strength threshold;
[0017] In response to the signal strength of the first communication method being between the first preset signal strength threshold and the second preset signal strength threshold, the transmission quality of the first terminal and the second terminal transmitting the same data packets based on the first communication method and the second communication method, respectively, is compared, and based on the comparison result of the transmission quality, it is determined whether to maintain communication in the first communication method or switch to communication in the second communication method.
[0018] In some embodiments, determining whether to maintain communication in the first communication mode or switch to the second communication mode based on the comparison results of transmission quality includes:
[0019] In response to the fact that the transmission quality of the same data packet transmitted in the first communication method is better than or equal to the transmission quality of the same data packet transmitted in the second communication method, it is determined to maintain communication in the first communication method;
[0020] In response to the fact that the transmission quality of the same data packet transmitted in the first communication method is inferior to the transmission quality of the same data packet transmitted in the second communication method, a decision is made to switch to the second communication method.
[0021] In some embodiments, the method further includes:
[0022] Based on the distance between the first terminal and the second terminal and the signal quality, it is determined to switch to the second communication mode while maintaining the connection status of the first communication mode.
[0023] When switching to the second communication method, the signal quality of the maintained first communication method is detected, and based on the signal quality of the first communication method, it is determined whether to maintain communication in the second communication method or switch to the first communication method.
[0024] In some embodiments, the first communication method is an indirect communication method, and the second communication method is a direct communication method.
[0025] According to a second aspect of the present disclosure, a communication device is provided, the device comprising:
[0026] The first determining module is configured to determine the distance between the first terminal and the second terminal with which a communication connection has been established, and the signal quality between the first terminal and the second terminal; wherein the first terminal and the second terminal have established the communication connection based on a first communication method;
[0027] The second determining module is configured to determine, based on the distance between the first terminal and the second terminal and the signal quality, whether the first terminal and the second terminal maintain communication in the first communication mode or switch to communication in the second communication mode.
[0028] In some embodiments, the communication distance supported by the first communication method is greater than the communication distance supported by the second communication method. The second determining module is further configured to determine that the first terminal and the second terminal maintain communication using the first communication method in response to the distance between the first terminal and the second terminal being greater than or equal to a preset distance threshold; and to determine whether to maintain communication using the first communication method or switch to communication using the second communication method based on the signal quality of the communication between the first terminal and the second terminal using the first communication method in response to the distance between the first terminal and the second terminal being less than the preset distance threshold.
[0029] In some embodiments, the signal quality includes signal strength, and the second determining module is further configured to determine to switch to the second communication mode in response to the signal strength of the first communication mode being less than a first preset signal strength threshold; and to determine to maintain communication in the first communication mode or switch to the second communication mode based on the signal strength of the first communication mode in response to the signal strength of the first communication mode being greater than or equal to the first preset signal strength threshold.
[0030] In some embodiments, the apparatus further includes:
[0031] The module is configured to, in response to a distance between the first terminal and the second terminal being less than a preset distance threshold, establish a communication connection between the first terminal and the second terminal based on the second communication method, provided that a communication connection has been established based on the first communication method.
[0032] The second determining module is further configured to determine to maintain communication using the first communication method in response to a signal strength greater than a second preset signal strength threshold; wherein the second preset signal strength threshold is greater than the first preset signal strength threshold; and to compare the transmission quality of the first terminal and the second terminal transmitting the same data packets based on the first communication method and the second communication method respectively in response to a signal strength between the first preset signal strength threshold and the second preset signal strength threshold, and to determine whether to maintain communication using the first communication method or switch to the second communication method based on the comparison result of the transmission quality.
[0033] In some embodiments, the second determining module is further configured to determine to maintain communication in the first communication method in response to the transmission quality of transmitting the same data packet in the first communication method being better than or equal to the transmission quality of transmitting the same data packet in the second communication method; and to determine to switch to communication in the second communication method in response to the transmission quality of transmitting the same data packet in the first communication method being worse than the transmission quality of transmitting the same data packet in the second communication method.
[0034] In some embodiments, the apparatus further includes:
[0035] The maintenance module is configured to, in response to determining to switch to the second communication mode based on the distance between the first terminal and the second terminal and the signal quality, maintain the connection state of the first communication mode;
[0036] The third determining module is configured to detect the signal quality of the maintained first communication method when switching to the second communication method, and determine whether to maintain communication in the second communication method or switch to the first communication method based on the signal quality of the first communication method.
[0037] In some embodiments, the first communication method is an indirect communication method, and the second communication method is a direct communication method.
[0038] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0039] processor;
[0040] Memory used to store computer programs or instructions;
[0041] The processor executes the computer program or instructions to implement the steps of the communication method described in the first aspect above.
[0042] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, the storage medium storing a computer program or instructions which, when executed by a processor, implement the steps of the communication method described in the first aspect above.
[0043] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program or instructions, which, when executed by a processor, implement the steps of the communication method described in the first aspect above.
[0044] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:
[0045] In this embodiment, the electronic device determines the distance between the first terminal and the second terminal that has established a communication connection based on the first communication method, as well as the signal quality between the first terminal and the second terminal. Based on the distance and signal quality between the first terminal and the second terminal, it determines whether the first terminal and the second terminal should maintain communication in the first communication method or switch to the second communication method. By determining the distance and signal quality between the first terminal and the second terminal, the accuracy of assessing the current communication environment of the first terminal and the second terminal can be improved. Based on the assessed communication environment, it determines whether the first terminal and the second terminal should maintain communication in the first communication method or switch to the second communication method, dynamically adjusting the communication method, reducing the possibility of communication interruption due to communication environment problems, improving the stability and reliability of communication between the first terminal and the second terminal, and exhibiting high intelligence.
[0046] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0047] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0048] Figure 1 This is a schematic diagram of the terminal's communication based on the base station in related technologies.
[0049] Figure 2 This is a flowchart illustrating a communication method according to an exemplary embodiment.
[0050] Figure 3 This is a schematic diagram illustrating a communication method according to an exemplary embodiment.
[0051] Figure 4 This is a flowchart illustrating a communication method according to an exemplary embodiment.
[0052] Figure 5 This is a block diagram of a communication device according to an exemplary embodiment.
[0053] Figure 6 This is a structural block diagram of an electronic device according to an exemplary embodiment. Detailed Implementation
[0054] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0055] Among related technologies, there is a method for terminals to communicate using base stations. Figure 1 This is a schematic diagram of a terminal based on base station communication in related technologies. L13 represents a terminal device, and L14 represents another terminal device besides L13. Figure 1As shown in (a), when both terminal device L13 and terminal device L14 are within the coverage area L12 of base station L11, terminal device L13 and terminal device L14 communicate based on base station L11. For example, when terminal device L13 sends data to terminal device L14, terminal device L13 can first send the data to base station L11, and base station L11 will then send the received data to terminal device L14. If at least one of the communicating terminal devices is not within the coverage area of the base station, such as... Figure 1 As shown in (b), when terminal device L13 is outside the coverage area L12 of base station L11, terminal device L13 and terminal device L14 cannot communicate based on base station L11, which will cause the communication between terminal device L13 and terminal device L14 to be disconnected.
[0056] In response, this disclosure provides a communication method. Figure 1 This is a flowchart illustrating a communication method according to an exemplary embodiment. For example... Figure 1 As shown, the method mainly includes the following steps:
[0057] S21. Determine the distance between the first terminal and the second terminal with which a communication connection has been established, and the signal quality between the first terminal and the second terminal; wherein the first terminal and the second terminal have established the communication connection based on a first communication method;
[0058] S22. Based on the distance between the first terminal and the second terminal and the signal quality, determine whether the first terminal and the second terminal maintain communication in the first communication mode or switch to the second communication mode.
[0059] In this embodiment of the disclosure, the first terminal and the second terminal can be terminal devices such as mobile devices, user terminals, mobile phones, tablets, televisions, vehicle systems, computers, and wearable devices. The communication method in this embodiment of the disclosure can be executed by the first terminal and / or the second terminal, or by other devices such as servers or cloud devices that are simultaneously connected to the first terminal and the second terminal. This embodiment of the disclosure takes an electronic device as the execution subject as an example for explanation, wherein the electronic device can be the first terminal and / or the second terminal, servers, or other devices.
[0060] In step S21, the electronic device determines the distance between the first terminal and the second terminal with which a communication connection has been established, wherein the first terminal and the second terminal have established a communication connection based on a first communication method. In some embodiments, the first communication method may be cellular communication, such as 3G, 4G, 5G, etc. It should be noted that cellular communication refers to the technology of wireless communication using cellular networks. A cellular network consists of multiple base stations and mobile devices. The base stations are responsible for transmitting and receiving signals, and the devices communicate with the base stations through wireless channels.
[0061] In other embodiments, the first communication method may also be Ethernet communication, radio communication, Wireless Fidelity (Wi-Fi) communication, Bluetooth communication, fiber optic communication, etc. Among them, Wi-Fi communication includes communication between terminal devices based on a router, such as communication based on a wireless local area network (WLAN); it also includes direct communication without the need for a router, such as Wi-Fi Direct communication. The embodiments of this disclosure do not limit the first communication method.
[0062] In this embodiment of the disclosure, the electronic device determines the distance between the first terminal and the second terminal with which a communication connection has been established. As mentioned above, the electronic device can be the first terminal and / or the second terminal itself, or it can be another device other than the first terminal or the second terminal that is simultaneously connected to both the first terminal and the second terminal. In some embodiments, when the electronic device is another device other than the first terminal or the second terminal that is simultaneously connected to both the first terminal and the second terminal, taking a server as an example, the server is simultaneously connected to both the first terminal and the second terminal. The server can detect the geographical location information sent by the first terminal and the second terminal respectively. If both the first terminal and the second terminal are connected to the server via the Internet, an IP address will be assigned when they connect to the server. The server can obtain the geographical location information associated with the IP address by querying the IP address database to determine the geographical location information of the first terminal and the second terminal, and determine the distance between the first terminal and the second terminal based on the geographical location information of the first terminal and the second terminal.
[0063] For example, both the first terminal and the second terminal can have built-in positioning modules. The first terminal and the second terminal can obtain their own geographical location information based on positioning technologies such as Global Positioning System (GPS), BeiDou Navigation Satellite System (BDS), and Global Navigation Satellite System (GNSS) through the positioning modules, and send the geographical location information to the server. The server determines the distance between the first terminal and the second terminal based on the geographical location information of the first terminal and the second terminal.
[0064] In other embodiments, when the electronic device is a first terminal and / or a second terminal, taking the electronic device as the first terminal as an example, the first terminal can send a signal with a sending timestamp to the second terminal based on a first communication method. After receiving the signal, the second terminal records the receiving time and returns the signal to the first terminal. After receiving the signal returned by the second terminal, the first terminal can determine the distance between itself and the second terminal based on the sending time, the receiving time of the returned signal, and the signal transmission speed (such as the speed of light). For another example, the first terminal can also obtain the geographical location information of both the first terminal and the second terminal, and determine the distance between them based on this information. The first terminal can obtain its geographical location information in the manner described above, or it can receive the geographical location information of the second terminal sent by the second terminal.
[0065] In this embodiment of the disclosure, the electronic device further determines the signal quality between the first terminal and the second terminal. As mentioned above, the first terminal and the second terminal establish a communication connection based on the first communication method, and determining the signal quality between the first terminal and the second terminal is to determine the signal quality of the first communication method.
[0066] In some embodiments, the electronic device may determine the signal strength of the communication between the first terminal and the second terminal based on the first communication method, such as by using a Received Signal Strength Indicator (RSSI), a spectrum analyzer, an oscilloscope, etc. to detect the signal strength.
[0067] In other embodiments, the electronic device may also determine information that characterizes signal quality, such as signal distortion rate, signal noise, signal bit error rate, and signal transmission delay, when the first terminal and the second terminal communicate based on the first communication method, in order to determine the signal quality between the first terminal and the second terminal. This disclosure does not limit this aspect.
[0068] In step S22, the electronic device determines, based on the distance between the first terminal and the second terminal and the signal quality, whether the first terminal and the second terminal maintain communication using the first communication method or switch to the second communication method. The second communication method can be a cellular communication method, such as 3G, 4G, or 5G, or it can be an Ethernet communication method, a radio communication method, a Wi-Fi communication method, a Bluetooth communication method, or a fiber optic communication method. The Wi-Fi communication method includes communication between terminal devices based on a router, such as communication based on a wireless local area network; it also includes direct communication methods that do not require a router, such as Wi-Fi direct communication. This embodiment does not limit the second communication method. It should be noted that the second communication method differs from the first communication method, and the corresponding communication distances are also different.
[0069] In this embodiment of the disclosure, for example, the electronic device may preset a signal quality threshold. When the signal quality of the first terminal and the second terminal is better than or equal to the signal quality threshold, communication is maintained in the first communication mode. When the signal quality of the first terminal and the second terminal is worse than the signal quality threshold, based on the distance between the first terminal and the second terminal, it is determined to switch to a second communication mode whose communication distance can cover the current distance.
[0070] For example, the electronic device can also set a signal quality threshold and a distance threshold at the same time, and determine whether the first terminal and the second terminal maintain communication in the first communication mode or switch to the second communication mode based on the relationship between the signal quality of the first terminal and the signal quality threshold and the relationship between the distance between the first terminal and the second terminal and the distance threshold.
[0071] For example, electronic devices can dynamically adjust the distance and signal quality thresholds based on environmental changes (such as indoor, outdoor, urban, rural, etc.) and terminal type (such as smartphones, tablets, IoT devices, etc.). When the detected change in distance or signal quality reaches or exceeds the dynamic threshold, it switches to a second communication method. Specifically, when two terminals move from indoors to outdoors and the distance increases, they may switch from WiFi communication to 4G / 5G communication to maintain communication stability.
[0072] For example, electronic devices can formulate different communication strategies based on application scenarios and user needs. For instance, for applications with high real-time requirements (such as video conferencing), communication quality and stability are prioritized; for applications with low power requirements (such as sending / receiving messages), energy saving and cost are prioritized. Based on the communication strategy, the distance and signal quality between the first and second terminals are comprehensively evaluated, and the communication method suitable for the current scenario and needs is selected based on the evaluation results. For example, in video conferencing, if the current WiFi signal quality is unstable, it may switch to 4G / 5G to ensure communication quality; while in IoT devices, if the distance is short and the signal quality is good, low-power communication methods such as Bluetooth or Zigbee may be selected.
[0073] For example, electronic devices can also directly determine whether the first terminal and the second terminal maintain communication in the first communication mode or switch to the second communication mode based on the distance and signal quality between the first terminal and the second terminal, using a preset communication mode calculation method or a trained communication mode determination model.
[0074] In this embodiment of the disclosure, it should be noted that communication between the first terminal and the second terminal includes data transmission between the first terminal and the second terminal. The transmitted data includes various types of data such as files, pictures, videos, and audio. This embodiment of the disclosure does not limit the data types transmitted during communication.
[0075] In some embodiments, the first communication method is an indirect communication method, and the second communication method is a direct communication method.
[0076] In this embodiment of the disclosure, it should be noted that indirect communication refers to communication (such as message sending and receiving) between the first terminal and the second terminal through an intermediate entity (such as a base station, router, etc.). This communication method does not require a direct communication link between the first terminal and the second terminal. Indirect communication methods may include cellular communication methods, Wi-Fi communication using a router, etc. Direct communication, also known as point-to-point communication, refers to communication between the first terminal and the second terminal through a direct connection without going through an intermediate device or entity. Direct communication methods may include Bluetooth communication methods, Wi-Fi direct communication methods, etc. The communication distance of direct communication methods is generally shorter than that of indirect communication methods.
[0077] It should be noted that since direct communication does not require intermediate devices such as base stations or routers, as long as the distance between the first terminal and the second terminal is within the communication distance corresponding to the direct communication method, communication can be carried out using the direct communication method regardless of the location of the first terminal and / or the second terminal. For example, if the first terminal and / or the second terminal are located in some enclosed or signal-impenetrable environments, such as basements or elevators, making it impossible for the first terminal and the second terminal to communicate based on indirect communication, communication can still be carried out using the direct communication method as long as the distance between the first terminal and the second terminal is within the communication distance corresponding to the direct communication method.
[0078] In other embodiments, the first communication method and the second communication method can both be indirect communication methods, or both can be direct communication methods. However, the communication distances of the first communication method and the second communication method are different. The electronic device determines whether to maintain communication in the first communication method or switch to the second communication method based on the distance and signal quality between the first terminal and the second terminal, according to the aforementioned method.
[0079] In this embodiment, the electronic device determines the distance between the first terminal and the second terminal that has established a communication connection based on the first communication method, as well as the signal quality between the first terminal and the second terminal. Based on the distance and signal quality between the first terminal and the second terminal, it determines whether the first terminal and the second terminal should maintain communication in the first communication method or switch to the second communication method. By determining the distance and signal quality between the first terminal and the second terminal, the accuracy of assessing the current communication environment of the first terminal and the second terminal can be improved. Based on the assessed communication environment, it determines whether the first terminal and the second terminal should maintain communication in the first communication method or switch to the second communication method, dynamically adjusting the communication method, reducing the possibility of communication interruption due to communication environment problems, improving the stability and reliability of communication between the first terminal and the second terminal, and exhibiting high intelligence.
[0080] In some embodiments, the communication distance supported by the first communication method is greater than the communication distance supported by the second communication method. The step of determining whether the first terminal and the second terminal should maintain communication using the first communication method or switch to the second communication method based on the distance between the first terminal and the second terminal and the signal quality includes:
[0081] In response to the distance between the first terminal and the second terminal being greater than or equal to a preset distance threshold, it is determined that the first terminal and the second terminal maintain communication in the first communication method;
[0082] In response to the distance between the first terminal and the second terminal being less than the preset distance threshold, based on the signal quality of the first terminal and the second terminal communicating in the first communication mode, it is determined whether to maintain communication in the first communication mode or switch to communication in the second communication mode.
[0083] In this embodiment, the communication distance supported by the first communication method is greater than that supported by the second communication method. As mentioned above, the communication distance of the indirect communication method is greater than that of the direct communication method. Therefore, in some embodiments, the first communication method can be an indirect communication method, and the second communication method can be a direct communication method. In other embodiments, both the first and second communication methods can be either indirect or direct communication methods, with different communication distances for each method. For example, when both the first and second communication methods are indirect, the first communication method can be 4G, and the second communication method can be 2G, etc.; when both the first and second communication methods are direct communication methods, the first communication method can be a Wi-Fi direct communication method, and the second communication method can be a Bluetooth communication method, etc. It should be noted that the communication distance of the Wi-Fi direct communication method is typically 100-200 meters, and the communication distance of the Bluetooth communication method is typically 50-100 meters.
[0084] In this embodiment of the present disclosure, the electronic device determines that the first terminal and the second terminal maintain communication in a first communication mode in response to the distance between the first terminal and the second terminal being greater than or equal to a preset distance threshold. The electronic device may preset the distance threshold, which may be associated with the communication distance of the second communication mode. For example, the distance threshold may be set as the maximum communication distance of the second communication mode. When the distance between the first terminal and the second terminal is greater than or equal to the preset distance threshold, it indicates that the first terminal and the second terminal cannot connect to the second communication mode, and it is determined that the first terminal and the second terminal maintain communication in the first communication mode.
[0085] In this embodiment of the disclosure, the electronic device responds to the distance between the first terminal and the second terminal being less than a preset distance threshold, and determines whether to maintain communication in the first communication mode or switch to communication in the second communication mode based on the signal quality of the communication between the first terminal and the second terminal in the first communication mode. The method for determining the signal quality of the communication between the first terminal and the second terminal in the first communication mode is as described above.
[0086] In this embodiment of the disclosure, as described above, the electronic device may set a signal quality threshold and determine whether to maintain communication in a first communication mode or switch to a second communication mode based on the relationship between the signal quality and the signal quality threshold. For example, when the signal quality is better than or equal to the signal quality threshold, it is determined to maintain communication in the first communication mode; when the signal quality is worse than the signal quality threshold, it is determined to switch to the second communication mode.
[0087] In this embodiment of the disclosure, since the communication distance of the first communication method is greater than that of the second communication method, the relationship between the distance between the first terminal and the second terminal and the preset distance threshold is compared first, and then the communication method is further determined based on the comparison result. This can improve the accuracy of the determined communication method, thereby improving the stability of the communication between the first terminal and the second terminal and making it more intelligent.
[0088] In some embodiments, the signal quality includes signal strength, and determining whether to maintain communication in the first communication mode or switch to the second communication mode based on the signal quality of the communication between the first terminal and the second terminal using the first communication mode includes:
[0089] In response to the signal strength of the first communication method being less than a first preset signal strength threshold, it is determined to switch to the second communication method.
[0090] In response to the signal strength of the first communication method being greater than or equal to the first preset signal strength threshold, based on the signal strength of the first communication method, it is determined whether to maintain communication using the first communication method or switch to communication using the second communication method.
[0091] In this embodiment of the present disclosure, the electronic device determines to switch to the second communication mode in response to the signal strength of the first communication mode being less than the first preset signal strength threshold. The method for determining the signal strength of the first communication mode can be as described above, and the first preset signal strength threshold can be a set value, such as setting the first preset signal strength threshold to 0. When the signal strength of the first communication mode is less than the first preset signal strength threshold, it indicates that the signal strength of the first communication mode is weak, the first communication mode is in a state of network disconnection or about to be disconnected, and the first terminal and the second terminal can no longer communicate normally using the first communication mode, resulting in poor communication quality.
[0092] In this embodiment of the present disclosure, the signal strength of the first communication method is relatively weak. However, since the distance between the first terminal and the second terminal is less than a preset distance threshold, the communication can be switched to the second communication method with a shorter communication distance.
[0093] In this embodiment of the disclosure, the electronic device, in response to a signal strength of a first communication method being greater than or equal to a first preset signal strength threshold, determines whether to maintain communication using the first communication method or switch to a second communication method based on the signal strength of the first communication method. A signal strength of the first communication method greater than or equal to the first preset signal strength threshold indicates that the first terminal and the second terminal can transmit data through the first communication method, but the quality of the transmitted data varies with the signal strength.
[0094] In some embodiments, the electronic device may set an evaluation standard and a stability threshold for signal strength stability, such as the standard deviation or coefficient of variation of signal strength over a period of time, and monitor the signal strength of the first communication method in real time, calculate its stability index, and determine whether to maintain communication in the first communication method or switch to the second communication method based on the comparison result of the stability index and the stability threshold.
[0095] In other embodiments, if the signal strength of the first communication method is very high and far exceeds the first preset signal strength threshold, indicating that the current communication link quality is very good, but may be accompanied by high power consumption, the electronic device can set a power efficiency ratio comparison standard, consider factors such as communication quality, power consumption and possible bandwidth requirements, and monitor the signal strength of the first communication method in real time, calculate the power efficiency ratio of the current communication link, and determine whether to maintain communication in the first communication method or switch to the second communication method based on the power efficiency ratio and efficiency ratio threshold of the current communication link.
[0096] In other embodiments, a second preset signal strength threshold greater than the first preset signal strength threshold may be set, and based on the signal strength and the second preset signal strength threshold, it may be determined whether to maintain communication in the first communication mode or switch to the second communication mode.
[0097] In this embodiment, when the distance between the first terminal and the second terminal is less than a preset distance threshold, the electronic device determines whether to maintain communication in the first communication mode or switch to the second communication mode based on the signal strength of the first communication mode. This can further improve the stability and quality of communication between the first terminal and the second terminal, and demonstrates high intelligence.
[0098] In some embodiments, the method further includes:
[0099] In response to the distance between the first terminal and the second terminal being less than the preset distance threshold, if a communication connection has been established based on the first communication method, a communication connection between the first terminal and the second terminal is established based on the second communication method.
[0100] The step of determining whether to maintain communication using the first communication method or switch to the second communication method based on the signal strength of the first communication method includes:
[0101] In response to the signal strength of the first communication method being greater than a second preset signal strength threshold, it is determined to maintain communication using the first communication method; wherein the second preset signal strength threshold is greater than the first preset signal strength threshold;
[0102] In response to the signal strength of the first communication method being between the first preset signal strength threshold and the second preset signal strength threshold, the transmission quality of the first terminal and the second terminal transmitting the same data packets based on the first communication method and the second communication method, respectively, is compared, and based on the comparison result of the transmission quality, it is determined whether to maintain communication in the first communication method or switch to communication in the second communication method.
[0103] In this embodiment of the disclosure, when the distance between the first terminal and the second terminal is less than a preset distance threshold, the electronic device establishes a communication connection between the first terminal and the second terminal based on the second communication method when a communication connection has been established based on the first communication method. It should be noted that at this time, only the connection state of the first communication method and the second communication method is maintained, and communication is not performed based on the first communication method and / or the second communication method. The communication method used for the first terminal and the second terminal is determined based on the distance between the first terminal and the second terminal and the signal quality (such as signal strength) of the first communication method.
[0104] In this embodiment of the disclosure, the electronic device determines to maintain communication in the first communication method in response to the signal strength of the first communication method being greater than the second preset signal strength threshold; wherein, the second preset signal strength threshold is greater than the first preset signal strength threshold; when the signal strength of the first communication method is greater than the second preset signal strength threshold, it indicates that the signal strength of the first communication method is stronger, the stability of the communication between the first terminal and the second terminal in the first communication method is stronger, and the communication quality is higher.
[0105] In this embodiment of the disclosure, the electronic device responds to the signal strength of the first communication mode being between a first preset signal strength threshold and a second preset signal strength threshold, compares the transmission quality of the first terminal and the second terminal transmitting the same data packets based on the first communication mode and the second communication mode, respectively, and determines whether to maintain communication in the first communication mode or switch to communication in the second communication mode based on the comparison result of the transmission quality.
[0106] Determining whether to maintain communication in the first communication mode or switch to the second communication mode based on the comparison results of transmission quality includes:
[0107] In response to the fact that the transmission quality of the same data packet transmitted in the first communication method is better than or equal to the transmission quality of the same data packet transmitted in the second communication method, it is determined to maintain communication in the first communication method;
[0108] In response to the fact that the transmission quality of the same data packet transmitted in the first communication method is inferior to the transmission quality of the same data packet transmitted in the second communication method, a decision is made to switch to the second communication method.
[0109] In this embodiment of the disclosure, the electronic device can determine the transmission quality by determining the bit error rate, frame error rate, packet loss rate, transmission delay, etc., when transmitting the same data packets.
[0110] In this embodiment of the present disclosure, the electronic device determines to maintain communication in the first communication mode in response to the fact that the transmission quality of the same data packet transmitted in the first communication mode is better than or equal to the transmission quality of the same data packet transmitted in the second communication mode; and determines to switch to communication in the second communication mode in response to the fact that the transmission quality of the same data packet transmitted in the first communication mode is worse than the transmission quality of the same data packet transmitted in the second communication mode.
[0111] In this embodiment of the disclosure, based on the transmission quality of the first terminal and the second terminal transmitting the same data packets according to the first communication method and the second communication method respectively, and based on the comparison result of the transmission quality, it is determined whether to maintain communication in the first communication method or switch to the second communication method, which can further improve the accuracy of determining whether to switch the communication method and has a high degree of intelligence.
[0112] In some embodiments, the method further includes:
[0113] Based on the distance between the first terminal and the second terminal and the signal quality, it is determined to switch to the second communication mode while maintaining the connection status of the first communication mode.
[0114] When switching to the second communication method, the signal quality of the maintained first communication method is detected, and based on the signal quality of the first communication method, it is determined whether to maintain communication in the second communication method or switch to the first communication method.
[0115] In this embodiment of the disclosure, the electronic device determines to switch to the second communication mode based on the distance between the first terminal and the second terminal and the signal quality, while maintaining the connection state of the first communication mode. At this time, the first terminal and the second terminal communicate based on the second communication mode, while only maintaining the connection relationship of the first communication mode.
[0116] In this embodiment of the present disclosure, when an electronic device switches to a second communication mode, it detects the signal quality of the maintained first communication mode and determines whether to maintain communication in the second communication mode or switch back to the first communication mode based on the signal quality of the first communication mode. The method for detecting the signal quality of the first communication mode can be as described above, where a signal quality threshold can be preset, and the relationship between the signal quality of the first communication mode and the signal quality threshold is used to determine whether to maintain communication in the second communication mode or switch back to the first communication mode. For example, if the signal quality is better than or equal to the first signal quality threshold, communication can be switched to the first communication mode. If the signal quality is worse than the first signal quality threshold but better than or equal to the second signal quality threshold, the transmission quality of the same data packets transmitted by the first terminal and the second terminal under the first and second communication modes is compared, and the comparison result determines whether to maintain communication in the second communication mode or switch back to the first communication mode. If the signal quality is worse than the second signal quality threshold, communication is maintained in the second communication mode.
[0117] In this embodiment of the present disclosure, when switching to the second communication method for communication, the signal quality of the first communication method is still detected, and the communication method for the first terminal to communicate with the second terminal is determined based on the signal quality of the first communication method, which has a high degree of intelligence.
[0118] Figure 3 This is a schematic diagram illustrating a communication method according to an exemplary embodiment, wherein L33 is a terminal device, and L34 is another terminal device other than terminal device L33, such as... Figure 3 As shown in (a), when both terminal devices L33 and L34 are within the coverage area L32 of base station L31, terminal devices L33 and L34 communicate based on base station L31. This communication method is the first communication method. For example, when terminal device L33 sends data to terminal device L34, terminal device L33 can first send the data to base station L31, and base station L31 will then send the received data to terminal device L34. If at least one of the communicating terminal devices is not within the coverage area of the base station, the signal quality of the first communication method is lower. Figure 3 As shown in (b), when terminal device L33 moves outside the coverage area L32 of base station L31, terminal device L33 and terminal device L34 cannot communicate based on base station L31. At this time, terminal device L33 and terminal device L34 will switch to the second communication mode to communicate. Figure 3 The first communication method is indirect communication, and the second communication method is direct communication.
[0119] Figure 4This is a flowchart illustrating a communication method according to an exemplary embodiment, such as... Figure 4 As shown, it includes the following steps:
[0120] S41, Initiate a call.
[0121] In this embodiment of the disclosure, the communication service between the first terminal and the second terminal is a call, and the transmitted data packets are audio data packets. Initiating a call indicates that the first terminal and the second terminal have started communicating.
[0122] S42, Communication mode 1 connection successful.
[0123] In this embodiment of the disclosure, communication method 1 is used as an example for explanation. Communication method 1 can be an indirect communication method, and the first terminal and the second terminal establish a communication connection based on communication method 1.
[0124] S43. Can communication mode 2 be connected? If yes, proceed to step S45; if no, proceed to step S44.
[0125] In this embodiment of the disclosure, communication mode 2 is used as an example for explanation. It is determined whether communication mode 2 can be connected. Connecting communication mode 2 means that the first terminal and the second terminal establish a communication connection based on communication mode 2. Determining whether communication mode 2 can be connected means determining the distance between the first terminal and the second terminal. If the distance is within a preset distance threshold, communication mode 2 can be connected, and step S45 is executed; if the distance is greater than the preset distance threshold, communication mode 2 cannot be connected, and step S44 is executed.
[0126] S44, Maintain communication mode 1.
[0127] In this embodiment of the disclosure, the first terminal and the second terminal communicate using a first communication method.
[0128] S45, Communication method 1+2.
[0129] In this embodiment of the disclosure, the first terminal and the second terminal simultaneously maintain the connection state of communication mode 1 and communication mode 2. Based on the signal quality of communication mode 1 and / or the transmission quality of the same data packets transmitted by the first terminal and the second terminal respectively based on communication mode 1 and communication mode 2, the communication mode for communication between the first terminal and the second terminal is determined.
[0130] S46. If communication mode 1 is disconnected, proceed to step S47; otherwise, return to step S45.
[0131] In this embodiment of the disclosure, it is determined whether communication mode 1 is disconnected from the network. This can be determined based on the signal quality of communication mode 1. If the signal strength of communication mode 1 is less than the aforementioned first preset signal strength threshold, it indicates that communication mode 1 is disconnected from the network. If communication mode 1 is disconnected from the network, then step S47 is executed; if communication mode 1 is not disconnected from the network, then the process returns to step S45.
[0132] S47, Communication Method 2.
[0133] In this embodiment of the disclosure, the first terminal and the second terminal communicate based on communication method 2.
[0134] S48. Can communication mode 2 be maintained? If yes, proceed to step S49; if no, proceed to step S50.
[0135] In this embodiment of the disclosure, the connection status of communication mode 2 is determined, that is, the distance between the first terminal and the second terminal is determined. If the distance between the first terminal and the second terminal is greater than the communication distance of communication mode 2, then step S50 is executed; if the distance between the first terminal and the second terminal is less than or equal to the communication distance of communication mode 2, then step S49 is executed.
[0136] S49. Can the connection communication mode 1 be restored? If yes, proceed to step S45; otherwise, proceed to step S47.
[0137] In this embodiment of the disclosure, the signal quality of communication method 1 is detected, and based on the signal quality of communication method 1, it is determined whether communication method 1 is still in a disconnected state. If it is still in a disconnected state, the connection to communication method 1 cannot be restored, and step S47 is executed; if it is not in a disconnected state, the connection to communication method 1 can be established, and step S45 is executed.
[0138] S50, End Call.
[0139] In this embodiment of the disclosure, if neither communication method 1 nor communication method 2 can be connected, then the communication between the first terminal and the second terminal is disconnected.
[0140] Figure 5 This is a block diagram of a communication device 500 according to an exemplary embodiment, such as... Figure 5 As shown, the device mainly includes:
[0141] The first determining module 501 is configured to determine the distance between the first terminal and the second terminal with which a communication connection has been established, and the signal quality between the first terminal and the second terminal; wherein the first terminal and the second terminal have established the communication connection based on a first communication method;
[0142] The second determining module 502 is configured to determine, based on the distance between the first terminal and the second terminal and the signal quality, whether the first terminal and the second terminal maintain communication in the first communication mode or switch to communication in the second communication mode.
[0143] In some embodiments, if the communication distance supported by the first communication method is greater than the communication distance supported by the second communication method, the second determining module 502 is further configured to determine that the first terminal and the second terminal maintain communication using the first communication method in response to the distance between the first terminal and the second terminal being greater than or equal to a preset distance threshold; and to determine whether to maintain communication using the first communication method or switch to communication using the second communication method based on the signal quality of the communication between the first terminal and the second terminal using the first communication method in response to the distance between the first terminal and the second terminal being less than the preset distance threshold.
[0144] In some embodiments, the signal quality includes signal strength. The second determining module 502 is further configured to determine to switch to the second communication mode in response to the signal strength of the first communication mode being less than a first preset signal strength threshold; and to determine to maintain communication in the first communication mode or switch to the second communication mode in response to the signal strength of the first communication mode being greater than or equal to the first preset signal strength threshold.
[0145] In some embodiments, the apparatus further includes:
[0146] The module is configured to, in response to a distance between the first terminal and the second terminal being less than a preset distance threshold, establish a communication connection between the first terminal and the second terminal based on the second communication method, provided that a communication connection has been established based on the first communication method.
[0147] The second determining module 502 is further configured to determine to maintain communication using the first communication method in response to the signal strength of the first communication method being greater than a second preset signal strength threshold; wherein the second preset signal strength threshold is greater than the first preset signal strength threshold; and in response to the signal strength of the first communication method being between the first preset signal strength threshold and the second preset signal strength threshold, to compare the transmission quality of the first terminal and the second terminal transmitting the same data packets based on the first communication method and the second communication method, respectively, and to determine whether to maintain communication using the first communication method or switch to communication using the second communication method based on the comparison result of the transmission quality.
[0148] In some embodiments, the second determining module 502 is further configured to determine to maintain communication in the first communication mode in response to the transmission quality of transmitting the same data packet in the first communication mode being better than or equal to the transmission quality of transmitting the same data packet in the second communication mode; and to determine to switch to communication in the second communication mode in response to the transmission quality of transmitting the same data packet in the first communication mode being worse than the transmission quality of transmitting the same data packet in the second communication mode.
[0149] In some embodiments, the apparatus further includes:
[0150] The maintenance module is configured to, in response to determining to switch to the second communication mode based on the distance between the first terminal and the second terminal and the signal quality, maintain the connection state of the first communication mode;
[0151] The third determining module is configured to detect the signal quality of the maintained first communication method when switching to the second communication method, and determine whether to maintain communication in the second communication method or switch to the first communication method based on the signal quality of the first communication method.
[0152] In some embodiments, the first communication method is an indirect communication method, and the second communication method is a direct communication method.
[0153] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0154] Figure 6 This is a structural block diagram of an electronic device 600 according to an exemplary embodiment. For example, the electronic device 600 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, or other terminal device. The electronic device 600 may also be a cloud device such as a server capable of simultaneously connecting to the aforementioned first terminal and second terminal. In this respect, the embodiments disclosed herein do not impose any limitations.
[0155] Reference Figure 6 The electronic device 600 may include one or more of the following components: processing component 602, memory 604, power supply component 606, multimedia component 608, audio component 610, input / output (I / O) interface 612, sensor component 614, and communication component 616.
[0156] Processing component 602 typically controls the overall operation of electronic device 600, such as operations associated with at least one of display, telephone call, data communication, camera operation, and recording operation. Processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 602 may include one or more modules to facilitate interaction between processing component 602 and other components. For example, processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602.
[0157] Memory 604 is configured to store various types of data to support operation on electronic device 600. Examples of such data include at least one of the following: instructions for any application or method operating on electronic device 600, contact data, phonebook data, messages, pictures, and videos. Memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0158] Power supply component 606 provides power to various components of electronic device 600. Power supply component 606 may include at least one of the following: a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 600.
[0159] Multimedia component 608 includes a screen that provides an output interface between electronic device 600 and user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen may be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 608 includes a front-facing camera and / or a rear-facing camera. When electronic device 600 is in an operating mode, such as a shooting mode or video mode, the front-facing camera and / or rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0160] Audio component 610 is configured to output and / or input audio signals. For example, audio component 610 includes a microphone (MIC) configured to receive external audio signals when electronic device 600 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 604 or transmitted via communication component 616. In some embodiments, audio component 610 also includes a speaker for outputting audio signals.
[0161] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, and buttons. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0162] Sensor assembly 614 includes one or more sensors for providing state assessments of various aspects of electronic device 600. For example, sensor assembly 614 may detect the on / off state of electronic device 600, the relative positioning of components such as the display and keypad of electronic device 600, changes in position of electronic device 600 or one of its components, the presence or absence of user contact with electronic device 600, orientation or acceleration / deceleration of electronic device 600, and temperature changes of electronic device 600. Sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 614 may also include an optical sensor, such as a complementary metal-oxide-semiconductor (CMOS) or charge-coupled device (CCD) image sensor, for use in imaging applications. In some embodiments, sensor assembly 614 may also include, but is not limited to, at least one of the following: an accelerometer, a gyroscope, a magnetometer, a pressure sensor, and a temperature sensor.
[0163] Communication component 616 is configured to facilitate wired or wireless communication between electronic device 600 and other devices. Electronic device 600 can access wireless networks based on communication standards, such as Wi-Fi, 4G, 5G, or combinations thereof. In one exemplary embodiment, communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 616 also includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID), Infrared Data Association (IrDA), Ultra Wide Band (UWB), Bluetooth (BT), and other technologies.
[0164] In an exemplary embodiment, the electronic device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.
[0165] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including executable instructions or a computer program, which can be executed by a processor 620 of an electronic device 600 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0166] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform any of the communication methods described in the embodiments of this disclosure. For example, the method includes:
[0167] Determine the distance between the first terminal and the second terminal with which a communication connection has been established, as well as the signal quality between the first terminal and the second terminal; wherein the first terminal and the second terminal have established the communication connection based on a first communication method;
[0168] Based on the distance between the first terminal and the second terminal and the signal quality, it is determined whether the first terminal and the second terminal maintain communication in the first communication mode or switch to the second communication mode.
[0169] This disclosure provides a computer program product comprising a computer program or executable instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program or executable instructions from the computer-readable storage medium and executes the computer program or executable instructions, causing the computer device to perform any of the communication methods described in this disclosure.
[0170] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0171] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A communication method, characterized in that, The method includes: Determine the distance between the first terminal and the second terminal with which a communication connection has been established, as well as the signal quality between the first terminal and the second terminal; wherein the first terminal and the second terminal have established the communication connection based on a first communication method; Based on the distance between the first terminal and the second terminal and the signal quality, it is determined whether the first terminal and the second terminal maintain communication in the first communication mode or switch to the second communication mode.
2. The method according to claim 1, characterized in that, The communication distance supported by the first communication method is greater than the communication distance supported by the second communication method. The step of determining whether the first terminal and the second terminal should maintain communication using the first communication method or switch to the second communication method based on the distance between the first terminal and the second terminal and the signal quality includes: In response to the distance between the first terminal and the second terminal being greater than or equal to a preset distance threshold, it is determined that the first terminal and the second terminal maintain communication in the first communication method; In response to the distance between the first terminal and the second terminal being less than the preset distance threshold, based on the signal quality of the first terminal and the second terminal communicating in the first communication mode, it is determined whether to maintain communication in the first communication mode or switch to communication in the second communication mode.
3. The method according to claim 2, characterized in that, The signal quality includes signal strength. The step of determining whether to maintain communication using the first communication method or switch to the second communication method based on the signal quality of the communication between the first terminal and the second terminal using the first communication method includes: In response to the signal strength of the first communication method being less than a first preset signal strength threshold, it is determined to switch to the second communication method. In response to the signal strength of the first communication method being greater than or equal to the first preset signal strength threshold, based on the signal strength of the first communication method, it is determined whether to maintain communication using the first communication method or switch to communication using the second communication method.
4. The method according to claim 3, characterized in that, The method further includes: In response to the distance between the first terminal and the second terminal being less than the preset distance threshold, if a communication connection has been established based on the first communication method, a communication connection between the first terminal and the second terminal is established based on the second communication method. The step of determining whether to maintain communication using the first communication method or switch to the second communication method based on the signal strength of the first communication method includes: In response to the signal strength of the first communication method being greater than a second preset signal strength threshold, it is determined to maintain communication using the first communication method; wherein the second preset signal strength threshold is greater than the first preset signal strength threshold; In response to the signal strength of the first communication method being between the first preset signal strength threshold and the second preset signal strength threshold, the transmission quality of the first terminal and the second terminal transmitting the same data packets based on the first communication method and the second communication method, respectively, is compared, and based on the comparison result of the transmission quality, it is determined whether to maintain communication in the first communication method or switch to communication in the second communication method.
5. The method according to claim 4, characterized in that, The determination based on the comparison results of transmission quality to maintain communication in the first communication mode or switch to the second communication mode includes: In response to the fact that the transmission quality of the same data packet transmitted in the first communication method is better than or equal to the transmission quality of the same data packet transmitted in the second communication method, it is determined to maintain communication in the first communication method; In response to the fact that the transmission quality of the same data packet transmitted in the first communication method is inferior to the transmission quality of the same data packet transmitted in the second communication method, a decision is made to switch to the second communication method.
6. The method according to any one of claims 1-5, characterized in that, The method further includes: Based on the distance between the first terminal and the second terminal and the signal quality, it is determined to switch to the second communication mode while maintaining the connection status of the first communication mode. When switching to the second communication method, the signal quality of the maintained first communication method is detected, and based on the signal quality of the first communication method, it is determined whether to maintain communication in the second communication method or switch to the first communication method.
7. The method according to any one of claims 1-5, characterized in that, The first communication method is an indirect communication method, and the second communication method is a direct communication method.
8. A communication device, characterized in that, The device includes: The first determining module is configured to determine the distance between the first terminal and the second terminal with which a communication connection has been established, and the signal quality between the first terminal and the second terminal; wherein the first terminal and the second terminal have established the communication connection based on a first communication method; The second determining module is configured to determine, based on the distance between the first terminal and the second terminal and the signal quality, whether the first terminal and the second terminal maintain communication in the first communication mode or switch to communication in the second communication mode.
9. An electronic device, characterized in that, include: processor; Memory used to store computer programs or instructions; The processor executes the computer program or instructions to implement the steps of the communication method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing a computer program or instructions, characterized in that, When the computer program or instructions in the storage medium are executed by a processor, the steps of the communication method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the steps of the communication method according to any one of claims 1 to 7.