WO2024002137A1 - 通信方法、通信系统及电子设备 - Google Patents

通信方法、通信系统及电子设备 Download PDF

Info

Publication number
WO2024002137A1
WO2024002137A1 PCT/CN2023/103093 CN2023103093W WO2024002137A1 WO 2024002137 A1 WO2024002137 A1 WO 2024002137A1 CN 2023103093 W CN2023103093 W CN 2023103093W WO 2024002137 A1 WO2024002137 A1 WO 2024002137A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
slave
slave device
message
request
Prior art date
Application number
PCT/CN2023/103093
Other languages
English (en)
French (fr)
Inventor
王春风
韦行海
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024002137A1 publication Critical patent/WO2024002137A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/03Protecting confidentiality, e.g. by encryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/04Key management, e.g. using generic bootstrapping architecture [GBA]

Definitions

  • the present application relates to the field of electronic technology, and in particular to communication methods, communication systems and electronic devices.
  • wireless devices such as Bluetooth headsets, wireless keyboards and mice, and other devices.
  • the other wireless devices to be connected need to be in a discoverable or connectable state before a connection can be established.
  • the steps for establishing a connection between an electronic device and the Bluetooth headset can be divided into the following two steps:
  • the user needs to disconnect the Bluetooth headset from other devices, and in some cases also needs to long press the Bluetooth headset.
  • the function button of the headset then converts the status of the Bluetooth headset into a connectable state;
  • the electronic device searches for an attached Bluetooth device, then connects to the Bluetooth device and performs pairing.
  • Embodiments of the present application provide communication methods, communication systems and electronic devices, and relate to the field of electronic technology.
  • the communication method provided by the embodiment of the present application can enable an electronic device that is not connected to a slave device to connect to a slave device of another electronic device through information interaction, without requiring the user to perform cumbersome operations, thereby improving the user experience.
  • embodiments of the present application provide a communication method, applied to a communication system including a first electronic device and a second electronic device.
  • the method includes: the second electronic device is connected to a slave device, and when the second electronic device When the device determines to establish a connection between the first electronic device and the slave device, the second electronic device sends a first message to the first electronic device, and the second electronic device sends a first message to the slave device.
  • the first instruction is used to instruct the slave device to enter a connectable state
  • the first message is used to instruct the first electronic device to connect to the slave device, and the first message includes information for connecting to the slave device;
  • the first electronic device connects to the slave device based on the first message.
  • the first electronic device can connect to the slave device through the first message, and the user does not need to manually configure the slave device to a connectable state, which facilitates the user's use.
  • the method further includes: in response to receiving a user's operation on the second electronic device, the second electronic device determines to establish the relationship between the first electronic device and the first electronic device. connections between slave devices.
  • the user of the second electronic device wants to actively share the slave device with the user of the first electronic device, he or she can operate in the form of an interface, thereby triggering the second electronic device to determine to establish the connection between the first electronic device and the first electronic device.
  • the connection between the slave devices if the user of the second electronic device wants to actively share the slave device with the user of the first electronic device, he or she can operate in the form of an interface, thereby triggering the second electronic device to determine to establish the connection between the first electronic device and the first electronic device. The connection between the slave devices.
  • the method further includes: the second electronic device sends a message to the first electronic device.
  • a first request the first request is used to share the slave device to the first electronic device; after the first electronic device receives the first request, the first electronic device sends a confirmation message to the second electronic device; After the second electronic device receives the confirmation message, the second electronic device determines to establish a connection between the first electronic device and the slave device.
  • the second electronic device determines through interaction with the user that it wants to actively share the slave device, it interacts with the first electronic device and then notifies the first electronic device that it wants to share the slave device with the first electronic device. After receiving the confirmation message from the first electronic device, the second electronic device determines to establish a connection between the first electronic device and the slave device.
  • the method further includes: the first electronic device sends a second request to the second electronic device; after the second electronic device receives the second request, the third electronic device The two electronic devices determine to establish a connection between the first electronic device and the slave device.
  • the first electronic device may also actively initiate a request, which request is used to make the second electronic device determine to establish the first Connection between electronic equipment and slave devices.
  • the method before the first electronic device sends the second request to the second electronic device, the method further includes: the first electronic device displays a first interface, and the first electronic device displays a first interface.
  • An interface includes a first control; after receiving a user's operation on the first control, the first electronic device displays a first window, the first window includes a second control, and the second control is connected to the second electronic device
  • the first electronic device sends a second request to the second electronic device, specifically including: after receiving the user's operation on the second control, the first electronic device sends the second request to the second electronic device.
  • the user can operate the interface on the first electronic device, causing the first electronic device to send the second request to the second electronic device.
  • the interface can be the interface of a music application, or the interface of a settings center, etc.
  • the method before the second electronic device determines to establish a connection between the first electronic device and the slave device, the method further includes: the second request includes: The type of the device, the second electronic device determines the slave device based on the second request; after the first electronic device connects the slave device based on the first message, the method further includes: the first electronic device connects the slave device as an input device or an output device.
  • the second request may also include the type of the slave device, and then the second electronic device may determine the slave device required by the first electronic device from among the plurality of slave devices.
  • the method before the second electronic device determines to establish a connection between the first electronic device and the slave device, the method further includes: the second request is for Share the first data. After the second electronic device determines that the slave device processes the first data based on the first data, the second electronic device determines the slave device; after the first electronic device connects to the slave device based on the first message. After the slave device, the method further includes: the first electronic device sending the first data to the slave device.
  • the second request may also be a service type, a request to share data, etc., and then the second electronic device may determine the slave device required by the first electronic device from among the plurality of slave devices.
  • the first interface is an interface of a first application program
  • the first application program is an application program for playing multimedia files
  • the first data is a multimedia file
  • the first interface also includes a third control, which is used to play the first data.
  • the method also includes: after receiving the user's request for After the third control is operated, the first electronic device plays the images and/or audio of the multimedia file through the slave device.
  • the user can click some controls to connect to the slave device of the second electronic device, and then click play, so that the slave device can play music, thereby achieving rapid sharing. Audio Purpose.
  • the method before the first electronic device sends the first request to the second electronic device, the method further includes: the first electronic device determines a first distance, and the first electronic device determines a first distance.
  • a distance is the distance between the first electronic device and the second electronic device; after the first electronic device determines that the first distance is less than a distance threshold, the first electronic device establishes a connection with the second electronic device; the first electronic device establishes a connection with the second electronic device;
  • An electronic device sends a first request to the second electronic device, specifically including: the first electronic device sends a first request to the second electronic device based on the connection; the second electronic device sends a first request to the first electronic device.
  • the message specifically includes: the second electronic device sends the first message to the first electronic device based on the connection.
  • the first electronic device when the first electronic device is connecting to the slave device, the first electronic device can establish a connection with the second electronic device to avoid leakage of information used to connect the slave device and ensure the information security of the slave device.
  • the first electronic device determines the first distance, specifically including: the second electronic device sending a first broadcast message; the first electronic device receiving the first broadcast message. After receiving the message, the first distance is determined based on the first broadcast message.
  • the first electronic device can actively measure distance.
  • the first electronic device determines the first distance, specifically including: the first electronic device sending a first broadcast message; the second electronic device receiving the first broadcast message. message and determines the first distance based on the first broadcast message, and then sends a first response, where the first response includes the first distance; after receiving the first response, the first electronic device determines the first distance based on the first response. distance.
  • the first electronic device can passively measure distance.
  • the method before the first electronic device establishes a connection with the second electronic device, the method further includes: the second electronic device sends a first verification parameter through broadcast, the The first verification parameter is a hash value of the first parameter, the first parameter is the first MAC and/or the first public key, the first public key is the public key of the second electronic device, the first MAC is The address of the second electronic device; after the first electronic device establishes a connection with the second electronic device, it also includes: the second electronic device sends the first parameter based on the connection; the first electronic device sends the first parameter based on the first parameter and the first verification parameter to determine whether to disconnect the connection.
  • security verification can also be performed between the first electronic device and the second electronic device to avoid connection between the devices. After a connection error occurs, the information from the slave device is leaked.
  • the method further includes: The second electronic device displays a second interface.
  • the second interface includes a second window and a fourth control.
  • the second window is used to display authorization prompt information.
  • the authorization prompt information is used to prompt the user whether to authorize the first electronic device to interact with the first electronic device.
  • the second slave device establishes a connection, and the fourth control is used to obtain user authorization; the second electronic device sends a first instruction to the second slave device, specifically including: after receiving the user's operation on the fourth control, the second electronic device sends a first instruction to the second slave device.
  • the second electronic device sends the first instruction to the second slave device.
  • the first electronic device can obtain the information used to connect to the slave device, thereby preventing the leakage of information from the slave device.
  • the method further includes : The second electronic device sends a third message to the slave device.
  • the third message is used to verify whether the electronic device connected to the slave device is the first electronic device.
  • the third message includes a second MAC.
  • the second MAC is the address of the first electronic device; after the first electronic device connects to the slave device, the method further includes: the slave device determines that the electronic device connected to the slave device is the first electronic device based on the third message.
  • security verification may also be performed between the slave device and the first electronic device.
  • the method it also includes: the second electronic device sending a fourth message to the first electronic device, the fourth message being used to determine whether the electronic device connected based on the first message is the slave device, the fourth message including the slave device.
  • the method also includes: the first electronic device determines that the electronic device connected to the first electronic device is the slave device based on the fourth message.
  • security verification may also be performed between the slave device and the first electronic device.
  • the first request or the first message includes a first duration; after the first electronic device connects to the slave device, the method further includes: After an electronic device is connected to the slave device for the first period of time, the first electronic device disconnects the connection between the first electronic device and the slave device.
  • the first electronic device is disconnected after being used for a period of time, so that the slave device can be connected back to the second electronic device without requiring the user of the second electronic device or the user of the first electronic device to perform cumbersome operations.
  • the method further includes: the first electronic device is disabled or deleted for connecting to the slave device. Device information.
  • the first electronic device after the first electronic device disconnects from the slave device, the first electronic device will fail or delete the information connected to the slave device, thereby preventing the first electronic device from mistakenly connecting to the slave device in the future.
  • the first request is used to share first data
  • the first data is a multimedia file
  • the first duration is related to the playback duration of the multimedia file.
  • the first duration may be related to the duration of the multimedia file, such as music, so that the music can be automatically disconnected after playing.
  • the electronic device in the connectable state may be connected and may be paired.
  • the slave device can also be paired with the first electronic device, thereby further ensuring the security of information interaction between the slave device and the first electronic device.
  • the method further includes: the first electronic device sends a second request to the second electronic device; after the second electronic device receives the second request, the third electronic device The second electronic device determines the slave device based on the second request; after the second electronic device determines the slave device, the second electronic device determines to establish a connection between the first electronic device and the slave device.
  • the first electronic device may also actively initiate a request, which is used to make the second electronic device determine to establish a connection between the first electronic device and the slave device, and the request is approved by the second electronic device.
  • the second request includes a type of slave device and/or the second request is used to share the first data, and the first electronic device connects based on the first message.
  • the method further includes: the first electronic device using the slave device as an input device or an output device.
  • the second request may also include the type of slave device and/or what type of data the second request is used to share, and then the second electronic device may determine the data required by the first electronic device from the plurality of slave devices. That slave device.
  • the second request is used to share the first data
  • the second electronic device is based on Determining the slave device in the second request specifically includes: after the second electronic device determines that the slave device processes the first data based on the first data, the second electronic device determines the slave device; After the device uses the slave device as an input device or an output device, the method further includes: the first electronic device sending the first data to the slave device.
  • the second request can also be a request to share data, etc. Then the second electronic device can determine the slave device that the first electronic device needs from among the multiple slave devices, and then the first electronic device can directly Data is sent to the slave device.
  • the first interface is an interface of a first application program
  • the first application program is an application program for playing multimedia files
  • the first interface further includes a third application program.
  • the third control is used to instruct the first electronic device to play multimedia files; after the first electronic device connects to the slave device based on the first message, the method also includes: after receiving the user's request for the third control After the operation, the first electronic device plays the images and/or audio of the multimedia file through the slave device.
  • the user can click some controls to connect to the slave device of the second electronic device, and then click play, so that the slave device can play music, thereby achieving rapid sharing. Audio Purpose.
  • the second request includes a type of slave device and/or the second request is used to share the first data
  • the first electronic device connects based on the first message.
  • the method further includes: the first electronic device using the slave device as an input device or an output device, and the first electronic device sending the first data to the slave device.
  • the second electronic device can determine the slave device required by the first electronic device from multiple slave devices based on the type of the slave device, and then share the slave device to the first electronic device, and the first electronic device will A data is sent to the slave device.
  • the second request sent by the first electronic device may only include the device type, and then the second electronic device determines the slave device required by the first electronic device based on the device type, and then after the first electronic device connects to the slave device, Send the first data.
  • the second request sent by the first electronic device is a request for sharing certain data, which carries information for determining the slave device, and the second electronic device can determine the first electronic device based on the information for determining the slave device. The required slave device, and then after the first electronic device connects to the slave device, the data can be shared through the slave device.
  • embodiments of the present application provide a communication method applied to a first electronic device.
  • the method includes: the first electronic device receives a first message sent by the second electronic device, and the first message is used to connect From the slave device, the first message includes information for connecting the slave device, wherein before the first electronic device receives the first message, the slave device is connected to the second electronic device; wherein, before the first electronic device receives the first message, the slave device is connected to the second electronic device; After the electronic device receives the first message, the slave device is in a connectable state; the first electronic device connects to the slave device based on the first message.
  • the first electronic device can connect to the slave device through the first message, and the user does not need to manually configure the slave device to a connectable state, which facilitates the user's use.
  • the method before the first electronic device receives the first message sent by the second electronic device, the method further includes: the first electronic device receives the second electronic device.
  • the first request sent, the first request is used to share the slave device to the first electronic device; the first electronic device sends a confirmation message to the second electronic device, the confirmation message is used to instruct the second electronic device It is determined to establish a connection between the first electronic device and the slave device.
  • the second electronic device determines through interaction with the user that it wants to actively share the slave device, it interacts with the first electronic device and then notifies the first electronic device that it wants to share the slave device with the first electronic device. After receiving the confirmation message from the first electronic device, the second electronic device determines to establish a connection between the first electronic device and the slave device.
  • the method before the first electronic device sends the first request to the second electronic device, the method further includes: the first electronic device displays a first interface, and the first electronic device displays a first interface.
  • An interface includes a first control; after receiving a user's operation on the first control, the first electronic device displays a first window, the first window includes a second control, and the second control is connected to the second electronic device
  • the first electronic device sends a first request to the second electronic device, specifically including: after receiving the user's operation on the second control, the first electronic device sends the second request to the second electronic device.
  • the user can operate the interface on the first electronic device to cause the first electronic device to send the second request to the second electronic device.
  • the interface can be the interface of the music application or the setting center. interface etc.
  • the method further includes: the second request includes the type of the slave device, the first The electronic device uses the slave device as an input device or an output device.
  • the second request may also include the type of the slave device, and then the second electronic device may determine the slave device required by the first electronic device from among the plurality of slave devices.
  • the method further includes: the second request is used to share the first data with the second electronic device.
  • the first electronic device sends the first data to the slave device.
  • the second request may also be a service type, a request to share data, etc., and then the second electronic device may determine the slave device required by the first electronic device from among the plurality of slave devices. .
  • the first interface is an interface of a first application program
  • the first application program is an application program for playing multimedia files
  • the first data is a multimedia file
  • the first interface also includes a third control.
  • the third control is used to play the first data.
  • the method also includes: receiving a user's request for the third control. After the operation, the first electronic device plays the images and/or audio of the multimedia file through the slave device.
  • the user can click some controls to connect to the slave device of the second electronic device, and then click play, so that the slave device can play music, thereby achieving rapid sharing. Audio Purpose.
  • the method before the first electronic device sends the second request to the second electronic device, the method further includes: the first electronic device determines a first distance, and the first electronic device determines a first distance.
  • a distance is the distance between the first electronic device and the second electronic device; after the first electronic device determines that the first distance is less than a distance threshold, the first electronic device establishes a connection with the second electronic device; the first electronic device establishes a connection with the second electronic device;
  • An electronic device sends a second request to the second electronic device, specifically including: the first electronic device sends a second request to the second electronic device based on the connection; the first electronic device receives the second request sent by the second electronic device.
  • a message specifically includes: the first electronic device receiving the first message sent by the second electronic device based on the connection.
  • the first electronic device when the first electronic device is connecting to the slave device, the first electronic device can establish a connection with the second electronic device to avoid leakage of information used to connect the slave device and ensure the information security of the slave device.
  • the second electronic device needs to be close enough to the first electronic device to avoid leakage of information from the connected slave device due to misconnection with other electronic devices.
  • the first electronic device determines the first distance, specifically including: the first electronic device receives the first broadcast message sent by the second electronic device, based on the first A broadcast message determines the first distance; or the first electronic device sends a first broadcast message and receives a first response sent by the second electronic device, the first response includes the first distance, and the first distance is the first distance.
  • the two electronic devices are determined based on the first broadcast message.
  • the first electronic device can passively measure distance.
  • the method before the first electronic device establishes a connection with the second electronic device, the method further includes: the second electronic device sends a first verification parameter through broadcast, the The first verification parameter is a hash value of the first parameter, the first parameter is the first MAC and/or the first public key, the first public key is the public key of the second electronic device, the first MAC is The address of the second electronic device; after the first electronic device establishes a connection with the second electronic device, it also includes: the first electronic device receives the first parameter based on the connection; the first electronic device receives the first parameter based on the first parameter and the first verification parameter to determine whether to disconnect the connection.
  • security verification can also be performed between the first electronic device and the second electronic device, thereby preventing information from the slave device from being leaked after an error occurs in the connection between the devices.
  • the method before the first electronic device connects to the slave device based on the first message, the method further includes: the first electronic device receives the message sent by the second electronic device.
  • the second message is used to determine whether the electronic device connected based on the first message is the slave device.
  • the second message includes the public key of the slave device, the identification information of the slave device, the relationship between the slave device and the slave device.
  • One or more identifications of the connection of the second electronic device after the first electronic device connects to the slave device based on the first message, the method further includes: the first electronic device determines to connect the slave device based on the second message.
  • the electronic device of the first electronic device is the slave device.
  • security verification may also be performed between the slave device and the first electronic device.
  • the first request or the first message includes a first duration; after the first electronic device connects to the slave device based on the first message, the method further The method includes: after the first electronic device is connected to the slave device for the first period of time, the first electronic device disconnects the connection between the first electronic device and the slave device.
  • the first electronic device is disconnected after being used for a period of time, so that the slave device can be connected back to the second electronic device without requiring the user of the second electronic device or the user of the first electronic device to perform cumbersome operations.
  • the method further includes: the first electronic device is disabled or deleted for connecting to the slave device. Information.
  • the first electronic device after the first electronic device disconnects from the slave device, the first electronic device will fail or delete the information connected to the slave device, thereby preventing the first electronic device from mistakenly connecting to the slave device in the future.
  • the first request is used to share first data
  • the first data is a multimedia file
  • the first duration is related to the playback duration of the multimedia file.
  • the first duration may be related to the duration of the multimedia file, such as music, so that the music can be automatically disconnected after playing.
  • the second request includes the type of slave device and/or the second request is used for Sharing the first data
  • the method also includes: the first electronic device uses the slave device as an input device or an output device; in the second request for In the case of sharing the first data, after the first electronic device uses the slave device as an input device or an output device, the first electronic device sends the first data to the slave device.
  • the first electronic device can also inform the second electronic device what slave device it needs through various parameters, and use the slave device as an input device or an output device after connection.
  • embodiments of the present application provide a communication method applied to a second electronic device.
  • the method includes: the second electronic device is connected to a slave device, and the second electronic device determines to establish a relationship between the first electronic device and the slave device.
  • the second electronic device sends a first message to the first electronic device, and the second electronic device sends a first instruction to the slave device, the first instruction is used to instruct the
  • the slave device enters a connectable state, the first message is used to instruct the first electronic device to connect to the slave device, and the first message includes information for connecting to the slave device.
  • the second electronic device when the second electronic device determines to establish a connection between the first electronic device and the slave device, the second electronic device sends a first instruction to the slave device to cause the slave device to transition to In the connectable state, the second electronic device sends a first message to the first electronic device, instructing the first electronic device to connect to the slave device based on the first message.
  • the second electronic device in response to receiving a user's operation on the second electronic device, determines to establish a connection between the first electronic device and the slave device. connect.
  • the method in response to receiving the user's operation on the second electronic device, the method further includes: the second electronic device sends a first electronic device to the first electronic device.
  • a request the first request is used to share the slave device to the first electronic device; after the second electronic device receives the confirmation message sent by the first electronic device, the second electronic device determines to establish the The connection between the first electronic device and the slave device.
  • the user of the second electronic device wants to actively share the slave device with the user of the first electronic device, he or she can operate in the form of an interface, thereby triggering the second electronic device to determine to establish the connection between the first electronic device and the first electronic device.
  • the connection between the slave devices if the user of the second electronic device wants to actively share the slave device with the user of the first electronic device, he or she can operate in the form of an interface, thereby triggering the second electronic device to determine to establish the connection between the first electronic device and the first electronic device. The connection between the slave devices.
  • the method in response to receiving the user's operation on the second electronic device, the method further includes: the second electronic device sends a first electronic device to the first electronic device.
  • a request the first request is used to share the slave device to the first electronic device; after the second electronic device receives the confirmation message sent by the first electronic device, the second electronic device determines to establish the The connection between the first electronic device and the slave device.
  • the second electronic device determines through interaction with the user that it wants to actively share the slave device, it interacts with the first electronic device and then notifies the first electronic device that it wants to share the slave device with the first electronic device. After receiving the confirmation message from the first electronic device, the second electronic device determines to establish a connection between the first electronic device and the slave device.
  • the method further includes: the second electronic device receiving a second request sent by the first electronic device; after the second electronic device receives the second request, the second electronic device The second electronic device determines to establish a connection between the first electronic device and the slave device.
  • the first electronic device may also actively initiate a request, and the request is used to make the second electronic device determine to establish a connection between the first electronic device and the slave device.
  • the method further includes: the second request is used to share the first data, and the second electronic device determines that the slave device processes the first data based on the first data. After receiving the data, the second electronic device determines the slave device;
  • the second request may also be a service type, a request to share data, etc., and then the second electronic device may determine the slave device required by the first electronic device from among the plurality of slave devices.
  • the method further includes: the second request includes the type of the slave device, and the second electronic device determines the slave device based on the second request.
  • the second request may also include the type of the slave device, and then the second electronic device may determine the slave device required by the first electronic device from among the plurality of slave devices.
  • the method before the second electronic device receives the second request sent by the first electronic device, the method further includes: the second electronic device and the first electronic device establish Connection; before the second electronic device establishes a connection with the first electronic device, the method also includes: the second electronic device sends a first verification parameter through broadcast, and the first verification parameter is the hash value of the first parameter, The first parameter is a first MAC and/or a first public key, the first public key is the public key of the second electronic device, and the first MAC is the address of the second electronic device; in the second electronic device After establishing a connection with the first electronic device, the method further includes: the second electronic device sending the first parameter based on the connection; the second electronic device receiving the second request sent by the first electronic device, specifically including: the second electronic device sending the first parameter.
  • the equipment receives the second request sent by the first electronic device based on the connection; the second electronic device sends a first message to the first electronic device, specifically including: the second electronic device sends a first message to the first electronic device based on the connection. Send the first message.
  • the second electronic device establishes a connection with the first electronic device and performs security verification to ensure that information from the slave device will not be leaked.
  • the method further includes: the second The electronic device displays a first interface.
  • the first interface includes a first window and a first control.
  • the first window is used to display authorization prompt information.
  • the authorization prompt information is used to prompt the user whether to authorize the first electronic device and the slave device.
  • Establishing a connection the first control is used to obtain user authorization; the second electronic device sends a first instruction to the slave device, specifically including: after receiving the user's operation on the first control, the second electronic device sends a first instruction to the slave device.
  • the first indication is sent from the device.
  • the second electronic device since the connection information of the slave device involves the user's privacy, the second electronic device only sends the first message to the first electronic device and the first instruction to the slave device only after the user's authorization is required.
  • the method also includes: the second electronic device sends a third message to the slave device, the third message is used to verify whether the electronic device connected to the slave device is the first electronic device, the third message includes a second MAC, The second MAC is the address of the first electronic device.
  • the second electronic device sends verification information to the slave device, thereby providing a solid data basis for security verification between the slave device and the first electronic device.
  • the method further includes: the second electronic device sends a fourth instruction to the first electronic device.
  • the fourth message is used to determine whether the electronic device connected based on the first message is the slave device, the fourth message includes the public key of the slave device, the identification information of the slave device, the slave device and the second One or more of the identifiers of electronic device connections.
  • the second electronic device sends verification information to the first electronic device, thereby providing a solid data basis for security verification between the slave device and the first electronic device.
  • the method further includes: after the second electronic device receives the second request, the second electronic device determines the slave device based on the second request; After the second electronic device determines the slave device, the second electronic device determines to establish a connection between the first electronic device and the slave device.
  • the second electronic device can determine which specific slave device the first electronic device requires through the message sent by the first electronic device.
  • the second request includes a type of slave device and/or the second request is used to share the first data, and the second electronic device determines the slave device based on the second request.
  • the slave device specifically includes: the slave device is determined based on the type of the slave device and the first data, and the second electronic device determines that the slave device processes the first data based on the first data. Determine the slave device;
  • the second electronic device has different methods to determine the slave device according to the second request.
  • the second request can select different formats.
  • embodiments of the present application provide a communication method, applied to a slave device.
  • the method includes: connecting the slave device to a second electronic device, and the slave device based on the communication between the slave device and the second electronic device.
  • the connection receives a first instruction sent by the second electronic device, the first instruction is used to instruct the slave device to transition to a connectable state; the slave device transitions to a connectable state based on the first instruction; after the slave device transitions to a connectable state After entering the connection state, in response to receiving the connection request sent by the first electronic device, the slave device establishes a connection with the first electronic device.
  • the slave device first connects to the second electronic device, and then receives the first instruction sent by the second electronic device and changes to a connectable state, thereby providing a data basis for the connection with the first electronic device.
  • the method before the slave device establishes a connection with the first electronic device, the method further includes: the slave device based on the communication between the second electronic device and the slave device.
  • the connection receives a first message sent by the second electronic device.
  • the first message is used to verify whether the electronic device connected to the slave device is the first electronic device.
  • the method further includes: the slave device determines that the electronic device connected to the slave device is the first electronic device based on the first message.
  • the slave device can perform security verification with the first electronic device, thereby preventing the slave device from being connected to other electronic devices.
  • the first message includes a first MAC
  • the first MAC is an address of the first electronic device.
  • the message used to perform security verification may be the address of the first electronic device.
  • inventions of the present application provide a first electronic device.
  • the first electronic device includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store Computer program code, the computer program code includes computer instructions, the one or more processors call the computer instructions to cause the first electronic device to execute: the first electronic device receives the first message sent by the second electronic device, the The first message is used to connect a slave device, and the first message includes information used to connect the slave device, wherein before the first electronic device receives the first message, the slave device is connected to the second electronic device; Wherein, after the first electronic device receives the first message, the slave device is in a connectable state; the first electronic device connects to the slave device based on the first message.
  • the one or more processors are also configured to call the computer instructions to cause the first electronic device to execute: the first electronic device receives the second electronic device The first request sent, the first request is used to share the slave device to the first electronic device; the first electronic device sends a confirmation message to the second electronic device, the confirmation message is used to instruct the second electronic device It is determined to establish a connection between the first electronic device and the slave device.
  • the one or more processors are specifically configured to call the computer instructions to cause the first electronic device to execute: the first electronic device sends a request to the second electronic device. Send a second request, the second request being used to instruct the second electronic device to determine to establish a connection between the first electronic device and the slave device;
  • the one or more processors are also configured to call the computer instructions to cause the first electronic device to execute: the first electronic device displays the first interface, the The first interface includes a first control; after receiving the user's operation on the first control, the first electronic device displays a first window, the first window includes a second control, and the second control is connected to the second electronic device.
  • the first electronic device sends a first request to the second electronic device, specifically including: after receiving the user's operation on the second control, the first electronic device sends the second request to the second electronic device .
  • the one or more processors are also configured to call the computer instructions to cause the first electronic device to execute: the second request includes the type of the slave device, The first electronic device uses the slave device as an input device or an output device.
  • the one or more processors are also used to call the computer instructions to cause the first electronic device to execute: the second request is used to share the first data with The second electronic device and the first electronic device send the first data to the slave device.
  • the one or more processors are also configured to call the computer instructions to cause the first electronic device to execute: upon receiving the user's operation on the third control. Then, the first electronic device plays the picture and/or audio of the multimedia file through the slave device; the first interface is the interface of the first application program, and the first application program is an application program for playing multimedia files, and the The first data is a multimedia file, and the first interface also includes a third control, which is used to play the first data.
  • the one or more processors are also configured to call the computer instructions to cause the first electronic device to execute: the first electronic device determines the first distance, the The first distance is the distance between the first electronic device and the second electronic device; after the first electronic device determines that the first distance is less than a distance threshold, the first electronic device establishes a connection with the second electronic device; One or more processors, specifically configured to invoke the computer instructions to cause the first electronic device to execute: the first electronic device sends a second request to the second electronic device based on the connection; the first electronic device based on the connection Receive the first message sent by the second electronic device.
  • the one or more processors are specifically configured to call the computer instructions to cause the first electronic device to execute: the first electronic device receives the second electronic device.
  • the first broadcast message sent by the device determines the first distance based on the first broadcast message; or the first electronic device sends the first broadcast message and receives the first response sent by the second electronic device, the first response includes The first distance is determined by the second electronic device based on the first broadcast message.
  • the one or more processors are also configured to call the computer instructions to cause the first electronic device to execute: between the first electronic device and the second electronic device Before the device establishes a connection, the method also includes: the second electronic device sends a first verification parameter through broadcast, the first verification parameter is a hash value of the first parameter, and the first parameter is the first MAC and/or the first The first public key is the public key of the second electronic device, and the first MAC is the address of the second electronic device; the first electronic device receives the first parameter based on the connection; the first electronic device Determine whether to disconnect the connection based on the first parameter and the first verification parameter.
  • the one or more processors are also configured to call the computer instructions to cause the first electronic device to execute: the first electronic device receives the second electronic device The second message sent is used to determine whether the electronic device connected based on the first message is the slave device.
  • the second message includes the public key of the slave device, the identification information of the slave device, the slave device One or more of the identifiers connected to the second electronic device; the first electronic device determines that the electronic device connected to the first electronic device is the slave device based on the second message.
  • the one or more processors are also configured to call the computer instructions to cause the first electronic device to execute: the first request or the first message includes A first duration; after the first electronic device is connected to the slave device for the first duration, the first electronic device disconnects the connection between the first electronic device and the slave device.
  • the one or more processors are also configured to call the computer instructions to cause the first electronic device to execute: the first electronic device fails or deletes the connection Information about the slave device.
  • the first request is used to share first data
  • the first data is a multimedia file
  • the first duration is related to the playback duration of the multimedia file.
  • the one or more processors are also configured to call the computer instructions to cause the first electronic device to execute: the first electronic device uses the slave device as input device or output device; in the case where the second request is used to share the first data, after the first electronic device uses the slave device as an input device or an output device, the first electronic device sends the first data to the slave device.
  • inventions of the present application provide a second electronic device.
  • the second electronic device includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store Computer program code, the computer program code includes computer instructions, the one or more processors call the computer instructions to cause the second electronic device to execute: the second electronic device is connected to the slave device, and when the second electronic device determines to When the connection between the first electronic device and the slave device is established, the second electronic device sends a first message to the first electronic device, and the second electronic device sends a first instruction to the slave device, and the second electronic device sends a first instruction to the slave device.
  • An instruction is used to instruct the slave device to enter a connectable state, the first message is used to instruct the first electronic device to connect to the slave device, and the first message includes information for connecting to the slave device.
  • the one or more processors are further configured to call the computer instructions to cause the second electronic device to execute: in response to receiving the user's input on the second electronic device. By operating on the second electronic device, the second electronic device determines to establish a connection between the first electronic device and the slave device.
  • the one or more processors are also configured to call the computer instructions to cause the second electronic device to execute: the second electronic device sends a request to the first electronic device. Send a first request, the first request is used to share the slave device to the first electronic device; after the second electronic device receives the confirmation message sent by the first electronic device, the second electronic device determines to Establish a connection between the first electronic device and the slave device.
  • the one or more processors are also configured to call the computer instructions to cause the second electronic device to execute: the second electronic device receives the first electronic device The second request sent; after the second electronic device receives the second request, the second electronic device determines to establish a connection between the first electronic device and the slave device.
  • the one or more processors are also used to call the computer instructions to cause the second electronic device to execute: the second request is used to share the first data, After the second electronic device determines that the slave device processes the first data based on the first data, the second electronic device determines the slave device;
  • the one or more processors are also configured to call the computer instructions to cause the second electronic device to execute: the second request includes the type of slave device, the The second electronic device determines the slave device based on the second request.
  • the one or more processors are also configured to call the computer instructions to cause the second electronic device to execute: the second electronic device and the first electronic device Establish a connection; the second electronic device sends a first verification parameter through broadcast, the first verification parameter is the hash value of the first parameter, the first parameter is the first MAC and/or the first public key, the first public key The key is the public key of the second electronic device, and the first MAC is the address of the second electronic device; the second electronic device sends the first parameter based on the connection; the one or more processors are specifically used to call The computer instructions cause the second electronic device to execute: the second electronic device receives the second request sent by the first electronic device based on the connection; the second electronic device sends the third request to the first electronic device based on the connection. A message.
  • the one or more processors are also used to call the computer instructions to cause the second electronic device to execute: the second electronic device displays the first interface, the The first interface includes a first window and a first control.
  • the first window is used to display authorization prompt information.
  • the authorization prompt information is used to prompt the user whether to authorize the first electronic device to establish a connection with the slave device.
  • the first control uses To obtain user authorization; the one or more processors are specifically configured to call the computer instructions to cause the second electronic device to execute: after receiving the user's operation on the first control, the second electronic device sends a request to the slave. The device sends the first indication.
  • the one or more processors are also configured to call the computer instructions to cause the second electronic device to execute: the second electronic device sends the first Three messages, the third message is used to verify whether the electronic device connected to the slave device is the first electronic device, the third message includes a second MAC, and the second MAC is the address of the first electronic device.
  • the one or more processors are also configured to call the computer instructions to cause the second electronic device to execute: the second electronic device sends a request to the first electronic device. Send a fourth message.
  • the fourth message is used to determine whether the electronic device connected based on the first message is the slave device.
  • the fourth message includes the public key of the slave device, the identification information of the slave device, the slave device and One or more of the identifiers connected to the second electronic device.
  • the one or more processors are also configured to call the computer instructions to cause the second electronic device to execute: after the second electronic device receives the second request, , the second electronic device determines the slave device based on the second request; after the second electronic device determines the slave device, the second electronic device determines to establish a connection between the first electronic device and the slave device.
  • the one or more processors are also configured to call the computer instructions to cause the second electronic device to execute: the second electronic device is based on the type of the slave device and the first data identify the slave device.
  • embodiments of the present application provide a slave device, which includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program codes,
  • the computer program code includes computer instructions that are invoked by the one or more processors to cause the electronic device to execute: the slave device is connected to a second electronic device, and the slave device is based on the connection between the slave device and the second electronic device.
  • the connection between the two electronic devices receives a first instruction sent by the second electronic device, the first instruction is used to instruct the slave device to transition to a connectable state; the slave device transitions to a connectable state based on the first instruction; when the slave device transitions After being in a connectable state, in response to receiving a connection request sent by the first electronic device, the slave device establishes a connection with the first electronic device.
  • the one or more processors are also configured to call the computer instructions to cause the slave device to execute: the slave device is based on the second electronic device and the slave device The connection between receives the first message sent by the second electronic device. The first message is used to verify whether the electronic device connected to the slave device is the first electronic device; the slave device is based on the first message. It is determined that the electronic device connected to the slave device is the first electronic device.
  • the first message includes a first MAC
  • the first MAC is an address of the first electronic device.
  • embodiments of the present application provide a chip system, which is applied to an electronic device.
  • the chip system includes one or more processors, and the processor is used to call computer instructions to cause the electronic device to execute the second step.
  • embodiments of the present application provide a computer program product containing instructions.
  • the electronic device causes the electronic device to execute the following aspects: the second aspect, the third aspect, the fourth aspect, and the second aspect. Any possible implementation method in the aspect, any possible implementation method in the third aspect, and any possible implementation method in the fourth aspect.
  • embodiments of the present application provide a computer-readable storage medium, including instructions.
  • the electronic device When the instructions are run on an electronic device, the electronic device causes the electronic device to execute the following aspects: the second aspect, the third aspect, the fourth aspect, and the second aspect. Any possible implementation method in the aspect, any possible implementation method in the third aspect, and any possible implementation method in the fourth aspect.
  • the electronic device provided by the second aspect the chip system provided by the third aspect, the computer program product provided by the fourth aspect, and the computer storage medium provided by the fifth aspect are all used to execute the method provided by the embodiments of the present application. . Therefore, the beneficial effects it can achieve can be referred to the beneficial effects in the corresponding methods, and will not be described again here.
  • Figure 1 is an exemplary schematic diagram of an interface for sharing media files on a local electronic device provided by an embodiment of the present application.
  • FIG. 2 is an exemplary schematic diagram of an interface for receiving a shared link on a peer electronic device provided by an embodiment of the present application.
  • Figure 3 is an exemplary schematic diagram of a Bluetooth headset connected to a local electronic device and a peer electronic device provided by this application.
  • 4A and 4B are an exemplary schematic diagram of a media file sharing interface provided by an embodiment of the present application.
  • FIG. 5A and FIG. 5B are another exemplary schematic diagram of the interface provided by the embodiment of the present application.
  • FIG. 6A and FIG. 6B are an exemplary schematic diagram of the slave device state change of the local electronic device connected to the peer electronic device provided by the embodiment of the present application.
  • Figure 7 is an exemplary schematic diagram of the method flow of the communication method provided by the embodiment of the present application.
  • FIG. 8 is an exemplary schematic diagram of the triggering timing of establishing a connection between a local electronic device and a peer electronic device according to an embodiment of the present application.
  • FIG. 9A is an exemplary schematic diagram of a local electronic device and a peer electronic device performing security verification during the establishment of a connection according to an embodiment of the present application.
  • FIG. 9B is an exemplary schematic diagram of a local electronic device performing security verification during the establishment of a connection with other electronic devices according to an embodiment of the present application.
  • Figure 10 is an exemplary schematic diagram of a local electronic device exchanging session keys with a peer electronic device according to an embodiment of the present application.
  • Figure 11 is an exemplary schematic diagram of the connection between a local electronic device and a slave device provided by an embodiment of the present application.
  • Figure 12 is an exemplary schematic diagram of the authentication between a local electronic device and a slave device provided by an embodiment of the present application.
  • Figure 13 is another exemplary schematic diagram of authentication between a local electronic device and a slave device provided by an embodiment of the present application.
  • Figure 14 is another exemplary schematic diagram of authentication between a local electronic device and a slave device provided by an embodiment of the present application.
  • Figure 15A is an exemplary schematic diagram of the method flow of the communication method provided by the embodiment of the present application.
  • Figure 15B is an exemplary schematic diagram of the method flow of the communication method provided by the embodiment of the present application.
  • Figure 16 is an exemplary schematic diagram of the hardware structure of a local electronic device, a peer electronic device, and a slave device provided by an embodiment of the present application.
  • FIG. 17A is an exemplary schematic diagram of the software architecture of an electronic device provided by an embodiment of the present application.
  • FIG. 17B is another exemplary schematic diagram of the software architecture of an electronic device provided by an embodiment of the present application.
  • first and second are used for descriptive purposes only and shall not be understood as implying or implying relative importance or implicitly specifying the quantity of indicated technical features. Therefore, the features defined as “first” and “second” may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, “plurality” The meaning is two or more.
  • GUI graphical user interface
  • wireless devices such as Bluetooth headsets, wireless keyboards and mice, stylus pens such as Huawei pencil, and other devices.
  • the local electronic device shares the link corresponding to the media file to the peer electronic device.
  • An example content is shown in Figure 1 below.
  • the local electronic device is the electronic device of the local user
  • the peer electronic device is the electronic device of the peer user.
  • the local electronic device may be mobile phone A
  • the peer electronic device may be mobile phone B.
  • the peer electronic device and the local electronic device are peers of each other.
  • the electronic device connected to the slave device may also be called the second electronic device
  • the peer electronic device of the second electronic device may also be called the first electronic device. equipment.
  • the slave devices are the Bluetooth headsets, wireless keyboards and mice, stylus and other electronic devices that support near-field wireless communication technology mentioned above.
  • Figure 1 is an exemplary schematic diagram of an interface for sharing media files on a local electronic device provided by an embodiment of the present application.
  • Interface 1001 in Figure 1 is an exemplary interface of a music application program interface, and there are controls 1004 in the interface of the music application program.
  • the control 1004 is a control used for sharing the media file currently being played.
  • Interface 1002 in Figure 1 is an exemplary interface for selecting sharing users, and there are one or more controls corresponding to one or more users in the interface.
  • interface 1002 in Figure 1 there are controls 1005 and 1006 on the interface. Among them, control 1005 corresponds to user 1; control 1006 corresponds to user 2.
  • the link corresponding to the media file is sent to the corresponding link of user 1 through the Internet. on the peer electronic device; when the local user clicks the control 1006 on the local electronic device, the link of the media file is sent to the peer electronic device corresponding to user 2.
  • FIG. 2 is an exemplary schematic diagram of an interface for receiving a shared link on a peer electronic device provided by an embodiment of the present application.
  • the interface displayed on the peer electronic device is as shown in interface 2001 in Figure 2 .
  • mobile phone B is a local electronic device. After the local electronic device transmits the link corresponding to the media file to the peer electronic device through the Internet, the interface displayed by the peer electronic device may include a control 2003 corresponding to the link.
  • the peer electronic device in response to the peer user clicking the control 2003 displayed on the peer electronic device, the peer electronic device can launch the music application and start playing the media file corresponding to the link.
  • the interaction method shown in Figures 1 and 2 is a method of sharing music or other media files.
  • the methods shown in Figures 1 and 2 require that the same application is installed on both the local electronic device or the peer electronic device.
  • music or other media files are paid resources, local electronic devices are also required.
  • Both the user and the peer user are paying users; furthermore, it is difficult for local users and peer users to synchronize the playback progress of music or other media files, or due to network delays, it is difficult to synchronize the playback progress of music or other media files in real time.
  • the user can instruct the local electronic device to connect to the peer user's Bluetooth headset through operations, thereby realizing music Or share other media files, as shown in Figure 3.
  • Figure 3 is an exemplary schematic diagram of a Bluetooth headset connected to a local electronic device and a peer electronic device provided by this application.
  • mobile phone A is a local electronic device
  • mobile phone B is a peer electronic device.
  • mobile phone B is connected to headset B; then, the peer user instructs mobile phone B to disconnect mobile phone B and headset B; then, the peer user or the local user sets headset B to the In the connectable state, you can press and hold the function button on earphone B or put earphone B back into the charging box to make earphone B enter the connectable state; finally, when the Bluetooth earphone enters the connectable state, the local user can The operation instructs mobile phone A to establish a connection with headset B.
  • the method shown in Figure 3 requires the local user or the peer user to perform cumbersome operations in order to reconnect the Bluetooth headset originally connected to the peer electronic device to the local electronic device; secondly, if In the method shown in Figure 3, after the Bluetooth headset enters the connectable state, it may be connected by other electronic devices besides the local electronic device, which has poor security.
  • electronic devices in a connectable state can be connected and paired.
  • earphone B is manually set from the connected state (connected) to the advertising state (advertiser/advertising), and then enters the connected state (connected) again after the connection is established.
  • the local electronic device connects to a Bluetooth headset that is not paired with the local electronic device and is connected to the peer electronic device or other near-field wireless communication technology to connect with the peer electronic device.
  • the operations required by the user are cumbersome and the security is poor.
  • embodiments of the present application provide a communication method, which allows the local electronic device to connect with the slave device of the peer electronic device in an easy-to-operate and safe manner.
  • the slave device of the peer electronic device is an electronic device that has not been paired with the local electronic device; or, the slave device of the peer electronic device is an electronic device that has not saved pairing information for pairing with the local electronic device.
  • slave device will be used in the following to refer to the slave device of the peer electronic device.
  • the slave device may be earphone B.
  • the slave device may be connected to the peer electronic device; or, the slave device may have been connected to the peer electronic device and save relevant information for connecting to the peer electronic device.
  • the slave device can connect with the peer electronic device and/or the local electronic device based on any near-field wireless communication technology, which is not limited here, for example, Bluetooth, ZigBee, Wi-Fi, Apple Wireless Direct Link, AWDL), etc.
  • any near-field wireless communication technology which is not limited here, for example, Bluetooth, ZigBee, Wi-Fi, Apple Wireless Direct Link, AWDL), etc.
  • the slave device can be a Bluetooth headset, a wireless keyboard and mouse, a stylus, a game controller, VR glasses, a key (an anti-theft door key or a car key), a TV, a rice cooker, a smart home device, etc. that support at least one of the above near-field wireless communications.
  • Technology electronic devices can be a Bluetooth headset, a wireless keyboard and mouse, a stylus, a game controller, VR glasses, a key (an anti-theft door key or a car key), a TV, a rice cooker, a smart home device, etc. that support at least one of the above near-field wireless communications.
  • the application scenarios of the communication method provided by the embodiments of the present application may also be different.
  • the following is an exemplary introduction to several application scenarios of the communication methods provided by the embodiments of the present application.
  • 4A and 4B are an exemplary schematic diagram of a media file sharing interface provided by an embodiment of the present application.
  • mobile phone A is a local electronic device
  • mobile phone B is a peer electronic device.
  • the interface 4A01 in Figure 4A is the same as the interface 1001 in Figure 1. You can refer to the text description of Figure 1 and will not be described again here.
  • Control 4A04 may include one or more controls, the first or more controls corresponding to one or more peer electronic devices. Among them, control 4A05 corresponds to mobile phone B.
  • control 4A05 After the user clicks control 4A05, the interfaces of the local electronic device and the peer electronic device change as shown in interface 4B01 and interface 4B03 in Figure 4B.
  • the content displayed on the interface on the peer electronic device includes control 4B04, where control 4B04 can also be called a prompt box, a pop-up window, a small window, etc.
  • Control 4B04 includes control 4B05.
  • Control 4B04 also includes text used to prompt the peer user.
  • the text can be "Mobile phone A wants to share the music Dream it's possible with you", or it can also be other text used to prompt the user to determine whether The text for receiving music sharing, or other text used to prompt the user whether to share earphone B to the local electronic device, is not limited here.
  • earphone B is the slave device of mobile phone B.
  • the interface of mobile phone B also includes an icon 4B06.
  • the icon 4B06 is used to identify the Bluetooth connection and to identify the connection between mobile phone B and headset B.
  • the Bluetooth setting interface of the local electronic device is shown as interface 4B03 in Figure 4B.
  • the Bluetooth setting interface includes icon 4B11. Icon 4B11 corresponds to earphone B and is used to prompt the user that earphone B has established a connection with the local electronic device.
  • the interface of mobile phone A also includes an icon 4B10.
  • the icon 4B10 is used to identify the Bluetooth connection and identify the connection between mobile phone A and headset B.
  • the interfaces of the local electronic device and the peer electronic device change as shown in interface 4B02 and interface 4B03 in Figure 4B.
  • the content displayed on the interface on the peer electronic device includes a control 4B08, where the control 4B08 can also be called a prompt box, a pop-up window, a small window, etc.
  • Control 4B08 includes control 4B09, and control 4B08 also includes text used to prompt the peer user.
  • the text can be "select the shared slave device", or it can also be other text used to prompt the user to confirm the slave device, which is not included here. Make limitations.
  • the local electronic device and earphone B automatically establish a Bluetooth connection.
  • the Bluetooth setting interface of the local electronic device is as shown in interface 4B03 in Figure 4B.
  • the interfaces of the local electronic device and the peer electronic device change as shown in interface 4B01, interface 4B02 and interface 4B03 in Figure 4B.
  • earphone B can maintain the connection with the peer electronic device or disconnect it, which is not limited here.
  • FIG. 5A and FIG. 5B are another exemplary schematic diagram of the interface provided by the embodiment of the present application.
  • the user can make mobile phone A display the control center interface through a sliding operation, such as the change process from interface 5A01 to interface 5A02.
  • interface 5A01 is the main interface of mobile phone A
  • interface 5A02 is the control center interface of mobile phone A.
  • the interface 5A02 includes a control 5A05.
  • control 5A05 is a control corresponding to music multimedia playback.
  • the interface of mobile phone A changes to interface 5A03.
  • control 5A06 is used to display the connected audio output device, such as headphone A.
  • Control 5A06 includes control 5A07 and control 5A08, where control 5A07 is a control corresponding to earphone A, and the text on control 5A08 is shared with other earphones.
  • interface displayed on mobile phone A changes from interface 5A04 to interface 5B01.
  • interface 5B01 includes control 5B04
  • control 5B04 includes control 5B05 and control 5B06.
  • the text displayed on control 5B04 is whether to connect the mobile phone B.
  • the text displayed on control 5B05 is connect; the text displayed on control 5B06 is cancel.
  • Interface 5B02 includes control 5B07
  • control 5B07 includes control 5B08 and control 5B09.
  • the text displayed on control 5B07 is "Whether to share headset B" and "During sharing, your headset B will be temporarily connected to mobile phone A and controlled by mobile phone A”
  • the text displayed on control 5B08 is "Connect”
  • the control The text displayed on 5B09 is "Cancel”.
  • controls 5B07, 5B04 and 5A06 mentioned above can also be called prompt boxes, pop-up windows, small windows, etc., which are not limited here; and other text prompts can also appear in controls 5B07, 5B04 and 5A06.
  • the information is not limited to the content shown in Figure 5A and Figure 5B and is not limited here.
  • FIG. 6A and FIG. 6B are an exemplary schematic diagram of the slave device state change of the local electronic device connected to the peer electronic device provided by the embodiment of the present application.
  • mobile phone A is the local electronic device
  • mobile phone B is the peer electronic device
  • the slave device is the earphone B connected to mobile phone B.
  • mobile phone B remains connected to headset B; secondly, mobile phone A obtains information from mobile phone B for connecting and pairing headset B; finally, mobile phone A and headset B complete pairing after being connected.
  • earphone B automatically changes from the connected state to the connectable state.
  • earphone B When earphone B is a Bluetooth low energy (BLE) device, earphone B changes from the connected state to the broadcast state, and then enters the connected state again after the connection is established. Among them, the broadcast state can also be called the connectable state.
  • BLE Bluetooth low energy
  • the headset When the headset is a classic Bluetooth device (BR/EDR) device, headset B changes from the connected state to the page scan state (page scan), and then enters the connected state again after the connection is established. Among them, the paging scanning state can also become a connectable state.
  • BLE Bluetooth low energy
  • earphone B When earphone B is in the broadcast state, it will broadcast its own information so that local electronic devices can discover and connect to earphone B.
  • earphone B is disconnected from mobile phone A and restored to connection with mobile phone B.
  • connection time between earphone B and mobile phone A may be related to the service running on mobile phone A, or may be a preset fixed value.
  • the connection time between earphone B and mobile phone A can be equal to the playback time of the media file.
  • the communication method provided by this application is not limited to the scenarios shown in Figure 4A and Figure 4B, and can also be used in other scenarios, which are not limited here.
  • the local electronic device and the peer electronic device can both be laptop computers, and the slave devices of the peer electronic device can be wireless keyboards and mice; for another example, the local electronic device and the peer electronic device can both be mobile phones or hosts, and the peer electronic device can be both mobile phones or hosts, and the peer electronic device can be a wireless keyboard and mouse.
  • the slave device of the device can be VR/AR glasses, etc.
  • Figure 7 is an exemplary schematic diagram of the method flow of the communication method provided by the embodiment of the present application.
  • the communication method provided by this application includes three steps, namely step S701, step S702, and step S703. These three steps are introduced below.
  • S701 After establishing a connection with the peer electronic device, the local electronic device sends a first request to the peer electronic device.
  • the triggering timing for establishing a connection between the local electronic device and the peer electronic device may vary with different scenarios, and is not limited here.
  • the local electronic device when the user clicks control 4A04 on the local electronic device, the local electronic device establishes a connection with the peer electronic device.
  • the local electronic device when the user clicks control 5A08 on the local electronic device, the local electronic device starts to receive the broadcast, and in the process of receiving the broadcast, it receives the broadcast sent by the peer electronic device. Discover the peer electronic device. After the local electronic device discovers the peer electronic device, the interface of the local electronic device changes from interface 5A04 to interface 5B01. When the user clicks control 5B05, the local electronic device establishes a connection with the peer electronic device.
  • the first request may be a request for sharing data; or the first request may be a request for connecting to a slave device of the opposite end electronic device.
  • the local electronic device and the peer electronic device may not establish a connection, and complete part or all of the data interaction in the embodiments of the present application in the form of broadcast through the broadcast channel.
  • the local electronic device may discover one or more peer electronic devices through broadcasting and other methods.
  • the local electronic device when the user clicks control 4A03 on the local electronic device, the local electronic device begins to discover one or more peer electronic devices. After the user clicks control 4B05, the local electronic device communicates with the peer electronic device. The electronic device establishes a connection.
  • the local electronic device and the peer electronic device can establish multiple connections, which are not limited here.
  • the connection between the local electronic device and the peer electronic device can be through Bluetooth, ZigBee, Wi-Fi, and Apple wireless direct connection. (apple wireless direct link, AWDL) and other protocols or methods to establish connections.
  • AWDL application wireless direct link
  • the first request may be sent to the peer electronic device.
  • the first request may include obtaining information about a slave device used to connect to the peer electronic device, and/or the first request may include information about services running on the local electronic device.
  • the first request may include a media file sharing service.
  • the first request is used to share data, such as multimedia files.
  • data such as multimedia files.
  • the first request may be used to share a music file or audio stream.
  • the first request may include the device type of the slave device.
  • the device type may be an audio output device, a Bluetooth headset, VR glasses, a remote control, etc., which is not limited here.
  • the first request may carry time information, and the time information may represent the length of time that the local electronic device needs to use the slave device. For example, after the connection time between the local electronic device and the slave device reaches this length, the slave device will automatically disconnect from the local electronic device and restore the connection between the slave device and the peer electronic device.
  • the local electronic device can obtain the public key of the slave device of the peer electronic device through the peer electronic device, which is used to encrypt data requiring data interaction in subsequent steps.
  • the local electronic device and the peer electronic device can perform security verification, thereby preventing other devices from interacting with the local electronic device. Or establish a connection with the peer electronic device.
  • security verification can be performed after the connection is established. When the security verification fails, the local electronic device disconnects the connection. Among them, security verification can be completed through the physical address (Media Access Control Address, MAC) of the local electronic device or the peer electronic device.
  • MAC Media Access Control Address
  • the MAC when the local electronic device or the peer electronic device is connected through the classic Bluetooth protocol, the MAC is a fixed MAC; when the local electronic device and the peer electronic device are connected through low-power Bluetooth, the MAC can be a fixed MAC or a random MAC. MAC; Similarly, in the following text, the MAC used for the connection between the local electronic device and the slave device can also be a fixed MAC or a random MAC according to different protocols.
  • the identification of the local electronic device and/or the peer electronic device and/or the slave device may also be different.
  • FIG. 8 is an exemplary schematic diagram of the triggering timing of establishing a connection between a local electronic device and a peer electronic device according to an embodiment of the present application.
  • S801 The peer electronic device sends the first broadcast.
  • the peer electronic device may periodically send the first broadcast to surrounding devices.
  • the local electronic device determines based on the first broadcast that the first distance is less than or equal to the distance threshold.
  • the local electronic device After receiving the first broadcast, the local electronic device determines that the distance between the peer electronic device and the local electronic device is the first distance based on the signal attenuation of the first broadcast. The local electronic device determines the size of the first distance and the distance threshold. If the first distance is less than or equal to the distance threshold, step S803 is executed to start establishing a connection with the peer electronic device; if the first distance is greater than the distance threshold, the local electronic device is discordant. The peer electronic device establishes a connection.
  • the local electronic device when the user clicks control 5A08 in interface 5A03 on the local electronic device, the local electronic device begins to receive or parse the first broadcast, and determining the first distance based on the first broadcast.
  • the first distance based on the first broadcast there are many methods for determining the first distance based on the first broadcast, which are not limited here. For example, it can be determined by the received signal strength indicator (RSSI).
  • RSSI received signal strength indicator
  • the local electronic device may also actively send a first broadcast.
  • the peer electronic device After receiving the first broadcast, the peer electronic device sends a first response to the local electronic device.
  • the local electronic device may respond based on the first response. A distance between the first electronic device and the second electronic device is determined.
  • the local electronic device may also actively send a first broadcast, and after receiving the first broadcast, the peer electronic device sends a first response to the local electronic device, where the first response includes There is distance 1, which is determined based on the RSSI of the first broadcast.
  • the local electronic device determines whether the electronic device sending the first response is the peer electronic device based on the distance 1, that is, if the distance 1 is less than or equal to the distance threshold, the electronic device sending the first response is the peer electronic device.
  • the local electronic device may also actively send a first broadcast, and after receiving the first broadcast, the peer electronic device sends a first response to the local electronic device, where the first response includes There is distance 1, which is determined based on the RSSI of the first broadcast. After the local electronic device determines distance 2 based on the RSSI of the first response, the local electronic device determines whether the local electronic device and the electronic device that sent the first response are peer electronic devices based on distance 1 and distance 2. If distance 1 and distance 2 are If the average value is less than or equal to the distance threshold, the electronic device that sends the first response is the peer electronic device.
  • S803 The local electronic device establishes a connection with the peer electronic device.
  • FIG. 9A is an exemplary schematic diagram of a local electronic device and a peer electronic device performing security verification during the establishment of a connection according to an embodiment of the present application.
  • the process of establishing a connection between the local electronic device and the peer electronic device includes the following steps.
  • S9A01 Send broadcast.
  • the local electronic device sends a broadcast on the broadcast channel to discover surrounding connectable electronic devices.
  • the peer electronic device and the local electronic device can receive the broadcast.
  • S9A02 Send the hash value of public key 1 and the hash value of MAC1.
  • the response of the peer electronic device includes sending the hash value of public key 1 and the hash value of MAC1 to the local electronic device.
  • the Bluetooth MAC of the peer electronic device is MAC1.
  • the MAC1 is the public address of the peer electronic device.
  • Data interaction between the peer electronic device and the local electronic device is still carried out through the broadcast channel.
  • public key 1 corresponds to private key 1, and private key 1 is private to the peer electronic device; before step S9A05 is performed, public key 1 is also private to the peer electronic device.
  • the peer electronic device may also send the public key 1 and the hash value of the MAC operation result.
  • S9A03 Store the hash value of public key 1 and the hash value of MAC1.
  • the local electronic device After the local electronic device receives the public key 1 and the hash value and the hash value of MAC1, it can save the public key 1 and the hash value of MAC1 locally and use it to perform security verification in subsequent steps.
  • the local electronic device in the case where the peer electronic device can also send the public key 1 and the hash value of the MAC operation result, the local electronic device can also verify the value.
  • the local electronic device establishes a connection with the peer electronic device.
  • the local electronic device when the local electronic device establishes a connection with the peer electronic device, the data interaction between the local electronic device and the peer electronic device is point-to-point, that is, other electronic devices cannot obtain the content of the data interaction between the local electronic device and the peer electronic device. .
  • S9A05 Send public key 1 and MAC1.
  • the peer electronic device sends public key 1 and MAC1 to the local electronic device.
  • the local electronic device Since the local electronic device has established a connection with the peer electronic device, the data sent through the connection cannot be obtained by other electronic devices, so other electronic devices cannot obtain public key 1 and MAC1.
  • S9A06 Verify public key 1 and MAC1.
  • the local electronic device independently verifies public key 1 and MAC1 through the hash value of public key 1 and the hash value of MAC1.
  • the opposite end electronic device may send the hash value of public key 1 or the hash value of MAC1; in step S9A05, the opposite end electronic device may send the public key 1 or MAC1; in step S9A06, the local electronic device can verify the public key 1 or MAC1.
  • the local electronic device can determine that the connected peer electronic device is the electronic device selected by the user and not other electronic devices by verifying the public key and/or MAC; the interface for the user to select the electronic device can refer to Figure 4B The contents shown in interface 4B02 will not be described again here.
  • FIG. 9B is an exemplary schematic diagram of a local electronic device performing security verification during the establishment of a connection with other electronic devices according to an embodiment of the present application.
  • the process of establishing a connection between the local electronic device and the peer electronic device includes the following steps.
  • S9B01 Send broadcast.
  • the local electronic device sends a broadcast on the broadcast channel to discover surrounding connectable electronic devices.
  • the peer electronic device and the local electronic device can receive the broadcast.
  • S9B02 Send the hash value of public key 1 and the hash value of MAC1.
  • step S9A02 For specific content, see step S9A02 above, which will not be described again here.
  • S9B03 Forward the received broadcast.
  • other electronic devices can also listen on the broadcast channel to directly obtain the hash value of public key 1 and the hash value of MAC1 sent by the peer electronic device to the local electronic device.
  • S9B04 Send the hash value of public key 1 and the hash value of MAC1.
  • the peer electronic device sends the hash value of public key 1 and the hash value of MAC1 to other electronic devices that send the broadcast.
  • S9B05 Send the hash value of public key 1 and the hash value of MAC1.
  • S9B06 Store the hash value of public key 1 and the hash value of MAC1.
  • step S9A03 For specific content, see step S9A03 above, which will not be described again here.
  • Local electronic devices establish connections with other electronic devices.
  • S9B08 Send public key 2 and MAC2.
  • the other electronic devices After the local electronic device establishes a connection with other electronic devices, the other electronic devices send the public key 2 and MAC2 to the local electronic device.
  • the peer electronic device has not sent public key 1 and MAC1 in the form of broadcast, and other electronic devices cannot recover public key 1 through the hash value of public key 1 and cannot recover the public key through the hash value of MAC1 1, so other electronic devices cannot send public key 1 and MAC1 to the local electronic device.
  • S9B09 It is determined that the public key and MAC do not match, and the connection is disconnected.
  • the local electronic device After receiving public key 2 and MAC2 sent by other electronic devices, the local electronic device performs security verification to determine whether the hash value of public key 1 matches public key 2 and whether the hash value of MAC1 matches MAC2. After determining that the public key and MAC do not match, the local electronic device disconnects from other electronic devices.
  • the peer electronic device can send the hash value of public key 1 or the hash value of MAC1; in step S9B08, other electronic devices can send public key 2 or MAC2; in step S9B09, the local electronic device determines that the public key does not match or the MAC does not match.
  • connection between the local electronic device and the peer electronic device may be secure.
  • the local electronic device and the peer electronic device can also exchange session keys, where the session key can be generated by the local electronic device.
  • the method of exchanging session keys is introduced below.
  • Figure 10 is an exemplary schematic diagram of a local electronic device exchanging session keys with a peer electronic device according to an embodiment of the present application.
  • the method for exchanging session keys between a local electronic device and a peer electronic device includes three steps.
  • the local electronic device can generate a session key.
  • the session key corresponds to the session public key, and the session public key can be sent to the peer electronic device through broadcast or other methods.
  • S1002 Send the session key encrypted by public key 1.
  • the local electronic device sends the session key encrypted by public key 1 to the peer electronic device.
  • public key 1 can refer to the text description in Figure 8, Figure 9A and Figure 9B above, and will not be described again here.
  • public key 1 corresponds to private key 1, and private key 1 is known to the peer electronic device.
  • S1003 Use private key 1 to decrypt and obtain the session key.
  • the peer electronic device After receiving the session key encrypted by public key 1, the peer electronic device can use the known private key 1 to decrypt the data, thereby obtaining the session key.
  • the session key is used to encrypt data interaction between the local electronic device and the peer electronic device in subsequent steps. For example, when the peer electronic device sends information such as the public key of the slave device, the MAC of the slave device, the serial number of the slave device, etc., it can use the session key to perform encryption.
  • the peer electronic device determines the slave device based on the first request, and sends information for connecting the slave device to the local electronic device.
  • the peer electronic device determines the slave device based on the first request.
  • For the content of the first request please refer to the text description in step S701 above, which will not be described again here.
  • the peer electronic device after receiving the first request, if the peer electronic device determines that there is no slave device corresponding to the first request, it does not respond to the first request; or, the local electronic device An error message is sent so that the local electronic device determines that the peer electronic device is not connected to a suitable slave device.
  • the corresponding relationship between the first request and the slave device is as shown in Table 1.
  • Table 1 is an exemplary schematic table of the corresponding relationship between a first request and a slave device provided by the embodiment of the present application.
  • the peer electronic device can also determine the data to be shared from the multiple slave devices.
  • slave device For example, the slave device includes a Bluetooth headset, an electric fan, a refrigerator, etc., and when the first request includes an identification of the music sharing service or a Bluetooth headset identification, the peer electronic device can determine that the slave device is a Bluetooth headset; when the first request includes In the case of an electric fan identification, the peer electronic device can determine that the slave device is an electric fan.
  • the peer electronic device After determining the slave device, the peer electronic device sends information for connecting the slave device to the local electronic device.
  • the information used to connect the slave device may include the identification of the connection between the peer electronic device and the slave device, the MAC of the slave device, and the product serial number (Serical Number, SN) of the slave device.
  • the peer electronic device can also obtain the identification information of the local electronic device, and send the identification information of the local electronic device to the slave device.
  • the identification information may be the ID of the local electronic device, the MAC of the local electronic device, or any other information that can distinguish the local electronic device from other electronic devices, which is not limited here.
  • the first request may also be used to notify the peer electronic device: after a period of time, the slave device may disconnect from the peer electronic device.
  • the peer electronic device after the peer electronic device receives the first request, the peer electronic device will first ask the user to obtain the user's authorization, and then send the information for connecting to the slave device. to local electronic equipment.
  • the peer electronic device after the peer electronic device receives the first request, it will also send a first message to the slave device, so that the slave device enters a connectable state, thereby allowing the slave device to be connected by the local electronic device. Device connection.
  • the peer electronic device may also send information for mutual authentication between the slave device and the local electronic device to the local electronic device respectively. equipment and peer electronic equipment.
  • the information used for mutual authentication between the slave device and the local electronic device can come from the slave device and the local electronic device respectively, or can also come from the peer electronic device itself.
  • the information used for mutual authentication between the slave device and the local electronic device may be an identification of the connection between the peer electronic device and the local electronic device, or may be an identification of the connection between the peer electronic device and the slave device.
  • the identifier can be a token or other parameters.
  • the local electronic device connects the slave device of the peer electronic device based on the information used to connect the slave device.
  • the local electronic device After receiving the information for connecting to the slave device, the local electronic device can connect to the slave device of the peer electronic device based on the information for connecting to the slave device.
  • pairing and data interaction can be performed.
  • the slave device is an electronic device that supports classic Bluetooth, pairing is completed during the connection process.
  • the playback when the peer electronic device is playing audio information, video information or other information through the slave device, after receiving the first request sent by the local electronic device, the playback can be paused; or, After the peer electronic device sends information for connecting to the slave device, playback is paused.
  • the local electronic device can directly import recipes or configure the settings of the rice cooker, such as what time to start cooking, and what time to start cooking. What meals, etc.; when the slave device is a stylus or wireless keyboard and mouse, the user can use the stylus or wireless keyboard and mouse to operate on the local electronic device.
  • the slave device when the slave device is an electronic device that supports multiple connections, when both the local electronic device and the peer electronic device are playing audio information or video information, the slave device can give priority to playing the local electronic device. Audio or video information from the device.
  • the slave device when the slave device obtains the identification information of the local electronic device, the slave device can verify whether the electronic device that initiates the connection to the slave device is a local electronic device based on the identification information of the local electronic device. , thereby achieving reliable and secure connections.
  • the identification information of the local electronic device may be the MAC of the local electronic device.
  • connection process of the local electronic device and the slave device of the peer electronic device is exemplarily introduced below with reference to the content shown in FIGS. 11 to 13 .
  • Figure 11 is an exemplary schematic diagram of the connection between a local electronic device and a slave device provided by an embodiment of the present application.
  • the method for connecting a local electronic device to a slave device includes the following steps.
  • S1101 Send the first request.
  • the local electronic device sends a first request to the peer electronic device.
  • first request For the concept of the first request, reference can be made to the textual descriptions in steps S701 and S702 above, and will not be described again here.
  • the local electronic device may send the first request to the peer electronic device through a connection established with the peer electronic device or other means.
  • S1102 Ask the user whether the slave device can be shared.
  • Step S1102 is an optional step, that is, the peer electronic device does not need to perform step S1102.
  • step S1102 is an optional step.
  • the local electronic device and the peer electronic device are logged into the same account, or the local electronic device and the peer electronic device are logged into the same account, such as a family group.
  • the peer electronic device will ask the user whether the slave device can be shared by displaying control 4B04 of interface 4B01 in Figure 4B on the interface.
  • interface on the peer electronic device that asks the user whether the slave device can be shared is not limited to the content shown in interface 4B01 in Figure 4B.
  • S1103 Send the identification of the local electronic device.
  • Step S1103 is an optional step, that is, the peer electronic device does not need to perform step S1103.
  • step S1103 the slave device will not execute step S1107.
  • the peer electronic device sends the identification of the local electronic device to the slave device.
  • the identifier of the local electronic device may be the MAC of the local electronic device, or other parameters that can distinguish the local electronic device from other electronic devices.
  • S1104 Send the identification information of the slave device and information for verification.
  • the peer electronic device sends identification information of the slave device and information for connection to the local electronic device.
  • the identification of the slave device may be the MAC of the slave device, or other parameters that can distinguish the slave device from other electronic devices.
  • the MAC may be a random address of the slave device or a public address of the slave device.
  • the information used for verification may include at least one of an identification of the connection between the slave device and the peer electronic device, a serial number of the slave device, and the like.
  • the identification of the connection between the slave device and the peer electronic device may be a token or other parameters.
  • the peer electronic device may only send the identification information of the slave device to the local electronic device.
  • the local electronic device and the slave device may not perform steps S1107 and S1108.
  • the connection between the local electronic device and the slave device does not require additional verification.
  • the slave device only verifies whether the local electronic device matches the identity of the local electronic device. Whether they match to complete the security verification.
  • step S1105 is an optional step.
  • the slave device when the slave device actively switches to the connectable state, when the slave device is a Bluetooth headset.
  • S1106 Establish a connection based on the identity of the slave device.
  • the local electronic device establishes a connection based on the identity of the slave device, and the connection is used to carry data interaction between the local electronic device and the slave device.
  • S1107 Verify whether the local electronic device matches the identity of the local electronic device.
  • the slave device checks whether the local electronic device initiating the connection matches the identification of the local electronic device sent by the peer electronic device. If it matches, it continues to perform subsequent steps; if it does not match, it interrupts the connection.
  • S1108 Perform two-way authentication or one-way authentication based on the information used for connection.
  • step S1107 by the slave device can also be considered as a kind of verification.
  • the local electronic device and the slave device are verified twice.
  • the local electronics and slave devices can perform two-way authentication or one-way authentication based on the information used for the connection.
  • the following is an exemplary introduction to the verification process of the local electronic device and the slave device in conjunction with the content shown in Figure 12, Figure 13 and Figure 14.
  • Figure 12 is an exemplary schematic diagram of the authentication between a local electronic device and a slave device provided by an embodiment of the present application.
  • the method for verifying the local electronic device and the slave device includes the following steps.
  • Step S1201 Generate derived token 1 based on random number 1 and token.
  • the token belongs to the identification of the connection between the slave device and the peer electronic device.
  • Random number 1 is a random number generated by the local electronic device.
  • the token on the local electronic device originates from the peer electronic device and is sent by the peer electronic device to the local electronic device.
  • Step S1202 Send random number 1 and derived token 1.
  • the local electronic device sends the random number 1 and the derived token 1 to the slave device.
  • Step S1203 Generate derived token 2 based on random number 1 and token.
  • a derived token 2 can be generated based on the nonce 1 and the token.
  • Step S1204 Verify whether derived token 2 is equal to derived token 1.
  • the slave device can determine whether derived token 2 and derived token 1 are equal. If they are equal, the verification passes; if they are not equal, the verification fails.
  • the slave device can determine that the local electronic device is a trusted and correct electronic device.
  • Step S1205 Generate derived token 3 based on random number 2 and token.
  • the slave device can derive a token3 based on the nonce2 and token generation.
  • random number 2 is a random number generated by the slave device.
  • Step 1206 Send random number 2 and derived token 3.
  • Step S1207 Generate derived token 4 based on random number 2 and token.
  • the local electronic device derives token 4 based on random number 2 and token generation.
  • Step S1208 Verify whether derived token 3 is equal to derived token 4.
  • the local electronic device determines whether derived token 3 and derived token 4 are equal. If they are equal, the verification passes; if they do not want to be hit, the verification fails.
  • steps S1201 to S1204 are one-way verification; steps S1205 to S1208 are also one-way verification; and steps S1201 to S1208 are two-way verification.
  • the verification between the local electronic device and the slave device can also perform one-way verification or two-way verification through the public key of the peer electronic device and the public key of the slave device, and is not limited to the token parameter.
  • Figure 13 is another exemplary schematic diagram of authentication between a local electronic device and a slave device provided by an embodiment of the present application.
  • the method for authenticating the local electronic device and the slave device may include the following steps.
  • the local electronic device After the local electronic device establishes a connection with the slave device, it can request the slave device to send a verification message.
  • the slave device may send a hash of the slave device's public key to the local electronic device.
  • the slave device may send the hash value of the slave device MAC to the local electronic device.
  • the slave device may send the hash value of the slave device MAC and the slave device's public key operation result to the local electronic device.
  • the slave device may send a hash value of the slave device's serial number to the local electronic device.
  • the hash value of the public key can be replaced by the hash value of other parameters.
  • the parameters need to be obtainable by the local electronic device from the peer electronic device, and the parameters need to be related to the slave device. .
  • S1303 Verify the hash value of the slave device's public key.
  • the local electronic device can verify whether the hash value is correct after receiving the hash value of the public key sent from the device. Among them, the local electronic device can receive the public key of the slave device from the peer electronic device, and then verify whether the slave device is the correct slave device.
  • the local electronic device after receiving the hash value of the slave device MAC and the slave device's public key operation result, the local electronic device can also verify the slave device MAC and the slave device. The hash value of the public key operation result. Among them, the local electronic device can obtain the MAC of the slave device from the peer electronic device.
  • the local electronic device after receiving the hash value of the slave device serial number, can also verify the hash value of the slave device serial number.
  • the local electronic device can obtain the serial number of the slave device from the peer electronic device.
  • the slave device requests the local electronic device to send verification information.
  • S1305 Send the public key of the slave device.
  • the local electronic device can send the slave device's public key to the slave device.
  • the electronic device can also send the local electronic device MAC and other parameters that can be verified by the slave device.
  • the parameters verified by the slave device are parameters that can be obtained from the peer electronic device or parameters known by the slave device itself.
  • the slave device verifies whether the public key of the slave device sent by the local electronic device is consistent with its own public key, thereby completing the verification.
  • steps S1301 to S1303 are one-way verification; steps S1304 to S1306 are also one-way verification; and steps S1301 to S1306 are two-way verification.
  • steps S1301 and S1304 are optional steps, that is, the verification process between the local electronic device and the slave device may not be triggered by a request, but may be automatically triggered after the connection is established.
  • the verification between the local electronic device and the slave device can also use the public key of the peer electronic device or the public key of the slave device, as shown in Figure 14.
  • Figure 14 is another exemplary schematic diagram of authentication between a local electronic device and a slave device provided by an embodiment of the present application.
  • the verification of the local electronic device and the slave device may include the following steps.
  • S1401 Send a random number encrypted by the public key of the slave device.
  • the local electronic device generates a random number, which is then encrypted using the public key of the slave device and sent to the slave device. Among them, the local electronic device obtains the public key of the slave device from the peer electronic device.
  • the local electronic device can also use the public key of the peer electronic device to encrypt the random number, where the peer electronic device sends its own public key to the local electronic device, and the peer electronic device Send your private key to the slave device.
  • S1402 Use the private key of the slave device to decrypt and obtain a random number.
  • the slave device uses its own private key to decrypt and obtain the random number.
  • the slave device can also use the private key of the peer electronic device to decrypt and obtain the random number.
  • the local electronic device verifies the random number, that is, verifies whether the received random number is consistent with the random number in step S1401.
  • steps S1401 to S1404 are one-way verification.
  • the slave device can also initiate one-way verification to the local electronic device; or the local electronic device and the slave device can perform two-way verification.
  • step S1401 may be triggered by the slave device sending a verification request.
  • data interaction can be performed based on the connection. For example, you can start pairing, transfer media files, etc., which are not limited here.
  • S704 The slave device is disconnected from the local electronic device, and the information used to connect the slave device is deleted or invalidated.
  • Step S704 is an optional step.
  • the slave device After a period of time, the slave device is disconnected from the local electronic device, and the slave device and/or the local electronic device delete or invalidate the information used to connect the slave device.
  • the period of time may be a length of time indicated by the time information in the first request sent by the peer electronic device.
  • the peer electronic device instructs the slave device after how long to disconnect from the local electronic device based on the time information.
  • the slave device and/or the local electronic device Upon disconnection, the slave device and/or the local electronic device deletes or invalidates the information used to connect the slave device.
  • the slave device After the information used to connect to the slave device is deleted or invalidated, the slave device remains in its original state. In scenarios such as media file sharing, the security of the slave device will also be ensured.
  • Figure 15A is an exemplary schematic diagram of the method flow of the communication method provided by the embodiment of the present application.
  • the communication method provided by the embodiment of the present application may include the following steps.
  • Steps S15A01, S15A02, S15A04, S15A09, S15A10, S15A12 and S15A14 are optional steps.
  • S15A01 Inquire about connectable electronic devices via broadcast.
  • the local electronic device inquires for connectable electronic devices via broadcast.
  • the peer electronic device may query the local electronic device through broadcast.
  • the peer electronic device After receiving the broadcast query from the local electronic device, the peer electronic device replies to the query so that the local electronic device can discover the local electronic device. sub-device.
  • the peer electronic device when the peer electronic device can query the local electronic device through broadcast, the local electronic device replies to the query.
  • the local electronic device can discover the peer electronic device through other methods, which is not limited here.
  • the local electronic device may determine that the distance between the peer electronic device and the local electronic device is the first distance, and then determine whether the first distance is less than equal to the distance threshold, and then determine whether to execute step S15A03.
  • the local electronic device establishes a connection with the peer electronic device.
  • the peer electronic device before performing step S15A03, when the initiator of the connection is a local electronic device, the peer electronic device needs to obtain the user's authorization before establishing a connection with the local electronic device. .
  • the local electronic device and the peer electronic device perform security verification.
  • the security verification is to avoid malicious misconnection by forwarding broadcast messages, and on the other hand, it is to exchange session private keys.
  • the content of the security verification performed by the local electronic device and the peer electronic device can refer to the above step S701, the text description corresponding to Figure 8, the text description corresponding to Figure 9A and Figure 9B, and the text description corresponding to Figure 10, which are not included here. Again.
  • S15A05 Send the first request.
  • the local electronic device sends a first request to the peer electronic device.
  • a first request For the content of the first request, please refer to the text description in step S702, which will not be described again here.
  • the peer electronic device can obtain the user's authorization through various methods such as displaying notifications on the interface.
  • displaying notifications on the interface For an exemplary interface, refer to the content shown in interface 4B01 in Figure 4B.
  • S15A07 Send the first message.
  • the peer electronic device sends a first message to the slave device, and the first message is used to notify the slave device to switch to a connectable state.
  • the first message may also be called the first instruction.
  • the first message may also include time information.
  • the time information is used to instruct the slave device to reconnect to the peer electronic device after an interval of time; and/or, the time information is also used to instruct the slave device to delete information related to connection or security verification with the local electronic device, thereby achieving A temporary connection with the local electronic device; and/or, the time information may also indicate parameters such as the failure of the slave device and the key that was once shared with the local electronic device.
  • the slave device enters the connectable state.
  • the connection between the slave device and the peer electronic device is disconnected.
  • S15A09 Send a message for authenticating the local electronic device.
  • the peer electronic device sends parameters used to verify the local electronic device to the local electronic device.
  • the parameters used for verification may include the identification of the local electronic device, such as the MAC of the local electronic device.
  • the parameters used to verify the local electronic device may be related to the connection between the local electronic device and the peer electronic device, or may be inherent parameters of the local electronic device.
  • the peer electronic device can obtain parameters used to verify the local electronic device through connection with the local electronic device.
  • S15A10 Send information for verifying the slave device.
  • the slave device sends information used to verify the slave device to the peer electronic device.
  • the information for verifying the slave device may be the public key of the slave device.
  • S15A11 Send information for connecting to the slave device.
  • the peer electronic device sends information for connecting to the slave device to the local electronic device.
  • the information connected to the slave device may be the MAC of the slave device.
  • the peer electronic device since the peer electronic device has been connected to the slave device before, the peer electronic device stores the MAC of the slave device.
  • S15A12 Send information for verifying the slave device.
  • the peer electronic device sends information for verifying the slave device to the local electronic device.
  • the information for verifying the slave device can come from step S15A10, such as the public key of the slave device; or the information for verifying the slave device can also come from the information exchanged when the peer electronic device and the slave device are connected before, such as the identification of the slave device. , the MAC of the slave device, the peer electronic device The token corresponding to the connection between the device and the slave device.
  • the local electronic device establishes a connection with the slave device.
  • the local electronic device performs security verification with the slave device.
  • the content of the security verification between the local electronic device and the slave device please refer to the text description corresponding to Figure 12, the text description corresponding to Figure 13, and the text description corresponding to Figure 14, and will not be described again here.
  • the local electronic device can perform pairing with the peer electronic device, and then perform data interaction.
  • Figure 15B is another exemplary schematic diagram of the method flow of the communication method provided by the embodiment of the present application.
  • step S15B01 for step S15B01, step S15B02, step S15B03, and step S15B04, reference can be made to the content of step S15A01, step S15A02, step S15A03, and step S15A04 in FIG. 15A, which will not be described again here.
  • S15B05 Send the first request.
  • the local electronic device sends a first request to the peer electronic device, where the first request is used to share the slave device connected to the local electronic device.
  • the user's authorization is also required to be obtained during the execution of step S15B05.
  • S15B06 Send the first message.
  • step S15A07 For the content of the first message, please refer to the text description in step S15A07, which will not be described again here.
  • step S15A08 For the content of the connectable state, please refer to the text description in step S15A08, which will not be described again here.
  • S15B08 Send information used to verify the peer electronic device.
  • the local electronic device sends information used to verify the peer electronic device to the slave device.
  • the parameters used for verification may include the identity of the peer electronic device, such as the MAC of the peer electronic device.
  • the parameters used to verify the peer electronic device may be related to the connection between the local electronic device and the peer electronic device, or may be inherent parameters of the peer electronic device.
  • the peer electronic device can obtain parameters used to verify the peer electronic device through connection with the local electronic device.
  • S15B09 Send information for verifying the slave device.
  • the local electronic device sends information for verifying the slave device to the peer electronic device.
  • the information used to verify the slave device may be the public key of the slave device, etc.
  • S15B10 Send information for connecting to the slave device.
  • the local electronic device sends information for connecting the slave device to the peer electronic device.
  • the information connected to the slave device may be the MAC of the slave device.
  • the MAC of the slave device is stored on the local electronic device.
  • S15B11 Send information for verifying the slave device.
  • the local electronic device sends information for verifying the slave device to the peer electronic device.
  • the information for verifying the slave device can come from step S15B09, such as the public key of the slave device; or the information for verifying the slave device can also come from the information exchanged when the peer electronic device and the slave device are connected before, such as the identification of the slave device. , the MAC of the slave device, the token corresponding to the connection between the peer electronic device and the slave device.
  • the peer electronic device establishes a connection with the slave device.
  • the peer electronic device and the slave device perform security verification.
  • the content of the security verification between the peer electronic device and the slave device please refer to the text description corresponding to Figure 12, the text description corresponding to Figure 13, and the text description corresponding to Figure 14, and will not be repeated here.
  • Figure 16 is an exemplary schematic diagram of the hardware structure of a local electronic device, a peer electronic device, and a slave device provided by an embodiment of the present application.
  • the local electronic device, the peer electronic device, or the slave device may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, and Cellular phones, personal digital assistants (PDAs), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, vehicles equipment, smart home equipment and/or smart city equipment.
  • PDAs personal digital assistants
  • AR augmented reality
  • VR virtual reality
  • AI artificial intelligence
  • the electronic device is used below to refer to any one of the local electronic device, the peer electronic device and the slave device.
  • the electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, Mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and user Identification module (subscriber identification module, SIM) card interface 195, etc.
  • a processor 110 an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, Mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen
  • the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structures illustrated in the embodiments of the present invention do not constitute specific limitations on the electronic equipment.
  • the electronic device may include more or less components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
  • processor 110 may include one or more interfaces.
  • Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and /or universal serial bus (USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous receiver and transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (derail clock line, SCL).
  • processor 110 may include multiple sets of I2C buses.
  • the processor 110 can separately couple the touch sensor 180K, charger, flash, camera 193, etc. through different I2C bus interfaces.
  • the processor 110 can be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to implement the touch function of the electronic device.
  • the I2S interface can be used for audio communication.
  • processor 110 may include multiple sets of I2S buses.
  • the processor 110 can be coupled with the audio module 170 through the I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface to implement the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications to sample, quantize and encode analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is generally used to connect the processor 110 and the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 110 and the camera 193 communicate through a CSI interface to implement the shooting function of the electronic device.
  • the processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device.
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 110 with the camera 193, display screen 194, wireless communication module 160, audio module 170, sensor module 180, etc.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface that complies with the USB standard specification, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
  • the USB interface 130 can be used to connect a charger to charge the electronic device, and can also be used to transmit data between the electronic device and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.
  • the interface connection relationships between the modules illustrated in the embodiments of the present invention are only schematic illustrations and do not constitute structural limitations on the electronic equipment.
  • the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device. While the charging management module 140 charges the battery 142, it can also provide power to the electronic device through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, and the like.
  • the power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device can be realized through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in an electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • Antenna 1 can be reused as a diversity antenna for a wireless LAN.
  • antennas may be used in conjunction with tuning switches.
  • the mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied to electronic devices.
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 150 may be disposed in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • a modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194.
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110 and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), and global navigation satellite systems for use in electronic devices. (global navigation satellite system, GNSS), frequency modulation (FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the antenna 1 of the electronic device is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi) -zenith satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device implements display functions through the GPU, display screen 194, and application processor.
  • GPU is an image processing microprocessor connected to Connect the display 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • the display screen 194 is used to display images, videos, etc.
  • Display 194 includes a display panel.
  • the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • AMOLED organic light-emitting diode
  • FLED flexible light-emitting diode
  • Miniled MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
  • the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the electronic device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
  • the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise and brightness. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.
  • Camera 193 is used to capture still images or video.
  • the object passes through the lens to produce an optical image that is projected onto the photosensitive element.
  • the photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other format image signals.
  • the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
  • Video codecs are used to compress or decompress digital video.
  • Electronic devices may support one or more video codecs. In this way, electronic devices can play or record videos in multiple encoding formats, such as: Moving Picture Experts Group (MPEG)1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG Moving Picture Experts Group
  • MPEG2 MPEG2, MPEG3, MPEG4, etc.
  • NPU is a neural network (NN) computing processor.
  • NN neural network
  • Intelligent cognitive applications of electronic devices can be realized through NPU, such as image recognition, face recognition, speech recognition, text understanding, etc.
  • the internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
  • RAM random access memories
  • NVM non-volatile memories
  • Random access memory can include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous memory Dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, for example, the fifth generation DDR SDRAM is generally called DDR5SDRAM), etc.; non-volatile memory can include disk storage devices and flash memory (flash memory).
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • non-volatile memory can include disk storage devices and flash memory (flash memory).
  • Flash memory can be divided according to the operating principle to include NOR FLASH, NAND FLASH, 3D NAND FLASH, etc.
  • the storage unit potential level it can include single-level storage cells (single-level cell, SLC), multi-level storage cells (multi-level cell, MLC), third-level storage unit (triple-level cell, TLC), fourth-level storage unit (quad-level cell, QLC), etc., which can include universal flash storage (English: universal flash storage, UFS) according to storage specifications. , embedded multi media card (embedded multi media Card, eMMC), etc.
  • the random access memory can be directly read and written by the processor 110, can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data, etc.
  • the non-volatile memory can also store executable programs and user and application data, etc., and can be loaded into the random access memory in advance for direct reading and writing by the processor 110.
  • the external memory interface 120 can be used to connect an external non-volatile memory to expand the storage capacity of the electronic device.
  • the external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, save music, video and other files in external non-volatile memory.
  • the electronic device can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio. Signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
  • the electronic device can listen to music through speaker 170A, or listen to hands-free calls.
  • Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the electronic device answers a call or a voice message, the voice can be heard by bringing the receiver 170B close to the human ear.
  • Microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak close to the microphone 170C with the human mouth and input the sound signal to the microphone 170C.
  • the electronic device may be provided with at least one microphone 170C. In other embodiments, the electronic device may be provided with two microphones 170C, which in addition to collecting sound signals, may also implement a noise reduction function. In other embodiments, the electronic device can also be equipped with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions, etc.
  • the headphone interface 170D is used to connect wired headphones.
  • the headphone interface 170D may be a USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA Cellular Telecommunications Industry Association of the USA
  • the pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals.
  • pressure sensor 180A may be disposed on display screen 194 .
  • pressure sensors 180A there are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.
  • a capacitive pressure sensor may include at least two parallel plates of conductive material.
  • the electronic device detects the strength of the touch operation according to the pressure sensor 180A.
  • the electronic device may also calculate the touched position based on the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch location but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold is applied to the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B can be used to determine the motion posture of the electronic device. In some embodiments, the angular velocity of the electronic device about three axes (ie, x, y, and z axes) may be determined by gyro sensor 180B.
  • the gyro sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyro sensor 180B detects the angle at which the electronic device shakes, and calculates the distance that the lens module needs to compensate based on the angle, so that the lens can offset the shake of the electronic device through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • Air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
  • Magnetic sensor 180D includes a Hall sensor.
  • the electronic device can use the magnetic sensor 180D to detect the opening and closing of the flip holster.
  • the electronic device may detect opening and closing of the flip according to the magnetic sensor 180D. Then, based on the detected opening and closing status of the leather case or the opening and closing status of the flip cover, features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the acceleration of the electronic device in various directions (generally three axes). When the electronic device is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices and be used in horizontal and vertical screen switching, pedometer and other applications.
  • Distance sensor 180F for measuring distance.
  • Electronic devices can measure distance via infrared or laser. In some embodiments, when shooting a scene, the electronic device can utilize the distance sensor 180F to measure distance to achieve fast focusing.
  • Proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • Electronic devices emit infrared light through light-emitting diodes.
  • Electronic devices use photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device. When insufficient reflected light is detected, the electronic device can determine that there is no object near the electronic device.
  • Electronic devices can use the proximity light sensor 180G to detect when the user holds the electronic device close to the ear and talk, so that the screen can be automatically turned off to save power.
  • the proximity light sensor 180G can also be used in holster mode, and pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device can adaptively adjust the brightness of the display screen 194 based on perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device is in the pocket to prevent accidental touching.
  • Fingerprint sensor 180H is used to collect fingerprints. Electronic devices can use the collected fingerprint characteristics to unlock fingerprints, access application locks, take photos with fingerprints, answer incoming calls with fingerprints, etc.
  • Temperature sensor 180J is used to detect temperature.
  • the electronic device utilizes the temperature detected by the temperature sensor 180J to perform Temperature treatment strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device reduces the performance of a processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device heats the battery 142 to prevent the low temperature from causing abnormal shutdown of the electronic device. In some other embodiments, when the temperature is lower than another threshold, the electronic device performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also known as "touch device”.
  • the touch sensor 180K can be disposed on the display screen 194.
  • the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K.
  • the touch sensor can pass the detected touch operation to the application processor to determine the touch event type.
  • Visual output related to the touch operation may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device at a location different from that of the display screen 194 .
  • Bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human body's vocal part.
  • the bone conduction sensor 180M can also contact the human body's pulse and receive blood pressure beating signals.
  • the bone conduction sensor 180M can also be provided in an earphone and combined into a bone conduction earphone.
  • the audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibrating bone obtained by the bone conduction sensor 180M to implement the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M to implement the heart rate detection function.
  • the buttons 190 include a power button, a volume button, etc.
  • Key 190 may be a mechanical key. It can also be a touch button.
  • the electronic device can receive key input and generate key signal input related to user settings and function control of the electronic device.
  • the motor 191 can generate vibration prompts.
  • the motor 191 can be used for vibration prompts for incoming calls and can also be used for touch vibration feedback.
  • touch operations for different applications can correspond to different vibration feedback effects.
  • the motor 191 can also respond to different vibration feedback effects for touch operations in different areas of the display screen 194 .
  • Different application scenarios such as time reminders, receiving information, alarm clocks, games, etc.
  • the touch vibration feedback effect can also be customized.
  • the indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to realize contact and separation from the electronic device.
  • the electronic device can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
  • the SIM card interface 195 is also compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • Electronic devices interact with the network through SIM cards to implement functions such as calls and data communications.
  • the electronic device uses an eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the electronic device and cannot be separated from the electronic device.
  • the local electronic device can be connected to the peer electronic device through the wireless communication module 160; the local electronic device can be connected to the slave device through the wireless communication module 160.
  • FIG. 17A is an exemplary schematic diagram of the software architecture of an electronic device provided by an embodiment of the present application.
  • Software systems of electronic devices can adopt layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture.
  • the embodiment of the present invention takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device.
  • the layered architecture divides the software into several layers, and each layer has clear roles and division of labor.
  • the layers communicate through software interfaces.
  • the Android system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime and system libraries, and kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
  • the application framework layer provides an application programming interface (API) and programming framework for applications in the application layer.
  • API application programming interface
  • the application framework layer includes some predefined functions.
  • the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
  • a window manager is used to manage window programs.
  • the window manager can obtain the display size, determine whether there is a status bar, lock the screen, capture the screen, etc.
  • Content providers are used to store and retrieve data and make this data accessible to applications.
  • Said data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, etc.
  • a view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
  • Telephone managers are used to provide communication functions of electronic devices. For example, call status management (including connected, hung up, etc.).
  • the resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.
  • the notification manager allows applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of conversation windows. For example, text information is prompted in the status bar, a beep sounds, the electronic device vibrates, the indicator light flashes, etc.
  • Android Runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
  • the core library contains two parts: one is the functional functions that need to be called by the Java language, and the other is the core library of Android.
  • the application layer and application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and application framework layer into binary files.
  • the virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection and other functions.
  • System libraries can include multiple functional modules. For example: surface manager (surface manager), media libraries (Media Libraries), 3D graphics processing libraries (for example: OpenGL ES), 2D graphics engines (for example: SGL), etc.
  • the surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, composition, and layer processing.
  • 2D Graphics Engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, sensor driver and Bluetooth driver.
  • the Bluetooth connection between the local electronic device and the peer electronic device can be performed through the Bluetooth driver; correspondingly, the Bluetooth connection between the local electronic device and the slave device can be performed through the Bluetooth driver.
  • FIG. 17B is another exemplary schematic diagram of the software architecture of an electronic device provided by an embodiment of the present application.
  • the software architecture of the electronic device includes a media playback module, a device connection management module and a Bluetooth hardware abstraction layer.
  • the media playing module can be used to play media files.
  • the device connection management module includes a device discovery module and a device connection module.
  • the device discovery module is used to discover other surrounding electronic devices; the device connection module is used to connect the discovered electronic devices and perform security verification.
  • the Bluetooth hardware abstraction layer is used to call the Bluetooth hardware by the device connection management module, and then perform Bluetooth connections with other electronic devices.
  • the term “when” may be interpreted to mean “if" or “after” or “in response to determining" or “in response to detecting" depending on the context.
  • the phrase “when determining" or “if (stated condition or event) is detected” may be interpreted to mean “if it is determined" or “in response to determining" or “on detecting (stated condition or event)” or “in response to detecting (stated condition or event)”.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted over a wired connection from a website, computer, server, or data center (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) means to transmit to another website, computer, server or data center.
  • the computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center integrated with one or more available media.
  • the available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, solid state drive), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本申请实施例提供了通信方法、通信系统及电子设备,涉及电子技术领域。本申请实施例提供的通信方法,可以使没有连接从设备的第一电子设备通过信息交互的方式去连接第二电子设备的从设备。其中,从设备可以是蓝牙耳机、手写笔、无线键鼠等电子设备。其中,用户可以在第一电子设备上操作也可以在第二电子设备操作。本申请实施例提供的通信方法可以极大的提升多用户和/或多设备场景下,从设备在不同设备之间的流转能力,提升用户的体验。

