Method and device for determining main control device of low-power-consumption Bluetooth network and medium

By calculating the scores of the number of connections, power and signal strength of the communication device, dynamically adjusting the master control device in the low-power Bluetooth network, solving the problem of failure to consider network environment changes in the traditional method and improving network performance and stability.

CN119946594APending Publication Date: 2025-05-06MOBILE TECH COMPANY CHINA TRAVELSKY HLDG
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510118265.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

In traditional low-power Bluetooth networks, the method of determining the master control device fails to fully consider the changes in the network environment and the current state of the communication device, resulting in the master control device being unsuitable for the current network needs and affecting network performance and stability.

Method used

By obtaining the current number of equipment connections, power and RSSI signal strength of the communication device, calculate the score of the master control device. When the master control device determines the score less than the score of the new communication device determines the score, dynamically adjust the main control device to ensure that the network is always managed by the most suitable equipment.

Benefits of technology

Improves the overall performance and stability of the low-power Bluetooth network, ensures that the master device is always suitable for the current network environment, and reduces the communication interruption time caused by the lack of the master device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119946594A_ABST
    Figure CN119946594A_ABST
Patent Text Reader

Abstract

The invention provides a main control equipment determining method and equipment of a low-power-consumption Bluetooth network and a medium, and relates to the technical field of low-power-consumption Bluetooth networks, the method is applied to communication equipment, and in the method, when new communication equipment joins or existing main control equipment exits, the main control equipment of the low-power-consumption Bluetooth network is determined. Obtaining a main control equipment determination score corresponding to the communication equipment based on the number of other communication equipment directly communicating with the communication equipment in the current low-power-consumption Bluetooth network, the electric quantity of the current communication equipment and the RSSI signal strength of the current communication equipment, and determining the main control equipment according to the main control equipment determination score corresponding to the communication equipment, according to the method, the number of other communication devices directly communicating with the communication device, the electric quantity of the communication device and the RSSI signal strength of the communication device are considered, so that the low-power-consumption Bluetooth network is always managed by the most appropriate communication device, and the overall performance and stability of the low-power-consumption Bluetooth network are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of low-power Bluetooth networks, and in particular to a method, device and medium for determining a master control device of a low-power Bluetooth network. Background Art

[0002] Bluetooth low energy is a wireless personal area network technology designed specifically for mobile communications and the Internet of Things. It aims to provide similar communication distance and functions as traditional Bluetooth with lower energy consumption. In a Bluetooth low energy network, the network topology usually adopts a star structure, including several communication devices, including a master device and one or more non-master devices (slave devices); the master device is responsible for initiating and managing connections with non-master devices and coordinating data transmission, and the non-master device responds to the request of the master device and provides data or services; however, in some complex environments, such as smart homes, industrial automation, aerospace and other scenarios, there may be multiple master devices and a large number of non-master devices to form a more complex network structure. Traditional methods for determining master devices mostly rely on static attributes or simple rules, such as: sorting by the MAC address of the communication device and selecting the communication device at a specific location as the master device; when deploying the network, pre-designating certain communication devices as master devices; however, traditional methods for determining master devices fail to fully consider changes in the network environment and the current status of the communication device, such as power and RSSI signal strength, which may cause the determined master device to be unsuitable for the current network requirements, thereby affecting the performance and stability of the Bluetooth low energy network. For example, when the power of the master device is low or the signal quality is poor, it may cause unstable communication, increased response delays, or even service interruption. Summary of the invention

[0003] In view of the above technical problems, the technical solution adopted by the present invention is:

[0004] According to a first aspect of the present invention, a method for determining a master control device of a low-power Bluetooth network is provided. The method is applied to a communication device and comprises the following steps:

[0005] S001. When it is the master device of a low-power Bluetooth network and responds to a new communication device joining the low-power Bluetooth network, it obtains the master device determination score corresponding to itself and the master device determination score corresponding to the new communication device and proceeds to step S002; when it is a non-master device of a low-power Bluetooth network and responds to the master device of the low-power Bluetooth network exiting the low-power Bluetooth network, it obtains the master device determination scores corresponding to all communication devices in the current low-power Bluetooth network and proceeds to step S003; wherein the master device determination score corresponding to the communication device is obtained based on the number of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network, the power of the current communication device and the RSSI signal strength of the current communication device.

[0006] S002. When the master device determination score corresponding to itself is less than the master device determination score corresponding to the new communication device, set itself as a non-master device of the low-power Bluetooth network, and send master device determination information to the new communication device at the same time, so that the new communication device sets itself as the master device of the low-power Bluetooth network when receiving the master device determination information.

[0007] S003. When the master control device corresponding to itself determines the score that is the maximum value among the master control devices corresponding to all communication devices in the current low-power Bluetooth network, it sets itself as the master control device of the low-power Bluetooth network; otherwise, it sets itself as a non-master control device of the low-power Bluetooth network.

[0008] According to a second aspect of the present invention, a non-transitory computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the aforementioned method.

[0009] According to a third aspect of the present invention, there is provided an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the aforementioned method when executing the computer program.

[0010] The present invention has at least the following beneficial effects:

[0011] The present invention provides a method, device and medium for determining a master device of a low-power Bluetooth network. The method is applied to a communication device. In the method, when the device itself is a master device of a low-power Bluetooth network and responds to a new communication device joining the low-power Bluetooth network, the method obtains a master device determination score corresponding to the device itself and a master device determination score corresponding to the new communication device. When the master device determination score corresponding to the device itself is less than the master device determination score corresponding to the new communication device, the device itself is set as a non-master device of the low-power Bluetooth network, and master device determination information is sent to the new communication device, so that the new communication device sets itself as the master device of the low-power Bluetooth network when the master device determination information is received; when the device itself is a master device of a low-power Bluetooth network ... the master device determination information is sent to the new communication device. When the new communication device receives the master device determination information, the new communication device sets itself as the master device of the low-power Bluetooth network; when the device itself is When a non-master device of a low-power Bluetooth network exits the low-power Bluetooth network in response to the master device of the low-power Bluetooth network exiting the low-power Bluetooth network, the master device determination score corresponding to all communication devices in the current low-power Bluetooth network is obtained, and when the master device determination score corresponding to itself is the maximum value among the master device determination scores corresponding to all communication devices in the current low-power Bluetooth network, it is set as the master device of the low-power Bluetooth network, otherwise, it is set as the non-master device of the low-power Bluetooth network, wherein the master device determination score corresponding to the communication device is obtained based on the number of other communication devices in the current low-power Bluetooth network that directly communicate with the communication device, the power of the current communication device, and the RSSI signal strength of the current communication device. It can be seen that when determining the master device, the present invention takes into account the number of other communication devices that directly communicate with the communication device, the power of the communication device, and the RSSI signal strength of the communication device, and when a new communication device joins or an existing master device exits, the most suitable communication device can be re-evaluated and selected as the master device to ensure that the low-power Bluetooth network is always managed by the most suitable communication device, which is conducive to improving the overall performance and stability of the low-power Bluetooth network. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0013] Figure 1 A flowchart of a method for determining a master control device of a low-power Bluetooth network provided by an embodiment of the present invention;

[0014] Figure 2 The initial network connection relationship diagram in step S21 provided in an embodiment of the present invention;

[0015] Figure 3 This is a new initial network connection relationship diagram in step S22 provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0016] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0017] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar tasks, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0018] An embodiment of the present invention provides a method for determining a master control device of a low-power Bluetooth network, the method being applied to a communication device, the method comprising the following steps: Figure 1 As shown:

[0019] S001. When it is the master device of a low-power Bluetooth network and responds to a new communication device joining the low-power Bluetooth network, it obtains the master device determination score corresponding to itself and the master device determination score corresponding to the new communication device and proceeds to step S002. When it is a non-master device of a low-power Bluetooth network and responds to the master device of the low-power Bluetooth network exiting the low-power Bluetooth network, it obtains the master device determination scores corresponding to all communication devices in the current low-power Bluetooth network and proceeds to step S003, wherein the master device determination score corresponding to the communication device is obtained based on the number of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network, the power of the current communication device and the RSSI signal strength of the current communication device.

[0020] Specifically, step S001 further includes: when the device itself is a non-master device of the low-power Bluetooth network and receives the master device confirmation information, setting itself as the master device of the low-power Bluetooth network.

[0021] S002. When the master device determination score corresponding to itself is less than the master device determination score corresponding to the new communication device, set itself as a non-master device of the low-power Bluetooth network, and send master device determination information to the new communication device at the same time, so that the new communication device sets itself as the master device of the low-power Bluetooth network when receiving the master device determination information.

[0022] Specifically, step S002 also includes: when the master control device corresponding to the communication device determines the score is not less than the master control device corresponding to the new communication device determines the score, no processing is performed.

[0023] S003. When the master control device corresponding to itself determines the score that is the maximum value among the master control devices corresponding to all communication devices in the current low-power Bluetooth network, it sets itself as the master control device of the low-power Bluetooth network; otherwise, it sets itself as a non-master control device of the low-power Bluetooth network.

[0024] Through the above steps, the master control device determination score corresponding to the communication device is obtained based on the number of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network, the power of the current communication device and the RSSI signal strength of the current communication device. When determining the master control device, the number of other communication devices that directly communicate with the communication device, the power of the communication device and the RSSI signal strength of the communication device are taken into consideration. When it is the master control device of the low-power Bluetooth network and responds to a new communication device joining the low-power Bluetooth network, by comparing the master control device determination score corresponding to itself with the master control device determination score corresponding to the new communication device, a more suitable communication device is selected as the master control device. When it is the master control device of the low-power Bluetooth network When a non-master device responds to the master device of the low-power Bluetooth network exiting the low-power Bluetooth network, the most suitable device is dynamically selected as the master device by comparing the master device determination scores of each communication device. When a new communication device joins or an existing master device exits, the communication device corresponding to the larger master device determination score is selected as the master device, ensuring that the master role is assumed by the most suitable communication device, which is beneficial to improving the overall performance and stability of the low-power Bluetooth network, and when the low-power Bluetooth network changes, it can automatically, quickly and efficiently redetermine the master device of the low-power Bluetooth network, reducing the communication interruption time caused by the lack of the master device, and improving the overall performance and resource utilization of the network.

[0025] Specifically, obtaining a master control device corresponding to a communication device based on the number of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network, the power of the current communication device, and the RSSI signal strength of the current communication device to determine the score includes the following steps S0011-S0014:

[0026] S0011. Obtain the current device connection quantity E corresponding to the communication device, where E is the quantity of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network.

[0027] S0012. According to the preset power score mapping list F, obtain the current power score G corresponding to the communication device, where F = {F1, F2, ..., F i , ..., F m}, F i =(F i1 , F i2 ), F i is the i-th preset power score mapping combination, i ranges from 1 to m, m is the number of preset power score mapping combinations, F i1 F i The preset power interval in F i2 F i1 The corresponding preset power score, when F i11 ≤H≤F i12 When F i1 As G, where F i11 F i1 The minimum value, F i12 F i1 The maximum value of H is the current power of the communication device; in a specific embodiment, the preset power score mapping list is a list pre-set by technicians in this field according to actual needs, which will not be repeated here.

[0028] Specifically, F i12 <F (i+1)11 , F i2 =F (i+1)2 -1, F (i+1)11 F (i+1)1 The minimum value, F (i+1)1 F i+1 The preset power interval in F i+1 is the i+1th preset power score mapping combination, F (i+1)2 F (i+1)1 The corresponding preset power score.

[0029] S0013. According to the preset RSSI signal strength score mapping list R, obtain the current RSSI signal strength score J corresponding to the communication device, where R = {R1, R2, ..., R j , ..., R n}, R j =(R j1 , R j2 ), R jis the jth preset RSSI signal strength score mapping combination, where j ranges from 1 to n, and n is the number of preset RSSI signal strength score mapping combinations. j1 For R j The preset RSSI signal strength interval, R j2 For R j1 The corresponding preset RSSI signal strength score, when R j11 <K≤R j12 When R j2 As J, where R j11 For R j1 The minimum value, R j12 For R j1 The maximum value of K is the current RSSI signal strength of the communication device. In a specific embodiment, the preset RSSI signal strength score mapping list is a list preset by those skilled in the art according to actual needs, which will not be repeated here.

[0030] Specifically, R j12 <R (j+1)11 , R j2 =R (j+1)2 -1, R (j+1)11 For R (j+1)1 The minimum value, R (j+1)1 For R j+1 The preset RSSI signal strength interval, R j+1 is the j+1th preset RSSI signal strength score mapping combination, R (j+1)2 For R (j+1)1 The corresponding preset RSSI signal strength score.

[0031] S0014. Obtain the master control device corresponding to the communication device based on E, G and J to determine the score FZ, which meets the following conditions:

[0032] FZ=E+G+J.

[0033] Specifically, F m2 =R n2 = ZD, ZD is the maximum number of valid communication connections that the communication device can maintain simultaneously, F m2 F m1 The corresponding preset power score, F m1 F m The preset power interval in F m is the mth preset power score mapping combination, R n2 For R n1 The corresponding preset RSSI signal strength score, R n1 For R n The preset RSSI signal strength interval, R nIt is the nth preset RSSI signal strength score mapping combination.

[0034] Specifically, F 12 =R 12 =0, F 12 F 11 The corresponding preset power score, F 11 is the preset power interval in F1, F1 is the first preset power score mapping combination, R 12 For R 11 The corresponding preset RSSI signal strength score, R 11 is the preset RSSI signal strength interval in R1, and R1 is the first preset RSSI signal strength score mapping combination.

[0035] Specifically, the greater the master device determination score corresponding to the communication device is, the greater the possibility that the communication device is the master device of the low-power Bluetooth network.

[0036] Through the above steps, the master device determination score corresponding to the communication device is obtained according to the current number of device connections, the current power score and the current RSSI signal strength score of the communication device, providing a more comprehensive evaluation standard to ensure that the selection of the master device is not only based on a single factor, but takes multiple factors into consideration, providing a more accurate basis for selecting the master device, and selecting the communication device corresponding to the largest master device determination score as the master device, which can be understood as: selecting a communication device with a larger power supply, a larger RSSI signal strength and a larger number of other communication devices that directly communicate with the communication device as the master device; which is conducive to improving the connectivity and stability of the low-power Bluetooth network.

[0037] In a specific embodiment, the method further comprises the following steps to obtain F 11 , F 21 , ..., F i1 , ..., F m1 :

[0038] Get the preset power usage time mapping list L = {L1, L2, ..., L e , ..., L f}, L e =(L e1 , L e2 ), where L e is the e-th preset power usage duration mapping combination, where the value of e ranges from 1 to f, and f is the number of preset power usage duration mapping combinations. e1 is the e-th preset power, L e2 The power of the communication equipment is L e1 The estimated length of time that the communication equipment can continue to be used.

[0039] Specifically, L e <L e+1 , L e+1 This is the e+1th preset power level.

[0040] When L (e-1)2 <M<L e2 When F m11 =L e1 , let F m12 =100, where L (e-1)2 The power of the communication equipment is L (e-1)1 The estimated time that the communication equipment can continue to be used, L (e-1)1 is the e-1th preset power, F m11 F m1 The minimum value, F m12 F m1 The maximum value of M is the duration between the current time point and the end time point of the low-power Bluetooth network use. In a specific application scenario, the end time point of the low-power Bluetooth network use can be understood as the end time point of the voyage, and M can be understood as the remaining time of the voyage; for example: if there are still 120 minutes before the end of the low-power Bluetooth network use, then the value of M is 120; if there are still 120 minutes left in the voyage, then the value of M is 120.

[0041] The closed interval [0, F m11 -1] is divided into F m2 -1 closed interval as F 11 , F 21 , ..., F i1 , ..., F (m-1)1 , wherein those skilled in the art know that any method of dividing a closed interval into a plurality of closed intervals in the prior art, for example: average division, falls within the protection scope of the present invention, and will not be described in detail here.

[0042] Through the above steps, the preset power range in the preset power score mapping combination is determined according to the preset power, the estimated length of time the communication device can continue to be used, and the length of time between the current time point and the end time point of the use of the low-power Bluetooth network. The preset power range can be flexibly determined according to actual conditions, which is conducive to improving the accuracy of determining the preset power range.

[0043] Specifically, before step S001, the following steps S01-S02 are included:

[0044] S01. When a low-power Bluetooth network joining instruction is received, a Bluetooth signal search is performed.

[0045] S02. When no Bluetooth signal can be found, a low-power Bluetooth network is established and the device is set as the master device of the low-power Bluetooth network, while continuing to search for Bluetooth signals; when a Bluetooth signal can be found, the device joins the low-power Bluetooth network and sets itself as a non-master device of the low-power Bluetooth network.

[0046] Through the above steps, when no Bluetooth signal can be searched, a low-power Bluetooth network is established and itself is set as the master device of the low-power Bluetooth network, and the Bluetooth signal search is continued. When the Bluetooth signal can be searched, the low-power Bluetooth network is joined and itself is set as a non-master device of the low-power Bluetooth network. This enables the communication device to quickly determine whether it is the master device of the low-power Bluetooth network based on the current network environment, and avoids unnecessary creation of new networks, which is beneficial to the stability and connectivity of the low-power Bluetooth network.

[0047] In a specific embodiment, the following steps S010-S040 are included before step S001:

[0048] S010. When a low-power Bluetooth network joining instruction is received, a Bluetooth signal search is performed.

[0049] S020. When no Bluetooth signal can be found, a low-power Bluetooth network is established; when a Bluetooth signal can be found, a low-power Bluetooth network is joined.

[0050] S030. If DQ is less than YS, set itself as a non-master device of the low-power Bluetooth network; if DQ is equal to YS, obtain the master device corresponding to all communication devices in the current low-power Bluetooth network to determine the score, wherein DQ is the number of communication devices in the current low-power Bluetooth network. The low-power Bluetooth network includes several communication devices, and communication connections are established and maintained between the communication devices based on the low-power Bluetooth protocol. YS is the preset number of devices, which is the number of devices pre-set by technicians in this field according to actual needs, such as 10, 20, 30, which will not be repeated here.

[0051] S040. If the master control device corresponding to itself determines the score that is the maximum value among the master control device determination scores corresponding to all communication devices in the current low-power Bluetooth network, then set itself as the master control device of the low-power Bluetooth network; otherwise, set itself as a non-master control device of the low-power Bluetooth network.

[0052] Through the above steps, when the current number of devices is less than the preset number of devices, it means that the number of communication devices in the low-power Bluetooth network is small. At this time, without setting a master device, the working efficiency and stability of the low-power Bluetooth network can be guaranteed, and unnecessary resource consumption is reduced. When the current number of devices is equal to the preset number of devices, the most suitable device is dynamically selected as the master device by comparing the scores determined by the master devices of each communication device, ensuring that the master role is assumed by the most suitable communication device, which is conducive to improving the overall performance and resource utilization of the low-power Bluetooth network.

[0053] In a specific embodiment, step S003 further includes the following steps S1-S2:

[0054] S1. If the device is a master device of a low-power Bluetooth network and the low-power Bluetooth network has not been optimized, then in response to a new communication device joining the low-power Bluetooth network, DQ is obtained.

[0055] Specifically, in a low-power Bluetooth network, when a new communication device joins the low-power Bluetooth network, the new communication device maintains a communication connection relationship with all other communication devices that can establish a communication connection with it. At the same time, the maintained communication connection relationship will be stored in the initial routing table corresponding to the low-power Bluetooth network.

[0056] In a specific embodiment, the initial routing table corresponding to the low-power Bluetooth network records the communication connection relationship between each communication device in the low-power Bluetooth network and all other communication devices, and the communication connection relationship includes a connection state, and the connection state includes a maintain connection state and a disconnection state.

[0057] Furthermore, if the connection state in the communication connection relationship between two communication devices is to maintain the connection state, it indicates that the two communication devices communicate directly. Direct communication means that the two communication devices can communicate without going through other devices. For example, communication device 1 and communication device 2 communicate directly without going through other communication devices.

[0058] Furthermore, if the connection state in the communication connection relationship between two communication devices is a disconnected state, it indicates that the two communication devices are not directly connected for communication, for example, communication device 1 and communication device 2 communicate through communication device 3 .

[0059] S2. If DQ ≥ YS, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network.

[0060] Specifically, optimizing the low-power Bluetooth network according to the initial routing table corresponding to the low-power Bluetooth network includes the following steps S21-S23:

[0061] S21, constructing an initial network connection relationship diagram corresponding to the low-power Bluetooth network according to the initial routing table corresponding to the low-power Bluetooth network, wherein, Figure 2 As shown, the initial network connection relationship diagram includes several nodes and edges. The nodes represent communication devices in the low-power Bluetooth network, and the edges represent direct communication between two communication devices corresponding to the nodes at both ends of the edge. Each edge is attached with the total communication quality weight of the two communication devices corresponding to the nodes at both ends of the edge. The total communication quality weight is used to measure the communication quality between the two communication devices.

[0062] Specifically, the smaller the total communication quality weight is, the better the communication quality between the corresponding two communication devices is.

[0063] Specifically, step S2 also includes: if DQ<YS, no processing is performed.

[0064] Specifically, step S21 includes the following steps S211-S215 to obtain the total communication quality weight of two communication devices corresponding to the nodes at both ends of the edge:

[0065] S211. Use two communication devices corresponding to the nodes at both ends of the edge as the first initial device and the second initial device respectively.

[0066] S212. Obtain a first power level, a first RSSI signal strength, a second power level, and a second RSSI strength, wherein the first power level is the power level of the first initial device, the first RSSI signal strength is the RSSI signal strength of the first initial device, the second power level is the power level of the second initial device, and the second RSSI signal strength is the RSSI signal strength of the second initial device.

[0067] S213. According to the first preset weight influence value mapping list, obtain a first electricity weight influence value corresponding to the first electricity and a second electricity weight influence value corresponding to the second electricity, wherein the first preset weight influence value mapping list includes a plurality of preset electricity intervals and first preset weight influence values ​​corresponding to the preset electricity intervals. When the first electricity belongs to a preset electricity interval, the first preset weight influence value corresponding to the preset electricity interval to which the first electricity belongs is used as the first electricity weight influence value corresponding to the first electricity. When the second electricity belongs to a preset electricity interval, the first preset weight influence value corresponding to the preset electricity interval to which the second electricity belongs is used as the second electricity weight influence value corresponding to the second electricity. Persons skilled in the art know that the first preset weight influence value mapping list is a list pre-set by those skilled in the art according to actual needs and will not be repeated here.

[0068] Specifically, the larger the preset power interval is, the larger the corresponding first power weight influence value is. For example, the preset power intervals are [0%, 20%), [20%, 40%), [40%, 60%), [60%, 100%); the first preset weight influence value corresponding to [0%, 20%) is 0, the first preset weight influence value corresponding to [20%, 40%) is 1, the first preset weight influence value corresponding to [40%, 60%) is 2, and the first preset weight influence value corresponding to [60%, 100%) is 3.

[0069] S214. According to the second preset weight influence value mapping list, obtain the first RSSI signal strength weight influence value corresponding to the first RSSI signal strength and the second RSSI signal strength weight influence value corresponding to the second RSSI signal strength, wherein the second preset weight influence value mapping list includes several preset RSSI signal strength intervals and second preset weight influence values ​​corresponding to the preset RSSI signal strength intervals. When the first RSSI signal strength belongs to a preset RSSI signal strength interval, the second preset weight influence value corresponding to the preset RSSI signal strength interval to which the first RSSI signal strength belongs is used as the first RSSI signal strength weight influence value corresponding to the first RSSI signal strength. When the second RSSI signal strength belongs to a preset RSSI signal strength interval, the second preset weight influence value corresponding to the preset RSSI signal strength interval to which the second RSSI signal strength belongs is used as the second RSSI signal strength weight influence value corresponding to the second RSSI signal strength. Persons skilled in the art know that the second preset weight influence value mapping list is a list pre-set by those skilled in the art according to actual needs and will not be repeated here.

[0070] Specifically, the larger the preset RSSI signal strength interval, the greater the corresponding second power weight influence value. For example, the preset power intervals are (-∞, -120), [-120, -90), [-90, -60), and [-60, 0]; the second preset weight influence value corresponding to (-∞, -120) is 0, the second preset weight influence value corresponding to [-120, -90) is 1, the second preset weight influence value corresponding to [-90, -60) is 2, and the second preset weight influence value corresponding to [-60, 0] is 3.

[0071] S215. The sum of the communication quality weight corresponding to the first initial device and the communication quality weight corresponding to the second initial device is used as the total communication quality weight representing the communication quality between the first initial device and the second initial device, wherein the communication quality weight corresponding to the first initial device is the difference between the preset communication quality weight and the first power weight influence value and the first RSSI signal strength weight influence value, and the communication quality weight corresponding to the second initial device is the difference between the preset communication quality weight and the second power weight influence value and the second RSSI signal strength weight influence value.

[0072] Specifically, the preset communication quality weight used to obtain the communication quality weight corresponding to the first initial device is the same as the preset communication quality weight used to obtain the communication quality weight corresponding to the second initial device. Those skilled in the art know that the preset communication quality weight is a weight pre-set by those skilled in the art according to actual needs and will not be repeated here.

[0073] Through the above steps, the total communication quality weight of the first initial device and the second initial device is obtained by quantifying the power of the first initial device and the second initial device and the RSSI signal strength. The lower the power, the worse the communication quality, and too low power may mean that the communication device is about to be powered off or the user using the communication device actively exits the low-power Bluetooth network. The smaller the RSSI signal strength, the worse the communication quality, and when the RSSI signal strength is small, the user using the communication device may also actively exit the low-power Bluetooth network, which will directly affect the communication capability of the communication device. Therefore, the total communication quality weight of the first initial device and the second initial device is obtained according to the power of the first initial device and the second initial device and the RSSI signal strength, which takes into account the key factors that actually affect the communication quality, can more accurately reflect the communication quality status between communication devices, and provides a basis for optimizing the low-power Bluetooth network.

[0074] S22, copy the initial network connection relationship graph as the historical network connection relationship graph, and use the minimum spanning tree corresponding to the initial network connection relationship graph as the new initial network connection relationship graph so as to update the initial network connection relationship graph, such as Figure 3 As shown, the minimum spanning tree corresponding to the initial network connection relationship graph contains all the nodes in the initial network connection relationship graph and the edges connecting these nodes, and the sum of the total communication quality weights attached to all edges is the smallest.

[0075] S23. Generate an intermediate routing table based on the new initial network connection relationship diagram and send the intermediate routing table to all communication devices except itself in the low-power Bluetooth network, so that the communication device that receives the intermediate routing table determines whether to disconnect the communication connection between itself and other communication devices based on the communication connection relationship recorded in the intermediate routing table, so as to optimize the low-power Bluetooth network. At the same time, the intermediate routing table is used as the initial routing table corresponding to the low-power Bluetooth network, wherein the intermediate routing table records the communication connection relationship between the communication devices corresponding to each node in the initial network connection relationship diagram.

[0076] Specifically, step S1 also includes: if itself is a non-master control device of the low-power Bluetooth network, then when the intermediate routing table is received, it determines whether to disconnect the communication connection between itself and other communication devices according to the communication connection relationship between itself and other communication devices recorded in the intermediate routing table, so as to achieve the optimization of the low-power Bluetooth network, wherein, if in the low-power Bluetooth network, itself communicates directly with a certain communication device, but the communication connection relationship is not recorded in the intermediate routing table, then it is set that it needs to disconnect the communication connection with the communication device; for example: in the low-power Bluetooth network, if communication device 1 and communication device 2 communicate directly, but the communication connection relationship between communication device 1 and communication device 2 is not recorded in the intermediate routing table received by communication device 1, or the connection state in the communication connection relationship between communication device 1 and communication device 2 recorded in the intermediate routing table received by communication device 1 is a disconnected state, then communication device 1 sets itself to disconnect the communication connection with communication device 2.

[0077] Through the above steps, an initial network connection relationship graph corresponding to the low-power Bluetooth network is constructed according to the initial routing table corresponding to the low-power Bluetooth network, the minimum spanning tree corresponding to the initial network connection relationship graph is used as a new initial network connection relationship graph to update the initial network connection relationship graph, an intermediate routing table is generated according to the new initial network connection relationship graph and the intermediate routing table is sent to all communication devices except itself in the low-power Bluetooth network, so that the communication device that receives the intermediate routing table determines whether to disconnect the communication connection between itself and other communication devices according to the communication connection relationship recorded in the intermediate routing table, so as to achieve the optimization of the low-power Bluetooth network, dynamically adjust the network connection relationship and routing strategy, reduce unnecessary communication connections while maintaining communication quality, thereby reducing resource consumption, effectively improving the working efficiency and stability of the low-power Bluetooth network, and reducing the negative impact caused by the low-power Bluetooth transmission distance limitation and too many communication device connections.

[0078] In a specific embodiment, after step S003, step S10 is further included:

[0079] S10. If it is the master device of the low-power Bluetooth network and the low-power Bluetooth network has been optimized, then in response to a new communication device joining the low-power Bluetooth network, obtain the current device identification list and optimize the low-power Bluetooth network based on the current device identification list, wherein the current device identification list includes several current device identifications, and the current device identification is the identity identification of the communication device in the current low-power Bluetooth network.

[0080] Specifically, in step S10, optimizing the low-power Bluetooth network based on the current device identification list includes the following steps S11-S13:

[0081] S11. Obtain a target device identification list and a target optimization time point. The target device identification list includes several target device identifications. The target optimization time point is the time point when the low-power Bluetooth network was most recently optimized. The target device identification is the identity identification of the communication device in the low-power Bluetooth network at the target optimization time point.

[0082] S12: Taking the symmetric difference between the current device identification list and the target device identification list as an intermediate device identification list, wherein the intermediate device identification list includes a plurality of intermediate device identifications.

[0083] S13, when ZJ>YS 0 Or when A / B>C, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network, where ZJ is the time difference between the current time point and the target optimization time point, and YS 0 is the preset time difference, A is the number of intermediate device identifiers in the intermediate device identifier list, B is the number of current device identifiers in the current device identifier list, and C is the preset device quantity change ratio. Technical personnel in this field know that the preset time difference is the time difference pre-set by technical personnel in this field according to actual needs, for example: 10 minutes, and the preset device quantity change ratio is a value pre-set by technical personnel in this field according to actual needs, for example: 0.2, which will not be repeated here.

[0084] Through the above steps, when the low-power Bluetooth has been optimized, the current device identification list is obtained, the target device identification list and the target optimization time point are obtained, and the symmetric difference set of the current device identification list and the target device identification list is used as the intermediate device identification list. When the time difference between the current time point and the target optimization time point is not less than the preset time difference, or the quotient of the number of intermediate device identifications in the intermediate device identification list divided by the number of current device identifications in the current device identification list is not less than the preset device quantity change ratio, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network, and combined with the change ratio and time difference of communication devices in the low-power Bluetooth network (communication devices joining and exiting), it is determined whether the network needs to be re-optimized, thereby avoiding the extra calculation and communication overhead caused by frequent optimization, while maintaining the communication quality, reducing unnecessary communication connections, thereby reducing resource consumption, not only improving the optimization efficiency, but also reducing the power consumption of communication devices, and effectively improving the working efficiency and stability of the low-power Bluetooth network.

[0085] Specifically, step S13 also includes: when ZJ≤YS 0 And when A / B≤C, no processing is performed.

[0086] In a specific embodiment, after step S003, the following steps S20-S70 are also included:

[0087] S20. If it is the master device of the low-power Bluetooth network and the low-power Bluetooth network has been optimized, then in response to the communication device exiting the low-power Bluetooth network, the communication device exiting the low-power Bluetooth network will be treated as a key device and the number of node connections corresponding to the key device will be obtained. The number of node connections is the number of other nodes in the initial network connection relationship diagram that are directly connected to the node corresponding to the key device through edges.

[0088] Specifically, if it is a non-master device of a low-power Bluetooth network, then when it fails to receive a heartbeat signal sent by a communication device that is communicating directly with it for D seconds, it determines that the communication device that is communicating directly with it has exited the low-power Bluetooth network. At this time, the identity identification and network exit information of the communication device that is communicating directly with it are sent to the master device of the low-power Bluetooth network, where the network exit information is information indicating that the communication device has exited the low-power Bluetooth network, wherein D is a preset heartbeat signal sending interval duration. Those skilled in the art know that the preset heartbeat signal sending interval duration is a duration pre-set by those skilled in the art based on actual needs, which will not be elaborated here.

[0089] S30. If the number of node connections corresponding to the key device is greater than 1, the nodes corresponding to the key device and the edges connecting the nodes are deleted from the historical network connection relationship graph to obtain a first key network connection relationship graph, and the nodes corresponding to the key device and the edges connecting the nodes are deleted from the initial network connection relationship graph to obtain a second key network connection relationship graph; if the number of connection nodes corresponding to the key device is equal to 1, no processing is performed.

[0090] S40, marking the edge that exists in the first key network connection relationship graph but does not exist in the second key network connection relationship graph as a candidate edge. For example: if the first key network connection relationship graph includes node 1, node 2 and node 3, node 1 and node 2 are connected by an edge, node 1 and node 3 are connected by an edge, and node 2 and node 3 are connected by an edge, and the second key network connection relationship graph includes node 1, node 2 and node 3, node 1 and node 2 are connected by an edge, and node 2 and node 3 are connected by an edge, then the edge connecting node 1 and node 3 is an edge that exists in the first key network connection relationship graph but does not exist in the second key network connection relationship graph.

[0091] S50: Mark the candidate edge corresponding to the smallest total communication quality weight among the total communication quality weights attached to all candidate edges as the target edge.

[0092] S60: Use the communication devices corresponding to the nodes at both ends of the target edge in the first key network connection relationship graph as the first intermediate device and the second intermediate device corresponding to the first intermediate device respectively.

[0093] S70. Send the second intermediate device connection information to the first intermediate device, so that the first intermediate device establishes a communication connection with the corresponding second intermediate device when receiving the second intermediate device connection information, so as to optimize the low-power Bluetooth network.

[0094] Through the above steps, if it is the master device of the low-power Bluetooth network and the low-power Bluetooth network has been optimized, then in response to the communication device exiting the low-power Bluetooth network, the communication device exiting the low-power Bluetooth network is used as a key device and the number of node connections corresponding to the key device is obtained. According to the number of node connections corresponding to the key device, when the number of node connections corresponding to the key device is greater than 1, the first key network connection relationship graph and the second key network connection relationship graph are obtained, and the edges that exist in the first key network connection relationship graph but not in the second key network connection relationship graph are marked as candidate edges, and the candidate edge corresponding to the smallest total communication quality weight among all the candidate edges is marked as the target edge, and the communication devices corresponding to the nodes at both ends of the target edge in the first key network connection relationship graph are respectively used as the first The intermediate device and the second intermediate device corresponding to the first intermediate device send the second intermediate device connection information to the first intermediate device, so that the first intermediate device establishes a communication connection with the corresponding second intermediate device when receiving the second intermediate device connection information, so as to optimize the low-power Bluetooth network and respond quickly when the communication device exits, thereby avoiding communication interruption or network instability caused by sudden disconnection of the communication device. By constructing a first key network connection relationship graph and a second key network connection relationship graph, and marking candidate edges and target edges, the first intermediate device and the second intermediate device are determined according to the target edge, so that the first intermediate device establishes a communication connection with the corresponding second intermediate device when receiving the second intermediate device connection information, and can intelligently select the optimal alternative path to ensure the continuity of the network connection and the communication quality.

[0095] In a specific embodiment, after step S30 and before step S60, the following steps S40-S50 are included:

[0096] S40. Obtain a minimum spanning tree corresponding to the first key network connection relationship graph, wherein the minimum spanning tree corresponding to the first key network connection relationship graph includes all nodes in the first key network connection relationship graph and edges connecting these nodes, and the sum of the total communication quality weights attached to all edges is the smallest.

[0097] S50. Mark the edge that exists in the minimum spanning tree corresponding to the first key network connection relationship graph but does not exist in the second key network connection relationship graph as the target edge; for example: if the minimum spanning tree corresponding to the first key network connection relationship graph includes node 1, node 2 and node 3, node 1 and node 2 are connected by an edge, node 1 and node 3 are connected by an edge, and node 2 and node 3 are connected by an edge, and the second key network connection relationship graph includes node 1, node 2 and node 3, node 1 and node 2 are connected by an edge, and node 2 and node 3 are connected by an edge, then the edge connecting node 1 and node 3 is an edge that exists in the minimum spanning tree corresponding to the first key network connection relationship graph but does not exist in the second key network connection relationship graph.

[0098] Through the above steps, the target edge is obtained through the minimum spanning tree corresponding to the first key network connection relationship graph and the second key network connection relationship graph, and the first intermediate device and the second intermediate device are determined according to the target edge, so that the first intermediate device establishes a communication connection with the corresponding second intermediate device when receiving the connection information of the second intermediate device, and can intelligently select the optimal alternative path to ensure the continuity of the network connection and the communication quality, avoiding communication interruption or network instability caused by sudden disconnection of the communication device.

[0099] Specifically, step S20 also includes: if the device itself is the master device of the low-power Bluetooth network and the low-power Bluetooth network has not been optimized, then in response to the communication device exiting the low-power Bluetooth network, no processing is performed.

[0100] In a specific embodiment, after step S003, the following steps S100-S600 are also included:

[0101] S100: If the device is a master device of the low-power Bluetooth network and the low-power Bluetooth network has been optimized, in response to a new communication device joining the low-power Bluetooth network, obtain DQ.

[0102] S200, when Q>ZK, obtain Q cluster core devices, when Q≤ZK, do not perform any processing, where Q is the device multiple value, ZK is the number of master control devices in the current low-power Bluetooth network, and Q meets the following conditions:

[0103] Q=floor(DQ / YS), floor() is a floor rounding function.

[0104] S300. The identities corresponding to the Q clustering core devices are respectively used as the Q cluster centers in the k-means clustering algorithm, and the total communication quality weight between the communication device in the low-power Bluetooth network and the clustering core devices corresponding to the cluster centers is used as the distance between the identity of the communication device and the cluster center, and the identities of all communication devices in the current low-power Bluetooth network are clustered based on the k-means clustering algorithm to obtain Q clusters and several discrete identities, each cluster including several cluster identities.

[0105] Specifically, a discrete identity can be understood as an identity that is not clustered among the identities of all communication devices in the Bluetooth low energy network.

[0106] S400: Using a network formed by communication devices corresponding to all clustering identities in a single cluster as a single low-power Bluetooth sub-network to obtain Q low-power Bluetooth sub-networks.

[0107] Specifically, the method also includes: sending full connection information to the communication device corresponding to the discrete identity identifier, so that when the communication device corresponding to the discrete identity identifier receives the full connection information, it maintains a communication connection relationship with all other communication devices in the low-power Bluetooth network that can establish a communication connection with it.

[0108] S500. When it is a cluster core device, it sets itself as the master device of the low-power Bluetooth sub-network where it is located, and sends master device confirmation information to other cluster core devices, so that when other cluster core devices receive the master device confirmation information, they set themselves as the master device of the low-power Bluetooth network and also set themselves as the master device of the low-power Bluetooth sub-network where they are located; when it is not a cluster core device, it sets itself as a non-master device of the low-power Bluetooth network, and sends master device confirmation information to all cluster core devices, so that when other cluster core devices receive the master device confirmation information, they set themselves as the master device of the low-power Bluetooth network and also set themselves as the master device of the low-power Bluetooth sub-network where they are located.

