Inter-device connection method, electronic device, computer readable medium, and program product
Patent Information
- Application Number
- CN202411582088.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2044-11-06
AI Technical Summary
[0005]本申请实施例提供一种设备间连接方法、电子设备、可读介质及程序产品,以解决连接冲突导致的连接失败问题,可提升连接建立成功率,进而提升用户体验
[0059]第四方面,本申请实施例提供了一种程序产品,该程序产品中包括指令,在该指令被电子设备执行时,使得电子设备可以执行上述第一方面中任一项的设备间连接方法。
Smart Images

Figure CN120475551B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a device-to-device connection method, electronic device, readable medium, and program product. Background Technology
[0002] With the development of electronic technology, electronic devices are becoming increasingly popular. A user can own multiple electronic devices (such as mobile phones, tablets, laptops, smart screens, etc.). Multiple electronic devices can establish connections through communication technologies such as Bluetooth, peer-to-peer (P2P), Wireless Local Area Network (WLAN), and Near-field communication (NFC), thereby enabling interconnection and interoperability between multiple electronic devices.
[0003] When performing high real-time service transfers between multiple electronic devices, the transfer speed is critical. The networking speed of multiple electronic devices is one of the important factors affecting the transfer speed, and the networking speed depends on the speed at which connections are established between multiple electronic devices. Therefore, related technologies use pre-connection to accelerate the networking speed.
[0004] Although establishing a pre-connection before business processes can improve efficiency, if an electronic device suddenly becomes unusable for a business process using the pre-connection, a new connection needs to be established. However, the new connection may conflict with the pre-connection, causing connection establishment failure and ultimately business process failure. Summary of the Invention
[0005] This application provides a device connection method, electronic device, readable medium, and program product to solve the connection failure problem caused by connection conflicts, improve the connection establishment success rate, and thus improve the user experience.
[0006] In a first aspect, embodiments of this application provide a device-to-device connection method. This method is applied to a first device, which can be any type of electronic device such as a mobile phone, tablet computer, or laptop computer. The method includes:
[0007] Before receiving the user's first operation, a pre-connection with a third device is established; the first operation is used to transfer data of the first service of the first device to the third device; a first user interface is displayed, the first user interface including a first icon of the second device; in response to the user's second operation on the first icon, the pre-connection is disconnected and a first connection is established between the first device and the second device; data of the second service is transferred based on the first connection.
[0008] In this embodiment, the first device can be a main device, and the second and third devices can be extension devices. The main device can pre-establish a communication connection with one of the extension devices to improve device interaction efficiency. The second and third devices can be any type of electronic device.
[0009] In this embodiment of the application, before the user triggers the first operation of transmitting the data of the first service of the first device to the third device, it can be determined based on historical interaction information whether the pre-connection conditions for establishing a communication connection between the first device and the third device are met; if the pre-connection conditions are met, the first device and the third device can establish a communication connection in advance, hereinafter referred to as pre-connection.
[0010] It is understandable that, upon receiving the first operation, the data for the first service can be transmitted based on this pre-connection, thereby improving device interaction efficiency and the speed of service flow. The first operation can be an operation where the first device needs to call upon a device in the third device to perform a corresponding function, including sharing operations, such as the first device calling upon the screen of the third device for extended display.
[0011] In the embodiments of this application, if a user wants to call the device of the second device to perform a corresponding function when the first device and the third device have established a pre-connection, such as the user wanting to share the display content of the first device to the second device, a first user interface including the first icon of the second device can be triggered. The interface may also include icons of other selectable devices, which is not limited in this application.
[0012] In this embodiment, if a user performs a second operation on the first icon, such as clicking the first icon, the first device can disconnect the pre-connection between the first device and the third device in response to the second operation. Then, the first device can establish a first connection with the second device and transmit data for the second service based on the first connection. The second operation can be any operation that requires the first device to invoke a device in the second device to perform a corresponding function, such as the user triggering an expanded display on the screen of the second device or the second device's audio device to play sound.
[0013] In this embodiment, the pre-connection between the first device and the third device and the first connection between the first device and the second device are implemented through the same connection module. It can be understood that the pre-connection and the first connection belonging to the same connection module means that the pre-connection and the first connection are established and managed by the same connection module.
[0014] In this embodiment, when the pre-connection and the first connection are implemented through the same connection module, the above-described processing method can be adopted to disconnect the pre-connection and establish a new connection when the extended devices are inconsistent and the pre-connection is not used. This approach reduces the risk of conflict between the first connection and the pre-connection, increases the success rate of establishing a connection between the first device and the second device, and thus improves the user experience.
[0015] In one feasible approach, in response to a second user action on the first icon, disconnecting the pre-connection includes:
[0016] Upon receiving the second operation, determine whether the second device and the third device are consistent; if the second device and the third device are inconsistent, determine whether the pre-connection has been used; if the pre-connection has not been used, disconnect the pre-connection.
[0017] In this embodiment, when a second operation is received that triggers the transfer of data of a first service of the first device to a third device, the first device may first determine whether the second device and the third device are the same device. If they are the same device, the first device may transfer the data of the corresponding service based on the pre-connection. If they are not the same device, the first device may further determine whether the pre-connection has been used. If the pre-connection has not been used, the first device may disconnect the pre-connection. If the pre-connection has been used, disconnecting the pre-connection may affect the existing service flow. The first device may issue a prompt message indicating that the connection with the second device failed or the second operation failed, so that the user can perform subsequent operations.
[0018] In this way, the first device can verify the extended devices and disconnect the pre-connection if the extended devices are inconsistent and the pre-connection is not used, thereby reducing the impact on the existing business process and lowering the probability of business process errors.
[0019] In one possible implementation, the device connection method of this application embodiment further includes:
[0020] Display a second user interface, which includes a second icon for the fourth device; in response to a third operation by the user on the second icon, disconnect the pre-connection and establish a second connection between the first device and the fourth device; transmit data for the third service based on the second connection.
[0021] In this application embodiment, the fourth device can also be an extended device. If the user wants to invoke the fourth device to perform a corresponding function, such as sharing the display content of the first device to the fourth device, a second user interface including the second icon of the fourth device can be triggered. This interface may also include icons of other selectable devices; this application does not impose any limitations on this.
[0022] In this embodiment, if the user performs a third operation on the second icon, such as a long press (pressing for more than a time threshold), the first device can disconnect the pre-connection between the first device and the third device in response to the third operation; then, a second connection can be established with the fourth device, and data for the third service can be transmitted based on the second connection. The third operation can be any operation that requires the first device to call upon the second device's components to perform a corresponding function, such as the user triggering the sharing of an image to the fourth device on the first device.
[0023] In this embodiment, the first device can support multiple different connection modules. These different connection modules can be used to establish different connections for different types of services to facilitate service flow. The pre-connection between the first device and the third device, and the second connection between the first device and the fourth device, are implemented through different connection modules. It can be understood that the pre-connection and the second connection belonging to different connection modules means that the pre-connection and the second connection are established and managed by different connection modules.
[0024] In this embodiment, when the pre-connection and the second connection are implemented through different connection modules, the pre-connection can be disconnected and a new connection established if the extended devices are inconsistent and the pre-connection is not used. This method achieves connection isolation between different connections, improves connection performance, further reduces the risk of conflict between the new connection and the pre-connection, and further increases the success rate of establishing a connection between the first device and the extended device.
[0025] In one possible implementation, where the pre-connection and the second connection belong to different connection modules, for example, the pre-connection belongs to the first connection module of the first device and the second connection belongs to the second connection module of the first device, and the first connection module and the second connection module are different.
[0026] In this case, the step of disconnecting the pre-connection in response to the user's third operation on the second icon includes: the first device sending a pre-connection disconnection command to the first connection module through the second connection module according to the third operation, the pre-connection disconnection command being used to indicate the disconnection of the pre-connection between the first device and the third device; the first device disconnecting the pre-connection between the first device and the third device through the first connection module according to the pre-connection disconnection command.
[0027] It can be understood that "pre-connection belonging to the first connection module" means that the pre-connection is established and managed by the first connection module. Similarly, "first connection belonging to the second connection module" means that the first connection is established and managed by the second connection module. Upon receiving a third operation, the first device can determine which connection module handles the service request corresponding to the third operation. For example, a sharing operation request is handled by the first connection module, while a sharing operation request is handled by the second connection module. If the service request corresponding to the third operation is handled by the second connection module, a pre-connection disconnection command can be sent from the second connection module to the first connection module to disconnect the pre-connection between the first and third devices; and a new connection will be established after the pre-connection is disconnected.
[0028] By using the interaction of different connection modules to disconnect pre-connections, connection isolation between different connections can be achieved, improving connection performance and further reducing the risk of connection failure due to connection conflicts, thereby increasing the connection establishment success rate and improving the user experience.
[0029] In one possible implementation, the first connection module and the second connection module may be connected in the same or different ways. For example, both the first and second connection modules may be connected via Wi-Fi; alternatively, the first connection module may be connected via Wi-Fi, and the second connection module may be connected via Bluetooth. This application does not limit the specific type of connection method between the first and second connection modules.
[0030] In one possible implementation, the step of disconnecting the pre-connection between the first device and the third device by the first connection module according to the pre-connection disconnection command includes:
[0031] The first connection module determines whether a pre-connection exists between the first device and the third device based on the pre-connection disconnection command; if a pre-connection exists between the first device and the third device, the first connection module determines whether the pre-connection between the first device and the third device has been used; if a pre-connection exists between the first device and the third device and the pre-connection has not been used, the pre-connection between the first device and the third device is disconnected.
[0032] It is understandable that after receiving a pre-connection disconnection command, the first connection module can determine whether a pre-connection exists based on whether a pre-connection identifier is stored. If a pre-connection identifier is stored, it can be determined that a pre-connection corresponding to the pre-connection identifier exists; otherwise, if a pre-connection identifier is not stored, it can be determined that a pre-connection does not exist. If the first connection module determines that a pre-connection exists, it can further determine whether the pre-connection is used; if the pre-connection is not used, it disconnects the pre-connection.
[0033] In this way, pre-connections can be disconnected when they are not in use, thus avoiding disruption to existing business processes.
[0034] In one possible implementation, after the second connection module sends a pre-connection disconnection command to the first connection module according to a third operation, the method further includes: sending a pre-connection disconnection response message to the second connection module through the first connection module. The pre-connection disconnection response message includes first information or second information. The first information is used to indicate that there is no pre-connection between the first device and the third device, and the second information is used to indicate the pre-connection disconnection result between the first device and the third device. The pre-connection disconnection result includes whether the pre-connection has been disconnected or the pre-connection has not been disconnected.
[0035] In one possible approach, the step of establishing a second connection between a first device and a fourth device includes: establishing a second connection between the first device and the fourth device if it is determined, based on first information, that there is no pre-connection or based on second information, that the pre-connection has been broken.
[0036] In this embodiment of the application, if the first connection module determines that there is no pre-connection, it can directly generate a pre-connection disconnection response message including first information and send it to the second connection module. The first information is used to indicate that there is no pre-connection between the first device and the third device.
[0037] In this embodiment of the application, if the first connection module determines that a pre-connection exists, it can further determine whether the pre-connection is used; if the pre-connection is not used, the pre-connection is disconnected, and a pre-connection disconnection response message including second information is generated when the pre-connection is successfully disconnected. The pre-connection disconnection result in the second information includes that the pre-connection has been disconnected.
[0038] In this embodiment of the application, if the pre-connection has been used (e.g., the first device and the third device have established a connection based on the pre-connection), or if the pre-connection has not been used but the disconnection fails (e.g., the pre-connection is set to not be preempted), a pre-connection disconnection response message including second information is generated, wherein the pre-connection disconnection result in the second information includes that the pre-connection has not been disconnected.
[0039] In this embodiment of the application, after receiving the pre-connection disconnection response message, if the pre-connection disconnection response message contains first information indicating that the pre-connection does not exist, or second information indicating that the pre-connection has been disconnected, the second connection module establishes a second connection between the first device and the fourth device; otherwise, if the pre-connection disconnection response message contains second information indicating that the pre-connection has not been disconnected, the second connection cannot be established, and a connection establishment failure message is returned.
[0040] In this way, it is possible to establish a second connection even if the pre-connection has been disconnected, and to implement the second connection and the pre-connection separately through different connection modules, thereby achieving connection isolation between different connections, improving connection performance, further reducing the risk of conflict between the first connection and the pre-connection, further improving the connection establishment success rate, and thus improving the user experience.
[0041] In one possible implementation, establishing a pre-connection with a third device includes: a first device receiving pre-connection capability information from the third device, the pre-connection capability information including first indication information and second indication information, the first indication information indicating whether the third device supports the pre-connection capability, and the second indication information indicating whether the third device supports the pre-connection disconnection capability; if the first device determines that the third device supports the pre-connection capability and the pre-connection disconnection capability based on the pre-connection capability information, a pre-connection between the first device and the third device is established through a pre-connection establishment message, the pre-connection establishment message including a pre-connection identifier.
[0042] Pre-connection capability refers to the ability to establish a connection before the business process begins. Pre-connection disconnection capability refers to the ability to disconnect a pre-connection.
[0043] In this embodiment, after receiving pre-connection capability information from the third device, the first device can store the pre-connection capability information in a database (such as a device knowledge base) used by the first device to store capability information of various electronic devices. When it is necessary to determine the pre-connection related capabilities of the third device later, such as whether the pre-connection related capabilities support pre-connection capabilities and / or whether pre-connection disconnection capabilities support them, the pre-stored pre-connection capability information of the third device can be retrieved from the first device's database, and then the pre-connection related capabilities of the third device can be determined based on the pre-connection capability information of the third device. If the first device determines that the third device supports pre-connection capabilities and pre-connection disconnection capabilities, it establishes a pre-connection with the third device.
[0044] In this embodiment, the first device can also be a device that supports pre-connection capability and pre-connection disconnection capability. If both the first device and the third device support pre-connection disconnection capability, the first device can be configured to allow preemption after establishing a pre-connection with the third device. Conversely, if it is determined from the pre-connection capability information that the third device does not support pre-connection capability and pre-connection disconnection capability, then a pre-connection between the first device and the third device will not be established.
[0045] By processing pre-connection capability information between devices, it is possible to ensure that a pre-connection is established when the device supports both pre-connection and pre-connection disconnection capabilities, thereby improving the pre-connection success rate and facilitating connection switching.
[0046] In one possible implementation, establishing a pre-connection with the third device further includes: configuring the pre-connection to be preempted; in this possible implementation, the step of disconnecting the pre-connection in response to a second operation by the user on the first icon includes: disconnecting the pre-connection between the first device and the third device if it is determined that the pre-connection is preempted.
[0047] It is understandable that if the pre-connection between the first device and the third device is configured to not be preempted, then during subsequent service flows, when a second operation is triggered to transfer data from the first device's first service to the third device, the pre-connection between the first device and the third device cannot be disconnected, causing the connection establishment between the first device and the second device to fail. Therefore, when the first device establishes a pre-connection with the third device, this pre-connection can be configured to allow preemption, and this configuration information can be stored in the pre-connection identifier.
[0048] Thus, when the second operation is triggered, the first device can determine, based on the stored configuration information, that the pre-connection is allowed to be preempted, and then disconnect the pre-connection between the first device and the third device in order to establish the first connection between the first device and the second device.
[0049] By handling the pre-connection by disconnecting it when it is determined that the pre-connection is allowed to be preempted, it is possible to avoid affecting the existing business flow.
[0050] In one feasible approach, the step of establishing a pre-connection with a third device before receiving the user's first operation includes: determining whether the third device meets the pre-connection conditions based on historical interaction information between the first device and the third device; and establishing a pre-connection with the third device if the third device meets the pre-connection conditions; wherein the historical interaction information includes interaction information between the first device and the third device when establishing a connection and transmitting data for the fourth service.
[0051] In the embodiments of this application, the historical interaction information may include the communication connection established between the first device and the third device, and the transmission of data of the fourth service, so as to realize the interaction information of the corresponding function (such as display function, shooting function, etc.) through the device of the third device; it may also include one or more of the following information: the device identifier of the third device, at least one historical interaction time between the first device and the third device, at least one historical interaction location where the first device interacted with the third device in the past, and the historical connection method corresponding to each historical interaction time and / or each historical interaction location. This application does not limit the specific content of the historical interaction information.
[0052] In the embodiments of this application, one historical interaction time can correspond to one historical connection method or multiple historical connection methods. One historical interaction location can correspond to one historical connection method or multiple historical connection methods. One historical interaction time and one historical interaction location can both correspond to one historical connection method or both correspond to multiple historical connection methods.
[0053] It is understandable that determining the historical connection methods corresponding to each historical interaction time and / or each historical interaction location between the first device and the third device can establish a connection with the third device based on the connection methods corresponding to the first historical interaction time and / or the first historical interaction location when the system time of the first device matches the first historical interaction time (e.g., 8 pm every night) and / or the location information matches the first historical interaction location (e.g., the geographical location of the user's home).
[0054] In this application embodiment, the pre-connection conditions may include: the current system time of the first device matches the first historical interaction time in at least one historical interaction time; the current location of the first device matches the first historical interaction location in at least one historical interaction location, etc., and this application does not limit these conditions.
[0055] In this application embodiment, the historical interaction information can also be predicted by the trained network model (e.g., decision tree model) to determine whether the third device meets the pre-connection conditions; or the device that meets the pre-connection conditions can be determined from multiple extended devices as the third device.
[0056] In this way, extended devices that meet the pre-connection conditions can be identified as third devices and pre-connections can be established, thereby improving the accuracy of selecting pre-connected extended devices, improving device interaction efficiency, and thus enhancing the user experience.
[0057] In a second aspect, embodiments of this application provide an electronic device, including: a memory and a processor; the memory is used to store computer execution instructions, and when the electronic device is running, the processor executes the computer execution instructions stored in the memory to cause the electronic device to perform the device connection method as described in any of the first aspects above.
[0058] Thirdly, embodiments of this application provide a computer-readable medium storing instructions that, when executed on an electronic device, enable the electronic device to perform the device connection method of any of the first aspects described above.
[0059] Fourthly, embodiments of this application provide a program product that includes instructions that, when executed by an electronic device, enable the electronic device to perform the device connection method described in any of the first aspects above.
[0060] The beneficial effects of the second to fourth aspects mentioned above can be referred to the relevant descriptions in the first aspect and various possible implementations of the first aspect, which will not be repeated here. Attached Figure Description
[0061] Figure 1 This is a schematic diagram illustrating an application scenario of a method for connecting electronic devices provided in an embodiment of this application;
[0062] Figures 2a-2e This application provides a schematic diagram of a user interface for triggering a business flow function.
[0063] Figure 2f This is a schematic diagram of a connection scenario between electronic devices provided in an embodiment of this application;
[0064] Figure 3 This is a schematic diagram of the structure of an electronic device 100 provided in an embodiment of this application;
[0065] Figure 4 A software structure block diagram of an electronic device 100 provided in this application embodiment;
[0066] Figure 5 This is a schematic flowchart of a device connection method provided in an embodiment of this application;
[0067] Figure 6 This is a schematic flowchart of a device connection method provided in an embodiment of this application;
[0068] Figure 7a and Figure 7b A user interface diagram provided for an embodiment of this application;
[0069] Figure 8 This is a schematic flowchart of a device connection method provided in an embodiment of this application;
[0070] Figure 9 This is a schematic flowchart of a device connection method provided in an embodiment of this application. Detailed Implementation
[0071] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are all within the protection scope of this application.
[0072] The terms "first," "second," etc., used in this application specification and claims are used to distinguish different objects, not to limit a specific order. In the description of this application, unless otherwise stated, "at least one" means one, two, or more.
[0073] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that they are examples, illustrations, or descriptions. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0074] The terminology used in the implementation section of this application is only for explaining specific embodiments of this application and is not intended to limit this application. In order to make the purpose, technical solution and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and thoroughly described below with reference to the accompanying drawings.
[0075] Figure 1 This is a schematic diagram illustrating an application scenario of a connection method between electronic devices provided in an embodiment of this application.
[0076] like Figure 1 As shown, mobile phone 10, tablet computer 20, laptop computer 30, and smart screen 40 form a device group, and all devices within this group can communicate with each other. For example, the device group can be networked such that users log in using the same account. Figure 1 When the device group shown includes mobile phone 10, tablet computer 20, laptop computer 30, and smart screen 40, all devices within the same local area network (LAN) can communicate with each other. These devices can connect to the LAN via wired or wireless communication.
[0077] For example, the networking method for device groups can also be... Figure 1The mobile phone 10, tablet computer 20, laptop computer 30, and smart screen 40 in the device group shown are connected via wireless communication methods, such as Bluetooth (BT), Wi-Fi, or ZigBee, to form a wireless local area network (WLAN). For example, a user can add the mobile phone 10, tablet computer 20, laptop computer 30, and smart screen 40 to a Wi-Fi network named "123". The electronic devices within this Wi-Fi network form a local area network, and all the electronic devices within this local area network constitute the device group.
[0078] It is understandable that, in addition to a local area network, the electronic devices within the device group can also be interconnected via a cellular network, or via adapters (such as USB cables or docking devices), thereby enabling communication between the electronic devices within the device group.
[0079] It is understandable that the electronic devices in the device group can be mobile phones, tablets, smart screens, wearable devices, computers with wireless transceiver capabilities, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, and so on.
[0080] by Figure 1Taking the illustrated application scenario as an example, multiple electronic devices in a device group can perform business transfers. Before a business transfer occurs, the user determines the electronic device initiating the transfer (hereinafter referred to as the primary device) and the target electronic device (hereinafter referred to as the extended device). A connection needs to be established between the primary device and the extended device, and then the business transfer can be performed through the established connection. For example, when a user is making a video call using mobile phone 10, they can use the screen sharing function included in the business transfer function to share the screen of mobile phone 10 to smart screen 40 to continue the video call through smart screen 40. To achieve the screen sharing function between mobile phone 10 and smart screen 40, a connection needs to be established between mobile phone 10 and smart screen 40 first. Then, video call data can be transmitted through the connection established between mobile phone 10 and smart screen 40, thus realizing the screen sharing function.
[0081] For example, an extended device can be displayed. For instance, phone 10 displays something like... Figure 2a The user interface 20a shown includes a "phone" control 201 corresponding to the phone 10, and "tablet computer" controls 202, "laptop" controls 203, and "smart screen" controls 204 corresponding to the tablet computer 20, laptop computer 30, and smart screen 40 connected to the phone 10, respectively. In response to a user clicking the "phone" control 201, a list of business workflow functions supported by the phone 10 can be displayed. For example, the phone 10 can display... Figure 2b The user interface 20b is shown.
[0082] Compared to user interface 20a, Figure 2b The user interface 20b shown can display a business workflow function list 205. This list includes a "screen sharing" function control 2051 and a "network sharing" function control 2052. In response to a user dragging the "screen sharing" function control 2051 onto the "smart screen" control 204, the mobile phone 10 can share its screen with the smart screen 40. Correspondingly, the user interface of the mobile phone 10 (not shown in the figure) can be displayed on the screen of the smart screen 40.
[0083] However, before using the service transfer function, the main device and the extended device need to establish a connection first, and then exchange service data based on the established connection. The initial service transfer process between the main device and the extended device usually takes a long time. The aforementioned service data may be, for example, the image data and voice data in the video call process described above. Correspondingly, after the mobile phone 10 and the smart screen 40 successfully transmit service data, the video call interface of the mobile phone 10 can be displayed on the screen of the smart screen 40, for example. The long connection establishment time between the main device and the extended device may lead to a long service transfer time, resulting in a longer waiting time for the user.
[0084] In some related technologies, to reduce user waiting time, pre-connections are established between the main device and extended devices before business transactions. When business transactions are required, the main device and extended devices can directly transmit business data based on the established pre-connection without waiting for the connection to be established between them. For example, the main device can determine the network profile through model training based on historical interaction data, and then pre-establish a connection with the extended devices based on the network profile. Then, when the main device needs to conduct business transactions with the extended devices, it can directly use the pre-established connection to interact with the business data without waiting for the connection to be established between them. The aforementioned historical interaction data includes, but is not limited to, the device type, device identifier (ID), interaction time, interaction location, link type (connection method), and interaction event name (using shared devices of the extended devices, such as shared cameras or shared displays). The network profile includes, but is not limited to, extended devices, connection time, connection method, and location information.
[0085] While establishing pre-connections before business processes can improve efficiency, it can also introduce new problems. For example, if a pre-connection has been established between mobile phone 10 and smart screen 40, a business process might be triggered by mobile phone 10 with tablet computer 20, or vice versa. In this case, a connection needs to be established between mobile phone 10 and tablet computer 20 to exchange business data. However, establishing a connection between mobile phone 10 and tablet computer 20 may conflict with the existing pre-connection, causing connection establishment failure and consequently, business process failure. Several examples illustrate these scenarios below.
[0086] For example, if a pre-connection has been established between the mobile phone 10 and the smart screen 40, such as Figure 2a As shown, if a service flow between a mobile phone 10 and a tablet computer 20 is triggered, the user interface 20a displayed on the mobile phone 10 includes a "Mobile Phone" control 201, a "Tablet Computer" control 202, a "Laptop" control 203, and a "Smart Screen" control 204. In response to the user clicking the "Mobile Phone" control 201, a list 205 of service flow functions supported by the mobile phone 10 can be displayed, such as... Figure 2b The interface 20b shown includes a list 205 containing a "screen sharing" control 2051 and a "network sharing" control 2052. In response to the user dragging the "screen sharing" control 2051 onto the "tablet computer" control 202, the phone 10 returns a screen sharing failure message. At this time, the phone 10 can display the following... Figure 2c The user interface 20c shown is shown. Figure 2cThe user interface 20c shown may include a screen sharing failure message 206.
[0087] For example, if a pre-connection has been established between the mobile phone 10 and the smart screen 40, and the user initiates a service flow with the mobile phone 10 via the control center of the mobile phone 10, the tablet computer 20 will display the following: Figure 2d The user interface 20d shown includes a "phone" control 201, a "tablet computer" control 202, a "laptop computer" control 203, and a "smart screen" control 204; in response to the user clicking the "tablet computer" control 202, the tablet computer 20 can display as shown... Figure 2e The user interface 20e shown is shown. Figure 2e The user interface 20e shown can display a list 207 of business workflow functions for the tablet computer 20. This list includes a "screen sharing" control 2071 and a "network sharing" control 2072. In response to a user dragging the "screen sharing" control 2071 onto the "phone" control 201, the tablet computer 20 returns a screen sharing failure message 208.
[0088] Please refer to Figure 2f This diagram illustrates the interaction between a mobile phone 10, a smart screen 40, and a tablet computer 20. A pre-connection has been established between the mobile phone 10 and the smart screen 40, but this pre-connection does not yet carry any business. At this point, the mobile phone 10 triggers a business flow with the tablet computer 20. This requires establishing a connection between the mobile phone 10 and the tablet computer 20 to exchange business flow data. However, in scenarios where multiple connections cannot coexist, establishing a connection between the mobile phone 10 and the tablet computer 20 may conflict with the already established pre-connection, causing the connection establishment to fail and consequently, the business flow to fail.
[0089] To address the aforementioned issues, this application provides a device-to-device connection method. Using this method, when a master device has already established a pre-connection with an extension device, if an operation triggering the master device to establish a connection with another extension device is received, the master device can establish a connection with the other extension device after disconnecting the pre-connection with the first extension device. Therefore, this method reduces the risk of connection failure due to connection conflicts, improves the connection establishment success rate, and thus enhances the user experience.
[0090] Figure 3 This is a schematic diagram of the structure of an electronic device 100 provided in an embodiment of this application. For example, the electronic device 100 may be a mobile phone.
[0091] like Figure 3As shown, 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, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0092] The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity 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.
[0093] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0094] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.
[0095] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory.
[0096] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.
[0097] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.
[0098] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.
[0099] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0100] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.
[0101] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
[0102] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates 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 processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0103] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth, and other wireless communication methods. The wireless communication module 160 can be one or more devices integrating at least one communication processing module.
[0104] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0105] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0106] The external storage 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. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0107] The internal memory 121 can be used to store computer executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a given function (such as file transfer functionality, photo album functionality, etc.). The data storage area may store data created during the use of the electronic device 100 (such as files, photos, videos, etc.).
[0108] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0109] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.
[0110] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can be corresponding to touch operations performed on different applications (such as taking photos, playing audio, etc.). Motor 191 can also correspond to different vibration feedback effects for touch operations performed on different areas of the display screen 194.
[0111] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.
[0112] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with and detach from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, and other SIM cards. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as calls and data communication.
[0113] It will be apparent to those skilled in the art that some of the specific details presented above regarding electronic device 100 may not be necessary for practicing the particular embodiments described herein or their equivalents. Similarly, other electronic devices may include a greater number of modules, components, etc. Where appropriate, some modules may be implemented as software or hardware. Therefore, it should be understood that the above description is not intended to be exhaustive or to limit this application to the precise forms set forth herein. Rather, it will be apparent to those skilled in the art that many modifications and variations are possible in light of the above teachings.
[0114] The device connection methods described in the following embodiments can be implemented in an electronic device 100 having the above-described hardware structure.
[0115] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.
[0116] Figure 4 This is a software structure block diagram of an electronic device 100 provided in an embodiment of this application.
[0117] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, Android... TM The system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime (ART) and system libraries, and the kernel layer.
[0118] like Figure 4As shown, the application layer can include a series of application packages. These application packages can include applications such as camera, gallery, calendar, calling, maps, conferencing, WLAN, Bluetooth, music, video, and connected services.
[0119] Among them, interconnection services can be used for electronic devices to conduct services with other electronic devices, including screen sharing, memo synchronization, super keyboard and mouse, and PC collaboration.
[0120] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0121] like Figure 4 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, connection module, and connection management module, etc.
[0122] In some embodiments of this application, the connection management module is used to receive a connection establishment trigger instruction issued by the application layer, and trigger the connection module to establish a connection with other electronic devices based on the connection establishment trigger instruction.
[0123] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0124] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.
[0125] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0126] A phone manager is used to provide communication functions for electronic devices. For example, it manages call status (including connection and disconnection).
[0127] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0128] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0129] Application framework layer Figure 4 In addition to the modules shown, it may also include an activity manager, an input manager, etc.
[0130] The Activity Manager Service (AMS) can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers), as well as manage and schedule application processes.
[0131] The Input Manager Service (IMS) provides input management services, which can be used to manage system inputs such as touchscreen input, keypad input, and sensor input. IMS retrieves events from input device nodes and, through interaction with the WMS (Windows Management System), distributes these events to appropriate windows.
[0132] The Android Runtime consists of core libraries and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system, such as converting source code into machine code.
[0133] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.
[0134] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0135] A system library can include multiple functional modules. For example, a surface manager, media libraries, and 3D graphics processing libraries (e.g., OpenGraphicsLibrary for Embedded Systems, OpenGL ES).
[0136] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.
[0137] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
[0138] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0139] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, camera drivers, audio drivers, sensor drivers, and Bluetooth drivers, among others.
[0140] To better understand the technical solutions of the embodiments of this application, the following describes the flow of the device connection method provided in the embodiments of this application, taking several application scenarios as examples in conjunction with the architecture of electronic devices. A user triggers an interconnection service in an interconnection service application at the application layer. The interconnection service application notifies the connection management module and connection module in the application framework layer to establish a connection. In some embodiments, the software module corresponding to the interconnection service application can be referred to as a service module. The service involved in the embodiments of this application is an interconnection service.
[0141] Before describing the device connection method provided in the embodiments of this application, the modules that may be involved when interconnecting multiple electronic devices will be described first.
[0142] When multiple electronic devices are performing service flows, a negotiation channel for connection establishment between these devices can be established through a communication module, such as a Wi-Fi module or a Bluetooth module. Service flows can be triggered by the service modules of the electronic devices, which can then send commands to the connection modules of other electronic devices to negotiate and establish connections. Furthermore, the connection management module of an electronic device can manage and configure one or more connection modules. The connection modules and connection management modules of an electronic device can be combined or set up independently. When combined, they are referred to as a connection module, which possesses both management and connection-related functions. Different types of service flows can be triggered by different service modules, and different types of service flows can establish connections through different connection modules to transmit their corresponding service data.
[0143] For example, this application provides a method for connecting devices, in which the execution subject of each step is a first device. For simplicity, the execution subject of each step will not be described again below. The method flow includes, but is not limited to, the following steps:
[0144] In this embodiment of the application, the first device may establish a pre-connection with the third device.
[0145] For example, the first device may be Figure 1 The mobile phone 10 in the middle, the third device can be Figure 1 The smart screen 40 is used in the system. Based on historical interaction data between the mobile phone 10 and the smart screen 40, the mobile phone 10 can determine whether the pre-connection conditions for establishing a communication connection between the mobile phone 10 and the smart screen 40 are met. If the pre-connection conditions are met, the mobile phone 10 pre-establishes a communication connection with the smart screen 40, hereinafter referred to as the pre-connection. Thus, when a request is received for the mobile phone 10 to connect with the smart screen 40 and for the first operation to transmit the data of the first service of the first device to the third device, the data of the first service can be transmitted based on this pre-connection, improving the interaction efficiency and service flow speed between the mobile phone 10 and the smart screen 40. The first operation may be an operation where the mobile phone 10 needs to call upon the devices of the smart screen 40 to perform a corresponding function, such as a user triggering the mobile phone 10 to call upon the screen of the smart screen 40 for shared display.
[0146] In this embodiment of the application, if a user wants to call the device of the second device to perform a corresponding function, triggering the first user interface including the first icon of the second device and performing a second operation on the first icon, the pre-connection between the first device and the third device can be disconnected when the first device and the third device have established a pre-connection.
[0147] In this embodiment, the second operation may involve the first device calling upon a component of the second device to perform a corresponding function. For example, a user on the first device may trigger an expanded display on the screen of the second device, or the audio component of the second device may play sound. The second device and the third device are different devices.
[0148] For example, in response to the second operation, the first device can initiate a service request. The service request includes a connection type and an identifier of the second device, and the service request is associated with the first connection. It can be understood that the service request is a request initiated for the service corresponding to the second operation, such as a screen sharing request or a document sharing request. The service request being associated with the first connection means that the data related to the service request is transmitted through the first connection. Taking the first device as the mobile phone 10 mentioned above, the second device as the tablet computer 20 mentioned above, and the third device as the smart screen 40 mentioned above as an example, the mobile phone 10 and the smart screen 40 have already established a pre-connection. If the user wants to share the screen, they can enter the first user interface on the mobile phone 10, for example... Figure 2a The interface 20a; and triggers an operation on the first icon (e.g., "Tablet PC" control 202) on the mobile phone 10, for example, as described above. Figure 2c When the user drags the "screen sharing" function control 2051 to the "tablet computer" control 202, the mobile phone 10 initiates a "screen sharing" service request to the tablet computer 20.
[0149] In this embodiment, the connection type included in the service request may be, but is not limited to, P2P connection type.
[0150] In this embodiment, the first device, in response to the second operation, can directly disconnect the pre-connection with the third device; alternatively, it can disconnect the pre-connection with the third device if predetermined conditions are met, for example, by disconnecting... Figure 1 The pre-connection between the mobile phone 10 and the smart screen 40 is described in this application embodiment. The specific disconnection method is not limited.
[0151] For example, the pre-connection between the first device and the third device can be disconnected if it is determined that the pre-connection is allowed to be preempted. In this way, disconnecting the pre-connection when it is determined that the pre-connection is allowed to be preempted can avoid affecting the existing business flow.
[0152] In this embodiment of the application, after the first device disconnects the pre-connection between the first device and the third device, a first connection between the first device and the second device can be established directly; alternatively, if predetermined conditions are met, a first connection can be established, and data for the second service can be transmitted based on the first connection.
[0153] In this embodiment, after disconnecting the pre-connection between the first device and the third device, the first connection can be established directly, such as establishing a connection between mobile phone 10 and tablet computer 20; alternatively, the first connection can be established if predetermined conditions are met, and this embodiment does not limit this. In this embodiment, the first device can establish a connection with the second device after disconnecting the pre-connection between the first device and the third device, which can avoid connection failures caused by connection conflicts, improve the connection establishment success rate, and thus improve the user experience.
[0154] The aforementioned first, second, and third devices can be electronic devices, including mobile phones, tablets, laptops, large-screen devices (e.g., smart TVs, smart screens), personal computers (PCs), ultra-mobile personal computers (UMPCs), handheld computers, netbooks, personal digital assistants (PDAs), smartwatches and other wearable electronic devices, artificial intelligence (AI) speakers, and in-vehicle devices. They can also be various teaching aids (e.g., learning machines, early education machines), smart toys, portable robots, augmented reality (AR) / virtual reality (VR) devices, media players, etc., and can also be devices with mobile office functions, smart home functions, audio-visual entertainment functions, or devices supporting smart travel. This application does not impose special limitations on the specific form of the electronic devices.
[0155] In this embodiment, the first device, the second device, and the third device can be different electronic devices. Each electronic device can support multiple different connection modules, and different connection modules can be used to establish different connections for different types of services to facilitate service flow. When different types of service flow are involved, connections need to be established through different connection modules, and the corresponding methods for disconnecting pre-connections are not entirely the same. The following will describe the methods for disconnecting pre-connections in detail through different scenarios.
[0156] Scene 1:
[0157] Please refer to Figure 5 This is a schematic flowchart of a device connection method provided in an embodiment of this application. Figure 5 Device A is the first device or mobile phone 10 mentioned above, device B is the third device or smart screen 40 mentioned above, and device C is the second device or tablet computer 20 mentioned above. The method includes, but is not limited to, the following steps:
[0158] S300a: The connection management module of device A configures the connection module of device A to support pre-connection capability and pre-connection disconnection capability. In this embodiment, S300a can be executed when device A starts up.
[0159] S300b: The connection management module of device B configures the connection module of device B to support pre-connection capability and pre-connection disconnection capability. In this embodiment, S300b can be executed when device B starts up.
[0160] S301: The connection module of device A and the connection module of device B exchange pre-connection capability information.
[0161] In this embodiment, the pre-connection capability information may include first indication information and second indication information, wherein the first indication information is used to indicate whether device A and device B support pre-connection capability, and the second indication information is used to indicate whether device A and device B support pre-connection disconnection capability.
[0162] S302a: Device A's connectivity module updates the device knowledge base. This can be understood as Device A updating the device knowledge base including storing device B's pre-connectivity capability information.
[0163] S302b: Device B's connectivity module updates the device knowledge base. This can be understood as Device B updating the device knowledge base including storing device A's pre-connectivity capability information.
[0164] S303: The connection management module of device A begins to establish a pre-connection with device B.
[0165] In this embodiment, there is no limitation on how to initiate the pre-connection. For example, device A can initiate the pre-connection if it predicts that device B meets the pre-connection conditions based on a trained model. For instance, if device A predicts that a business flow may occur at a first time based on a trained model, it can initiate the pre-connection at a second time earlier than the first time.
[0166] S304: The connection management module of device A queries the device knowledge base to determine whether device B supports pre-connection capability and pre-connection disconnection capability. In this embodiment, the connection management module of device A can obtain the pre-connection capability information of device B stored in S302a by querying the device knowledge base, and then determine whether device B supports pre-connection capability based on the first indication information included in the pre-connection capability information of device B, and determine whether device B supports pre-connection disconnection capability based on the second indication information included in the pre-connection capability information of device B.
[0167] S305: If the connection management module of device A determines that device B does not support pre-connection capability, then no pre-connection will be established with device B.
[0168] S306a: If the connection management module of device A determines that device B supports pre-connection capability and pre-connection disconnection capability, it initiates a pre-connection establishment process with device B and sets the pre-connection to be allowed to be preempted.
[0169] For example, S306a may include the connection management module of device A sending a pre-connection instruction to the connection module of device A, the pre-connection instruction instructing the connection module of device A to initiate a pre-connection with the connection module of device B and setting the pre-connection to be preempted.
[0170] For example, in response to the pre-connection command, the connection module of device A executes S306b: generating and storing a pre-connection identifier. For example, the connection module of device A may generate and store a pre-connection identifier according to the received pre-connection command, wherein the pre-connection identifier is used to identify that the established connection is a pre-connection.
[0171] For example, after the connection module of device A generates and stores the pre-connection identifier, it can send a pre-connection negotiation request message to the connection module of device B to negotiate the establishment of a pre-connection with device B; after receiving the pre-connection negotiation request message, the connection module of device B can send a pre-connection negotiation response message to the connection module of device A to respond to the negotiation request of device A, including agreeing to or disagreeing with the negotiation request.
[0172] For example, if the connection module of device A receives a pre-connection negotiation response message, and the pre-connection negotiation response message indicates agreement to the negotiation request of device A, then it sends a pre-connection request message to the connection module of device B to request the establishment of a pre-connection; after receiving the pre-connection request message, the connection module of device B may send a pre-connection response message to the connection module of device A to respond to the result of device A establishing the pre-connection, including whether the pre-connection was established successfully or failed.
[0173] For example, if the connection module of device A receives a pre-connection response message, and the pre-connection response message indicates that the pre-connection was successfully established, then the pre-connection establishment process is completed.
[0174] That is, step S306c is completed: the connection module of device A and the connection module of device B exchange pre-connection establishment messages, completing the pre-connection establishment process. For example, the pre-connection establishment message may include a pre-connection negotiation request message, a pre-connection negotiation response message, a pre-connection request message, and a pre-connection response message, etc.
[0175] In this embodiment, the connection module of device A can send a pre-connection identifier to the connection module of device B. This application does not limit the type of message used to send the pre-connection identifier. For example, the connection module of device A can carry the pre-connection identifier in a pre-connection establishment message sent to the connection module of device B. Alternatively, the connection module of device A can also send the pre-connection identifier to the connection module of device B using a newly designed message.
[0176] After the pre-connection is established, the connection module of device B executes step S306d: store the pre-connection identifier and set the pre-connection to be preempted.
[0177] It is understandable that the process of pre-establishing a connection between device A and device B without requiring active user intervention, and which allows device A and device B to pre-establish a communication connection when the model determines that the conditions for pre-establishing a communication connection are met, can improve the efficiency of device interaction.
[0178] If device A and device B have already established a pre-connection, and device A receives a second operation that triggers the establishment of a connection between device A and the target device, such as the one described above... Figure 2c When the user drags the "screen sharing" function control 2051 to the "tablet computer" control 202, S307 is executed: the service module of device A sends a service request message to the connection module of device A.
[0179] For example, the service request message in S307 may include a connection type and a target device identifier. For instance, a service request message initiated by device A could be a service request initiated by mobile phone 10, such as the one described above. Figure 2c When a user drags the "screen sharing" function control 2051 onto the "tablet computer" control 202, a corresponding "screen sharing" service request message is initiated.
[0180] S308: The connection module of device A determines whether a pre-connection exists.
[0181] For example, in S308, the connection module of device A can determine whether a pre-connection exists based on whether a pre-connection identifier is stored. If a pre-connection identifier is stored, it can be determined that a pre-connection corresponding to the pre-connection identifier exists; otherwise, if a pre-connection identifier is not stored, it can be determined that no pre-connection exists.
[0182] In this embodiment, the target device identified by the target device identifier will be described below as either device B, which has already established a pre-connection, or device C, which has not established a pre-connection.
[0183] If the target device is device B, perform the following steps:
[0184] For device A, S310 can be executed: The connection module of device A determines that a pre-connection exists, and determines that the pre-connection is a pre-connection with device B, and sends a connection usage request to the connection module of device B.
[0185] For example, before sending a connection usage request to the connection module of device B, the connection module of device A may further determine that the type of the pre-connection is the same as the connection type included in the service request message in S307.
[0186] In this embodiment, the connection module of device A sends a connection usage request to the connection module of device B to request the use of pre-connection.
[0187] For device B, S309 can be executed: The service module of device B sends a service listening request message to the connection module of device B.
[0188] In this embodiment, the service monitoring request message is used to request registration for service monitoring, monitoring whether device A initiates a connection request to device B. For example, device B is the one mentioned above. Figure 1 The Smart Screen 40, such as Figure 2b When the user drags the "screen sharing" function control 2051 to the "smart screen" control 204, device B hears a connection request from device A to device B in order to realize the "screen sharing" function.
[0189] For device B, upon detecting a connection request from device A to device B, execute S311: Device B's connection module deletes the pre-connection identifier. Then, execute S312: Device B's connection module sends a connection usage response message to device A.
[0190] After receiving the connection use response message, the connection module of device A determines that the pre-connection with device B can be used and executes S313: The connection module of device A deletes the pre-connection identifier.
[0191] Device B executes S314: Device B's connection module sends a connection response message to Device B's service module. In this embodiment, the connection response message is used to instruct Device A to initiate a connection usage request to Device B.
[0192] Device A executes S315: Device A's connection module sends a service response message to Device A's service module. In this embodiment, the service response message is used to indicate a successful connection.
[0193] After device A and device B successfully connect, step S316 is executed: the service module of device A and the service module of device B exchange service data. In this embodiment, the service modules of device A and device B use the pre-connection established between the connection modules of device A and device B to exchange service data.
[0194] In this way, device A and device B can achieve rapid connection based on pre-connection, thereby improving device interaction efficiency and business flow speed.
[0195] The above describes a scenario where device A and device B have established a pre-connection, and the target device for the service request message sent by device A is device B. In this scenario, device A and device B establish a connection based on the pre-connection and achieve business data interaction. In another scenario, the target device for the service request message sent by device A can also be device C. For example, the service request message initiated by device A could be a service request initiated by mobile phone 10, such as the one described above. Figure 2c When the user drags the "screen sharing" function control 2051 to the "tablet computer (corresponding to device C)" control 202, the mobile phone 10 initiates a "screen sharing" service request.
[0196] When the target device is device C, after device A executes S308: Device A's connection module determines whether a pre-connection exists, the following steps are performed:
[0197] By executing S308, the device A connection module determines that there is a pre-connection between device A and device B; and, it can compare whether the target device identifier of the target device (device C) is consistent with the device identifier of device B; if the target device identifier is inconsistent with the device identifier of device B, it can be determined that the target device to be connected is different from the pre-connected device B; then, it can be determined whether the pre-connection between device A and device B is used; if the pre-connection is not used, the device A connection module executes S317: there is a pre-connection but it is not used, disconnect the pre-connection with device B.
[0198] Device B executes S318: Device B's connection module updates the connection identifier. In this embodiment, updating the connection identifier includes deleting the pre-connection identifier.
[0199] Device A executes S319: Device A's connection module sends a connection negotiation request to Device C's connection module. In this embodiment, the connection negotiation request is used to request negotiation of the configuration information used for this connection. This configuration information may include device A's device identifier, the connection method of Device A's connection module, etc. This application does not limit the specific content included in the configuration information.
[0200] In this embodiment, the connection module of device C can determine whether device C has a pre-connection with other devices (e.g., device D); if device C has a pre-connection with other devices; if a pre-connection exists, it determines whether the pre-connection is used; if the pre-connection is not used, then S320 is executed: the connection module of device C determines that a pre-connection exists and is not used, and disconnects the pre-connection; and after disconnecting the pre-connection, the connection module of device C executes S321: sending a connection negotiation response to device A.
[0201] In this embodiment, S320 may include a connection module of device C determining whether there is a pre-connection with device D, wherein device D and device A are different devices, and device D and device B may be the same device or different devices. If the connection module of device C determines that there is a pre-connection with device D and the pre-connection is not used, the pre-connection is disconnected.
[0202] In this scenario, the pre-connection between device A and device B, and the established connection between device A and device C, belong to the same connection module. In this embodiment, the connection negotiation response includes the result information of this connection negotiation.
[0203] In this embodiment, if device C does not have a pre-connection with other devices, the connection module of device C can directly execute S321: send a connection negotiation response to device A.
[0204] After receiving the connection negotiation response from the connection module of device C, the connection module of device A executes S322: the connection module of device A and the connection module of device C establish a connection based on the negotiation result information.
[0205] Device A executes S323a: Device A's connection module returns a connection success message to Device A's service module.
[0206] Device C executes S323b: Device C's connection module returns a connection success message to Device C's service module.
[0207] After device A and device C successfully connect, execute S324: The service module of device A and the service module of device C exchange service data. For example, as described above... Figure 2c As shown, the user drags the "screen sharing" function control 2051 from device A to the "tablet computer (corresponding to device C)" control 202. After the connection process described above, device A and device C are successfully connected, and the screen content of device A is shared and displayed on the screen of device C, thus realizing the screen sharing function.
[0208] It should be noted that the step numbers involved in the various embodiments of this application are only used to distinguish different processing steps and are not used to limit the order in which the steps are executed.
[0209] The processing method described above enables the establishment of a new connection after the pre-connection is disconnected, reducing the risk of conflict between the new connection and the pre-connection, increasing the success rate of establishing a connection between the first device and the second device, and thus improving the user experience.
[0210] In "Scenario 1," the process of establishing a pre-connection between device A and device B was described, as well as the processing procedure when device A sends a service request message, with the target device being either device B or device C. The following description, "Scenario 2," uses device C sending a service request message with device A as the target device, and details the processing procedure in this scenario.
[0211] Scene 2:
[0212] Please refer to Figure 6 This is a schematic flowchart of a device connection method provided in an embodiment of this application. Figure 6 Device A is the first device or mobile phone 10 mentioned above, device B is the third device or smart screen 40 mentioned above, and device C is the second device or tablet computer 20 mentioned above. The method includes, but is not limited to, the following steps:
[0213] In this embodiment, the process of establishing a pre-connection between device A and device B in steps S400a to S406d is the same as the process in steps S300a to S306d, and will not be described again here.
[0214] If device A and device B have already established a pre-connection, and device C receives an operation that triggers the establishment of a connection between device C and the target device, as described above... Figure 2e The user drags the "screen sharing" function control 2071 onto the "phone" control 201, as shown in the diagram. Then, step S407 is executed: the service module of device C sends a service request message to the connection module of device C. For example, the service request message initiated by device C could be a service request initiated by tablet computer 20, such as the one described above. Figure 2e When a user drags the "screen sharing" function control 2071 onto the "phone" control 201, a corresponding "screen sharing" service request message is initiated.
[0215] For example, the service request message in S407 may include the connection type and the target device identifier.
[0216] In this embodiment, when the target device is device A, the following steps are performed: the connection module of device C determines whether there is a pre-connection for device C; for example, the connection module of device C can determine whether there is a pre-connection based on whether a pre-connection identifier is stored. If a pre-connection identifier is stored, it can be determined that there is a pre-connection corresponding to the pre-connection identifier; otherwise, if a pre-connection identifier is not stored, it can be determined that there is no pre-connection.
[0217] In this embodiment, if device C does not have a pre-connection, then S409 is executed directly: the connection module of device C sends a connection negotiation request to the connection module of device A.
[0218] In this embodiment, if device C has a pre-connection and the stored pre-connection identifier is not the device identifier of device A, but for example, the device identifier of device D, then it continues to determine whether the pre-connection is used; if the pre-connection has been used, then a connection failure or operation failure prompt message is returned, for example... Figure 2e The message displayed is "Screen sharing failed"; if the pre-connection is not used, the connection module of device C executes S408: determine that a pre-connection exists and is not used, and disconnect the pre-connection.
[0219] After the connection module of device C disconnects the pre-connection, step S409 is executed: the connection module of device C sends a connection negotiation request to the connection module of device A. In this embodiment, the connection negotiation request is used to request negotiation of the configuration information used for this connection. The configuration information may include the device identifier of device C, the connection method of the connection module of device C, etc. This application does not limit the specific content of the configuration information.
[0220] After receiving the connection negotiation request, the connection module of device A executes S410: The connection module of device A determines whether a pre-connection exists. For example, in S410, the connection module of device A can determine whether a pre-connection exists based on whether a pre-connection identifier is stored. If a pre-connection identifier is stored, it can be determined that a pre-connection corresponding to the pre-connection identifier exists; otherwise, if a pre-connection identifier is not stored, it can be determined that no pre-connection exists.
[0221] In this embodiment, if device A does not have a pre-connection, then S413 is executed directly: the connection module of device A sends a connection negotiation response to the connection module of device C.
[0222] In this embodiment, if device A has a pre-connection and the stored pre-connection identifier is not the device identifier of device C, but for example, the device identifier of device B, then it continues to determine whether the pre-connection has been used; if the pre-connection has been used, then a connection failure or operation failure prompt message is returned, for example... Figure 2e The message displayed is "Screen sharing failed"; if the pre-connection is not used, the connection module of device A executes S411: there is a pre-connection and the pre-connection is not used, disconnect the pre-connection.
[0223] For device B, execute S412: Device B's connection module updates the connection identifier. In this embodiment, updating the connection identifier includes deleting the pre-connection identifier.
[0224] After the connection module of device A disconnects the pre-connection, step S413 is executed: a connection negotiation response is sent to the connection module of device C. In this embodiment, the connection negotiation response includes information about the result of this connection negotiation.
[0225] S414: The connection module of device A and the connection module of device C establish a connection based on the negotiation result information.
[0226] Device A executes S415a: Device A's connection module returns a connection success message to Device A's service module.
[0227] Device C executes S415b: Device C's connection module returns a connection success message to Device C's service module.
[0228] In this scenario, the pre-connection between device A and device B and the connection established between device A and device C belong to the same connection module.
[0229] After device A and device C successfully connect, execute S416: The service module of device C exchanges service data with the service module of device A. For example, as described above... Figure 2eAs shown, the user drags the "screen sharing" function control 2071 from the "tablet" device C to the "phone (corresponding to device A)" control 201. After the connection process described above, if the connection between device A and device C fails, the message "screen sharing failed" will be displayed; if the connection is successful, the screen content of device C will be shared and displayed on the screen of device A, thus realizing the screen sharing function.
[0230] By using the processing method described in the above embodiments, establishing a new connection after the pre-connection is disconnected can reduce the risk of conflict between the new connection and the pre-connection, improve the success rate of establishing a connection between the first device and the second device, and thus enhance the user experience.
[0231] In "Scenario Two," the process of establishing a pre-connection between device A and device B was described, as well as the processing procedure when device C sends a service request message with device A as the target device. The following description assumes "Scenario Three," where device A sends a service request message with device C as the target device, and the pre-connection between device A and device B and the connection established between device A and device C belong to different connection modules.
[0232] Scene 3:
[0233] Figure 7a and Figure 7b This is a schematic diagram of a user interface provided for an embodiment of this application.
[0234] Reference Figure 7a The user interface 70a is displayed for selecting the object to share with. The user interface 70a displays an image 701 and a "share" icon 702. If the user wants to share image 701 with an extended device, they can click the "share" icon 702. In response to the user clicking the "share" icon 702, the following actions are taken: Figure 7b The electronic device displays a user interface 70b that includes icons for sharing the device, and... Figure 7b The display interface 70b shows a "tablet computer" icon 703 and a "laptop computer" icon 704.
[0235] In this embodiment, if a user wants to share image 701 with tablet computer 20, they can click the "tablet computer" icon 703 to perform the image sharing operation. In response to this operation, mobile phone 10 initiates an "image sharing" service request to tablet computer 20, and mobile phone 10 establishes a new connection with tablet computer 20.
[0236] In this embodiment, device A is the first device or mobile phone 10, device B is the third device or smart screen 40, and device C is the fourth device or tablet computer 20. The fourth device may be the same as or different from the second device mentioned above. Device A and device B establish a pre-connection through the first connection module to facilitate possible subsequent shared services; while the service corresponding to the connection to be established between device A and device C is a sharing service, which is different from the sharing service and requires a new connection to be established through the second connection module.
[0237] Figure 8 This is a schematic flowchart of a device connection method provided in an embodiment of this application. Please refer to the following. Figure 8 This paper describes the process of establishing a pre-connection between device A and device B, and establishing a new connection between device A and device C in this scenario.
[0238] This process includes, but is not limited to, the following steps:
[0239] In this embodiment, the process of establishing a pre-connection between device A and device B in steps S500a to S506d is consistent with the process in steps S300a to S306d, and will not be described again here. The only difference is that the pre-connection in steps S500a to S506d is established and managed by the first connection module.
[0240] If device A and device B have already established a pre-connection, and the user triggers an operation on the second icon of device C on the second user interface, for example... Figure 7b If a user clicks the "Tablet PC" icon 703 on the display interface 70b to perform a "photo sharing" operation, and the service corresponding to this operation belongs to the second connection module, then device A will respond to this operation and execute it through device A's service module:
[0241] S507: The service module of device A sends a service request message to the second connection module of device A.
[0242] In this scenario, the service initiated by device A belongs to the second connection module. It can be understood that the service belongs to the second connection module, meaning that the service is associated with the second connection module, or that the service needs to be processed based on the connection established by the second connection module.
[0243] For example, the service request message in S507 may include the connection type and the target device identifier (i.e., the identifier of device C). For instance, a service request message initiated by device A could be a service request initiated by mobile phone 10, such as the one mentioned above where the user... Figure 7b When the "Tablet PC" icon 703 is clicked on the display interface 70b to perform the "Image Sharing" operation, the mobile phone 10 will initiate a corresponding "Image Sharing" service request message.
[0244] In this embodiment, when the second connection module of device A receives a service request message, it executes S508: sending a pre-connection disconnection command to the first connection module of device A.
[0245] In this embodiment, when the first connection module of device A receives a pre-connection disconnection command, it executes S509: The first connection module of device A determines whether a pre-connection exists. For example, in S509, the first connection module of device A can determine whether a pre-connection exists based on whether a pre-connection identifier is stored. If a pre-connection identifier is stored, it can be determined that a pre-connection corresponding to the pre-connection identifier exists; otherwise, if a pre-connection identifier is not stored, it can be determined that no pre-connection exists.
[0246] In this embodiment, if the first connection module of device A determines that a pre-connection exists, it can further determine whether the pre-connection is used; if the pre-connection is not used, then S510 is executed: the first connection module of device A determines that a pre-connection exists and that the pre-connection is not used, and disconnects the pre-connection.
[0247] After disconnecting the pre-connection, the first connection module of device A executes S511a: update the connection identifier. In this embodiment, updating the connection identifier of device A includes deleting the pre-connection identifier.
[0248] Furthermore, the first connection module of device B executes S511b: update the connection identifier. In this embodiment, updating the connection identifier by device B includes deleting the pre-connection identifier.
[0249] The first connection module of device A executes S512: sending a pre-connection disconnection response message to the second connection module of device A.
[0250] In this embodiment, if the first connection module of device A determines that there is no pre-connection, it can directly return no pre-connection through the pre-connection disconnection response message; if the first connection module of device A determines that there is a pre-connection, it can return the pre-connection disconnection result through the pre-connection disconnection response message after disconnecting the pre-connection.
[0251] In this embodiment, the target device identified by the target device identifier will be described as device B or device C respectively.
[0252] If the target device is device B, perform the following steps:
[0253] S513: The second connection module of device A establishes a connection with the second connection module of device B. In this embodiment, a connection corresponding to the connection type is established. The method of establishing the connection is not limited.
[0254] S514: The service module of device A interacts with the service module of device B to exchange service data. In this embodiment, the service module of device A and the service module of device B exchange service data based on the connection established between the second connection module of device A and the second connection module of device B.
[0255] If the target device is device C, perform the following steps:
[0256] S515: The second connection module of device A sends a connection negotiation request to the second connection module of device C. In this embodiment, the connection negotiation request is used to request negotiation of the configuration information used for this connection.
[0257] S516: The second connection module of device C sends a pre-connection disconnection command to the first connection module of device C. In this embodiment, the pre-connection disconnection command is used to indicate the disconnection of an existing pre-connection.
[0258] S517: The first connection module of device C determines whether a pre-connection exists.
[0259] S518: The first connection module of device C determines that a pre-connection exists and that the pre-connection is not in use, and disconnects the pre-connection.
[0260] S519: The first connection module of device C sends a pre-connection disconnection response message to the second connection module of device C.
[0261] In this embodiment, if the first connection module of device C determines that there is no pre-connection, it can directly return no pre-connection through the pre-connection disconnection response message; if the first connection module of device C determines that there is a pre-connection, it can return the pre-connection disconnection result through the pre-connection disconnection response message after disconnecting the pre-connection.
[0262] S520: The second connection module of device A receives a connection negotiation response from the second connection module of device C.
[0263] In this embodiment, the connection negotiation response includes information about the result of this connection negotiation.
[0264] S521: The second connection module of device A and the second connection module of device C establish a connection based on the negotiation result information.
[0265] S522a: The second connection module of device A returns a connection success message to the service module of device A.
[0266] S522b: The second connection module of device C returns a connection success message to the service module of device C.
[0267] S523: The business module of device A interacts with the business module of device C to exchange business data, thereby realizing the transmission of corresponding business data. For example, Figure 7b The image 701 in the display interface 70b is transferred from the mobile phone 10 to the tablet computer 20, realizing the "image sharing" function between electronic devices.
[0268] In this scenario, the pre-connection between device A and device B, and the established connection between device A and device C, belong to different connection modules. The connection methods of these different connection modules can be the same or different. For example, the first connection module and the second connection module can both use Wi-Fi; alternatively, the first connection module can use Wi-Fi, and the second connection module can use Bluetooth. This application does not limit the specific type of connection method between the first and second connection modules.
[0269] The processing method described in the above embodiments enables the establishment of a new connection after the pre-connection is disconnected. Different connection modules are used to implement the new connection and the pre-connection separately, thereby achieving connection isolation between different connections, improving connection performance, further reducing the risk of conflicts between the new connection and the pre-connection, further increasing the success rate of establishing a connection between the first device and the second device, and enhancing the user experience. Furthermore, the new connection can be implemented using connection modules more suited to the new interactive business, which can improve the efficiency of business data interaction.
[0270] In "Scenario 3," the process described is as follows: Device A establishes a pre-connection with Device B; Device A sends a service request message, with Device C as the target device; and the pre-connection between Device A and Device B and the connection established between Device A and Device C belong to different connection modules. The following description assumes "Scenario 4," where Device C sends a service request message, the target device is Device A, and the pre-connection between Device A and Device B and the connection established between Device A and Device C belong to different connection modules.
[0271] Scene 4:
[0272] Please refer to Figure 9 This is a schematic flowchart of another device connection method provided in an embodiment of this application. Figure 8 Device A is the first device or mobile phone 10 mentioned above, device B is the third device or smart screen 40 mentioned above, and device C is the fourth device or tablet computer 20 mentioned above. The method includes, but is not limited to, the following steps:
[0273] In this embodiment, the pre-connection process between device A and device B in steps S600a to S606d is the same as that in steps S300a to S306d, and will not be described again here. The only difference is that the pre-connection in steps S600a to S606d is established and managed by the first connection module.
[0274] If device A and device B have already established a pre-connection, and device C receives an operation that triggers the establishment of a connection between device C and the target device, then step S607 is executed: the service module of device C sends a service request message to the second connection module of device C. For example, the service request message initiated by device C can be a service request initiated by tablet computer 20. For instance, it could be that when a user clicks the "phone" icon on the image sharing user interface (not shown) on tablet computer 20 to share an image with a phone, tablet computer 20 initiates a corresponding "image sharing" service request message.
[0275] In this scenario, the pre-connection between device A and device B and the connection established between device A and device C belong to different connection modules.
[0276] For example, the service request message in S607 may include the connection type and the target device identifier.
[0277] In this scenario, the service initiated by device C belongs to the second connection module. It can be understood that the service belongs to the second connection module, meaning that the service is associated with the second connection module, or that the service needs to be processed based on the connection established by the second connection module.
[0278] In this embodiment, upon receiving a service request message, the second connection module of device C executes step S608: sending a pre-connection disconnection command to the first connection module of device C. In this embodiment, the pre-connection disconnection command is used to instruct the disconnection of an existing pre-connection.
[0279] In this embodiment, when the first connection module of device C receives a pre-connection disconnection command, it executes S609: determining whether a pre-connection exists. For example, in S609, the first connection module of device C can determine whether a pre-connection exists based on whether a pre-connection identifier is stored. If a pre-connection identifier is stored, it can be determined that a pre-connection corresponding to the pre-connection identifier exists; otherwise, if a pre-connection identifier is not stored, it can be determined that no pre-connection exists.
[0280] In this embodiment, if the first connection module of device C determines that a pre-connection exists, it can compare whether the target device identifier of the target device (device A) is consistent with the device identifier of the pre-connected device (e.g., device D). If the target device identifier is inconsistent with the device identifier of the pre-connected device, it can be determined that the target device to be connected is different from the pre-connected device. It can further determine whether the pre-connection is used. If the pre-connection is not used, then S610 is executed: the first connection module of device C determines that a pre-connection exists and the pre-connection is not used, and disconnects the pre-connection.
[0281] After the pre-connection is disconnected, the first connection module of device C executes S611: the first connection module of device C sends a pre-connection disconnection response message to the second connection module of device C.
[0282] In this embodiment, if the first connection module of device C determines that there is no pre-connection, it can directly return no pre-connection through the pre-connection disconnection response message; if the first connection module of device C determines that there is a pre-connection, it can return the pre-connection disconnection result through the pre-connection disconnection response message after disconnecting the pre-connection.
[0283] S612: The second connection module of device C sends a connection negotiation request to the second connection module of device A.
[0284] In this embodiment, the connection negotiation request is used to request the negotiation of the configuration information used for this connection.
[0285] S613: The second connection module of device A sends a pre-connection disconnection command to the first connection module of device A.
[0286] In this embodiment, the pre-connection disconnect command is used to instruct the disconnection of an existing pre-connection.
[0287] S614: The first connection module of device A determines whether a pre-connection exists.
[0288] S615: The first connection module of device A determines that a pre-connection exists and is not in use, and disconnects the pre-connection.
[0289] S616a: The first connection module of device A updates the connection identifier.
[0290] In this embodiment, updating the connection identifier of device A includes deleting the pre-connection identifier corresponding to the pre-connection that has been disconnected.
[0291] S616b: The first connection module of device B updates the connection identifier.
[0292] In this embodiment, updating the connection identifier of device B includes deleting the pre-connection identifier corresponding to the pre-connection that has been disconnected.
[0293] S617: The first connection module of device A sends a pre-connection disconnection response message to the second connection module of device A.
[0294] In this embodiment, if the first connection module of device A determines that there is no pre-connection, it can directly return no pre-connection through the pre-connection disconnection response message; if the first connection module of device A determines that there is a pre-connection, it can return the pre-connection disconnection result through the pre-connection disconnection response message after disconnecting the pre-connection.
[0295] S618: The second connection module of device A sends a connection negotiation response to the second connection module of device C.
[0296] In this embodiment, the connection negotiation response includes information about the result of this connection negotiation.
[0297] S619: The second connection module of device A and the second connection module of device C establish a connection based on the negotiation result information.
[0298] S620a: The second connection module of device A returns a connection success message to the service module of device A.
[0299] S620b: The second connection module of device C returns a connection success message to the service module of device C.
[0300] S621: The business module of device C interacts with the business module of device A to exchange business data, thereby realizing the data transmission of the corresponding business.
[0301] The processing method described in the above embodiments enables the establishment of a new connection after the pre-connection is disconnected. Different connection modules are used to implement the new connection and the pre-connection separately, thereby achieving connection isolation between different connections, improving connection performance, further reducing the risk of conflicts between the new connection and the pre-connection, further increasing the success rate of establishing a connection between the first device and the second device, and enhancing the user experience. Furthermore, the new connection can be implemented using connection modules more suited to the new interactive business, which can improve the efficiency of business data interaction.
[0302] Other embodiments of this application provide an electronic device. The electronic device may include a memory and a processor, the memory being coupled to the processor. The memory stores computer program code, including computer instructions. When the electronic device is running, the processor executes the computer instructions stored in the memory to cause the electronic device to perform any of the method embodiments described above.
[0303] Other embodiments of this application provide a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, which is loaded and executed by a processor to implement the inter-device connection method provided in the above-described method embodiments.
[0304] Other embodiments of this application provide a computer program product that includes instructions that, when executed by an electronic device, enable the electronic device to implement the inter-device connection method provided in the embodiments of this application.
[0305] The embodiments of this application can be implemented in hardware, software, firmware, or a combination of these implementations. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0306] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.
[0307] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.
[0308] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media include any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.
[0309] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.
[0310] Each unit / module mentioned in the device embodiments of this application is a logical unit / module. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problem proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments have not introduced units / modules that are not closely related to solving the technical problem proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.
[0311] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for connecting devices, characterized in that, The method is applied to a first device, and the method includes: Before receiving the user's first operation, a pre-connection with a third device is established; the first operation is used to transmit the data of the first service of the first device to the third device, and the pre-connection indicates a connection that has been established for communication but has not yet carried a service. Display a first user interface, the first user interface including a first icon of the second device; In response to a second user action on the first icon, the pre-connection is disconnected, and a first connection is established between the first device and the second device. Disconnecting the pre-connection in response to the second user action on the first icon includes: upon receiving the second action, determining whether the second device and the third device are identical; if the second device and the third device are inconsistent, determining whether the pre-connection has been used; and disconnecting the pre-connection if it has not been used. The second action indicates that the first device needs to invoke a device of the second device to perform any operation corresponding to a function, and the fact that the pre-connection has not been used indicates that no business data interaction has occurred. Data for the second service is transmitted based on the first connection.
2. The method according to claim 1, characterized in that, The method further includes: Display a second user interface, which includes a second icon for the fourth device; In response to a third user action on the second icon, the pre-connection is disconnected, and a second connection is established between the first device and the fourth device; Data for the third service is transmitted based on the second connection.
3. The method according to claim 2, characterized in that, The pre-connection belongs to the first connection module of the first device, and the second connection belongs to the second connection module of the first device. The first connection module and the second connection module are different. The step of disconnecting the pre-connection in response to a third user action on the second icon includes: The second connection module sends a pre-connection disconnection command to the first connection module according to the third operation. The pre-connection disconnection command is used to indicate the disconnection of the pre-connection between the first device and the third device. The first connection module disconnects the pre-connection between the first device and the third device according to the pre-connection disconnection command.
4. The method according to claim 3, characterized in that, The first connection module and the second connection module may have the same or different connection methods.
5. The method according to claim 3, characterized in that, The step of disconnecting the pre-connection between the first device and the third device via the first connection module according to the pre-connection disconnection command includes: The first connection module determines whether a pre-connection exists between the first device and the third device based on the pre-connection disconnection command. If it is determined that a pre-connection exists between the first device and the third device, the first connection module determines whether the pre-connection between the first device and the third device has been used. If it is determined that a pre-connection exists between the first device and the third device and that the pre-connection is not in use, the pre-connection between the first device and the third device is disconnected.
6. The method according to claim 3 or 5, characterized in that, After the second connection module sends a pre-connection disconnection command to the first connection module according to the third operation, the method further includes: The first connection module sends a pre-connection disconnection response message to the second connection module. The pre-connection disconnection response message includes first information or second information. The first information is used to indicate that there is no pre-connection between the first device and the third device. The second information is used to indicate the pre-connection disconnection result between the first device and the third device. The pre-connection disconnection result includes whether the pre-connection has been disconnected or the pre-connection has not been disconnected. Establishing a second connection between the first device and the fourth device includes: If it is determined from the first information that the pre-connection does not exist or from the second information that the pre-connection has been broken, the second connection between the first device and the fourth device is established.
7. The method according to claim 1, characterized in that, The establishment of a pre-connection with the third device includes: The first device receives pre-connection capability information from the third device. The pre-connection capability information includes first indication information and second indication information. The first indication information is used to indicate whether the third device supports pre-connection capability, and the second indication information is used to indicate whether the third device supports pre-connection disconnection capability. When the first device determines that the third device supports pre-connection capability and pre-connection disconnection capability based on the pre-connection capability information, the pre-connection between the first device and the third device is established through a pre-connection establishment message, the pre-connection establishment message including a pre-connection identifier.
8. The method according to claim 7, characterized in that, The establishment of the pre-connection with the third device also includes: The pre-connection configuration allows preemption; The step of disconnecting the pre-connection in response to a second user action on the first icon includes: Upon receiving the second operation and if the pre-connection is allowed to be preempted, the pre-connection between the first device and the third device is disconnected.
9. The method according to claim 1, characterized in that, Before receiving the user's first action, a pre-connection with the third device is established, including: Based on the historical interaction information between the first device and the third device, it is determined whether the third device meets the pre-connection conditions; If the third device meets the pre-connection conditions, a pre-connection with the third device is established; The historical interaction information includes interaction information of the first device and the third device establishing a connection and transmitting data for the fourth service.
10. An electronic device, characterized in that, include: A memory and a processor, wherein the memory is coupled to the processor; The memory stores computer program code, which includes computer instructions. When the computer instructions are executed by the processor, the electronic device performs the device connection method according to any one of claims 1 to 9.
11. A computer-readable medium, characterized in that, The computer-readable medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the inter-device connection method according to any one of claims 1 to 9.
12. A program product, characterized in that, The program product includes instructions that, when executed on an electronic device, cause the electronic device to perform the inter-device connection method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Bluetooth connection method and electronic equipment
CN115087134A
Equipment connection method and device, electronic equipment and readable storage medium
CN116801425A