Description

通信方法、通信系统及电子设备
本申请要求于2022年06月30日提交中国专利局、申请号为202210761381.X、申请名称为“通信方法、通信系统及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及电子技术领域,尤其涉及通信方法、通信系统及电子设备。
背景技术
随着电子技术的发展以及近场无线通信技术的成熟,越来越多的消费者开始使用无线设备,例如蓝牙耳机、无线键鼠以及其他设备等。
电子设备通过近场无线通信技术连接其他无线设备时,需要被连接的其他无线设备处于可发现状态或可连接状态,进而才能建立连接。
例如,对于蓝牙耳机来说,电子设备和蓝牙耳机建立连接步骤可以分为下面两步骤:第一步,用户需要先将蓝牙耳机与其他设备断开连接,并且在一些情况下还需要长按蓝牙耳机的功能按钮,进而将蓝牙耳机的状态转换为可连接状态;第二步,响应于用户的操作,电子设备搜索附件的蓝牙设备,然后与该蓝牙设备连接然后执行配对。
很显然的,电子设备连接一个已经和其他电子设备连接的无线设备,需要用户在多个电子设备上操作,操作的步骤相对繁琐,不利于用户的体验。
发明内容
本申请实施例提供了通信方法、通信系统及电子设备,涉及电子技术领域。本申请实施例提供的通信方法,可以使没有连接从设备的电子设备通过信息交互的方式去连接另一个电子设备的从设备,不需要用户执行繁琐的操作,提升了用户的体验。
第一方面,本申请实施例提供了一种通信方法,应用于包括第一电子设备和第二电子设备的通信系统,该方法包括:该第二电子设备与从设备连接,在该第二电子设备确定要建立该第一电子设备与该从设备之间的连接的情况下,该第二电子设备向该第一电子设备发送第一消息,并且该第二电子设备向该从设备发送第一指示,该第一指示用于指示该从设备进入可连接状态,该第一消息用于指示该第一电子设备连接该从设备,该第一消息中包括用于连接该从设备的信息;该第一电子设备基于该第一消息连接该从设备。
在上述实施例中,第一电子设备可以通过第一消息连接从设备,不需要用户将从设备手动配置为可连接状态,方便了用户的使用。
结合第一方面的一些实施例,在一些实施例中,该方法还包括:响应于接收到用户在该第二电子设备上的操作,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
在上述实施例中,若第二电子设备的用户想要主动将从设备分享给第一电子设备的用户,可以通过界面的形式操作,进而触发第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
结合第一方面的一些实施例,在一些实施例中,在该响应于接收到用户在该第二电子设备上的操作后,该方法还包括:该第二电子设备向该第一电子设备发送第一请求,该第一请求用于将该从设备分享至该第一电子设备;该第一电子设备接收到该第一请求后,该第一电子设备向该第二电子设备发送确认消息;在该第二电子设备接收到该确认消息后,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
在上述实施例中,第二电子设备通过与用户的交互确定要主动分享从设备后,与第一电子设备交互,进而告知第一电子设备要将从设备分享给第一电子设备,在接收到第一电子设备的确认消息后,第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
结合第一方面的一些实施例,在一些实施例中,该方法还包括:该第一电子设备向该第二电子设备发送第二请求;该第二电子设备接收该第二请求后,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
在上述实施例中,第一电子设备也可以主动的发起请求,该请求用于使第二电子设备确定要建立第一 电子设备与从设备之间的连接。
结合第一方面的一些实施例,在一些实施例中,在该第一电子设备向该第二电子设备发送第二请求前,该方法还包括:该第一电子设备显示第一界面,该第一界面中包括第一控件;在接收到用户对该第一控件操作后,该第一电子设备显示第一窗口,该第一窗口中包括第二控件,该第二控件与该第二电子设备对应;该第一电子设备向该第二电子设备发送第二请求,具体包括:在接收到用户对该第二控件操作后,该第一电子设备向该第二电子设备发送该第二请求。
在上述实施例中,用户可以通过在第一电子设备上的界面操作,使得第一电子设备向第二电子设备发送第二请求。该界面可以是音乐应用程序的界面,也可以是设置中心的界面等。
结合第一方面的一些实施例,在一些实施例中,在该第二电子设备确定要建立该第一电子设备与该从设备之间的连接前,该方法还包括:该第二请求包括从设备的类型,该第二电子设备基于该第二请求确定该从设备;在该第一电子设备基于该第一消息连接该从设备后,该方法还包括:该第一电子设备将该从设备作为输入设备或输出设备。
在上述实施例中,第二请求还可以包括从设备的类型,进而第二电子设备可以从多个从设备中确定出第一电子设备需要的那个从设备。
结合第一方面的一些实施例,在一些实施例中,在该第二电子设备确定要建立该第一电子设备与该从设备之间的连接前,该方法还包括:该第二请求用于分享第一数据,该第二电子设备基于该第一数据确定由该从设备处理该第一数据后,该第二电子设备确定该从设备;在该第一电子设备基于该第一消息连接该从设备后,该方法还包括:该第一电子设备将该第一数据发送到该从设备。
在上述实施例中,第二请求还可以是业务类型、分享数据的请求等,进而第二电子设备可以从多个从设备中确定出第一电子设备需要的那个从设备。
结合第一方面的一些实施例,在一些实施例中,该第一界面为第一应用程序的界面,该第一应用程序为用于播放多媒体文件的应用程序,该第一数据为多媒体文件,该第一界面中还包括第三控件,该第三控件用于播放该第一数据,在该第一电子设备基于该第一消息连接该从设备后,该方法还包括:在接收到用户对该第三控件的操作后,该第一电子设备通过该从设备播放该多媒体文件的画面和/或音频。
在上述实施例中,在第一电子设备上的音乐应用程序界面中,用户可以通过点击一些控件连接第二电子设备的从设备,然后点击播放,就可以使得从设备播放音乐,进而达到快速分享音频的目的。
结合第一方面的一些实施例,在一些实施例中,在该第一电子设备向该第二电子设备发送第一请求前,该方法还包括;该第一电子设备确定第一距离,该第一距离为该第一电子设备和该第二电子设备之间的距离;该第一电子设备确定该第一距离小于距离阈值后,该第一电子设备与该第二电子设备建立连接;该第一电子设备向该第二电子设备发送第一请求,具体包括:该第一电子设备基于该连接向该第二电子设备发送第一请求;该第二电子设备向该第一电子设备发送第一消息,具体包括:该第二电子设备基于该连接向该第一电子设备发送该第一消息。
在上述实施例中,第一电子设备在连接从设备的过程中,第一电子设备可以与第二电子设备建立连接,避免用于连接从设备的信息泄露,保障从设备的信息安全。
结合第一方面的一些实施例,在一些实施例中,该第一电子设备确定第一距离,具体包括:该第二电子设备发送第一广播消息;该第一电子设备接收到该第一广播消息后,基于该第一广播消息确定该第一距离。
在上述实施例中,第一电子设备可以主动测距。
结合第一方面的一些实施例,在一些实施例中,该第一电子设备确定第一距离,具体包括:该第一电子设备发送第一广播消息;该第二电子设备接收到该第一广播消息并基于该第一广播消息确定第一距离后,发送第一响应,该第一响应包括该第一距离;该第一电子设备接收该第一响应后,基于该第一响应确定该第一距离。
在上述实施例中,第一电子设备可以被动测距。
结合第一方面的一些实施例,在一些实施例中,在该第一电子设备与该第二电子设备建立连接前,该方法还包括:该第二电子设备通过广播发送第一验证参数,该第一验证参数为第一参数的哈希值,该第一参数为第一MAC和/或第一公钥,该第一公钥为该第二电子设备的公钥,该第一MAC为该第二电子设备的地址;在该第一电子设备与该第二电子设备建立连接后,还包括:该第二电子设备基于该连接发送该第一参数;该第一电子设备基于该第一参数和该第一验证参数判断是否断开该连接。
在上述实施例中,第一电子设备和第二电子设备之间还可以执行安全性验证,进而避免设备之间的连 接出现错误后,从设备的信息被泄露。
结合第一方面的一些实施例,在一些实施例中,在该第二电子设备接收该第二请求后,在该第二电子设备向该从设备发送第一指示前,该方法还包括:该第二电子设备显示第二界面,该第二界面包括第二窗口和第四控件,该第二窗口用于显示授权提示信息,该授权提示信息用于提示用户是否授权该第一电子设备与该第二从设备建立连接,该第四控件用于获取用户授权;该第二电子设备向该第二从设备发送第一指示,具体包括:在接收到用户对该第四控件的操作后,该第二电子设备向该第二从设备发送该第一指示。
在上述实施例中,第二电子设备上用户确认后,第一电子设备才可以获取到用于连接从设备的信息,进而避免从设备的信息泄密。
结合第一方面的一些实施例,在一些实施例中,在该第二电子设备接收该第二请求后,在该第二电子设备向该第一电子设备发送第一消息前,该方法还包括:该第二电子设备向该从设备发送第三消息,该第三消息用于验证连接该从设备的电子设备是否是该第一电子设备,该第三消息包括第二MAC,该第二MAC为该第一电子设备的地址;在该第一电子设备连接该从设备后,该方法还包括:该从设备基于该第三消息确定连接该从设备的电子设备为该第一电子设备。
在上述实施例中,从设备和第一电子设备之间也可以执行安全性验证。
结合第一方面的一些实施例,在一些实施例中,在该第二电子设备向该从设备发送第一指示后,在该第一电子设备基于该第一消息连接该从设备前,该方法还包括:该第二电子设备向该第一电子设备发送第四消息,该第四消息用于判断基于该第一消息连接的电子设备是否是该从设备,该第四消息包括该从设备的公钥、该从设备的标识信息、该从设备与该第二电子设备连接的标识中的一种或多种;在该第一电子设备基于该第一消息连接该从设备后,该方法还包括:该第一电子设备基于该第四消息确定连接该第一电子设备的电子设备为该从设备。
在上述实施例中,从设备和第一电子设备之间也可以执行安全性验证。
结合第一方面的一些实施例,在一些实施例中,该第一请求或该第一消息中包括第一时长;在该第一电子设备连接该从设备后,该方法还包括:在该第一电子设备连接该从设备的该第一时长后,该第一电子设备断开第一电子设备与该从设备之间的连接。
在上述实施例中,第一电子设备在使用一段时间后断开,进而使得从设备可以连回第二电子设备,无需第二电子设备的用户或第一电子设备的用户执行繁琐的操作。
结合第一方面的一些实施例,在一些实施例中,在该第一电子设备连接该从设备的该第一时长后,该方法还包括:该第一电子设备失效或删除用于连接该从设备的信息。
在上述实施例中,第一电子设备在断开和从设备的连接后,第一电子设备会失效或删除连接从设备的信息,进而避免以后第一电子设备误连接从设备。
结合第一方面的一些实施例,在一些实施例中,该第一请求用于分享第一数据,该第一数据为多媒体文件,该第一时长与该多媒体文件的播放时长有关。
在上述实施例中,第一时长可以与多媒体文件,如音乐的时长有关,进而使得音乐播放后可以自动断开。
结合第一方面的一些实施例,在一些实施例中,处于可连接状态的电子设备可以被连接并且可以被配对。
在上述实施例中,从设备还可以和第一电子设备配对,进而进一步保证从设备和第一电子设备之间的信息交互的安全性。
结合第一方面的一些实施例,在一些实施例中,该方法还包括:该第一电子设备向该第二电子设备发送第二请求;该第二电子设备接收该第二请求后,该第二电子设备基于该第二请求确定该从设备;在该第二电子设备确定该从设备后,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
在上述实施例中,第一电子设备也可以主动的发起请求,该请求用于使第二电子设备确定要建立第一电子设备与从设备之间的连接,并且该请求被第二电子设备
结合第一方面的一些实施例,在一些实施例中,该第二请求包括从设备的类型和/或该第二请求用于分享第一数据,在该第一电子设备基于该第一消息连接该从设备后,该方法还包括:该第一电子设备将该从设备作为输入设备或输出设备。
在上述实施例中,第二请求还可以包括从设备的类型和/或第二请求用于分享什么类型的数据,进而第二电子设备可以从多个从设备中确定出第一电子设备需要的那个从设备。
结合第一方面的一些实施例,在一些实施例中,该第二请求用于分享该第一数据,该第二电子设备基 于该第二请求确定该从设备,具体包括:该第二电子设备基于该第一数据确定由该从设备处理该第一数据后,该第二电子设备确定该从设备;在该第一电子设备将该从设备作为输入设备或输出设备后,该方法还包括:该第一电子设备将该第一数据发送到该从设备。
在上述实施例中,第二请求还可以是分享数据的请求等,进而第二电子设备可以从多个从设备中确定出第一电子设备需要的那个从设备,进而第一电子设备可以直接将数据发送到从设备。
结合第一方面的一些实施例,在一些实施例中,该第一界面为第一应用程序的界面,该第一应用程序为用于播放多媒体文件的应用程序,该第一界面中还包括第三控件,该第三控件用于指示第一电子设备播放多媒体文件;在该第一电子设备基于该第一消息连接该从设备后,该方法还包括:在接收到用户对该第三控件的操作后,该第一电子设备通过该从设备播放该多媒体文件的画面和/或音频。
在上述实施例中,在第一电子设备上的音乐应用程序界面中,用户可以通过点击一些控件连接第二电子设备的从设备,然后点击播放,就可以使得从设备播放音乐,进而达到快速分享音频的目的。
结合第一方面的一些实施例,在一些实施例中,该第二请求包括从设备的类型和/或该第二请求用于分享第一数据,在该第一电子设备基于该第一消息连接该从设备后,该方法还包括:该第一电子设备将该从设备作为输入设备或输出设备,该第一电子设备将该第一数据发送到该从设备。
在上述实施例中,第二电子设备可以通过从设备的类型从多个从设备中确定第一电子设备需要的从设备,然后将该从设备分享到第一电子设备,第一电子设备将第一数据发送到该从设备。或者,第一电子设备发送的第二请求中可以只包括设备类型,然后第二电子设备基于设备类型确定第一电子设备需要的从设备,然后在第一电子设备连接从设备后,向从设备发送第一数据。或者,第一电子设备发送的第二请求为用于分享某个数据的请求,其中携带有用于确定从设备的信息,第二电子设备可以基于该用于确定从设备的信息确定第一电子设备需要的从设备,进而在第一电子设备连接从设备后,可以通过该从设备分享该数据。
第二方面,本申请实施例提供了一种通信方法,应用于第一电子设备,该方法包括:该第一电子设备接收该第二电子设备发送的第一消息,该第一消息用于连接从设备,该第一消息中包括用于连接该从设备的信息,其中,在该第一电子设备接收该第一消息前,该从设备与该第二电子设备连接;其中,在该第一电子设备接收该第一消息后,该从设备处于可连接状态;该第一电子设备基于该第一消息连接该从设备。
在上述实施例中,第一电子设备可以通过第一消息连接从设备,不需要用户将从设备手动配置为可连接状态,方便了用户的使用。
结合第二方面的一些实施例,在一些实施例中,在该第一电子设备接收该第二电子设备发送的第一消息前,该方法还包括:该第一电子设备接收该第二电子设备发送的第一请求,该第一请求用于将该从设备分享至该第一电子设备;该第一电子设备向该第二电子设备发送确认消息,该确认消息用于指示该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
在上述实施例中,第二电子设备通过与用户的交互确定要主动分享从设备后,与第一电子设备交互,进而告知第一电子设备要将从设备分享给第一电子设备,在接收到第一电子设备的确认消息后,第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
结合第二方面的一些实施例,在一些实施例中,在该第一电子设备向该第二电子设备发送第一请求前,该方法还包括:该第一电子设备显示第一界面,该第一界面中包括第一控件;在接收到用户对该第一控件操作后,该第一电子设备显示第一窗口,该第一窗口中包括第二控件,该第二控件与该第二电子设备对应;该第一电子设备向该第二电子设备发送第一请求,具体包括:在接收到用户对该第二控件操作后,该第一电子设备向该第二电子设备发送该第二请求。
在上述实施例中,用户可以通过在第一电子设备上的界面操作,使得第一电子设备向第二电子设备发送第二请求,该界面可以是音乐应用程序的界面,也可以是设置中心的界面等。
结合第二方面的一些实施例,在一些实施例中,该第一电子设备基于该第一消息连接该从设备后,该方法还包括:该第二请求包括该从设备的类型,该第一电子设备将该从设备作为输入设备或输出设备。
在上述实施例中,第二请求还可以包括从设备的类型,进而第二电子设备可以从多个从设备中确定出第一电子设备需要的那个从设备。
结合第二方面的一些实施例,在一些实施例中,该第一电子设备基于该第一消息连接该从设备后,该方法还包括:该第二请求用于分享第一数据给该第二电子设备,该第一电子设备将该第一数据发送到该从设备。
在上述实施例中,在上述实施例中,第二请求还可以是业务类型、分享数据的请求等,进而第二电子设备可以从多个从设备中确定出第一电子设备需要的那个从设备。
结合第二方面的一些实施例,在一些实施例中,该第一界面为第一应用程序的界面,该第一应用程序为用于播放多媒体文件的应用程序,该第一数据为多媒体文件,该第一界面中还包括第三控件,该第三控件用于播放该第一数据,在该第一电子设备连接该从设备后,该方法还包括:在接收到用户对该第三控件的操作后,该第一电子设备通过该从设备播放该多媒体文件的画面和/或音频。
在上述实施例中,在第一电子设备上的音乐应用程序界面中,用户可以通过点击一些控件连接第二电子设备的从设备,然后点击播放,就可以使得从设备播放音乐,进而达到快速分享音频的目的。
结合第二方面的一些实施例,在一些实施例中,在该第一电子设备向该第二电子设备发送第二请求前,该方法还包括;该第一电子设备确定第一距离,该第一距离为该第一电子设备和该第二电子设备之间的距离;该第一电子设备确定该第一距离小于距离阈值后,该第一电子设备与该第二电子设备建立连接;该第一电子设备向该第二电子设备发送第二请求,具体包括:该第一电子设备基于该连接向该第二电子设备发送第二请求;该第一电子设备接收该第二电子设备发送的第一消息,具体包括:该第一电子设备基于该连接接收该第二电子设备发送的该第一消息。
在上述实施例中,第一电子设备在连接从设备的过程中,第一电子设备可以与第二电子设备建立连接,避免用于连接从设备的信息泄露,保障从设备的信息安全。其中,第二电子设备需要和第一电子设备足够近,进而避免由于误连其他电子设备导致连接从设备的信息泄露。
结合第二方面的一些实施例,在一些实施例中,该第一电子设备确定第一距离,具体包括:该第一电子设备接收到该第二电子设备发送的第一广播消息,基于该第一广播消息确定该第一距离;或者,该第一电子设备发送第一广播消息,并接收第二电子设备发送的第一响应,该第一响应包括第一距离,该第一距离为该第二电子设备基于该第一广播消息确定的。
在上述实施例中,第一电子设备可以被动测距。
结合第二方面的一些实施例,在一些实施例中,在该第一电子设备与该第二电子设备建立连接前,该方法还包括:该第二电子设备通过广播发送第一验证参数,该第一验证参数为第一参数的哈希值,该第一参数为第一MAC和/或第一公钥,该第一公钥为该第二电子设备的公钥,该第一MAC为该第二电子设备的地址;在该第一电子设备与该第二电子设备建立连接后,还包括:该第一电子设备基于该连接接收该第一参数;该第一电子设备基于该第一参数和该第一验证参数判断是否断开该连接。
在上述实施例中,第一电子设备和第二电子设备之间还可以执行安全性验证,进而避免设备之间的连接出现错误后,从设备的信息被泄露。
结合第二方面的一些实施例,在一些实施例中,在该第一电子设备基于该第一消息连接该从设备前,该方法还包括:该第一电子设备接收该第二电子设备发送的第二消息,该第二消息用于判断基于该第一消息连接的电子设备是否是该从设备,该第二消息包括该从设备的公钥、该从设备的标识信息、该从设备与该第二电子设备连接的标识中的一种或多种;在该第一电子设备基于该第一消息连接该从设备后,该方法还包括:该第一电子设备基于该第二消息确定连接该第一电子设备的电子设备为该从设备。
在上述实施例中,从设备和第一电子设备之间也可以执行安全性验证。
结合第二方面的一些实施例,在一些实施例中,该第一请求或该第一消息中包括第一时长;在该第一电子设备基于该第一消息连接该从设备后,该方法还包括:在该第一电子设备连接该从设备的该第一时长后,该第一电子设备断开第一电子设备与该从设备之间的连接。
在上述实施例中,第一电子设备在使用一段时间后断开,进而使得从设备可以连回第二电子设备,无需第二电子设备的用户或第一电子设备的用户执行繁琐的操作。
结合第二方面的一些实施例,在一些实施例中,在该第一电子设备连接该从设备的第一时长后,该方法还包括:该第一电子设备失效或删除用于连接该从设备的信息。
在上述实施例中,第一电子设备在断开和从设备的连接后,第一电子设备会失效或删除连接从设备的信息,进而避免以后第一电子设备误连接从设备。
结合第二方面的一些实施例,在一些实施例中,该第一请求用于分享第一数据,该第一数据为多媒体文件,该第一时长与该多媒体文件的播放时长有关。
在上述实施例中,第一时长可以与多媒体文件,如音乐的时长有关,进而使得音乐播放后可以自动断开。
结合第二方面的一些实施例,在一些实施例中,该第二请求包括从设备的类型和/或该第二请求用于 分享第一数据,在该第一电子设备基于该第一消息连接该从设备后,该方法还包括:该第一电子设备将该从设备作为输入设备或输出设备;在该第二请求用于分享第一数据的情况下,在该第一电子设备将该从设备作为输入设备或输出设备后,该第一电子设备将该第一数据发送到该从设备。
在上述实施例中,第一电子设备还可以通过多种参数告知第二电子设备自己需要的从设备是什么,并在连接后将从设备作为输入设备或输出设备使用。
第三方面,本申请实施例提供了一种通信方法,应用于第二电子设备,该方法包括:该第二电子设备与从设备连接,在该第二电子设备确定要建立第一电子设备与该从设备之间的连接的情况下,该第二电子设备向该第一电子设备发送第一消息,并且该第二电子设备向该从设备发送第一指示,该第一指示用于指示该从设备进入可连接状态,该第一消息用于指示该第一电子设备连接该从设备,该第一消息中包括用于连接该从设备的信息。
在上述实施例中,在该第二电子设备确定要建立第一电子设备与该从设备之间的连接的情况下,该第二电子设备通过向从设备发送第一指示,让从设备转变为可连接状态,并且该第二电子设备箱该第一电子设备发送第一消息,指示第一电子设备基于该第一消息连接从设备。
结合第三方面的一些实施例,在一些实施例中,响应于接收到用户在该第二电子设备上的操作,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
在上述实施例中,
结合第三方面的一些实施例,在一些实施例中,该响应于接收到用户在该第二电子设备上的操作后,该方法还包括:该第二电子设备向该第一电子设备发送第一请求,该第一请求用于将该从设备分享至该第一电子设备;在该第二电子设备接收到该第一电子设备发送的该确认消息后,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
在上述实施例中,若第二电子设备的用户想要主动将从设备分享给第一电子设备的用户,可以通过界面的形式操作,进而触发第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
结合第三方面的一些实施例,在一些实施例中,该响应于接收到用户在该第二电子设备上的操作后,该方法还包括:该第二电子设备向该第一电子设备发送第一请求,该第一请求用于将该从设备分享至该第一电子设备;在该第二电子设备接收到该第一电子设备发送的该确认消息后,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
在上述实施例中,第二电子设备通过与用户的交互确定要主动分享从设备后,与第一电子设备交互,进而告知第一电子设备要将从设备分享给第一电子设备,在接收到第一电子设备的确认消息后,第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
结合第三方面的一些实施例,在一些实施例中,该方法还包括:该第二电子设备接收该第一电子设备发送的第二请求;该第二电子设备接收该第二请求后,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
在上述实施例中,第一电子设备也可以主动的发起请求,该请求用于使第二电子设备确定要建立第一电子设备与从设备之间的连接。
结合第三方面的一些实施例,在一些实施例中,该方法还包括:该第二请求用于分享第一数据,该第二电子设备基于该第一数据确定由该从设备处理该第一数据后,该第二电子设备确定该从设备;
在上述实施例中,第二请求还可以是业务类型、分享数据的请求等,进而第二电子设备可以从多个从设备中确定出第一电子设备需要的那个从设备。
结合第三方面的一些实施例,在一些实施例中,该方法还包括:该第二请求包括从设备的类型,该第二电子设备基于该第二请求确定该从设备。
在上述实施例中,第二请求还可以包括从设备的类型,进而第二电子设备可以从多个从设备中确定出第一电子设备需要的那个从设备。
结合第三方面的一些实施例,在一些实施例中,在该第二电子设备接收第一电子设备发送的第二请求前,该方法还包括:该第二电子设备和该第一电子设备建立连接;在该第二电子设备与该第一电子设备建立连接前,该方法还包括:该第二电子设备通过广播发送第一验证参数,该第一验证参数为第一参数的哈希值,该第一参数为第一MAC和/或第一公钥,该第一公钥为该第二电子设备的公钥,该第一MAC为该第二电子设备的地址;在该第二电子设备与该第一电子设备建立连接后,该方法还包括:该第二电子设备基于该连接发送该第一参数;该第二电子设备接收第一电子设备发送的第二请求,具体包括:该第二电子设 备基于该连接接收该第一电子设备发送的该第二请求;该第二电子设备向该第一电子设备发送第一消息,具体包括:该第二电子设备基于该连接向该第一电子设备发送该第一消息。
在上述实施例中,第二电子设备和第一电子设备建立连接,并执行安全性验证,进而保证从设备的信息不会被泄露。
结合第三方面的一些实施例,在一些实施例中,该第二电子设备接收该第二请求后,该第二电子设备向该从设备发送第一指示前,该方法还包括:该第二电子设备显示第一界面,该第一界面包括第一窗口和第一控件,该第一窗口用于显示授权提示信息,该授权提示信息用于提示用户是否授权该第一电子设备与该从设备建立连接,该第一控件用于获取用户授权;该第二电子设备向该从设备发送第一指示,具体包括:在接收到用户对该第一控件的操作后,该第二电子设备向该从设备发送该第一指示。
在上述实施例中,由于从设备的连接信息涉及到用户的隐私,需要用户授权后,第二电子设备才向第一电子设备发送第一消息,并且向从设备发送第一指示。
结合第三方面的一些实施例,在一些实施例中,该第二电子设备接收第一电子设备发送的第二请求后,在该第二电子设备向该第一电子设备发送第一消息前,该方法还包括:该第二电子设备向该从设备发送第三消息,该第三消息用于验证连接该从设备的电子设备是否是该第一电子设备,该第三消息包括第二MAC,该第二MAC为该第一电子设备的地址。
在上述实施例中,第二电子设备向从设备发送验证信息,进而为从设备和第一电子设备之间的安全性验证提供了夯实的数据基础。
结合第三方面的一些实施例,在一些实施例中,在该第二电子设备向该从设备发送第一指示后,该方法还包括:该第二电子设备向该第一电子设备发送第四消息,该第四消息用于判断基于该第一消息连接的电子设备是否是该从设备,该第四消息包括该从设备的公钥、该从设备的标识信息、该从设备与该第二电子设备连接的标识中的一种或多种。
在上述实施例中,第二电子设备向第一电子设备发送验证信息,进而为从设备和第一电子设备之间的安全性验证提供了夯实的数据基础。
结合第三方面的一些实施例,在一些实施例中,该方法还包括:该第二电子设备接收该第二请求后,该第二电子设备基于该第二请求确定该从设备;在该第二电子设备确定该从设备后,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
在上述实施例中,第二电子设备可以通过第一电子设备发送的消息确定第一电子设备需要的从设备是具体的哪一个。
结合第三方面的一些实施例,在一些实施例中,该第二请求包括从设备的类型和/或该第二请求用于分享第一数据,该第二电子设备基于该第二请求确定该从设备,具体包括:该基于该从设备的类型和该第一数据确定该从设备,该第二电子设备基于该第一数据确定由该从设备处理该第一数据后,该第二电子设备确定该从设备;
在上述实施例中,第二电子设备根据第二请求的不同,有不同的方法可以确定从设备,在不同的场景下,第二请求可以选择不同的格式。
第四方面,本申请实施例提供了一种通信方法,应用于从设备,该方法包括:该从设备与第二电子设备连接,该从设备基于该从设备与该第二电子设备之间的连接接收该第二电子设备发送的第一指示,该第一指示用于指示该从设备转变为可连接状态;该从设备基于该第一指示转变为可连接状态;在该从设备转变为可连接状态后,响应于接收到第一电子设备发送的连接请求,该从设备与该第一电子设备建立连接。
在上述实施例中,从设备首先与第二电子设备连接,然后接收到第二电子设备发送的第一指示,转变为可连接状态,进而为与第一电子设备之间的连接提供了数据基础。
结合第四方面的一些实施例,在一些实施例中,在该从设备与该第一电子设备建立连接前,该方法还包括:该从设备基于该第二电子设备与该从设备之间的连接接收该第二电子设备发送的第一消息,该第一消息,该第一消息用于验证连接从设备的电子设备是否是该第一电子设备。在该从设备与该第一电子设备建立连接后,该方法还包括:该从设备基于该第一消息确定连接该从设备的电子设备是该第一电子设备。
在上述实施例中,从设备可以与第一电子设备执行安全性验证,进而避免从设备被其他电子设备连接。
结合第四方面的一些实施例,在一些实施例中,该第一消息包括第一MAC,该第一MAC为该第一电子设备的地址。
在上述实施例中,用于执行安全性验证的消息可以是第一电子设备的地址。
第五方面,本申请实施例提供了一种第一电子设备,该第一电子设备包括:一个或多个处理器和存储器;该存储器与该一个或多个处理器耦合,该存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令,该一个或多个处理器调用该计算机指令以使得该第一电子设备执行:该第一电子设备接收该第二电子设备发送的第一消息,该第一消息用于连接从设备,该第一消息中包括用于连接该从设备的信息,其中,在该第一电子设备接收该第一消息前,该从设备与该第二电子设备连接;其中,在该第一电子设备接收该第一消息后,该从设备处于可连接状态;该第一电子设备基于该第一消息连接该从设备。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:该第一电子设备接收该第二电子设备发送的第一请求,该第一请求用于将该从设备分享至该第一电子设备;该第一电子设备向该第二电子设备发送确认消息,该确认消息用于指示该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,具体用于调用该计算机指令以使得该第一电子设备执行:该第一电子设备向该第二电子设备发送第二请求,该第二请求用于指示该第二电子设备确定要建立该第一电子设备与该从设备之间的连接;
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:该第一电子设备显示第一界面,该第一界面中包括第一控件;在接收到用户对该第一控件操作后,该第一电子设备显示第一窗口,该第一窗口中包括第二控件,该第二控件与该第二电子设备对应;该第一电子设备向该第二电子设备发送第一请求,具体包括:在接收到用户对该第二控件操作后,该第一电子设备向该第二电子设备发送该第二请求。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:该第二请求包括该从设备的类型,该第一电子设备将该从设备作为输入设备或输出设备。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:该第二请求用于分享第一数据给该第二电子设备,该第一电子设备将该第一数据发送到该从设备。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:在接收到用户对该第三控件的操作后,该第一电子设备通过该从设备播放该多媒体文件的画面和/或音频;该第一界面为第一应用程序的界面,该第一应用程序为用于播放多媒体文件的应用程序,该第一数据为多媒体文件,该第一界面中还包括第三控件,该第三控件用于播放该第一数据。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:该第一电子设备确定第一距离,该第一距离为该第一电子设备和该第二电子设备之间的距离;该第一电子设备确定该第一距离小于距离阈值后,该第一电子设备与该第二电子设备建立连接;该一个或多个处理器,具体用于调用该计算机指令以使得该第一电子设备执行:该第一电子设备基于该连接向该第二电子设备发送第二请求;该第一电子设备基于该连接接收该第二电子设备发送的该第一消息。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,具体用于调用该计算机指令以使得该第一电子设备执行:该第一电子设备接收到该第二电子设备发送的第一广播消息,基于该第一广播消息确定该第一距离;或者,该第一电子设备发送第一广播消息,并接收第二电子设备发送的第一响应,该第一响应包括第一距离,该第一距离为该第二电子设备基于该第一广播消息确定的。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:在该第一电子设备与该第二电子设备建立连接前,该方法还包括:该第二电子设备通过广播发送第一验证参数,该第一验证参数为第一参数的哈希值,该第一参数为第一MAC和/或第一公钥,该第一公钥为该第二电子设备的公钥,该第一MAC为该第二电子设备的地址;该第一电子设备基于该连接接收该第一参数;该第一电子设备基于该第一参数和该第一验证参数判断是否断开该连接。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:该第一电子设备接收该第二电子设备发送的第二消息,该第二消息用于判断基于该第一消息连接的电子设备是否是该从设备,该第二消息包括该从设备的公钥、该从设备的标识信息、该从设备与该第二电子设备连接的标识中的一种或多种;该第一电子设备基于该第二消息确定连接该第一电子设备的电子设备为该从设备。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:该第一请求或该第一消息中包括第一时长;在该第一电子设备连接该从设备的该第一时长后,该第一电子设备断开第一电子设备与该从设备之间的连接。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:该第一电子设备失效或删除用于连接该从设备的信息。
结合第五方面的一些实施例,在一些实施例中,该第一请求用于分享第一数据,该第一数据为多媒体文件,该第一时长与该多媒体文件的播放时长有关。
结合第五方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第一电子设备执行:该第一电子设备将该从设备作为输入设备或输出设备;在该第二请求用于分享第一数据的情况下,在该第一电子设备将该从设备作为输入设备或输出设备后,该第一电子设备将该第一数据发送到该从设备。
第六方面,本申请实施例提供了一种第二电子设备,该第二电子设备包括:一个或多个处理器和存储器;该存储器与该一个或多个处理器耦合,该存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令,该一个或多个处理器调用该计算机指令以使得该第二电子设备执行:该第二电子设备与从设备连接,在该第二电子设备确定要建立第一电子设备与该从设备之间的连接的情况下,该第二电子设备向该第一电子设备发送第一消息,并且该第二电子设备向该从设备发送第一指示,该第一指示用于指示该从设备进入可连接状态,该第一消息用于指示该第一电子设备连接该从设备,该第一消息中包括用于连接该从设备的信息。
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:响应于接收到用户在该第二电子设备上的操作,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:该第二电子设备向该第一电子设备发送第一请求,该第一请求用于将该从设备分享至该第一电子设备;在该第二电子设备接收到该第一电子设备发送的该确认消息后,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:该第二电子设备接收该第一电子设备发送的第二请求;该第二电子设备接收该第二请求后,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:该第二请求用于分享第一数据,该第二电子设备基于该第一数据确定由该从设备处理该第一数据后,该第二电子设备确定该从设备;
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:该第二请求包括从设备的类型,该第二电子设备基于该第二请求确定该从设备。
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:该第二电子设备和该第一电子设备建立连接;该第二电子设备通过广播发送第一验证参数,该第一验证参数为第一参数的哈希值,该第一参数为第一MAC和/或第一公钥,该第一公钥为该第二电子设备的公钥,该第一MAC为该第二电子设备的地址;该第二电子设备基于该连接发送该第一参数;该一个或多个处理器,具体用于调用该计算机指令以使得该第二电子设备执行:该第二电子设备基于该连接接收该第一电子设备发送的该第二请求;该第二电子设备基于该连接向该第一电子设备发送该第一消息。
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:该第二电子设备显示第一界面,该第一界面包括第一窗口和第一控件,该第一窗口用于显示授权提示信息,该授权提示信息用于提示用户是否授权该第一电子设备与该从设备建立连接,该第一控件用于获取用户授权;该一个或多个处理器,具体用于调用该计算机指令以使得该第二电子设备执行:在接收到用户对该第一控件的操作后,该第二电子设备向该从设备发送该第一指示。
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:该第二电子设备向该从设备发送第三消息,该第三消息用于验证连接该从设备的电子设备是否是该第一电子设备,该第三消息包括第二MAC,该第二MAC为该第一电子设备的地址。
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:该第二电子设备向该第一电子设备发送第四消息,该第四消息用于判断基于该第一消息连接的电子设备是否是该从设备,该第四消息包括该从设备的公钥、该从设备的标识信息、该从设备与该第二电子设备连接的标识中的一种或多种。
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:该第二电子设备接收该第二请求后,该第二电子设备基于该第二请求确定该从设备;在该第二电子设备确定该从设备后,该第二电子设备确定要建立该第一电子设备与该从设备之间的连接。
结合第六方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该第二电子设备执行:该第二电子设备基于该从设备的类型和该第一数据确定该从设备。
第七方面,本申请实施例提供了一种从设备,该从设备包括:一个或多个处理器和存储器;该存储器与该一个或多个处理器耦合,该存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令,该一个或多个处理器调用该计算机指令以使得该电子设备执行:该从设备与第二电子设备连接,该从设备基于该从设备与该第二电子设备之间的连接接收该第二电子设备发送的第一指示,该第一指示用于指示该从设备转变为可连接状态;该从设备基于该第一指示转变为可连接状态;在该从设备转变为可连接状态后,响应于接收到第一电子设备发送的连接请求,该从设备与该第一电子设备建立连接。
结合第七方面的一些实施例,在一些实施例中,该一个或多个处理器,还用于调用该计算机指令以使得该从设备执行:该从设备基于该第二电子设备与该从设备之间的连接接收该第二电子设备发送的第一消息,该第一消息,该第一消息用于验证连接从设备的电子设备是否是该第一电子设备;该从设备基于该第一消息确定连接该从设备的电子设备是该第一电子设备。
结合第七方面的一些实施例,在一些实施例中,该第一消息包括第一MAC,该第一MAC为该第一电子设备的地址。
第八方面,本申请实施例提供了一种芯片系统,该芯片系统应用于电子设备,该芯片系统包括一个或多个处理器,该处理器用于调用计算机指令以使得该电子设备执行如第二方面、第三方面、第四方面、第二方面中任一可能的实现方式、第三方面中任一可能的实现方式、第四方面中任一可能的实现方式描述的方法。
第九方面,本申请实施例提供一种包含指令的计算机程序产品,当上述计算机程序产品在电子设备上运行时,使得上述电子设备执行如第二方面、第三方面、第四方面、第二方面中任一可能的实现方式、第三方面中任一可能的实现方式、第四方面中任一可能的实现方式描述的方法。
第十方面,本申请实施例提供一种计算机可读存储介质,包括指令,当上述指令在电子设备上运行时,使得上述电子设备执行如第二方面、第三方面、第四方面、第二方面中任一可能的实现方式、第三方面中任一可能的实现方式、第四方面中任一可能的实现方式描述的方法。
可以理解地,上述第二方面提供的电子设备、第三方面提供的芯片系统、第四方面提供的计算机程序产品和第五方面提供的计算机存储介质均用于执行本申请实施例所提供的方法。因此,其所能达到的有益效果可参考对应方法中的有益效果,此处不再赘述。
附图说明
图1为本申请实施例提供的本地电子设备上分享媒体文件的界面的一个示例性示意图。
图2为本申请实施例提供的对端电子设备上接收分享链接的界面的一个示例性示意图。
图3为本申请提供的本地电子设备连接与对端电子设备连接的蓝牙耳机的一个示例性示意图。
图4A和图4B为本申请实施例提供的媒体文件分享的界面的一个示例性示意图。
图5A和图5B为本申请实施例提供的界面的另一个示例性示意图。
图6A和图6B为本申请实施例提供的本地电子设备连接对端电子设备的从设备状态变化的一个示例性示意图。
图7为本申请实施例提供的通信方法的方法流程的一个示例性示意图。
图8为本申请实施例提供的本地电子设备和对端电子设备建立连接的触发时机的一个示例性示意图。
图9A为本申请实施例提供本地电子设备与对端电子设备在建立连接过程中执行安全性验证的一个示例性示意图。
图9B为本申请实施例提供本地电子设备与其他电子设备在建立连接过程中执行安全性验证的一个示例性示意图。
图10为本申请实施例提供的本地电子设备与对端电子设备交换会话密钥的一个示例性的示意图。
图11为本申请实施例提供的本地电子设备与从设备连接的一个示例性示意图。
图12为本申请实施例提供的本地电子设备与从设备验证的一个示例性示意图。
图13为本申请实施例提供的本地电子设备与从设备验证的另一个示例性示意图。
图14为本申请实施例提供的本地电子设备与从设备验证的另一个示例性示意图。
图15A为本申请实施例提供的通信方法的方法流程的一个示例性示意图。
图15B为本申请实施例提供的通信方法的方法流程的一个示例性示意图。
图16为本申请实施例提供的本地电子设备、对端电子设备和从设备的硬件结构的一个示例性示意图。
图17A为本申请实施例提供的电子设备的软件架构的一个示例性示意图。
图17B为本申请实施例提供的电子设备的软件架构的另一个示例性示意图。
具体实施方式
本申请以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“该”、“上述”、“该”和“这一”旨在也包括复数表达形式,除非其上下文中明确地有相反指示。还应当理解,本申请中使用的术语“和/或”是指并包含一个或多个所列出项目的任何或所有可能组合。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
本申请以下实施例中的术语“用户界面(user interface,UI)”,是应用程序或操作系统与用户之间进行交互和信息交换的介质接口,它实现信息的内部形式与用户可以接受形式之间的转换。用户界面是通过java、可扩展标记语言(extensible markup language,XML)等特定计算机语言编写的源代码,界面源代码在电子设备上经过解析,渲染,最终呈现为用户可以识别的内容。用户界面常用的表现形式是图形用户界面(graphic user interface,GUI),是指采用图形方式显示的与计算机操作相关的用户界面。它可以是在电子设备的显示屏中显示的文本、图标、按钮、菜单、选项卡、文本框、对话框、状态栏、导航栏、Widget等可视的界面元素。
随着电子技术的发展,越来越多的消费者开始使用无线设备,例如蓝牙耳机、无线键鼠、手写笔如华为pencil以及其他设备等。
在有些场景中,本地用户想要将音乐或其他媒体文件分享给其他一个或多个对端用户时,本地电子设备将该媒体文件对应的链接分享给对端电子设备。一个示例性的内容如下图1所示。其中,本地电子设备为本地用户的电子设备,对端电子设备为对端用户的电子设备。其中,在具体的示例性说明中,本地电子设备可以为手机A、对端电子设备可以为手机B。其中,对端电子设备与本地电子设备互为对端。在本申请实施例中,在执行本申请实施例提供的通信方法前,连接从设备的电子设备也可以称为第二电子设备,第二电子设备的对端电子设备也可以称为第一电子设备。其中,从设备为上文中提到的蓝牙耳机、无线键鼠、手写笔等支持近场无线通信技术的电子设备。
图1为本申请实施例提供的本地电子设备上分享媒体文件的界面的一个示例性示意图。
其中,手机A为本地电子设备。图1中的界面1001为音乐应用程序界面的一个示例性的界面,在音乐应用程序的界面中存在控件1004。其中,控件1004为用于分享当前正在播放的媒体文件的控件。
响应于用户点击控件1004,手机A显示的界面变为图1中的界面1002。图1中的界面1002为选择分享用户的一个示例性的界面,该界面中存在与一个或多个用户对应的一个或多个控件。例如,如图1中的界面1002所示,该界面上存在控件1005以及控件1006。其中,控件1005对应于用户1;控件1006对应于用户2。
当本地用户点击本地电子设备上的控件1005,媒体文件对应的链接通过互联网被发送到用户1对应的 对端电子设备上;当本地用户点击本地电子设备上的控件1006,媒体文件的链接被发送到用户2对应的对端电子设备上。
图2为本申请实施例提供的对端电子设备上接收分享链接的界面的一个示例性示意图。
其中,对端电子设备上显示的界面如图2中的界面2001所示。
其中,手机B为本地电子设备。当本地电子设备将媒体文件对应的链接通过互联网传输到对端电子设备后,对端电子设备显示的界面上可以包括对应该链接的控件2003。
如图2中的界面2002所示,响应于对端用户点击对端电子设备上显示的控件2003,对端电子设备可以启动音乐应用程序,并开始播放该链接对应的媒体文件。
很显然的,如图1和图2所示的交互方法是一种分享音乐或其他媒体文件的方法。但是,很显然的,如图1和图2所示的方法需要本地电子设备或对端电子设备都安装有相同的应用程序,进一步的,当音乐或其他媒体文件为付费资源时,还需要本地用户和对端用户都是付费用户;再进一步的,本地用户和对端用户难以同步音乐或其他媒体文件的播放进度,或者由于网络的延迟,难以实时的同步音乐或其他媒体文件的播放进度。
很显然的,图1和图2所示的交互方法的操作十分繁琐,且要求对端电子设备满足一定的条件。
在另一些场景中,当本地用户与对端用户位置接近的时候,即在本地电子设备与对端电子设备的用户,用户可以通过操作指示本地电子设备连接对端用户的蓝牙耳机,进而实现音乐或其他媒体文件的分享,如图3所示。
图3为本申请提供的本地电子设备连接与对端电子设备连接的蓝牙耳机的一个示例性示意图。
在图3所示的内容中,手机A为本地电子设备,手机B为对端电子设备。
如图3所示,首先,手机B与耳机B连接;然后,对端用户通过操作指示手机B断开手机B和耳机B的连接;再然后,对端用户或本地用户通过操作将耳机B置于可连接状态,其中,可以通过长按耳机B上的功能按钮或者将耳机B放回充电盒中以使得耳机B进入可连接状态;最后,当蓝牙耳机进入可连接状态后,本地用户可以通过操作指示手机A与耳机B建立连接。
结合图3所示的内容,如图3所示的方法,需要本地用户或对端用户执行繁琐的操作,才能使得原先与对端电子设备连接的蓝牙耳机重新连接到本地电子设备;其次,如图3所示的方式,在蓝牙耳机进入可连接状态后还可能被除本地电子设备外的其他电子设备连接,安全性较差。
其中,处于可连接状态的电子设备可以被连接并且可以被配对。
在图3所示的内容中,耳机B从连接状态(connected)被手动置为广播状态(advertiser/advertising),然后在建立连接后再进入连接状态(connected)。
结合上文叙述的内容,很容易可以看出,本地电子设备连接一个未和本地电子设备配对的并且和对端电子设备正在连接的蓝牙耳机或其他基于近场无线通信技术与对端电子设备连接的电子设备时,需要的用户执行的操作繁琐,且安全性较差。
基于此,本申请实施例提供了通信方法,可以使得本地电子设备可以以一种操作简便的、安全的方式与对端电子设备的从设备连接。
其中,对端电子设备的从设备为没有与本地电子设备配对过的电子设备;或者,对端电子设备的从设备为没有保存用于和本地电子设备配对的配对信息的电子设备。为了方便描述,后文中以从设备指代对端电子设备的从设备。在具体的示例性说明中,从设备可以为耳机B。
其中,从设备可以和对端电子设备连接;或者,从设备可以和对端电子设备曾经连接过,并且保存有用于和对端电子设备连接的相关信息。
其中,从设备可以基于任何近场无线通信技术与对端电子设备和/或本地电子设备连接,在此不做限定,例如,蓝牙、ZigBee、Wi-Fi、苹果无线直连连接(Apple Wirelsee Direct Link,AWDL)等。
其中,从设备可以为蓝牙耳机、无线键鼠、手写笔、游戏手柄、VR眼镜、钥匙(防盗门钥匙或汽车钥匙)、电视、电饭煲、智能家居设备等支持上文中至少一种近场无线通信技术的电子设备。
其中,从设备的设备类型不同,则本申请实施例提供的通信方法的应用场景也可以不同。下面示例性的介绍几种本申请实施例提供的通信方法的应用场景。
图4A和图4B为本申请实施例提供的媒体文件分享的界面的一个示例性示意图。
在图4A和图4B所示的内容中,手机A为本地电子设备,手机B为对端电子设备。
其中,图4A中的界面4A01与图1中的界面1001相同,可以参考图1的文字描述,此处不再赘述。
但是与图1整体所示内容不同的是,如图4A中的界面4A02所示,响应于用户点击控件4A03,本地电子设备显示控件4A04,其中控件4A04也可以称为提示框、弹窗、小窗等,在此不做限定。控件4A04可以包括一个或多个控件,该第一个或多个控件对应于一个或多个对端电子设备。其中,控件4A05对应于手机B。
在用户点击控件4A05后,本地电子设备和对端电子设备的界面变化如图4B中的界面4B01和界面4B03所示。其中,对端电子设备上的界面上显示的内容包括控件4B04,其中控件4B04也可以称为提示框、弹窗、小窗等。控件4B04中包括控件4B05,控件4B04还包括用于提示对端用户的文字,该文字可以为“手机A想要将音乐Dream it possible分享给您”,或者也可以是其他用于提示用户确定是否接收音乐分享的文字,或者也可以是其他用于提示用户是否将耳机B共享给本地电子设备的文字,在此不做限定。
其中,在图4A和图4B所示的内容中,耳机B为手机B的从设备。
其中,在图4B中的界面4B01所示的内容中,手机B的界面上还包括图标4B06,图标4B06用于标识蓝牙连接,标识手机B与耳机B连接。
在用户点击控件4A05后,本地电子设备和耳机B自动的建立蓝牙连接,本地电子设备的蓝牙设置界面如图4B中的界面4B03所示,蓝牙设置界面包括图标4B11。图标4B11与耳机B对应,用于提示用户耳机B已经和本地电子设备建立连接。
其中,在图4B中的界面4B03所示的内容中,手机A的界面上还包括图标4B10,图标4B10用于标识蓝牙连接,标识手机A与耳机B连接。
可选地,在本申请一些实施例中,在用户点击控件4A05后,本地电子设备和对端电子设备的界面变化如图4B中的界面4B02和界面4B03所示。在图4B中的界面4B02所示的内容中,对端电子设备上的界面上显示的内容包括控件4B08,其中控件4B08也可以称为提示框、弹窗、小窗等。控件4B08中包括控件4B09,控件4B08还包括用于提示对端用户的文字,该文字可以为“选择共享的从设备”,或者也可以是其他用于提示用户确定从设备的文字,在此不做限定。在用户点击控件4B09后,本地电子设备和耳机B自动的建立蓝牙连接,本地电子设备的蓝牙设置界面如图4B中的界面4B03所示。
可选地,在本申请一些实施例中,在用户点击控件4A05后,本地电子设备和对端电子设备的界面变化如图4B中的界面4B01、界面4B02和界面4B03所示。
值得说明的是,耳机B和本地电子设备建立蓝牙连接并不一定会导致本地电子设备与其他设备断开蓝牙连接。耳机B在与本地电子设备建立蓝牙连接后,耳机B可以与对端电子设备保持连接,也可以断开连接,在此不做限定。
图5A和图5B为本申请实施例提供的界面的另一个示例性示意图。
如图5A所示,用户可以通过下滑操作使得手机A显示控制中心界面,如界面5A01至界面5A02的变化过程。其中,界面5A01为手机A的主界面,界面5A02为手机A的控制中心界面。
在界面5A02中,界面5A02包括有控件5A05。其中,控件5A05为对应于音乐多媒体播放的控件。响应于用户点击控件5A05,手机A的界面变为界面5A03。
在界面5A03中,界面5A03包括有控件5A06。其中,控件5A06用于展示连接的音频输出设备,如耳机A。控件5A06包括控件5A07和控件5A08,其中,控件5A07为对应于耳机A的控件,控件5A08上的文字为共享给其他耳机。
在用户点击控件5A08后,手机A显示的界面如界面5A04所示。
如图5B所示,在手机A发现手机B后,手机A上显示的界面从界面5A04变为界面5B01。其中,界面5B01包括控件5B04,控件5B04包括控件5B05和控件5B06。其中,控件5B04上显示的文字为是否连接手机B控件5B05上显示的文字为连接;控件5B06上显示的文字为取消。
在用户点击控件5B05后,手机B上显示的界面为界面5B02。界面5B02包括控件5B07,控件5B07包括控件5B08和控件5B09。其中,控件5B07上显示的文字为“是否共享耳机B”和“共享期间,您的耳机B会与手机A暂时连接,并被手机A控制”,控件5B08上显示的文字为“连接”,控件5B09上显示的文字为“取消”。
值得说明的是,上文中控件5B07、控件5B04和控件5A06也可以称为提示框、弹窗、小窗等,在此不做限定;并且控件5B07、控件5B04和控件5A06也可以出现其他文字提示信息,并不局限与图5A和图5B所示的内容,在此不做限定。
图6A和图6B为本申请实施例提供的本地电子设备连接对端电子设备的从设备状态变化的一个示例性示意图。
在图6A所示的内容中,手机A为本地电子设备,手机B为对端电子设备,从设备为与手机B连接的耳机B。
首先,手机B与耳机B保持连接;其次,手机A从手机B处获取用于连接和配对耳机B的信息;最后,手机A与耳机B连接后完成配对。
在图6A所示的内容中,耳机B从连接状态自动的变为可连接状态。
当耳机B为低功耗蓝牙(BLE)设备时,耳机B从连接状态变为广播状态,然后在建立连接后再进入连接状态。其中,广播状态也可以称为可连接状态。当耳机为经典蓝牙设备(BR/EDR)设备时,耳机B从连接状态变为寻呼扫描状态(page scan),然后在建立连接后再进入连接状态。其中,寻呼扫描状态也可以成为可连接状态。
耳机B在广播状态时,会广播自己的信息进而使得本地电子设备可以发现并连接至耳机B。
如图6B所示,在耳机B和手机A连接一段时间后,耳机B与手机A断开连接,并且与手机B恢复连接。
其中,耳机B和手机A的连接时长可以与手机A上运行的业务有关,也可以是预设的固定值。例如,在上文中图4A和图4B所示的媒体文件分享场景中,耳机B和手机A的连接时长可以等于媒体文件的播放时长。
值得说明的是,本申请提供的通信方法并不局限于图4A、图4B所示的场景,还可以是其他场景,在此不做限定。例如,本地电子设备和对端电子设备可以均为笔记本电脑,对端电子设备的从设备可以是无线键鼠;又例如,本地电子设备和对端电子设备可以均为手机或主机,对端电子设备的从设备可以是VR/AR眼镜等。
下面结合图7所示的内容,示例性的介绍本申请提供的通信方法。
图7为本申请实施例提供的通信方法的方法流程的一个示例性示意图。
如图7所示,本申请提供的通信方法,包括三个步骤,分别为步骤S701、步骤S702、步骤S703,下面分别介绍这三个步骤。
S701:本地电子设备与对端电子设备建立连接后,向对端电子设备发送第一请求。
其中,本地电子设备与对端电子设备建立连接的触发时机可以随场景的不同而不同,在此不做限定。
例如,在图4A和图4B所示的内容中,当用户在本地电子设备上点击控件4A04后,本地电子设备与对端电子设备建立连接。
又例如,在图5A和图5B所示的内容中,当用户在本地电子设备点击控件5A08后,本地电子设备开始接收广播,并在接收广播的过程中接收到对端电子设备发送的广播,发现对端电子设备。当本地电子设备发现对端电子设备后,本地电子设备的界面从界面5A04变为界面5B01后,当用户点击控件5B05后,本地电子设备与对端电子设备建立连接。
其中,第一请求可以是用于分享数据的请求;或者,第一请求可以是用于请求连接对端电子设备的从设备的请求。
可选地,在本申请一些实施例中,本地电子设备与对端电子设备也可以不建立连接,通过广播信道以广播的形式完成本申请实施例中部分或全部的数据交互。
可选地,在本申请一些实施例中,在本地电子设备与对端电子设备建立连接前,本地电子设备可以通过广播等其他多种方式,发现一个或多个对端电子设备。
可选地,在本申请一些实施例中,当用户在本地电子设备点击控件4A03后,本地电子设备开始发现一个或多个对端电子设备,在用户点击控件4B05后,本地电子设备与对端电子设备建立连接。
本地电子设备与对端电子设备可以建立多种连接,在此不做限定,例如,本地电子设备可以和对端电子设备之间的连接可以通过蓝牙、ZigBee、Wi-Fi、苹果无线直连连接(apple wireless direct link,AWDL)等多种协议或方式建立连接。
在本地电子设备与对端电子设备建立连接后,可以向对端电子设备发送第一请求。
可选地,在本申请一些实施例中,第一请求可以包括获取用于连接对端电子设备的从设备的信息,和/或,第一请求可以包括本地电子设备上运行的业务的信息。例如,在图4A和图4B所示的内容中,第一请求可以包括媒体文件分享业务。
可选的,在本申请一些实施例中,第一请求用于分享数据,如多媒体文件。例如,在图4A和图4B所示的内容中,第一请求可以用于分享音乐文件或音频流。
可选地,在本申请一些实施例中,第一请求可以包括从设备的设备类型,例如,设备类型可以是音频输出设备、蓝牙耳机、VR眼镜、遥控器等,在此不做限定。
可选地,在本申请一些实施例中,第一请求中可以携带时间信息,该时间信息可以表示本地电子设备需要使用从设备的时长。例如,在本地电子设备与从设备连接时长达到该时长后,从设备会与本地电子设备自动的断开,并且恢复从设备与对端电子设备的连接。
可选地,在本申请一些实施例中,在本地电子设备与对端电子设备建立连接的过程中,可以交换各自的公钥,用于在后续步骤中对需要数据交互的数据进行加密。
可选地,在本申请一些实施例中,本地电子设备可以通过对端电子设备获取对端电子设备的从设备的公钥,用于在后续步骤中对需要数据交互的数据进行加密。
可选地,在本申请一些实施例中,本地电子设备与对端电子设备可以在建立连接的过程中,本地电子设备和对端电子设备可以执行安全性验证,进而避免其他设备与本地电子设备或对端电子设备建立连接。可选地,在本申请一些实施例中,可以在建立连接后执行安全性验证,当安全性验证失败后则本地电子设备断开该连接。其中,安全性验证可以通过本地电子设备或对端电子设备的物理地址(Media Access Control Address,MAC)完成。
值得说明的是,当本地电子设备或对端电子设备通过经典蓝牙协议连接时,MAC为固定MAC;当本地电子设备与对端电子设备通过低功耗蓝牙连接时,MAC可以为固定MAC或随机MAC;类似的,后文中,本地电子设备与从设备的连接使用的MAC也可以根据协议的不同选择固定MAC或随机MAC。
值得说明的是,随着连接依赖具体的近场通信技术所遵循的协议的不同,本地电子设备和/或对端电子设备和/或从设备的标识也可以不同。
下面以图8、图9A和图9B所示的内容示例性的介绍在本地电子设备和对端电子设备之间通过蓝牙连接的情况下,本地电子设备与对端电子设备之间的连接过程,以及安全性验证的过程。
图8为本申请实施例提供的本地电子设备和对端电子设备建立连接的触发时机的一个示例性示意图。
S801:对端电子设备发送第一广播。
对端电子设备可以周期性的向周围的设备发送第一广播。
S802:本地电子设备基于第一广播确定第一距离小于等于距离阈值。
本地电子设备,在接收到第一广播后,基于第一广播的信号衰减确定对端电子设备与本地电子设备之间的距离为第一距离。本地电子设备判断第一距离和距离阈值的大小,若第一距离小于等于距离阈值,则执行步骤S803,与对端电子设备开始建立连接;若第一距离大于距离阈值,则本地电子设备不和对端电子设备建立连接。
可选地,在本申请一些实施例中,在上文中图5A所示的界面中,当用户在本地电子设备上点击界面5A03中的控件5A08后,本地电子设备开始接收或解析第一广播,并基于第一广播确定第一距离。
其中,基于第一广播确定第一距离的方法有许多种,在此不做限定。例如,可以通过接收信号强度指标(received signal strength indication,RSSI)确定。
可选地,在本申请一些实施例中,本地电子设备也可以主动发送第一广播,对端电子设备接收到该第一广播后向本地电子设备发送第一响应,本地电子设备基于第一响应确定第一电子设备和第二电子设备之间的距离。
可选地,在本申请一些实施例中,本地电子设备也可以主动发送第一广播,对端电子设备接收到该第一广播后向本地电子设备发送第一响应,其中,第一响应中包括有距离1,距离1为基于第一广播的RSSI确定的。本地电子设备基于距离1确定发送第一响应的电子设备是否为对端电子设备,即距离1小于等于距离阈值的情况下,该发送第一响应的电子设备为对端电子设备。
可选地,在本申请一些实施例中,本地电子设备也可以主动发送第一广播,对端电子设备接收到该第一广播后向本地电子设备发送第一响应,其中,第一响应中包括有距离1,距离1为基于第一广播的RSSI确定的。本地电子设备基于第一响应的RSSI确定距离2后,本地电子设备基于距离1的和距离2确定本地电子设备与发送第一响应的电子设备是否为对端电子设备,若距离1和距离2的平均值小于等于距离阈值的情况下,该发送第一响应的电子设备为对端电子设备。
S803:本地电子设备与对端电子设备建立连接。
结合图8所示的内容,可以理解的是,当本地电子设备和对端电子设备之间的距离小于距离阈值的情 况下,本地电子设备发现对端电子设备后,才会通过界面提醒用户是否建立与对端电子设备的连接。
图9A为本申请实施例提供本地电子设备与对端电子设备在建立连接过程中执行安全性验证的一个示例性示意图。
如图9A所示,本地电子设备与对端电子设备的建立连接过程包括如下步骤。
S9A01:发送广播。
本地电子设备在广播信道发送广播,以发现周边的可连接的电子设备。在图9A所示的内容中,对端电子设备和本地电子设备可以接收到该广播。
S9A02:发送公钥1的哈希值和MAC1的哈希值。
对端电子设备在接收到广播后,对端电子设备的响应包括向本地电子设备发送公钥1的哈希值和MAC1的哈希值。其中,对端电子设备的蓝牙MAC为MAC1。
可选的,在本申请一些实施例中,该MAC1为对端电子设备的公共地址(public address)。
对端电子设备和本地电子设备之间依然是通过广播信道进行的数据交互。
其中,公钥1和私钥1对应,私钥1为对端电子设备私有的;在执行步骤S9A05前,公钥1也是对端电子设备私有的。
可选地,在本申请一些实施例中,对端电子设备也可以发送公钥1和MAC运算结果的哈希值。
S9A03:存储公钥1的哈希值和MAC1的哈希值。
本地电子设备接收到公钥1和哈希值和MAC1的哈希值后,可以将公钥1和MAC1的哈希值保存在本地,在后续步骤中用于执行安全性验证。
可选地,在本申请一些实施例中,在对端电子设备也可以发送公钥1和MAC运算结果的哈希值的情况下,本地电子设备也可以验证该值。
S9A04:建立连接。
本地电子设备与对端电子设备建立连接。
值得说明的是,在本地电子设备与对端电子设备建立连接收,本地电子设备与对端电子设备数据交互是点对点的,即其他电子设备不能获取本地电子设备与对端电子设备数据交互的内容。
S9A05:发送公钥1和MAC1。
对端电子设备向本地电子设备发送公钥1和MAC1。
由于本地电子设备已经和对端电子设备建立连接,通过该连接发送的数据并不能被其他电子设备获取,所以其他电子设备并不能获取公钥1和MAC1。
S9A06:验证公钥1和MAC1。
本地电子设备通过公钥1的哈希值和MAC1的哈希值分别独立的验证公钥1和MAC1。
可选地,在本申请一些实施例中,在步骤S9A02中,对端电子设备可以发送公钥1的哈希值或MAC1的哈希值;在步骤S9A05中,对端电子设备可以发送公钥1或MAC1;在步骤S9A06中,本地电子设备可以验证公钥1或MAC1。
可以理解的是,本地电子设备通过验证公钥和/或MAC可以确定连接的对端电子设备即为用户选择的电子设备,而非其他电子设备;其中,用户选择电子设备的界面可以参考图4B中界面4B02中所示的内容,此处不再赘述。图9B为本申请实施例提供本地电子设备与其他电子设备在建立连接过程中执行安全性验证的一个示例性示意图。
如图9B所示,本地电子设备与对端电子设备的建立连接过程包括如下步骤。
S9B01:发送广播。
本地电子设备在广播信道发送广播,以发现周边的可连接的电子设备。在图9B所示的内容中,对端电子设备和本地电子设备可以接收到该广播。
S9B02:发送公钥1的哈希值和MAC1的哈希值。
具体的内容,参见上文中的步骤S9A02,此处不再赘述。
S9B03:转发接收到的广播。
由于其他电子设备也可以接收到本地电子设备的广播,其他电子设备可以转发本地电子设备的广播,并发送给对端电子设备。
可选地,在本申请一些实施例中,其他电子设备也可以在广播信道监听以直接获取对端电子设备向本地电子设备发送的公钥1的哈希值和MAC1的哈希值。
S9B04:发送公钥1的哈希值和MAC1的哈希值。
与步骤S9B02类似的,对端电子设备向发送广播的其他电子设备发送公钥1的哈希值和MAC1的哈希值。
S9B05:发送公钥1的哈希值和MAC1的哈希值。
其他电子设备在接收到公钥1的哈希值和MAC1的哈希值后,可以将该公钥1的哈希值和MAC1的哈希值发送到本地电子设备。
S9B06:存储公钥1的哈希值和MAC1的哈希值。
具体的内容,参见上文中的步骤S9A03,此处不再赘述。
S9B07:建立连接。
本地电子设备与其他电子设备建立连接。
S9B08:发送公钥2和MAC2。
在本地电子设备与其他电子设备建立连接后,其他电子设备向本地电子设备发送公钥2和MAC2。其中,由于对端电子设备没有以广播的形式发送过公钥1和MAC1,并且其他电子设备不能通过公钥1的哈希值恢复出公钥1以及不能通过MAC1的哈希值恢复出公钥1,所以其他电子设备并不能向本地电子设备发送公钥1和MAC1。
S9B09:确定公钥和MAC不匹配,断开连接。
本地电子设备在接收到其他电子设备发送的公钥2和MAC2后,执行安全性验证,判断公钥1的哈希值和公钥2是否匹配以及MAC1的哈希值与MAC2是否匹配。本地电子设备在确定公钥和MAC不匹配后,断开与其他电子设备的连接。
值得说明的是,在步骤S9B02和步骤S9B04中,对端电子设备可以发送公钥1的哈希值或MAC1的哈希值;在步骤S9B08中,其他电子设备可以发送公钥2或MAC2;在步骤S9B09中,本地电子设备确定公钥不匹配或MAC不匹配。
结合图8、图9A和图9B所示的内容,可以理解的是,本地电子设备和对端电子设备之间的连接可以是安全的。
进一步的,可选地,在本申请一些实施例中,本地电子设备与对端电子设备还可以交换会话密钥,其中,会话密钥可以由本地电子设备产生。示例性的,下面介绍交换会话密钥的方法。
图10为本申请实施例提供的本地电子设备与对端电子设备交换会话密钥的一个示例性的示意图。
如图10所示,本申请实施例提供的本地电子设备与对端电子设备交换会话密钥的方法包括三个步骤。
S1001:生成会话密钥。
在本地电子设备和对端电子设备建立连接后,本地电子设备可以生成会话密钥。其中会话密钥和会话公钥对应,会话公钥可以通过广播或其他方式发送到对端电子设备。
S1002:发送公钥1加密过的会话密钥。
本地电子设备向对端电子设备发送公钥1加密过得会话密钥。其中,公钥1的概念可以参考上文中的图8、图9A和图9B中的文字描述,此处不再赘述。其中,公钥1和私钥1对应,对端电子设备已知私钥1。
S1003:使用私钥1解密,获取会话密钥。
对端电子设备在接收公钥1加密过的会话密钥后,可以使用已知的私钥1解密该数据,进而获取到会话密钥。
其中,会话密钥用于在后续步骤加密本地电子设备与对端电子设备之间的数据交互。例如,对端电子设备发送从设备的公钥、从设备的MAC、从设备的序列号等信息时均可以使用会话密钥执行加密。
S702:对端电子设备基于该第一请求确定从设备,并将用于连接从设备的信息发送给本地电子设备。
对端电子设备基于第一请求确定从设备。其中,第一请求的内容可以参考上文中步骤S701中的文字描述,此处不再赘述。
可选地,在本申请一些实施例中,在接收到第一请求后,若对端电子设备确定没有与第一请求对应的从设备,则不响应该第一请求;或者,向本地电子设备发送错误消息,以使得本地电子设备确定对端电子设备没有连接合适的从设备。其中,第一请求与从设备的对应关系如下表1。
表1为本申请实施例提供的一个第一请求与从设备对应关系的一个示例性示意表。
表1
表1所述的内容仅仅是一个示例性说明。
当对端电子设备正在连接多个从设备的情况下,或者,当对端电子设备曾经连接多个从设备的情况下,对端电子设备还可以从该多个从设备中确定出要分享的从设备。例如,从设备包括蓝牙耳机、电风扇、电冰箱等,当第一请求包括音乐分享业务的标识或蓝牙耳机标识的情况下,对端电子设备可以确定从设备为蓝牙耳机;当第一请求包括电风扇标识的情况下,对端电子设备可以确定从设备为电风扇。
对端电子设备在确定从设备后,将用于连接从设备的信息发送给本地电子设备。
其中,示例性地,用于连接从设备的信息可以包括对端电子设备与从设备连接的标识、从设备的MAC、从设备的产品序列号(Serical Number,SN)。
可选地,在本申请一些实施例中,对端电子设备还可以获取本地电子设备的标识信息,并且将本地电子设备的标识信息发送给从设备。其中,标识信息可以是本地电子设备的ID、本地电子设备的MAC等任何可以将本地电子设备与其他电子设备区分的信息,在此不做限定。
可选地,在本申请一些实施例中,第一请求可以还用于通知对端电子设备:在一段时间后,从设备可能会与对端电子设备断开连接。
可选地,在本申请一些实施例中,在对端电子设备接收到第一请求后,对端电子设备首先会询问用户以获取用户的授权,然后才会将用于连接从设备的信息发送给本地电子设备。
可选地,在本申请一些实施例中,在对端电子设备接收到第一请求后,还会向从设备发送第一消息,使得从设备进入可连接状态,进而使得从设备可以被本地电子设备连接。
可选地,在本申请一些实施例中,在对端电子设备接收到第一请求后,对端电子设备还可以将用于从设备和本地电子设备之间互相验证的信息分别发送给本地电子设备和对端电子设备。用于从设备和本地电子设备之间互相验证的信息可以分别来源于从设备和本地电子设备,也可以来自于对端电子设备本身。例如,用于从设备和本地电子设备之间互相验证的信息可以是对端电子设备与本地电子设备连接的标识,或者可以是对端电子设备与从设备连接的标识。其中,该标识可以是令牌(token)或其他参数。
S703:本地电子设备基于用于连接从设备的信息连接对端电子设备的从设备。
本地电子设备在接收到用于连接从设备的信息后,可以基于该用于连接从设备的信息连接对端电子设备的从设备。
在本地电子设备和从设备连接成功后,可以执行配对以及数据交互。当从设备为支持经典蓝牙的电子设备,则在连接过程中完成配对。
可选地,在本申请一些实施例中,当对端电子设备正在通过从设备播放音频信息、视频信息或者其他信息时,在接收到本地电子设备发送第一请求后,可以暂停播放;或者,在对端电子设备发送用于连接从设备的信息后,暂停播放。
可选地,在本申请一些实施例中,在建立连接后,当从设备为智能家居如电饭煲的情况下,本地电子设备可以直接导入食谱或者配置电饭煲的设置,如几点开始做饭,做什么饭菜等;当从设备为手写笔或无线键鼠的情况下,用户可以使用手写笔或无线键鼠在本地电子设备上操作。
可选地,在本申请一些实施例中,当从设备为支持多连接的电子设备时,当本地电子设备和对端电子设备均在播放音频信息或视频信息时,从设备可以优先播放本地电子设备的音频或视频信息。
可选地,在本申请一些实施例中,在从设备获取本地电子设备的标识信息的情况下,从设备可以基于本地电子设备的标识信息验证向从设备发起连接的电子设备是否是本地电子设备,进而实现可靠、安全的连接。本地电子设备的标识信息可以是本地电子设备的MAC。
示例性的,下面结合图11至图13所示的内容示例性的介绍本地电子设备与对端电子设备的从设备的连接过程。
图11为本申请实施例提供的本地电子设备与从设备连接的一个示例性示意图。
如图11所示,本地电子设备与从设备连接的方法包括如下步骤。
S1101:发送第一请求。
本地电子设备向对端电子设备发送第一请求。其中,第一请求的概念可以参考上文中步骤S701、步骤S702中的文字描述,此处不在赘述。
本地电子设备可以通过与对端电子设备建立的连接或其他方式向对端电子设备发送第一请求。
S1102:询问用户是否可以分享从设备。
其中,步骤S1102为可选的步骤,即,对端电子设备也可以不执行步骤S1102。
可选地,在本申请一些实施例中,在本地电子设备与对端电子设备互为可信设备的情况下,步骤S1102为可选的步骤。例如,本地电子设备与对端电子设备登录同一账号,或者,本地电子设备与对端电子设备登录的账户属于同一组,例如属于家庭组。
对端电子设备会通过在界面上显示如图4B中的界面4B01的控件4B04,以询问用户是否可以分享从设备。
值得说明的是,对端电子设备上询问用户是否可以分享从设备的界面并不局限于图4B中的界面4B01所示的内容。
若用户不同意分享从设备,则结束,对端电子设备不执行后续步骤。
S1103:发送本地电子设备的标识。
其中,步骤S1103为可选的步骤,即,对端电子设备也可以不执行步骤S1103。
当对端电子设备没有执行步骤S1103,则从设备不会执行步骤S1107。
对端电子设备向从设备发送本地电子设备的标识。其中,本地电子设备的标识可以是本地电子设备的MAC,或其他可以区分本地电子设备与其他电子设备的参数。
S1104:发送从设备的标识信息以及用于验证的信息。
对端电子设备向本地电子设备发送从设备的标识信息以及用于连接的信息。
其中,从设备的标识可以是从设备的MAC,或其他可以区分从设备与其他电子设备的参数。其中,该MAC可以是从设备的随机地址或者是从设备的公共地址。
其中,用于验证的信息可以包括从设备与对端电子设备连接的标识、从设备的序列号等中的至少一个。
其中,从设备与对端电子设备连接的标识可以是令牌或其他参数。
可选地,在本申请一些实施例中,对端电子设备可以仅向本地电子设备发送从设备的标识信息。在该情况下,本地电子设备和从设备可以不执行步骤S1107和步骤S1108,本地电子设备与从设备的连接不进行额外的验证,仅通过从设备校验本地电子设备是否和本地电子设备的标识是否匹配完成安全性的验证。
S1105:切换至可连接状态。
其中,步骤S1105为可选的步骤。
从设备切换至可连接状态后,可以被本地电子设备发现以及其他电子设备发现。
可选地,在本申请一些实施例中,当从设备主动切换至可连接状态,在从设备是蓝牙耳机的情况下。
S1106:基于从设备的标识建立连接。
本地电子设备基于从设备的标识建立连接,该连接用于承载本地电子设备和从设备之间的数据交互。
S1107:校验本地电子设备是否与本地电子设备的标识匹配。
从设备校验发起连接的本地电子设备是否与对端电子设备发送的本地电子设备的标识匹配,若匹配,则继续执行后续步骤;若不匹配,则中断该连接。
S1108:基于用于连接的信息执行双向验证或单向验证。
值得说明的是,从设备执行步骤S1107也可以认为是一种验证。在该情况下,图11对应的内容中,本地电子设备与从设备进行了两次验证。
本地电子设备和从设备可以基于用于连接的信息执行双向验证或者单向验证。下面结合图12、图13和图14所示的内容,示例性的介绍本地电子设备和从设备的验证过程。
图12为本申请实施例提供的本地电子设备与从设备验证的一个示例性示意图。
如图12所示,本地电子设备与从设备验证的方法包括如下步骤。
步骤S1201:基于随机数1和令牌生成派生令牌1。
其中,令牌属于从设备与对端电子设备连接的标识。随机数1为本地电子设备产生的随机数。其中,本地电子设备上的令牌来源对端电子设备,是由对端电子设备发送给本地电子设备的。
步骤S1202:发送随机数1和派生令牌1。
本地电子设备向从设备发送随机数1和派生令牌1。
步骤S1203:基于随机数1和令牌生成派生令牌2。
从设备接收到随机数1后,可以基于随机数1和令牌生成派生令牌2。
步骤S1204:校验派生令牌2是否和派生令牌1是否相等。
从设备可以判断派生令牌2和派生令牌1是否相等,若相等,则该次校验通过;若不相等,则该次校验失败。
可以理解的是,派生令牌2和派生令牌1相等后,从设备可以确定本地电子设备即为可信的、正确的电子设备。
步骤S1205:基于随机数2和令牌生成派生令牌3。
从设备可以基于随机数2和令牌生成派生令牌3。其中,随机数2为从设备产生的随机数。
步骤1206:发送随机数2和派生令牌3。
从设备向本地电子设备发送随机数2和派生令牌3。
步骤S1207:基于随机数2和令牌生成派生令牌4。
本地电子设备基于随机数2和令牌生成派生令牌4。
步骤S1208:校验派生令牌3是否和派生令牌4相等。
本地电子设备判断派生令牌3和派生令牌4是否相等。若相等,则该次校验通过;若不想打,则该次校验失败。
值得说明的是,步骤S1201至步骤S1204为单向验证;步骤S1205至步骤S1208同样为单向验证;步骤S1201至步骤S1208为双向验证。
或者,本地电子设备与从设备的验证也可以通过对端电子设备的公钥和从设备的公钥执行单向验证或者双向验证,并不局限于令牌这一种参数。
图13为本申请实施例提供的本地电子设备与从设备验证的另一个示例性示意图。
如图13所示,本地电子设备与从设备验证的方法可以包括如下步骤。
S1301:请求发送验证信息。
本地电子设备在和从设备建立连接后,可以请求从设备发送验证消息。
S1302:发送从设备公钥的哈希值。
从设备可以向本地电子设备发送从设备的公钥的哈希值。
可选地,在本申请一些实施例中,从设备可以向本地电子设备发送从设备MAC的哈希值。
可选地,在本申请一些实施例中,从设备可以向本地电子设备发送从设备MAC和从设备的公钥运算结果的哈希值。
可选地,在本申请一些实施例中,从设备可以向本地电子设备发送从设备的序列号的哈希值。
值得说明的是,公钥的哈希值可以替换成其他参数的哈希值,该参数需要是本地电子设备可以从对端电子设备能够获取到的,并与该参数是与从设备有关的参数。
S1303:验证从设备公钥的哈希值。
本地电子设备可以在接收到从设备发送的公钥的哈希值,验证该哈希值是否正确。其中,本地电子设备可以从对端电子设备处接收到从设备的公钥,进而验证从设备是否为正确的从设备。
可选地,在本申请一些实施例中,与步骤S1302对应的,本地电子设备在接收到从设备MAC和从设备的公钥运算结果的哈希值,同样也可以验证从设备MAC和从设备的公钥运算结果的哈希值。其中,本地电子设备可以从对端电子设备获取从设备的MAC。
可选地,在本申请一些实施例中,与步骤S1302对应的,本地电子设备在接收到从设备序列号的哈希值,同样也可以验证从设备序列号的哈希值。其中,本地电子设备可以从对端电子设备获取从设备的序列号。
S1304:请求发送验证信息。
从设备请求本地电子设备发送验证信息。
S1305:发送从设备的公钥。
本地电子设备可以向从设备发送从设备的公钥。
可选地,在本申请一些实施例中,电子设备还可以发送本地电子设备MAC等其他从设备可以验证的参数。其中,从设备验证的参数是可以从对端电子设备中获取的参数或者从设备自己已知的参数。
值得说明的是,本地电子设备发送给从设备的用于验证的信息不能和步骤S1302中接收到的数据相同。
S1306:验证从设备的公钥。
从设备验证本地电子设备发送的从设备的公钥是否与自己的公钥一致,进而完成验证。
值得说明的是,步骤S1301至步骤S1303为单向验证;步骤S1304至步骤S1306同样为单向验证;步骤S1301至步骤S1306为双向验证。
值得说明的是,步骤S1301和步骤S1304为可选的步骤,即本地电子设备与从设备的验证过程可以不由请求触发,而是在建立连接后自动触发。
或者,本地电子设备与从设备的验证也可以利用对端电子设备的公钥或者从设备的公钥,如图14所示。
图14为本申请实施例提供的本地电子设备与从设备验证的另一个示例性示意图。
本地电子设备与从设备的验证可以包括如下步骤。
S1401:发送从设备公钥加密的随机数。
本地电子设备生成一个随机数,然后使用从设备的公钥加密,发送给从设备。其中,本地电子设备从对端电子设备处获取从设备的公钥。
可选地,在本申请一些实施例中,本地电子设备也可以使用对端电子设备的公钥加密随机数,其中,对端电子设备将自己的公钥发送给本地电子设备,对端电子设备将自己的私钥发送给从设备。
S1402:使用从设备的私钥解密,获取随机数。
从设备使用自己的私钥解密,获取随机数。
可选地,在本申请一些实施例中,从设备也可以使用对端电子设备的私钥解密,获取随机数。
S1403:发送随机数。
从设备向本地电子设备发送随机数。
S1404:验证随机数。
本地电子设备验证随机数,即验证接收到的随机数和步骤S1401中的随机数是否一致。
值得说明的是,步骤S1401至步骤S1404为单向验证,对应的,从设备也可以向本地电子设备发起单向验证;或者,本地电子设备与从设备可以执行双向验证。
可选地,在本申请一些实施例中,步骤S1401可以由从设备发送验证请求触发。
S1109:验证成功后,执行数据交互。
本地电子设备与从设备的验证成功后,可以基于该连接执行数据交互。例如,可以开始配对、传输媒体文件等,在此不做限定。
S704:从设备与本地电子设备断开连接,删除或失效用于连接从设备的信息。
步骤S704为可选的步骤。
在一段时间后,从设备与本地电子设备断开连接,并且从设备和/或本地电子设备删除或失效用于连接从设备的信息。
其中,该一段时间可以为对端电子设备发送给的第一请求中的时间信息指示的时间长度。对端电子设备基于该时间信息指示从设备在多长时间后断开与本地电子设备的连接。
在断开连接后,从设备和/或本地电子设备删除或失效用于连接从设备的信息。
可以理解的是,在删除或失效用于连接从设备的信息后,从设备保持原来的状态,在媒体文件分享等场景中,还会保证从设备的安全性。
下面结合图15A和图15B所示的内容,示例性的介绍本申请实施例提供的通信方法。
图15A为本申请实施例提供的通信方法的方法流程的一个示例性示意图。
如图15A所示,本申请实施例提供的通信方法可以包括如下步骤。
其中步骤S15A01、步骤S15A02、步骤S15A04、步骤S15A09、步骤S15A10、步骤S15A12、步骤S15A14为可选的步骤。
S15A01:通过广播询问可连接的电子设备。
本地电子设备通过广播询问可连接的电子设备。
可选地,在本申请一些实施例中,对端电子设备可以通过广播询问本地电子设备。
S15A02:回复询问。
对端电子设备在接收到本地电子设备的广播询问后,回复该询问,使得本地电子设备可以发现本地电 子设备。
可选地,在本申请一些实施例中,在对端电子设备可以通过广播询问本地电子设备的情况下,由本地电子设备回复询问。
可选地,在本申请一些实施例中,本地电子设备可以通过其他方式发现对端电子设备,在此不做限定。
可选地,在本申请一些实施例中,在步骤S15A01和/或S15A02中,本地电子设备可以确定对端电子设备与本地电子设备之间的距离为第一距离,进而判断第一距离是否小于等于距离阈值,进而确定是否执行步骤S15A03。
S15A03:建立连接。
本地电子设备与对端电子设备建立连接。
可选的,在本申请一些实施例中,在执行步骤S15A03前,当连接的发起方为本地电子设备的情况下,对端电子设备需要获取用户的授权后,才会与本地电子设备建立连接。
S15A04:执行安全性验证。
本地电子设备与对端电子设备执行安全性验证,其中,安全性验证一方面为了避免恶意是被通过转发广播的消息而误连接,另一方面为了交互会话私钥。
其中,本地电子设备与对端电子设备执行安全性验证的内容可以参考上文中步骤S701、图8对应的文字描述、图9A和图9B对应的文字描述、图10对应的文字描述,此处不再赘述。
S15A05:发送第一请求。
本地电子设备向对端电子设备发送第一请求,其中,第一请求的内容可以参考步骤S702中的文字描述,此处不再赘述。
S15A06:获取用户授权。
对端电子设备可以通过界面上显示通知等多种方式获取用户的授权,一个示例性的界面可以参考图4B中界面4B01所示的内容。
S15A07:发送第一消息。
对端电子设备向从设备发送第一消息,第一消息用于通知从设备切换为可连接状态。
其中,第一消息也可以称为第一指令。
可选地,在本申请一些实施例中,第一消息还可以包括时间信息。该时间信息用于指示从设备在间隔多长时间后重新回连对端电子设备;和/或,该时间信息还用于指示从设备删除与本地电子设备连接或安全验证的相关信息,进而实现与本地电子设备的临时连接;和/或,该时间信息还可以指示从设备失效与曾经与本地电子设备共用的密钥等参数。
S15A08:进入可连接状态。
从设备进入可连接状态。
可选地,在本申请一些实施例中,从设备进入可连接状态后,从设备与对端电子设备之间的连接断开。
S15A09:发送用于验证本地电子设备的消息。
对端电子设备向本地电子设备发送用于验证本地电子设备的参数。
其中,用于验证的参数可以包括本地电子设备的标识,如本地电子设备的MAC。
其中,用于验证本地电子设备的参数可以与本地电子设备与对端电子设备的连接有关,也可以是本地电子设备的固有参数。
其中,对端电子设备可以通过与本地电子设备的连接获取用于验证本地电子设备的参数。
S15A10:发送用于验证从设备的信息。
从设备向对端电子设备发送用于验证从设备的信息。
其中,验证从设备的信息可以是从设备的公钥。
S15A11:发送用于连接从设备的信息。
对端电子设备向本地电子设备发送用于连接从设备的信息。
例如,连接从设备的信息可以是从设备的MAC。其中,对端电子设备由于和从设备之前连接过,所以对端电子设备上存有从设备的MAC。
S15A12:发送用于验证从设备的信息。
对端电子设备向本地电子设备发送用于验证从设备的信息。
其中,验证从设备的信息可以来自于步骤S15A10,如从设备的公钥;或者,验证从设备的信息也可以来自于之前对端电子设备和从设备连接时交换的信息,如从设备的标识、从设备的MAC、对端电子设 备和从设备之间连接对应的令牌。
S15A13:建立连接。
本地电子设备与从设备建立连接。
S15A14:执行安全性验证。
本地电子设备与从设备执行安全性验证。本地电子设备与从设备之间的安全性验证的内容可以参考图12对应的文字描述、图13对应的文字描述、图14对应的文字描述,此处不再赘述。
在验证成功后,本地电子设备可以与对端电子设备执行配对,进而执行数据交互。
图15B为本申请实施例提供的通信方法的方法流程的另一个示例性示意图。
其中,步骤S15B01、步骤S15B02、步骤S15B03、步骤S15B04可以参考图15A中的步骤S15A01、步骤S15A02、步骤S15A03、步骤S15A04中的内容,此处不再赘述。
S15B05:发送第一请求。
本地电子设备向对端电子设备发送第一请求,该第一请求中用于分享本地电子设备连接的从设备。
可选地,在本申请一些实施例中,步骤S15B05执行的过程中还需要获取用户的授权。
S15B06:发送第一消息。
其中,第一消息的内容可以参考步骤S15A07中的文字描述,此处不再赘述。
S15B07:进入可连接状态。
其中,可连接状态的内容可以参考步骤S15A08中的文字描述,此处不再赘述。
S15B08:发送用于验证对端电子设备的信息。
本地电子设备向从设备发送用于验证对端电子设备的信息。
其中,用于验证的参数可以包括对端电子设备的标识,如对端电子设备的MAC。
其中,用于验证对端电子设备的参数可以与本地电子设备与对端电子设备的连接有关,也可以是对端电子设备的固有参数。
其中,对端电子设备可以通过与本地电子设备的连接获取用于验证对端电子设备的参数。
S15B09:发送用于验证从设备的信息。
本地电子设备向对端电子设备发送用于验证从设备的信息。
例如,验证从设备的信息可以是从设备的公钥等。
S15B10:发送用于连接从设备的信息。
本地电子设备向对端电子设备发送用于连接从设备的信息。例如,连接从设备的信息可以是从设备的MAC。其中,本地电子设备由于和从设备之前连接过,所以本地电子设备上存有从设备的MAC。
S15B11:发送用于验证从设备的信息。
本地电子设备向对端电子设备发送用于验证从设备的信息。
其中,验证从设备的信息可以来自于步骤S15B09,如从设备的公钥;或者,验证从设备的信息也可以来自于之前对端电子设备和从设备连接时交换的信息,如从设备的标识、从设备的MAC、对端电子设备和从设备之间连接对应的令牌。
S15B12:建立连接。
对端电子设备与从设备建立连接。
S15B13:执行安全性验证。
对端电子设备与从设备执行安全性验证。对端电子设备与从设备之间的安全性验证的内容可以参考图12对应的文字描述、图13对应的文字描述、图14对应的文字描述,此处不再赘述。
最后介绍本申请实施例提供的本地电子设备、对端电子设备和从设备的硬件结构和软件架构。
图16为本申请实施例提供的本地电子设备、对端电子设备和从设备的硬件结构的一个示例性示意图。
本地电子设备、对端电子设备或从设备可以是手机、平板电脑、桌面型计算机、膝上型计算机、手持计算机、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及蜂窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、人工智能(artificial intelligence,AI)设备、可穿戴式设备、车载设备、智能家居设备和/或智慧城市设备,本申请实施例对该电子设备的具体类型不作特殊限制。
为了方便说明,在未出现本地电子设备、对端电子设备或从设备的情况下,下文以电子设备指代本地电子设备、对端电子设备和从设备中的任一个。
电子设备可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本发明实施例示意的结构并不构成对电子设备的具体限定。在本申请另一些实施例中,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备充电,也可以用于电子设备与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备的结构限定。在本申请另一些实施例中,电子设备也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连 接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备可以支持一种或多种视频编解码器。这样,电子设备可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
内部存储器121可以包括一个或多个随机存取存储器(random access memory,RAM)和一个或多个非易失性存储器(non-volatile memory,NVM)。
随机存取存储器可以包括静态随机存储器(static random-access memory,SRAM)、动态随机存储器(dynamic random access memory,DRAM)、同步动态随机存储器(synchronous dynamic random access memory,SDRAM)、双倍资料率同步动态随机存取存储器(double data rate synchronous dynamic random access memory,DDR SDRAM,例如第五代DDR SDRAM一般称为DDR5SDRAM)等;非易失性存储器可以包括磁盘存储器件、快闪存储器(flash memory)。
快闪存储器按照运作原理划分可以包括NOR FLASH、NAND FLASH、3D NAND FLASH等,按照存储单元电位阶数划分可以包括单阶存储单元(single-level cell,SLC)、多阶存储单元(multi-level cell,MLC)、三阶储存单元(triple-level cell,TLC)、四阶储存单元(quad-level cell,QLC)等,按照存储规范划分可以包括通用闪存存储(英文:universal flash storage,UFS)、嵌入式多媒体存储卡(embedded multi media Card,eMMC)等。
随机存取存储器可以由处理器110直接进行读写,可以用于存储操作系统或其他正在运行中的程序的可执行程序(例如机器指令),还可以用于存储用户及应用程序的数据等。
非易失性存储器也可以存储可执行程序和存储用户及应用程序的数据等,可以提前加载到随机存取存储器中,用于处理器110直接进行读写。
外部存储器接口120可以用于连接外部的非易失性存储器,实现扩展电子设备的存储能力。外部的非易失性存储器通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部的非易失性存储器中。
电子设备可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频 信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备可以设置至少一个麦克风170C。在另一些实施例中,电子设备可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备根据压力传感器180A检测所述触摸操作强度。电子设备也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备是翻盖机时,电子设备可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测电子设备在各个方向上(一般为三轴)加速度的大小。当电子设备静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备通过发光二极管向外发射红外光。电子设备使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备附近有物体。当检测到不充分的反射光时,电子设备可以确定电子设备附近没有物体。电子设备可以利用接近光传感器180G检测用户手持电子设备贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备利用温度传感器180J检测的温度,执行 温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备对电池142加热,以避免低温导致电子设备异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备可以接收按键输入,产生与电子设备的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备的接触和分离。电子设备可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备中,不能和电子设备分离。
在本申请一些实施例中,本地电子设备可以通过无线通信模块160与对端电子设备连接;本地电子设备可以通过无线通信模块160与从设备连接。
图17A为本申请实施例提供的电子设备的软件架构的一个示例性示意图。
电子设备的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android系统为例,示例性说明电子设备的软件结构。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。
应用程序层可以包括一系列应用程序包。
如图17A所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图17A所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。 显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供电子设备的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动和蓝牙驱动。
其中,本地电子设备与对端电子设备之间可以通过蓝牙驱动执行蓝牙连接;对应的,本地电子设备与从设备之间可以通过蓝牙驱动执行蓝牙连接。
图17B为本申请实施例提供的电子设备的软件架构的另一个示例性示意图。
如图17B所示,电子设备的软件架构包括媒体播放模块、设备连接管理模块和蓝牙硬件抽象层。
其中,媒体播放模块可以用于播放媒体文件。
其中,设备连接管理模块包括设备发现模块和设备连接模块。其中,设备发现模块用于发现周边的其他电子设备;设备连接模块用于连接发现的电子设备,以及执行安全性验证。
其中,蓝牙硬件抽象层用于被设备连接管理模块调用蓝牙硬件,进而与其他电子设备执行蓝牙连接。
上述实施例中所用,根据上下文,术语“当…时”可以被解释为意思是“如果…”或“在…后”或“响应于确定…”或“响应于检测到…”。类似地,根据上下文,短语“在确定…时”或“如果检测到(所陈述的条件或事件)”可以被解释为意思是“如果确定…”或“响应于确定…”或“在检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机程序指令时,全部或部分地产生按照本申请实施例该的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如DVD)、或者半导体介质(例如固态硬盘)等。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。

