Equipment connection method and device, equipment and storage medium
By obtaining role information and supported connection methods between devices, flexibly determining the connection methods and roles between devices, the problem of inflexible connections between devices in the prior art is solved and the connection efficiency is improved.
Patent Information
- Application Number
- CN202311360480.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-19
- Publication Date
- 2025-04-22
AI Technical Summary
In the prior art, the connection mode and role between devices are fixed, resulting in inflexible connection and low efficiency, making it difficult to adapt to the interconnection needs between different devices.
Through the first connection established with the second device, its role information is obtained, the target connection method is determined from a plurality of preset connection methods according to the roles supported by itself and the second device, and the target role is determined based on the candidate role and priority, and the second connection is finally established.
It realizes flexible determination of the connection mode and role between devices, and improves the interconnection efficiency and flexibility between devices.
Smart Images

Figure CN119865931A_ABST
Abstract
Description
Technical Field
[0001] The technical solution disclosed herein relates to the field of computer communication technology, and in particular to a device connection method, apparatus, device and storage medium. Background Art
[0002] With the continuous development of communication technology and terminal technology, users have higher expectations for the interconnection and interoperability between devices. In related technologies, devices can be connected through P2P or SoftAP-STA, and the connection mode and roles between devices are fixed. For example, when using P2P connection, one of the parties is fixed as GO or GC, and when using SoftAP-STA connection, one of the parties is fixed as SoftAP or STA. This connection mode is not flexible and the connection efficiency is not high. Summary of the invention
[0003] In view of this, the present disclosure provides a device connection method, apparatus, device and storage medium to increase the flexibility of connection.
[0004] According to a first aspect of an embodiment of the present disclosure, a device connection method is provided, which is applied to a first device, and the method includes:
[0005] Acquire role information of the second device through a first connection established with the second device, the role information including roles supported by the second device; determine a target connection mode of the first device and the second device from a plurality of preset connection modes according to the roles supported by the first device and the roles supported by the second device; determine a target role played by the first device in the target connection mode according to the candidate roles played by the first device and the second device in the target connection mode; establish a second connection with the second device according to the target connection mode and the target role played by the first device.
[0006] In some embodiments, the first connection is any one of a Bluetooth connection, a LAN connection or an NFC connection; the second connection is any one of a group server GO-group client GC connection, a group server GO-site STA connection or a soft access point SoftAP-site STA connection.
[0007] In some embodiments, determining the target connection mode of the first device and the second device from a plurality of preset connection modes according to the roles supported by the first device and the roles supported by the second device includes: determining at least one candidate connection mode supported by the first device and the second device from a plurality of preset connection modes according to the roles supported by the first device and the roles supported by the second device; and determining the target connection mode of the first device and the second device according to pre-set priorities of the candidate connection modes.
[0008] In some embodiments, the role information also includes a priority level corresponding to each role;
[0009] The determining, according to the candidate roles played by the first device and the second device in the target connection mode, a target role played by the first device in the target connection mode includes:
[0010] If some of the candidate roles played by the first device and the second device in the target connection mode are the same, determining the target role played by the first device in the target connection mode according to the priorities of the same candidate roles played by the first device and the second device;
[0011] If the candidate roles played by the first device and the second device in the target connection mode are different, the candidate role played by the first device is determined as the target role played by the first device in the target connection mode.
[0012] In some embodiments, determining the target role played by the first device in the target connection mode according to the priorities of the same candidate roles played by the first device and the second device includes:
[0013] If the candidate roles played by the first device and the second device both include GO, or the candidate roles played by the first device and the second device both include SoftAP, determining the target role played by the first device in the target connection mode according to the priority of the candidate role played by the first device and the priority of the candidate role played by the second device;
[0014] If the priority of the first device as a GO is the same as the priority of the second device as a GO, or the priority of the first device as a SoftAP is the same as the priority of the second device as a SoftAP, the target role of the first device in the target connection mode is determined according to the initiator identifier of the first device.
[0015] In some embodiments, the method also includes: determining a first score of the first device as a GO or SoftAP based on the device type of the first device; if the first device has a specific function that complies with the agreement, determining a second score based on the association between the specific function and the preset score; determining a target score of the first device as a GO or SoftAP based on the first score and the second score, and the target score is used to indicate the priority of the first device as a GO or SoftAP.
[0016] In some embodiments, establishing a second connection with the second device according to the target connection mode and the target role played by the first device includes: initiating a connection using the target connection mode based on the target role played by the first device; if the target role of the first device is GO or SoftAP, sending configuration information to the second device so that the second device establishes a second connection with the first device based on the configuration information; if the target role of the first device is GC or STA, receiving the configuration information sent by the second device, and establishing a second connection with the second device according to the configuration information.
[0017] According to a second aspect of an embodiment of the present disclosure, a device connection apparatus is provided, the apparatus comprising:
[0018] an acquiring unit, configured to acquire role information of the second device through a first connection established with the second device, wherein the role information includes roles supported by the second device;
[0019] A selection unit, configured to determine a target connection mode between the first device and the second device from a plurality of preset connection modes according to roles supported by the first device and roles supported by the second device;
[0020] a determining unit, configured to determine a target role played by the first device in the target connection mode according to candidate roles played by the first device and the second device in the target connection mode;
[0021] A connecting unit is used to establish a second connection with the second device according to the target connection mode and the target role played by the first device.
[0022] According to a third aspect of an embodiment of the present disclosure, there is provided a non-temporary computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of any method described in the first aspect are implemented.
[0023] According to a fourth aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0024] processor;
[0025] a memory for storing processor-executable instructions;
[0026] Wherein, the processor is configured to:
[0027] Acquire role information of the second device through a first connection established with the second device, the role information including roles supported by the second device;
[0028] Determining a target connection mode between the first device and the second device from a plurality of preset connection modes according to the roles supported by the first device and the roles supported by the second device;
[0029] Determining a target role played by the first device in the target connection mode according to the candidate roles played by the first device and the second device in the target connection mode;
[0030] A second connection is established with the second device according to the target connection mode and the target role played by the first device.
[0031] The technical solution provided by the embodiment of the present disclosure may include the following beneficial effects: obtaining the role information of the second device through the first connection established with the second device, the role information including the roles supported by the second device; determining the target connection mode of the first device and the second device from a plurality of preset connection modes according to the roles supported by the first device and the roles supported by the second device; determining the target role played by the first device in the target connection mode according to the candidate roles played by the first device and the second device in the target connection mode; establishing a second connection with the second device according to the target connection mode and the target role played by the first device. The present disclosure can determine the connection mode and the role played between the present device and the opposite device, thereby increasing the flexibility of device interconnection and improving connection efficiency.
[0032] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0034] Figure 1 is a flow chart of a device connection method according to an exemplary embodiment of the present disclosure;
[0035] Figure 2 is an interactive flow chart of a device connection method according to an exemplary embodiment of the present disclosure;
[0036] Figure 3 is a schematic structural diagram of a device connection apparatus in an exemplary embodiment of the present disclosure;
[0037] Figure 4 It is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0038] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0039] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0040] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0041] In order to facilitate understanding of the device connection method provided by the present disclosure, the concepts involved in the present disclosure will be explained below.
[0042] P2P (peer-to-peer, point-to-point direct connection technology), the P2P in this disclosure corresponds to the WiFiDirect protocol launched by the Wi-Fi Alliance, also known as WiFi Direct, WiFi (Wireless Fidelity) direct connection, WLAN (WirelessLan, wireless local area network) direct connection, etc.
[0043] Soft Access Point (SoftAP), also known as soft AP / Hotspot / hotspot / portable hotspot, etc.
[0044] Station (STA), a type of WLAN mode. In the present disclosure, the connection between devices through a soft access point is referred to as a soft access point-station connection, or SoftAP-STA connection for short.
[0045] When a P2P connection is established, a group Group will be generated. When forming a P2P group, the device that supports the P2P function is called a P2P Device. Through P2P negotiation, one of the devices plays the role of the group server (P2P Group Owner, GO), and the other devices play the role of the group client (P2P Group Client, GC), thus forming a P2P Group. In this disclosure, the way of connecting between devices based on the P2P protocol is called a group server-group client connection, referred to as a GO-GC connection.
[0046] Since the function of GO is similar to that of AP, STAs that do not support P2P function (i.e. cannot process P2P protocol) can also find and connect to GO, and such STAs are called Legacy Clients. In this disclosure, such connection mode is called group server-station connection, or GO-STA connection for short.
[0047] In the related art, two devices can use a standard P2P connection or a SoftAP-STA connection, and the connection scheme between the devices and the roles of the devices in the connection are fixed. For example, when devices of the same type use a P2P connection, the initiator is designated as the GO. For another example, when different types of devices use a P2P connection, one type of device is fixed as a GO or GC, and when using a SoftAP connection, one type of device is fixed as a SoftAP or STA. For example, when a Pad and a mobile phone use a P2P connection, the Pad is fixed as a GO and the mobile phone is fixed as a GC; when a mobile phone and a computer use a P2P connection, the computer is fixed as a GO and the mobile phone is fixed as a GC.
[0048] That is to say, when using relevant technologies to interconnect devices, the connection scheme and roles between devices are fixed, but this fixed connection scheme is not necessarily the best. In addition, if new devices are added later, the connection scheme and roles need to be re-added or specified, resulting in inflexible interconnection between devices.
[0049] In view of this, the present disclosure provides a device connection method applicable to devices supporting WLAN function. Each device can select a better connection solution through the connection method, and determine the corresponding role of each device by itself, so as to achieve fast and efficient connection between devices. The devices supporting WLAN function in the present disclosure may include Android devices, Windows devices, Linux devices, Apple devices, Internet of Things (IOT) devices, wireless APs, etc.
[0050] The embodiments of the present disclosure involve interconnection between two devices. For the convenience of description, one of the devices is referred to as a first device and the other device is referred to as a second device. In addition, since the implementation method of the present disclosure in any device is the same, the following embodiments will be combined with the drawings to introduce the device connection method of the embodiments of the present disclosure by taking the first device as an example.
[0051] Figure 1 is a flow chart of a device connection method according to an exemplary embodiment of the present disclosure. Figure 1 As shown, the exemplary embodiment method may include the following steps 101 to 104 .
[0052] In step 101, role information of a second device is acquired through a first connection established with the second device.
[0053] The first device may obtain the role information of the second device through a first connection established with the second device. The first connection may be an out-of-band (OOB) connection, and the OOB connection may be any one of a Bluetooth connection, a local area network connection, or a Near Field Communication (NFC) connection. The Bluetooth connection may include a traditional Bluetooth connection or a Bluetooth Low Energy (BLE) connection.
[0054] The first device may initiate a first connection request to the second device, thereby establishing a first connection with the second device; the first device may also establish a first connection with the second device by responding to the first connection request initiated by the second device, which is not limited in the present disclosure.
[0055] After establishing a first connection with the second device, the role information of the second device can be obtained through the first connection, and the role information may include roles supported by the second device. Assuming that the second device is an IOT device, the role supported by the second device is STA.
[0056] In this embodiment, the roles supported by the device can be determined according to the hardware and firmware design of the device. For example, the roles supported by the device can be determined according to the operating system version of the device, the model of the core chip, etc. The roles supported by the device are also called the capabilities of the device. In this embodiment, the roles corresponding to different hardware and firmware designs can be preset.
[0057] In some embodiments, the roles supported by the device can be pre-set. Suppose the roles that the device can support include GO, SoftAP, GC and STA, but for other considerations, the device is expected to focus on being a GO. For example, the device has a higher version and better processing efficiency when used as a GO. Therefore, the role that the device can support can be set to GO.
[0058] In step 102, according to the roles supported by the first device and the roles supported by the second device, a target connection mode of the first device and the second device is determined from a plurality of preset connection modes.
[0059] In this embodiment, the multiple preset connection modes may include GO-GC connection, SoftAP-STA connection, GO-STA connection, and other connections.
[0060] When the roles supported by the first device and the roles supported by the second device are known, the connection mode between the first device and the second device can be determined. Assuming that the roles supported by the first device include GO, SoftAP and GC, and the roles supported by the second device include GO and GC, the first device and the second device can be connected through GO-GC.
[0061] In step 103, a target role played by the first device in the target connection mode is determined according to the candidate roles played by the first device and the second device in the target connection mode.
[0062] When the target connection mode is determined, the role of the first device in the target connection mode is a candidate role of the first device. Similarly, the role of the second device in the target connection mode is a candidate role of the second device.
[0063] In the target connection mode, there may be two situations. If the candidate roles played by the first device and the second device are different, the candidate role played by the first device is determined as the target role. For example, if the candidate role of the first device is GO and the candidate role of the second device is GC, the target role of the first device is GO. If some of the candidate roles played by the first device and the second device are the same, the target role played by the first device in the target connection mode is determined according to the priority of the same candidate roles played by the first device and the second device.
[0064] Those skilled in the art should understand that, when some of the candidate roles played by the first device and the second device are the same, in addition to determining the target role of the first device according to the priority of the same candidate role, the target role of the first device may also be determined by random assignment. For example, when the candidate roles of the first device include GO and GC, and the candidate roles of the second device also include GO and GC, the initiator may be designated as GO and the other party as GC; or the target role of the first device may be randomly designated as GO and the target role of the second device may be randomly designated as GC. In this case, the second device may be informed of the designated role through the first connection method, and the present disclosure is not limited to this.
[0065] In step 104, a second connection is established with the second device according to the target connection mode and the target role played by the first device.
[0066] The second connection is any one of a GO-GC connection, a GO-STA connection or a SoftAP-STA connection, which is specifically determined according to the selected target connection mode.
[0067] It can be known from the above embodiments that the present disclosure obtains the role information of the second device through the first connection established with the second device, the role information includes the roles supported by the second device and the priorities corresponding to each role; determines the target connection mode of the first device and the second device from a plurality of preset connection modes according to the roles supported by the first device and the roles supported by the second device; determines the target role of the first device in the target connection mode according to the priorities of the candidate roles played by the first device and the second device in the target connection mode; establishes a second connection with the second device according to the target connection mode and the target role played by the first device. The present disclosure can select the connection mode and the respective roles according to the capabilities of each device, thereby realizing the establishment of a connection between different devices.
[0068] As devices are upgraded, the capabilities of each device become more and more abundant, and multiple connection modes may be determined when determining the target connection mode according to the capabilities of the device. In this case, determining the target connection mode of the first device and the second device from multiple preset connection modes according to the roles supported by the first device and the roles supported by the second device may include: determining at least one candidate connection mode supported by the first device and the second device from multiple preset connection modes according to the roles supported by the first device and the roles supported by the second device; determining the target connection mode of the first device and the second device according to the pre-set priorities of the candidate connection modes.
[0069] By setting priorities for multiple connection methods, the optimal target connection method is determined for interconnection between devices.
[0070] In this embodiment, the priorities of the connection modes may be set in the following order: GO-GC connection>SoftAP-STA connection>GO-STA connection>other connections.
[0071] Assuming that the roles supported by the first device include GO, SoftAP, GC and STA, and the roles supported by the second device also include GO, SoftAP, GC and STA, the candidate connection modes supported by the first device and the second device include GO-GC connection, SoftAP-STA connection and GO-STA connection. According to the priority of the preset connection mode, it can be determined that the target connection mode of the first device and the second device is GO-GC connection.
[0072] In the case of determining the target connection mode, if some of the candidate roles played by the first device and the second device are the same, the target role corresponding to the first device can be determined based on the role priority, that is, the role information also includes the priority corresponding to each role. In this case, determining the target role played by the first device in the target connection mode based on the candidate roles played by the first device and the second device in the target connection mode may include: if some of the candidate roles played by the first device and the second device in the target connection mode are the same, determining the target role played by the first device in the target connection mode based on the priority of the same candidate roles played by the first device and the second device.
[0073] Different devices can have different priorities when playing the same role. For example, both device A and device B can be used as GO, but the priority of device A as GO can be set higher than the priority of device B as GO according to the device type. For another example, both device C and device D can be used as SoftAP, but the priority of device D as SoftAP can be set higher than the priority of device C as SoftAP according to the device type.
[0074] If the candidate roles played by the first device and the second device both include GO, or the candidate roles played by the first device and the second device both include SoftAP, the target role played by the first device in the target connection mode is determined according to the priority of the candidate role played by the first device and the priority of the candidate role played by the second device.
[0075] That is, when the target connection mode is a SoftAP-STA connection mode, if the priority of the first device as a SoftAP is higher than the priority of the second device as a SoftAP, it is determined that the target role of the first device in the target connection mode is a SoftAP;
[0076] When the target connection mode is a GO-GC connection mode or a GO-STA connection mode, if the priority of the first device as a GO is higher than the priority of the second device as a GO, it is determined that the target role of the first device in the target connection mode is a GO.
[0077] For example, when the target connection mode is GO-GC connection, the candidate roles of the first device include GO and GC, and the candidate roles of the second device also include GO and GC. In this case, the target role of the first device in the target connection mode can be determined based on the priority of the candidate role played by the first device and the priority of the candidate role played by the second device.
[0078] Assuming that the priority of the first device as a GO is higher than the priority of the second device as a GO, the target role played by the first device in the target connection mode is GO.
[0079] Assuming that the priority of the first device as a GO is lower than the priority of the second device as a GO, the target role played by the first device in the target connection mode is GC.
[0080] If the priority of the first device as a GO is the same as the priority of the second device as a GO, or the priority of the first device as a SoftAP is the same as the priority of the second device as a SoftAP, the target role of the first device in the target connection mode is determined according to the initiator identifier of the first device.
[0081] Assuming that it is pre-set that when the role priorities are the same, the initiator is the GO or SoftAP, then when the initiator identifier of the first device indicates that the first device is the initiator, it is determined that the target role played by the first device in the target connection mode is GO or SoftAP. Similarly, assuming that it is pre-set that when the role priorities are the same, the receiver is the GO or SoftAP, then when the initiator identifier of the first device indicates that the first device is the initiator, it is determined that the target role played by the first device in the target connection mode is GC or STA.
[0082] It should be noted that if the candidate roles played by the first device and the second device in the target connection mode are different, the candidate role played by the first device is determined as the target role played by the first device in the target connection mode.
[0083] In addition to being determined according to the device type, the priority in the above embodiment can also be determined in the following manner: determining a first score of the first device as a GO or SoftAP according to the device type of the first device; if the first device has a specific function that complies with the agreement, determining a second score based on the association between the specific function and the preset score; determining a target score for the first device as a GO or SoftAP based on the first score and the second score, and the target score is used to indicate the priority of the first device as a GO or SoftAP.
[0084] The above method can be used to quantify the priority, which is convenient for comparison between interconnected devices. In addition, the above method of determining the priority can meet specific needs. For example, when the device's capability iteration is fast, devices with specific capabilities can be designated as GO or SoftAP. For example, scores corresponding to different capabilities can be pre-set, such as 25 points for supporting WiFi7. For example, assuming that the first score corresponding to a mobile phone type device is 100, and the first score corresponding to a Pad type device is 110, if the device supports WiFi7, 25 points will be added separately. The target score representing the priority can be obtained by summing the first score and the second score.
[0085] In some embodiments, establishing a second connection with the second device according to the target connection mode and the target role played by the first device may include: initiating a connection using the target connection mode based on the target role played by the first device; if the target role of the first device is GO or SoftAP, sending configuration information to the second device so that the second device establishes a second connection with the first device based on the configuration information; if the target role of the first device is GC or STA, receiving the configuration information sent by the second device, and establishing a second connection with the second device according to the configuration information.
[0086] The configuration information may include a service set identifier (SSID) and a connection password.
[0087] Through the present disclosure, when a device has more capabilities by updating the firmware version, the optimal connection scheme and role can be selected according to the capabilities, avoiding the use of a fixed connection scheme that affects the connection effect.
[0088] For ease of understanding, an interaction embodiment of the first device and the second device will be introduced below. In the description of this embodiment, the same steps as in any of the foregoing embodiments will be briefly described and will not be described in detail. For details, please refer to any of the foregoing embodiments.
[0089] Before implementation, a unified connection mode priority and role selection scheme is pre-established, i.e., connection mode priority and role priority. The connection mode priority may include GO-GC connection > SoftAP-STA connection > GO-STA connection > others. The role selection scheme may include, preferably selecting a device with a higher GO or SoftAP priority as the GO or SoftAP, and if the priorities are the same, selecting the initiator (or non-initiator) as the GO or SoftAP.
[0090] Figure 2 is an interactive flow chart of a device connection method according to an exemplary embodiment of the present disclosure, such as Figure 2 As shown, the first device and the second device are connected through the method provided by the present disclosure, and the method includes the following steps:
[0091] In step 201, interconnected devices establish an OOB connection, such as a Bluetooth connection or an NFC connection.
[0092] In step 202, the interconnected devices query their own capabilities.
[0093] The capabilities to be queried may include: supported roles, such as GO, GC, SoftAP or STA, etc.; the priority of being a GO or SoftAP according to the device itself; whether to be an initiator, that is, the initiator identifier.
[0094] In step 203, each other's capabilities are acquired through the OOB connection.
[0095] In step 204, based on each other's capabilities, the preset connection mode and the role selection mode, the target connection mode of the interconnection and the target role to be assumed are confirmed.
[0096] If the target connection mode is determined to be a GO-GC connection based on the role combination supported by each other, the role played by the device is GO or GC; if the target connection mode is a SoftAP-STA connection, the role played by the device is SoftAP or STA; if the target connection mode is a GO-STA connection, the role played by the device is GO or STA.
[0097] In step 205, a connection is initiated according to the target connection mode and the target role.
[0098] Through the present disclosure, the optimal WLAN interconnection solution and the role of each device can be automatically and flexibly selected based on the capabilities of both interconnected devices.
[0099] For the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present disclosure is not limited by the described order of actions, because according to the present disclosure, certain steps can be performed in other orders or simultaneously.
[0100] Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
[0101] Corresponding to the aforementioned application function implementation method embodiment, the present disclosure also provides an application function implementation device and a corresponding terminal embodiment.
[0102] Figure 3 is a schematic diagram of the structure of a device connection device in an exemplary embodiment of the present disclosure, such as Figure 3 As shown, the device connection device may include:
[0103] An acquiring unit 301 is configured to acquire role information of a second device through a first connection established with the second device, wherein the role information includes roles supported by the second device;
[0104] A selection unit 302, configured to determine a target connection mode of the first device and the second device from a plurality of preset connection modes according to roles supported by the first device and roles supported by the second device;
[0105] A determining unit 303, configured to determine a target role played by the first device in the target connection mode according to candidate roles played by the first device and the second device in the target connection mode;
[0106] The connecting unit 304 is configured to establish a second connection with the second device according to the target connection mode and the target role played by the first device.
[0107] In some embodiments, the selection unit 302 is specifically used to: determine at least one candidate connection method supported by the first device and the second device from multiple preset connection methods based on the roles supported by the first device and the roles supported by the second device; determine the target connection method of the first device and the second device based on the pre-set priorities of each candidate connection method.
[0108] In some embodiments, the role information further includes the priority corresponding to each role; the determining unit 303 is specifically used to:
[0109] If some of the candidate roles played by the first device and the second device in the target connection mode are the same, determining the target role played by the first device in the target connection mode according to the priorities of the same candidate roles played by the first device and the second device;
[0110] If the candidate roles played by the first device and the second device in the target connection mode are different, the candidate role played by the first device is determined as the target role played by the first device in the target connection mode.
[0111] In some embodiments, the determining unit 303 is specifically configured to:
[0112] If the candidate roles played by the first device and the second device both include GO, or the candidate roles played by the first device and the second device both include SoftAP, determining the target role played by the first device in the target connection mode according to the priority of the candidate role played by the first device and the priority of the candidate role played by the second device;
[0113] If the priority of the first device as a GO is the same as the priority of the second device as a GO, or the priority of the first device as a SoftAP is the same as the priority of the second device as a SoftAP, the target role of the first device in the target connection mode is determined according to the initiator identifier of the first device.
[0114] In some embodiments, the connection unit 304 is specifically used to: initiate a connection using the target connection method based on the target role of the first device; if the target role of the first device is GO or SoftAP, send configuration information to the second device so that the second device establishes a second connection with the first device based on the configuration information; if the target role of the first device is GC or STA, receive the configuration information sent by the second device, and establish a second connection with the second device based on the configuration information.
[0115] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are only schematic, wherein the units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the disclosed solution. A person of ordinary skill in the art may understand and implement it without creative work.
[0116] Accordingly, an embodiment of the present disclosure provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to:
[0117] Acquire role information of the second device through a first connection established with the second device, the role information including roles supported by the second device;
[0118] Determining a target connection mode between the first device and the second device from a plurality of preset connection modes according to the roles supported by the first device and the roles supported by the second device;
[0119] Determining a target role played by the first device in the target connection mode according to the candidate roles played by the first device and the second device in the target connection mode;
[0120] A second connection is established with the second device according to the target connection mode and the target role played by the first device.
[0121] Figure 4 4 is a schematic diagram of the structure of an electronic device 400 according to an exemplary embodiment. For example, the electronic device 400 may be a user device, and may specifically be a mobile phone, a computer, a digital broadcast terminal, a message transceiver device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, a wearable device such as a smart watch, a smart glasses, a smart bracelet, a smart running shoe, etc.
[0122] Reference Figure 4 , the electronic device 400 may include one or more of the following components: a processing component 402 , a memory 404 , a power component 406 , a multimedia component 408 , an audio component 410 , an input / output (I / O) interface 412 , a sensor component 414 , and a communication component 416 .
[0123] The processing component 402 generally controls the overall operation of the electronic device 400, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 402 may include one or more modules to facilitate the interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate the interaction between the multimedia component 408 and the processing component 402.
[0124] The memory 404 is configured to store various types of data to support operations on the device 400. Examples of such data include instructions for any application or method operating on the electronic device 400, contact data, phone book data, messages, pictures, videos, etc. The memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0125] The power supply component 406 provides power to the various components of the electronic device 400. The power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 400.
[0126] The multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front camera and / or a rear camera. When the electronic device 400 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0127] The audio component 410 is configured to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC), and when the electronic device 400 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 404 or sent via the communication component 416. In some embodiments, the audio component 410 also includes a speaker for outputting audio signals.
[0128] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0129] The sensor assembly 414 includes one or more sensors for providing various aspects of status assessment for the electronic device 400. For example, the sensor assembly 414 can detect the open / closed state of the electronic device 400, the relative positioning of the components, such as the display and keypad of the electronic device 400, and the sensor assembly 414 can also detect the position change of the electronic device 400 or a component of the electronic device 400, the presence or absence of contact between the user and the electronic device 400, the orientation or acceleration / deceleration of the electronic device 400, and the temperature change of the electronic device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 414 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0130] The communication component 416 is configured to facilitate wired or wireless communication between the electronic device 400 and other devices. The electronic device 400 can access a wireless network based on a communication standard, such as WiFi, 4G or 5G, 4G LTE, 5G NR or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0131] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0132] In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided, such as a memory 404 including instructions, which, when executed by a processor 420 of an electronic device 400, enables the electronic device 400 to perform a device connection method, the method comprising:
[0133] Acquire role information of the second device through a first connection established with the second device, the role information including roles supported by the second device;
[0134] Determining a target connection mode between the first device and the second device from a plurality of preset connection modes according to the roles supported by the first device and the roles supported by the second device;
[0135] Determining a target role played by the first device in the target connection mode according to the candidate roles played by the first device and the second device in the target connection mode;
[0136] A second connection is established with the second device according to the target connection mode and the target role played by the first device.
[0137] The non-transitory computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0138] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0139] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A device connection method, characterized in that: Applied to a first device, the method includes: Acquire role information of the second device through a first connection established with the second device, the role information including roles supported by the second device; Determining a target connection mode between the first device and the second device from a plurality of preset connection modes according to the roles supported by the first device and the roles supported by the second device; Determining a target role played by the first device in the target connection mode according to the candidate roles played by the first device and the second device in the target connection mode; A second connection is established with the second device according to the target connection mode and the target role played by the first device.
2. The method according to claim 1, characterized in that The first connection is any one of a Bluetooth connection, a local area network connection or an NFC connection; the second connection is any one of a group server GO-group client GC connection, a group server GO-site STA connection or a soft access point SoftAP-site STA connection.
3. The method according to claim 1, characterized in that The determining, according to the roles supported by the first device and the roles supported by the second device, a target connection mode between the first device and the second device from a plurality of preset connection modes includes: Determining at least one candidate connection mode supported by the first device and the second device from a plurality of preset connection modes according to the roles supported by the first device and the roles supported by the second device; The target connection modes of the first device and the second device are determined according to the preset priorities of the candidate connection modes.
4. The method according to claim 1, characterized in that: The role information also includes the priority corresponding to each role; The determining, according to the candidate roles played by the first device and the second device in the target connection mode, a target role played by the first device in the target connection mode includes: If some of the candidate roles played by the first device and the second device in the target connection mode are the same, determining the target role played by the first device in the target connection mode according to the priorities of the same candidate roles played by the first device and the second device; If the candidate roles played by the first device and the second device in the target connection mode are different, the candidate role played by the first device is determined as the target role played by the first device in the target connection mode.
5. The method according to claim 4, characterized in that The determining, according to the priorities of the same candidate roles played by the first device and the second device, the target role played by the first device in the target connection mode includes: If the candidate roles played by the first device and the second device both include GO, or the candidate roles played by the first device and the second device both include SoftAP, determining the target role played by the first device in the target connection mode according to the priority of the candidate role played by the first device and the priority of the candidate role played by the second device; If the priority of the first device as a GO is the same as the priority of the second device as a GO, or the priority of the first device as a SoftAP is the same as the priority of the second device as a SoftAP, the target role of the first device in the target connection mode is determined according to the initiator identifier of the first device.
6. The method according to claim 5, characterized in that The method further comprises: Determine a first score of the first device as a GO or a SoftAP according to the device type of the first device; If the first device has the agreed specific function, determining a second score according to the association between the specific function and the preset score; A target score for the first device to serve as a GO or a SoftAP is determined according to the first score and the second score, where the target score is used to indicate a priority of the first device to serve as a GO or a SoftAP.
7. The method according to claim 1, characterized in that The establishing a second connection with the second device according to the target connection mode and the target role played by the first device includes: Initiate connection using the target connection mode based on the target role played by the first device; If the target role of the first device is GO or SoftAP, sending configuration information to the second device, so that the second device establishes a second connection with the first device based on the configuration information; If the target role of the first device is GC or STA, the configuration information sent by the second device is received, and a second connection is established with the second device according to the configuration information.
8. A device connection device, characterized in that: The device comprises: an acquiring unit, configured to acquire role information of the second device through a first connection established with the second device, wherein the role information includes roles supported by the second device; A selection unit, configured to determine a target connection mode between the first device and the second device from a plurality of preset connection modes according to roles supported by the first device and roles supported by the second device; a determining unit, configured to determine a target role played by the first device in the target connection mode according to candidate roles played by the first device and the second device in the target connection mode; A connecting unit is used to establish a second connection with the second device according to the target connection mode and the target role played by the first device.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the method according to any one of claims 1 to 7.