Method for dynamically connecting equipment and electronic equipment
By disconnecting the physical layer connection in the electronic device without notifying the application layer and re-establishing the wireless connection, the problem of the upper limit of the number of electronic device connections is solved, and user experience and business continuity is improved.
Patent Information
- Application Number
- CN202310648826.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-02
- Publication Date
- 2024-12-03
AI Technical Summary
When the number of wireless connections reaches the upper limit, existing electronic devices cannot continue to connect to new devices or disconnect existing connections to connect to new devices, resulting in a degradation of user experience.
By receiving wireless connection requests, disconnect the physical layer of the target electronic device without notifying the application layer, re-establish the wireless connection with the new device, and restore the original connection after a preset time period to avoid long-term disconnection affecting services.
It enables the establishment of connections with new devices when the number of wireless connections reaches the upper limit, maintaining user experience, and avoiding business interruptions and data loss.
Smart Images

Figure CN119071938A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of electronic technology, and more specifically, to a method for dynamically connecting devices and an electronic device. Background Art
[0002] Currently, users have more and more electronic devices, and there are often scenarios where one electronic device needs to connect to multiple other devices. However, there is a limit to the number of other electronic devices that an electronic device can connect to at the same time. When the number of other electronic devices that an electronic device can connect to at the same time reaches the upper limit, if a new target electronic device needs to be connected, it may be impossible to connect; or, the electronic device disconnects from a target electronic device and then connects to a new electronic device. In this case, the service of the target electronic device cannot be carried out. In either case, the user experience will be reduced. Summary of the invention
[0003] The embodiments of the present application provide a method and an electronic device for dynamically connecting devices, so that when the number of electronic devices wirelessly connected to the electronic device reaches an upper limit, it is still possible to wirelessly connect to other electronic devices and exchange data, and the services of the original electronic devices are basically unaffected.
[0004] In a first aspect, a method for dynamically connecting devices is provided, the method being applied to a first electronic device, the first electronic device being wirelessly connected to a plurality of electronic devices, the method comprising: receiving a wireless connection request from a second electronic device, the wireless connection request being used to request establishment of a wireless connection with the first electronic device; disconnecting a physical layer connection with a first target electronic device according to the wireless connection request, without the first electronic device sending a message of physical layer connection disconnection to an application layer; and establishing a wireless connection with the second electronic device.
[0005] Exemplarily, the number of the first target electronic devices may be one or more.
[0006] Based on the embodiments of the present application, a first electronic device can be in a wireless connection state with multiple electronic devices. When the first electronic device receives a wireless connection request from a second electronic device, it can disconnect the physical layer connection with the first target electronic device according to the wireless connection request, and the first electronic device does not send a message of physical layer connection disconnection to the application layer, so that the application layer of the first electronic device is unaware of the state of physical layer connection disconnection; thereafter, the first electronic device establishes a wireless connection with the second electronic device.
[0007] In this way, when the number of other electronic devices wirelessly connected to the first electronic device reaches the upper limit, the first electronic device can still establish a wireless connection with the second electronic device. In addition, since the application layer of the first electronic device does not perceive the disconnection of the physical layer connection between the first electronic device and the first target electronic device, the user can believe that the first electronic device and the first target electronic device are still in a normal connection state, which brings a good experience to the user.
[0008] In combination with the first aspect, in an implementation of the first aspect, the method also includes: after establishing a wireless connection with the second electronic device, switching the second target electronic device that disconnects the physical layer connection with the first electronic device according to time, and the first electronic device does not send a message of physical layer connection disconnection to the application layer.
[0009] Based on the embodiment of the present application, after the first electronic device establishes a wireless connection with the second electronic device, the second target electronic device that is physically disconnected from the first electronic device can be switched according to time, and the first electronic device does not send a message of physical layer connection disconnection to the application layer, so that the second target electronic device that is physically disconnected can be switched, thereby avoiding disconnection of the physical layer connection of a certain electronic device for a long time, thereby affecting its business.
[0010] In combination with the first aspect, in an implementation of the first aspect, disconnecting the physical layer connection with the first target electronic device according to the wireless connection request includes: determining the first target electronic device whose physical layer connection needs to be disconnected from the multiple electronic devices; and disconnecting the physical layer connection with the first target electronic device.
[0011] Based on the embodiment of the present application, the first electronic device can first determine a first target electronic device whose physical layer connection needs to be disconnected from multiple connected electronic devices, and disconnect the physical layer connection with the first target electronic device.
[0012] In combination with the first aspect, in an implementation of the first aspect, the second target electronic device that is physically disconnected from the first electronic device is switched according to time, comprising: after a first preset time period, the first electronic device determines the second target electronic device that needs to be physically disconnected from the connected electronic devices; disconnects the physical layer connection with the second target electronic device, and the first electronic device does not send a message of physical layer connection disconnection to the application layer, and restores the physical layer connection with the first target electronic device, wherein the duration for which the first electronic device and the second target electronic device remain physically disconnected is a second preset time period.
[0013] Based on the embodiment of the present application, after the first electronic device is disconnected from the first target electronic device for the first preset time, it can determine the second target electronic device that needs to disconnect the physical layer connection from the connected electronic devices, disconnect the physical layer connection with the second target electronic device, and restore the physical layer connection with the first target electronic device. Thus, the first target electronic device can restore the physical layer connection with the first electronic device after the first preset time, so that the service of the first target electronic device can be basically unaffected.
[0014] In combination with the first aspect, in an implementation of the first aspect, determining the first target electronic device that needs to disconnect the physical layer connection from the multiple electronic devices includes: determining the first target electronic device based on first information, the first information including at least one of the types of the multiple electronic devices, historical data of communication between the multiple electronic devices and the first electronic device, and priorities of the multiple electronic devices.
[0015] Based on the embodiment of the present application, the first electronic device can determine the first target electronic device that needs to disconnect the physical layer connection according to the first information, so that the service of the disconnected first target electronic device is not affected as much as possible.
[0016] In combination with the first aspect, in an implementation of the first aspect, before disconnecting the physical layer connection with the first target electronic device according to the wireless connection request, the method also includes: sending first disconnection indication information to the first target electronic device, the first disconnection indication information being used to indicate that the first target electronic device is about to disconnect the physical layer connection, and being used to indicate that the first target electronic device does not send a physical layer connection disconnection message to the application layer when the physical layer connection is disconnected.
[0017] Based on the embodiment of the present application, it is possible to facilitate the first target electronic device to determine that the physical layer connection is about to be disconnected according to the first disconnection indication information, and it is necessary not to send a message of physical layer connection disconnection to the application layer when the physical layer connection is disconnected. This is conducive to the first target electronic device distinguishing whether the disconnection with the first electronic device is real or false.
[0018] In combination with the first aspect, in an implementation of the first aspect, the first disconnection indication information also includes a first preset duration, and the first disconnection indication information is also used to indicate that the physical layer connection between the first electronic device and the first target electronic device is restored after the first preset duration.
[0019] Based on the embodiment of the present application, it is helpful for the first target electronic device to determine the duration of disconnection of the physical layer connection and the time of reconnection.
[0020] In combination with the first aspect, in an implementation of the first aspect, the first disconnection indication information is further used to instruct the first target electronic device to cache data sent by the application layer of the first target electronic device to the first electronic device within a first preset time length of disconnecting the physical layer connection; or,
[0021] The first disconnection indication information is further used to instruct the first target electronic device to allocate memory to cache data sent by the application layer of the first target electronic device to the first electronic device within a first preset time period of disconnecting the physical layer connection.
[0022] Based on the embodiments of the present application, it is helpful for the first target electronic device to cache data that needs to be sent to the first electronic device during the period when the physical layer connection is disconnected, thereby avoiding data loss and causing a bad experience for the user.
[0023] In combination with the first aspect, in an implementation of the first aspect, the method further includes: the first electronic device caches data sent by the application layer of the first electronic device to the first target electronic device within a first preset time period of disconnecting the physical layer connection; or
[0024] The first electronic device allocates memory to cache data sent by the application layer of the first electronic device to the first target electronic device within a first preset time period when the physical layer connection is disconnected.
[0025] Based on the embodiments of the present application, the first electronic device can cache data that needs to be sent to the first target electronic device during the period when the physical layer connection is disconnected, thereby avoiding data loss and causing a bad experience for the user.
[0026] In combination with the first aspect, in an implementation manner of the first aspect, the method further includes: sending target data to the first target electronic device, where the target data is data that the first electronic device needs to send to the first target electronic device within the first preset time period.
[0027] Based on the embodiment of the present application, the first electronic device can also send data that is originally required to be sent to the first target electronic device within the first preset time period in advance to the first target electronic device before disconnecting the physical layer connection. Thus, the services of the two can continue during the period when the physical layer connection is disconnected, bringing a good experience to the user.
[0028] In combination with the first aspect, in an implementation manner of the first aspect, the method further includes: receiving a response message sent by the first target electronic device, where the response message is used to indicate that the first target electronic device is ready to disconnect the physical layer connection.
[0029] Based on the embodiment of the present application, it is helpful for the first electronic device to determine that the first target electronic device is ready to disconnect the physical layer connection, so that the first electronic device can disconnect the physical layer connection with the first target electronic device.
[0030] In combination with the first aspect, in an implementation manner of the first aspect, the response message also includes the first preset duration.
[0031] Based on the embodiment of the present application, the response message also includes a first preset duration, which is helpful for the first electronic device to determine the disconnection duration with the first target electronic device. Since the first preset duration is the disconnection duration recommended by the first target electronic device, the service between the first electronic device and the first target electronic device may not be affected during the disconnection duration.
[0032] In a second aspect, an electronic device is provided, comprising: one or more processors; one or more memories; the one or more memories storing one or more computer programs, the one or more computer programs comprising instructions, which, when executed by the one or more processors, enable the method for dynamically connecting devices as described in the first aspect and any possible implementation thereof to be executed.
[0033] According to a third aspect, an apparatus is provided, comprising a module for implementing the method for dynamically connecting devices as described in the first aspect and any possible implementation thereof.
[0034] In a fourth aspect, a chip is provided, comprising a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method for dynamically connecting a device as described in the first to third aspects and any possible implementation thereof is executed.
[0035] In a fifth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the method for dynamically connecting devices as described in the first aspect and any possible implementation thereof is executed.
[0036] In a sixth aspect, a computer program product is provided, the computer program product comprising a computer program code, which, when executed on a computer, enables the method for dynamically connecting devices as described in the first aspect and any possible implementation thereof to be executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0038] Figure 2It is a schematic diagram of the software structure of the electronic device provided in the embodiment of the present application.
[0039] Figure 3 It is a schematic diagram of a scenario to which the embodiments of the present application can be applied.
[0040] Figure 4 It is a schematic diagram of another scenario to which the embodiment of the present application can be applied.
[0041] Figure 5 It is a schematic diagram of a dynamic connection device provided in an embodiment of the present application.
[0042] Figure 6 It is a schematic diagram of wireless communication between electronic devices provided in an embodiment of the present application.
[0043] Figure 7 It is a schematic flowchart of a method for dynamically connecting devices provided in an embodiment of the present application.
[0044] Figure 8 It is a schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0046] The method for dynamically connecting devices in the embodiments of the present application can be applied to electronic devices such as smart phones, smart speakers, smart TVs, tablet computers, laptops, personal computers (PCs), ultra-mobile personal computers (UMPCs), netbooks, vehicle-mounted devices, wearable devices, foldable devices, and Internet of Things (IOT) devices.
[0047] Figure 11 shows a schematic diagram of the structure of the electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0048] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0049] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0050] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0051] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0052] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus interface, etc.
[0053] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL).
[0054] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170.
[0055] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface.
[0056] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160.
[0057] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
[0058] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc.
[0059] The USB interface 130 is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device.
[0060] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0061] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0062] The power management module 141 is used to connect the battery 142 , the charging management module 140 and the processor 110 .
[0063] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0064] The mobile communication module 150 can provide wireless communication solutions including 2G / 3G / 4G / 5G etc. applied on the electronic device 100 .
[0065] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0066] The wireless communication module 160 can provide wireless communication solutions for application in the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), Bluetooth low energy (BLE), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
[0067] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, so that electronic device 100 can communicate with the network and other devices through wireless communication technology.
[0068] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0069] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), or a display panel made of one of the materials such as an organic light-emitting diode (OLED), an active matrix organic light-emitting diode or an active matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed or a quantum dot light-emitting diode (QLED). In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0070] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0071] The ISP is used to process data fed back by the camera 193. The camera 193 is used to capture still images or videos.
[0072] Digital signal processors are used to process digital signals. In addition to processing digital image signals, they can also process other digital signals.
[0073] Video codecs are used to compress or decompress digital video.
[0074] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100 .
[0075] The internal memory 121 may be used to store computer executable program codes, wherein the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121 .
[0076] The electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0077] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals.
[0078] The speaker 170A, also called a "horn", is used to convert audio electrical signals into sound signals.
[0079] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals.
[0080] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals.
[0081] The earphone jack 170D is used to connect a wired earphone.
[0082] Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, an acceleration sensor 180E, a distance sensor 180F, a fingerprint sensor 180H, a touch sensor 180K, a bone conduction sensor 180M, etc.
[0083] Buttons 190 include a power button, a volume button, and the like.
[0084] Motor 191 can generate vibration prompts.
[0085] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0086] The SIM card interface 195 is used to connect a SIM card.
[0087] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes an operating system of a layered architecture as an example to exemplify the software structure of the electronic device 100.
[0088] Figure 2 1 is a software structure diagram of the electronic device 100 of the embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the operating system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the system library, and the kernel layer. The application layer can include a series of application packages.
[0089] like Figure 2 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, wallet, etc.
[0090] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0091] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0092] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0093] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0094] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0095] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
[0096] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0097] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0098] The core library consists of two parts: one part is the function that the Java language needs to call, and the other part is the core library.
[0099] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0100] The system library may include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0101] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0102] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0103] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0104] A 2D graphics engine is a drawing engine for 2D drawings.
[0105] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0106] Currently, users have more and more electronic devices, and there are often scenarios where one electronic device needs to connect to multiple other devices. However, there is a limit to the number of other electronic devices that an electronic device can connect to at the same time. When the number of other electronic devices that an electronic device can connect to at the same time reaches the upper limit, if a new electronic device needs to be connected, it may be impossible to connect; or, the electronic device disconnects from a target electronic device and then connects to a new electronic device. In this case, the service of the target electronic device cannot be carried out. In either case, the user experience will be reduced.
[0107] The number of devices that an electronic device can connect to simultaneously using different wireless protocols is different. For example, an electronic device can connect to a maximum of 7 other electronic devices using Bluetooth, and an electronic device can connect to a maximum of 4 other electronic devices using Wi-Fi peer-to-peer (P2P) technology.
[0108] For example, Figure 3 , Figure 4 Schematic diagram of a scenario to which the present application embodiment can be applied. Figure 3 , 4 As shown, the wireless connection relationship between the electronic device 200a and other electronic devices is taken as an example for explanation.
[0109] See also Figure 3 and Figure 4 , electronic device 200a establishes a connection relationship with electronic devices 200b1, 200b2, 200b3, ..., 200bm via wireless. In some cases, when electronic device 200c needs to establish a wireless connection with electronic device 200a, it sends a request message to electronic device 200a requesting to establish a connection relationship. After receiving the request message, electronic device 200a can disconnect the wireless connection with one of electronic devices 200b1, 200b2, 200b3, ..., 200bm, and establish a wireless connection with electronic device 200c. For example, electronic device 200a disconnects the wireless connection with electronic device 200b3 and establishes a wireless connection with electronic device 200c. At this time, the business between electronic device 200a and electronic device 200b3 will not be able to continue.
[0110] Another possible situation is that after electronic device 200a has established a connection relationship with electronic devices 200b1, 200b2, 200b3, ..., 200bm, if the number of electronic devices wirelessly connected to electronic device 200a has reached an upper limit, electronic device 200a may reject the connection request of electronic device 200c, making it impossible for electronic device 200c to establish a wireless connection with electronic device 200a.
[0111] In view of this, an embodiment of the present application provides a method and electronic device for dynamically connecting devices, so that when the number of electronic devices wirelessly connected to the electronic device reaches an upper limit, it is still possible to wirelessly connect to other electronic devices and interact with data, and the business of the original electronic device is basically unaffected.
[0112] Taking the wireless connection as Bluetooth connection as an example, when the number of electronic devices connected to the electronic device 200a using traditional Bluetooth reaches 7, the electronic device 200a may not be able to receive Bluetooth connection requests from other electronic devices.
[0113] One solution can be found in Figure 3 , the electronic device 200c may send a low-power Bluetooth message to the electronic device 200a, and the low-power Bluetooth message may indicate that the electronic device 200c needs to establish a Bluetooth connection with the electronic device 200a in a traditional Bluetooth manner, so that the electronic device 200a can receive the Bluetooth connection request of the electronic device 200c.
[0114] Optionally, the electronic device 200a may also directly send a Bluetooth message to the electronic device 200c, and the Bluetooth message may indicate that the electronic device 200c needs to establish a Bluetooth connection with the electronic device 200a in a traditional Bluetooth manner.
[0115] Another solution can be found in Figure 4 In addition to establishing a Bluetooth connection with the electronic device 200a, the electronic device 200bm can also establish a connection with the electronic device 200c. When the electronic device 200c needs to connect to the electronic device 200a, the electronic device 200bm can send a connection request to the electronic device 200a. Thus, the electronic device 200a can receive the Bluetooth connection request of the electronic device 200c.
[0116] For example, the electronic device 200c may carry its own MAC address and the MAC address of the electronic device 200a in a connection request, and send the connection request to the electronic device 200bm, which then forwards the connection request to the electronic device 200bm.
[0117] In an embodiment of the present application, when electronic device 200a receives a connection request from electronic device 200c, it can determine a first target electronic device from the connected electronic devices 200b1 to 200bm; and send disconnect indication information to the first target electronic device, which can be used to indicate that the first target electronic device is about to disconnect the physical layer connection with electronic device 200a and requires the application layer of the first target electronic device to be unaware of the disconnection state; thereafter, electronic device 200a can disconnect the physical layer connection with the first target electronic device and establish a connection relationship with electronic device 200c, but the application layers of electronic device 200a and the first target electronic device are unaware of the disconnection state.
[0118] In this way, when the number of electronic devices that the electronic device 200a is simultaneously wirelessly connected to reaches the upper limit, and there is another electronic device 200c that needs to connect to the electronic device 200a, the technical solution can enable the electronic device 200c to smoothly establish a connection relationship with the electronic device 200a and to exchange data normally. In addition, although the electronic device 200a disconnects the physical layer connection with the originally connected electronic device, its application layer cannot perceive the disconnection, so that the user cannot perceive the disconnection, thereby improving the user experience.
[0119] In some optional technical solutions, after the preset time T1, the electronic device 200a determines a second target electronic device from the connected electronic devices, and sends a disconnection indication message to the second target electronic device; thereafter, the electronic device 200a disconnects the physical layer connection with the second target electronic device and restores the physical layer connection with the first target electronic device, and the application layer of the electronic device 200a and the second target electronic device are not aware of the disconnection state. And so on.
[0120] In this way, after the preset time, the electronic device 200a restores the physical layer connection with the previously disconnected first target electronic device, so that the service between the two is basically not affected, thereby improving the user experience.
[0121] For example, Figure 5 It is a schematic diagram of a dynamic connection device provided in an embodiment of the present application.
[0122] According to the wireless protocol, it is assumed that the number of electronic devices that the electronic device 200a can connect to at the same time is m. Figure 5 In (a), the m electronic devices to which the electronic device 200a is wirelessly connected simultaneously are the electronic devices 200b1-bm. At a certain moment, the electronic device 200a receives a wireless connection request from the electronic device 200c.
[0123] It is understandable that, although the wireless protocol stipulates an upper limit on the number of electronic devices that the electronic device 200a can connect to simultaneously, in some cases, the number of electronic devices that the electronic device 200a can connect to simultaneously has not reached the upper limit, and it is very difficult for the electronic device 200a to connect to a new electronic device at this time. This application can also be applied to such scenarios. For example, the Bluetooth protocol stipulates that the electronic device 200a can connect to 7 electronic devices simultaneously using Bluetooth, but in fact, the electronic device 200a may not be able to successfully connect to the fourth electronic device.
[0124] See also Figure 5 In (b), the electronic device 200a may send first disconnection indication information to the first target electronic device that needs to disconnect the physical layer connection. The first disconnection indication information may refer to the description of the disconnection indication information in the foregoing text.
[0125] Optionally, the first disconnection indication information may further include a first duration T1, and indicate that the physical layer connection between the electronic device 200a and the first target electronic device is restored after the first duration T1.
[0126] In one implementation, after the first time duration T1, the electronic device 200a sends a connection request to the first target electronic device to restore the physical layer connection between the two.
[0127] In another implementation, after the first time period T1, the first target electronic device sends a connection request to the electronic device 200a to restore the physical layer connection between the two.
[0128] Optionally, the first disconnection indication information can also be used to indicate that after the first time duration T1, when restoring the physical layer connection between electronic device 200a and the first target electronic device, the first target electronic device needs to reserve sufficient resources so that electronic device 200a and the first target electronic device can restore the physical layer connection.
[0129] For example, the first target electronic device may conduct other services during the first time period T1, or may establish a wireless connection with other electronic devices. Therefore, after the first time period T1, the first target electronic device needs to reserve sufficient resources (for example, suspend other services, etc.) so that the electronic device 200a and the first target electronic device can restore the physical layer connection.
[0130] Optionally, the electronic device 200a may further send a first duration T1 to the first target electronic device, and instruct to restore the physical layer connection between the electronic device 200a and the first target electronic device after the first duration T1.
[0131] The first duration T1 may be determined by the electronic device 200a according to the type of the first target electronic device. For example, if the first target electronic device is a heart rate monitor, and the heart rate monitor reports data to the electronic device 200a once every 60 seconds, the first duration T1 may be less than 60 seconds, for example, the first duration T1 is 30 seconds or 15 seconds. Thus, the service of the first target electronic device may not be affected within the time range of the first duration T1 of disconnecting the physical layer connection.
[0132] In other embodiments, the first target electronic device may also send a response message to the first target electronic device after receiving the first disconnection indication information sent by the electronic device 200a, and the response message may include the first duration T1. At this time, the first duration T1 may be determined by the first target electronic device according to its own business, so as to try to ensure that the time range of the first duration T1 of disconnecting the physical layer connection will not affect the business of the first target electronic device.
[0133] In some cases, within the time range of the physical layer connection being disconnected, the application layer of the electronic device may send some data. For example, when the service type between the electronic device 200a and the first target electronic device is a service in which the first target electronic device needs to send data to the electronic device 200a at intervals. Therefore, in an embodiment of the present application, the first disconnection indication information can also be used to indicate that the first target electronic device caches the data sent by the first target electronic device during the period when the physical layer connection is disconnected; or, the first disconnection indication information can also be used to indicate that the first target electronic device allocates memory for the wireless transmission management module or the wireless module to cache the data sent by the first target electronic device during the period when the physical layer connection is disconnected. For another example, when the service type between the electronic device 200a and the first target electronic device is a service in which the electronic device 200a needs to transmit data to the first target electronic device, the electronic device 200a can allocate memory for the wireless transmission management module or the wireless module when sending the first disconnection indication information to the first target electronic device to cache the data sent by the application layer of the electronic device 200a during the period when the physical layer connection is disconnected.
[0134] In some optional schemes, the electronic device 200a may also send data that may be generated during the disconnection of the physical layer connection to the first target electronic device in advance. The first target electronic device may cache the data and transmit it to the application layer in a timely manner so that the business between the two will not be affected during the disconnection of the physical layer connection.
[0135] Alternatively, the electronic device 200a may also downgrade the service with the first target electronic device, and send the data that may be generated after the service downgrade during the period of disconnection of the physical layer connection to the first target electronic device in advance. For example, if the first target electronic device is a Bluetooth headset, and the service that the electronic device 200a is performing with the Bluetooth headset is a music service, the electronic device 200a may reduce the sound quality of the music and send part of the data to the Bluetooth headset in advance, thereby ensuring that the music service can continue within the time range when the physical layer connection between the two is disconnected. In addition, due to the reduction in sound quality, the amount of data stored in the Bluetooth headset can be reduced while the music service can be performed.
[0136] Alternatively, after determining the first target electronic device, if the real-time nature of the service being performed by the first target electronic device is high, the electronic device 200a may also pop up a window to remind the user whether to disconnect the physical layer connection with the first target electronic device.
[0137] In other embodiments, the first target electronic device may send a response message to the electronic device 200a after allocating memory to the wireless transmission management module or the wireless module, so that the electronic device 200a determines that the first target electronic device is ready to disconnect the physical layer connection.
[0138] In the embodiment of the present application, the electronic device 200a may adopt the following technical solution to determine the first target electronic device.
[0139] Method 1: Determine the first target electronic device according to the amount of data on each wireless link within a period of time.
[0140] Specifically, the electronic device 200a may count the data volume of each wireless link within a period of time, and select the electronic device on the wireless link with the smallest data volume as the first target electronic device.
[0141] For example, electronic device 200a may count the amount of data generated on each wireless link within 1 minute or 2 minutes. When it is determined that the amount of data generated on the wireless link between electronic device 200a and electronic device 200b3 is the smallest, electronic device 200b3 may be selected as the first target electronic device.
[0142] In another example, the electronic device 200a may further determine the first target electronic device in combination with the communication frequency of the connected electronic device. The electronic device 200a may select an electronic device with a small amount of data and a low communication frequency as the first target electronic device.
[0143] For example, electronic device 200a communicates with electronic device 200b3 once every minute, and each communication is 20 bytes, which is less than the communication frequency and data volume between electronic device 200a and other electronic devices. Then electronic device 200a can use electronic device 200b3 as the first target electronic device.
[0144] In some other examples, the electronic device 200a may also determine the first target electronic device based solely on the communication frequency with the connected electronic devices.
[0145] For example, if the electronic device 200a determines that it communicates with the electronic device 200b3 once every 10 minutes, which is less than the communication frequency between the electronic device 200a and other electronic devices, the electronic device 200a may select the electronic device 200b3 as the first target electronic device.
[0146] Method 2: Determine the first target electronic device according to the priority of the electronic device.
[0147] Exemplarily, when the electronic device 200a establishes a wireless connection with other electronic devices, a corresponding priority may be assigned to each electronic device according to its type.
[0148] For electronic devices with higher immediacy, the electronic device 200a can assign a higher priority to them. For example, for a Bluetooth headset, the electronic device 200a can assign the highest priority to it; for a heart rate meter, the electronic device 200a can assign a low priority to it.
[0149] Alternatively, the electronic device 200a may store a comparison table of electronic device types and priorities. When the electronic device 200a establishes a wireless connection with other electronic devices, it may assign corresponding priorities to them according to the comparison table. Alternatively, when the electronic device determines the first target electronic device, it may determine the electronic device with the lowest priority according to the comparison table, and use the electronic device with the lowest priority as the first target electronic device.
[0150] In some other optional solutions, the electronic device 200a may also send the first disconnection indication information and the disconnection instruction to the first target electronic device at the same time after determining the first target electronic device to disconnect the physical layer connection. Alternatively, the electronic device may also directly send a disconnection instruction to the first target electronic device after determining the first target electronic device to disconnect the physical layer connection, and the disconnection instruction may include the first disconnection indication information.
[0151] After the electronic device 200a sends the first disconnection instruction information to the first target electronic device, Figure 5 In (c), the electronic device 200a disconnects the physical layer connection with the first target electronic device and establishes a wireless connection with the electronic device 200c, and the application layer of the electronic device 200a and the first target electronic device are unaware of the disconnection state.
[0152] Optionally, after receiving the response message from the first target electronic device, electronic device 200a may disconnect the physical layer connection with the first target electronic device and establish a wireless connection with electronic device 200c, so that the application layer of electronic device 200a and the first target electronic device are unaware of the disconnection state.
[0153] It should be understood that the electronic device 200a and the application layer of the first target electronic device do not perceive the disconnection state, which can be understood as, although the underlying physical layer connection between the electronic device 200a and the first target electronic device is disconnected, the application layer of the electronic device 200a and the application layer of the first target electronic device remain connected and are not disconnected. Therefore, the user may not perceive the disconnection and still think that the electronic device 200a and the first target electronic device are in a normal connection state.
[0154] In the embodiment of the present application, the technical solution of the application layer of the electronic device not sensing the disconnection state can be found in Figure 6 . For example, Figure 6It is a schematic diagram of wireless communication between electronic devices provided in an embodiment of the present application.
[0155] like Figure 6 As shown, electronic device A may include an application 310 , a wireless transmission management module 320 , and a wireless module 330 , and electronic device B may include an application 340 , a wireless transmission management module 350 , and a wireless module 360 .
[0156] When electronic device A establishes a wireless connection with electronic device B, the wireless module 330 of electronic device A can send a message of successful connection with electronic device B to the wireless transmission management module 320. For example, the wireless module 330 can generate a connection identity (ID) according to the media access control (MAC) address of electronic device B, and send the connection ID to the wireless transmission management module 320. The wireless transmission management module 320 can convert the connection ID into a session ID, so that each session ID corresponds to a connection ID. When the physical layer connection is disconnected, the wireless transmission management module 320 sets the connection ID corresponding to the session ID to null, but does not notify the application 310 upward, so that the application 310 does not perceive the physical layer connection disconnection. When reconnection is required later, the wireless module 320 continues to generate a new connection ID and sends the new connection ID to the wireless transmission management module 320. The wireless connection management module 320 matches the session ID with the new connection ID, so that the wireless transmission channel can be restored.
[0157] It should be understood that the above-mentioned disconnection and reconnection process in electronic device B can refer to the relevant description of electronic device A.
[0158] In this case, the cache mentioned above in the electronic device may be in the wireless transmission management module.
[0159] It should be understood that when electronic device A establishes a wireless connection with electronic device B, the wireless module 360 of electronic device B can also send a message of successful connection with electronic device A to the wireless transmission management module 350 .
[0160] Generally, when electronic device A is disconnected from electronic device B, wireless transmission management module 320 may send a disconnection instruction to wireless module 330, and wireless module 330 may disconnect from wireless module 360 according to the disconnection instruction. After disconnection, wireless module 330 may send a disconnection message to wireless transmission management module 320, and wireless transmission management module 320 may send a disconnection message to application 310, so that the application layer cannot perceive the disconnection.
[0161] In the present application, when electronic device A is disconnected from electronic device B, after receiving the disconnection message sent by wireless module 330, wireless transmission management module 320 does not send a disconnection message to application 310, so that the application layer of electronic device A cannot perceive the disconnection state between electronic device A and electronic device B. It should be understood that the same is true for electronic device B, and its wireless transmission management module 350 does not send a disconnection message to application 340, so that the application layer of electronic device B cannot perceive the disconnection state between electronic device A and electronic device B.
[0162] Optionally, the technical solution that the application layer cannot perceive the connection disconnection can also be implemented in the wireless protocol.
[0163] In other examples, taking the wireless module 330 as a Bluetooth module, when the number of electronic devices connected to the electronic device A by Bluetooth at the same time reaches 7, and the Bluetooth connection request of the electronic device C is received; the electronic device A determines to disconnect the physical layer connection with the electronic device B, and establishes a Bluetooth connection with the electronic device C; then when the electronic device A actually disconnects the Bluetooth connection with the electronic device B, the wireless module 330 can disconnect the physical layer connection between the wireless module 360, but does not send a message of Bluetooth connection disconnection to the wireless transmission management module 320, so that the wireless transmission management module and the application layer of the electronic device A can not perceive the Bluetooth connection disconnection. For the electronic device B, before the electronic device A is actually disconnected from the electronic device B, it will send a disconnection indication message to the electronic device B to indicate that the electronic device B is about to disconnect the physical layer connection, and the application layer of the electronic device B is required not to perceive the disconnection state. Afterwards, after the physical layer connection between the electronic device B and the electronic device A is disconnected, the Bluetooth module 360 of the electronic device B also does not send a Bluetooth disconnection message to its wireless transmission management module 350, so that the wireless transmission management module and the application layer of the electronic device B can not perceive the Bluetooth connection disconnection.
[0164] In some embodiments, when electronic device A establishes a Bluetooth connection with electronic device B, the wireless module can generate a connection ID and correspond the connection ID to the MAC address of the connected device. When the Bluetooth connection is disconnected, the wireless module can set the MAC address corresponding to the connection ID to null, but does not notify the wireless transmission management module and the application program upward, so that the wireless transmission management module and the application program do not perceive the physical layer connection disconnection. When reconnection is required later, the wireless module uses the same connection ID to correspond to the MAC address of the connected device, so that the wireless transmission channel can be restored.
[0165] In this case, the cache mentioned above in the electronic device can be located in the wireless module.
[0166] It is understandable that the wireless modules in the above-mentioned electronic devices A and B can also be Wi-Fi modules, ultra wide band (UWB) modules, ZigBee modules, etc. The embodiments of the present application do not limit the specific form of the wireless module.
[0167] After the first duration T1, see Figure 5 In (d), the electronic device 200a determines a second target electronic device that needs to disconnect the physical layer connection from the electronic devices connected to it, and sends a second disconnection indication information to the second target electronic device; the second disconnection indication information can be used to indicate that the second target electronic device is about to disconnect the physical layer connection, and the second disconnection indication information can also be used to indicate that when the second target electronic device disconnects the physical layer connection with the electronic device 200a, the application layer of the second target electronic device does not perceive the disconnection state.
[0168] It should be understood that the manner in which the electronic device 200a determines the second target electronic device can refer to the related description of the electronic device 200a determining the first target electronic device in the foregoing text, and for the sake of brevity, it will not be repeated here.
[0169] Similarly, the second disconnection indication information may further include a second time duration T2, and indicate that the physical layer connection between the electronic device 200a and the second target electronic device is restored after the second time duration T2.
[0170] In one implementation, after the second time period T2, the electronic device 200a sends a connection request to the second target electronic device to restore the physical layer connection between the two.
[0171] In another implementation, after the second time period T2, the second target electronic device sends a connection request to the electronic device 200a to restore the physical layer connection between the two.
[0172] It should be understood that the method for determining the second duration T2 can refer to the related description of the electronic device determining the first duration T1 in the above text, and for the sake of brevity, it will not be repeated here.
[0173] In other embodiments, the second target electronic device may also send a response message to the second target electronic device after receiving the second disconnection indication information sent by the electronic device 200a, and the response message may include the second duration T2. At this time, the second duration T2 may be determined by the second target electronic device according to its own business, so as to try to ensure that the time range of the second duration T2 for disconnecting the physical layer connection will not affect the business of the second target electronic device.
[0174] Similarly, in the embodiment of the present application, when the service type between the electronic device 200a and the second target electronic device is a service in which the second target electronic device needs to transmit data to the electronic device 200a, the second disconnection indication information can also be used to instruct the second target electronic device to allocate more memory to the wireless transmission management module or the wireless module to cache the data sent by the second target electronic device during the period when the physical layer connection is disconnected. Alternatively, the second disconnection indication information can also be used to instruct the wireless transmission management module or the wireless module of the second target electronic device to cache the data sent by the second target electronic device during the period when the physical layer connection is disconnected.
[0175] In some other embodiments, the second target electronic device may send a response message to the electronic device 200a after allocating more memory, so that the electronic device 200a determines that the second target electronic device is ready to disconnect the physical layer connection.
[0176] When the service type between the electronic device 200a and the second target electronic device is a service in which the electronic device 200a needs to transmit data to the second target electronic device, the electronic device 200a can allocate more memory to the wireless transmission management module or the wireless module when sending the second disconnection indication information to the second target electronic device, so as to cache the data that the application layer of the electronic device 200a needs to send to the second target electronic device during the period when the physical layer connection is disconnected. Alternatively, the electronic device 200a can also directly instruct the wireless transmission management module or the wireless module to cache the data that the application layer of the electronic device 200a needs to send to the second target electronic device during the period when the physical layer connection is disconnected.
[0177] After the electronic device 200a sends the second disconnection instruction information to the second target electronic device, Figure 5 In (e), the electronic device 200a disconnects the physical layer connection with the second target electronic device, and restores the physical layer connection with the first target electronic device, and makes the application layer of the electronic device 200a and the second target electronic device unaware of the disconnection state, so that the first target electronic device is reconnected with the electronic device 200a.
[0178] Optionally, after receiving a response message from the second target electronic device, electronic device 200a may disconnect the physical layer connection with the second target electronic device and restore the physical layer connection with the first target electronic device, so that the application layer of electronic device 200a and the second target electronic device are unaware of the disconnection state.
[0179] In this way, after the first time period T1, the first target electronic device can be reconnected with the electronic device 200a, so that the service of the first target electronic device can continue, thereby improving the user experience.
[0180] After the second time duration T2, the electronic device 200 continues to determine the third target electronic device from the connected electronic devices, and sends the third disconnection indication information to the third target electronic device; thereafter, the electronic device 200a disconnects the physical layer connection with the third target electronic device, and restores the physical layer connection with the second target electronic device, so that the second target electronic device is reconnected with the electronic device 200a. And so on. There is always one target electronic device in the electronic devices connected to the electronic device 200a that is physically disconnected from the electronic device 200a, and the remaining electronic devices are in a normal wireless connection state with the electronic device 200a.
[0181] In some cases, when executing the above solution, the electronic device 200a may also disconnect the physical layer connections of multiple electronic devices each time.
[0182] For example, if there are multiple electronic devices with lower communication frequencies among the multiple electronic devices 200b1-200bm connected to the electronic device 200a, the electronic device can use multiple electronic devices as the target electronic devices (e.g., the first target electronic device, the second target electronic device, etc.) when determining the target electronic device that needs to disconnect the physical layer connection. In this way, when the electronic device 200a establishes a wireless connection with the electronic device 200c, the electronic device 200c can allocate more resources to improve the transmission efficiency between the electronic device 200a and the electronic device 200c.
[0183] For example, electronic device 200b1 communicates with electronic device 200a once every 5 minutes, and electronic device 200b3 communicates with electronic device 200a once every 2 minutes. After receiving a connection request from electronic device 200c, electronic device 200a can use electronic device 200b1 and electronic device 200b3 as target electronic devices for disconnecting the physical layer connection. Electronic device 200a can simultaneously disconnect the physical layer connection with electronic device 200b1 and electronic device 200b3, and establish a wireless connection with electronic device 200c.
[0184] Alternatively, the electronic device may also disconnect the physical layer connections of multiple electronic devices with the lowest priority according to the priority, and establish a wireless connection with the electronic device 200c.
[0185] It is understandable that if during the execution of the above solution, the electronic device 200a receives a connection request from the electronic device 200d, the electronic device 200a can perform the same operation as the above solution, so that the electronic device 200d can successfully establish a wireless connection with the electronic device 200a. In this case, the electronic device 200a needs to keep the physical layer connection of the two electronic devices disconnected at the same time.
[0186] It should also be understood that if there are more electronic devices that need to connect to the electronic device 200a, they can all use the above technical solution to establish a wireless connection with the electronic device 200a, which will not be repeated here.
[0187] Based on the embodiment of the present application, when the number of electronic devices connected to the electronic device 200a at the same time reaches the upper limit, when one or more other electronic devices have the need to connect to the electronic device 200a, the one or more other electronic devices can smoothly establish a connection relationship with the electronic device 200a, and the services of the electronic device originally connected to the electronic device 200a can be basically unaffected. In addition, when the electronic device originally connected to the electronic device 200a disconnects the physical layer connection with the electronic device 200a, its application layer remains unaware of the disconnection state, so that the user cannot perceive the disconnection, thereby improving the user's experience.
[0188] Figure 7 FIG. 1 is a schematic flow chart of a method for dynamically connecting devices provided in an embodiment of the present application. Figure 7 As shown, the method 400 may be applied to a first electronic device, wherein the first electronic device is wirelessly connected to a plurality of electronic devices, and the method 400 may include steps 410 to 430.
[0189] 410. The first electronic device receives a wireless connection request from the second electronic device, where the wireless connection request is used to request to establish a wireless connection with the first electronic device.
[0190] Exemplarily, the wireless connection request may be sent directly from the second electronic device to the first electronic device; or, the wireless connection request may be sent from the second electronic device to the first electronic device via another electronic device.
[0191] 420. The first electronic device disconnects the physical layer connection with the first target electronic device according to the wireless connection request, and the first electronic device does not send a message of disconnection of the physical layer connection to the application layer.
[0192] After receiving the wireless connection request, the first electronic device can disconnect the physical layer connection with the first target electronic device, and the first electronic device does not send a message to its own application layer indicating the disconnection of the physical layer connection with the first target electronic device, so that the application layer of the first electronic device is unaware of the disconnection status of the underlying physical layer connection.
[0193] It is understandable that the technical solution that the application layer of the first electronic device does not perceive the disconnection of the underlying physical layer can be referred to in the above Figure 6 The relevant description will not be repeated here.
[0194] It should be understood that the present application does not limit the number of the first target electronic devices. For example, the number of the first target electronic devices can be one or more. When the number of the first target electronic devices is one, the second electronic device can establish a wireless connection with the first electronic device; when the number of the first target electronic devices is more than one, the first electronic device can free up more resources, thereby improving the efficiency of the wireless connection with the second electronic device.
[0195] 430. The first electronic device establishes a wireless connection with the second electronic device.
[0196] In one embodiment of the present application, a first electronic device can be in a wireless connection state with multiple electronic devices. When the first electronic device receives a wireless connection request from a second electronic device, it can disconnect the physical layer connection with the first target electronic device according to the wireless connection request, and the first electronic device does not send a message of physical layer connection disconnection to the application layer, so that the application layer of the first electronic device is unaware of the physical layer connection disconnection state; thereafter, the first electronic device establishes a wireless connection with the second electronic device.
[0197] In this way, when the number of other electronic devices wirelessly connected to the first electronic device reaches the upper limit, the first electronic device can still establish a wireless connection with the second electronic device. In addition, since the application layer of the first electronic device does not perceive the disconnection of the physical layer connection between the first electronic device and the first target electronic device, the user can believe that the first electronic device and the first target electronic device are still in a normal connection state, which brings a good experience to the user.
[0198] In some embodiments, the method 400 may further include:
[0199] After establishing a wireless connection with the second electronic device, the second target electronic device that disconnects the physical layer connection with the first electronic device is switched according to time, and the first electronic device does not send a message of physical layer connection disconnection to the application layer.
[0200] For example, the first electronic device may determine the duration of disconnection from the second target electronic device according to information such as the type and historical data of the second target electronic device, thereby minimizing the impact on the service with the second target electronic device.
[0201] In one embodiment of the present application, after establishing a wireless connection with a second electronic device, the first electronic device can switch the second target electronic device that is physically disconnected from the first electronic device according to time, and the first electronic device does not send a message of physical layer connection disconnection to the application layer, so that the second target electronic device that is physically disconnected can be switched, thereby avoiding disconnection of the physical layer connection of a certain electronic device for a long time, thereby affecting its business.
[0202] In some embodiments, disconnecting the physical layer connection with the first target electronic device according to the wireless connection request includes:
[0203] Determine a first target electronic device from among a plurality of electronic devices that needs to disconnect a physical layer connection;
[0204] The physical layer connection with the first target electronic device is disconnected.
[0205] The first electronic device can determine a first target electronic device whose physical layer connection needs to be disconnected from the multiple connected electronic devices, and disconnect the physical layer connection with the first target electronic device. After that, the first electronic device can establish a wireless connection with the second electronic device.
[0206] In some embodiments, switching the second target electronic device that is physically disconnected from the first electronic device according to the time includes:
[0207] After a first preset time, the first electronic device determines a second target electronic device from the connected electronic devices that needs to disconnect the physical layer connection;
[0208] The physical layer connection with the second target electronic device is disconnected, and the first electronic device does not send a message of physical layer connection disconnection to the application layer, and the physical layer connection with the first target electronic device is restored, wherein the duration for which the physical layer connection between the first electronic device and the second target electronic device is disconnected is a second preset duration.
[0209] Exemplarily, the first preset duration may be determined by the first electronic device. For example, the first electronic device may be determined based on historical data transmitted between the first target electronic device and the first electronic device. Assume that the first target electronic device is a heart rate monitor that transmits data to the first electronic device every 30 seconds. After the first electronic device disconnects the physical layer connection with the first target electronic device, it may disconnect the connection with the second target electronic device after 30 seconds and restore the physical layer connection with the first target electronic device, so as not to affect the business of the first target electronic device.
[0210] The first preset duration may also be sent by the first target electronic device to the first electronic device.
[0211] Similarly, the second preset time length may also refer to the method for determining the first preset time length.
[0212] This technical solution can enable the first target electronic device to restore the physical layer connection with the first electronic device after a first preset period of time, so that the service of the first target electronic device can be basically unaffected.
[0213] In some embodiments, determining a first target electronic device that needs to disconnect a physical layer connection from a plurality of electronic devices includes:
[0214] The first target electronic device is determined according to first information, wherein the first information includes at least one of types of multiple electronic devices, historical data of communication between the multiple electronic devices and the first electronic device, and priorities of the multiple electronic devices.
[0215] For example, the type of the electronic device may be a wireless headset, a heart rate monitor, etc., and the first electronic device may choose to disconnect the physical layer connection of the electronic device such as the heart rate monitor which has low real-time performance.
[0216] The first electronic device may also determine the first target electronic device through historical data of communication between multiple electronic devices and the first electronic device. For details, please refer to the relevant description above.
[0217] The first electronic device may also determine the first target electronic device according to the priorities of multiple electronic devices. For example, the priorities of multiple electronic devices are stored in the first electronic device, and the first electronic device may select an electronic device with a low priority as the first target electronic device.
[0218] In one embodiment of the present application, the first electronic device may determine the first target electronic device that needs to disconnect the physical layer connection according to the first information, so that the service of the disconnected first target electronic device is not affected as much as possible.
[0219] In some embodiments, before disconnecting the physical layer connection with the first target electronic device according to the wireless connection request, the method 400 may further include:
[0220] First disconnection indication information is sent to the first target electronic device, where the first disconnection indication information is used to indicate that the first target electronic device is about to disconnect the physical layer connection, and is used to indicate that the first target electronic device does not send a physical layer connection disconnection message to the application layer when the physical layer connection is disconnected.
[0221] For details of the first disconnection indication information, please refer to the related description in the foregoing text.
[0222] In one embodiment of the present application, the technical solution can help the first target electronic device determine that the physical layer connection is about to be disconnected according to the first disconnection indication information, and when the physical layer connection is disconnected, it is necessary not to send a message of physical layer connection disconnection to the application layer. This helps the first target electronic device distinguish whether the wireless connection with the first electronic device is truly disconnected or falsely disconnected.
[0223] In some embodiments, the first disconnection indication information further includes a first preset time duration, and the first disconnection indication information is further used to indicate that the physical layer connection between the first electronic device and the first target electronic device is restored after the first preset time duration.
[0224] In one embodiment of the present application, the technical solution helps the first target electronic device to determine the duration of disconnection of the physical layer connection and the time to reconnect.
[0225] In some embodiments, the first disconnection indication information is further used to instruct the first target electronic device to cache data sent by the application layer of the first target electronic device to the first electronic device within a first preset time period of disconnecting the physical layer connection; or,
[0226] The first disconnection indication information is further used to instruct the first target electronic device to allocate memory to cache data sent by the application layer of the first target electronic device to the first electronic device within a first preset time period when the physical layer connection is disconnected.
[0227] Based on the embodiments of the present application, it is helpful for the first target electronic device to cache data that needs to be sent to the first electronic device during the period when the physical layer connection is disconnected, thereby avoiding data loss and causing a bad experience for the user.
[0228] In some embodiments, the method 400 may further include:
[0229] The first electronic device buffers data sent by the application layer of the first electronic device to the first target electronic device within a first preset time period of disconnecting the physical layer connection; or
[0230] The first electronic device allocates memory to cache data sent by the application layer of the first electronic device to the first target electronic device within a first preset time period when the physical layer connection is disconnected.
[0231] Based on the embodiments of the present application, the first electronic device can cache data that needs to be sent to the first target electronic device during the period when the physical layer connection is disconnected, thereby avoiding data loss and causing a bad experience for the user.
[0232] In some embodiments, the method 400 may further include:
[0233] Sending target data to the first target electronic device, where the target data is data that the first electronic device needs to send to the first target electronic device within a first preset time period.
[0234] In other examples, the target data may also be data after service downgrading of data that the first electronic device needs to send to the first target electronic device within the first preset time period. For example, if the data is a picture or video, its resolution may be reduced.
[0235] Based on the embodiment of the present application, the first electronic device can also send data that is originally required to be sent to the first target electronic device within the first preset time period in advance to the first target electronic device before disconnecting the physical layer connection. Thus, the services of the two can continue during the period when the physical layer connection is disconnected, bringing a good experience to the user.
[0236] In some embodiments, the method 400 may further include:
[0237] A response message sent by the first target electronic device is received, where the response message is used to indicate that the first target electronic device is ready to disconnect the physical layer connection.
[0238] Based on the embodiment of the present application, it is helpful for the first electronic device to determine that the first target electronic device is ready to disconnect the physical layer connection, so that the first electronic device can disconnect the physical layer connection with the first target electronic device.
[0239] In some embodiments, the response message also includes a first preset duration.
[0240] Based on the embodiment of the present application, the response message also includes a first preset duration, which is helpful for the first electronic device to determine the disconnection duration with the first target electronic device. Since the first preset duration is the disconnection duration recommended by the first target electronic device, the service between the first electronic device and the first target electronic device may not be affected during the disconnection duration.
[0241] Figure 8 is a schematic block diagram of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 500 may include one or more processors 510; one or more memories 520; the one or more memories 520 store one or more computer programs, and the one or more computer programs include instructions. When the instructions are executed by the one or more processors 510, the method for dynamically connecting devices as described in any possible implementation method described above is executed.
[0242] Exemplarily, the electronic device 500 may be the electronic device 200a, the first electronic device, etc. mentioned above.
[0243] An embodiment of the present application also provides a chip, which includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method for dynamically connecting a device as described in any possible implementation method described above is executed.
[0244] This embodiment also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the method for dynamically connecting devices in the above-mentioned embodiment.
[0245] This embodiment also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the method for dynamically connecting devices in the above-mentioned embodiment.
[0246] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory so that the chip executes the method of dynamically connecting devices in the above-mentioned method embodiments.
[0247] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.
[0248] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example 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 performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0249] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0250] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0251] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0252] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0253] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0254] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for dynamically connecting devices, characterized in that: The method is applied to a first electronic device, the first electronic device is wirelessly connected to a plurality of electronic devices, and the method includes: receiving a wireless connection request from a second electronic device, wherein the wireless connection request is used to request to establish a wireless connection with the first electronic device; Disconnecting the physical layer connection with the first target electronic device according to the wireless connection request, and the first electronic device does not send a message of physical layer connection disconnection to the application layer; A wireless connection is established with the second electronic device.
2. The method according to claim 1, characterized in that The method further comprises: After establishing a wireless connection with the second electronic device, the second target electronic device that disconnects the physical layer connection with the first electronic device is switched according to time, and the first electronic device does not send a message of physical layer connection disconnection to the application layer.
3. The method according to claim 1 or 2, characterized in that: The disconnecting the physical layer connection with the first target electronic device according to the wireless connection request comprises: Determine the first target electronic device that needs to disconnect the physical layer connection from the multiple electronic devices; The physical layer connection with the first target electronic device is disconnected.
4. The method according to claim 3, characterized in that The switching of the second target electronic device disconnected from the first electronic device at the physical layer according to the time includes: After a first preset time, the first electronic device determines the second target electronic device that needs to disconnect the physical layer connection from the connected electronic devices; The physical layer connection with the second target electronic device is disconnected, and the first electronic device does not send a message of physical layer connection disconnection to the application layer, and the physical layer connection with the first target electronic device is restored, wherein the duration for which the physical layer connection between the first electronic device and the second target electronic device is disconnected is a second preset duration.
5. The method according to claim 3 or 4, characterized in that: The step of determining the first target electronic device that needs to disconnect the physical layer connection from the plurality of electronic devices includes: The first target electronic device is determined according to first information, wherein the first information includes at least one of types of the plurality of electronic devices, historical data of communication between the plurality of electronic devices and the first electronic device, and priorities of the plurality of electronic devices.
6. The method according to any one of claims 1 to 5, characterized in that Before disconnecting the physical layer connection with the first target electronic device according to the wireless connection request, the method further includes: Sending first disconnection indication information to the first target electronic device, wherein the first disconnection indication information is used to indicate that the first target electronic device is about to disconnect the physical layer connection, and is used to indicate that the first target electronic device does not send a physical layer connection disconnection message to the application layer when the physical layer connection is disconnected.
7. The method according to claim 6, characterized in that The first disconnection indication information further includes a first preset time duration, and the first disconnection indication information is further used to indicate that the physical layer connection between the first electronic device and the first target electronic device is restored after the first preset time duration.
8. The method according to claim 6 or 7, characterized in that: The first disconnection indication information is further used to instruct the first target electronic device to cache data sent by the application layer of the first target electronic device to the first electronic device within a first preset time period of disconnecting the physical layer connection; or The first disconnection indication information is further used to instruct the first target electronic device to allocate memory to cache data sent by the application layer of the first target electronic device to the first electronic device within a first preset time period of disconnecting the physical layer connection.
9. The method according to claim 6 or 7, characterized in that: The method further comprises: The first electronic device buffers data sent by the application layer of the first electronic device to the first target electronic device within a first preset time period of disconnecting the physical layer connection; or The first electronic device allocates memory to cache data sent by the application layer of the first electronic device to the first target electronic device within a first preset time period when the physical layer connection is disconnected.
10. The method according to claim 7, characterized in that The method further comprises: Send target data to the first target electronic device, where the target data is data that the first electronic device needs to send to the first target electronic device within the first preset time period.
11. The method according to any one of claims 7 to 10, characterized in that: The method further comprises: A response message sent by the first target electronic device is received, where the response message is used to indicate that the first target electronic device is ready to disconnect the physical layer connection.
12. The method according to claim 11, characterized in that The response message also includes the first preset duration.
13. An electronic device, characterized in that: include: one or more processors; One or more memories; the one or more memories store one or more computer programs, the one or more computer programs include instructions, when the instructions are executed by one or more processors, the method of the dynamic connection device as described in any one of claims 1-12 is executed.
14. A chip, characterized in that: The chip includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method for dynamically connecting a device according to any one of claims 1 to 12 is executed.
15. A readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the method for dynamically connecting a device according to any one of claims 1 to 12 is executed.