Claims (40)

  1. 一种通信方法,其特征在于,应用于包括第一电子设备和第二电子设备的通信系统,所述方法包括:
    所述第二电子设备与从设备连接,在所述第二电子设备确定要建立所述第一电子设备与所述从设备之间的连接的情况下,所述第二电子设备向所述第一电子设备发送第一消息,并且所述第二电子设备向所述从设备发送第一指示,所述第一指示用于指示所述从设备进入可连接状态,所述第一消息用于指示所述第一电子设备连接所述从设备,所述第一消息中包括用于连接所述从设备的信息;
    所述第一电子设备基于所述第一消息连接所述从设备。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    响应于接收到用户在所述第二电子设备上的操作,所述第二电子设备确定要建立所述第一电子设备与所述从设备之间的连接。
  3. 根据权利要求2所述的方法,其特征在于,在所述响应于接收到用户在所述第二电子设备上的操作后,所述方法还包括:
    所述第二电子设备向所述第一电子设备发送第一请求,所述第一请求用于将所述从设备分享至所述第一电子设备;所述第一电子设备接收到所述第一请求后,所述第一电子设备向所述第二电子设备发送确认消息;
    在所述第二电子设备接收到所述确认消息后,所述第二电子设备确定要建立所述第一电子设备与所述从设备之间的连接。
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    所述第一电子设备向所述第二电子设备发送第二请求;
    所述第二电子设备接收所述第二请求后,所述第二电子设备基于所述第二请求确定所述从设备;
    在所述第二电子设备确定所述从设备后,所述第二电子设备确定要建立所述第一电子设备与所述从设备之间的连接。
  5. 根据权利要求4所述的方法,其特征在于,所述第二请求包括从设备的类型和/或所述第二请求用于分享第一数据,在所述第一电子设备基于所述第一消息连接所述从设备后,所述方法还包括:所述第一电子设备将所述从设备作为输入设备或输出设备。
  6. 根据权利要求4或5所述的方法,其特征在于,所述第二请求用于分享所述第一数据,所述第二电子设备基于所述第二请求确定所述从设备,具体包括:所述第二电子设备基于所述第一数据确定由所述从设备处理所述第一数据后,所述第二电子设备确定所述从设备;
    在所述第一电子设备将所述从设备作为输入设备或输出设备后,所述方法还包括:所述第一电子设备将所述第一数据发送到所述从设备。
  7. 根据权利要求4-6中任一项所述的方法,其特征在于,在所述第一电子设备向所述第二电子设备发送第二请求前,所述方法还包括:
    所述第一电子设备显示第一界面,所述第一界面中包括第一控件;
    在接收到用户对所述第一控件操作后,所述第一电子设备显示第一窗口,所述第一窗口中包括第二控件,所述第二控件与所述第二电子设备对应;
    所述第一电子设备向所述第二电子设备发送第二请求,具体包括:在接收到用户对所述第二控件操作后,所述第一电子设备向所述第二电子设备发送所述第二请求。
  8. 根据权利要求7所述的方法,其特征在于,
    所述第一界面为第一应用程序的界面,所述第一应用程序为用于播放多媒体文件的应用程序,所述第一界面中还包括第三控件,所述第三控件用于指示第一电子设备播放多媒体文件;
    在所述第一电子设备基于所述第一消息连接所述从设备后,所述方法还包括:在接收到用户对所述第三控件的操作后,所述第一电子设备通过所述从设备播放所述多媒体文件的画面和/或音频。
  9. 根据权利要求4-8中任意一项所述的方法,其特征在于,
    在所述第一电子设备向所述第二电子设备发送第二请求前,所述方法还包括;所述第一电子设备确定第一距离,所述第一距离为所述第一电子设备和所述第二电子设备之间的距离;所述第一电子设备确定所述第一距离小于距离阈值后,所述第一电子设备与所述第二电子设备建立连接;
    所述第一电子设备向所述第二电子设备发送第二请求,具体包括:所述第一电子设备基于所述连接向所述第二电子设备发送第二请求;
    所述第二电子设备向所述第一电子设备发送第一消息,具体包括:所述第二电子设备基于所述连接向所述第一电子设备发送所述第一消息。
  10. 根据权利要求9所述的方法,其特征在于,所述第一电子设备确定第一距离,具体包括:
    所述第二电子设备发送第一广播消息;
    所述第一电子设备接收到所述第一广播消息后,基于所述第一广播消息确定所述第一距离。
  11. 根据权利要求9所述的方法,其特征在于,所述第一电子设备确定第一距离,具体包括:
    所述第一电子设备发送第一广播消息;
    所述第二电子设备接收到所述第一广播消息并基于所述第一广播消息确定第一距离后,发送第一响应,所述第一响应包括所述第一距离;
    所述第一电子设备接收所述第一响应后,基于所述第一响应确定所述第一距离。
  12. 根据权利要求9-11中任一项所述的方法,其特征在于,
    在所述第一电子设备与所述第二电子设备建立连接前,所述方法还包括:所述第二电子设备通过广播发送第一验证参数,所述第一验证参数为第一参数的哈希值,所述第一参数为第一MAC和/或第一公钥,所述第一公钥为所述第二电子设备的公钥,所述第一MAC为所述第二电子设备的地址;
    在所述第一电子设备与所述第二电子设备建立连接后,还包括:
    所述第二电子设备基于所述连接发送所述第一参数;
    所述第一电子设备基于所述第一参数和所述第一验证参数判断是否断开所述连接。
  13. 根据权利要求4-12中任一项所述的方法,其特征在于,在所述第二电子设备接收所述第二请求后,在所述第二电子设备向所述第一电子设备发送第一消息前,所述方法还包括:
    所述第二电子设备向所述从设备发送第三消息,所述第三消息用于验证连接所述从设备的电子设备是否是所述第一电子设备,所述第三消息包括第二MAC,所述第二MAC为所述第一电子设备的地址;
    在所述第一电子设备连接所述从设备后,所述方法还包括:
    所述从设备基于所述第三消息确定连接所述从设备的电子设备为所述第一电子设备。
  14. 根据权利要求1-12中任一项所述的方法,其特征在于,在所述第二电子设备接收所述第二请求后,在所述第二电子设备向所述从设备发送第一指示前,所述方法还包括:
    所述第二电子设备显示第二界面,所述第二界面包括第二窗口和第四控件,所述第二窗口用于显示授权提示信息,所述授权提示信息用于提示用户是否授权所述第一电子设备与所述第二从设备建立连接,所述第四控件用于获取用户授权;
    所述第二电子设备向所述第二从设备发送第一指示,具体包括:在接收到用户对所述第四控件的操作后,所述第二电子设备向所述第二从设备发送所述第一指示。
  15. 根据权利要求1-12中任一项所述的方法,其特征在于,在所述第二电子设备向所述从设备发送第一指示后,在所述第一电子设备基于所述第一消息连接所述从设备前,所述方法还包括:
    所述第二电子设备向所述第一电子设备发送第四消息,所述第四消息用于判断基于所述第一消息连接的电子设备是否是所述从设备,所述第四消息包括所述从设备的公钥、所述从设备的标识信息、所述从设备与所述第二电子设备连接的标识中的一种或多种;
    在所述第一电子设备基于所述第一消息连接所述从设备后,所述方法还包括:
    所述第一电子设备基于所述第四消息确定连接所述第一电子设备的电子设备为所述从设备。
  16. 根据权利要求4-12中任一项所述的方法,其特征在于,
    所述第二请求或所述第一消息中包括第一时长;
    在所述第一电子设备连接所述从设备后,所述方法还包括:
    在所述第一电子设备连接所述从设备的所述第一时长后,所述第一电子设备断开第一电子设备与所述从设备之间的连接。
  17. 根据权利要求16所述的方法,其特征在于,在所述第一电子设备连接所述从设备的所述第一时长后,所述方法还包括:
    所述第一电子设备失效或删除用于连接所述从设备的信息。
  18. 根据权利要求16所述的方法,其特征在于,所述第一请求用于分享第一数据,所述第一数据为多媒体文件,所述第一时长与所述多媒体文件的播放时长有关。
  19. 根据权利要求1-18所述的方法,其特征在于,处于可连接状态的电子设备可以被连接并且可以被配对。
  20. 一种通信方法,其特征在于,应用于第一电子设备,所述方法包括:
    所述第一电子设备接收所述第二电子设备发送的第一消息,所述第一消息用于连接从设备,所述第一消息中包括用于连接所述从设备的信息,其中,在所述第一电子设备接收所述第一消息前,所述从设备与所述第二电子设备连接;其中,在所述第一电子设备接收所述第一消息后,所述从设备处于可连接状态;
    所述第一电子设备基于所述第一消息连接所述从设备。
  21. 根据权利要求20所述的方法,其特征在于,在所述第一电子设备接收所述第二电子设备发送的第一消息前,所述方法还包括:
    所述第一电子设备接收所述第二电子设备发送的第一请求,所述第一请求用于将所述从设备分享至所述第一电子设备;
    所述第一电子设备向所述第二电子设备发送确认消息,所述确认消息用于指示所述第二电子设备确定要建立所述第一电子设备与所述从设备之间的连接。
  22. 根据权利要求20所述的方法,其特征在于,在所述第一电子设备接收所述第二电子设备发送的第一消息前,所述方法还包括:
    所述第一电子设备向所述第二电子设备发送第二请求,所述第二请求用于指示所述第二电子设备确定要建立所述第一电子设备与所述从设备之间的连接。
  23. 根据权利要求22中任一项所述的方法,其特征在于,在所述第一电子设备向所述第二电子设备发送第一请求前,所述方法还包括:
    所述第一电子设备显示第一界面,所述第一界面中包括第一控件;
    在接收到用户对所述第一控件操作后,所述第一电子设备显示第一窗口,所述第一窗口中包括第二控件,所述第二控件与所述第二电子设备对应;
    所述第一电子设备向所述第二电子设备发送第一请求,具体包括:在接收到用户对所述第二控件操作后,所述第一电子设备向所述第二电子设备发送所述第二请求。
  24. 根据权利要求23所述的方法,其特征在于,所述第二请求包括从设备的类型和/或所述第二请求用于分享第一数据,在所述第一电子设备基于所述第一消息连接所述从设备后,所述方法还包括:所述第一电子设备将所述从设备作为输入设备或输出设备;
    在所述第二请求用于分享第一数据的情况下,在所述第一电子设备将所述从设备作为输入设备或输出设备后,所述第一电子设备将所述第一数据发送到所述从设备。
  25. 根据权利要求24所述的方法,其特征在于,
    所述第一界面为第一应用程序的界面,所述第一应用程序为用于播放多媒体文件的应用程序,所述第一数据为多媒体文件,所述第一界面中还包括第三控件,所述第三控件用于播放所述第一数据;
    在所述第一电子设备连接所述从设备后,所述方法还包括:在接收到用户对所述第三控件的操作后,所述第一电子设备通过所述从设备播放所述多媒体文件的画面和/或音频。
  26. 根据权利要求22-25中任一项所述的方法,其特征在于,
    在所述第一电子设备向所述第二电子设备发送第二请求前,所述方法还包括;所述第一电子设备确定第一距离,所述第一距离为所述第一电子设备和所述第二电子设备之间的距离;所述第一电子设备确定所述第一距离小于距离阈值后,所述第一电子设备与所述第二电子设备建立连接;
    所述第一电子设备向所述第二电子设备发送第二请求,具体包括:所述第一电子设备基于所述连接向所述第二电子设备发送第二请求;
    所述第一电子设备接收所述第二电子设备发送的第一消息,具体包括:所述第一电子设备基于所述连接接收所述第二电子设备发送的所述第一消息。
  27. 根据权利要求26所述的方法,其特征在于,所述第一电子设备确定第一距离,具体包括:
    所述第一电子设备接收到所述第二电子设备发送的第一广播消息,基于所述第一广播消息确定所述第一距离;
    或者,所述第一电子设备发送第一广播消息,并接收第二电子设备发送的第一响应,所述第一响应包括第一距离,所述第一距离为所述第二电子设备基于所述第一广播消息确定的。
  28. 根据权利要求26或27所述的方法,其特征在于,
    在所述第一电子设备与所述第二电子设备建立连接前,所述方法还包括:所述第二电子设备通过广播发送第一验证参数,所述第一验证参数为第一参数的哈希值,所述第一参数为第一MAC和/或第一公钥,所述第一公钥为所述第二电子设备的公钥,所述第一MAC为所述第二电子设备的地址;
    在所述第一电子设备与所述第二电子设备建立连接后,还包括:
    所述第一电子设备基于所述连接接收所述第一参数;
    所述第一电子设备基于所述第一参数和所述第一验证参数判断是否断开所述连接。
  29. 根据权利要求22-28中任一项所述的方法,其特征在于,在所述第一电子设备基于所述第一消息连接所述从设备前,所述方法还包括:
    所述第一电子设备接收所述第二电子设备发送的第二消息,所述第二消息用于判断基于所述第一消息连接的电子设备是否是所述从设备,所述第二消息包括所述从设备的公钥、所述从设备的标识信息、所述从设备与所述第二电子设备连接的标识中的一种或多种;
    在所述第一电子设备基于所述第一消息连接所述从设备后,所述方法还包括:
    所述第一电子设备基于所述第二消息确定连接所述第一电子设备的电子设备为所述从设备。
  30. 一种通信方法,其特征在于,应用于第二电子设备,所述方法包括:
    所述第二电子设备与从设备连接,在所述第二电子设备确定要建立第一电子设备与所述从设备之间的连接的情况下,所述第二电子设备向所述第一电子设备发送第一消息,并且所述第二电子设备向所述从设备发送第一指示,所述第一指示用于指示所述从设备进入可连接状态,所述第一消息用于指示所述第一电子设备连接所述从设备,所述第一消息中包括用于连接所述从设备的信息。
  31. 根据权利要求30所述的方法,其特征在于,所述方法还包括:
    响应于接收到用户在所述第二电子设备上的操作,所述第二电子设备确定要建立所述第一电子设备与所述从设备之间的连接。
  32. 根据权利要求31所述的方法,其特征在于,所述响应于接收到用户在所述第二电子设备上的操作 后,所述方法还包括:
    所述第二电子设备向所述第一电子设备发送第一请求,所述第一请求用于将所述从设备分享至所述第一电子设备;
    在所述第二电子设备接收到所述第一电子设备发送的所述确认消息后,所述第二电子设备确定要建立所述第一电子设备与所述从设备之间的连接。
  33. 根据权利要求30所述的方法,其特征在于,所述方法还包括:
    所述第二电子设备接收所述第二请求后,所述第二电子设备基于所述第二请求确定所述从设备;
    在所述第二电子设备确定所述从设备后,所述第二电子设备确定要建立所述第一电子设备与所述从设备之间的连接。
  34. 根据权利要求33所述的方法,其特征在于,所述方法还包括:
    所述第二请求包括从设备的类型和/或所述第二请求用于分享第一数据,所述第二电子设备基于所述第二请求确定所述从设备,具体包括:所述第二电子设备基于所述从设备的类型和所述第一数据确定所述从设备。
  35. 一种通信方法,其特征在于,应用于从设备,所述方法包括:
    所述从设备与第二电子设备连接,所述从设备基于所述从设备与所述第二电子设备之间的连接接收所述第二电子设备发送的第一指示,所述第一指示用于指示所述从设备转变为可连接状态;
    所述从设备基于所述第一指示转变为可连接状态;
    在所述从设备转变为可连接状态后,响应于接收到第一电子设备发送的连接请求,所述从设备与所述第一电子设备建立连接。
  36. 根据权利要求35所述的方法,其特征在于,在所述从设备与所述第一电子设备建立连接前,所述方法还包括:
    所述从设备基于所述第二电子设备与所述从设备之间的连接接收所述第二电子设备发送的第一消息,所述第一消息,所述第一消息用于验证连接从设备的电子设备是否是所述第一电子设备;
    在所述从设备与所述第一电子设备建立连接后,所述方法还包括:
    所述从设备基于所述第一消息确定连接所述从设备的电子设备是所述第一电子设备。
  37. 一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器和存储器;所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:如权利要求20-36中任一项所述的方法。
  38. 一种芯片系统,其特征在于,所述芯片系统应用于电子设备,所述芯片系统包括一个或多个处理器,所述处理器用于调用计算机指令以使得所述电子设备执行如权利要求20-36中任一项所述的方法。
  39. 一种计算机可读存储介质,包括指令,其特征在于,当所述指令在电子设备上运行时,使得所述电子设备执行如权利要求20-36中任一项所述的方法。
  40. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在电子设备上运行时,使得所述电子设备执行如权利要求20-36中任一项所述的方法。
