CN115884142A - Bluetooth connection method and electronic device - Google Patents
Bluetooth connection method and electronic device Download PDFInfo
- Publication number
- CN115884142A CN115884142A CN202111157938.0A CN202111157938A CN115884142A CN 115884142 A CN115884142 A CN 115884142A CN 202111157938 A CN202111157938 A CN 202111157938A CN 115884142 A CN115884142 A CN 115884142A
- Authority
- CN
- China
- Prior art keywords
- target
- bluetooth
- electronic device
- bluetooth connection
- target device
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Images
Landscapes
- Mobile Radio Communication Systems (AREA)
Abstract
本申请公开了蓝牙连接方法及电子设备,涉及电子技术领域,能够解决电子设备通过蓝牙连接的设备数量达到一定数量时,其他设备将无法再通过蓝牙与电子设备进行数据交互的问题。该方法包括:首先第一电子设备接收第二电子设备发送的第一蓝牙连接请求,第一连接请求用于请求建立第一蓝牙连接,第一蓝牙连接包括蓝牙物理链路连接和蓝牙业务链路连接;然后当第一目标设备数量大于第一阈值时,第一电子设备则执行第一操作,第一操作包括将与第一目标设备中的第二目标设备之间的第一蓝牙连接转换为第二蓝牙连接并与第二电子设备建立第一蓝牙连接,第一目标设备为与第一电子设备建立第一蓝牙连接的设备,第二蓝牙连接包括蓝牙业务链路连接。
The application discloses a bluetooth connection method and an electronic device, relates to the field of electronic technology, and can solve the problem that when the number of devices connected to the electronic device through the bluetooth reaches a certain number, other devices will no longer be able to perform data interaction with the electronic device through the bluetooth. The method includes: firstly, the first electronic device receives a first Bluetooth connection request sent by the second electronic device, the first connection request is used to request to establish a first Bluetooth connection, and the first Bluetooth connection includes a Bluetooth physical link connection and a Bluetooth service link connection; then when the number of the first target device is greater than the first threshold, the first electronic device executes the first operation, the first operation includes converting the first Bluetooth connection with the second target device in the first target device to The second Bluetooth connection establishes a first Bluetooth connection with the second electronic device, the first target device is a device that establishes the first Bluetooth connection with the first electronic device, and the second Bluetooth connection includes a Bluetooth service link connection.
Description
技术领域technical field
本申请涉及电子技术领域,尤其涉及蓝牙连接方法及电子设备。The present application relates to the field of electronic technology, in particular to a bluetooth connection method and electronic equipment.
背景技术Background technique
蓝牙是一种支持设备之间短距离通信的无线电技术。随着科技的发展,在人们的日常生活中出现了越来越多的具备蓝牙功能的电子设备。在全场景智能连接场景中,一个电子设备可以通过蓝牙连接多个设备。Bluetooth is a radio technology that supports short-range communication between devices. With the development of science and technology, more and more electronic devices with Bluetooth function appear in people's daily life. In the all-scenario smart connection scenario, one electronic device can connect to multiple devices via Bluetooth.
然而,电子设备通过蓝牙连接的设备数量达到一定数量时,多个设备会抢占该电子设备的蓝牙链路,导致其他设备将无法再通过蓝牙与电子设备进行数据交互。However, when the number of devices connected to an electronic device through Bluetooth reaches a certain number, multiple devices will seize the Bluetooth link of the electronic device, so that other devices will no longer be able to exchange data with the electronic device through Bluetooth.
发明内容Contents of the invention
本申请提供了蓝牙连接方法及电子设备,能够解决电子设备通过蓝牙连接的设备数量达到一定数量时,其他设备将无法再通过蓝牙与电子设备进行数据交互的问题。为达到上述目的,本申请采用如下技术方案:The application provides a bluetooth connection method and an electronic device, which can solve the problem that when the number of devices connected to the electronic device through the bluetooth reaches a certain number, other devices will no longer be able to perform data interaction with the electronic device through the bluetooth. In order to achieve the above object, the application adopts the following technical solutions:
第一方面,本申请了一种蓝牙连接方法,该方法包括:首先第一电子设备接收第二电子设备发送的第一蓝牙连接请求,所述第一连接请求用于请求建立第一蓝牙连接,所述第一蓝牙连接包括蓝牙物理链路连接和蓝牙业务链路连接;然后当第一目标设备数量大于第一阈值时,所述第一电子设备执行第一操作,所述第一操作包括将与所述第一目标设备中的第二目标设备之间的所述第一蓝牙连接转换为第二蓝牙连接并与所述第二电子设备建立第一蓝牙连接,所述第一目标设备为与所述第一电子设备建立第一蓝牙连接的设备,所述第二蓝牙连接包括蓝牙业务链路连接。In a first aspect, the present application provides a Bluetooth connection method, the method comprising: firstly, the first electronic device receives a first Bluetooth connection request sent by the second electronic device, and the first connection request is used to request establishment of a first Bluetooth connection, The first Bluetooth connection includes a Bluetooth physical link connection and a Bluetooth service link connection; then when the number of the first target device is greater than a first threshold, the first electronic device performs a first operation, and the first operation includes connecting The first Bluetooth connection with the second target device in the first target device is converted into a second Bluetooth connection and a first Bluetooth connection is established with the second electronic device, and the first target device is connected to The first electronic device is a device for establishing a first Bluetooth connection, and the second Bluetooth connection includes a Bluetooth service link connection.
相较于现有技术中,电子设备在通过蓝牙物理链路已连接的设备数量大于一定数量的情况下,由于蓝牙物理链路均被占用,电子设备无法提供空闲蓝牙物理链路建立新的蓝牙连接,因此电子设备会拒绝后续收到的蓝牙连接请求并通知连接发起方连接失败。而在本申请提供的蓝牙连接方法中,第一电子设备在通过蓝牙物理链路已连接的设备数量大于第一阈值的情况下,后续收到第二电子设备发送的蓝牙连接请求后,会通过将通过蓝牙物理链路已连接的第二目标设备的蓝牙业务链路保留并将蓝牙物理链路断开由此释放出了可供第一电子设备和第二电子设备建立蓝牙连接的蓝牙物理链路。第二目标设备的业务保持状态同步,由此解决了电子设备通过蓝牙连接的设备数量达到一定数量时,其他设备将无法再通过蓝牙与电子设备进行数据交互的问题,提升了用户体验。Compared with the prior art, when the number of devices connected to the electronic device through the Bluetooth physical link is greater than a certain number, since the Bluetooth physical link is occupied, the electronic device cannot provide an idle Bluetooth physical link to establish a new Bluetooth connection. connection, so the electronic device will reject subsequent received Bluetooth connection requests and notify the connection initiator that the connection failed. However, in the Bluetooth connection method provided by this application, when the number of connected devices via the Bluetooth physical link is greater than the first threshold, the first electronic device will pass Reserving the Bluetooth service link of the second target device connected through the Bluetooth physical link and disconnecting the Bluetooth physical link, thus releasing the Bluetooth physical link for the first electronic device and the second electronic device to establish a Bluetooth connection road. The service status of the second target device is kept synchronized, thereby solving the problem that when the number of devices connected to the electronic device through Bluetooth reaches a certain number, other devices will no longer be able to perform data interaction with the electronic device through Bluetooth, thereby improving user experience.
在一种可能的实现方式中,该方法还可以包括:当可连接设备数量小于第二阈值时,所述第一电子设备执行所述第一操作。In a possible implementation manner, the method may further include: when the number of connectable devices is less than a second threshold, the first electronic device performs the first operation.
在一种可能的实现方式中,所述将与第二目标设备之间的所述第一蓝牙连接转换为第二蓝牙连接,包括:从所述第一目标设备中确定所述第二目标设备;断开与所述第二目标设备之间的蓝牙物理链路连接。In a possible implementation manner, the converting the first Bluetooth connection with the second target device into a second Bluetooth connection includes: determining the second target device from the first target device ; Disconnect the Bluetooth physical link connection with the second target device.
在另一种可能的实现方式中,所述将与第二目标设备之间的所述第一蓝牙连接转换为第二蓝牙连接,包括:从所述第一目标设备中确定所述第二目标设备;断开与所述第二目标设备之间的蓝牙物理链路连接且保留与所述第二目标设备之间的蓝牙物理链路。In another possible implementation manner, the converting the first Bluetooth connection with the second target device into a second Bluetooth connection includes: determining the second target from the first target device device; disconnect the Bluetooth physical link with the second target device and reserve the Bluetooth physical link with the second target device.
可选地,所述第二目标设备为所述第一目标设备中空闲时长最长的第一目标设备或所述第一目标设备中业务优先级最低的第一目标设备,所述空闲时长为与第一电子设备上次进行蓝牙业务交互的时刻和当前时刻之间的时长。Optionally, the second target device is the first target device with the longest idle time among the first target devices or the first target device with the lowest service priority among the first target devices, and the idle time is The time period between the last time when the Bluetooth service interaction with the first electronic device is performed and the current time.
在一种可能的实现方式中,所述从所述第一目标设备中确定所述第二目标设备,包括:从所述第一目标设备中确定第三目标设备,所述第三目标设备为支持第二蓝牙连接的设备;从所述第三目标设备中确定所述第二目标设备,所述第二目标设备为所述第三目标设备中空闲时长最长的第三目标设备或所述第三目标设备中业务优先级最低的第三目标设备,所述空闲时长为与第一电子设备上次进行蓝牙业务交互的时刻和当前时刻之间的时长。In a possible implementation manner, the determining the second target device from the first target device includes: determining a third target device from the first target device, where the third target device is A device supporting the second Bluetooth connection; determining the second target device from the third target device, the second target device being the third target device with the longest idle time among the third target devices or the For the third target device with the lowest service priority among the third target devices, the idle time is the time between the time when the Bluetooth service interaction with the first electronic device last time and the current time.
在一种可能的实现方式中,在将与第二目标设备之间的所述第一蓝牙连接转换为第二蓝牙连接之后,所述方法还包括:当存在目标业务时,向所述第二目标设备发送第一指示,所述目标业务为与第二目标设备相关的蓝牙业务,所述第一指示用于指示所述第二目标设备与所述第一电子设备建立蓝牙物理链路连接。In a possible implementation manner, after converting the first Bluetooth connection with the second target device into a second Bluetooth connection, the method further includes: when there is a target service, sending The target device sends a first indication, the target service is a Bluetooth service related to the second target device, and the first indication is used to instruct the second target device to establish a Bluetooth physical link connection with the first electronic device.
在另一种可能的实现方式中,在将与第二目标设备之间的所述第一蓝牙连接转换为第二蓝牙连接之后,所述方法还包括:当存在目标业务时,向所述第二目标设备发送第二蓝牙连接请求,所述第二蓝牙请求用于请求建立蓝牙物理链路。In another possible implementation manner, after converting the first Bluetooth connection with the second target device into a second Bluetooth connection, the method further includes: when there is a target service, sending The two target devices send a second Bluetooth connection request, where the second Bluetooth request is used to request establishment of a Bluetooth physical link.
在一种可能的实现方式中,所述当第一目标设备数量大于第一阈值时,所述第一电子设备执行第一操作,包括:当所述第一目标设备数量大于所述第一阈值,且所述第一目标设备的空闲时长未均小于第三阈值时,所述第一电子设备执行所述第一操作;当所述第一目标设备数量大于所述第一阈值,且所述第一目标设备的空闲时长均小于所述第三阈值时,所述第一电子设备向所述第二电子设备发送第二指示,所述第二指示用于指示所述第二电子设备通过第四目标设备与所述第一电子设备建立第一蓝牙连接,所述第一目标设备包括所述第四目标设备。In a possible implementation manner, the performing the first operation on the first electronic device when the number of first target devices is greater than a first threshold includes: when the number of first target devices is greater than the first threshold , and the idle duration of the first target device is not less than a third threshold, the first electronic device performs the first operation; when the number of the first target devices is greater than the first threshold, and the When the idle durations of the first target devices are all less than the third threshold, the first electronic device sends a second indication to the second electronic device, and the second indication is used to instruct the second electronic device to pass through the third threshold. Four target devices establish a first Bluetooth connection with the first electronic device, and the first target device includes the fourth target device.
可以理解的是,第一电子设备的蓝牙物理链路数量有限并且与第一电子设备建立第一蓝牙连接需要占用第一电子设备的蓝牙物理链路,因此第一电子设备在收到第一连接请求需要通过第一目标设备数量和第一阈值大小关系来判断当前是否存在空闲(未占用)的蓝牙物理链路以供建立第一蓝牙连接。It can be understood that the number of Bluetooth physical links of the first electronic device is limited and establishing the first Bluetooth connection with the first electronic device needs to occupy the Bluetooth physical link of the first electronic device, so the first electronic device receives the first connection The request needs to determine whether there is currently an idle (unoccupied) Bluetooth physical link for establishing the first Bluetooth connection based on the relationship between the first target device number and the first threshold value.
在不存在空闲蓝牙物理链路(即第一目标设备数量大于第一阈值)的情况下,通过指示第二目标设备连接已与第一电子设备建立第一蓝牙连接的第四目标设备,使第二目标设备通过第四目标设备作为中继代理与第一电子设备建立第一蓝牙连接。这样第二电子设备和第四目标设备共用一条蓝牙物理链路与第一电子设备建立第一蓝牙连接,无需额外的蓝牙物理链路,一条蓝牙物理链路可供多个设备通过蓝牙连接第一电子设备,由此解决了电子设备通过蓝牙连接的设备数量达到一定数量时,其他设备将无法再通过蓝牙与电子设备进行数据交互的问题,提升了用户体验。When there is no idle Bluetooth physical link (that is, the number of the first target device is greater than the first threshold), the second target device is instructed to connect to the fourth target device that has established the first Bluetooth connection with the first electronic device, so that the second target device The second target device establishes a first Bluetooth connection with the first electronic device through the fourth target device as a relay agent. In this way, the second electronic device and the fourth target device share a bluetooth physical link to establish the first bluetooth connection with the first electronic device, no additional bluetooth physical link is needed, and one bluetooth physical link can be used by multiple devices to connect to the first bluetooth connection through bluetooth The electronic device thus solves the problem that when the number of devices connected to the electronic device through Bluetooth reaches a certain number, other devices will no longer be able to perform data interaction with the electronic device through Bluetooth, which improves the user experience.
在存在空闲蓝牙物理链路(即第一目标设备数量未大于第一阈值)的情况下,第一电子设备通过空闲蓝牙物理链路第二电子设备建立第一蓝牙连接。If there is an idle Bluetooth physical link (that is, the number of first target devices is not greater than the first threshold), the first electronic device establishes a first Bluetooth connection through the second electronic device through the idle Bluetooth physical link.
在一种可能的实现方式中,所述方法还包括:当所述第一目标设备数量大于所述第一阈值,且所述第一目标设备的空闲时长均小于所述第三阈值时,所述第一电子设备向所述第四目标设备发送第三指示,所示第三指示用于指示第四目标设备与所述第二电子设备建立第一蓝牙连接。In a possible implementation manner, the method further includes: when the number of the first target devices is greater than the first threshold and the idle duration of the first target devices is less than the third threshold, the The first electronic device sends a third indication to the fourth target device, where the third indication is used to instruct the fourth target device to establish a first Bluetooth connection with the second electronic device.
可选地,所述第四目标设备为所述第一目标设备中已连接设备数量最少或可连接设备数量最多的设备。Optionally, the fourth target device is the device with the least number of connected devices or the largest number of connectable devices among the first target devices.
在一种可能的实现方式中,所述方法还包括:当第一目标设备数量小于第一阈值或可连接设备数量大于第二阈值时,向所述第二电子设备发送第四指示,所述第四指示用于指示第二电子设备与第四目标设备断开连接并向所述第一电子设备发送第一蓝牙连接请求。In a possible implementation manner, the method further includes: when the number of first target devices is less than a first threshold or the number of connectable devices is greater than a second threshold, sending a fourth indication to the second electronic device, the The fourth indication is used to instruct the second electronic device to disconnect from the fourth target device and send a first Bluetooth connection request to the first electronic device.
可以理解的是,在第一电子设备存在可用蓝牙物理链路时,将第二电子设备与第一电子设备之间的连接方式由中继代理连接切换为直连可以降低第一电子设备和第二电子设备之间的通信时延,提升第一电子设备和第二电子设备之间的通信速度,从而进一步提升了用户体验。It can be understood that when the first electronic device has an available Bluetooth physical link, switching the connection mode between the second electronic device and the first electronic device from a relay agent connection to a direct connection can reduce the number of connections between the first electronic device and the second electronic device. The communication delay between the two electronic devices improves the communication speed between the first electronic device and the second electronic device, thereby further improving user experience.
在一种可能的实现方式中,所述方法还包括:当第四目标设备当前电量小于第五阈值时,与所述第四目标设备断开第一蓝牙连接并指示所述第二电子设备向所述第一电子设备发送第一蓝牙连接请求。In a possible implementation, the method further includes: disconnecting the first Bluetooth connection with the fourth target device and instructing the second electronic device to send The first electronic device sends a first Bluetooth connection request.
可以理解的是,在第四目标设备电量不足时,第一电子设备指示第二电子设备不再通过第四目标设备连接第一电子设备而是直接与第一电子设备,从而避免了第四目标设备电量不足而关机会造成通过第四目标设备与第一电子设备建立第一蓝牙连接的第二电子设备与第一电子设备断开连接而造成第一电子设备和第二电子设备蓝牙连接中断,进一步提升了用户体验。It can be understood that when the power of the fourth target device is insufficient, the first electronic device instructs the second electronic device not to connect to the first electronic device through the fourth target device but directly to the first electronic device, thereby avoiding the fourth target device. The shutdown of the device due to insufficient power will cause the second electronic device that establishes the first Bluetooth connection with the first electronic device through the fourth target device to be disconnected from the first electronic device, thereby causing the Bluetooth connection between the first electronic device and the second electronic device to be interrupted, Further enhance the user experience.
在一种可能的实现方式中,在与第四目标设备断开第一蓝牙连接后,所述方法还包括:当第四目标设备当前电量大于第五阈值时,与所述第二电子设备断开第一蓝牙连接并指示所述第四目标设备向所述第一电子设备发送第一蓝牙连接请求。In a possible implementation manner, after disconnecting the first Bluetooth connection with the fourth target device, the method further includes: when the current power level of the fourth target device is greater than the fifth threshold, disconnecting the second electronic device Opening a first Bluetooth connection and instructing the fourth target device to send a first Bluetooth connection request to the first electronic device.
在一种可能的实现方式中,所述方法还包括:根据第五目标设备的连接状态标识已连接设备,所述第五目标设备为已与所述第一电子设备建立第一蓝牙连接或第二蓝牙连接的设备,不同连接状态的第五目标设备对应不同的标识。In a possible implementation manner, the method further includes: identifying a connected device according to the connection status of the fifth target device, where the fifth target device is the first Bluetooth connection or the second Bluetooth connection that has been established with the first electronic device. For the devices connected by bluetooth, the fifth target devices in different connection states correspond to different identifications.
可选地,上述标识包括文字、颜色或图标中的至少一项。Optionally, the above identification includes at least one of text, color or icon.
示例性的,对于直接与第一电子设备建立第一蓝牙连接的设备可以通过蓝牙连接的文字标识,对于与第一电子设备建立第二蓝牙连接的设备可以通过虚拟蓝牙连接的文字标识,对于通过其他设备与第一电子设备建立第一蓝牙连接的设备可以通过中继蓝牙连接或代理蓝牙连接的文字标识。Exemplarily, for a device that directly establishes a first Bluetooth connection with the first electronic device, a textual identification of the Bluetooth connection may be used; for a device that establishes a second Bluetooth connection with the first electronic device, a textual identification of a virtual Bluetooth connection may be used; The device that establishes the first bluetooth connection with the first electronic device by other devices may be identified by the text of the relay bluetooth connection or proxy bluetooth connection.
可以理解的是,通过已连接设备的连接状态标识已连接设备,可以使用户通过已连接设备的标识快速获知已连接设备的连接状态以便于用户后续操作,由此进一步提升了用户体验。It can be understood that identifying the connected device through the connection status of the connected device can enable the user to quickly know the connection status of the connected device through the identification of the connected device to facilitate the user's subsequent operations, thereby further improving the user experience.
第二方面,本申请还提供一种电子设备,该电子设备包括处理单元和与所述处理单元耦合的存储单元,所述处理单元用于:接收第二电子设备发送的第一蓝牙连接请求,所述第一连接请求用于请求建立第一蓝牙连接,所述第一蓝牙连接包括蓝牙物理链路连接和蓝牙业务链路连接;当第一目标设备数量大于第一阈值时,执行第一操作,所述第一操作包括将与第二目标设备之间的所述第一蓝牙连接转换为第二蓝牙连接并与所述第二电子设备建立第一蓝牙连接,所述第一目标设备为与所述电子设备建立第一蓝牙连接的设备,所述第一目标设备包括所述第二目标设备,所述第二蓝牙连接包括蓝牙业务链路连接。In a second aspect, the present application also provides an electronic device, the electronic device includes a processing unit and a storage unit coupled to the processing unit, the processing unit is configured to: receive the first Bluetooth connection request sent by the second electronic device, The first connection request is used to request to establish a first Bluetooth connection, and the first Bluetooth connection includes a Bluetooth physical link connection and a Bluetooth service link connection; when the number of first target devices is greater than a first threshold, perform a first operation , the first operation includes converting the first Bluetooth connection with a second target device into a second Bluetooth connection and establishing a first Bluetooth connection with the second electronic device, the first target device being with the second electronic device The electronic device is a device for establishing a first Bluetooth connection, the first target device includes the second target device, and the second Bluetooth connection includes a Bluetooth service link connection.
在一种可能的实现方式中,所述处理单元还用于:当可连接设备数量小于第二阈值时,执行所述第一操作。In a possible implementation manner, the processing unit is further configured to: execute the first operation when the number of connectable devices is less than a second threshold.
在一种可能的实现方式中,所述处理单元具体用于:从所述第一目标设备中确定所述第二目标设备;断开与所述第二目标设备之间的蓝牙物理链路连接。In a possible implementation manner, the processing unit is specifically configured to: determine the second target device from the first target device; disconnect the Bluetooth physical link connection with the second target device .
在另一种可能的实现方式中,所述处理单元具体用于:从所述第一目标设备中确定所述第二目标设备;断开与所述第二目标设备之间的蓝牙物理链路连接且保留与所述第二目标设备之间的蓝牙物理链路。In another possible implementation manner, the processing unit is specifically configured to: determine the second target device from the first target device; disconnect the Bluetooth physical link with the second target device Connect and reserve a Bluetooth physical link with the second target device.
在一种可能的实现方式中,所述处理单元具体用于:从所述第一目标设备中确定第三目标设备,所述第三目标设备为支持第二蓝牙连接的设备;从所述第三目标设备中确定所述第二目标设备,所述第二目标设备为所述第三目标设备中空闲时长最长的第三目标设备或所述第三目标设备中业务优先级最低的第三目标设备,所述空闲时长为与电子设备上次进行蓝牙业务交互的时刻和当前时刻之间的时长。In a possible implementation manner, the processing unit is specifically configured to: determine a third target device from the first target device, where the third target device is a device supporting the second Bluetooth connection; The second target device is determined among the three target devices, and the second target device is the third target device with the longest idle time among the third target devices or the third target device with the lowest service priority among the third target devices. For the target device, the idle time is the time between the last time the electronic device interacts with the Bluetooth service and the current time.
在一种可能的实现方式中,在将与第二目标设备之间的所述第一蓝牙连接转换为第二蓝牙连接之后,所述处理单元还用于:当存在目标业务时,向所述第二目标设备发送第一指示,所述目标业务为与第二目标设备相关的蓝牙业务,所述第一指示用于指示所述第二目标设备与所述电子设备建立蓝牙物理链路连接。In a possible implementation manner, after converting the first Bluetooth connection with the second target device into a second Bluetooth connection, the processing unit is further configured to: when there is a target service, send the The second target device sends a first indication, the target service is a Bluetooth service related to the second target device, and the first indication is used to instruct the second target device to establish a Bluetooth physical link connection with the electronic device.
在另一种可能的实现方式中,在将与第二目标设备之间的所述第一蓝牙连接转换为第二蓝牙连接之后,所述处理单元还用于:当存在目标业务时,向所述第二目标设备发送第二蓝牙连接请求,所述第二蓝牙请求用于请求建立蓝牙物理链路。In another possible implementation manner, after converting the first Bluetooth connection with the second target device into a second Bluetooth connection, the processing unit is further configured to: when there is a target service, send the The second target device sends a second Bluetooth connection request, where the second Bluetooth request is used to request establishment of a Bluetooth physical link.
在一种可能的实现方式中,所述处理单元具体用于:当所述第一目标设备数量大于所述第一阈值,且所述第一目标设备的空闲时长未均小于第三阈值时,执行所述第一操作;当所述第一目标设备数量大于所述第一阈值,且所述第一目标设备的空闲时长均小于所述第三阈值时,向所述第二电子设备发送第二指示,所述第二指示用于指示所述第二电子设备通过第四目标设备与所述电子设备建立第一蓝牙连接,所述第一目标设备包括所述第四目标设备。In a possible implementation manner, the processing unit is specifically configured to: when the number of the first target devices is greater than the first threshold and the idle duration of the first target devices is not less than a third threshold, Executing the first operation; when the number of the first target devices is greater than the first threshold and the idle duration of the first target devices is less than the third threshold, sending the second electronic device to the second electronic device Two instructions, where the second instruction is used to instruct the second electronic device to establish a first Bluetooth connection with the electronic device through a fourth target device, where the first target device includes the fourth target device.
在一种可能的实现方式中,所述处理单元还用于:当所述第一目标设备数量大于所述第一阈值,且所述第一目标设备的空闲时长均小于所述第三阈值时,向所述第四目标设备发送第三指示,所示第三指示用于指示第四目标设备与所述第二电子设备建立第一蓝牙连接。In a possible implementation manner, the processing unit is further configured to: when the number of the first target devices is greater than the first threshold, and the idle durations of the first target devices are all less than the third threshold , sending a third indication to the fourth target device, where the third indication is used to instruct the fourth target device to establish a first Bluetooth connection with the second electronic device.
可选地,所述第四目标设备为所述第一目标设备中已连接设备数量最少或可连接设备数量最多的设备。Optionally, the fourth target device is the device with the least number of connected devices or the largest number of connectable devices among the first target devices.
在一种可能的实现方式中,所述处理单元还用于:当第一目标设备数量小于第一阈值或可连接设备数量大于第二阈值时,向所述第二电子设备发送第四指示,所述第四指示用于指示第二电子设备与第四目标设备断开连接并向所述电子设备发送第一蓝牙连接请求。In a possible implementation manner, the processing unit is further configured to: send a fourth indication to the second electronic device when the number of the first target device is less than a first threshold or the number of connectable devices is greater than a second threshold, The fourth indication is used to instruct the second electronic device to disconnect from the fourth target device and send a first Bluetooth connection request to the electronic device.
在一种可能的实现方式中,所述处理单元还用于:当第四目标设备当前电量小于第五阈值时,与所述第四目标设备断开第一蓝牙连接并指示所述第二电子设备向所述电子设备发送第一蓝牙连接请求。In a possible implementation manner, the processing unit is further configured to: disconnect the first Bluetooth connection with the fourth target device and instruct the second electronic device to The device sends a first Bluetooth connection request to the electronic device.
在一种可能的实现方式中,在与第四目标设备断开第一蓝牙连接后,所述处理单元还用于:当第四目标设备当前电量大于第五阈值时,与所述第二电子设备断开第一蓝牙连接并指示所述第四目标设备向所述电子设备发送第一蓝牙连接请求。In a possible implementation manner, after disconnecting the first Bluetooth connection with the fourth target device, the processing unit is further configured to: when the current power of the fourth target device is greater than the fifth threshold, communicate with the second electronic The device disconnects the first Bluetooth connection and instructs the fourth target device to send a first Bluetooth connection request to the electronic device.
在一种可能的实现方式中,所述处理单元还用于:根据第五目标设备的连接状态标识已连接设备,所述第五目标设备为已与所述第一电子设备建立第一蓝牙连接或第二蓝牙连接的设备,不同连接状态的第五目标设备对应不同的标识。In a possible implementation manner, the processing unit is further configured to: identify a connected device according to a connection state of a fifth target device, where the fifth target device has established a first Bluetooth connection with the first electronic device Or the second Bluetooth-connected device, the fifth target device in a different connection state corresponds to a different identifier.
可选地,上述标识包括文字、颜色或图标中的至少一项。Optionally, the above identification includes at least one of text, color or icon.
第三方面,本申请还提供一种电子设备,该装置包括:至少一个处理器,当所述至少一个处理器执行程序代码或指令时,实现上述第一方面或其任意可能的实现方式中所述的方法。In a third aspect, the present application also provides an electronic device, which includes: at least one processor, and when the at least one processor executes program codes or instructions, it can implement the above-mentioned first aspect or any possible implementation manners. described method.
可选地,该电子设备还可以包括至少一个存储器,该至少一个存储器用于存储该程序代码或指令。Optionally, the electronic device may further include at least one memory, and the at least one memory is used to store the program code or instruction.
第四方面,本申请还提供一种芯片,包括:输入接口、输出接口、至少一个处理器。可选地,该芯片还包括存储器。该至少一个处理器用于执行该存储器中的代码,当该至少一个处理器执行该代码时,该芯片实现上述第一方面或其任意可能的实现方式中所述的方法。In a fourth aspect, the present application further provides a chip, including: an input interface, an output interface, and at least one processor. Optionally, the chip also includes a memory. The at least one processor is used to execute the code in the memory, and when the at least one processor executes the code, the chip implements the method described in the above first aspect or any possible implementation thereof.
可选地,上述芯片还可以为集成电路。Optionally, the aforementioned chip may also be an integrated circuit.
第五方面,本申请还提供一种终端,该终端包括上述电子设备或上述芯片。In a fifth aspect, the present application further provides a terminal, where the terminal includes the above-mentioned electronic device or the above-mentioned chip.
第六方面,本申请还提供一种计算机可读存储介质,用于存储计算机程序,该计算机程序包括用于实现上述第一方面或其任意可能的实现方式中所述的方法。In a sixth aspect, the present application further provides a computer-readable storage medium for storing a computer program, and the computer program includes a method for realizing the above-mentioned first aspect or any possible implementation thereof.
第七方面,本申请还提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机实现上述第一方面或其任意可能的实现方式中所述的方法。In a seventh aspect, the present application further provides a computer program product containing instructions, which, when run on a computer, enable the computer to implement the method described in the above first aspect or any possible implementation thereof.
本实施例提供的电子设备、计算机存储介质、计算机程序产品和芯片均用于执行上文所提供的蓝牙连接方法,因此,其所能达到的有益效果可参考上文所提供的蓝牙连接方法中的有益效果,此处不再赘述。The electronic equipment, computer storage media, computer program products and chips provided in this embodiment are all used to implement the Bluetooth connection method provided above, therefore, the beneficial effects that it can achieve can refer to the Bluetooth connection method provided above The beneficial effects will not be repeated here.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without creative effort.
图1为本申请实施例提供的一种电子设备的结构示意图;FIG. 1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
图2为本申请实施例提供的一种电子设备的软件结构示意图;FIG. 2 is a schematic diagram of a software structure of an electronic device provided in an embodiment of the present application;
图3为本申请实施例提供的一种蓝牙连接方法的流程示意图;FIG. 3 is a schematic flow diagram of a Bluetooth connection method provided by an embodiment of the present application;
图4为本申请实施例提供的蓝牙连接的示意图;FIG. 4 is a schematic diagram of a Bluetooth connection provided by an embodiment of the present application;
图5为本申请实施例提供的另一种蓝牙连接方法的流程示意图Fig. 5 is a schematic flow chart of another Bluetooth connection method provided by the embodiment of the present application
图6为本申请实施例提供的又一种蓝牙连接方法的流程示意图;FIG. 6 is a schematic flowchart of another Bluetooth connection method provided by the embodiment of the present application;
图7为本申请实施例提供的一种电子设备的界面示意图;FIG. 7 is a schematic interface diagram of an electronic device provided in an embodiment of the present application;
图8为本申请实施例提供的一种装置的结构示意图;FIG. 8 is a schematic structural diagram of a device provided in an embodiment of the present application;
图9为本申请实施例提供的另一种装置的结构示意图;Fig. 9 is a schematic structural diagram of another device provided by the embodiment of the present application;
图10为本申请实施例提供的一种芯片的结构示意图。FIG. 10 is a schematic structural diagram of a chip provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the application with reference to the drawings in the embodiments of the application. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。The term "and/or" in this article is just an association relationship describing associated objects, which means that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist simultaneously, and there exists alone B these three situations.
本申请的说明书以及附图中的术语“第一”和“第二”等是用于区别不同的对象,或者用于区别对同一对象的不同处理,而不是用于描述对象的特定顺序。The terms "first" and "second" in the specification and drawings of the present application are used to distinguish different objects, or to distinguish different processes for the same object, rather than to describe a specific sequence of objects.
此外,本申请的描述中所提到的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选的还包括其他没有列出的步骤或单元,或可选的还包括对于这些过程、方法、产品或设备固有的其他步骤或单元。In addition, the terms "including" and "having" mentioned in the description of the present application and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include other unlisted steps or units, or may optionally also include Other steps or elements inherent to the process, method, product or apparatus are included.
需要说明的是,本申请实施例的描述中,“示例性地”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性地”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性地”或者“例如”等词旨在以具体方式呈现相关概念。It should be noted that, in the description of the embodiments of the present application, words such as "exemplarily" or "for example" are used as an example, illustration or description. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application shall not be interpreted as being more preferred or more advantageous than other embodiments or design solutions. Rather, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a concrete manner.
在本申请的描述中,除非另有说明,“多个”的含义是指两个或两个以上。In the description of the present application, unless otherwise specified, the meaning of "plurality" refers to two or more.
首先,对本申请中的部分用语进行解释说明,以便于本领域技术人员理解。First of all, some terms used in this application are explained to facilitate the understanding of those skilled in the art.
蓝牙物理链路是蓝牙设备间物理层的数据连接通道,蓝牙设备间可以通过蓝牙物理链路传输数据流。蓝牙物理链路包括但不限于低功耗蓝牙(bluetooth low energy,BLE)和经典蓝牙(basic rate,BR)。The Bluetooth physical link is the data connection channel of the physical layer between Bluetooth devices, and the Bluetooth devices can transmit data streams through the Bluetooth physical link. Bluetooth physical links include, but are not limited to, Bluetooth low energy (bluetooth low energy, BLE) and classic Bluetooth (basic rate, BR).
蓝牙业务链路是蓝牙设备间和蓝牙设备内部业务层的数据连接通道,蓝牙设备间或蓝牙设备内可以通过蓝牙业务链路传输业务数据流。蓝牙业务链路包括但不限于蓝牙音频传输模型协定(advanced audio distribution profile,A2DP)、符合蓝牙免提规范(hands-free profile,HFP)、符合蓝牙手机规范(headset pro-file,HSP)和音视频远程控制规范(audio/video remote control profile,AVRCP)。The Bluetooth service link is a data connection channel between Bluetooth devices and the internal service layer of the Bluetooth device. The service data flow can be transmitted between Bluetooth devices or within the Bluetooth device through the Bluetooth service link. Bluetooth service links include, but are not limited to, Bluetooth audio distribution profile (advanced audio distribution profile, A2DP), Bluetooth hands-free profile (hands-free profile, HFP), Bluetooth mobile phone specification (headset pro-file, HSP) and audio and video Remote control specification (audio/video remote control profile, AVRCP).
本申请实施例提供的蓝牙连接方法可以应用于手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等电子设备上,本申请实施例对电子设备的具体类型不作任何限制。The Bluetooth connection method provided by the embodiment of the present application can be applied to mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (augmented reality, AR)/virtual reality (virtual reality, VR) devices, notebook computers, super mobile personal computers (ultra-mobile personal computer, UMPC), netbook, personal digital assistant (personal digital assistant, PDA) and other electronic devices, the embodiments of the present application do not impose any limitation on the specific types of electronic devices.
示例性地,图1是本申请实施例提供的一例电子设备100的结构示意图。电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universalserial 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等。Exemplarily, FIG. 1 is a schematic structural diagram of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may include a processor 110, an
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or separate certain components, or arrange different components. The illustrated components can be realized in hardware, software or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor ( image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc. . Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。Wherein, the controller may be the nerve center and command center of the electronic device 100 . The controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronousreceiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processorinterface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serialbus,USB)接口等。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver) /transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and/or A universal serial bus (universal serialbus, USB) interface and the like.
其中,I2C接口是一种双向同步串行总线,处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serialinterface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。Wherein, the I2C interface is a bidirectional synchronous serial bus, and the processor 110 can couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to realize the touch function of the electronic device 100 . The MIPI interface can be used to connect the processor 110 with peripheral devices such as the
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules shown in the embodiment of the present application is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 . In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。The
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 realizes the display function through the GPU, the
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emittingdiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrixorganic light emitting diode的,AMOLED),柔性发光二极管(flex light-emittingdiode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot lightemitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The
电子设备100可以通过ISP,摄像头193,触摸传感器、视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize the shooting function through the ISP, the
其中,ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。Wherein, the ISP is used for processing the data fed back by the
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号,应理解,在本申请实施例的描述中,以RGB格式的图像为例进行介绍,本申请实施例对图像格式不做限定。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。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 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in various encoding formats, such as: moving picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, and so on.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。The
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions through the
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。陀螺仪传感器180B可以用于确定电子设备100的运动姿态。气压传感器180C用于测量气压。磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。温度传感器180J用于检测温度。触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。骨传导传感器180M可以获取振动信号。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。The pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal. The
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。SIM卡接口195用于连接SIM卡。The keys 190 include a power key, a volume key and the like. The key 190 may be a mechanical key. It can also be a touch button. The electronic device 100 can receive key input and generate key signal input related to user settings and function control of the electronic device 100 . The motor 191 can generate a vibrating reminder. The motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations applied to different applications (such as taking pictures, playing audio, etc.) may correspond to different vibration feedback effects. The motor 191 may also correspond to different vibration feedback effects for touch operations acting on different areas of the
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 .
图2是本申请实施例的电子设备100的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。FIG. 2 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate through software interfaces. In some embodiments, the Android system is divided into four layers, which are, from top to bottom, the application program layer, the application program framework layer, the Android runtime (Android runtime) and the system library, and the kernel layer.
应用程序层可以包括一系列应用程序包。如图2所示,应用程序包可以包括相机、相册、音乐、设置等应用程序。The application layer can consist of a series of application packages. As shown in FIG. 2, the application package may include application programs such as camera, photo album, music, and settings.
应用程序框架层为应用程序层的应用程序提供应用编程接口(applicationprogramming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,资源管理器,通知管理器等。The application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions. As shown in Figure 2, the application framework layer can include window managers, content providers, view systems, resource managers, notification managers, etc.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。A window manager is used to manage window programs. The window manager can get the size of the display screen, 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 it accessible to applications. Said data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebook, etc.
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. The view system can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,状态栏中显示通知信息可以短暂停留后自动消失,例如用于告知用户下载完成的消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,或者通知管理器还可以发出提示音,例如电子设备振动,指示灯闪烁等。The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages. The notification information displayed in the status bar can disappear automatically after a short stay, such as a message reminder to inform the user that the download is complete. The notification manager can also be a notification that appears on the top status bar of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, text information is prompted in the status bar, or the notification manager can also emit a prompt sound, such as electronic device vibration, indicator light flashing, and the like.
Android runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。Android runtime includes core library and virtual machine. The Android runtime is responsible for the scheduling and management of the Android system. The core library consists of two parts: one part is the function function that the java language needs to call, and the other part is the core library of Android.
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and the application framework layer run in virtual machines. The virtual machine executes the java files of the application program layer and the application program framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(media libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。A system library can include multiple function modules. For example: surface manager (surface manager), media library (media libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of various commonly used audio and video formats, as well as still 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.
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。2D图形引擎是2D绘图的绘图引擎。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing, etc. 2D graphics engine is a drawing engine for 2D drawing.
内核层是硬件和软件之间的层。其中,内核层可以包含硬件驱动模块,例如显示驱动,摄像头驱动、传感器驱动等,应用程序框架层可以调用内核层的硬件驱动模块。The kernel layer is the layer between hardware and software. Wherein, the kernel layer may include hardware driver modules, such as display drivers, camera drivers, sensor drivers, etc., and the application framework layer may call the hardware driver modules of the kernel layer.
为了便于理解,本申请以下实施例将以具有图1和图2所示结构的电子设备为例,介绍电子设备的拍照过程。For ease of understanding, the following embodiments of the present application will take the electronic device with the structure shown in FIG. 1 and FIG. 2 as an example to introduce the photographing process of the electronic device.
以下实施例中所涉及的技术方案均可以在具有上述硬件架构和软件架构的电子设备100中实现。The technical solutions involved in the following embodiments can all be implemented in the electronic device 100 having the above-mentioned hardware architecture and software architecture.
用户在使用手机时,经常会通过手机的蓝牙连接其他设备。如通过手机连接平板电脑进行数据传输,手机通过蓝牙遥控智能家电,手机通过蓝牙连接蓝牙音箱播放音乐等。然而手机在通过蓝牙连接的设备数量达到一定数量时,多个设备会抢占手机的蓝牙链路,导致其他设备将无法再通过蓝牙与手机进行数据交互。如手机通过蓝牙已连接的数量达到7个时,用户操作其他设备通过蓝牙设接该手机时,其他设备的屏幕显示无法加入连接、无法连接该设备或连接失败等文字提示或手机在其他设备的蓝牙列表中显示为不可连接状态。为此本申请实施例提供了一种蓝牙连接方法,能够解决电子设备通过蓝牙连接的设备数量达到一定数量时,其他设备将无法再通过蓝牙与电子设备进行数据交互的问题。When a user uses a mobile phone, he often connects to other devices through the Bluetooth of the mobile phone. For example, the mobile phone is connected to the tablet computer for data transmission, the mobile phone is connected to the smart home appliance through Bluetooth, and the mobile phone is connected to the Bluetooth speaker to play music through Bluetooth. However, when the number of devices connected to the mobile phone through Bluetooth reaches a certain number, multiple devices will seize the Bluetooth link of the mobile phone, so that other devices will no longer be able to exchange data with the mobile phone through Bluetooth. For example, when the number of mobile phones connected via Bluetooth reaches 7, when the user operates other devices to connect to the mobile phone via Bluetooth, the screens of other devices will display text prompts such as unable to join the connection, unable to connect to the device, or connection failure, or the mobile phone is connected to other devices. It is displayed as unconnectable in the Bluetooth list. For this reason, the embodiment of the present application provides a Bluetooth connection method, which can solve the problem that when the number of devices connected to an electronic device through Bluetooth reaches a certain number, other devices will no longer be able to perform data interaction with the electronic device through Bluetooth.
下面结合附图对本申请实施例提供的蓝牙连接方法进行详细说明,如图3所示,本申请实施例提供的蓝牙连接方法包括:The Bluetooth connection method provided by the embodiment of the present application will be described in detail below in conjunction with the accompanying drawings. As shown in Figure 3, the Bluetooth connection method provided by the embodiment of the present application includes:
S301、第一电子设备接收第二电子设备发送的第一蓝牙请求。S301. The first electronic device receives a first Bluetooth request sent by the second electronic device.
其中,第一连接请求用于请求建立第一蓝牙连接。第一蓝牙连接包括蓝牙物理链路连接和蓝牙业务链路连接。Wherein, the first connection request is used for requesting establishment of the first Bluetooth connection. The first Bluetooth connection includes a Bluetooth physical link connection and a Bluetooth service link connection.
示例性地,用户想通过蓝牙耳机(第二电子设备)收听手机(第一电子设备)播放的音乐,用户则通过操作蓝牙耳机向手机发送第一蓝牙请求,相应地手机接收蓝牙耳机发送的第一蓝牙请求。Exemplarily, the user wants to listen to the music played by the mobile phone (the first electronic device) through the Bluetooth headset (the second electronic device), and the user sends the first Bluetooth request to the mobile phone by operating the Bluetooth headset, and the mobile phone receives the first bluetooth request sent by the Bluetooth headset accordingly. A Bluetooth request.
可选地,第一连接请求可以包括第一子连接请求和第二子连接请求。其中,第一子连接请求用于请求建立蓝牙物理链路连接,第二子连接请求用于请求建立蓝牙业务链路连接。例如,第一电子设备可以先接收第二电子设备发送的第一子连接请求,之后接收第二电子设备发送的第二子连接请求。Optionally, the first connection request may include a first sub-connection request and a second sub-connection request. Wherein, the first sub-connection request is used for requesting establishment of a Bluetooth physical link connection, and the second sub-connection request is used for requesting establishment of a Bluetooth service link connection. For example, the first electronic device may first receive the first sub-connection request sent by the second electronic device, and then receive the second sub-connection request sent by the second electronic device.
S302、第一电子设备判断第一目标设备数量是否大于第一阈值?若是,则执行S303;若否,则执行S304。S302. The first electronic device judges whether the number of first target devices is greater than a first threshold? If yes, execute S303; if not, execute S304.
其中,第一目标设备为与第一电子设备建立第一蓝牙连接的设备。Wherein, the first target device is a device that establishes a first Bluetooth connection with the first electronic device.
可选地,第一阈值可以为6。Optionally, the first threshold may be 6.
需要说明的是,第一电子设备的蓝牙物理链路数量有限并且与第一电子设备建立第一蓝牙连接需要占用第一电子设备的蓝牙物理链路,因此第一电子设备在收到第一连接请求需要通过第一目标设备数量和第一阈值大小关系来判断当前是否存在空闲(未占用)的蓝牙物理链路以供建立第一蓝牙连接。It should be noted that the number of Bluetooth physical links of the first electronic device is limited and the establishment of the first Bluetooth connection with the first electronic device needs to occupy the Bluetooth physical link of the first electronic device, so the first electronic device receives the first connection The request needs to determine whether there is currently an idle (unoccupied) Bluetooth physical link for establishing the first Bluetooth connection based on the relationship between the first target device number and the first threshold value.
在不存在空闲蓝牙物理链路(即第一目标设备数量大于第一阈值)的情况下,通过将与第一目标设备中的第二目标设备之间的第一蓝牙连接转换为第二蓝牙连接以释放出蓝牙物理链路供第一电子设备与第二电子设备建立第一蓝牙连接。In the case that there is no idle Bluetooth physical link (that is, the number of the first target device is greater than the first threshold), by converting the first Bluetooth connection with the second target device in the first target device into a second Bluetooth connection The Bluetooth physical link is released for the first electronic device to establish a first Bluetooth connection with the second electronic device.
在存在空闲蓝牙物理链路(即第一目标设备数量未大于第一阈值)的情况下,第一电子设备通过空闲蓝牙物理链路第二电子设备建立第一蓝牙连接。If there is an idle Bluetooth physical link (that is, the number of first target devices is not greater than the first threshold), the first electronic device establishes a first Bluetooth connection through the second electronic device through the idle Bluetooth physical link.
示例性地,第一电子设备可以通过协议栈判断第一目标设备数量是否大于6个?若是,则执行S303;若否,则执行S304。即第一电子设备在第一目标设备数量为0、1、2、3、4、5、6时执行S303,在第一目标设备数量为其余数值时执行S304。Exemplarily, the first electronic device may determine whether the number of the first target devices is greater than 6 through the protocol stack. If yes, execute S303; if not, execute S304. That is, the first electronic device executes S303 when the number of first target devices is 0, 1, 2, 3, 4, 5, and 6, and executes S304 when the number of first target devices is other values.
在一种可能的实现方式中,第一设备也可以判断可连接设备数量是否小于第二阈值,若是,则执行S303,若否,则执行S304。In a possible implementation manner, the first device may also determine whether the number of connectable devices is smaller than the second threshold, and if yes, perform S303, and if not, perform S304.
示例性地,第一电子设备可以通过协议栈判断可连接设备数量是否小于1?若是,则执行S303;若否,则执行S304。即第一电子设备在可连接设备数量为0时执行S303,在可连接设备数量为不为0时执行S304。Exemplarily, the first electronic device can determine whether the number of connectable devices is less than 1 through the protocol stack. If yes, execute S303; if not, execute S304. That is, the first electronic device executes S303 when the number of connectable devices is 0, and executes S304 when the number of connectable devices is not 0.
在另一种可能的实现方式中,第一电子设备可以判断当前可用通道数(即当前可用物理通道数或当前空闲通道数)是否为0?若是,则执行S303,若否,则执行S304。In another possible implementation manner, the first electronic device may determine whether the number of currently available channels (that is, the number of currently available physical channels or the number of current idle channels) is 0? If yes, execute S303; if not, execute S304.
在又一种可能的实现方式中,第一电子设备也可以判断当前已占用通道数大于第四阈值?若是,则执行S303,若否,则执行S304。其中,第四阈值可以为6。In yet another possible implementation manner, the first electronic device may also determine that the number of currently occupied channels is greater than the fourth threshold? If yes, execute S303; if not, execute S304. Wherein, the fourth threshold may be 6.
S303、第一电子设备将与第二目标设备之间的第一蓝牙连接转换为第二蓝牙连接。S303. The first electronic device converts the first Bluetooth connection with the second target device into a second Bluetooth connection.
其中,第一目标设备包括第二目标设备,第二蓝牙连接包括蓝牙业务链路连接。Wherein, the first target device includes a second target device, and the second Bluetooth connection includes a Bluetooth service link connection.
示例性地,第一电子设备可以向第二目标设备发送蓝牙低功耗(bluetooth lowenergy,BLE)广播包指示第二目标设备将当前的第一蓝牙连接转换为第二蓝牙连接。Exemplarily, the first electronic device may send a Bluetooth low energy (bluetooth low energy, BLE) broadcast packet to the second target device, instructing the second target device to convert the current first Bluetooth connection to the second Bluetooth connection.
可选地,第一电子设备和第二目标设备建立第二蓝牙连接后,第一电子设备和第二目标设备可以通过Ble广播同步状态和消息。Optionally, after the first electronic device and the second target device establish the second Bluetooth connection, the first electronic device and the second target device may broadcast synchronization status and messages through Ble.
在一种可能的实现方式中,将与第二目标设备之间的第一蓝牙连接转换为第二蓝牙连接,可以包括:首先从第一目标设备中确定第二目标设备;然后断开与第二目标设备之间的蓝牙物理链路连接。其中,第二目标设备可以为第一目标设备中空闲时长(即空闲时间或业务空闲时间)最长的第一目标设备或第一目标设备中业务优先级最低的第一目标设备,空闲时长为与第一电子设备上次进行蓝牙业务交互的时刻和当前时刻之间的时长(例如,与第一电子设备上次进行蓝牙业务交互的时刻14:50:00,当前时刻为14:53:00,则空闲时长为00:03:00)。In a possible implementation manner, converting the first Bluetooth connection with the second target device to the second Bluetooth connection may include: first determining the second target device from the first target device; Bluetooth physical link connection between two target devices. Wherein, the second target device may be the first target device with the longest idle time (i.e. idle time or service idle time) among the first target devices or the first target device with the lowest service priority among the first target devices, and the idle time is The length of time between the last Bluetooth service interaction with the first electronic device and the current time (for example, the last Bluetooth service interaction with the first electronic device is 14:50:00, and the current time is 14:53:00 , the idle duration is 00:03:00).
在另一种可能的实现方式中,将与第二目标设备之间的第一蓝牙连接转换为第二蓝牙连接,可以包括:首先从第一目标设备中确定第二目标设备;然后断开与第二目标设备之间的蓝牙物理链路连接并保留与第二目标设备之间的蓝牙业务链路连接。In another possible implementation manner, converting the first Bluetooth connection with the second target device to the second Bluetooth connection may include: first determining the second target device from the first target device; The Bluetooth physical link between the second target devices is connected and the Bluetooth service link connection with the second target device is reserved.
需要说明的是,第一电子设备从第一目标设备中确定第二目标设备的具体方法可以采用本领域技术人员能够想到的任何一种方法进行处理,本申请实施例对此不做具体限定。It should be noted that the specific method for the first electronic device to determine the second target device from the first target device may be processed by any method conceivable by those skilled in the art, which is not specifically limited in this embodiment of the present application.
例如,第一电子设备可以将第一目标设备中空闲时长(即空闲时间或业务空闲时间)最长的第一目标设备确定为第二目标设备。空闲时长为与第一电子设备上次进行蓝牙业务交互的时刻和当前时刻之间的时长(如第一目标设备与第一电子设备上次进行蓝牙业务(不包括保活业务)交互的时刻14:50:00,当前时刻为14:53:00,则空闲时长为00:03:00)。For example, the first electronic device may determine the first target device with the longest idle time (ie idle time or business idle time) among the first target devices as the second target device. The idle time is the time between the time when the Bluetooth service was last interacted with the first electronic device and the current time (for example, the time when the first target device interacted with the first electronic device for the Bluetooth service (excluding the keep-alive service) last time 14 :50:00, the current time is 14:53:00, then the idle time is 00:03:00).
又例如,第一电子设备可以将第一目标设备中业务优先级最低的第一目标设备确定为第二目标设备。For another example, the first electronic device may determine the first target device with the lowest service priority among the first target devices as the second target device.
又例如,第一电子设备可以根据第一目标设备的各种参数(如连接次数、连接时长、业务优先级等)确定第一目标设备的评分,然后将第一目标设备中评分最低的第一目标设备确定为第二目标设备。For another example, the first electronic device may determine the score of the first target device according to various parameters of the first target device (such as the number of connections, connection duration, business priority, etc.), and then assign the first target device with the lowest score among the first target devices. The target device is determined to be the second target device.
示例性地,第一电子设备可以按照第一目标设备的空闲时长由小到大的顺序得到如表1所示的优先队列表,然后将优先队列表中的空闲时长最大的第一目标设备(即设备7)确定为第二目标设备,之后断开与设备7之间的蓝牙物理链路连接。Exemplarily, the first electronic device can obtain the priority queue table shown in Table 1 according to the order of the idle time of the first target device from small to large, and then assign the first target device ( That is, the device 7) is determined as the second target device, and then the Bluetooth physical link connection with the device 7 is disconnected.
表1Table 1
在一种可能的实现方式中,从第一目标设备中确定第二目标设备,可以包括:从第一目标设备中确定第三目标设备,第三目标设备为支持第二蓝牙连接的设备;从第三目标设备中确定第二目标设备。其中,第二目标设备可以为第三目标设备中空闲时长最长的第三目标设备或第三目标设备中业务优先级最低的第三目标设备。In a possible implementation manner, determining the second target device from the first target device may include: determining a third target device from the first target device, where the third target device is a device that supports the second Bluetooth connection; The second target device is determined in the third target device. Wherein, the second target device may be the third target device with the longest idle time among the third target devices or the third target device with the lowest service priority among the third target devices.
需要说明的是,第一电子设备从第一目标设备中确定第三目标设备的具体方法可以采用本领域技术人员能够想到的任何一种方法进行处理,本申请实施例对此不做具体限定。It should be noted that the specific method for the first electronic device to determine the third target device from the first target device may be processed by any method conceivable by those skilled in the art, which is not specifically limited in this embodiment of the present application.
例如,第一电子设备可以根据第一目标设备的型号、品牌等参数确定第一目标设备是否支持第二蓝牙连接。For example, the first electronic device may determine whether the first target device supports the second Bluetooth connection according to parameters such as the model and brand of the first target device.
又例如,第一电子设备可以向第一目标设备发送用于测试设备是否支持第二蓝牙连接的测试信令以确定第一目标设备是否支持第二蓝牙连接。For another example, the first electronic device may send a test signaling for testing whether the device supports the second Bluetooth connection to the first target device to determine whether the first target device supports the second Bluetooth connection.
相较于现有技术中,电子设备在通过蓝牙物理链路已连接的设备数量大于一定数量的情况下,由于蓝牙物理链路均被占用,电子设备无法提供空闲蓝牙物理链路建立新的蓝牙连接,因此电子设备会拒绝后续收到的蓝牙连接请求并通知连接发起方连接失败。而在本申请实施例提供的蓝牙连接方法中,第一电子设备在通过蓝牙物理链路已连接的设备数量大于第一阈值的情况下,后续收到第二电子设备发送的蓝牙连接请求后,会通过将通过蓝牙物理链路已连接的第二目标设备的蓝牙业务链路保留并将蓝牙物理链路断开由此释放出了可供第一电子设备和第二电子设备建立蓝牙连接的蓝牙物理链路。第二目标设备的业务保持状态同步,由此解决了电子设备通过蓝牙连接的设备数量达到一定数量时,其他设备将无法再通过蓝牙与电子设备进行数据交互的问题,提升了用户体验。Compared with the prior art, when the number of devices connected to the electronic device through the Bluetooth physical link is greater than a certain number, since the Bluetooth physical link is occupied, the electronic device cannot provide an idle Bluetooth physical link to establish a new Bluetooth connection. connection, so the electronic device will reject subsequent received Bluetooth connection requests and notify the connection initiator that the connection failed. However, in the Bluetooth connection method provided by the embodiment of the present application, when the number of connected devices through the Bluetooth physical link is greater than the first threshold, the first electronic device subsequently receives the Bluetooth connection request sent by the second electronic device, By reserving the Bluetooth service link of the second target device connected through the Bluetooth physical link and disconnecting the Bluetooth physical link, the Bluetooth connection for the first electronic device and the second electronic device to establish a Bluetooth connection is released. physical link. The service status of the second target device is kept synchronized, thereby solving the problem that when the number of devices connected to the electronic device through Bluetooth reaches a certain number, other devices will no longer be able to perform data interaction with the electronic device through Bluetooth, thereby improving user experience.
S304、第一电子设备与第二电子设备建立第一蓝牙连接。S304. The first electronic device establishes a first Bluetooth connection with the second electronic device.
在一种可能的实现方式中,若存在目标业务,第一电子设备则向第二目标设备发送第一指示。其中,目标业务为与第二目标设备相关的蓝牙业务,第一指示用于指示第二目标设备与第一电子设备建立蓝牙物理链路连接。In a possible implementation manner, if there is a target service, the first electronic device sends the first indication to the second target device. Wherein, the target service is a Bluetooth service related to the second target device, and the first indication is used to instruct the second target device to establish a Bluetooth physical link connection with the first electronic device.
在另一种可能的实现方式中,若存在目标业务,第一电子设备也可以向第二目标设备发送第二蓝牙连接请求。其中,第二蓝牙请求用于请求建立蓝牙物理链路。In another possible implementation manner, if there is a target service, the first electronic device may also send a second Bluetooth connection request to the second target device. Wherein, the second Bluetooth request is used to request to establish a Bluetooth physical link.
如图4中(a)所示,第一蓝牙连接包括蓝牙物理链路连接和蓝牙业务链路连接。设备的上层业务可以通过蓝牙业务链路与本设备的蓝牙物理链路端口交互业务数据流,设备的蓝牙物理链路端口通过蓝牙物理链路和对端设备的蓝牙物理链路端口业务数据流。如图4中(b)所示,在断开设备1和设备2之间的蓝牙物理链路连接且保留蓝牙业务链路连接的情况下,由于保留了蓝牙业务链路连接,设备1或设备2的上层业务依旧可以通过蓝牙业务链路向本设备的蓝牙物理链路端口交互业务数据流。因此,第一电子设备在将与第二目标设备之间的第一蓝牙连接转换为第二蓝牙连接后,第一电子设备的上层业务依旧可以通过蓝牙业务链路与第一电子设备的蓝牙物理链路端口交互目标业务(即与第二目标设备相关的蓝牙业务的业务数据流),而第一电子设备可以通过第一电子设备的蓝牙物理链路端口判断是否存在目标业务,若存在目标业务,则需要建立蓝牙物理链路以传输目标业务的数据流。因此,在存在目标业务的情况下,第一电子设备则向第二目标设备发送用于指示第二目标设备与第一电子设备建立蓝牙物理链路连接的第一指示,指示第二目标设备向第一电子设备发送第一蓝牙请求以建立第一电子设备与第二目标设备之间的第一蓝牙连接。当然,在存在目标业务的情况下,第一电子设备也可以直接向第二目标设备发送第一蓝牙请求以建立第一电子设备与第二目标设备之间的第一蓝牙连接。As shown in (a) of FIG. 4 , the first Bluetooth connection includes a Bluetooth physical link connection and a Bluetooth service link connection. The upper-layer business of the device can exchange service data flow with the Bluetooth physical link port of the device through the Bluetooth service link, and the Bluetooth physical link port of the device passes the Bluetooth physical link and the Bluetooth physical link port service data flow of the peer device. As shown in (b) in Figure 4, when the Bluetooth physical link connection between device 1 and device 2 is disconnected and the Bluetooth service link connection is reserved, since the Bluetooth service link connection is reserved, device 1 or device 2 2's upper-layer services can still exchange service data streams to the Bluetooth physical link port of the device through the Bluetooth service link. Therefore, after the first electronic device converts the first Bluetooth connection with the second target device into the second Bluetooth connection, the upper-layer services of the first electronic device can still communicate with the Bluetooth physical connection of the first electronic device through the Bluetooth service link. The link port exchanges target services (that is, the service data flow of the Bluetooth service related to the second target device), and the first electronic device can judge whether there is a target service through the Bluetooth physical link port of the first electronic device, and if there is a target service , it is necessary to establish a Bluetooth physical link to transmit the data stream of the target service. Therefore, when there is a target service, the first electronic device sends to the second target device a first indication for instructing the second target device to establish a Bluetooth physical link connection with the first electronic device, and instructs the second target device to The first electronic device sends a first Bluetooth request to establish a first Bluetooth connection between the first electronic device and the second target device. Certainly, in the case that the target service exists, the first electronic device may also directly send the first Bluetooth request to the second target device to establish the first Bluetooth connection between the first electronic device and the second target device.
需要说明的是,第一电子设备则向第二目标设备发送第一指示的具体方法可以采用本领域技术人员能够想到的任何一种方法进行处理,本申请实施例对此不做具体限定。It should be noted that the specific method for the first electronic device to send the first indication to the second target device may be processed by any method conceivable by those skilled in the art, which is not specifically limited in this embodiment of the present application.
例如,在存在目标业务的情况下,第一电子设备可以通过Ble广播向第二目标设备发送用于指示第二目标设备与第一电子设备建立蓝牙物理链路连接的第一指示,指示第二目标设备向第一电子设备发送第一蓝牙请求以建立第一电子设备与第二目标设备之间的第一蓝牙连接。For example, when there is a target service, the first electronic device may send a first indication for instructing the second target device to establish a Bluetooth physical link connection with the first electronic device to the second target device through a Ble broadcast, indicating that the second The target device sends a first Bluetooth request to the first electronic device to establish a first Bluetooth connection between the first electronic device and the second target device.
可以理解的是,第二目标设备的也可以通过第二目标设备的蓝牙物理链路端口判断是否存在目标业务,在存在目标业务的情况下,向第一电子设备发送用于指示第一电子设备与第二目标设备建立蓝牙物理链路连接的第二指示,指示第一电子设备向第一电子设备发送第一蓝牙请求以建立第一电子设备与第二目标设备之间的第一蓝牙连接,或者,在存在目标业务的情况下,第二目标设备也可以直接向第一电子设备发送第一蓝牙请求以建立第一电子设备与第二目标设备之间的第一蓝牙连接。It can be understood that the second target device can also judge whether there is a target service through the Bluetooth physical link port of the second target device, and if there is a target service, send a message indicating to the first electronic device to the first electronic device Establishing a second indication of a Bluetooth physical link connection with the second target device, instructing the first electronic device to send a first Bluetooth request to the first electronic device to establish a first Bluetooth connection between the first electronic device and the second target device, Alternatively, if there is a target service, the second target device may also directly send a first Bluetooth request to the first electronic device to establish a first Bluetooth connection between the first electronic device and the second target device.
用户在使用手机时,经常会通过手机的蓝牙连接其他设备。然而手机在通过蓝牙连接的设备数量达到一定数量时,多个设备会抢占手机的蓝牙链路,导致其他设备将无法再通过蓝牙与手机进行数据交互。如手机通过蓝牙已连接的数量达到7个时,用户操作其他设备通过蓝牙设接该手机时,其他设备的屏幕显示无法加入连接、无法连接该设备或连接失败等文字提示或手机在其他设备的蓝牙列表中显示为不可连接状态。为此本申请实施例提供了另一种蓝牙连接方法,能够解决电子设备通过蓝牙连接的设备数量达到一定数量时,其他设备将无法再通过蓝牙与电子设备进行数据交互的问题。When a user uses a mobile phone, he often connects to other devices through the Bluetooth of the mobile phone. However, when the number of devices connected to the mobile phone through Bluetooth reaches a certain number, multiple devices will seize the Bluetooth link of the mobile phone, so that other devices will no longer be able to exchange data with the mobile phone through Bluetooth. For example, when the number of mobile phones connected via Bluetooth reaches 7, when the user operates other devices to connect to the mobile phone via Bluetooth, the screens of other devices will display text prompts such as unable to join the connection, unable to connect to the device, or connection failure, or the mobile phone is connected to other devices. It is displayed as unconnectable in the Bluetooth list. For this reason, the embodiment of the present application provides another Bluetooth connection method, which can solve the problem that when the number of devices connected to an electronic device through Bluetooth reaches a certain number, other devices will no longer be able to perform data interaction with the electronic device through Bluetooth.
下面结合附图对本申请实施例提供的另一种蓝牙连接方法进行详细说明,如图5所示,本申请实施例提供的另一种蓝牙连接方法包括:Another Bluetooth connection method provided by the embodiment of the present application will be described in detail below in conjunction with the accompanying drawings. As shown in Figure 5, another Bluetooth connection method provided by the embodiment of the present application includes:
S501、第一电子设备接收第二电子设备发送的第一蓝牙请求。S501. The first electronic device receives a first Bluetooth request sent by the second electronic device.
其中,第一连接请求用于请求建立第一蓝牙连接。第一蓝牙连接包括蓝牙物理链路连接和蓝牙业务链路连接。Wherein, the first connection request is used for requesting establishment of the first Bluetooth connection. The first Bluetooth connection includes a Bluetooth physical link connection and a Bluetooth service link connection.
示例性地,用户想通过手机(第二电子设备)的蓝牙连接空调的蓝牙以调节空调的温度,用户则通过操作手机向空调发送第一蓝牙请求,相应地空调接收发送的第一蓝牙请求。Exemplarily, the user wants to connect the Bluetooth of the air conditioner through the Bluetooth of the mobile phone (second electronic device) to adjust the temperature of the air conditioner, and the user sends a first Bluetooth request to the air conditioner by operating the mobile phone, and the air conditioner receives the sent first Bluetooth request accordingly.
可选地,第一连接请求可以包括第一子连接请求和第二子连接请求。其中,第一子连接请求用于请求建立蓝牙物理链路连接,第二子连接请求用于请求建立蓝牙业务链路连接。例如,第一电子设备可以先接收第二电子设备发送的第一子连接请求,之后接收第二电子设备发送的第二子连接请求。Optionally, the first connection request may include a first sub-connection request and a second sub-connection request. Wherein, the first sub-connection request is used for requesting establishment of a Bluetooth physical link connection, and the second sub-connection request is used for requesting establishment of a Bluetooth service link connection. For example, the first electronic device may first receive the first sub-connection request sent by the second electronic device, and then receive the second sub-connection request sent by the second electronic device.
S502、第一电子设备判断第一目标设备数量是否大于第一阈值?若是,则执行S503;若否,则执行S504。S502. The first electronic device judges whether the number of first target devices is greater than a first threshold? If yes, execute S503; if not, execute S504.
其中,第一目标设备为与第一电子设备建立第一蓝牙连接的设备。Wherein, the first target device is a device that establishes a first Bluetooth connection with the first electronic device.
可选地,第一阈值可以为6。Optionally, the first threshold may be 6.
需要说明的是,第一电子设备的蓝牙物理链路数量有限并且与第一电子设备建立第一蓝牙连接需要占用第一电子设备的蓝牙物理链路,因此第一电子设备在收到第一连接请求需要通过第一目标设备数量和第一阈值大小关系来判断当前是否存在空闲(未占用)的蓝牙物理链路以供建立第一蓝牙连接。It should be noted that the number of Bluetooth physical links of the first electronic device is limited and the establishment of the first Bluetooth connection with the first electronic device needs to occupy the Bluetooth physical link of the first electronic device, so the first electronic device receives the first connection The request needs to determine whether there is currently an idle (unoccupied) Bluetooth physical link for establishing the first Bluetooth connection based on the relationship between the first target device number and the first threshold value.
在不存在空闲蓝牙物理链路(即第一目标设备数量大于第一阈值)的情况下,通过指示第二目标设备连接已与第一电子设备建立第一蓝牙连接的第四目标设备,使第二目标设备通过第四目标设备作为中继代理与第一电子设备建立第一蓝牙连接。这样第二电子设备和第四目标设备共用一条蓝牙物理链路与第一电子设备建立第一蓝牙连接,无需额外的蓝牙物理链路,一条蓝牙物理链路可供多个设备通过蓝牙连接第一电子设备,由此解决了电子设备通过蓝牙连接的设备数量达到一定数量时,其他设备将无法再通过蓝牙与电子设备进行数据交互的问题,提升了用户体验。When there is no idle Bluetooth physical link (that is, the number of the first target device is greater than the first threshold), the second target device is instructed to connect to the fourth target device that has established the first Bluetooth connection with the first electronic device, so that the second target device The second target device establishes a first Bluetooth connection with the first electronic device through the fourth target device as a relay agent. In this way, the second electronic device and the fourth target device share a bluetooth physical link to establish the first bluetooth connection with the first electronic device, no additional bluetooth physical link is needed, and one bluetooth physical link can be used by multiple devices to connect to the first bluetooth connection through bluetooth The electronic device thus solves the problem that when the number of devices connected to the electronic device through Bluetooth reaches a certain number, other devices will no longer be able to perform data interaction with the electronic device through Bluetooth, which improves the user experience.
在存在空闲蓝牙物理链路(即第一目标设备数量未大于第一阈值)的情况下,第一电子设备通过空闲蓝牙物理链路第二电子设备建立第一蓝牙连接。If there is an idle Bluetooth physical link (that is, the number of first target devices is not greater than the first threshold), the first electronic device establishes a first Bluetooth connection through the second electronic device through the idle Bluetooth physical link.
示例性地,第一电子设备可以通过协议栈判断第一目标设备数量是否大于6个?若是,则执行S503;若否,则执行S504。即第一电子设备在第一目标设备数量为0、1、2、3、4、5、6时执行S503,在第一目标设备数量为其余数值时执行S504。Exemplarily, the first electronic device may determine whether the number of the first target devices is greater than 6 through the protocol stack. If yes, execute S503; if not, execute S504. That is, the first electronic device executes S503 when the number of first target devices is 0, 1, 2, 3, 4, 5, and 6, and executes S504 when the number of first target devices is other values.
在一种可能的实现方式中,第一设备也可以判断可连接设备数量是否小于第二阈值,若是,则执行S503,若否,则执行S504。In a possible implementation manner, the first device may also determine whether the number of connectable devices is smaller than the second threshold, and if yes, perform S503, and if not, perform S504.
示例性地,第一电子设备可以通过协议栈判断可连接设备数量是否小于1?若是,则执行S503;若否,则执行S504。即第一电子设备在可连接设备数量为0时执行S503,在可连接设备数量为不为0时执行S504。Exemplarily, the first electronic device can determine whether the number of connectable devices is less than 1 through the protocol stack. If yes, execute S503; if not, execute S504. That is, the first electronic device executes S503 when the number of connectable devices is 0, and executes S504 when the number of connectable devices is not 0.
在一种可能的实现方式中,第一电子设备可以判断当前可用通道数(即当前可用物理通道数或当前空闲通道数)是否为0?若是,则执行S503,若否,则执行S50。In a possible implementation manner, the first electronic device may determine whether the number of currently available channels (that is, the number of currently available physical channels or the number of current idle channels) is 0? If yes, execute S503; if not, execute S50.
在另一种可能的实现方式中,第一电子设备也可以判断当前已占用通道数大于第四阈值?若是,则执行S503,若否,则执行S504。其中,第四阈值可以为6。In another possible implementation manner, the first electronic device may also determine that the number of currently occupied channels is greater than the fourth threshold? If yes, execute S503; if not, execute S504. Wherein, the fourth threshold may be 6.
S503、第一电子设备向第二电子设备发送第二指示以指示第二电子设备通过第一目标设备中的第四目标设备与第一电子设备建立第一蓝牙连接。S503. The first electronic device sends a second instruction to the second electronic device to instruct the second electronic device to establish a first Bluetooth connection with the first electronic device through a fourth target device in the first target device.
在一种可能的实现方式中,第一电子设备向第二电子设备发送第二指示,可以包括:第一电子设备先从所述第一目标设备中确定第四目标设备,之后向第二电子设备发送第二指示。In a possible implementation manner, the first electronic device sending the second indication to the second electronic device may include: the first electronic device first determines the fourth target device from the first target device, and then sends the second electronic device The device sends a second indication.
需要说明的是,第一电子设备先从第一目标设备中确定第四目标设备的具体方法可以采用本领域技术人员能够想到的任何一种方法进行处理,本申请实施例对此不做具体限定。It should be noted that the specific method for the first electronic device to first determine the fourth target device from the first target device can be processed by any method conceivable by those skilled in the art, which is not specifically limited in this embodiment of the present application. .
例如,第一电子设备可以先获取每个第一目标设备的已连接设备数量(通过蓝牙已连接设备数量),然后将第一目标设备中已连接设备数量最少的设备确定为第四目标设备。For example, the first electronic device may first obtain the number of connected devices of each first target device (the number of connected devices via Bluetooth), and then determine the device with the smallest number of connected devices among the first target devices as the fourth target device.
示例性地,第一电子设备可以通过向每个第一目标设备发送获取指令以获取每个第一目标设备的已连接设备数量,然后按照第一目标设备的已连接设备数量由小到大的顺序得到如表2所示的第一目标设备信息表,之后将表2中已连接设备数量的第一目标设备(即设备4)确定为第四目标设备。当然,第一电子设备也可以将已连接设备数小于第一阈值的任一第一目标设备确定为第四目标设备。Exemplarily, the first electronic device may acquire the number of connected devices of each first target device by sending an acquisition instruction to each first target device, and then obtain the number of connected devices of each first target device according to the number of connected devices of the first target device The first target device information table shown in Table 2 is sequentially obtained, and then the first target device (ie, device 4 ) of the number of connected devices in Table 2 is determined as the fourth target device. Of course, the first electronic device may also determine any first target device whose number of connected devices is less than the first threshold as the fourth target device.
表2Table 2
可选地,用于获取已连接设备数量的获取指示可以为hiecho指令。表3示出了hiech o指令的格式,如表3所示,hiecho指令的command id字段可用于添加定义指令类型,hiecho指令的payload字段可用于存放数据。Optionally, the obtaining instruction for obtaining the number of connected devices may be a hiecho instruction. Table 3 shows the format of the hiech o command. As shown in Table 3, the command id field of the hiecho command can be used to add and define the command type, and the payload field of the hiecho command can be used to store data.
表3table 3
在一种可能的实现方式中,第一电子设备也可以向第四目标设备发送第三指示以指示第四目标设备作为中继代理与第二电子设备建立第一蓝牙连接。In a possible implementation manner, the first electronic device may also send a third indication to the fourth target device to instruct the fourth target device to establish the first Bluetooth connection with the second electronic device as a relay agent.
相较于现有技术中,电子设备在通过蓝牙物理链路已连接的设备数量大于一定数量的情况下,由于蓝牙物理链路均被占用,电子设备无法提供空闲蓝牙物理链路建立新的蓝牙连接,因此电子设备会拒绝后续收到的蓝牙连接请求并通知连接发起方连接失败。而在本申请实施例提供的蓝牙连接方法中,第一电子设备在通过蓝牙物理链路已连接的设备数量大于第一阈值的情况下,后续收到第二电子设备发送的蓝牙连接请求后,会通过指示第二目标设备连接已与第一电子设备建立第一蓝牙连接的第四目标设备,使第二目标设备通过第四目标设备作为中继代理与第一电子设备建立第一蓝牙连接。这样第二电子设备和第四目标设备共用一条蓝牙物理链路与第一电子设备建立第一蓝牙连接,无需额外的蓝牙物理链路,一条蓝牙物理链路可供多个设备通过蓝牙连接第一电子设备,由此解决了电子设备通过蓝牙连接的设备数量达到一定数量时,其他设备将无法再通过蓝牙与电子设备进行数据交互的问题,提升了用户体验。Compared with the prior art, when the number of devices connected to the electronic device through the Bluetooth physical link is greater than a certain number, since the Bluetooth physical link is occupied, the electronic device cannot provide an idle Bluetooth physical link to establish a new Bluetooth connection. connection, so the electronic device will reject subsequent received Bluetooth connection requests and notify the connection initiator that the connection failed. However, in the Bluetooth connection method provided by the embodiment of the present application, when the number of connected devices through the Bluetooth physical link is greater than the first threshold, the first electronic device subsequently receives the Bluetooth connection request sent by the second electronic device, Instructing the second target device to connect to the fourth target device that has established the first Bluetooth connection with the first electronic device, so that the second target device establishes the first Bluetooth connection with the first electronic device through the fourth target device as a relay agent. In this way, the second electronic device and the fourth target device share a bluetooth physical link to establish the first bluetooth connection with the first electronic device, no additional bluetooth physical link is needed, and one bluetooth physical link can be used by multiple devices to connect to the first bluetooth connection through bluetooth The electronic device thus solves the problem that when the number of devices connected to the electronic device through Bluetooth reaches a certain number, other devices will no longer be able to perform data interaction with the electronic device through Bluetooth, which improves the user experience.
需要说明的是,蓝牙协议支持在同一个蓝牙物理链路上通过不同的DLC进行不同的业务交互,因此第二电子设备和第四目标设备可以通过不同的DLC使用同一个蓝牙物理链路与第一电子设备进行业务交互。It should be noted that the Bluetooth protocol supports different service interactions through different DLCs on the same Bluetooth physical link, so the second electronic device and the fourth target device can use the same Bluetooth physical link and the fourth target device through different DLCs. An electronic device performs service interaction.
例如,第一电子设备向第二电子设备发送业务数据流,则第一电子设备可以获取各第一目标设备已连接设备的信息,然后得到如表4所示的已连接设备信息表,然后根据已连接设备信息表确定第二电子设备所使用的DLC为B_4,然后向第四目标设备发送DLC为B_4的业务数据流,第四目标设备在收到业务数据流后根据业务数据流的DLC或业务数据流的MAC和DLC查询表4确定该数据流的DLC并不是第一电子设备和第四目标设备之间交互所使用的A_B,而是第一电子设备与第二电子设备所使用的B_4,然后将该数据流通过第四目标设备与第二电子设备之间的蓝牙物理链路传输至第二电子设备。For example, if the first electronic device sends a service data stream to the second electronic device, the first electronic device can obtain the information of the connected devices of each first target device, and then obtain the connected device information table shown in Table 4, and then according to The connected device information table determines that the DLC used by the second electronic device is B_4, and then sends the service data stream with the DLC of B_4 to the fourth target device, and the fourth target device receives the service data stream according to the DLC or DLC of the service data stream. The MAC and DLC lookup table 4 of the service data flow determines that the DLC of the data flow is not A_B used for interaction between the first electronic device and the fourth target device, but B_4 used by the first electronic device and the second electronic device , and then transmit the data stream to the second electronic device through the Bluetooth physical link between the fourth target device and the second electronic device.
表4Table 4
可以理解的是,第一电子设备在收到第四目标设备发送的业务数据流后,也可以通过业务数据流的DLC或业务数据流的MAC和DLC查询表4确定该数据流的发送方。It can be understood that, after receiving the service data flow sent by the fourth target device, the first electronic device may also determine the sender of the data flow through the DLC of the service data flow or the MAC and DLC lookup table 4 of the service data flow.
用户在使用手机时,经常会通过手机的蓝牙连接其他设备。然而手机在通过蓝牙连接的设备数量达到一定数量时,多个设备会抢占手机的蓝牙链路,导致其他设备将无法再通过蓝牙与手机进行数据交互。如手机通过蓝牙已连接的数量达到7个时,用户操作其他设备通过蓝牙设接该手机时,其他设备的屏幕显示无法加入连接、无法连接该设备或连接失败等文字提示或手机在其他设备的蓝牙列表中显示为不可连接状态。为此本申请实施例提供了又一种蓝牙连接方法,能够解决电子设备通过蓝牙连接的设备数量达到一定数量时,其他设备将无法再通过蓝牙与电子设备进行数据交互的问题。When a user uses a mobile phone, he often connects to other devices through the Bluetooth of the mobile phone. However, when the number of devices connected to the mobile phone through Bluetooth reaches a certain number, multiple devices will seize the Bluetooth link of the mobile phone, so that other devices will no longer be able to exchange data with the mobile phone through Bluetooth. For example, when the number of mobile phones connected via Bluetooth reaches 7, when the user operates other devices to connect to the mobile phone via Bluetooth, the screens of other devices will display text prompts such as unable to join the connection, unable to connect to the device, or connection failure, or the mobile phone is connected to other devices. It is displayed as unconnectable in the Bluetooth list. For this reason, the embodiment of the present application provides another Bluetooth connection method, which can solve the problem that when the number of devices connected to an electronic device through Bluetooth reaches a certain number, other devices will no longer be able to perform data interaction with the electronic device through Bluetooth.
下面结合附图对本申请实施例提供的又一种蓝牙连接方法进行详细说明,如图6所示,本申请实施例提供的又一种蓝牙连接方法包括:Another Bluetooth connection method provided by the embodiment of the present application will be described in detail below in conjunction with the accompanying drawings. As shown in FIG. 6, another Bluetooth connection method provided by the embodiment of the present application includes:
S601、第一电子设备接收第二电子设备发送的第一蓝牙请求。S601. The first electronic device receives a first Bluetooth request sent by the second electronic device.
其中,第一连接请求用于请求建立第一蓝牙连接。第一蓝牙连接包括蓝牙物理链路连接和蓝牙业务链路连接。Wherein, the first connection request is used for requesting establishment of the first Bluetooth connection. The first Bluetooth connection includes a Bluetooth physical link connection and a Bluetooth service link connection.
可选地,第一连接请求可以包括第一子连接请求和第二子连接请求。其中,第一子连接请求用于请求建立蓝牙物理链路连接,第二子连接请求用于请求建立蓝牙业务链路连接。例如,第一电子设备可以先接收第二电子设备发送的第一子连接请求,之后接收第二电子设备发送的第二子连接请求。Optionally, the first connection request may include a first sub-connection request and a second sub-connection request. Wherein, the first sub-connection request is used for requesting establishment of a Bluetooth physical link connection, and the second sub-connection request is used for requesting establishment of a Bluetooth service link connection. For example, the first electronic device may first receive the first sub-connection request sent by the second electronic device, and then receive the second sub-connection request sent by the second electronic device.
S602、第一电子设备判断第一目标设备数量是否大于第一阈值?若是,则执行S603;若否,则执行S605。S602. The first electronic device judges whether the number of first target devices is greater than a first threshold? If yes, execute S603; if not, execute S605.
S603、第一电子设备判断第一目标设备的空闲时长是否均小于第三阈值,若是,则执行S606,若否,则执行S604。S603. The first electronic device judges whether the idle duration of the first target device is less than a third threshold, and if yes, executes S606, and if not, executes S604.
需要说明的是,通过第一目标设备的空闲时长与第三阈值的大小的关系可以判断第一目标设备与第一电子设备之间业务交互是否频繁。当第一目标设备的空闲时长均小于第三阈值说明每个第一目标设备与第一电子设备均频繁进行业务交互,这时如果执行S604将某个第一目标设备的第一蓝牙连接转换为第二蓝牙连接,会影响该第一目标设备与第一电子设备之间的业务交互,而执行S606选取某个第一目标设备作为中继代理即能建立第一电子设备与第二电子设备之间的第一蓝牙蓝牙又不影响该第一目标设备与第一电子设备的业务交互。It should be noted that whether the service interaction between the first target device and the first electronic device is frequent can be determined according to the relationship between the idle duration of the first target device and the magnitude of the third threshold. When the idle duration of the first target device is less than the third threshold, it means that each first target device frequently interacts with the first electronic device. At this time, if S604 is executed to convert the first Bluetooth connection of a first target device The second Bluetooth connection will affect the business interaction between the first target device and the first electronic device, and by executing S606 to select a certain first target device as a relay agent, the relationship between the first electronic device and the second electronic device can be established. The first Bluetooth in between does not affect the service interaction between the first target device and the first electronic device.
当第一目标设备的空闲时长未均小于第三阈值说明第一目标设备中存在与第一电子设备业务交互不频繁的第一目标设备,通过执行S604可以将该第一目标设备的第一蓝牙连接转换为第二蓝牙连接转换以释放出该第一目标设备所占用的蓝牙物理连接供第一电子设备与第二电子设备建立第一蓝牙连接。When the idle duration of the first target device is not less than the third threshold, it means that there is a first target device in the first target device that does not frequently interact with the first electronic device. By performing S604, the first Bluetooth The connection conversion is converted into a second Bluetooth connection conversion to release the Bluetooth physical connection occupied by the first target device for the first electronic device to establish a first Bluetooth connection with the second electronic device.
可以理解的是,在第一目标设备数量是否大于第一阈值的情况下,第一电子设备也可以通过其他判断条件以判断执行S604还是606,本申请实施例对此不作限定。It can be understood that, in the case of whether the number of the first target devices is greater than the first threshold, the first electronic device may also judge whether to execute S604 or 606 through other judgment conditions, which is not limited in this embodiment of the present application.
例如,第一电子设备可以根据第二电子设备的优先级判断执行S604还是606。当第二电子设备的优先级较高(即大于优先级阈值)时,通过执行S604使第二电子设备通过单独的蓝牙物理链路与第一电子设备建立第一蓝牙连接。当第二电子设备的优先级较低(即小于优先级阈值)时,通过执行S606使第二电子设备与第四目标设备共用蓝牙物理链路与第一电子设备建立第一蓝牙连接。For example, the first electronic device may determine whether to perform S604 or S606 according to the priority of the second electronic device. When the priority of the second electronic device is higher (that is, greater than the priority threshold), execute S604 so that the second electronic device establishes a first Bluetooth connection with the first electronic device through a separate Bluetooth physical link. When the priority of the second electronic device is low (that is, less than the priority threshold), execute S606 so that the second electronic device shares the Bluetooth physical link with the fourth target device to establish a first Bluetooth connection with the first electronic device.
又例如,第一电子设备可以根据第二电子设备的信息(如设备类型、连接次数、业务类型、业务优先级等)对第二电子设备进行打分,当得到的分数高于分数阈值时,通过执行S604使第二电子设备通过单独的蓝牙物理链路与第一电子设备建立第一蓝牙连接。当得到的分数低于分数阈值时,通过执行S606使第二电子设备与第四目标设备共用蓝牙物理链路与第一电子设备建立第一蓝牙连接。For another example, the first electronic device may score the second electronic device according to the information of the second electronic device (such as device type, number of connections, service type, service priority, etc.), and when the obtained score is higher than the score threshold, pass Execute S604 to enable the second electronic device to establish a first Bluetooth connection with the first electronic device through a separate Bluetooth physical link. When the obtained score is lower than the score threshold, the second electronic device and the fourth target device share the Bluetooth physical link to establish the first Bluetooth connection with the first electronic device by executing S606.
S604、第一电子设备将与第一目标设备中的第二目标设备之间的第一蓝牙连接转换为第二蓝牙连接。S604. The first electronic device converts the first Bluetooth connection with the second target device in the first target device into a second Bluetooth connection.
S605、第一电子设备与第二电子设备建立第一蓝牙连接。S605. The first electronic device establishes a first Bluetooth connection with the second electronic device.
S606、第一电子设备向第二电子设备发送第二指示以指示第二电子设备通过第一目标设备中的第四目标设备与第一电子设备建立第一蓝牙连接。S606. The first electronic device sends a second instruction to the second electronic device to instruct the second electronic device to establish a first Bluetooth connection with the first electronic device through the fourth target device in the first target device.
在一种可能的实现方式中,第二电子设备通过第一目标设备中的第四目标设备与第一电子设备建立第一蓝牙连接之后,第一电子设备还可以在已连接设备数量小于第一阈值或可连接设备数量大于第二阈值等情况下,向第二电子设备发送第四指示以指示第二电子设备与第四目标设备断开连接并向所述第一电子设备发送第一蓝牙连接请求。In a possible implementation manner, after the second electronic device establishes the first Bluetooth connection with the first electronic device through the fourth target device among the first target devices, the first electronic device may also When the threshold or the number of connectable devices is greater than the second threshold, etc., send a fourth indication to the second electronic device to instruct the second electronic device to disconnect from the fourth target device and send the first Bluetooth connection to the first electronic device ask.
可以理解的是,在第一电子设备存在可用蓝牙物理链路时,将第二电子设备与第一电子设备之间的连接方式由中继代理连接切换为直连可以降低第一电子设备和第二电子设备之间的通信时延,提升第一电子设备和第二电子设备之间的通信速度,从而进一步提升了用户体验。It can be understood that when the first electronic device has an available Bluetooth physical link, switching the connection mode between the second electronic device and the first electronic device from a relay agent connection to a direct connection can reduce the number of connections between the first electronic device and the second electronic device. The communication delay between the two electronic devices improves the communication speed between the first electronic device and the second electronic device, thereby further improving user experience.
在另一种可能的实现方式中,第二电子设备通过第一目标设备中的第四目标设备与第一电子设备建立第一蓝牙连接之后,第一电子设备还可以在第四目标设备当前电量小于第五阈值的情况下,断开与第四目标设备之间的第一蓝牙连接并指示第二电子设备与第一电子设备建立第一蓝牙连接或指示第二电子设备向第一电子设备发送第一蓝牙连接请求。In another possible implementation, after the second electronic device establishes the first Bluetooth connection with the first electronic device through the fourth target device in the first target device, the first electronic device can also check the current battery level of the fourth target device. If it is less than the fifth threshold, disconnect the first Bluetooth connection with the fourth target device and instruct the second electronic device to establish the first Bluetooth connection with the first electronic device or instruct the second electronic device to send The first Bluetooth connection request.
可以理解的是,在第四目标设备电量不足时,第一电子设备指示第二电子设备不再通过第四目标设备连接第一电子设备而是直接与第一电子设备,从而避免了第四目标设备电量不足而关机会造成通过第四目标设备与第一电子设备建立第一蓝牙连接的第二电子设备与第一电子设备断开连接而造成第一电子设备和第二电子设备蓝牙连接中断,进一步提升了用户体验。It can be understood that when the power of the fourth target device is insufficient, the first electronic device instructs the second electronic device not to connect to the first electronic device through the fourth target device but directly to the first electronic device, thereby avoiding the fourth target device. The shutdown of the device due to insufficient power will cause the second electronic device that establishes the first Bluetooth connection with the first electronic device through the fourth target device to be disconnected from the first electronic device, thereby causing the Bluetooth connection between the first electronic device and the second electronic device to be interrupted, Further enhance the user experience.
在又一种可能的实现方式中,第四目标设备因当前电量小于第五阈值而与第一电子设备断开第一蓝牙连接后,第四目标设备进行充电,当第四目标设备的当前电量大于第五阈值时,第一电子设备可以断开与第二电子设备之间的第一蓝牙连接并指示第四目标设备与第一电子设备建立第一蓝牙连接或指示第四目标设备向第一电子设备发送第一蓝牙连接请求,之后向第二电子设备发送第二指示以指示第二电子设备通过第一目标设备中的第四目标设备与第一电子设备建立第一蓝牙连接。In yet another possible implementation, after the fourth target device disconnects the first Bluetooth connection with the first electronic device because the current power level is less than the fifth threshold, the fourth target device charges, and when the current power level of the fourth target device When greater than the fifth threshold, the first electronic device may disconnect the first Bluetooth connection with the second electronic device and instruct the fourth target device to establish the first Bluetooth connection with the first electronic device or instruct the fourth target device to send The electronic device sends a first Bluetooth connection request, and then sends a second instruction to the second electronic device to instruct the second electronic device to establish a first Bluetooth connection with the first electronic device through a fourth target device in the first target device.
在一种可能的实现方式中,第一电子设备还可以根据第五目标设备的连接状态标识已连接设备。其中,第五目标设备为已与所述第一电子设备建立第一蓝牙连接或第二蓝牙连接的设备,不同连接状态的第五目标设备对应不同的标识。In a possible implementation manner, the first electronic device may also identify the connected device according to the connection status of the fifth target device. Wherein, the fifth target device is a device that has established a first Bluetooth connection or a second Bluetooth connection with the first electronic device, and fifth target devices in different connection states correspond to different identifiers.
可选地,上述标识包括文字、颜色或图标中的至少一项。Optionally, the above identification includes at least one of text, color or icon.
需要说明的是,根据第五目标设备的连接状态标识已连接设备的具体方法可以采用本领域技术人员能够想到的任何一种方法进行处理,本申请实施例对此不做具体限定。It should be noted that the specific method for identifying the connected device according to the connection state of the fifth target device may be processed by any method conceivable by those skilled in the art, which is not specifically limited in this embodiment of the present application.
例如,对于直接与第一电子设备建立第一蓝牙连接的设备可以通过蓝牙连接的文字标识,对于与第一电子设备建立第二蓝牙连接的设备可以通过虚拟蓝牙连接的文字标识,对于通过其他设备与第一电子设备建立第一蓝牙连接的设备可以通过中继蓝牙连接或代理蓝牙连接的文字标识。For example, for a device that directly establishes a first Bluetooth connection with the first electronic device, it may use the text identification of the Bluetooth connection; for a device that establishes a second Bluetooth connection with the first electronic device, it may use the text identification of a virtual Bluetooth connection; The device establishing the first Bluetooth connection with the first electronic device may be identified by the text of the relay Bluetooth connection or proxy Bluetooth connection.
又例如,对于直接与第一电子设备建立第一蓝牙连接的设备可以通过蓝色标识,对于与第一电子设备建立第二蓝牙连接的设备可以通过灰色标识对于通过其他设备与第一电子设备建立第一蓝牙连接的设备可以通过白色标识。For another example, the device that directly establishes the first Bluetooth connection with the first electronic device can be identified by blue, the device that establishes the second Bluetooth connection with the first electronic device can be identified by gray, and the device that establishes the first electronic device through other devices The first Bluetooth-connected device can be identified by white.
示例性地,电子设备1~7直接与第一电子设备建立第一蓝牙连接,电子设备8与第一电子设备建立第二蓝牙连接,电子设备9通过电子设备5与第一电子设备建立第一蓝牙连接。图7中(a)图示出了第一电子设备在蓝牙设备列表,如图7中(a)图所示蓝牙设备列表中电子设备1~7通过蓝牙连接的文字进行标识,电子设备8通过虚拟蓝牙连接的文字进行标识,电子设备9通过中继连接的文字进行标识。Exemplarily, electronic devices 1-7 directly establish a first Bluetooth connection with the first electronic device, electronic device 8 establishes a second Bluetooth connection with the first electronic device, and electronic device 9 establishes a first Bluetooth connection with the first electronic device through electronic device 5. Bluetooth connection. (a) in Fig. 7 shows that the first electronic device is in the bluetooth device list, as shown in Fig. The text of the virtual Bluetooth connection is identified, and the electronic device 9 is identified by the text of the relay connection.
又示例性地,电子设备1~7直接与第一电子设备建立第一蓝牙连接,电子设备8与第一电子设备建立第二蓝牙连接,电子设备9通过电子设备5与第一电子设备建立第一蓝牙连接。图7中(b)图示出了第一电子设备在蓝牙设备列表,如图7中(b)图所示蓝牙设备列表中电子设备1~7通过白色进行标识,电子设备8通过灰色进行标识,电子设备9通过黑色进行标识。In another example, electronic devices 1-7 directly establish a first Bluetooth connection with the first electronic device, electronic device 8 establishes a second Bluetooth connection with the first electronic device, and electronic device 9 establishes a second Bluetooth connection with the first electronic device through electronic device 5. A Bluetooth connection. Figure 7 (b) shows the first electronic device in the Bluetooth device list, as shown in Figure 7 (b) in the Bluetooth device list, electronic devices 1 to 7 are identified by white, and electronic device 8 is identified by gray , the electronic device 9 is identified by black.
可以理解的是,通过已连接设备的连接状态标识已连接设备,可以使用户通过已连接设备的标识快速获知已连接设备的连接状态以便于用户后续操作,由此进一步提升了用户体验。It can be understood that identifying the connected device through the connection status of the connected device can enable the user to quickly know the connection status of the connected device through the identification of the connected device to facilitate the user's subsequent operations, thereby further improving the user experience.
下面将结合图8和图9介绍用于执行上述蓝牙连接方法的电子设备。An electronic device for performing the above Bluetooth connection method will be introduced below with reference to FIG. 8 and FIG. 9 .
可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件和/或软件模块。结合本文中所公开的实施例描述的各示例的算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以结合实施例对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。It can be understood that, in order to realize the above functions, the electronic device includes hardware and/or software modules corresponding to each function. Combining the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software drives hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions in combination with the embodiments for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
本申请实施例可以根据上述方法示例对电子设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块可以采用硬件的形式实现。需要说明的是,本实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。The embodiment of the present application may divide the electronic device into functional modules according to the above method example, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The above integrated modules may be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic, and is only a logical function division, and there may be other division methods in actual implementation.
在采用对应各个功能划分各个功能模块的情况下,图8示出了上述实施例中涉及的电子设备的一种可能的组成示意图,如图8所示,该装置800可以包括:收发单元801和处理单元802,该处理单元802可以实现上述方法实施例中由电子设备所执行的方法,和/或用于本文所描述的技术的其他过程。In the case of dividing each functional module corresponding to each function, FIG. 8 shows a possible composition diagram of the electronic device involved in the above embodiment. As shown in FIG. 8 , the apparatus 800 may include: a transceiver unit 801 and A processing unit 802, where the processing unit 802 may implement the method executed by the electronic device in the foregoing method embodiments, and/or other processes used in the technologies described herein.
需要说明的是,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。It should be noted that all relevant content of the steps involved in the above method embodiments can be referred to the function description of the corresponding function module, and will not be repeated here.
在采用集成的单元的情况下,装置800可以包括处理单元、存储单元和通信单元。其中,处理单元可以用于对装置800的动作进行控制管理,例如,可以用于支持装置800执行上述各个单元执行的步骤。存储单元可以用于支持装置800执行存储程序代码、和/或数据等。通信单元可以用于支持装置800与其他设备的通信。In case of an integrated unit, the apparatus 800 may include a processing unit, a storage unit and a communication unit. Wherein, the processing unit may be used to control and manage the actions of the apparatus 800, for example, may be used to support the apparatus 800 to execute the steps performed by the above-mentioned units. The storage unit may be used to support the device 800 to execute stored program codes, and/or data, and the like. The communication unit may be used to support communication of the apparatus 800 with other devices.
其中,处理单元可以是处理器或控制器。其可以实现或执行结合本申请公开内容所描述的各种示例性地逻辑方框,模块和电路。处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理(digital signal processing,DSP)和微处理器的组合等等。存储单元可以是存储器。通信单元具体可以为射频电路、蓝牙芯片、Wi-Fi芯片等与其他电子设备交互的设备。Wherein, the processing unit may be a processor or a controller. It can implement or execute the various illustrative logical blocks, modules and circuits described in connection with the present disclosure. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (digital signal processing, DSP) and a microprocessor, and the like. The storage unit may be a memory. Specifically, the communication unit may be a device that interacts with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, and a Wi-Fi chip.
在一种可能的实现方式中,本申请实施例所涉及的电子设备可以为具有图9所示结构的装置900,该装置900包括处理器901和收发器902。图8中的收发单元801和处理单元802所实现的相关功能可以由处理器901来实现。In a possible implementation manner, the electronic device involved in this embodiment of the present application may be an apparatus 900 having the structure shown in FIG. 9 , where the apparatus 900 includes a
可选地,该装置900还可以包括存储器903,该处理器901和该存储器903通过内部连接通路互相通信。图8中的存储单元所实现的相关功能可以由存储器903来实现。Optionally, the apparatus 900 may further include a
本申请实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的蓝牙连接方法。The embodiment of the present application also provides a computer storage medium, the computer storage medium stores computer instructions, and when the computer instructions are run on the electronic device, the electronic device executes the above-mentioned related method steps to realize the Bluetooth connection method in the above-mentioned embodiment .
本申请实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的蓝牙连接方法。An embodiment of the present application also provides a computer program product, which, when running on a computer, causes the computer to execute the above-mentioned related steps, so as to realize the Bluetooth connection method in the above-mentioned embodiment.
本申请实施例还提供一种电子设备,这个装置具体可以是芯片、集成电路、组件或模块。具体的,该装置可包括相连的处理器和用于存储指令的存储器,或者该装置包括至少一个处理器,用于从外部存储器获取指令。当装置运行时,处理器可执行指令,以使芯片执行上述各方法实施例中的蓝牙连接方法。The embodiment of the present application also provides an electronic device, and this device may specifically be a chip, an integrated circuit, a component or a module. Specifically, the device may include a connected processor and a memory for storing instructions, or the device may include at least one processor for fetching instructions from an external memory. When the device is running, the processor can execute instructions, so that the chip executes the Bluetooth connection method in the above method embodiments.
图10示出了一种芯片1000的结构示意图。芯片1000包括一个或多个处理器1001以及接口电路1002。可选的,上述芯片1000还可以包含总线1003。FIG. 10 shows a schematic structural diagram of a chip 1000 . The chip 1000 includes one or more processors 1001 and an interface circuit 1002 . Optionally, the above-mentioned chip 1000 may further include a bus 1003 .
处理器1001可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述蓝牙连接方法的各步骤可以通过处理器1001中的硬件的集成逻辑电路或者软件形式的指令完成。The processor 1001 may be an integrated circuit chip with signal processing capability. In the implementation process, each step of the above-mentioned Bluetooth connection method may be completed by an integrated logic circuit of hardware in the processor 1001 or instructions in the form of software.
可选地,上述的处理器1001可以是通用处理器、数字信号处理(digital signalproce ssing,DSP)器、集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。Optionally, the above-mentioned processor 1001 may be a general-purpose processor, a digital signal processing (digital signal processing, DSP) device, an integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Various methods and steps disclosed in the embodiments of the present application may be implemented or executed. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
接口电路1002可以用于数据、指令或者信息的发送或者接收,处理器1001可以利用接口电路1002接收的数据、指令或者其他信息,进行加工,可以将加工完成信息通过接口电路1002发送出去。The interface circuit 1002 can be used for sending or receiving data, instructions or information. The processor 1001 can use the data, instructions or other information received by the interface circuit 1002 to process, and can send the processing completion information through the interface circuit 1002.
可选的,芯片还包括存储器,存储器可以包括只读存储器和随机存取存储器,并向处理器提供操作指令和数据。存储器的一部分还可以包括非易失性随机存取存储器(non-vo latile random access memory,NVRAM)。Optionally, the chip further includes a memory, which may include a read-only memory and a random access memory, and provides operation instructions and data to the processor. A part of the memory may also include non-volatile random access memory (non-vo latile random access memory, NVRAM).
可选的,存储器存储了可执行软件模块或者数据结构,处理器可以通过调用存储器存储的操作指令(该操作指令可存储在操作系统中),执行相应的操作。Optionally, the memory stores executable software modules or data structures, and the processor can execute corresponding operations by calling operation instructions stored in the memory (the operation instructions can be stored in the operating system).
可选的,芯片可以使用在本申请实施例涉及的电子设备或DOP中。可选的,接口电路1002可用于输出处理器1001的执行结果。关于本申请的一个或多个实施例提供的蓝牙连接方法可参考前述各个实施例,这里不再赘述。Optionally, the chip may be used in the electronic device or DOP involved in the embodiment of the present application. Optionally, the interface circuit 1002 may be used to output an execution result of the processor 1001. Regarding the Bluetooth connection method provided by one or more embodiments of the present application, reference may be made to the foregoing embodiments, and details are not repeated here.
需要说明的,处理器1001、接口电路1002各自对应的功能既可以通过硬件设计实现,也可以通过软件设计来实现,还可以通过软硬件结合的方式来实现,这里不作限制。It should be noted that the corresponding functions of the processor 1001 and the interface circuit 1002 can be realized by hardware design, software design, or a combination of software and hardware, which is not limited here.
其中,本实施例提供的电子设备、计算机存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Wherein, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is all used to execute the corresponding method provided above, therefore, the beneficial effects it can achieve can refer to the corresponding method provided above The beneficial effects in the method will not be repeated here.
应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that, in various embodiments of the present application, the sequence numbers of the above-mentioned processes do not mean the order of execution, and the execution order of the processes should be determined by their functions and internal logic, and should not be used in the embodiments of the present application. The implementation process constitutes any limitation.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其他的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其他的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the above units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or can be Integrate into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
上述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例上述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the above functions are realized in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the above-mentioned methods in various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (Read Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, and other media capable of storing program codes.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应所述以权利要求的保护范围为准。The above is only a specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application. Should be covered within the protection scope of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims (35)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111157938.0A CN115884142A (en) | 2021-09-30 | 2021-09-30 | Bluetooth connection method and electronic device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111157938.0A CN115884142A (en) | 2021-09-30 | 2021-09-30 | Bluetooth connection method and electronic device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115884142A true CN115884142A (en) | 2023-03-31 |
Family
ID=85756586
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202111157938.0A Pending CN115884142A (en) | 2021-09-30 | 2021-09-30 | Bluetooth connection method and electronic device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115884142A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116828588A (en) * | 2023-08-25 | 2023-09-29 | 荣耀终端有限公司 | Communication methods, readable media and electronic devices |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20210136839A1 (en) * | 2018-05-17 | 2021-05-06 | Goertek Technology Co.,Ltd. | Connection request processing method and apparatus, bluetooth earphone, wearable device, system and storage medium |
| CN113225693A (en) * | 2019-04-18 | 2021-08-06 | 华为技术有限公司 | Bluetooth connection method, equipment and system |
| US20210264691A1 (en) * | 2020-02-21 | 2021-08-26 | Denso Corporation | In-vehicle device, system for vehicle, and method for managing terminal connection |
| CN113411793A (en) * | 2016-08-18 | 2021-09-17 | 华为技术有限公司 | Bluetooth communication method and terminal |
-
2021
- 2021-09-30 CN CN202111157938.0A patent/CN115884142A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113411793A (en) * | 2016-08-18 | 2021-09-17 | 华为技术有限公司 | Bluetooth communication method and terminal |
| US20210136839A1 (en) * | 2018-05-17 | 2021-05-06 | Goertek Technology Co.,Ltd. | Connection request processing method and apparatus, bluetooth earphone, wearable device, system and storage medium |
| CN113225693A (en) * | 2019-04-18 | 2021-08-06 | 华为技术有限公司 | Bluetooth connection method, equipment and system |
| US20210264691A1 (en) * | 2020-02-21 | 2021-08-26 | Denso Corporation | In-vehicle device, system for vehicle, and method for managing terminal connection |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116828588A (en) * | 2023-08-25 | 2023-09-29 | 荣耀终端有限公司 | Communication methods, readable media and electronic devices |
| CN116828588B (en) * | 2023-08-25 | 2023-11-21 | 荣耀终端有限公司 | Communication method, readable medium, and electronic device |
| WO2025044054A1 (en) * | 2023-08-25 | 2025-03-06 | 荣耀终端股份有限公司 | Communication method, readable medium, and electronic device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12231812B2 (en) | Device interaction method and electronic device | |
| EP4084486B1 (en) | Cross-device content projection method, and electronic device | |
| CN114040238B (en) | Method for displaying multiple windows and electronic equipment | |
| WO2021175300A1 (en) | Data transmission method and apparatus, electronic device, and readable storage medium | |
| CN112399390A (en) | Method and related device for Bluetooth back-up connection | |
| CN113448382B (en) | Multi-screen display electronic equipment and multi-screen display method of electronic equipment | |
| EP4192058A1 (en) | Bluetooth communication method, terminal device, and computer-readable storage medium | |
| US12272335B2 (en) | Display synchronization method, electronic device, and readable storage medium | |
| EP4407453A1 (en) | Application running method and related device | |
| CN113950033B (en) | Data transmission methods and equipment | |
| CN115460445A (en) | Screen projection method of electronic equipment and electronic equipment | |
| CN116709226A (en) | Communication relay method, electronic device, communication system, and storage medium | |
| CN115884142A (en) | Bluetooth connection method and electronic device | |
| CN115811719B (en) | Bluetooth connection method and electronic device | |
| CN114125805B (en) | Bluetooth connection method and terminal device | |
| CN115550423B (en) | Data communication method, electronic device and storage medium | |
| WO2023025038A1 (en) | Method for triggering service execution, and electronic device | |
| CN115079981A (en) | Equipment control method and related device | |
| CN115604773A (en) | Channel switching method and device | |
| EP4525530A1 (en) | Application component interaction method and related device | |
| HK40078045A (en) | Cross-device content projection method, and electronic device | |
| WO2024131878A1 (en) | Screen-mirroring method, electronic device, and system | |
| HK40078045B (en) | Cross-device content projection method, and electronic device | |
| WO2024093614A1 (en) | Device input method and system, and electronic device and storage medium | |
| WO2024093703A1 (en) | Instance management method and apparatus, and electronic device and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |