Communication method, readable medium, and electronic device
By releasing clients that meet specific conditions in the BLE connection scenario, the connection problem caused by the number of clients in electronic devices exceeding the threshold is solved, ensuring the stability of Bluetooth function.
Patent Information
- Application Number
- PCT/CN2024/074016
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-25
- Filing Date
- 2024-01-25
- Publication Date
- 2025-03-06
AI Technical Summary
In Bluetooth low power (BLE) connection scenario, when the number of registered clients in the electronic device exceeds the identification number threshold, other external devices cannot establish a BLE connection with the electronic device and send data, and even lead to abnormal Bluetooth function.
By determining whether the number of registered BLE user IDs reaches the threshold and releasing clients that meet the specific release conditions, so that other external devices can establish a BLE connection with the electronic device. The release condition may include the priority of the electronic device corresponding to the clientif is lower than the priority of the device requested for the new connection, the device type is the same, the device identification is the same, etc.
Ensures the Bluetooth function of electronic devices to be stable, allowing other external devices to establish connections with electronic devices and send data after reaching the identification number threshold.
Smart Images

Figure CN2024074016_06032025_PF_FP_ABST
Abstract
Description
Communication method, readable medium, and electronic device
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on August 25, 2023, with application number 202311081520.5 and application name “Communication Method, Readable Medium and Electronic Device”. The entire contents of the above application are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of wireless communication technology, and in particular to a communication method, a readable medium, and an electronic device. Background Art
[0003] Bluetooth low energy (BLE), also known as Bluetooth low energy, is widely used in smart home, sports and health, security, and other scenarios because it can reduce power consumption while maintaining the same communication range as traditional Bluetooth technology. An electronic device can connect to multiple external devices via BLE. Before establishing a BLE connection with an electronic device, the external device usually needs to register a clientif (user identity) and release the registered clientif after disconnecting.
[0004] However, if the number of registered clientifs in the electronic device exceeds the identification number threshold (the number of clientifs allowed to be registered by the electronic device, such as 32), for example, the number of external devices that establish a BLE connection with the electronic device exceeds the identification number threshold, or the registered clientif in the electronic device is not released after the external device disconnects, it may cause other external devices to be unable to establish a BLE connection with the electronic device and send data, or even cause the Bluetooth function of the electronic device to malfunction, affecting the user's use.
[0005] Summary of the Invention
[0006] The purpose of this application is to provide a communication method, a readable medium and an electronic device.
[0007] A first aspect of the present application provides a communication method, including: a first electronic device receives a Bluetooth Low Energy (BLE) connection request sent by a second electronic device; the first electronic device determines that the number of registered BLE user identifiers is greater than or equal to an identifier number threshold, and among the registered BLE user identifiers, there is a first BLE user identifier that meets a release condition; the first electronic device releases the first BLE user identifier.
[0008] In an embodiment of the present application, when two electronic devices are connected by BLE, such as a first electronic device and a second electronic device, if the number of clientifs registered by one of the electronic devices, such as the first electronic device, reaches an identification number threshold, it is determined whether there is a clientif that meets the release condition among the clientifs registered by the first electronic device, and the clientif that meets the release condition is released so that the first electronic device and the second electronic device can be connected by BLE.
[0009] It can be understood that through the communication method provided in the embodiment of the present application, if the number of registered clientifs in an electronic device exceeds the identification number threshold, other external devices can still establish a connection with the electronic device and send data, thereby ensuring the stability of the Bluetooth function of the electronic device.
[0010] In a possible implementation of the first aspect, after releasing the first BLE user identifier, the first electronic device registers the BLE user identifier corresponding to the second electronic device in the first electronic device and establishes a BLE connection with the second electronic device.
[0011] In an embodiment of the present application, the first electronic device may be a master device, and the second electronic device may be a first slave device. After the master device releases the clientif that meets the release condition, it allocates a new clientif to the first slave device, that is, registers the clientif corresponding to the first slave device, and establishes a BLE connection with the first slave device.
[0012] In a possible implementation of the first aspect above, the release condition includes at least one of the following: the priority of the electronic device corresponding to the registered BLE user identifier in the first electronic device is lower than the priority of the second electronic device; the electronic device corresponding to the registered BLE user identifier in the first electronic device is the same device type as the second electronic device; the electronic device corresponding to the registered BLE user identifier in the first electronic device is the same device identifier as the second electronic device.
[0013] In an embodiment of the present application, the release condition may be that the priority of the electronic device corresponding to clientif is lower than the priority of the second electronic device. For example, the priority of the corresponding electronic device may be determined by the device type and service type of the electronic device. The release condition may also be that the device type of the electronic device corresponding to clientif is the same as the device type of the second electronic device. The release condition may also be that the device identifier of the electronic device corresponding to clientif is the same as the device identifier of the second electronic device.
[0014] In a possible implementation of the first aspect above, the first electronic device determines the priority of the electronic device corresponding to the registered BLE user identifier in the first electronic device and the second electronic device in the following manner: obtaining the device type and service type of the electronic device corresponding to the registered BLE user identifier in the first electronic device, as well as the device type and service type of the second electronic device; based on the obtained device type and service type, determining the priority of the second electronic device and the electronic devices corresponding to each BLE user identifier registered in the first electronic device, wherein the electronic device belonging to the first electronic device type has a higher priority than the electronic device that does not belong to the first electronic device type, and the electronic device that transmits data via BLE and belongs to the first data service type has a higher priority than the electronic device that does not belong to the first data service type.
[0015] In an embodiment of the present application, the first electronic device may be a master device, the electronic device corresponding to the registered BLE user identifier may be a second slave device, the second electronic device may be a first slave device, the first electronic device type may be an external device, and the first data service type may be a real-time service. The master device prioritizes the slave devices according to their service type and device type (including the first slave device and the second slave device). For example, a sorting mechanism is added to the btif_gatt_client module of the Bluetooth protocol stack of the master device, and the Bluetooth protocol stack prioritizes the slave devices according to the source of the connection request, device type, service type, etc. of the slave device. The priority of an electronic device whose device type is an external device is higher than the priority of an electronic device whose device type is an equivalent device; the priority of an electronic device whose service type is a real-time service is higher than the priority of an electronic device whose service type is a non-real-time service.
[0016] In a possible implementation of the first aspect above, the first data service type includes data transmission of an instant messaging application.
[0017] In a possible implementation of the first aspect above, the device identifier includes at least one of the following: an application package name and a Bluetooth address; and a universally unique identifier.
[0018] In an embodiment of the present application, the universally unique identifier (UUID) of the second slave device can be used as the device identifier of the second slave device. Since the slave device sends a connection request to the master device through a corresponding application (APP), the identifier of the APP that sends the connection request and the device identifier of the second slave device can also be used together as the device identifier of the second slave device, that is, the caller (such as the APP package name) and the device identifier (such as the Bluetooth address).
[0019] In a possible implementation of the first aspect above, the identification quantity threshold includes a first identification type quantity threshold; and the first electronic device can also determine the first BLE user identification in the following manner: from the BLE user identifications registered by the first electronic device, select BLE user identifications belonging to the first identification type, the number of which is greater than or equal to the first identification type quantity threshold; and use at least one of the BLE user identifications belonging to the first identification type among the BLE user identifications registered by the first electronic device as the first BLE user identification.
[0020] In an embodiment of the present application, the first identification type quantity threshold may be a device quantity threshold. If the number of second slave devices corresponding to the business type / device type of the first slave device connected to the master device is greater than or equal to the device quantity threshold, the master device releases the clientifs exceeding the device quantity threshold and registers the clientifs for the first slave device. If the number of second slave devices corresponding to the business type / device type of the first slave device connected to the master device is less than the device quantity threshold, second slave devices of other business types / device types other than the first slave device whose number is greater than or equal to the device quantity threshold may also be determined, the master device releases the clientifs exceeding the device quantity threshold and registers the clientifs for the first slave device. The present application does not impose any restrictions on the specific method of allocating clientifs according to the device quantity threshold.
[0021] In a possible implementation of the first aspect, the method further includes: corresponding to the number of BLE user identifiers registered in the first electronic device being less than an identifier quantity threshold, the second electronic device registering the corresponding BLE user identifier in the first electronic device.
[0022] In the embodiment of the present application, when it is determined that the number of currently registered clientifs does not reach the identification number threshold, the master device allocates a clientif to the first slave device.
[0023] A second aspect of the present application provides a readable medium having instructions stored thereon, which, when executed on an electronic device, causes the electronic device to execute any one of the methods described in the first aspect.
[0024] A third aspect of the present application provides an electronic device, comprising a memory for storing instructions executed by one or more processors of the electronic device, and a processor, which is one of the processors of the electronic device, for executing any one of the methods in the above-mentioned first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] FIG1a shows a schematic diagram of establishing a BLE connection between a smartwatch and a mobile phone according to an embodiment of the present application;
[0027] FIG1 b shows a schematic diagram of a user interface of a smart watch according to an embodiment of the present application;
[0028] FIG1c is a schematic diagram showing a flow chart of a communication method according to an embodiment of the present application;
[0029] FIG2 is a schematic diagram showing a flow chart of a communication method based on priority sorting according to an embodiment of the present application;
[0030] FIG3 shows a schematic diagram of priority sorting according to an embodiment of the present application;
[0031] FIG4 a shows a schematic diagram of a user interface of a connection failure according to an embodiment of the present application;
[0032] FIG4 b shows a schematic diagram of a user interface for a user to determine whether to connect according to an embodiment of the present application;
[0033] FIG5 is a schematic diagram showing a flow chart of a communication method based on device type according to an embodiment of the present application;
[0034] FIG6 shows a schematic diagram of a device quantity threshold according to an embodiment of the present application;
[0035] FIG7 is a schematic diagram showing a flow chart of a communication method based on repeated connection judgment according to an embodiment of the present application;
[0036] FIG8 shows a schematic structural diagram of an electronic device according to an embodiment of the present application;
[0037] FIG9 shows a schematic block diagram of a software system architecture of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0038] Illustrative embodiments of the present application include, but are not limited to, a communication method, a readable medium, and an electronic device.
[0039] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and comprehensively described below with reference to the accompanying drawings.
[0040] As mentioned above, an electronic device can connect to multiple external devices via BLE. Before establishing a connection with the electronic device, the external device usually needs to register clientif and release the registered clientif after disconnecting.
[0041] However, if the number of registered clientifs in the electronic device exceeds the identification number threshold, for example, the number of external devices that establish BLE connections with the electronic device exceeds the identification number threshold, or the registered clientifs in the electronic device are not released after the external device disconnects, it may cause other external devices to be unable to establish a BLE connection with the electronic device and send data, or even cause the Bluetooth function of the electronic device to malfunction, affecting user use.
[0042] For example, taking electronic device 100 as a mobile phone, when using the mobile phone, the user often connects to external devices via BLE and obtains data transmitted by the external devices. For example, when the mobile phone connects to a smartwatch via BLE and obtains sports data collected by the smartwatch, it is necessary to first register the clientif corresponding to the smartwatch in the mobile phone; or, for example, when the mobile phone connects to another mobile phone via BLE and obtains data such as pictures transmitted by the other mobile phone, it is necessary to first register the clientif corresponding to the other mobile phone in the mobile phone.
[0043] As shown in FIG1a , when the number of registered clientifs in the mobile phone 10 reaches an identification number threshold, for example, 32, when the user wants to establish a BLE connection between the smart watch 20 and the mobile phone 10, the smart watch 20 will be unable to register the corresponding clientif in the mobile phone 10, thereby causing the smart watch 20 to be unable to establish a BLE connection with the mobile phone 10. For example, FIG1b shows the user interface of the smart watch 20, which includes a warning icon 11 and text prompts such as “Connection failed” and “Please try to reconnect”.
[0044] In view of this, an embodiment of the present application provides a communication method. When two electronic devices establish a BLE connection, such as a first electronic device and a second electronic device establish a BLE connection, if the number of clientifs registered by one of the electronic devices, such as the first electronic device, reaches an identification number threshold, it is determined whether there is a clientif that meets the release condition among the clientifs registered by the first electronic device, and the clientif that meets the release condition is released so that the first electronic device and the second electronic device can establish a BLE connection.
[0045] It is understood that in some embodiments, the release condition may be that the priority of the electronic device corresponding to the clientif is lower than the priority of the second electronic device. For example, the priority of the corresponding electronic device may be determined by the device type and service type of the electronic device.
[0046] In some embodiments, the release condition may also be that the device type of the electronic device corresponding to clientif is the same as the device type of the second electronic device.
[0047] In some embodiments, the release condition may also be that the device identification of the electronic device corresponding to clientif is the same as the device identification of the second electronic device.
[0048] It can be understood that through the communication method provided in the embodiment of the present application, if the number of registered clientifs in an electronic device exceeds the identification number threshold, other external devices can still establish a connection with the electronic device and send data, thereby ensuring the stability of the Bluetooth function of the electronic device.
[0049] It can be understood that the communication method provided in the embodiments of the present application can also be applied to scenarios such as BLE scanning and BLE broadcasting.
[0050] The communication method provided in the embodiments of the present application can be applied to any electronic device that can implement Bluetooth low energy functionality, such as mobile phones, smart screens, tablet computers, laptops, netbooks, and personal digital assistants (PDAs). Exemplary electronic devices include, but are not limited to, electronic devices running iOS, Android, Microsoft, or other operating systems. The embodiments of the present application do not impose any restrictions on the specific type of electronic device.
[0051] In order to better understand the technical solutions of the embodiments of the present application, some technical solutions of the present application are introduced in detail below using the BLE connection scenario as an example.
[0052] FIG1c shows a flow chart of a communication method according to an embodiment of the present application. As shown in FIG1c , the flow chart includes but is not limited to the following steps:
[0053] S101: The service APP sends a request to register clientif to the main device.
[0054] In some embodiments, the second electronic device (hereinafter referred to as the first slave device) sends a request to register clientif to the first electronic device (hereinafter referred to as the master device) through a service application (APP).
[0055] It is understood that BLE connections usually initiate a connection request (sending a request to register clientif) through the corresponding business app. For example, a sports bracelet sends a connection request to a mobile phone through a sports health app.
[0056] S102: Determine whether clientif has reached the upper limit.
[0057] In some embodiments, upon receiving a new connection request, the master device determines whether the number of registered clientifs reaches (is greater than or equal to) an upper limit (identification number threshold), for example, 32.
[0058] In some embodiments, if the judgment result is no, it means that the number of currently registered clientifs has not reached (is less than) the identification number threshold, and a clientif can be allocated to the first slave device initiating the connection request, then step S103 is executed, and the master device allocates a new clientif to the first slave device.
[0059] In other embodiments, if the judgment result is yes, it means that the number of currently registered clientifs has reached the identification number threshold, and it is necessary to further determine whether there are clientifs that meet the release conditions, then step S104 is executed to determine whether there are clientifs that meet the release conditions.
[0060] S103: The master device allocates a new clientif to the first slave device.
[0061] In some embodiments, when it is determined that the number of currently registered clientifs does not reach the identification number threshold, the master device allocates a clientif to the first slave device.
[0062] S104: Determine whether there is a clientif that meets the release condition.
[0063] In some embodiments, when it is determined that the number of currently registered clientifs has reached an identification number threshold, the master device determines whether there is a clientif that meets the release condition among the registered clientifs.
[0064] In some embodiments, if the judgment result is no, indicating that there is no clientif that meets the release condition among the clientifs registered in the current master device, step S105 is executed, and the master device rejects the connection request of the first slave device.
[0065] In other embodiments, if the judgment result is yes, indicating that there is a clientif that meets the release condition among the clientifs registered in the current master device, step S106 is executed, and the master device releases the clientif that meets the release condition.
[0066] S105: The master device rejects the connection request of the first slave device.
[0067] In some embodiments, when it is determined that the priorities of the second slave devices corresponding to the clientifs registered in the current master device are all higher than the priority of the first slave device, the master device rejects the connection request of the first slave device.
[0068] S106: The master device releases the clientif that meets the release condition.
[0069] In some embodiments, after determining that a clientif that meets the release condition exists among the registered clientifs in the master device, the master device releases the clientif that meets the release condition, so that the first slave device establishes a BLE connection with the master device.
[0070] S107: The master device allocates a new clientif to the first slave device.
[0071] In some embodiments, after the master device releases the clientif that meets the release condition, it allocates a new clientif to the first slave device, that is, registers the clientif corresponding to the first slave device, and establishes a BLE connection with the first slave device.
[0072] It can be understood that in other embodiments, according to actual needs, the steps shown in Figure 1c above can be combined, deleted or replaced with other steps that are conducive to achieving the purpose of this application, etc., and this application does not limit this.
[0073] In order to make the technical solutions provided by the embodiments of the present application clearer, the communication methods corresponding to various release conditions are described in detail below with reference to the accompanying drawings.
[0074] Example 1
[0075] In some embodiments, a first electronic device (hereinafter referred to as a master device) prioritizes slave devices according to their service types and device types, for example, by adding a sorting mechanism to the btif_gatt_client module of the Bluetooth protocol stack of the master device to prioritize slave devices that establish a BLE connection with the master device. When the number of registered clientifs in the master device reaches an identification number threshold, and a second electronic device (hereinafter referred to as a first slave device) sends a communication connection request to the master device, the release and allocation of the registered clientifs is determined based on the priority relationship between the third electronic device (hereinafter referred to as the second slave device) and the first slave device corresponding to the registered clientifs in the master device.
[0076] FIG2 shows a flow chart of a communication method based on priority sorting according to an embodiment of the present application. As shown in FIG2 , the flow includes but is not limited to the following steps:
[0077] S201: The master device determines the priority of the slave device.
[0078] In some embodiments, the master device prioritizes the slave devices (including the first slave device and the second slave device) according to their service types and device types. For example, a sorting mechanism is added to the btif_gatt_client module of the Bluetooth protocol stack of the master device, and the Bluetooth protocol stack prioritizes the slave devices according to the source of the slave device's connection request, device type, service type, etc.
[0079] For example, the priority of slave devices can refer to the schematic diagram of priority sorting shown in Figure 3. As shown in Figure 3, the priority of a slave device whose device type is an external device (peripheral) and whose service type is a real-time service (such as a hearing aid) is priority 1, the priority of a slave device whose device type is an equivalent device and whose service type is a real-time service (such as a sharing service) is priority 2, the priority of a slave device whose device type is an external device and whose service type is a non-real-time service (such as a wristband) is priority 3, and the priority of a slave device whose device type is an equivalent device and whose service type is a non-real-time service (such as an online notification service) is priority 4.
[0080] It is understood that the smaller the number, the higher the priority. In other words, the priority of an electronic device with an external device type is higher than that of an electronic device with the same device type; the priority of an electronic device with a real-time service type is higher than that of an electronic device with a non-real-time service type.
[0081] It can be understood that the real-time service may be, for example, a service such as data transmission of an instant messaging application.
[0082] For example, taking a mobile phone as the main device, peripherals are used to represent auxiliary peripheral devices of the main device, such as smart watches and smart desk lamps, and equivalent devices are used to represent another mobile phone, etc.
[0083] It can be understood that the priorities shown in Figure 3 and the device types and service types of the slave devices corresponding to each priority are only examples of priorities. In other embodiments, the confirmation of priorities can also be in other forms, and this application does not impose any restrictions on this.
[0084] S202: The service APP sends a request to register clientif to the main device.
[0085] In some embodiments, the first slave device sends a request to register clientif to the master device through the service APP.
[0086] It is understood that BLE connections usually initiate a connection request (sending a request to register clientif) through the corresponding business app. For example, a sports bracelet sends a connection request to a mobile phone through a sports health app.
[0087] S203: Determine whether clientif has reached the upper limit.
[0088] In some embodiments, upon receiving a new connection request, the master device determines whether the number of registered clientifs reaches (is greater than or equal to) an upper limit (identification number threshold), for example, 32.
[0089] In some embodiments, if the judgment result is no, it means that the number of currently registered clientifs has not reached the identification number threshold, and a clientif can be allocated to the first slave device initiating the connection request, then step S204 is executed, and the master device allocates a new clientif to the first slave device.
[0090] In other embodiments, if the judgment result is yes, it means that the number of currently registered clientifs has reached the identification number threshold, and it is necessary to further determine the relationship between the priority of the first slave device and the priority of the second slave device corresponding to the registered clientif in the master device, then execute step S205 to determine whether the priority is higher than the existing lowest priority.
[0091] S204: The master device allocates a new clientif to the first slave device.
[0092] In some embodiments, when it is determined that the number of currently registered clientifs does not reach the identification number threshold, the master device allocates a clientif to the first slave device.
[0093] S205: Determine whether the priority is higher than the current lowest priority.
[0094] In some embodiments, the master device determines whether the priority of the first slave device is higher than the lowest priority among the second slave devices corresponding to the clientif registered in the master device.
[0095] In some embodiments, if the judgment result is no, it means that the priority of the second slave device corresponding to the clientif registered in the current master device is higher than the priority of the first slave device, and there is no need to establish a connection with the first slave device, then step S206 is executed, and the master device rejects the connection request of the first slave device.
[0096] In other embodiments, if the judgment result is yes, it means that among the second slave devices corresponding to the clientif registered in the current master device, there is a second slave device with a priority lower than the priority of the first slave device, then step S207 can be executed, and the master device disconnects 1 connection with the low-priority slave device.
[0097] S206: The master device rejects the connection request of the first slave device.
[0098] In some embodiments, when it is determined that the priorities of the second slave devices corresponding to the clientifs registered in the current master device are all higher than the priority of the first slave device, the master device rejects the connection request of the first slave device.
[0099] For example, in the scenario shown in FIG1a , the master device is a mobile phone 10 and the first slave device is a smartwatch 20. The master device may display a user interface diagram as shown in FIG4a . As shown in FIG4a , user interface 40a is the main interface of mobile phone 10, including application icons for multiple applications and a prompt box 401 . Prompt box 401 includes text prompts such as “Smartwatch failed to connect to this device” and “Retry again later”.
[0100] Optionally, when it is determined that the priorities of the second slave devices corresponding to the clientifs registered in the current master device are all higher than the priority of the first slave device, the user may decide whether to reject the connection request of the first slave device.
[0101] For example, using the scenario shown in FIG1a , the master device is a mobile phone 10, the first slave device is a smartwatch 20, and the second slave device with the lowest priority is device A. The master device may display a user interface diagram as shown in FIG4b . As shown in FIG4b , user interface 40b is the main interface of mobile phone 10, including application icons for multiple applications and a prompt box 402 . Prompt box 402 includes a text prompt message "Do you want to disconnect this device from device A and establish a connection with the smartwatch?" as well as an accept control 4021 and a reject control 4022 .
[0102] S207: The master device disconnects one connection with the slave device of low priority.
[0103] In some embodiments, when it is determined that the priority of the first slave device is higher than the priority of the second slave device with the lowest priority among the second slave devices corresponding to the clientif registered in the current master device, the master device disconnects the connection with the second slave device with the lowest priority, or releases the clientif corresponding to the second slave device with the lowest priority.
[0104] S208: The master device allocates a new clientif to the first slave device.
[0105] In some embodiments, clientif is assigned to the first slave device after the master device disconnects from the second slave device having the lowest priority.
[0106] It can be understood that in other embodiments, according to actual needs, the steps shown in Figure 2 above can be combined, deleted or replaced with other steps that are conducive to achieving the purpose of this application, etc., and this application does not limit this.
[0107] Example 2
[0108] In some embodiments, a first electronic device (hereinafter referred to as a master device) determines a device quantity threshold for slave devices of each service type / device type. When the number of registered clientifs in the master device reaches an identification quantity threshold or the number of registered clientifs of a device type corresponding to a second electronic device (hereinafter referred to as a first slave device) reaches a device quantity threshold, and the first slave device sends a communication connection request to the master device, the connection of a third electronic device (hereinafter referred to as a second slave device) corresponding to a registered clientif in one path of the master device is disconnected, and a connection is established with the first slave device.
[0109] FIG5 shows a flow chart of a communication method based on device type according to an embodiment of the present application. As shown in FIG5 , the flow includes but is not limited to the following steps:
[0110] S501: The master device determines a threshold value of the number of slave devices of each service type / device type.
[0111] In some embodiments, the master device determines each service type / device type of the slave device connected to the master device and a device quantity threshold of the slave devices of each service type / device type according to the service type / device type of the slave device.
[0112] It can be understood that each service type / device type of the slave device that establishes a connection with the master device and the device quantity threshold of the slave devices of each service type / device type can be stored in the corresponding database.
[0113] For example, the device quantity thresholds for each service type / device type and slave devices of each service type / device type can refer to the schematic diagram of the device quantity thresholds shown in Figure 6. As shown in Figure 6, the device quantity threshold for slave devices whose device type is hearing aids is 2 to 4, the device quantity threshold for slave devices whose device type is wearable audio devices is 3 to 4, the device quantity threshold for slave devices whose device type is wearable devices is 3, the device quantity threshold for slave devices whose service type is full-scenario services is 5, and the device quantity threshold for slave devices whose service type is other services (such as trackers) is 3.
[0114] It can be understood that the device quantity thresholds of the various business types / device types and the slave devices of each business type / device type shown in Figure 6 are merely examples of the device quantity thresholds of the slave devices of each business type / device type. In other embodiments, the confirmation of the device quantity thresholds of the slave devices of each business type / device type can also be in other forms, and this application does not impose any restrictions on this.
[0115] S502: The service APP sends a request to register clientif to the main device.
[0116] In some embodiments, the first slave device sends a request to register clientif to the master device through the service APP.
[0117] It is understood that BLE connections usually initiate a connection request (sending a request to register clientif) through the corresponding business app. For example, a sports bracelet sends a connection request to a mobile phone through a sports health app.
[0118] S503: Query the service / device type of the first slave device.
[0119] In some embodiments, the Bluetooth protocol stack of the master device queries the service type / device type of the first slave device.
[0120] S504: Determine whether it is a known type.
[0121] In some embodiments, after determining the service type / device type of the first slave device, the master device determines whether the service type / device type of the first slave device is a known service type / device type.
[0122] It can be understood that the known service type / device type may be each service type / device type determined in the above step S501.
[0123] In some embodiments, if the judgment result is yes, it means that clientif can be allocated to the first slave device according to the device quantity threshold corresponding to the known service type / device type, then step S505 is executed to allocate clientif according to the device quantity threshold.
[0124] In other embodiments, if the judgment result is no, indicating that the device type / service type of the first slave device is a new device type / service type, step S506 is executed, and the master device allocates clientif to the first slave device.
[0125] S505: Allocate clientif according to the device quantity threshold.
[0126] In some embodiments, the service type / device type of the first slave device is determined to be a known service type / device type, and the master device allocates a clientif to the first slave device according to a device quantity threshold corresponding to the service type / device type of the first slave device.
[0127] For example, if the number of second slave devices corresponding to the service type / device type of the first slave device connected to the master device is less than the device quantity threshold, clientif is directly allocated to the first slave device (the first slave device is connected to the master device through BLE).
[0128] Or, for example, if the number of second slave devices connected to the master device that have the same service type / device type as the first slave device is greater than or equal to a device quantity threshold, then the BLE connection with the first slave device is rejected. The user interface may refer to the user interface shown in FIG. 4 a above.
[0129] Alternatively, if the number of second slave devices of the service type / device type corresponding to the first slave device connected to the master device is greater than or equal to a device quantity threshold, the user may decide whether to reject the connection request of the first slave device. The user interface may refer to the user interface shown in FIG4 b above.
[0130] In other embodiments, if the number of second slave devices corresponding to the business type / device type of the first slave device connected to the master device is greater than or equal to a device number threshold, the master device releases the clientifs exceeding the device number threshold and registers the clientifs for the first slave device. If the number of second slave devices corresponding to the business type / device type of the first slave device connected to the master device is less than the device number threshold, second slave devices of other business types / device types other than the first slave device whose number is greater than or equal to the device number threshold may also be determined. The master device releases the clientifs exceeding the device number threshold and registers the clientifs for the first slave device. This application does not limit the specific method of allocating clientifs according to the device number threshold.
[0131] S506: The master device allocates clientif to the first slave device.
[0132] In some embodiments, it is determined that the service type / device type of the first slave device is not a known service type / device type, and the master device allocates a clientif to the first slave device (establishes a connection between the first slave device and the master device).
[0133] S507: According to the information of the first slave device, the service / device type of the first slave device is recorded in the database.
[0134] In some embodiments, if the business type / device type of the first slave device is not a known business type / device type, and after the master device assigns a clientif to the first slave device, the master device records the business / device type of the first slave device in the database based on the information of the first slave device (business type / device type).
[0135] It can be understood that in other embodiments, according to actual needs, the steps shown in Figure 5 above can be combined, deleted or replaced with other steps that are conducive to achieving the purpose of this application, etc., and this application does not limit this.
[0136] It is understood that in other embodiments, when the number of registered clientifs in the master device reaches an identification number threshold (e.g., 32), and the first slave device sends a communication connection request to the master device, a clientif is allocated to the first slave device according to the device number threshold. This application does not impose any restrictions on this.
[0137] Example 3
[0138] In some embodiments, when the number of registered clientifs in a first electronic device (hereinafter referred to as the master device) reaches an identification number threshold, and a second electronic device (hereinafter referred to as the first slave device) sends a communication connection request to the master device, it is determined whether the first slave device has the same device identification as the third electronic device (hereinafter referred to as the second slave device) corresponding to the registered clientif in the master device, that is, they are the same device, then the connection between the second slave device with the same device identification as the first slave device is disconnected, or the connection of the first slave device is rejected.
[0139] For example, the Bluetooth protocol stack of the master device determines whether there are the same caller and device identifier through the caller (such as the APP package name) and device identifier (such as the Bluetooth address) of each slave device to identify whether there is a duplicate connection, that is, whether the first slave device has the same device identifier in the second slave device corresponding to the clientif registered in the master device.
[0140] FIG7 shows a flow chart of a communication method based on repeated connection judgment according to an embodiment of the present application. As shown in FIG7 , the flow includes but is not limited to the following steps:
[0141] S701: The master device determines the device identification of each second slave device.
[0142] In some embodiments, the master device determines the device identification of the second slave device corresponding to each registered clientif.
[0143] It is understandable that the universally unique identifier (UUID) of the second slave device can be used as the device identifier of the second slave device. Since the slave device sends a connection request to the master device through the corresponding APP, the identifier of the APP that sends the connection request and the device identifier of the second slave device can also be used together as the device identifier of the second slave device, that is, the caller (such as the APP package name) and the device identifier (such as the Bluetooth address).
[0144] S702: The service APP sends a request to register clientif to the main device.
[0145] In some embodiments, the first slave device sends a request to register clientif to the master device through the service APP.
[0146] It is understood that BLE connections usually initiate a connection request (sending a request to register clientif) through the corresponding business app. For example, a sports bracelet sends a connection request to a mobile phone through a sports health app.
[0147] S703: The master device obtains the device identification of the first slave device.
[0148] In some embodiments, after receiving the connection request, the master device obtains the device identification of the first slave device.
[0149] S704: Determine whether the connection is repeated.
[0150] In some embodiments, the master device determines whether the device identification of the first slave device and the device identification of the second slave device are the same to determine whether there is a duplicate connection.
[0151] In some embodiments, if the judgment result is no, indicating that there is no duplicate connection, step S705 is executed, and the master device rejects the connection request of the first slave device.
[0152] In other embodiments, if the judgment result is yes, indicating that there is a duplicate connection, step S706 is executed, and the master device disconnects from the duplicated slave device.
[0153] S705: The master device rejects the connection request of the first slave device.
[0154] In some embodiments, after the master device determines that there is no duplicate connection, it rejects the connection request of the first slave device. The user interface can refer to the user interface shown in Figure 4a above.
[0155] Alternatively, if the master device determines that there is no duplicate connection, the user may decide whether to reject the connection request of the first slave device. The user interface may refer to the user interface shown in FIG4 b above.
[0156] In other embodiments, after the master device determines that there is no duplicate connection, it may continue to determine whether the master device has established a connection with the first slave device according to the method in the above-mentioned embodiment 1 or embodiment 2. This application does not impose any limitation on this.
[0157] S706: The master device disconnects from the repeatedly connected slave device.
[0158] In some embodiments, after determining that there is a duplicate connection, the master device releases the clientif corresponding to the duplicate device identifier, that is, disconnects the connection with the device corresponding to the duplicate device identifier.
[0159] S707: The master device allocates clientif to the first slave device.
[0160] In some embodiments, after the master device releases the clientif corresponding to the duplicate device identifier, it allocates the clientif to the first slave device (establishes a connection between the first slave device and the master device).
[0161] It is understood that in other embodiments, the master device may also reject the connection request of the first slave device and retain the connection with the second slave device having the same device identifier as the first slave device.
[0162] It can be understood that in other embodiments, according to actual needs, the steps shown in Figure 7 above can be combined, deleted or replaced with other steps that are conducive to achieving the purpose of this application, etc., and this application does not limit this.
[0163] It is understood that in some embodiments, the method of embodiment 3 may also be used in combination with the method of embodiment 1 or the method of embodiment 2. This application does not impose any limitation on this.
[0164] For example, in some embodiments, after the master device receives a request from the first slave device to register clientif via a service APP, it first determines whether there is a duplicate connection. If there is a duplicate connection, the clientif is assigned to the first slave device (the first slave device is connected to the master device) according to the operations of steps S607 and S707 above. If there is no duplicate connection, it is determined whether the priority of the first slave device is higher than the lowest priority of the second slave device corresponding to the clientif registered in the master device, that is, the method in the above embodiment 1 is executed.
[0165] For example, in some embodiments, after receiving a request from a first slave device to register a clientif via a service app, the master device first determines whether a duplicate connection exists. If so, the master device allocates a clientif to the first slave device according to the operations in steps S607 and S707 described above. If not, the master device determines that the service type / device type of the first slave device is a known service type / device type, and allocates a clientif to the first slave device based on a device quantity threshold corresponding to the service type / device type of the first slave device, thereby executing the method described in the second embodiment.
[0166] In summary, the communication method provided in the embodiment of the present application, when two electronic devices are connected by BLE, such as a first electronic device and a second electronic device, if the number of clientifs registered by one of the electronic devices, such as the first electronic device, reaches the identification number threshold, it is determined whether there is a clientif that meets the release condition among the clientifs registered by the first electronic device, and the clientif that meets the release condition is released so that the first electronic device and the second electronic device can be connected by BLE. Through the communication method provided in the embodiment of the present application, if the number of registered clientifs in an electronic device exceeds the identification number threshold, other external devices can still establish a connection with the electronic device and send data, thereby ensuring the stability of the Bluetooth function of the electronic device.
[0167] In order to better understand the technical solutions of the embodiments of the present application, the structure of the equipment involved in the present application is introduced below with reference to the accompanying drawings.
[0168] Illustratively, FIG8 shows a schematic structural diagram of an electronic device 100 according to an embodiment of the present application.
[0169] It can be understood that the electronic device 100 can be the above-mentioned master device, the above-mentioned first slave device, or the above-mentioned second slave device.
[0170] As shown in FIG8 , the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, an interface module 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
[0171] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Among them, different processing units can be independent devices or integrated into one or more processors. The processor can be used to execute the communication method mentioned in this application.
[0172] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or is using in a loop.
[0173] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0174] The mobile communication module 150 can provide wireless communication solutions including 2G / 3G / 4G / 5G applied on the electronic device 100.
[0175] The wireless communication module 160 can provide wireless communication solutions for the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. For example, in some embodiments, the electronic device sends and receives BLE connection requests through the wireless communication module 160 to establish a BLE connection.
[0176] The display screen 194 is used to display images, videos, etc. For example, in some embodiments, the electronic device displays prompt information such as connection failure, connection rejection, etc. on the display screen 194.
[0177] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store an operating system, an application required for at least one function, etc. The data storage area may store data created during the use of the electronic device 100, etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.
[0178] The keys 190 include a power key, a volume key, etc. The electronic device 100 can receive key inputs and generate key signal inputs related to user settings and function controls of the electronic device 100 .
[0179] Exemplarily, FIG9 shows a schematic block diagram of a software system architecture of an electronic device 100 according to an embodiment of the present application.
[0180] The software system architecture of the electronic device 100 may adopt a layered architecture. In the embodiment of the present application, the Android system with a layered architecture is taken as an example to illustrate the software structure of the electronic device 100.
[0181] As shown in FIG9 , the Android system is divided into four layers, which are, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0182] As shown in Figure 9, the application layer may include a series of application packages. The application packages may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, short message, video and other applications.
[0183] As shown in FIG9 , the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.
[0184] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.
[0185] Content providers are used to store and retrieve data and make this data accessible to applications.
[0186] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. For example, in some embodiments, the display interface may include prompt information such as connection failure, connection rejection, etc.
[0187] The phone manager is used to provide the communication function of the electronic device 100 .
[0188] The resource manager provides various resources for applications, such as localized strings, icons, images, video files, etc.
[0189] The Notification Manager allows applications to display notifications in the status bar. These messages can be used to convey informational messages and can disappear automatically after a short pause without user interaction. The Notification Manager can also display notifications in the system's top status bar as icons or scrolling text, or in dialog windows.
[0190] Android Runtime includes core libraries and a virtual machine. Android Runtime is responsible for scheduling and management of the Android system.
[0191] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0192] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0193] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
[0194] The system library can include multiple functional modules, such as the surface manager (SM), media libraries (ML), 3D graphics processing library (such as OpenGL ES), and 2D graphics engine (such as SGL).
[0195] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files.
[0196] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0197] Program code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For purposes of this application, a processing system includes any system having a processor such as, for example, a DSP, a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0198] Program code can be implemented with a high-level programming language or an object-oriented programming language to communicate with the processing system. Where necessary, program code can also be implemented in assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any particular programming language. In either case, the language can be a compiled language or an interpreted language.
[0199] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, instructions may be distributed over a network or through other computer-readable media. Therefore, a machine-readable medium may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including but not limited to a floppy disk, an optical disk, an optical disk, a magneto-optical disk, a read-only memory (ROM), a random access memory (RAM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic card or an optical card, a flash memory, or a tangible machine-readable memory for transmitting information (e.g., a carrier wave, an infrared signal, a digital signal, etc.) using the Internet in an electrical, optical, acoustic, or other form of propagation signal. Accordingly, machine-readable media includes any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (eg, a computer).
[0200] In the accompanying drawings, some structural or method features may be shown in a particular arrangement and / or order. However, it should be understood that such a particular arrangement and / or order may not be required. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of a structural or method feature in a particular figure does not imply that such feature is required in all embodiments, and in some embodiments, such features may not be included or may be combined with other features.
[0201] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems raised by this application. In addition, in order to highlight the innovative part of this application, the above-mentioned device embodiments of this application do not introduce units / modules that are not closely related to solving the technical problems raised by this application. This does not mean that other units / modules do not exist in the above-mentioned device embodiments.
[0202] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "including a" does not exclude the presence of other identical elements in the process, method, article or device that includes the element.
[0203] Although the present application has been shown and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the application.
Claims
1. A communication method, characterized in that: include: The first electronic device receives a Bluetooth Low Energy (BLE) connection request sent by the second electronic device; The first electronic device determines that the number of registered BLE user identifiers is greater than or equal to an identifier number threshold, and among the registered BLE user identifiers, there is a first BLE user identifier that meets a release condition; The first electronic device releases the first BLE user identifier.
2. The method according to claim 1, characterized in that After the first electronic device releases the first BLE user identifier, the first electronic device registers the BLE user identifier corresponding to the second electronic device in the first electronic device, and establishes a BLE connection with the second electronic device.
3. The method according to claim 1, characterized in that The release conditions include at least one of the following: The priority of the electronic device corresponding to the BLE user identifier registered in the first electronic device is lower than the priority of the second electronic device; The electronic device corresponding to the BLE user identifier registered in the first electronic device is of the same device type as that of the second electronic device; The electronic device corresponding to the BLE user identifier registered in the first electronic device is the same as the device identifier of the second electronic device.
4. The method according to claim 3, characterized in that The first electronic device determines the priority of the electronic device corresponding to the BLE user identifier registered in the first electronic device and the second electronic device in the following manner: Acquire the device type and service type of the electronic device corresponding to the BLE user identifier registered in the first electronic device, and the device type and service type of the second electronic device; Based on the acquired device type and service type, the priority of the electronic devices corresponding to the BLE user identifiers registered in the second electronic device and the first electronic device is determined, wherein electronic devices belonging to the first electronic device type have a higher priority than electronic devices that do not belong to the first electronic device type, and electronic devices that transmit data via BLE and belong to the first data service type have a higher priority than electronic devices that transmit data via BLE and do not belong to the first data service type.
5. The method according to claim 4, characterized in that The first data service type includes data transmission of an instant messaging application.
6. The method according to claim 3, characterized in that The device identification includes at least one of the following: Application package name and Bluetooth address; Universally unique identifier.
7. The method according to claim 1, characterized in that The identification quantity threshold includes a first identification type quantity threshold; and, The first electronic device may also determine the first BLE user identifier in the following manner: From the BLE user identifiers registered by the first electronic device, the number of BLE user identifiers belonging to the first identifier type selected is greater than or equal to the first identifier type number threshold; At least one of the BLE user identifiers that are registered by the first electronic device and belong to the first identifier type is used as the first BLE user identifier.
8. The method according to claim 1, characterized in that: Also includes: Corresponding to the number of BLE user identifiers registered in the first electronic device being less than an identifier number threshold, the second electronic device registers the corresponding BLE user identifier in the first electronic device.
9. A readable medium, characterized in that: The readable medium stores instructions, which, when executed on an electronic device, enable the electronic device to execute the method according to any one of claims 1 to 8.
10. An electronic device, characterized in that: include: a memory for storing instructions to be executed by one or more processors of the electronic device, and, The processor is one of the processors of the electronic device, and is used to execute the method according to any one of claims 1 to 8.
11. A communication method, characterized in that: include: The first electronic device receives a Bluetooth Low Energy (BLE) connection request sent by the second electronic device; The first electronic device determines that the number of registered BLE user identifiers is greater than or equal to an identifier number threshold, and among the registered BLE user identifiers, there is a first BLE user identifier that meets a release condition; The first electronic device releases the first BLE user identifier; The identification quantity threshold includes each device quantity threshold corresponding to each device type connected to the first electronic device; and The first electronic device determines the first BLE user identifier in the following manner: If the number of slave devices corresponding to the device type of the second electronic device connected to the first electronic device is greater than or equal to a device number threshold corresponding to the device type of the second electronic device, at least one of the BLE user identifiers registered in the slave devices corresponding to the device type of the second electronic device is used as the first BLE user identifier; if the number of slave devices corresponding to the device type of the second electronic device connected to the first electronic device is less than the device number threshold, at least one of the BLE user identifiers registered in slave devices of other device types whose number is greater than or equal to the device number threshold corresponding to the device type of the second electronic device is used as the first BLE user identifier.
12. The method according to claim 11, characterized in that After the first electronic device releases the first BLE user identifier, the first electronic device registers the BLE user identifier corresponding to the second electronic device in the first electronic device, and establishes a BLE connection with the second electronic device.
13. The method according to claim 11, characterized in that The release conditions include at least one of the following: The priority of the electronic device corresponding to the BLE user identifier registered in the first electronic device is lower than the priority of the second electronic device; The electronic device corresponding to the BLE user identifier registered in the first electronic device is of the same device type as that of the second electronic device; The electronic device corresponding to the BLE user identifier registered in the first electronic device is the same as the device identifier of the second electronic device.
14. The method according to claim 13, characterized in that The first electronic device determines the priority of the electronic device corresponding to the BLE user identifier registered in the first electronic device and the second electronic device in the following manner: Acquire the device type and service type of the electronic device corresponding to the BLE user identifier registered in the first electronic device, and the device type and service type of the second electronic device; Based on the acquired device type and service type, the priority of the electronic devices corresponding to the BLE user identifiers registered in the second electronic device and the first electronic device is determined, wherein electronic devices belonging to the first electronic device type have a higher priority than electronic devices that do not belong to the first electronic device type, and electronic devices that transmit data via BLE and belong to the first data service type have a higher priority than electronic devices that transmit data via BLE and do not belong to the first data service type.
15. The method according to claim 14, characterized in that The first data service type includes data transmission of an instant messaging application.
16. The method according to claim 13, characterized in that The device identification includes at least one of the following: Application package name and Bluetooth address; Universally unique identifier.
17. The method according to claim 11, characterized in that Also includes: Corresponding to the number of BLE user identifiers registered in the first electronic device being less than an identifier number threshold, the second electronic device registers the corresponding BLE user identifier in the first electronic device.
18. A readable medium, characterized in that The readable medium stores instructions, which, when executed on an electronic device, enable the electronic device to execute the method according to any one of claims 11 to 17.
19. An electronic device, characterized in that: include: a memory for storing instructions to be executed by one or more processors of the electronic device, and, The processor is one of the processors of the electronic device, and is used to execute the method according to any one of claims 11 to 17.
20. A communication method, characterized in that: include: The first electronic device receives a Bluetooth Low Energy (BLE) connection request sent by the second electronic device; The first electronic device determines that the number of registered BLE user identifiers is greater than or equal to an identifier number threshold, and releases the first BLE user identifier; The registered BLE user identifier includes a BLE user identifier corresponding to an external device, and the connection between the external device and the first electronic device is disconnected.
21. The method according to claim 20, characterized in that Also includes: When the first electronic device determines that the number of registered BLE user identifiers is greater than or equal to the identifier number threshold, a prompt box is displayed in the user interface, wherein the prompt box includes text prompt information for the user to confirm whether to connect to the second electronic device, as well as an acceptance control and a rejection control.
22. The method according to claim 21, characterized in that Also includes: A first instruction is received, and the first BLE user identifier is released; wherein the first instruction is generated based on an operation on the accept control.
23. The method according to claim 20, characterized in that The first BLE user identifier meets a release condition.
24. The method according to claim 20, characterized in that After the first electronic device releases the first BLE user identifier, the first electronic device registers the BLE user identifier corresponding to the second electronic device in the first electronic device, and establishes a BLE connection with the second electronic device.
25. The method according to claim 23, characterized in that The release conditions include at least one of the following: The priority of the electronic device corresponding to the BLE user identifier registered in the first electronic device is lower than the priority of the second electronic device; The electronic device corresponding to the BLE user identifier registered in the first electronic device is of the same device type as that of the second electronic device; The electronic device corresponding to the BLE user identifier registered in the first electronic device is the same as the device identifier of the second electronic device.
26. The method according to claim 25, characterized in that The first electronic device determines the priority of the electronic device corresponding to the BLE user identifier registered in the first electronic device and the second electronic device in the following manner: Acquire the device type and service type of the electronic device corresponding to the BLE user identifier registered in the first electronic device, and the device type and service type of the second electronic device; Based on the acquired device type and service type, the priority of the electronic devices corresponding to the BLE user identifiers registered in the second electronic device and the first electronic device is determined, wherein the electronic devices belonging to the first electronic device type are prioritized over the electronic devices not belonging to the first electronic device type. Electronic devices of the device type have a higher priority, and electronic devices whose data transmission services via BLE belong to the first data service type have a higher priority than electronic devices whose data transmission services via BLE do not belong to the first data service type.
27. The method according to claim 26, characterized in that The first data service type includes data transmission of an instant messaging application.
28. The method according to claim 25, characterized in that The device identification includes at least one of the following: Application package name and Bluetooth address; Universally unique identifier.
29. The method according to claim 20, characterized in that Also includes: The first electronic device determines each device quantity threshold corresponding to each device type; wherein the second electronic device corresponds to a second device type, and the second device type corresponds to a second device quantity threshold; Determine that the number of BLE user identifiers corresponding to the second device type is a first number; If the first number is greater than or equal to the second device number threshold, the first BLE user identifier is determined from the BLE user identifiers corresponding to the second device type.
30. The method according to claim 29, characterized in that Also includes: If the first number is less than the second device number threshold, determine a third device type from other device types, the number of BLE user identifiers corresponding to the third device type is greater than or equal to the second device number threshold, and determine the first BLE user identifier from the BLE user identifiers corresponding to the third device type.
31. The method according to claim 20, characterized in that Also includes: Corresponding to the number of BLE user identifiers registered in the first electronic device being less than an identifier number threshold, the second electronic device registers the corresponding BLE user identifier in the first electronic device.
32. The method according to claim 20, characterized in that Also includes: A connection request sent by the second electronic device through an application is received, wherein the connection request includes an identifier of the application and a device identifier of the second electronic device.
33. A readable medium, characterized in that The readable medium stores instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 20 to 32.
34. An electronic device, characterized in that: include: a memory for storing instructions to be executed by one or more processors of the electronic device, and, The processor is one of the processors of an electronic device, and is used to execute the method described in any one of claims 20 to 32.
Citation Information
Patent Citations
Connection management of smart devices with automobile head unit
CN108702376A
Bluetooth connection method and electronic equipment
CN115884142A
Communication method, readable medium and electronic equipment
CN116828588A
Connection control method of bluetooth system
KR1020150065004A
Wireless terminal management apparatus, wireless terminal management method, wireless terminal management program, and recording medium
US20100279685A1