PCT/CN2023/103093 2022-06-30 2023-06-28 通信方法、通信系统及电子设备 WO2024002137A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210761381.X 2022-06-30
CN202210761381.XA CN117376906A (zh) 2022-06-30 2022-06-30 通信方法、通信系统及电子设备

Publications (1)

Publication Number Publication Date
WO2024002137A1 true WO2024002137A1 (zh) 2024-01-04

Family

ID=89383021

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/103093 WO2024002137A1 (zh) 2022-06-30 2023-06-28 通信方法、通信系统及电子设备

Country Status (2)

Country Link
CN (1) CN117376906A (zh)
WO (1) WO2024002137A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120084446A1 (en) * 2010-09-30 2012-04-05 Fujitsu Limited Electronic device
CN109144922A (zh) * 2017-06-16 2019-01-04 纬颖科技服务股份有限公司 数据传输装置及其方法
CN110198522A (zh) * 2019-06-14 2019-09-03 拉扎斯网络科技(上海)有限公司 数据传输的方法、装置、电子设备及计算机可读存储介质
CN111726842A (zh) * 2020-05-14 2020-09-29 深圳互由科技有限公司 漫游切换方法、电子设备及计算机可读存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120084446A1 (en) * 2010-09-30 2012-04-05 Fujitsu Limited Electronic device
CN109144922A (zh) * 2017-06-16 2019-01-04 纬颖科技服务股份有限公司 数据传输装置及其方法
CN110198522A (zh) * 2019-06-14 2019-09-03 拉扎斯网络科技(上海)有限公司 数据传输的方法、装置、电子设备及计算机可读存储介质
CN111726842A (zh) * 2020-05-14 2020-09-29 深圳互由科技有限公司 漫游切换方法、电子设备及计算机可读存储介质