[0109] S600. When it is the master control device of the low-power Bluetooth sub-network, the low-power Bluetooth sub-network is optimized according to the initial routing table corresponding to the low-power Bluetooth sub-network, wherein the initial routing table corresponding to the low-power Bluetooth sub-network records the communication connection relationship between each communication device in the low-power Bluetooth sub-network and all other communication devices, wherein the low-power Bluetooth sub-network is optimized according to the initial routing table corresponding to the low-power Bluetooth sub-network in the same manner as that of optimizing the low-power Bluetooth network according to the initial routing table corresponding to the low-power Bluetooth sub-network in steps S21-S23.

[0110] Through the above steps, if it is the master device of the low-power Bluetooth network and the low-power Bluetooth network has been optimized, then in response to a new communication device joining the low-power Bluetooth network, the current number of devices is obtained, and the device multiplier value is obtained according to the current number of devices. When the device multiplier value is greater than the number of master devices in the current low-power Bluetooth network, the clustering core device is determined, and the identity identifiers of all communication devices in the low-power Bluetooth network are clustered based on the k-means algorithm to obtain the cluster corresponding to each clustering core device. The network composed of the communication devices corresponding to all clustering identities in a single cluster is used as a single low-power Bluetooth sub-network, and the clustering core device is set as the master device of the low-power Bluetooth network and the low-power Bluetooth sub-network. When When it is the master device of a low-power Bluetooth sub-network, it optimizes the low-power Bluetooth sub-network according to the initial routing table corresponding to the low-power Bluetooth sub-network. It optimizes only when a new communication device is added and the device multiplier value is greater than the number of master devices in the current low-power Bluetooth network, thus avoiding the waste of resources caused by frequent optimization. When optimizing the low-power Bluetooth network, it uses the k-means algorithm to dynamically divide the network according to the communication quality weights between communication devices to obtain several low-power Bluetooth sub-networks. It can flexibly respond to changes in network topology and can optimize the low-power Bluetooth sub-networks at the same time, so it can quickly complete the optimization of the low-power Bluetooth network, which is beneficial to improving the performance and optimization efficiency of the low-power Bluetooth network.

[0111] In a specific embodiment, after step S600, the following steps S110-S160 are also included:

[0112] S110: When the device is the master control device of the low-power Bluetooth sub-network and the low-power Bluetooth sub-network has been optimized, the low-power Bluetooth sub-network in which the device is located is used as the first sub-network, and other low-power Bluetooth sub-networks except the first sub-network are used as the second sub-network.

[0113] S120, obtain a first designated device identification list X corresponding to the first sub-network = {X1, X2, . . . , X a , ..., X c} and the second designated device identification list set Y corresponding to X = {Y1, Y2, ..., Y a , ..., Y c},Y a = {Y a1 , Y a2 , ..., Y ab , ..., Y ad}, where X ais the ath first designated device identifier corresponding to the first sub-network, a is a value from 1 to c, c is the number of first designated device identifiers corresponding to the first sub-network, wherein the first designated device identifier is the identity identifier of the first designated device, and the first designated device is a communication device in the first sub-network that directly communicates with the communication device in the second sub-network, and Y a For X a The corresponding second specified device identification list, Y ab For X a The corresponding b-th second designated device identifier, b is from 1 to d, d is X a The number of corresponding second designated device identifiers, the second designated device identifier is the identity identifier of the second designated device, and the second designated device is a communication device in the second sub-network that directly communicates with the first designated device.

[0114] S130, X a The corresponding first specified device and Y ab The total communication quality weight of the corresponding second designated device is taken as Y ab The corresponding first specified weight is obtained by adopting the same method as that of obtaining the total communication quality weight of the two communication devices corresponding to the nodes at both ends of the edge in steps S211-S215 to obtain X a The corresponding first specified device and Y ab The corresponding communication quality weight of the second designated device.

[0115] S140: Send disconnection information to all first designated devices, so that the first designated device disconnects the communication connection with the second designated device corresponding to itself when receiving the disconnection information.

[0116] S150. The second designated device corresponding to the second designated device identifier corresponding to the minimum first designated weight is used as the third designated device, and the first designated device corresponding to the first designated device identifier corresponding to the minimum first designated weight is used as the fourth designated device corresponding to the third designated device, wherein the minimum first designated weight is the minimum value of the first designated weights corresponding to all second designated device identifiers in the list of all second designated device identifiers.

[0117] S160: Send the third designated device connection information to the fourth designated device, so that the fourth designated device establishes a communication connection with the corresponding third designated device when receiving the third designated device connection information.

[0118] Through the above steps, the first sub-network and the second sub-network are determined, and the third designated device and the fourth designated device are determined according to the first designated device in the first sub-network and the second designated device corresponding to the first designated device in the second sub-network, and a disconnection message is sent to all the first designated devices, so that the first designated device disconnects the communication connection with the second designated device corresponding to itself when receiving the disconnection message, and the third designated device connection information is sent to the fourth designated device, so that the fourth designated device establishes a communication connection with the third designated device corresponding to it when receiving the third designated device connection information, so that all communication devices in the first sub-network and all communication devices in the second sub-network can communicate indirectly only through the third designated device and the fourth designated device, thereby reducing unnecessary communication connections, thereby reducing resource consumption, and effectively improving the working efficiency and stability of the low-power Bluetooth network.

[0119] Specifically, step S200 also includes the following steps S210-S270 to obtain Q cluster core devices:

[0120] S210: Obtain a master control device corresponding to each communication device in the current low-power Bluetooth network to determine a score.

[0121] S220, select Q from all communication devices in the current low-power Bluetooth network in descending order of the scores determined by the master control device. 0 A communication device is selected as the first candidate device, Q 0 Determine the number of devices to be selected, Q 0 Meet the following conditions: Q 0 =2×Q.

[0122] S230, obtain a second list of device identification combinations to be selected T = {T1, T2, ..., T g , ..., T h}, T g is the gth second device identification combination to be selected, the value of g ranges from 1 to h, h is the number of second device identification combinations to be selected, T g The second device identifier to be selected includes Q second device identifiers, where the second device identifier to be selected is the identity identifier of the second device to be selected, wherein Q 0 Q first to-be-selected devices are randomly selected from the first to-be-selected devices as second to-be-selected devices corresponding to the Q second to-be-selected device identifiers in a second to-be-selected device identifier combination.

[0123] S240, from T g Randomly select two second candidate device identifiers as T g The two third candidate device identifiers in a corresponding third candidate device identifier combination are used to obtain T g The corresponding third candidate device identification combination list U g = {Ug1 , U g2 , ..., U gr , ..., U gs}, where U gr T g The corresponding rth third candidate device identification combination, r is from 1 to s, s is T g The corresponding third device identification combination to be selected, the third device identification to be selected is the identity identification of the third device to be selected.

[0124] S250, Get U gr The total communication quality weight W between the third candidate devices corresponding to the two third candidate device identifiers in gr .

[0125] S260, according to W gr Get T g The corresponding second intermediate weight N g , N g Meet the following conditions:

[0126] N g =∑ s r=1 W gr .

[0127] S270, N1, N2, ..., N g , ..., N h The second to-be-selected devices corresponding to the Q second to-be-selected device identifiers in the second to-be-selected device identifier combination list corresponding to the largest second intermediate weight are used as Q clustering core devices.

[0128] Through the above steps, the master control device determination score corresponding to each communication device in the current low-power Bluetooth network is obtained, the first candidate device is determined according to the master control device determination score, and the second candidate device identification combination list is obtained based on the first candidate device. Further, the third candidate device identification combination corresponding to the second candidate device identification combination is obtained, and the total communication quality weight between the third candidate devices corresponding to the two third candidate device identifications in the third candidate device identification combination is obtained. Further, the second intermediate weight corresponding to the second candidate device identification combination is obtained, and the second candidate device corresponding to the second candidate device identification in the second candidate device identification combination list corresponding to the largest second intermediate weight among all second candidate device identification combinations is used as the clustering core device, thereby ensuring that the finally selected clustering core device not only has a higher master control device determination score, but also has the best communication quality.

