Device connection method, apparatus, and electronic device
By outputting status information and dynamically adjusting the connection role before connecting electronic devices, the problem of low connection efficiency in existing technologies is solved, and higher data transmission rates and stability are achieved.
Patent Information
- Application Number
- CN202610685432.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-18
- Publication Date
- 2026-07-17
AI Technical Summary
In existing technologies, the connection establishment methods of electronic devices in big data migration scenarios are inefficient, resulting in the waste of the high-performance hardware advantages of new devices and increased transmission time.
Before connecting, electronic devices first enable their own hotspot and output connection credentials containing their own status information, dynamically adjusting the connection role to ensure that the access point is always established on the appropriate device, thus achieving intelligent switching.
By intelligently switching between connection roles, the data transmission rate is improved, the transmission time is reduced, and both hardware components can operate at a high physical speed, thereby improving transmission efficiency and stability.
Smart Images

Figure CN122421087A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of communication technology, specifically relating to a device connection method, apparatus, and electronic device. Background Technology
[0002] In scenarios involving the migration of large amounts of data between electronic devices, such as mobile phone migration and device switching assistant applications, high-speed transmission channels are typically established using wireless direct connection technology. A common connection establishment method involves the user selecting "I am the new device" on the new device and enabling a hotspot. The new device generates a QR code containing hotspot information. The user then scans this QR code with their old device to obtain the hotspot information and connect to the new device's hotspot, subsequently initiating data transmission. This connection establishment method has certain limitations and is prone to low transmission efficiency. Summary of the Invention
[0003] The purpose of this application is to provide a device connection method, apparatus, and electronic device that can improve data transmission rate in data migration scenarios.
[0004] In a first aspect, embodiments of this application provide a device connection method applied to a first electronic device, the device connection method comprising: The first electronic device acts as an access point and outputs first connection credential information; wherein, the first connection credential information includes the first device status information of the first electronic device. Upon detecting the second connection credential information of the second electronic device, the first electronic device establishes a connection with the second electronic device as a site.
[0005] Secondly, embodiments of this application provide a device connection method applied to a second electronic device, the device connection method comprising: Obtain first connection credential information of the first electronic device; wherein, the first connection credential information includes first device status information of the first electronic device; Based on the status information of the first device and the second device status information of the second electronic device, determine the one that will serve as the access point from the first electronic device and the second electronic device. If the second electronic device is identified as the access point, the second connection credential information is output.
[0006] Thirdly, embodiments of this application provide a device connection apparatus applied to a first electronic device, the device connection apparatus comprising: The output module is used for the first electronic device to output first connection credential information as an access point; wherein, the first connection credential information includes the first device status information of the first electronic device; A connection establishment module is provided for the first electronic device to establish a connection with the second electronic device as a site upon detection of the second connection credential information of the second electronic device.
[0007] Fourthly, embodiments of this application provide a device connection apparatus applied to a second electronic device, the device connection apparatus comprising: The acquisition module is used to acquire the first connection credential information of the first electronic device; wherein, the first connection credential information includes the first device status information of the first electronic device; The determining module is used to determine, based on the first device status information and the second device status information of the second electronic device, one of the first electronic device and the second electronic device as the access point; The output module is used to output the second connection credential information when the determining module determines that the second electronic device is the access point.
[0008] Fifthly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the method as described in the first aspect, or the steps of the method as described in the second aspect.
[0009] In a sixth aspect, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method as described in the first aspect, or the steps of the method as described in the second aspect.
[0010] In a seventh aspect, embodiments of this application provide a chip, which includes a processor and a communication interface coupled to the processor. The processor is used to run a program or instructions to implement the steps of the method as described in the first aspect, or the steps of the method as described in the second aspect.
[0011] Eighthly, embodiments of this application provide a computer program product stored in a storage medium, which, when executed by at least one processor, implements the steps of the method as described in the first aspect, or the steps of the method as described in the second aspect.
[0012] Understandably, the electronic device provided in the fifth aspect, the readable storage medium provided in the sixth aspect, the chip provided in the seventh aspect, and the computer program product provided in the eighth aspect are all used to execute the device connection method provided in this application. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods, and will not be repeated here.
[0013] In this embodiment, before the second electronic device establishes a connection with the first electronic device, the first electronic device first outputs first connection credential information as an access point. Upon detecting the second connection credential information of the second electronic device, the first electronic device establishes a connection with the second electronic device as a site. That is, before establishing a connection, the first electronic device in this embodiment first turns on its own hotspot and outputs connection credential information containing its own status information. This helps the other end obtain the device status information of the first electronic device without establishing a connection, providing a data foundation for subsequent dynamic decision-making. When the first electronic device detects the second connection credential information, it switches its connection role and establishes a connection with the other end as a site. The above scheme realizes intelligent switching of connection roles, which helps to ensure that the access point is always established on the appropriate device, reducing data transmission time and improving data transmission rate. Attached Figure Description
[0014] Figure 1 This is a schematic diagram illustrating an application scenario of a device connection method provided in an embodiment of this application; Figure 2 A flowchart illustrating a device connection method provided in an embodiment of this application; Figure 3 A flowchart illustrating another device connection method provided in this application embodiment; Figure 4 A flowchart illustrating another device connection method provided in this application embodiment; Figure 5 A flowchart illustrating the connection establishment between a first electronic device and a second electronic device provided in this application embodiment; Figure 6 A flowchart illustrating data transmission between a first electronic device and a second electronic device, as provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a device connection device provided in an embodiment of this application; Figure 8 This is a schematic diagram of another device connection device provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application; Figure 10 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0015] 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. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0016] The terms "first," "second," etc., used in this application's specification are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, in the specification, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects have an "or" relationship.
[0017] In scenarios involving the migration of large amounts of data between two devices, such as mobile phone transfers or device switching, high-speed transmission channels are typically established using wireless technologies like Wi-Fi Direct. Current connection establishment methods primarily involve the new device creating a hotspot, and the old device scanning a QR code to connect. Once the hotspot is identified, it cannot be changed.
[0018] However, in reality, the capabilities of new devices are not necessarily better than those of older devices. For example, older devices support Wi-Fi 6 and 160MHz bandwidth, while new devices only support Wi-Fi 5 and 80MHz bandwidth. If the new device is used as a hotspot according to traditional logic, the entire transmission link will be limited to the speed level of Wi-Fi 5, resulting in the waste of the high-performance hardware advantages of the new device and a significant increase in transmission time.
[0019] To address the aforementioned issues, this application provides a device connection method. Before establishing a connection, the first electronic device activates its own hotspot and outputs connection credential information containing its own status information. This helps the peer device obtain the device status information of the first electronic device without establishing a connection, providing a data foundation for subsequent dynamic decision-making. When the first electronic device detects the second connection credential information, it switches its connection role and establishes a connection with the peer device as a site. This allows the access point to no longer be limited to a single fixed device, such as a new device, enabling both parties to operate at the higher physical speeds achievable by their hardware, reducing data transmission time, and increasing data transmission rate.
[0020] The device connection method provided in this application embodiment can be applied to, for example, Figure 1 The scenario shown may include at least two electronic devices. Figure 1 Taking two electronic devices as an example, namely the first electronic device 101 and the second electronic device 102.
[0021] The first electronic device 101 and the second electronic device 102 can be the same type of device or different types of devices, and this embodiment does not limit this. For example, in some embodiments, the first electronic device 101 and the second electronic device 102 are both mobile phones, while in other embodiments, the first electronic device 101 is a mobile phone and the second electronic device 102 is a tablet computer.
[0022] When performing large data migration between the first electronic device 101 and the second electronic device 102, according to the scheme of the embodiments of this application, one of them can be determined first as the access point. After the access point is determined, the other party can be connected to the access point as a station. After the first electronic device 101 and the second electronic device 102 establish a connection, data transmission can be realized. In this way, the access point can always be established on a suitable device, thereby keeping the data transmission at a high rate, reducing transmission time, and improving the transmission rate.
[0023] The device connection method, apparatus, and electronic device provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0024] Figure 1 This is a flowchart of a device connection method provided in an embodiment of this application. The device connection method is applied to a first electronic device as an example. The first electronic device may be a device that initially serves as an access point or a device that displays a graphic code.
[0025] like Figure 1 As shown, the device connection method may include the following steps S110-S120.
[0026] S110, The first electronic device, acting as an access point, outputs the first connection credential information.
[0027] The first connection credential information includes the first device status information.
[0028] S120. Upon detecting the second connection credential information of the second electronic device, the first electronic device establishes a connection with the second electronic device as a site.
[0029] In this embodiment, before the second electronic device establishes a connection with the first electronic device, the first electronic device first outputs first connection credential information as an access point. Upon detecting the second connection credential information of the second electronic device, the first electronic device establishes a connection with the second electronic device as a site. That is, before establishing a connection, the first electronic device in this embodiment first turns on its own hotspot and outputs connection credential information containing its own status information. This helps the other end obtain the device status information of the first electronic device without establishing a connection, providing a data foundation for subsequent dynamic decision-making. When the first electronic device detects the second connection credential information, it switches its connection role and establishes a connection with the other end as a site. The above scheme realizes intelligent switching of connection roles, which helps to ensure that the access point is always established on the appropriate device, reducing data transmission time and improving data transmission rate.
[0030] The above steps are explained in detail below: In S110, the first connection credential information is the information upon which the device connection is established, and may include, but is not limited to, the hotspot's network name (Service Set Identifier, SSID), password, and the first device status information of the first electronic device. Exemplarily, the first connection credential information can be carried by a carrier, such as a graphic code, meaning the graphic code contains the first connection credential information, which can be obtained by scanning the graphic code. In some embodiments, the graphic code can be a QR code or other forms.
[0031] The first device status information can be information characterizing the capabilities and / or status of the first electronic device. For example, in some embodiments, the first device status information may include communication performance information and operating status information of the first electronic device. The communication performance information is used to characterize the hardware capabilities of the first electronic device in wireless communication, such as the supported wireless communication protocol version (e.g., Wi-Fi 6, Wi-Fi 5), maximum bandwidth (160MHz, 80MHz), number of antennas (2*2 MIMO, 1*1 MIMO), heat dissipation, etc. The operating status information is used to characterize the current operating condition of the first electronic device, such as including but not limited to remaining battery power, whether it is charging, temperature, etc. The temperature here may be the battery temperature or the temperature of the central processing unit (CPU) of the first electronic device.
[0032] For example, upon receiving a first input, the first electronic device can output first connection credential information. The first input is used to instruct or control the first electronic device to output the first connection credential information. In some embodiments, the first input may include a first sub-input of the user clicking "One-click device transfer" and a second sub-input of clicking "I am a new device". After receiving the first input, the first electronic device can obtain the first device status information of the first electronic device, and generate the first connection credential information based on the first device status information, embedding a graphic code for display. That is, the graphic code contains the first connection credential information of the first electronic device.
[0033] In some embodiments, the first input may also include voice commands, gesture commands, near-field communication touch, etc.
[0034] S120. Upon detecting the second connection credential information of the second electronic device, the first electronic device establishes a connection with the second electronic device as a site.
[0035] The second connection credential information here refers to the connection credential information output by the second electronic device. For example, the second connection credential information may include the second device status information, the hotspot's SSID, password, etc., of the second electronic device. The second device status information may include, for example, the communication performance information and operating status information of the second electronic device. These information can be found in the above embodiments and will not be repeated here.
[0036] For example, the second electronic device may output the second connection credential information by broadcasting, by using a graphic code, or by other means.
[0037] For example, after outputting the first connection credential information, the first electronic device can activate a hotspot scanner to perform a hotspot scan. In some embodiments, this scan may be performed by the first electronic device with the assistance of a user, scanning the graphic code displayed by the second electronic device. In some embodiments, this scan may also be an active scan performed by the first electronic device using the hotspot scanner, without user intervention. For example, if the second connection credential information is detected, the first electronic device can turn off its own hotspot and, based on the SSID and password in the second connection credential information, establish a hotspot connection between the site and the second electronic device, thus establishing a connection between the first and second electronic devices.
[0038] For example, after obtaining the first connection credential information, the second electronic device can match the first device status information of the first electronic device with its own device status information to determine which device is suitable to act as an access point (hotspot). If the second electronic device is determined to be the access point, it can broadcast the second connection credential information. After detecting the second connection credential information, the first electronic device can turn off its own hotspot and establish a connection with the second electronic device as a site.
[0039] In this embodiment, before the second electronic device establishes a connection with the first electronic device, the first electronic device first outputs first connection credential information as an access point. This allows the second electronic device to obtain the device status information of the first electronic device before establishing a connection, providing a basis for the dynamic adjustment of the connection role. Upon receiving the second input, the first electronic device outputs the first connection credential information. When it scans for second connection credential information associated with the identification information in the first connection credential information, the first electronic device directly establishes a connection with the second electronic device as a station. That is, the access point and station in this embodiment are dynamically changing. This helps both devices operate at the higher physical speeds achievable by their hardware, reducing data transmission time and increasing data transmission rate.
[0040] In some embodiments, the first connection credential information further includes identification information, which is used to instruct the second electronic device to output connection credential information containing the identification information when the second electronic device is determined to be an access point; Accordingly, the above-mentioned S120 may include the following steps: If the second connection credential information of the second electronic device is detected and the second connection credential information contains identification information, the first electronic device establishes a connection with the second electronic device as a site.
[0041] It is understood that the first electronic device may detect multiple connection credential information simultaneously. To quickly determine the electronic device requiring a connection when multiple connection credential information are detected, thereby saving data transmission time, the first connection credential information may, for example, include identification information. This identification information can instruct the second electronic device to output connection credential information according to the identification information when it determines itself as an access point. This embodiment does not limit the specific form of the identification information. For example, in some embodiments, the identification information may be a preset string prefix such as "REV_FLAG_", or it may be a specific flag or field, a specific service identifier in broadcast information, a QR code, or specific information carried in near-field communication interactions.
[0042] For example, when the second electronic device determines itself as an access point based on the first and second device status information, it can output second connection credential information containing identification information. Upon detecting that the second connection credential information contains this identification information, the first electronic device can disable its own hotspot and establish a connection with the second electronic device as a site.
[0043] For example, if the identifier is "REV_FLAG_", and the first electronic device detects the connection credentials of both device 1 and device 2, but only the connection credentials output by device 1 contain "REV_FLAG_", then the first electronic device can disable its own hotspot and connect to device 1's hotspot as a site, without establishing a connection with device 2. This ensures the accuracy of the connection.
[0044] By including identification information in the first connection credential information, the first electronic device can quickly identify the peer establishing the connection, improving the accuracy of the connection and thus reducing data transmission latency.
[0045] In some embodiments, the device connection method may further include the following steps: If no second connection credential information is detected, continue to establish a connection with the second electronic device as an access point.
[0046] For example, if no second connection credential information is detected within a preset time period, it indicates that the communication performance of the first electronic device is good, and the first electronic device can continue to act as an access point to establish a connection with the second electronic device. In this case, the second electronic device can directly connect to the hotspot of the first electronic device as a site based on the SSID and password in the first connection credential information, thereby realizing the connection between the first electronic device and the second electronic device.
[0047] In this embodiment, the first electronic device establishes a connection with the second electronic device as an access point when the second connection credential information is not detected. In this way, both devices can operate at a higher physical speed that their hardware can achieve, reducing data transmission time and increasing data transmission rate.
[0048] In some embodiments, even if the second connection credential information is detected but the second connection credential information does not contain the aforementioned identification information, the first electronic device can still continue to establish a connection with the second electronic device as an access point.
[0049] In some embodiments, after the first electronic device establishes a connection with the second electronic device as a station, the device connection method may further include the following steps: Upon receiving a first role switching request from a second electronic device, a first response message is sent to the second electronic device; The first electronic device disconnects from the second electronic device as a site and switches to access point mode, establishing a connection with the second electronic device as an access point.
[0050] The first role switch request is used to request a switch of connection role (or mode), for example, a request to switch from the "access point" role (mode) to the "site" role (mode), or from the "site" role (mode) to the "access point" role (mode).
[0051] For example, after obtaining the first connection credential information, the second electronic device can compare its own device status information with the device status information of the first electronic device to determine whether the role switching conditions are met. If the role switching conditions are met, the second electronic device can send a first role switching request to the first electronic device.
[0052] For example, after receiving a first role switch request, the first electronic device can return a first response message to the second electronic device, instructing the first electronic device to agree to the role switch. At this time, the first electronic device can disconnect from the second electronic device as a site, turn on its own hotspot, and establish a connection with the second electronic device as an access point. The second electronic device can turn off its own hotspot to dissipate heat.
[0053] For example, after the second electronic device receives the first response message, both parties pause data transmission and record the byte offset of the currently transmitted file so as to resume transmission.
[0054] For example, after the role switch is complete, the second electronic device can act as a station, scan and connect to the connection credentials provided by the first electronic device as an access point, and re-establish a connection with the first electronic device. After re-establishing the connection, both parties can continue data transmission based on byte offsets. For example, the second electronic device can reconnect to the first electronic device based on the previously stored SSID and password of the first electronic device, thus improving connection efficiency.
[0055] In this embodiment, the connection role of the device can be dynamically adjusted during data transmission, so that the access point is always established on the appropriate device, which helps to improve the stability and efficiency of data transmission.
[0056] It is understood that the role switching request can be initiated by either the second electronic device or the first electronic device. In some embodiments, the device connection method may also include the following steps: During the data transmission process between the first electronic device and the second electronic device, the first operating state parameters of the first electronic device and the second operating state parameters of the second electronic device are obtained. If the first operating status parameter and the second operating status parameter meet the role switching conditions, a second role switching request is sent to the second electronic device. Upon receiving a second response message from the second electronic device in response to the second role switching request, the connection between the site and the second electronic device is disconnected, and the site switches to access point mode to establish a connection with the first electronic device as an access point.
[0057] For example, the first electronic device may also obtain the second operating status parameters of the second electronic device through the data transmission link, compare them with its own first operating status parameters, and send a second role switching request to the second electronic device if it is determined that the role switching conditions are met.
[0058] The conditions for switching roles can be conditions for switching roles, such as switching from an access point to a site, or switching from a site to an access point.
[0059] For example, the role-switching conditions may include at least one of the following: The thermal load parameters of the device currently acting as an access point exceed the first threshold (e.g., CPU temperature exceeds 43°C), while the thermal load parameters of the device currently acting as a site are below the second threshold (e.g., CPU temperature is below 38°C). The remaining transmission time, determined by the transmission progress parameter, is greater than the preset switching time threshold (e.g., the remaining transmission time is greater than 3 seconds).
[0060] In some embodiments, a role switching condition is determined to be met when the thermal load parameter of the first electronic device exceeds a first threshold, the thermal load parameter of the second electronic device is less than a second threshold, and the remaining data transmission time is greater than a switching time threshold. By limiting the remaining transmission time, meaningless switching at the end of transmission can be reduced, improving the stability of data transmission.
[0061] For example, if the conditions for role switching are met, the second electronic device may send a first role switching request message to the first electronic device. The first role switching request message is used to inform the first electronic device that it is ready to switch roles.
[0062] After receiving the second response message sent by the second electronic device, the first electronic device can disconnect from the second electronic device as a site, switch to access point mode, turn on its own hotspot, establish a connection with the second electronic device, and continue data transmission.
[0063] In this embodiment, during data transmission, both ends of the connection perform role switching verification, and when the role switching conditions are met, a role switching request is sent to the other end to perform role switching. This is not limited to a single device, thus improving the flexibility of the method.
[0064] In this embodiment, during data transmission, the roles of both parties can be dynamically adjusted according to their real-time operating status to distribute the heat load. This effectively solves the problem of transmission being affected by overheating at one end, improves the transmission rate, and reduces the risk of equipment shutdown due to overheating.
[0065] Figure 3 The flowchart illustrates another device connection method provided in this application embodiment. This device connection method is applied to a second electronic device as an example. The second electronic device may be a device initially serving as a station, or a device that scans a graphic code based on user operations.
[0066] like Figure 3 As shown, the device connection method may include the following S310-S330.
[0067] S310: Obtain the first connection credential information of the first electronic device.
[0068] The first connection credential information includes the first device status information of the first electronic device.
[0069] S320. Based on the status information of the first device and the second device of the second electronic device, determine the device that will serve as the access point from the first electronic device and the second electronic device.
[0070] S330. If the second electronic device is determined to be the access point, output the second connection credential information.
[0071] In this embodiment, the second electronic device first obtains the first connection credential information of the first electronic device, and determines which device can act as an access point based on the first device status information and the second device status information of the second electronic device in the first connection credential information. If the second electronic device is determined to be the access point, the second connection credential information is output. Subsequently, the first electronic device can establish a connection with the second electronic device as a station based on the second connection credential information. That is, before the second electronic device establishes a connection with the first electronic device, this embodiment determines which device can act as an access point based on the device status of the two electronic devices, rather than being limited to a fixed device such as a new device. In this way, the access point can be established on a suitable device, which helps both devices to work at a higher physical speed achievable by their hardware, reducing data transmission time and increasing data transmission rate.
[0072] The above steps are explained in detail below: In S310, the relevant content of the first connection credential information and the first device status information can be found in the above embodiments, and will not be repeated here.
[0073] For example, the second electronic device can obtain the first connection credential information upon receiving the second input. The second input can be the input for obtaining the first connection credential information; for example, the second input can be the user clicking "I am an old device." After receiving the second input, the second electronic device can scan the graphic code displayed by the first electronic device to obtain the first connection credential information.
[0074] Note that the new device and the old device in the above embodiments are only a means of outputting and obtaining the first connection credential information. Subsequently, the new device may not necessarily act as the access point and the old device as the site.
[0075] In S320, for example, the second electronic device can determine the one that will be the access point from the first electronic device and the second electronic device based on the acquired first device status information and its own second device status information.
[0076] For example, the second electronic device can be comprehensively evaluated based on the communication performance of both devices and their real-time operating status. For instance, comparing the communication performance information of both devices: if the first electronic device supports Wi-Fi 6 and 160MHz bandwidth, while the second electronic device only supports Wi-Fi 5 and 80MHz bandwidth, then the first electronic device scores higher in terms of communication capability.
[0077] Compare the operating status information of both devices: if the second electronic device has sufficient power (e.g., 80%) and a low current temperature (e.g., 30℃), while the first electronic device has only 15% power remaining and a high temperature, then the second electronic device scores higher in terms of operating status.
[0078] Based on the combined scores from the different dimensions mentioned above, the party with the higher comprehensive score is selected as the access point.
[0079] For example, a machine learning model or a deep learning model can be combined to determine which device should be the access point. For instance, the first device status information and the second device status information can be input into a deep learning model, which can then parse the information and output a device identifier suitable as the access point.
[0080] In S330, for example, when the second electronic device is determined to be an access point, the second electronic device can start a hotspot based on its own communication hardware capabilities, generate second connection credential information, and broadcast the second connection credential information by broadcasting.
[0081] When the first electronic device outputs the first connection credential information, it can start a hotspot scanner to scan in the background. When the second connection credential information is detected, it can turn off its own hotspot and become the hotspot for the site to connect to the second electronic device, thereby establishing a connection between the second electronic device and the first electronic device.
[0082] Taking the first electronic device as the new device and the second electronic device as the old device as an example, assuming the second electronic device supports Wi-Fi 6 and 160MHz bandwidth, while the first electronic device only supports Wi-Fi 5 and 80MHz bandwidth, the above-described scheme of this application determines that the second electronic device (old device) is more suitable as the access point and the first electronic device (new device) as the site. This allows the transmission link to operate at a higher physical speed achievable by both devices, thereby shortening transmission time and improving transmission efficiency. Furthermore, the embodiment of this application performs role determination before establishing a connection between the first and second electronic devices, which reduces the number of connection interruptions and improves the stability of data transmission.
[0083] This embodiment introduces a dynamic decision-making mechanism based on the status information of both devices, which can enable devices with stronger communication hardware capabilities and better operating status to act as access points, thereby improving the transmission performance of the transmission link and reducing connection instability caused by poor status of one end.
[0084] In some embodiments, the first connection credential information further includes identification information, which is used to instruct the second electronic device to output connection credential information containing the identification information when the second electronic device is determined to be an access point; Accordingly, the above-mentioned S330 may include the following steps: If the second electronic device is identified as the access point, the second connection credential information, including identification information, is output.
[0085] For example, when the second electronic device determines itself to be an access point, it can output second connection credential information containing the identification information as instructed in the first connection credential information. In this way, the first electronic device can quickly determine the peer to establish a connection.
[0086] For example, if the identification information is a preset string prefix "REV_FLAG_", then the hotspot name in the second connection credential information can contain the string prefix "REV_FLAG_".
[0087] When the first electronic device detects a hotspot with a specific prefix such as "REV_FLAG_", it can turn off its own hotspot and connect to the hotspot of the other end as a site, thus establishing a connection with the other end.
[0088] In some embodiments, the device connection method may further include the following steps: If the first electronic device is identified as the access point, the site establishes a connection with the first electronic device.
[0089] For example, if the first electronic device is determined to be the access point, the second electronic device can directly connect to the hotspot of the first electronic device as a site based on the connection parameters such as SSID and password in the first connection credential information, thereby establishing a connection between the second electronic device and the first electronic device, providing a foundation for subsequent data transmission.
[0090] This embodiment introduces a dynamic decision-making mechanism based on the status information of both devices. When the first electronic device is determined to be the access point, the second electronic device can directly connect to the hotspot of the first electronic device based on the first connection credential information to establish a device connection. This can improve the performance of the transmission link and thus increase the data transmission rate.
[0091] Figure 4 A flowchart illustrating another device connection method provided in this application embodiment. Figure 4 and Figure 3 The difference is that, Figure 4 It also includes S410-S430.
[0092] S410. During the data transmission between the second electronic device and the first electronic device, the first operating state parameters of the first electronic device and the second operating state parameters of the second electronic device are obtained.
[0093] For example, after the second electronic device establishes a connection with the first electronic device, the two devices can periodically report their respective operating status parameters through the established data communication link (such as the TCP / IP layer). For instance, the first electronic device can report its first operating status parameter in the data communication link, and the second electronic device can also report its own second operating status parameter in the data communication link.
[0094] The first operating status parameter can be a parameter characterizing the operating status of the first electronic device, such as, but not limited to, the thermal load parameter and transmission progress parameter of the first electronic device. The thermal load parameter is used to characterize the heat generation status of the device, such as, but not limited to, CPU temperature, battery temperature, and casing temperature. The transmission progress parameter is used to characterize the completion status of data transmission, such as the amount of data remaining to be transmitted and the estimated remaining transmission time.
[0095] For example, the second electronic device can obtain the first operating status information of the first electronic device in the data communication link.
[0096] S420: If the first operating state parameter and the second operating state parameter meet the role switching conditions, send a first role switching request to the first electronic device.
[0097] For example, after obtaining the first operating status information, the second electronic device can compare it with its own second operating status information to determine whether the role switching conditions are met. If the role switching conditions are met, the second electronic device can send a first role switching request to the first electronic device, which is used to request the first electronic device to prepare for a role switching.
[0098] S430. Upon receiving a first response message sent by the first electronic device in response to the first role switching request, disconnect the connection between the access point and the first electronic device, switch to the site mode, and establish a connection between the site and the first electronic device.
[0099] For example, after receiving the first role switching request, the first electronic device can return a first response message to the second electronic device. The first response message indicates that the first electronic device has agreed to the switch, and the two devices enter a synchronization state.
[0100] For example, after receiving the first response message, the second electronic device pauses data transmission and records the byte offset of the currently transmitted file to facilitate resumption of transmission. For example, the second electronic device disconnects its connection with the first electronic device as an access point, switching from access point mode to site mode. In a specific implementation, the second electronic device can disable its own hotspot for heat dissipation.
[0101] For example, after the role switch is complete, the second electronic device can act as a station, scan and connect to the connection credentials provided by the first electronic device as an access point, and re-establish a connection with the first electronic device. After re-establishing the connection, both parties can continue data transmission based on byte offsets. For example, the second electronic device can reconnect to the first electronic device based on the previously stored SSID and password of the first electronic device, thus improving connection efficiency.
[0102] In this embodiment, during data transmission, the roles of both parties can be dynamically adjusted according to their real-time operating status, thereby achieving heat load sharing. This effectively solves the problem of transmission being affected by overheating at one end, improves the transmission rate, and reduces the risk of equipment shutdown due to overheating.
[0103] The following is combined with Figure 5 The process of establishing a connection between the first electronic device (the new phone) and the second electronic device (the old phone) is explained. An example is given of a user migrating data from their old phone to their new phone.
[0104] The S510 and the new mobile phone respond to the user's first input, output the first connection credential information, and generate a QR code based on the first connection credential information for display.
[0105] S520: The old phone responds to the user's second input by scanning the QR code on the new phone to obtain the first connection credential information.
[0106] S530: The old mobile phone determines whether to use the old mobile phone as the access point based on the first device status information in the first connection credential information and its own second device status information. If the old mobile phone is suitable as the access point, proceed to S540; if the new mobile phone is suitable as the access point, proceed to S550.
[0107] S540 and older mobile phones can enable their own hotspots, with the hotspot name prefixed with REV_FLAG_.
[0108] S550, old mobile phone directly serves as the site and hotspot connection with new mobile phone.
[0109] After the S560 and the new phone scan for a hotspot carrying REV_FLAG_, it disconnects its own hotspot and connects to the old phone's hotspot as a site.
[0110] At this point, the new and old phones have established a communication connection, and data can be transferred based on this connection.
[0111] This embodiment abandons the fixed-role connection approach. It utilizes a strategy where the first electronic device pre-activates a hotspot and scans simultaneously. When the second electronic device is superior to the first in terms of hardware capabilities or energy efficiency, a role swap is triggered. This reduces the number of connection switches and improves data transmission stability. Furthermore, it ensures that the data transmission link is always established on the more capable end, reducing transmission time and improving transmission efficiency.
[0112] The following is combined with Figure 6 The data transmission process between the first electronic device (the new mobile phone) and the second electronic device (the old mobile phone) is described. In this case, the new mobile phone acts as the access point, and the old mobile phone acts as the site.
[0113] S610. Both parties report their respective operating status information during data transmission.
[0114] S620: Is the CPU temperature of the new phone greater than the first threshold? If yes, proceed to S630; otherwise, return to S610.
[0115] S630: Is the CPU temperature of the old phone lower than the second threshold? If yes, proceed to S640; otherwise, return to S610.
[0116] S640. Is the remaining data transmission time greater than the handover time threshold? If yes, then execute S650; otherwise, return to execute S610.
[0117] S650. Both parties negotiate and suspend data transmission, recording the byte offset of the currently transmitted file.
[0118] S660 performs a role swap, meaning the new phone turns off its own hotspot, enters a cooling state, and switches to site mode, while the old phone turns on its own hotspot and switches to access point mode.
[0119] The S670, the new phone, and the old phone re-establish a connection and resume transmission from where it left off based on byte offset.
[0120] In this embodiment, during data transmission, the operating status information of the other party can be monitored in real time. A heat load sharing mechanism is adopted. When the hot end overheats and the slave end is in good condition, the roles can be switched. This can effectively solve the problem of single-end overheating and frequency reduction, so that the entire transmission process can maintain a high transmission rate, save transmission time, and reduce the risk of single-end device shutting down due to overheating.
[0121] It should be noted that the device connection method provided in this application embodiment can be executed by a device connection device or a processing module within that device connection device for executing the device connection method. This application embodiment uses the execution of the device connection method by a device connection device as an example to illustrate the device connection device provided in this application embodiment.
[0122] Figure 7 This is a schematic diagram of a device connection apparatus provided in an embodiment of this application.
[0123] like Figure 7 As shown, the device connection device 700 may include: Output module 701 is used for the first electronic device to output first connection credential information as an access point; wherein, the first connection credential information includes the first device status information of the first electronic device; Module 702 is used to establish a connection between the first electronic device as a site and the second electronic device when the second connection credential information of the second electronic device is detected.
[0124] In this embodiment, before the second electronic device establishes a connection with the first electronic device, the first electronic device first outputs first connection credential information as an access point. Upon detecting the second connection credential information of the second electronic device, the first electronic device establishes a connection with the second electronic device as a site. That is, before establishing a connection, the first electronic device in this embodiment first turns on its own hotspot and outputs connection credential information containing its own status information. This helps the other end obtain the device status information of the first electronic device without establishing a connection, providing a data foundation for subsequent dynamic decision-making. When the first electronic device detects the second connection credential information, it switches its connection role and establishes a connection with the other end as a site. The above scheme realizes intelligent switching of connection roles, which helps to ensure that the access point is always established on the appropriate device, reducing data transmission time and improving data transmission rate.
[0125] In some possible implementations of the embodiments of this application, the first connection credential information further includes identification information, which is used to instruct the second electronic device to output connection credential information containing the identification information when the second electronic device is determined to be an access point; Module 702 is created, specifically for: If the second connection credential information of the second electronic device is detected and the second connection credential information contains identification information, the first electronic device establishes a connection with the second electronic device as a site.
[0126] In some possible implementations of the embodiments of this application, the device connection device 700 may further include: The sending module is used to send a first response message to the second electronic device after the first electronic device establishes a connection with the second electronic device as a station and receives a first role switching request sent by the second electronic device; The switching module is used to disconnect the first electronic device from the second electronic device as a site and switch to access point mode to establish a connection with the second electronic device as an access point.
[0127] In some possible implementations of the embodiments of this application, the device connection device 700 may further include: The acquisition module is used to acquire the first operating status parameters of the first electronic device and the second operating status parameters of the second electronic device during the data transmission process between the first electronic device and the second electronic device. The sending module is also used to send a second role switching request to the second electronic device when the first running status parameter and the second running status parameter meet the role switching conditions; The switching module is also used to disconnect the connection between the site and the second electronic device and switch to access point mode when it receives a second response message sent by the second electronic device in response to the second role switching request, and establish a connection between the site and the second electronic device as an access point.
[0128] Figure 8 This is a schematic diagram of a device connection apparatus provided in an embodiment of this application.
[0129] like Figure 8 As shown, the device connection device 800 may include: The acquisition module 801 is used to acquire the first connection credential information of the first electronic device; wherein, the first connection credential information includes the first device status information of the first electronic device; The determining module 802 is used to determine, based on the first device status information and the second device status information of the second electronic device, one of the first electronic device and the second electronic device as the access point; The output module 803 is used to output the second connection credential information when the determining module determines that the second electronic device is the access point.
[0130] This embodiment introduces a dynamic decision-making mechanism based on the status information of both devices, which can enable devices with stronger communication hardware capabilities and better operating status to act as access points, thereby improving the transmission performance of the transmission link and reducing connection instability caused by poor status of one end.
[0131] In some possible implementations of the embodiments of this application, the first connection credential information further includes identification information, which is used to instruct the second electronic device to output connection credential information containing the identification information when the second electronic device is determined to be an access point; Output module 803 is specifically used for: If the second electronic device is identified as the access point, the second connection credential information, including identification information, is output.
[0132] In some possible implementations of the embodiments of this application, the acquisition module 801 is further configured to acquire the first operating state parameters of the first electronic device and the second operating state parameters of the second electronic device during the data transmission process between the second electronic device and the first electronic device. The device connection device 800 may also include: The sending module is used to send a first role switching request to the first electronic device when the first running status parameter and the second running status parameter meet the role switching conditions. The switching module is used to disconnect the connection between the first electronic device as an access point and the first electronic device, and switch to the site mode to establish a connection between the first electronic device as a site, upon receiving a first response message sent by the first electronic device in response to the first role switching request.
[0133] The device connection device in the embodiments of this application can be a device or a component in an electronic device, such as an integrated circuit or a chip. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, handheld computer, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. The embodiments of this application do not specifically limit the device.
[0134] The electronic device in this application embodiment can be a terminal with an operating system. The operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system.
[0135] The device connection device provided in this application embodiment can achieve... Figures 2-6 The various processes in the device connection method embodiments can achieve the same technical effect and can also realize... Figures 2-6 The various processes in the device connection method embodiments can achieve the same technical effect, and will not be described again here to avoid repetition.
[0136] like Figure 9 As shown, this application embodiment also provides an electronic device 900, including a processor 901 and a memory 902. The memory 902 stores programs or instructions that can run on the processor 901. When the program or instructions are executed by the processor 901, they implement the various steps of the above-described device connection method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0137] It should be noted that the electronic devices in the embodiments of this application include the mobile terminals and non-mobile terminals mentioned above.
[0138] Figure 10 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application.
[0139] The electronic device 1000 includes, but is not limited to, components such as: radio frequency unit 1001, network module 1002, audio output unit 1003, input unit 1004, sensor 1005, display unit 1006, user input unit 1007, interface unit 1008, memory 1009, and processor 1010.
[0140] Those skilled in the art will understand that the electronic device 1000 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1010 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 10 The structure of the electronic device 1000 shown does not constitute a limitation on the electronic device 1000. The electronic device 1000 may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be described in detail here.
[0141] When this electron is used as a first electronic device, the following process can be performed: The processor 1010 is configured to output first connection credential information when the first electronic device acts as an access point; wherein the first connection credential information includes first device status information of the first electronic device; and, upon detecting second connection credential information of the second electronic device, enable the first electronic device to establish a connection with the second electronic device as a site.
[0142] In this embodiment, before the second electronic device establishes a connection with the first electronic device, the first electronic device first outputs first connection credential information as an access point. Upon detecting the second connection credential information of the second electronic device, the first electronic device establishes a connection with the second electronic device as a site. That is, before establishing a connection, the first electronic device in this embodiment first turns on its own hotspot and outputs connection credential information containing its own status information. This helps the other end obtain the device status information of the first electronic device without establishing a connection, providing a data foundation for subsequent dynamic decision-making. When the first electronic device detects the second connection credential information, it switches its connection role and establishes a connection with the other end as a site. The above scheme realizes intelligent switching of connection roles, which helps to ensure that the access point is always established on the appropriate device, reducing data transmission time and improving data transmission rate.
[0143] In some possible implementations of the embodiments of this application, the first connection credential information further includes identification information, which is used to instruct the second electronic device to output connection credential information containing the identification information when the second electronic device is determined to be an access point; Processor 1010, specifically used for: If the second connection credential information of the second electronic device is detected and the second connection credential information contains identification information, the first electronic device establishes a connection with the second electronic device as a site.
[0144] In some possible implementations of the embodiments of this application, the processor 1010 is further configured to send a first response message to the second electronic device after the first electronic device establishes a connection with the second electronic device as a station and receives a first role switching request sent by the second electronic device; Disconnect the first electronic device from the second electronic device as a station, switch to access point mode, and establish a connection with the second electronic device as an access point.
[0145] In some possible implementations of the embodiments of this application, the processor 1010 is further configured to: acquire first operating state parameters of the first electronic device and second operating state parameters of the second electronic device during the data transmission process between the first electronic device and the second electronic device; send a second role switching request to the second electronic device when the first operating state parameters and the second operating state parameters meet the role switching conditions; and, upon receiving a second response message sent by the second electronic device in response to the second role switching request, cause the first electronic device to disconnect from the connection between the first electronic device as a station and the second electronic device, switch to access point mode, and establish a connection between the first electronic device as an access point and the second electronic device.
[0146] When this electron is used as a second electronic device, the following process can be performed: The processor 1010 is configured to acquire first connection credential information of a first electronic device; wherein the first connection credential information includes first device status information of the first electronic device; based on the first device status information and the second device status information of the second electronic device, determine one of the first electronic device and the second electronic device as the access point; and if the second electronic device is determined to be the access point, output second connection credential information.
[0147] This embodiment introduces a dynamic decision-making mechanism based on the status information of both devices, which can enable devices with stronger communication hardware capabilities and better operating status to act as access points, thereby improving the transmission performance of the transmission link and reducing connection instability caused by poor status of one end.
[0148] In some possible implementations of the embodiments of this application, the first connection credential information further includes identification information, which is used to instruct the second electronic device to output connection credential information containing the identification information when the second electronic device is determined to be an access point; Processor 1010, specifically used for: If the second electronic device is identified as the access point, the second connection credential information, including identification information, is output.
[0149] In some possible implementations of the embodiments of this application, the processor 1010 is further configured to: acquire first operating state parameters of the first electronic device and second operating state parameters of the second electronic device during the data transmission process between the second electronic device and the first electronic device; send a first role switching request to the first electronic device when the first operating state parameters and the second operating state parameters meet the role switching conditions; and disconnect the connection between the first electronic device as an access point and the first electronic device, switch to site mode, and establish a connection between the second electronic device and the first electronic device as a site, upon receiving a first response message sent by the first electronic device in response to the first role switching request.
[0150] It should be understood that, in this embodiment, the input unit 1004 may include a graphics processing unit (GPU) 10041 and a microphone 10042. The GPU 10041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1006 may include a display panel 10061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 1007 includes at least one of a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, joysticks, etc., which will not be described in detail here.
[0151] The memory 1009 can be used to store software programs and various data. The memory 1009 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 1009 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 1009 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0152] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor 1010.
[0153] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described device connection method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.
[0154] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0155] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described device connection method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0156] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0157] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the device connection method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0158] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0159] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the related technology, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0160] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A device connection method, characterized in that, Applied to a first electronic device, the method includes: The first electronic device, acting as an access point, outputs first connection credential information; wherein, the first connection credential information includes first device status information of the first electronic device; Upon detecting the second connection credential information of the second electronic device, the first electronic device establishes a connection with the second electronic device as a site.
2. The method according to claim 1, characterized in that, The first connection credential information also includes identification information, which is used to instruct the second electronic device to output connection credential information containing the identification information when the second electronic device is determined to be an access point; The step of establishing a connection between the first electronic device and the second electronic device as a site upon detecting the second connection credential information of the second electronic device includes: When the second connection credential information of the second electronic device is detected and the second connection credential information contains the identification information, the first electronic device establishes a connection with the second electronic device as a site.
3. The method according to claim 1 or 2, characterized in that, After the first electronic device establishes a connection with the second electronic device as a station, the method further includes: Upon receiving a first role switching request from the second electronic device, a first response message is sent to the second electronic device; The first electronic device disconnects from the second electronic device as a site, switches to access point mode, and establishes a connection with the second electronic device as an access point.
4. The method according to claim 1 or 2, characterized in that, The method further includes: During the data transmission process between the first electronic device and the second electronic device, the first operating status parameter of the first electronic device and the second operating status parameter of the second electronic device are obtained. If the first operating status parameter and the second operating status parameter meet the role switching conditions, a second role switching request is sent to the second electronic device; Upon receiving a second response message sent by the second electronic device in response to the second role switching request, the connection between the site and the second electronic device is disconnected, and the site switches to access point mode to establish a connection with the second electronic device as an access point.
5. A device connection method, characterized in that, Applied to a second electronic device, the method includes: Obtain first connection credential information of the first electronic device; wherein, the first connection credential information includes first device status information of the first electronic device; Based on the first device status information and the second device status information of the second electronic device, determine one of the first electronic device and the second electronic device as the access point; If the second electronic device is determined to be the access point, the second connection credential information is output.
6. The method according to claim 5, characterized in that, The first connection credential information also includes identification information, which is used to instruct the second electronic device to output connection credential information containing the identification information when the second electronic device is determined to be an access point; When the second electronic device is determined to be an access point, the step of outputting the second connection credential information includes: If the second electronic device is determined to be an access point, second connection credential information including the identification information is output.
7. The method according to claim 5 or 6, characterized in that, The method further includes: During the data transmission process between the second electronic device and the first electronic device, the first operating status parameter of the first electronic device and the second operating status parameter of the second electronic device are obtained. If the first operating status parameter and the second operating status parameter meet the role switching conditions, a first role switching request is sent to the first electronic device. Upon receiving a first response message sent by the first electronic device in response to the first role switching request, the connection between the access point and the first electronic device is disconnected, and the device switches to site mode to establish a connection with the first electronic device as a site.
8. A device connection apparatus, characterized in that, Applied to a first electronic device, the device includes: An output module is used for the first electronic device to output first connection credential information as an access point; wherein, the first connection credential information includes first device status information of the first electronic device; An establishment module is used to establish a connection between the first electronic device as a site and the second electronic device upon detection of the second connection credential information of the second electronic device.
9. The apparatus according to claim 8, characterized in that, The device further includes: The sending module is configured to send a first response message to the second electronic device after the first electronic device establishes a connection with the second electronic device as a station, upon receiving a first role switching request sent by the second electronic device; The switching module is used to disconnect the first electronic device from the second electronic device as a station, switch to access point mode, and establish a connection with the second electronic device as an access point.
10. A device connection apparatus, characterized in that, Applied to a second electronic device, the device includes: The acquisition module is used to acquire first connection credential information of the first electronic device; wherein, the first connection credential information includes first device status information of the first electronic device; The determining module is configured to determine, based on the first device status information and the second device status information of the second electronic device, one of the first electronic device and the second electronic device as the access point; The output module is used to output second connection credential information when the determining module determines that the second electronic device is an access point.
11. The apparatus according to claim 10, characterized in that, The first connection credential information also includes identification information, which is used to instruct the second electronic device to output connection credential information containing the identification information when the second electronic device is determined to be an access point; The output module is specifically used for: If the second electronic device is determined to be an access point, second connection credential information including the identification information is output.
12. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing programs or instructions that can run on the processor, the programs or instructions being executed by the processor to implement the steps of the method as claimed in any one of claims 1-4, or the steps of the method as claimed in any one of claims 5-7.