Also Published As

Publication number Publication date
CN117376906A (zh) 2024-01-09

Similar Documents

Publication Publication Date Title
EP4113415A1 (en) Service recommending method, electronic device, and system
EP4084486B1 (en) Cross-device content projection method, and electronic device
WO2020238728A1 (zh) 智能终端的登录方法及电子设备
WO2021037146A1 (zh) 一种移动终端的文件共享方法及设备
WO2020224447A1 (zh) 一种在联系人中添加智能家居设备的方法及系统
CN112399390A (zh) 一种蓝牙回连的方法及相关装置
WO2021052204A1 (zh) 基于通讯录的设备发现方法、音视频通信方法及电子设备
WO2022042770A1 (zh) 控制通信服务状态的方法、终端设备和可读存储介质
WO2022089121A1 (zh) 处理推送消息的方法和装置
WO2023088459A1 (zh) 设备协同方法及相关装置
CN114722377A (zh) 一种利用其它设备授权的方法、电子设备和系统
EP4293997A1 (en) Display method, electronic device, and system
CN113986369B (zh) 物联网设备控制方法、系统、电子设备及存储介质
WO2021238967A1 (zh) 一种内容分享的方法、装置及系统
CN111132047A (zh) 网络连接方法及装置
WO2020062304A1 (zh) 一种文件传输方法及电子设备
WO2023284555A1 (zh) 安全调用服务的方法、安全注册服务的方法及装置
WO2021218544A1 (zh) 一种提供无线上网的系统、方法及电子设备
CN113590346B (zh) 处理业务请求的方法和电子设备
WO2024002137A1 (zh) 通信方法、通信系统及电子设备
CN116828100A (zh) 蓝牙音频播放方法、电子设备及存储介质
CN114567871A (zh) 文件共享的方法、装置、电子设备以及可读存储介质
CN114489876A (zh) 一种文本输入的方法、电子设备和系统
WO2023236939A1 (zh) 应用组件交互方法及相关设备
CN113271577B (zh) 媒体数据播放系统、方法及相关装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23830312

Country of ref document: EP

Kind code of ref document: A1