[0129] Specifically, step S250 includes the following steps S251-S254:

[0130] S251, if Ugr The two third candidate devices corresponding to the two third candidate device identifiers in the two third candidate devices communicate directly, and the total weight of the communication quality of the two third candidate devices is taken as W gr , wherein the total communication quality weights of the two third candidate devices are obtained in the same manner as that of obtaining the total communication quality weights of the two communication devices corresponding to the nodes at both ends of the edge in steps S211-S215.

[0131] S252. If U gr The two third to-be-selected devices corresponding to the two third to-be-selected device identifiers in the indirect communication are used as U gr A fourth candidate device identifier in a corresponding fourth candidate device identifier list is used to obtain U gr The corresponding fourth candidate device identification list set V gr = {V gr1 , V gr2 , ..., V grx , ..., V grp},V grx = {V grx1 , V grx2 , ..., V grxy , ..., V grxq},V grx For U gr The corresponding xth fourth candidate device identification list, x ranges from 1 to p, p is U gr The number of the corresponding fourth candidate device identification list, V grxy V grx The yth fourth device to be selected identifier in the fourth device to be selected identifier list, where y ranges from 1 to q, and q is the number of fourth device to be selected identifiers in the fourth device to be selected identifier list.

[0132] Specifically, indirect communication means that two communication devices need to communicate through one or more other communication devices that act as relays; for example: if communication device 1 and communication device 2 communicate through communication device 3, communication device 4 and communication device 5, then communication device 1 and communication device 2 communicate indirectly, and communication device 3, communication device 4 and communication device 5 act as relays in the indirect communication process.

[0133] Specifically, V grxy The corresponding fourth candidate device and V grx(y+1) The corresponding fourth candidate device directly communicates, V grx(y+1) V grx The y+1th fourth device identifier to be selected.

[0134] S253, Get V grxThe corresponding first intermediate weight V 0 grx , V 0 grx Meet the following conditions:

[0135] V 0 grx =∑ q-1 y=1 V 1 grxy , V 1 grxy V grxy The corresponding fourth candidate device and V grx(y+1) The total communication quality weight of the fourth candidate device corresponding to the node at both ends of the edge is obtained in the same manner as in steps S211-S215 to obtain the total communication quality weight of the two communication devices corresponding to the nodes at both ends of the edge, to obtain V grxy The corresponding fourth candidate device and V grx(y+1) The corresponding total weight of the communication quality of the fourth candidate device.

[0136] S254, V 0 grx1 , V 0 grx2 , ..., V 0 grxy , ..., V 0 grxq The smallest first intermediate weight is W gr .

[0137] Through the above steps, if the two third to be selected devices corresponding to the two third to be selected device identifiers in the third to be selected device identifier combination communicate directly, the total communication quality weight of the two third to be selected devices is used as the total communication quality weight between the two third to be selected devices; if the two third to be selected devices corresponding to the two third to be selected device identifiers in the third to be selected device identifier combination communicate indirectly, a fourth to be selected device identifier list set corresponding to the third to be selected device identifier combination is obtained, and the first intermediate weight corresponding to the fourth to be selected device identifier list is obtained according to the total communication quality weight of the fourth to be selected devices corresponding to two adjacent fourth to be selected device identifiers in the fourth to be selected device identifier list, and the minimum value of the first intermediate weights corresponding to all the fourth to be selected device identifier lists is used as the total communication quality weight of the two third to be selected devices as the total communication quality weight between the two third to be selected devices, and the communication quality of each communication path is accurately quantified, providing a basis for selecting the optimal clustering core device.

[0138] In a specific embodiment, after step S003, the following steps S1000-S6000 are also included:

[0139] S1000: If the device is a master control device of a low-power Bluetooth network, in response to a new communication device joining the low-power Bluetooth network, obtain a current device identification list.

[0140] S2000: Acquire a plurality of direct communication device identifiers corresponding to each current device identifier, where the direct communication device identifier is an identity identifier of a communication device that directly communicates with the communication device corresponding to the current device identifier in a low-power Bluetooth network.

[0141] S3000. The total communication quality weight of the communication device corresponding to the current device identifier and the communication device corresponding to the direct communication device identifier is used as the first stability weight corresponding to the current device identifier, wherein the total communication quality weight of the communication device corresponding to the current device identifier and the communication device corresponding to the direct communication device identifier is obtained in the same manner as that of obtaining the total communication quality weight of the two communication devices corresponding to the nodes at both ends of the edge in steps S211-S215.

[0142] S4000: Taking the minimum value of all first stability weights corresponding to the current device identifier as the second stability weight corresponding to the current device identifier.

[0143] Specifically, the smaller the second stability weight corresponding to the current device identifier is, the more stable the network directly communicating with the communication device corresponding to the current device identifier is.

[0144] S5000. Obtain the number of stable devices WD, where WD is the number of current device identifiers whose corresponding second stability weight is less than the preset stability weight. Those skilled in the art know that the preset stability weight is a weight preset and set by those skilled in the art according to actual needs, and will not be described in detail here.

[0145] S6000, if DQ ≥ YS and WD ≥ WD 0 , when the low-power Bluetooth network has not been optimized, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network. When the low-power Bluetooth network has been optimized, the low-power Bluetooth network is optimized based on the current device identification list, where WD 0 It is a preset stable device ratio. Those skilled in the art know that the preset stable device ratio is set by those skilled in the art according to actual needs and will not be described in detail here.

[0146] Through the above steps, in response to a new communication device joining the low-power Bluetooth network, the first stability weight corresponding to the current device identifier is obtained according to the total weight of the communication quality between the current communication device and other devices with which it directly communicates, and the minimum value of all the first stability weights corresponding to the current device identifier is used as the second stability weight corresponding to the current device identifier, and the number of current device identifiers whose corresponding second stability weights are less than the preset stability weight is used as the number of stable devices. The current number of devices is less than the preset number of devices, indicating that the number of communication devices in the low-power Bluetooth network is small and does not need to be optimized. The number of stable devices is less than the preset ratio of stable devices, indicating that the low-power Bluetooth network is not stable enough and is not suitable for optimization. Therefore, the low-power Bluetooth network is optimized only when the current number of devices is not less than the preset number of devices and the number of stable devices is not less than the preset ratio of stable devices. The optimization strategy can be dynamically adjusted, and the optimization is performed only when certain conditions are met, thereby avoiding unnecessary optimization, reducing resource consumption, ensuring the necessity and effectiveness of the optimization operation, reducing the impact on existing communications, and ensuring the efficient operation and stability of the low-power Bluetooth network.

[0147] An embodiment of the present invention also provides a non-transitory computer-readable storage medium, which can be set in an electronic device to store a computer program related to a method in a method embodiment, and the computer program is loaded and executed by the processor to implement the method provided in the above embodiment.

[0148] An embodiment of the present invention further provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method provided in the above embodiment when executing the computer program.

[0149] An embodiment of the present invention further provides a computer program product, which includes program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the method according to various exemplary embodiments of the present invention described above in this specification.

[0150] The present invention provides a method, device and medium for determining a master device of a low-power Bluetooth network. The method is applied to a communication device. In the method, when the device itself is a master device of a low-power Bluetooth network and responds to a new communication device joining the low-power Bluetooth network, the method obtains a master device determination score corresponding to the device itself and a master device determination score corresponding to the new communication device. When the master device determination score corresponding to the device itself is less than the master device determination score corresponding to the new communication device, the device itself is set as a non-master device of the low-power Bluetooth network, and master device determination information is sent to the new communication device, so that the new communication device sets itself as the master device of the low-power Bluetooth network when the master device determination information is received; when the device itself is a master device of a low-power Bluetooth network ... the master device determination information is sent to the new communication device. When the new communication device receives the master device determination information, the new communication device sets itself as the master device of the low-power Bluetooth network; when the device itself is When a non-master device of a low-power Bluetooth network exits the low-power Bluetooth network in response to the master device of the low-power Bluetooth network exiting the low-power Bluetooth network, the master device determination score corresponding to all communication devices in the current low-power Bluetooth network is obtained, and when the master device determination score corresponding to itself is the maximum value among the master device determination scores corresponding to all communication devices in the current low-power Bluetooth network, it is set as the master device of the low-power Bluetooth network, otherwise, it is set as the non-master device of the low-power Bluetooth network, wherein the master device determination score corresponding to the communication device is obtained based on the number of other communication devices in the current low-power Bluetooth network that directly communicate with the communication device, the power of the current communication device, and the RSSI signal strength of the current communication device. It can be seen that when determining the master device, the present invention takes into account the number of other communication devices that directly communicate with the communication device, the power of the communication device, and the RSSI signal strength of the communication device, and when a new communication device joins or an existing master device exits, the most suitable communication device can be re-evaluated and selected as the master device to ensure that the low-power Bluetooth network is always managed by the most suitable communication device, which is conducive to improving the overall performance and stability of the low-power Bluetooth network.

[0151] Although some specific embodiments of the present invention have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are only for illustration, not for limiting the scope of the present invention. It should also be understood by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention.

Claims

1. A method for determining a master control device of a low-power Bluetooth network, characterized in that: The method is applied to a communication device, and the method comprises the following steps: S001. When it is the master device of a low-power Bluetooth network and responds to a new communication device joining the low-power Bluetooth network, it obtains the master device determination score corresponding to itself and the master device determination score corresponding to the new communication device and proceeds to step S002; when it is a non-master device of a low-power Bluetooth network and responds to the master device of the low-power Bluetooth network exiting the low-power Bluetooth network, it obtains the master device determination scores corresponding to all communication devices in the current low-power Bluetooth network and proceeds to step S003; wherein the master device determination score corresponding to the communication device is obtained based on the number of other communication devices in the current low-power Bluetooth network that directly communicate with the communication device, the power of the current communication device and the RSSI signal strength of the current communication device; S002. When the master device determination score corresponding to itself is less than the master device determination score corresponding to the new communication device, set itself as a non-master device of the low-power Bluetooth network, and send master device determination information to the new communication device, so that the new communication device sets itself as the master device of the low-power Bluetooth network when receiving the master device determination information; S003. When the master control device corresponding to itself determines the score that is the maximum value among the master control devices corresponding to all communication devices in the current low-power Bluetooth network, it sets itself as the master control device of the low-power Bluetooth network; otherwise, it sets itself as a non-master control device of the low-power Bluetooth network.

2. The method for determining a master control device of a low-power Bluetooth network according to claim 1, characterized in that: Based on the number of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network, the power of the current communication device, and the RSSI signal strength of the current communication device, obtaining the master control device corresponding to the communication device to determine the score includes the following steps S0011-S0014: S0011. Obtain the current device connection number E corresponding to the communication device, where E is the number of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network; S0012. According to the preset power score mapping list F, obtain the current power score G corresponding to the communication device, where F = {F1, F2, ..., F i , ..., F m }, F i =(F i1 , F i2 ), F i is the i-th preset power score mapping combination, i ranges from 1 to m, m is the number of preset power score mapping combinations, F i1 F i The preset power interval in F i2 F i1 The corresponding preset power score, when F i11 ≤H≤F i12 When F i1 As G, where F i11 F i1 The minimum value, F i12 F i1 The maximum value of , H is the current power of the communication device; S0013. According to the preset RSSI signal strength score mapping list R, obtain the current RSSI signal strength score J corresponding to the communication device, where R = {R1, R2, ..., R j , ..., R n }, R j =(R j1 , R j2 ), R j is the jth preset RSSI signal strength score mapping combination, where j ranges from 1 to n, and n is the number of preset RSSI signal strength score mapping combinations. j1 For R j The preset RSSI signal strength interval, R j2 For R j1 The corresponding preset RSSI signal strength score, when R j11 <K≤R j12 When R j2 As J, where R j11 For R j1 The minimum value, R j12 For R j1 The maximum value of K is the current RSSI signal strength of the communication device; S0014. Obtain the master control device corresponding to the communication device based on E, G and J to determine the score FZ, which meets the following conditions: FZ=E+G+J.

3. The method for determining the master control device of a low-power Bluetooth network according to claim 2, characterized in that: F i12 <F (i+1)11 , F i2 =F (i+1)2 -1, F (i+1)11 F (i+1)1 The minimum value, F (i+1)1 F i+1 The preset power interval in F i+1 is the i+1th preset power score mapping combination, F (i+1)2 F (i+1)1 The corresponding preset power score.

4. The method for determining a master control device of a low-power Bluetooth network according to claim 2, characterized in that: R j12 <R (j+1)11 , R j2 =R (j+1)2 -1, R (j+1)11 For R (j+1)1 The minimum value, R (j+1)1 For R j+1 The preset RSSI signal strength interval, R j+1 is the j+1th preset RSSI signal strength score mapping combination, R (j+1)2 For R (j+1)1 The corresponding preset RSSI signal strength score.

5. The method for determining a master control device of a low-power Bluetooth network according to claim 2, characterized in that: F m2 =R n2 = ZD, ZD is the maximum number of valid communication connections that the communication device can maintain simultaneously, F m2 F m1 The corresponding preset power score, F m1 F m The preset power interval in F m is the mth preset power score mapping combination, R n2 For R n1 The corresponding preset RSSI signal strength score, R n1 For R n The preset RSSI signal strength interval, R n It is the nth preset RSSI signal strength score mapping combination.

6. The method for determining a master control device of a low-power Bluetooth network according to claim 2, characterized in that: F 12 =R 12 =0, F 12 F 11 The corresponding preset power score, F 11 is the preset power interval in F1, F1 is the first preset power score mapping combination, R 12 For R 11 The corresponding preset RSSI signal strength score, R 11 is the preset RSSI signal strength interval in R1, and R1 is the first preset RSSI signal strength score mapping combination.

7. The method for determining a master control device of a low-power Bluetooth network according to claim 1, characterized in that: Before step S001, the following steps S01-S02 are included: S01, when receiving a low-power Bluetooth network joining instruction, searching for Bluetooth signals; S02. When no Bluetooth signal can be found, a low-power Bluetooth network is established and the device is set as the master device of the low-power Bluetooth network, while continuing to search for Bluetooth signals; when a Bluetooth signal can be found, the device joins the low-power Bluetooth network and sets itself as a non-master device of the low-power Bluetooth network.

8. The method for determining a master control device of a low-power Bluetooth network according to claim 1, characterized in that: Before step S001, the following steps S010-S040 are included: S010, when receiving a low-power Bluetooth network joining instruction, searching for Bluetooth signals; S020, when no Bluetooth signal can be searched, establish a low-power Bluetooth network; when a Bluetooth signal can be searched, join the low-power Bluetooth network; S030, if DQ<YS, set itself as a non-master device of the low-power Bluetooth network; if DQ=YS, obtain the master device corresponding to all communication devices in the current low-power Bluetooth network to determine the score, where DQ is the number of communication devices in the current low-power Bluetooth network, the low-power Bluetooth network includes several communication devices, and the communication connection is established and maintained between the communication devices based on the low-power Bluetooth protocol, and YS is the preset number of devices; S040. If the master control device corresponding to itself determines the score that is the maximum value among the master control device determination scores corresponding to all communication devices in the current low-power Bluetooth network, then set itself as the master control device of the low-power Bluetooth network; otherwise, set itself as a non-master control device of the low-power Bluetooth network.

9. A non-transitory computer-readable storage medium, characterized in that: The storage medium stores a computer program, which is loaded and executed by a processor to implement the method for determining a master control device of a low-power Bluetooth network as described in any one of claims 1 to 8.

10. An electronic device comprising: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for determining the master device of a low-power Bluetooth network as described in any one of claims 1 to 8 is implemented.

Citation Information

Cited By

  • Wearable smart watch with low power consumption

    CN120343688A

  • A low-power wearable smart watch

    CN120343688B