Ad hoc network technology implementation method based on BLE

By optimizing the Bluetooth protocol stack and cellular networking technology, independent maintenance and rapid adaptation of upstream and downstream networks are achieved, and the problems of slow networking speed, slow data transmission and poor stability in the BLE networking method are solved, improving the performance and application range of the network.

CN120568435APending Publication Date: 2025-08-29XIAN SEVIS INFORMATION TECHNOLOGY CO LTD

Patent Information

Application Number
CN202510888735.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-08-29

AI Technical Summary

Technical Problem

The existing BLE-based automatic networking method has shortcomings in networking speed, data transmission performance, number of accesses and distance, and cannot meet the needs of some specific application scenarios.

Method used

By optimizing the Bluetooth protocol stack, it realizes the master-slave integrated and one-slave multi-main autonomous communication, combines the sub-device to actively scan the gateway to access the network, establishes uplink and downlink networks, adopts cellular networking and distributed data transmission, and uses RSSI and data transmission rates to judge network stability, ensuring that the uplink and downlink networks are maintained independently and quickly adapt to network changes.

Benefits of technology

It improves network speed and data transmission rate, ensures network stability and real-timeness, solves the problem of long links and slow communication, and quickly forms a new network network after adapting to network changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120568435A_ABST
    Figure CN120568435A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of wireless communication, and discloses a BLE (Bluetooth Low Energy)-based ad hoc network technology implementation method, which comprises the following steps of: acquiring a gateway and sub-equipment; starting an uplink network construction process; determining a stable connection link for each sub-device in the uplink network; if the data transmission succeeds, the connection is disconnected and dormancy is entered, otherwise, the data is stored and retransmitted regularly, and a reconfiguration network is started after retransmission identification; starting a downlink network construction process; according to a data transmission demand of a downlink network, the gateway transmits a control instruction to a target sub-device step by step, if the transmission fails, retransmission is initiated, and if the retransmission fails, the network is reconstructed; the network communication distance is expanded; and judging the stability of the uplink network and the downlink network, if not, triggering a network reconstruction process, and re-scanning and constructing the uplink network or the downlink network. The network formed by the method is stable, active uploading and active issuing are both considered, the problems of long link and slow communication are solved, and a new networking network can be quickly formed after the network is changed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of wireless communication technology, and in particular to a method for implementing BLE self-organizing network technology. Background Art

[0002] With the rapid development of IoT technology, Bluetooth Low Energy (BLE) has been widely used in a variety of fields, including smart homes, industrial IoT, and smart wearable devices, due to its advantages such as low power consumption, low cost, and easy deployment. In many application scenarios, automatic networking between multiple BLE devices is required to enable data exchange and collaborative operation between devices. Currently, there are three common methods for automatic networking based on BLE: 1. Automatic networking based on BLE MESH BLE MESH is a network topology based on BLE technology that allows a large number of BLE devices to form a large network through multi-hop relays. In this networking mode, devices can communicate with each other, and data can be forwarded through multiple relay nodes, thus achieving long-distance data transmission and large-scale device connectivity.

[0003] However, there are some significant shortcomings in the automatic networking based on BLE MESH. First, the networking speed is slow.

[0004] Devices in a MESH network need to discover each other, establish connections, and build a network topology. This process involves a large amount of signaling interaction and node coordination, resulting in a long networking time. Secondly, the amount of data transmitted is low. For some application scenarios with high data transmission requirements, such as security areas such as payment, large encrypted data packets need to be transmitted. In a BLE MESH network, due to the complexity of the relay forwarding link, the data transmission process needs to be processed and forwarded by multiple nodes. This not only increases the delay of data transmission, but also causes the data transmission speed to be very slow, which cannot meet the actual needs of the product. In addition, the entire communication link of BLE MESH is complex, and the relay forwarding link is complex. Excessive relay nodes and data forwarding increase the possibility of signal interference and conflict, worsening the wireless environment and affecting the stability and reliability of the network.

[0005] 2. The gateway scans the slaves and searches for the network in rotation

[0006] In this networking mode, there is a master device (usually a gateway) and multiple slave devices. The master device actively scans for slave devices in its environment and establishes connections with them according to a specific round-robin strategy, thus establishing a network. Slave devices are passive during the networking process, waiting for queries and connections from the master device.

[0007] This master-slave communication method has significant drawbacks in applications requiring high real-time performance. Because slave devices must actively query to obtain information, data uploads experience significant latency, making them incapable of meeting the real-time data upload requirements of critical applications. Furthermore, this networking method is limited in both the number of connections and the distance between them. As the number of slave devices increases, the master device spends more time scanning and connecting, reducing networking efficiency. Furthermore, BLE signals have a limited transmission range. When the distance between the slave and master is long, the signal strength weakens, impacting connection stability and data transmission quality.

[0008] 3. The device scans the gateway and automatically uploads network data

[0009] In contrast to the second method, in this networking method, the slave device actively scans for the master device (gateway) in the surrounding environment and automatically establishes a connection upon discovering the gateway, enabling networking and data upload. The master device is in a passive state during the networking process, waiting for connection requests from slave devices.

[0010] While this networking approach improves the initiative of slave devices to a certain extent, it still cannot meet the requirements of real-time data upload in application scenarios such as remote real-time control. The slave device takes a certain amount of time to scan and connect to the gateway, which causes data upload delays. Furthermore, this networking approach is also limited in the number of connections and distance. When a large number of slave devices attempt to connect to the gateway simultaneously, the gateway's processing capacity may reach its limit, resulting in some slave devices being unable to successfully connect. Furthermore, the transmission distance limit of BLE signals also affects the stability of the connection between the slave device and the gateway, significantly reducing the reliability of data transmission, especially over long distances.

[0011] In summary, existing BLE-based automatic networking methods have certain shortcomings in terms of networking speed, data transmission performance, number of access points, and distance, and cannot meet the needs of some specific application scenarios. Therefore, it is necessary to develop a new BLE-based automatic networking technology to address these issues and improve the performance and application scope of BLE networks. Summary of the Invention

[0012] In response to the shortcomings of the existing technology, the present invention provides a method for implementing BLE self-organizing network technology. By optimizing the Bluetooth protocol stack, the Bluetooth protocol stack is implemented to simultaneously support master-slave integration and one-slave-multi-master autonomous communication. On this basis, by combining the sub-device to actively scan the gateway to access the network, an uplink network is established, and the master device reversely scans to establish a downlink network. The dual networks are independently maintained, which solves the problem of inconsistent uplink and downlink traffic due to layout or antenna problems, and enables the network uplink and downlink to work simultaneously without affecting the network communication connection. The network stability is judged in combination with RSSI and data transmission rate fluctuations; the overall networking solution adopts cellular networking and transmission networking to further improve the networking distance; distributed data transmission is adopted to speed up the data transmission speed and improve the communication rate; this method not only makes the formed network sufficiently stable, takes into account the real-time nature of active uploading and active downloading, but also solves the problem of slow communication due to long links, and can quickly form a new networking network after the network changes.

[0013] To achieve the above objectives, the present invention provides the following technical solution: a method for implementing BLE ad hoc networking technology, the method comprising the following steps: Obtain a gateway and multiple sub-devices in a Bluetooth communication system; the gateway is used to communicate with the cloud and manage the sub-devices, and the sub-devices serve as terminal devices to establish connections with the gateway or other sub-devices; Start the uplink network construction process; scan the gateway or relay device through the sub-device to access the network. If a gateway or relay device is scanned, change the broadcast name and save the upper sub-device address to establish an uplink communication link; A network stability verification mechanism is used to obtain signal strength stability and communication time interval data for each sub-device in the uplink network, and a stable connection link is determined using a preset network quality assessment algorithm; Start the downlink network construction process; the gateway scans the sub-devices and saves the communication list. If the network quality is stable, the list is saved. Otherwise, the unstable devices are removed and a secondary scan is initiated to build the downlink network. Acquire independent communication data from the uplink and downlink networks; the uplink network is used for sub-devices to transmit data to the gateway, and the downlink network is used for the gateway to issue control instructions to sub-devices, ensuring that two-way communication does not interfere with each other; For data transmission on the upstream network, the sub-device connects to the upper-level device through the communication whitelist address to transmit data. If the data transmission is successful, the sub-device disconnects and enters sleep mode. Otherwise, the data is stored and retransmitted periodically until network reconstruction is triggered. According to the data transmission requirements of the downlink network, the gateway retrieves the routing list of the target sub-device and transmits the control instructions to the target sub-device step by step through the communication whitelist connection. If the transmission fails, retransmission or network reconstruction is initiated; Use cellular networking to extend network communication distance; sub-devices prioritize connecting to the lowest-level and most stable relay device, building a multi-level transmission network to cover long-distance communication scenarios; Determine whether the stability of the uplink and downlink networks meets the preset threshold. If not, trigger the network reconstruction process to rescan and build the uplink or downlink network to ensure the stability and real-time performance of the communication system.

[0014] Preferably, the obtaining of a gateway and multiple sub-devices in the Bluetooth communication system includes: After the gateway is powered on, it scans the surrounding Bluetooth devices, obtains the RSSI value and MAC address of the sub-device's broadcast signal, and saves it to the gateway's initial device list. Based on the initial device list, the gateway connects to the sub-devices one by one, and sends test data packets to obtain connection stability and communication time interval to determine whether the network quality is stable. If the network quality is stable, the sub-device will be added to the gateway's communication whitelist and the sub-device's MAC address and routing information will be saved; if it is unstable, the sub-device will be removed from the list and the gateway's scan list will be updated; The gateway sends a secondary scanning command to the sub-devices in the communication whitelist. The sub-device changes its broadcast name to SERGYX1n and continues to scan for unconnected sub-devices around it to obtain a list of new sub-devices. Based on the scanned list, it evaluates the RSSI stability and communication interval of the new sub-devices, identifies the new sub-devices with stable connections, and saves their MAC addresses. If the new sub-device has a stable connection with the upper-level sub-device, the broadcast name of the new sub-device is modified to SERGYX1n+1 to build a secondary network; if there is no stable connection, the gateway is notified to update the scan list; Through the communication whitelist and routing information saved by the gateway, the gateway receives the control instructions issued by the cloud, retrieves the MAC address and routing link of the target sub-device, and sends the instructions to the first-level sub-device. Based on the instructions received by the first-level sub-device, it forwards them to the target sub-device step by step through the MAC address in the communication whitelist, obtains the confirmation response of the target sub-device, and determines whether the instruction is successfully issued. If the instruction is successfully issued, the confirmation response is transmitted to the gateway through the uplink and the communication record is saved. If the issuance fails five times in a row, the gateway is triggered to rescan and reorganize the network and update the routing information.

[0015] Preferably, the sub-device scans for a gateway or relay device to access the network, and if a gateway or relay device is scanned, changes the broadcast name and saves the upper sub-device address to establish an uplink communication link, including: After the sub-device is powered on, it scans the gateway identifier gateway0 or the relay device identifier SERGY, obtains the scan list, and saves the MAC address of the gateway or relay device; If the scan list contains the gateway identifier gateway0, the sub-device changes its broadcast name to SERGYn1, saves the gateway MAC address, and determines the uplink communication link of the first-level sub-device; If the scan list does not contain the gateway identifier gateway0, but contains the relay device identifier SERGY, the sub-device selects the relay device identifier SERGY with a stable signal and the lowest level to connect to, and obtains the relay device MAC address. After the connection is successful, the sub-device changes the broadcast name to SERGYn+1, saves the upper-level sub-device MAC address, and determines the multi-level uplink communication link; The sub-device establishes a connection with the upper-level sub-device through the MAC address in its communication whitelist, transmits uplink data, and determines whether the data is confirmed to be received by the upper-level sub-device; If the data is confirmed to be received by the upper-level sub-device, the upper-level sub-device will continue to transmit it to the upper-level sub-device through the MAC address in its communication whitelist, and then pass it to the gateway in turn to obtain the data upload completion status; If the data is not confirmed to be received by the upper-level sub-device, the sub-device stores the data, periodically initiates retransmission through the MAC address in its communication whitelist, and determines whether the number of retransmissions reaches 5; If the number of retransmissions reaches 5, the sub-device initiates network reconstruction, rescans the gateway or relay device, builds a new uplink communication link, and determines the network reorganization status.

[0016] Preferably, the network stability verification mechanism is adopted to obtain signal strength stability and communication time interval data for each sub-device in the uplink network, and a stable connection link is determined by a preset network quality evaluation algorithm, including: The sub-device starts scanning, sequentially obtains RSSI data of the upper-level connectable sub-device, records the RSSI value of each scan, calculates RSSI stability, and obtains RSSI stability data. Based on the RSSI stability data, the sub-device uploads a packet of test data to the upper-level sub-device at a preset time interval, records the actual time interval for the upper-level sub-device to receive the data, and obtains the communication time interval data; Using RSSI stability data and communication time interval data, the sub-device calculates the connection stability and communication efficiency to determine the network quality score of the current upper-level sub-device; If the network quality score of the current upper-level sub-device meets the preset stable connection threshold, the sub-device saves the MAC address and link information of the upper-level sub-device to obtain a stable connection link; If the network quality score of the current upper-level sub-device does not meet the preset stable connection threshold, the sub-device scans the upper-level sub-device of the next level, repeatedly obtains RSSI stability and communication time interval data, and determines the new network quality score; If all the upper-level sub-devices at the next level do not have a link that meets the stable connection threshold, the sub-device sets a poor location flag and uses a comprehensive analysis algorithm of network quality and link length to determine the optimal link; Based on the optimal link, the sub-device establishes a connection with the upper-level sub-device through the MAC address in the communication whitelist, uploads the poor location flag to the gateway, obtains the gateway confirmation instruction, and after the gateway confirms the instruction, the sub-device uploads the poor location flag and link information to the cloud platform, triggering the operation and maintenance notification process, and obtains the link adjustment task stored in the cloud. Based on the link adjustment task stored in the cloud, the sub-device receives the optimized routing instruction issued by the gateway, updates the MAC address in the communication whitelist, and determines a new stable connection link.

[0017] Preferably, the gateway scans the sub-devices and saves the communication list. If the network quality is stable, the list is saved. Otherwise, the unstable devices are eliminated and a secondary scan is initiated to build a downlink network, including: The gateway scans all sub-devices and obtains each broadcast signal, generating an initial sub-device communication list. Based on the initial sub-device communication list, the gateway connects to each sub-device one by one, evaluates the network quality parameters of each sub-device connection, and determines whether the network quality is stable. If the network quality is stable, the sub-device and its MAC address are saved to the stable communication list to obtain a stable downlink communication sub-device set; If the network quality is unstable, the unstable sub-device will be removed from the communication list to generate a sub-device list after removal. Through the sub-device list after removal, the gateway sends a secondary scan command to all sub-devices, triggering the sub-device broadcast name to be changed to SERGYX1n; After receiving the secondary scan command, the sub-device scans surrounding devices to determine whether there is a SERGYX0n broadcast in the scan list, and generates a sub-device scan result. Based on the sub-device scan result, if SERGYX0n is present and the network stability assessment passes, the sub-device establishes a secondary network connection with the device and determines the secondary network topology. Through the secondary network topology, the sub-device sends instructions to the lower-level sub-device, and the broadcast name of the lower-level sub-device is changed to SERGYX1n. The networking is expanded in sequence to obtain a complete downstream network structure; the gateway obtains the complete downstream network structure, saves the routing link MAC addresses of all sub-devices, and generates a downstream communication routing list.

[0018] Preferably, the obtaining of independent communication data of the uplink network includes: The sub-device actively scans the gateway, obtains the gateway's broadcast signal, and determines whether it contains the gateway identifier gateway0. If so, it connects to the gateway and saves the gateway MAC address to obtain the initial connection to the upstream network; According to the initial connection of the upstream network, the sub-device changes the broadcast name to SERGYn1, obtains and stores the gateway MAC address, and determines whether the gateway identifier gateway or the relay device identifier SERGY appears in the scanning list for 20 consecutive seconds. If not, it enters the sleep broadcast mode to determine the sleep state of the upstream network; The relay device identification SERGY is detected by scanning the list, and the signal stability and relay level are obtained. It is determined whether there is a stable relay device with the lowest level. If so, the relay device is connected and the broadcast name is changed to SERGYn current level + 1 to obtain the hierarchical connection of the upstream network; Based on the hierarchical connection of the uplink network, network stability verification is performed to obtain RSSI and data transmission rate fluctuation data to determine whether the connection is stable. If stable, the communication list is saved to confirm the stable networking of the uplink network; The obtaining of independent communication data of the downlink network includes: After the gateway is powered on, it scans the sub-devices, obtains the sub-device broadcast signal, and determines whether the network quality is stable. If stable, it saves the communication list and issues a secondary scanning command to obtain the initial connection of the downlink network; Based on the initial connection of the downstream network, the child device changes the broadcast name to SERGYX1n, checks whether SERGYX0n is included in the scan list, and determines the network stability. If stable, a secondary network is constructed and instructions are sent to the lower-level device to determine the hierarchical connection of the downstream network. Through the hierarchical connection of the downstream network, the control instructions and routing link MAC address issued by the gateway are obtained to determine whether there is a matching first-level device MAC. If so, the instructions are transmitted to the next level through the communication whitelist connection to obtain the data transmission path of the downstream network; According to the data transmission path of the downlink network, the uplink network is used to transmit confirmation data, obtain the confirmation signal of the upper-level device, and determine whether the data is successfully uploaded to the gateway. If successful, a success command is sent to the sub-device that initiated the connection to confirm the completion of two-way communication; By completing two-way communication, we obtain records of five consecutive data transmission failures to determine whether network reconstruction is triggered. If so, we rescan and reconstruct the uplink and downlink networks to obtain a new network communication structure.

[0019] Preferably, for the data transmission on the uplink network, the sub-device connects to the upper sub-device through the communication whitelist address to transmit data, and if the data transmission is successful, the sub-device disconnects and enters sleep mode, otherwise the data is stored and retransmitted periodically until network reconstruction is triggered, including: The sub-device initiates a connection request with the upper-level sub-device through the stored communication whitelist MAC address and obtains the connection status; If the connection status is successful, the sub-device sends the data to be transmitted to the upper-level sub-device via the Bluetooth protocol and obtains data transmission confirmation; If the data transmission confirmation indicates success, the sub-device disconnects from the upper-level sub-device and enters sleep mode after confirming that the data transmission is complete; If the data transmission confirmation indicates failure, the sub-device stores the data to be transmitted in the local cache and determines the number of transmission failures; If the number of transmission failures does not reach 5, the sub-device will re-initiate the connection through the communication whitelist MAC address after the set time interval to obtain the new connection status; If the number of transmission failures reaches 5, the sub-device triggers the network reconstruction process to obtain a new network topology; According to the new network topology, the sub-device updates the communication whitelist MAC address and determines the new upper-level sub-device. Through the updated communication whitelist MAC address, the sub-device initiates a connection with the new upper-level sub-device and obtains the connection status. If the connection status is successful, the sub-device extracts the data to be transmitted from the local cache and sends it to the new upper-level sub-device, and obtains a data transmission confirmation.

[0020] Preferably, according to the data transmission requirements of the downlink network, the gateway retrieves the routing list of the target sub-device, transmits the control instruction to the target sub-device step by step through the communication whitelist connection, and initiates retransmission or network reconstruction if the transmission fails, including: The gateway obtains the downlink communication list uploaded after the network is successfully established, determines the network routing list of the target sub-device, and generates a control instruction based on the network routing list of the target sub-device and carries the MAC address of the routing link, obtaining a control instruction data packet containing the MAC address; The gateway retrieves the MAC address of the primary device, uses the communication whitelist mechanism to establish a connection with the primary sub-device, and determines whether the connection is successful. If the primary sub-device is successfully connected, the primary sub-device retrieves the MAC address of the secondary sub-device, transmits the control command through the communication whitelist mechanism, and determines whether the command reaches the secondary sub-device. According to the command transmission result, if the command reaches the second-level sub-device, the MAC address of the subsequent sub-device is retrieved in sequence, and the communication whitelist mechanism is used to transmit the command step by step to obtain the final sub-device reception status. After the final sub-device receives the control command, it executes the command and generates a confirmation message, which is sent to the gateway through the uplink transmission path to determine whether the handshake confirmation is completed; If the handshake confirmation is not completed, the gateway initiates a control command retransmission after a preset time interval, obtains the number of retransmissions, and determines whether it has reached 5 times. If the number of retransmissions reaches 5 and is still unsuccessful, the gateway initiates network reconstruction, rescans the device and updates the downlink communication list to determine whether the target sub-device is in the network. If the target sub-device is not scanned after the network reconstruction, the gateway marks the sub-device as offline and generates a sub-device offline record.

[0021] Preferably, the method of extending the network communication distance by adopting a cellular networking method includes: After the sub-device is powered on, it scans the gateway or relay device through the Bluetooth module, obtains the MAC address and signal strength of the gateway identifier gateway or relay device identifier SERGY in the scan list, and determines the list of connectable devices; According to the scan list, if there is a device with the gateway identifier gateway or the relay device identifier SERGY in the list, the sub-device compares the signal strength and relay level, and preferentially selects the device with the lowest level and the most stable signal for connection, and obtains the MAC address of the upper-level sub-device with successful connection; After the sub-device successfully connects, it changes its own broadcast name to SERGYn (the current level plus 1). By storing the MAC address of the upper-level sub-device, it builds a communication whitelist connection and determines its hierarchical position in the network. If the sub-device does not scan a device with the gateway identifier gateway or a relay device identifier SERGY for 20 consecutive seconds, it switches to sleep broadcast mode, obtains a low-power state, and determines whether to suspend the networking attempt. The sub-device periodically sends test data packets to the upper-level sub-device to obtain the network stability verification results. If the verification results are stable, it confirms that the network is successful and a stable communication link is confirmed; When a sub-device needs to transmit data uplink, it connects to the upper-level sub-device through the communication whitelist MAC address, transmits data and receives the confirmation signal from the upper-level sub-device to obtain the data transmission status; If the upper-level sub-device does not return a confirmation signal, the sub-device stores the data that was not successfully transmitted and triggers a retransmission mechanism through a timer to determine whether the threshold of 5 consecutive transmission failures has been reached; If the transmission fails for 5 times in a row, the sub-device initiates network reorganization, rescans the gateway or relay device, obtains the new upper-level sub-device MAC address, and determines the new networking path; After receiving the data uploaded by the sub-device, the gateway retrieves the routing link MAC address of the target sub-device through the downlink communication list, sends a control instruction and obtains the handshake confirmation of the sub-device to determine the data downlink transmission status.

[0022] Preferably, the determining whether the stability of the uplink network and the downlink network meets a preset threshold, and if not, triggering a network reconstruction process, rescanning and reconstructing the uplink network or the downlink network to ensure the stability and real-time performance of the communication system, includes: After the gateway is powered on, it scans the sub-devices, obtains the RSSI value and connection response time of each sub-device, calculates the RSSI stability, and uploads a packet of test data to the sub-device at preset intervals based on the RSSI stability and connection response time, and records the actual time interval for the sub-device to receive data. A network quality assessment algorithm is used based on connection stability, RSSI stability, and communication time interval to output a quality score for each connection link. If the quality score of a connection link is lower than a preset threshold, the link is removed from the network list to obtain a list of links that meet the quality requirements. Based on the list of links that meet the quality requirements, the network topology is constructed layer by layer to determine the upper and lower level connection relationships of each sub-device. If, after the overall networking is completed, it is detected that a known sub-device has not been scanned, each sub-device in the current link is notified to scan for the sub-device and obtain its RSSI stability and communication time interval; Using the scan data of unscanned sub-devices, a network quality assessment algorithm is used to determine the optimal link to which sub-device in the current link the sub-device can connect. If the quality of the optimal link of the unscanned sub-device is still lower than the preset threshold, the network reconstruction process is triggered to rescan all sub-devices and build an uplink or downlink network. According to the reconstructed network topology, the network list and connection relationship are updated to determine a new stable communication link.

[0023] Compared with the existing technology, the present invention provides a system for predicting existing customer churn based on machine learning, which has the following beneficial effects: The present invention uses independent cellular networking for uplink and downlink combined with a network quality assessment algorithm to effectively solve the problem that the current one-way network access cannot meet the needs of two-way long-distance interaction of products. In addition, through an independent networking architecture, the uplink and downlink network lists are managed separately, which can effectively solve the problems of mismatch between terminal equipment and gateway antennas, temporary removal of equipment, inability to achieve information transmission in uplink or downlink, and inability to connect after reverse access after one-way networking. In addition, combined with the network quality assessment algorithm, after a network anomaly occurs, the uplink and downlink can independently and automatically perform network optimization without the need for compatibility considerations. Through targeted hierarchical data transmission, the problem of deterioration of multi-network environment caused by long-term connection over a large area and the problem of hardware resources and power consumption overhead are effectively solved, and it can be used in large-scale and low-power scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 This is a schematic diagram of the networking process of the present invention; Figure 2 A schematic diagram of the uplink network construction process of the present invention; Figure 3 This is a flow chart of uplink network data transmission according to the present invention; Figure 4 A schematic diagram of the downlink network construction process of the present invention; Figure 5 This is a flow chart of downlink network data transmission in the present invention. DETAILED DESCRIPTION

[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0026] See also Figure 1 , a method for implementing BLE self-organizing network technology, the method comprising the following steps: S101. Acquire a gateway and multiple sub-devices in a Bluetooth communication system; the gateway is used to communicate with the cloud and manage the sub-devices, and the sub-devices serve as terminal devices and establish connections with the gateway or other sub-devices; S102, start the uplink network construction process; scan the gateway or relay device through the sub-device to access the network, if the gateway or relay device is scanned, change the broadcast name and save the upper device address to build an uplink communication link; S103: Using a network stability verification mechanism, obtain signal strength stability and communication time interval data for each sub-device in the uplink network, and determine a stable connection link using a preset network quality assessment algorithm; S104, start the downlink network construction process; the gateway scans the sub-devices and saves the communication list. If the network quality is stable, the list is saved. Otherwise, the unstable device is removed and a secondary scan is initiated to build a downlink network. S105. Acquire independent communication data of the uplink network and the downlink network; the uplink network is used by the sub-device to transmit data to the gateway, and the downlink network is used by the gateway to issue control instructions to the sub-device, ensuring that the two-way communication does not interfere with each other; S106. For data transmission on the uplink network, the sub-device connects to the upper-level device through the communication whitelist address to transmit data. If the data transmission is successful, the sub-device disconnects and enters sleep mode. Otherwise, the sub-device stores the data and retransmits it periodically until network reconstruction is triggered. S107. Based on the data transmission requirements of the downlink network, the gateway retrieves the routing list of the target sub-device and transmits the control instructions to the target sub-device step by step through the communication whitelist connection. If the transmission fails, retransmission or network reconstruction is initiated; S108. Use cellular networking to extend network communication distance; sub-devices prioritize connecting to the lowest-level and most stable relay device, building a multi-level transmission network to cover long-distance communication scenarios; S109: Determine whether the stability of the uplink network and the downlink network meets the preset threshold. If not, trigger the network reconstruction process to rescan and reconstruct the uplink network or the downlink network to ensure the stability and real-time performance of the communication system.

[0027] In a specific implementation, the step of obtaining a gateway and multiple sub-devices in the Bluetooth communication system includes: S1011. After the gateway is powered on, it scans the surrounding Bluetooth sub-devices, obtains the RSSI value and MAC address of the sub-device's broadcast signal, and saves it to the gateway's initial device list. Based on the initial device list, the gateway connects to the sub-devices one by one, obtains the connection stability and communication time interval by sending test data packets, and determines whether the network quality is stable. S1012. If the network quality is stable, the sub-device is added to the gateway's communication whitelist and the MAC address and routing information of the sub-device is saved; if the network quality is unstable, the sub-device is removed from the list and the gateway's scan list is updated; S1013. The gateway issues a secondary scan command to the sub-device in the communication whitelist. The sub-device modifies its broadcast name to SERGYX1n and continues to scan for unconnected sub-devices around it to obtain a list of new sub-devices. Based on the list of sub-devices scanned, the gateway evaluates the RSSI stability and communication interval of the new sub-devices. A network quality assessment algorithm, such as a weighted average method, is used to identify new sub-devices with stable connections and save their MAC addresses. S1014. If the new sub-device is stably connected to the upper-level sub-device, the broadcast name of the new sub-device is modified to SERGYX1n+1 to build a secondary network. If there is no stable connection, the gateway is notified to update the scan list. S1015. Through the communication whitelist and routing information saved by the gateway, the gateway receives the control instructions issued by the cloud, retrieves the MAC address and routing link of the target sub-device, and sends the instructions to the first-level sub-device. According to the instructions received by the first-level sub-device, it forwards them to the target sub-device step by step through the MAC address in the communication whitelist, obtains the confirmation response of the target sub-device, and determines whether the instructions are successfully issued. If the instructions are successfully issued, the confirmation response is transmitted to the gateway through the uplink and the communication record is saved. If the issuance fails for five consecutive times, the gateway is triggered to rescan and reorganize the network and update the routing information.

[0028] In one embodiment, after the gateway is powered on, it scans the surrounding sub-devices and obtains the RSSI value of the sub-device broadcast signal, for example, the RSSI value range is -60dBm to -80dBm, and records the MAC address of the sub-device and saves it to the gateway's initial device list. According to the initial device list, the gateway connects to the sub-devices one by one, and obtains the connection stability and communication time interval by sending test data packets, for example, once every 100ms. If the packet loss rate is less than 5% and the delay is less than 200ms, the network quality is determined to be stable. If the network quality is stable, the sub-device is added to the gateway's communication whitelist, and the sub-device MAC address and routing information are saved; if the packet loss rate is higher than 5% or the delay exceeds 200ms, the sub-device is removed from the list and the gateway's scan list is updated. Through the sub-device in the communication whitelist, the gateway issues a secondary scan instruction, and the sub-device modifies the broadcast name to SERGYX1n, continues to scan the surrounding unconnected sub-devices, and obtains a new sub-device list. Based on the list of sub-devices scanned, the RSSI stability and communication interval of the new sub-device are evaluated. A network quality assessment algorithm, such as the weighted average method, is used. If the RSSI value is greater than -70dBm and the communication interval is less than 150ms, a stable sub-device is identified and its MAC address is saved. If the new sub-device has a stable connection with the upper-level sub-device, the new sub-device's broadcast name is changed to SERGYX1n+1, establishing a secondary network. If the RSSI value is less than -70dBm or the communication interval exceeds 150ms, the gateway is notified to update the scan list. Using the communication whitelist and routing information stored in the gateway, the gateway receives control commands issued by the cloud, retrieves the MAC address and routing link of the target sub-device, and sends the command to the first-level sub-device. Based on the received command, the first-level sub-device forwards it to the target sub-device through the MAC address in the communication whitelist, obtaining a confirmation response from the target sub-device. If the response time is less than 300ms, the command is considered successfully issued. If the command is successfully issued, the confirmation response will be transmitted to the gateway through the uplink and the communication record will be saved; if the issuance fails five times in a row, the gateway will be triggered to rescan and reorganize the network and update the routing information.

[0029] For specific implementation, see Uplink Network Construction. Figure 2 As shown, the sub-device scans for a gateway or relay device to access the network. If a gateway or relay device is found, the broadcast name is changed and the address of the upper-level sub-device is saved to establish an uplink communication link, including: S1021. After the sub-device is powered on, it scans the gateway identifier gateway0 or the relay device identifier SERGY, obtains a scan list, and saves the MAC address of the gateway or relay device. If the scan list contains the gateway identifier gateway0, the sub-device changes its broadcast name to SERGYn1, saves the gateway MAC address, and determines the uplink communication link of the first-level sub-device; If the scan list does not contain the gateway identifier gateway0, but contains the relay device identifier SERGY, the sub-device selects the relay device identifier SERGY with a stable signal and the lowest level to connect to, and obtains the relay device MAC address. After the connection is successful, the sub-device changes the broadcast name to SERGYn+1, saves the upper-level sub-device MAC address, and determines the multi-level uplink communication link; S1022. The sub-device establishes a connection with the upper-level sub-device through the MAC address in its communication whitelist, transmits uplink data, and determines whether the data is confirmed to be received by the upper-level sub-device; If the data is confirmed to be received by the upper-level sub-device, the upper-level sub-device will continue to transmit it to the upper-level sub-device through the MAC address in its communication whitelist, and then pass it to the gateway in turn to obtain the data upload completion status; If the data is not confirmed to be received by the upper-level sub-device, the sub-device stores the data, periodically initiates retransmission through the MAC address in its communication whitelist, and determines whether the number of retransmissions reaches 5; If the number of retransmissions reaches 5, the sub-device initiates network reconstruction, rescans the gateway or relay device, builds a new uplink communication link, and determines the network reorganization status.

[0030] For example, after powering on, the slave device scans for gateway ID gateway0 or relay ID SERGY, with a scan cycle set to 100ms and a continuous scan time of 20 seconds. It obtains a scan list and saves the MAC addresses of gateways or relay devices with signal strength greater than -80dBm. If the scan list includes gateway0, the slave device changes its broadcast name to SERGYn1, stores the gateway's MAC address, and verifies the address integrity using CRC16 (cyclic redundancy check), confirming a first-level uplink communication link. If the scan list does not include gateway ID gateway0 but a relay ID SERGY is detected, the slave device uses a weighted algorithm (RSSI accounts for 70% and packet loss rate accounts for 30%) to select the relay ID SERGY with the lowest level and the most stable signal. After establishing a connection, the slave device obtains the relay ID MAC address. After a successful connection, the slave device parses the level field n in the relay ID's broadcast name, updates its own broadcast name to SERGYn+1, stores the upper-level slave device's MAC address in non-volatile memory, and uses the Link Quality Indicator (LQI) to assess stability and confirm a multi-level uplink communication link. A slave device establishes a connection with a higher-level slave device using the MAC address in its communication whitelist. It transmits uplink data packets using the GATT protocol and confirms data receipt if it receives an ACK frame. The higher-level slave device parses the destination address field in the packet and forwards it to the gateway using the MAC address in its communication whitelist. The gateway records the transmission delay and hop count to determine the data upload completion status. If no ACK is received, the slave device initiates an exponential backoff retransmission mechanism with an initial interval of 1 second and a maximum of 5 retransmissions. The CRC32 (cyclic redundancy check) value of the stored data is verified before each retransmission. When the retransmission counter reaches 5, the slave device clears its local MAC address table and re-enters scanning mode. If no valid slave device is found within 30 seconds, it switches to sleep advertising mode with a 2-second advertising interval to reduce power consumption.

[0031] In a specific implementation, the network stability verification mechanism is used to obtain signal strength stability and communication time interval data for each sub-device in the uplink network, and a stable connection link is determined by a preset network quality evaluation algorithm, including: S1031. The sub-device starts scanning, sequentially obtains RSSI data of upper-level connectable sub-devices, records the RSSI value of each scan, calculates RSSI stability, and obtains RSSI stability data. Based on the RSSI stability data, the sub-device uploads a packet of test data to the upper-level sub-device at a preset time interval, records the actual time interval between the upper-level sub-device receiving the data, and obtains communication time interval data. S1032. The sub-device calculates the connection stability and communication efficiency based on the RSSI stability data and the communication time interval data, and determines the network quality score of the current upper-level sub-device; If the network quality score of the current upper-level sub-device meets the preset stable connection threshold, the sub-device saves the MAC address and link information of the upper-level sub-device to obtain a stable connection link; If the network quality score of the current upper-level sub-device does not meet the preset stable connection threshold, the sub-device scans the upper-level sub-device of the next level, repeatedly obtains RSSI stability and communication time interval data, and determines the new network quality score; If all the upper-level sub-devices at the next level do not have a link that meets the stable connection threshold, the sub-device sets a poor location flag and uses a comprehensive analysis algorithm of network quality and link length to determine the optimal link; S1033. Based on the optimal link, the sub-device establishes a connection with the upper-level sub-device through the MAC address in the communication whitelist, uploads the poor location flag to the gateway, obtains the gateway confirmation instruction, and through the gateway confirmation instruction, the sub-device uploads the poor location flag and link information to the cloud platform, triggering the operation and maintenance notification process, and obtains the link adjustment task stored in the cloud. Based on the link adjustment task stored in the cloud, the sub-device receives the optimized routing instruction issued by the gateway, updates the MAC address in the communication whitelist, and determines a new stable connection link.

[0032] For example, a slave device activates the scanning function and scans 10 times continuously at 100ms intervals. It obtains and records the RSSI value of the upstream slave device and uses a standard deviation algorithm to calculate the RSSI fluctuation range. If the standard deviation is less than 5dBm, the signal is considered stable, and RSSI stability data is obtained. Based on the RSSI stability data, the slave device sends a 128-byte packet of test data to the upstream slave device every 500ms. The upstream slave device records the reception timestamp and transmits it back. The slave device calculates the deviation between the actual reception interval of adjacent data packets and the theoretical interval. If the deviation rate is less than 10%, the communication interval is considered stable and communication interval data is obtained. Combining RSSI stability and communication interval data, a weighted scoring algorithm is used, setting the RSSI weight at 60% and the interval weight at 40%. When the combined score exceeds 80, the network quality is considered acceptable and the network quality score of the upstream slave device is determined. If the score meets the requirements, the slave device stores the upstream slave device's MAC address and link quality parameters, and a stable connection is established. If the score falls below 80, the sub-device switches to the next-level upper-level sub-device and repeats the RSSI sampling and interval testing process. After three rounds of scanning, the new link's score is determined. If all next-level upper-level sub-devices fail to meet the criteria, the sub-device activates the "poor location" flag and uses the Dijkstra algorithm to calculate path weights based on link hop count and quality scores. The link with the lowest total weight is selected as the optimal link. The sub-device establishes a connection with the upper-level sub-device in the optimal link using the MAC address in its communication whitelist. It sends an encrypted data packet containing the location flag and link quality report to the gateway, which responds with a confirmation command containing a checksum. The sub-device encapsulates the complete link report in JSON format and uploads it to the cloud. After cloud-based parsing, the automated work order system generates a device tuning task and pushes it to the operation and maintenance terminal. Based on the optimization instructions issued by the cloud, the gateway recalculates the routing table and sends a configuration package containing the new MAC address list to the sub-device via an encrypted channel. The sub-device updates its communication whitelist and verifies that the new link's comprehensive score exceeds the threshold, completing the stable link switch.

[0033] For specific implementation, see Figure 4 As shown, the gateway scans the sub-devices and saves the communication list. If the network quality is stable, the list is saved. Otherwise, the unstable devices are eliminated and a secondary scan is initiated to build a downlink network, including: S1041. The gateway scans all sub-devices and obtains each broadcast signal, generates an initial sub-device communication list, and connects to each sub-device based on the initial sub-device communication list. The gateway evaluates the network quality parameters of each sub-device connection to determine whether the network quality is stable. If the network quality is stable, the sub-device and its MAC address are saved to the stable communication list to obtain a stable downlink communication sub-device set; If the network quality is unstable, the unstable sub-device will be removed from the communication list to generate a sub-device list after removal. Through the sub-device list after removal, the gateway sends a secondary scan command to all sub-devices, triggering the sub-device broadcast name to be changed to SERGYX1n; S1042. After receiving the secondary scan command, the sub-device scans surrounding devices to determine whether a SERGYX0n broadcast exists in the scan list, generates a sub-device scan result, and based on the sub-device scan result, if a SERGYX0n broadcast exists and the network stability assessment passes, establishes a secondary network connection with the sub-device and determines the secondary network topology. Through the secondary network topology, the sub-device sends instructions to the lower-level sub-device, and the broadcast name of the lower-level sub-device is changed to SERGYX1n. The networking is expanded in sequence to obtain a complete downstream network structure; the gateway obtains the complete downstream network structure, saves the routing link MAC addresses of all sub-devices, and generates a downstream communication routing list.

[0034] For example, the gateway initiates the downlink network establishment process, scanning all sub-devices and acquiring each broadcast signal to generate an initial sub-device communication list. The scan range is 10 meters and lasts 20 seconds, acquiring information for all sub-devices broadcasting the names gateway0 or SERGYn1. Based on the initial sub-device communication list, the gateway connects to each sub-device one by one and evaluates the network quality parameters of each connection, using RSSI values ​​as an evaluation metric. If the RSSI value is greater than -70dBm and the packet loss rate is less than 5%, the network quality is considered stable. If the network quality is stable, the sub-device and its MAC address are saved to a stable communication list, resulting in a stable downlink communication sub-device set consisting of the sub-device MAC address and its corresponding RSSI value. If the network quality is unstable, the unstable sub-device is removed from the communication list, generating a post-removal sub-device list. Removal criteria include an RSSI value less than -70dBm or a packet loss rate greater than 5%. Based on this post-removal sub-device list, the gateway issues a secondary scan command to all sub-devices, triggering a change in the sub-device's broadcast name to SERGYX1n. The command includes the new broadcast name and scan parameters. After receiving the secondary scan command, the slave device scans for nearby slave devices to determine if a SERGYX0n broadcast is found in the scan list. This scan lasts 15 seconds, generating a slave scan result containing the broadcast name and RSSI value of the scanned slave device. Based on the slave scan result, if SERGYX0n is present and the network stability assessment passes, the slave device establishes a secondary network connection with it and determines the secondary network topology. During this connection process, a communication whitelist mechanism is implemented, allowing only slave devices with matching MAC addresses to establish a connection. Within the secondary network topology, the slave device sends a command to its subordinate sub-devices, changing their broadcast name to SERGYX1n. This network is then expanded sequentially to form a complete downstream network structure, with the broadcast name rank of each sub-device increasing by 1 as the network is formed. The gateway obtains the complete downstream network structure, saves the routing link MAC addresses of all devices, and generates a downstream communication routing list containing the MAC address and corresponding broadcast name rank of each sub-device.

[0035] In a specific implementation, the obtaining of independent communication data of the uplink network includes: S1051. Actively scan the gateway through the sub-device to obtain the gateway's broadcast signal and determine whether the gateway identifier gateway0 is included. If so, connect to the gateway and save the gateway MAC address to obtain the initial connection to the uplink network. S1052. Based on the initial connection to the uplink network, the sub-device changes its broadcast name to SERGYn1, obtains and stores the gateway MAC address, and determines whether the gateway identifier gateway or the relay device identifier SERGY appears in the scan list for 20 consecutive seconds. If not, it enters the sleep broadcast mode to determine the sleep state of the uplink network. S1053. Detect the relay device identifier SERGY by scanning the list, obtain the signal stability and relay level, and determine whether there is a relay device with the lowest level that is stable. If so, connect to the relay device and change the broadcast name to SERGYn (current level + 1) to obtain the hierarchical connection of the upstream network. S1054. Based on the hierarchical connection of the uplink network, a network stability check is performed to obtain RSSI and data transmission rate fluctuation data to determine whether the connection is stable. If stable, a communication list is saved to determine a stable uplink network. The obtaining of independent communication data of the downlink network includes: S1055. After the gateway is powered on, scan the sub-devices to obtain the sub-device broadcast signal and determine whether the network quality is stable. If stable, save the communication list and issue a secondary scan command to obtain the initial connection of the downlink network; S1056. Based on the initial connection of the downstream network, the sub-device changes the broadcast name to SERGYX1n, checks whether SERGYX0n is included in the scan list, and determines the network stability. If stable, a secondary network is constructed and a command is sent to the lower-level device to determine the hierarchical connection of the downstream network. S1057. Obtain the control command and routing link MAC address issued by the gateway through the hierarchical connection of the downstream network, and determine whether there is a matching first-level device MAC. If so, transmit the command to the next level through the communication whitelist connection to obtain the data transmission path of the downstream network; S1058. Based on the data transmission path of the downlink network, use the uplink network to transmit confirmation data, obtain a confirmation signal from the upper-level device, and determine whether the data has been successfully uploaded to the gateway. If successful, send a success command to the sub-device that initiated the connection to confirm the completion of the two-way communication; S1059. Upon completion of the two-way communication, obtain records of five consecutive data transmission failures to determine whether network reconstruction is triggered. If so, rescan and reconstruct the uplink and downlink networks to obtain a new network communication structure.

[0036] For example, when acquiring independent communication data from the upstream network, after startup, the sub-device scans the surrounding broadcast signals at a 10Hz frequency, detecting devices with a signal strength threshold above -80dBm. If a gateway broadcasting the name gateway0 is found, a connection is established and its MAC address 00:1A:7D:DA:71:13 is recorded, completing the upstream network initialization. The sub-device then changes its broadcast name to SERGY11 and stores the gateway MAC. If no valid signal is detected within a 20-second scanning cycle, it switches to a sleep broadcast mode with a 5-second interval to reduce power consumption. When multiple SERGY prefix sub-devices are scanned, the SERGY21 sub-device with the lowest RSSI average of -65dBm and the lowest level identifier is selected. After connecting, it updates its broadcast name to SERGY32 and records the MAC address of the upper-level sub-device. RSSI values ​​are sampled at 100ms intervals, and the link is considered stable when the standard deviation is less than 3dB.

[0037] For example, when acquiring independent communication data from the downlink network, the gateway scans surrounding devices at an 8Hz frequency upon startup. It issues a networking command containing the secondary network identifier, SERGYX01, to any device that maintains a signal strength above -70dBm for three consecutive scans. Upon receiving the command, the device switches its broadcast to SERGYX12. Upon detecting the SERGYX01 device, it verifies link quality through a packet loss test (10 consecutive 1KB packet transmission success rates exceeding 95%). If this test passes, it establishes a secondary routing table. The gateway issues a control command with the target device's MAC address and the routing path [00:1A:7D:DA:71:13, 00:1B:44:11:3A:E7]. The primary device matches 00:1B:44:11:3A:E7 in its local routing table and establishes a communication whitelist connection for data transmission. After the data reaches the terminal device, it sends an acknowledgement frame containing a 16-bit CRC checksum back through the uplink path. Upon receipt, the gateway sends a 0xAA success response code to the primary device. When the uplink data retransmission counter reaches the threshold of 5 times, the device clears the existing routing table and re-executes the initial scanning process in a 30-second cycle, maintaining the original broadcast name unchanged.

[0038] For specific implementation, refer to the uplink data transmission process. Figure 3 As shown, for data transmission on the uplink network, the sub-device connects to the upper sub-device through the communication whitelist address to transmit data. If the data transmission is successful, the connection is disconnected and the device enters sleep mode. Otherwise, the data is stored and retransmitted periodically until network reconstruction is triggered, including: S1061. The sub-device initiates a connection request with the upper-level sub-device through the stored communication whitelist MAC address and obtains the connection status; If the connection status is successful, the sub-device sends the data to be transmitted to the upper-level sub-device via the Bluetooth protocol and obtains data transmission confirmation; If the data transmission confirmation indicates success, the sub-device disconnects from the upper-level sub-device and sleeps to confirm that the data transmission is complete; If the data transmission confirmation indicates failure, the sub-device stores the data to be transmitted in the local cache and determines the number of transmission failures; If the number of transmission failures does not reach 5, the sub-device will re-initiate the connection through the communication whitelist MAC address after the set time interval to obtain the new connection status; If the number of transmission failures reaches 5, the sub-device triggers the network reconstruction process to obtain a new network topology; S1062. Based on the new network topology, the sub-device updates the communication whitelist MAC address, determines the new upper-level sub-device, and initiates a connection with the new upper-level sub-device using the updated communication whitelist MAC address to obtain the connection status. If the connection status is successful, the sub-device extracts the data to be transmitted from the local cache and sends it to the new upper-level sub-device, and obtains a data transmission confirmation.

[0039] For example, a slave device initiates a connection request with a higher-level slave device using a stored communication whitelist MAC address, such as "00:1A:7D:DA:71:13," and uses the Bluetooth protocol's connection request command to obtain the connection status. If the connection status is successful, the slave device sends the data to be transmitted, such as "25.3°C" collected by the temperature sensor, to the higher-level slave device using the Bluetooth protocol data frame format. The higher-level device returns a data transmission confirmation frame, "ACK." If the data transmission confirmation indicates success, the slave device executes the disconnect command, confirming that the data transmission is complete and enters sleep mode. If the data transmission confirmation indicates failure, the slave device stores the data to be transmitted in a local cache, such as at address 0x1000 in the EEPROM, and determines the number of transmission failures, such as the current number of failures being 3. If the number of transmission failures has not reached 5, the slave device re-initiates a connection using the communication whitelist MAC address after a set interval, such as 30 seconds, to obtain a new connection status. If the number of transmission failures reaches 5, the slave device triggers a network reconfiguration process, such as broadcasting "SERGYn1" and scanning for surrounding devices to determine the new network topology. Based on the new network topology, the slave device updates its communication whitelist MAC address, for example, updating the parent sub-device's MAC address to "00:1A:7D:DA:71:14," identifying the new parent sub-device. Using the updated communication whitelist MAC address, the slave device initiates a connection with the new parent sub-device and obtains the connection status. If the connection status is successful, the slave device retrieves the data to be transmitted from its local cache, for example, reading "25.3°C" from address 0x1000 in the EEPROM, and sends it to the new parent sub-device, receiving confirmation of data transmission.

[0040] For specific implementation, refer to the downlink data transmission process. Figure 5 As shown, according to the data transmission requirements of the downlink network, the gateway retrieves the routing list of the target sub-device, transmits the control instructions to the target sub-device step by step through the communication whitelist connection, and initiates retransmission or network reconstruction if the transmission fails, including: S1071. The gateway obtains the downlink communication list uploaded after the network is successfully established, determines the network routing list of the target sub-device, and generates a control instruction carrying the routing link MAC address based on the network routing list of the target sub-device, thereby obtaining a control instruction data packet containing the MAC address. S1072. The gateway retrieves the MAC address of the primary device, establishes a connection with the primary sub-device using a communication whitelist mechanism, and determines whether the connection is successful. If the primary sub-device is successfully connected, the primary sub-device retrieves the MAC address of the secondary sub-device, transmits a control command using the communication whitelist mechanism, and determines whether the command reaches the secondary sub-device. S1073. Based on the instruction transmission result, if the instruction reaches the second-level sub-device, the MAC addresses of the subsequent-level sub-devices are retrieved in sequence, and the instruction is transmitted step by step using the communication whitelist mechanism to obtain the final sub-device reception status. After the final sub-device receives the control instruction, it executes the instruction and generates a confirmation message, which is sent to the gateway via the uplink transmission path to determine whether the handshake confirmation is completed; S1074. If the handshake confirmation is not completed, the gateway initiates a control command retransmission after a preset time interval, obtains the number of retransmissions, and determines whether it has reached 5 times. If the number of retransmissions reaches 5 times and is still unsuccessful, the gateway initiates network reconstruction, rescans the device and updates the downlink communication list to determine whether the target sub-device is in the network. If the target sub-device is not scanned after the network reconstruction, the gateway marks the sub-device as offline and generates a sub-device offline record.

[0041] For example, after networking is complete, the gateway stores a downlink communication list containing network routing information for all sub-devices. For example, the routing path for sub-device A is [Gateway → Sub-device B → Sub-device C → Sub-device A]. When controlling sub-device A, the gateway parses the routing list, extracts the MAC address chain [00:1A:3F, 00:1B:4E, 00:1C:5D], and encapsulates the control command into a JSON-formatted packet: {"cmd":"on","route":["00:1A:3F","00:1B:4E","00:1C:5D"]}. The gateway uses the BLE protocol to scan and match the MAC address 00:1A:3F of first-level sub-device B at an RSSI threshold of -70dBm. If a connection is successful, the command forwarding module in sub-device B is triggered. Sub-device B extracts the next-hop MAC address 00:1B:4E from the packet and establishes a connection with sub-device C using an AES-128 encrypted channel, with transmission latency kept within 50ms. After receiving the command, sub-device C verifies the CRC32 checksum. If the check passes, it continues forwarding to sub-device A. Sub-device A executes the command and generates an ACK frame, which is transmitted back to the gateway via the reverse path [00:1C:5D→00:1B:4E→00:1A:3F]. If the gateway does not receive an ACK within the 200ms timeout window, it triggers an exponential backoff retransmission algorithm with an initial retransmission interval of 1s and a maximum of 5 retries. If the retry fails, the gateway initiates topology reconstruction based on the OLSR protocol, broadcasting a probe frame to scan for responses from surrounding sub-devices. If no response message is received from sub-device A within the 30-second probe period, the last_online field in the sub-device status table is updated to UNREACHABLE.

[0042] In a specific implementation, the use of a cellular networking method to extend the network communication distance includes: S1081. After the sub-device is powered on, it scans for gateways or relay devices through the Bluetooth module, obtains the MAC addresses and signal strengths of the devices in the scan list that contain the gateway identifier "gateway" or the relay device identifier "SERGY", and determines the list of connectable devices. S1082. Based on the scan list, if a device with a gateway identifier of "gateway" or a relay device identifier of "SERGY" exists in the list, the sub-device compares the signal strength and relay level, and preferentially selects the device with the lowest level and the most stable signal for connection, thereby obtaining the MAC address of the upper-level sub-device with successful connection. S1083. After the sub-device successfully connects, it changes its broadcast name to SERGYn and the current level plus 1. By storing the MAC address of the upper-level sub-device, it builds a communication whitelist connection and determines its hierarchical position in the network. If the sub-device does not scan a device with the gateway identifier gateway or a relay device identifier SERGY for 20 consecutive seconds, it switches to sleep broadcast mode, obtains a low-power state, and determines whether to suspend the networking attempt. S1084. The sub-device periodically sends a test data packet to the upper-level sub-device to obtain the network stability verification result. If the verification result is stable, the network is confirmed to be successful and a stable communication link is confirmed. S1085. When the sub-device needs to transmit data uplink, it connects to the upper-level sub-device through the communication whitelist MAC address, transmits data, and receives a confirmation signal from the upper-level sub-device to obtain the data transmission status; S1086. If the upper-level sub-device does not return a confirmation signal, the sub-device stores the data that was not successfully transmitted and triggers a retransmission mechanism through a timer to determine whether the threshold of five consecutive transmission failures has been reached; If the transmission fails for 5 times in a row, the sub-device initiates network reorganization, rescans the gateway or relay device, obtains the new upper-level sub-device MAC address, and determines the new networking path; S1087. After receiving the data uploaded by the sub-device, the gateway retrieves the routing link MAC address of the target sub-device through the downlink communication list, sends a control instruction and obtains the handshake confirmation of the sub-device to determine the data downlink transmission status.

[0043] For example, after powering on, a slave device uses its Bluetooth module to scan for nearby devices at 100-millisecond intervals. It obtains the MAC addresses and signal strengths of devices with the gateway identifier "gateway" or the relay identifier "SERGY" in the scan list. It then selects devices with signal strengths greater than -70dBm to determine the list of connectable devices. Based on the scan list, if a device with the gateway identifier "gateway" or the relay identifier "SERGY" exists, the slave device compares signal strength and relay level, prioritizing devices with level 1 and signal strengths greater than -65dBm for connection. This determines the MAC address of the parent sub-device to which the connection was successfully made. Upon successful connection, the slave device changes its own broadcast name to "SERGY2" and, by storing the parent sub-device's MAC address, establishes a communication whitelist connection and determines its hierarchical position in the network. If the slave device fails to scan for a device with the gateway identifier "gateway" or the relay identifier "SERGY" for 20 consecutive seconds, it switches to sleep broadcast mode, adjusts the broadcast interval to 5 seconds, enters a low-power state, and determines whether to suspend networking attempts. A slave device sends a test packet to its upstream device every 30 seconds to verify network stability. If three consecutive test packets are successfully received, the network is successfully established and a stable communication link is established. When a slave device needs to transmit data uplink, it connects to the upstream device using a MAC address in the communication whitelist, transmits data, and receives an acknowledgment from the upstream device. If no acknowledgment is received within 500 milliseconds, the data transmission is considered unsuccessful. If the upstream device does not return an acknowledgment, the slave device stores the unsuccessful data and triggers a retransmission mechanism every 10 seconds to determine whether a threshold of five consecutive transmission failures has been reached. If five consecutive transmission failures are reached, the slave device initiates network reorganization, rescanning gateways or relay devices to obtain a new upstream device MAC address and establish a new network path. After receiving data uploaded by the slave device, the gateway retrieves the routing link MAC address of the target slave device from the downlink communication list, sends a control command, and obtains a handshake confirmation from the slave device. If no handshake confirmation is received within one second, the downlink data transmission is considered unsuccessful.

[0044] In a specific implementation, the determination of whether the stability of the uplink network and the downlink network meets a preset threshold value, and if not, triggering a network reconstruction process to rescan and reconstruct the uplink network or the downlink network to ensure the stability and real-time performance of the communication system, includes: S1091. After the gateway is powered on, it scans the sub-devices, obtains the RSSI value and connection response time of each sub-device, calculates the RSSI stability, and uploads a packet of test data to the lower-level sub-device at a preset interval based on the RSSI stability and connection response time, and records the actual time interval for the lower-level sub-device to receive the data. S1092. Using the connection stability, RSSI stability, and communication time interval, a network quality assessment algorithm is used to output a quality score for each connection link. If the quality score of a connection link is lower than a preset threshold, the link is removed from the network list to obtain a list of links that meet the quality requirements. S1093. Based on the list of links that meet the quality requirements, a network topology is constructed level by level to determine the upper and lower level connection relationships of sub-devices at each level. If, after the overall networking is completed, it is detected that a known sub-device has not been scanned, each sub-device in the current link is notified to scan for the sub-device and obtain its RSSI stability and communication time interval. S1094. Using the scan data of the unscanned sub-device, a network quality assessment algorithm is used to determine the optimal link to which the sub-device in the current link can be connected by the sub-device. If the quality of the optimal link of the unscanned sub-device is still lower than a preset threshold, a network reconstruction process is triggered to rescan all sub-devices and reconstruct an uplink or downlink network. S1095. Update the network list and connection relationship according to the reconstructed network topology, and determine a new stable communication link.

[0045] For example, after powering on, the gateway activates its Bluetooth scanning module, continuously scanning for nearby devices at 100ms intervals. It records the RSSI value for each device and calculates the variance over 10 scans. If the variance is less than 5dBm, the connection is considered stable. The gateway sends a 10-byte test packet to each device and records the average latency from transmission to ACK response. Devices exceeding 200ms are marked as high-latency devices. Every 30 seconds, the gateway sends a 50-byte packet containing a timestamp to downstream devices. These devices record the reception time and calculate the time interval jitter. Link quality scores are calculated using a weighted algorithm (RSSI stability accounts for 40%, latency jitter for 30%, and packet loss rate for 30%). Links with scores below 60 are removed from the available list. The system uses the Dijkstra algorithm to construct the network topology, prioritizing links with a quality score above 80 as backbone paths. When it is detected that the MAC address of a device is missing from the preset device list, all network devices are triggered to perform a directional scan of the device at intervals of 150ms, collecting the RSSI average (e.g., -65dBm±3dBm) and response time (e.g., 180ms±20ms) between it and each node. The quality assessment algorithm compares the comprehensive scores of each candidate link and selects the link with the highest score greater than 75 as the new access point. If the scores of all candidate links are lower than the threshold, the system clears the current routing table, re-performs a full scan, and uses the K-means clustering algorithm to group the devices, selecting a central node as a relay for each group. The reconstructed network topology generates a new routing priority list, marking links with an average delay of less than 150ms and an RSSI fluctuation of less than 4dBm as preferred paths.

[0046] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A method for implementing BLE self-organizing network technology, characterized in that: The method comprises the following steps: Obtain a gateway and multiple sub-devices in a Bluetooth communication system; the gateway is used to communicate with the cloud and manage the sub-devices, and the sub-devices serve as terminal devices to establish connections with the gateway or other sub-devices; Start the uplink network construction process; scan the gateway or relay device through the sub-device to access the network. If a gateway or relay device is scanned, change the broadcast name and save the upper sub-device address to establish an uplink communication link; A network stability verification mechanism is used to obtain signal strength stability and communication time interval data for each sub-device in the uplink network, and a stable connection link is determined using a preset network quality assessment algorithm; Start the downlink network construction process; the gateway scans the sub-devices and saves the communication list. If the network quality is stable, the list is saved. Otherwise, the unstable devices are removed and a secondary scan is initiated to build the downlink network. Acquire independent communication data from the uplink and downlink networks; the uplink network is used for sub-devices to transmit data to the gateway, and the downlink network is used for the gateway to issue control instructions to sub-devices, ensuring that two-way communication does not interfere with each other; For data transmission on the upstream network, the sub-device connects to the upper sub-device through the communication whitelist address to transmit data. If the data transmission is successful, the connection is disconnected and the device goes into sleep mode. Otherwise, the data is stored and retransmitted periodically until network reconstruction is triggered. Based on the data transmission requirements of the downlink network, the gateway retrieves the routing list of the target sub-device and transmits control instructions to the target sub-device step by step through the communication whitelist connection. If the transmission fails, retransmission is initiated. When the maximum number of retransmission failures is reached, the network is reconstructed. Use cellular networking to extend network communication distance; sub-devices prioritize connecting to the lowest-level and most stable relay device, building a multi-level transmission network to cover long-distance communication scenarios; Determine whether the stability of the uplink and downlink networks meets the preset threshold. If not, trigger the network reconstruction process to rescan and build the uplink or downlink network to ensure the stability and real-time performance of the communication system.

2. A method for implementing BLE ad hoc network technology according to claim 1, characterized in that: The obtaining of a gateway and multiple sub-devices in the Bluetooth communication system includes: After the gateway is powered on, it scans the surrounding Bluetooth devices, obtains the RSSI value and MAC address of the sub-device's broadcast signal, and saves it to the gateway's initial device list. Based on the initial device list, the gateway connects to the sub-devices one by one, and sends test data packets to obtain connection stability and communication time interval to determine whether the network quality is stable. If the network quality is stable, the sub-device will be added to the gateway's communication whitelist and the sub-device's MAC address and routing information will be saved; if it is unstable, the sub-device will be removed from the list and the gateway's scan list will be updated; The gateway sends a secondary scanning command to the sub-devices in the communication whitelist. The sub-device changes its broadcast name to SERGYX1n and continues to scan for unconnected sub-devices around it to obtain a list of new sub-devices. Based on the scanned list, it evaluates the RSSI stability and communication interval of the new sub-devices, identifies the new sub-devices with stable connections, and saves their MAC addresses. If the new sub-device has a stable connection with the upper-level sub-device, the broadcast name of the new sub-device is modified to SERGYX1n+1 to build a secondary network; if there is no stable connection, the gateway is notified to update the scan list; Through the communication whitelist and routing information saved by the gateway, the gateway receives the control instructions issued by the cloud, retrieves the MAC address and routing link of the target sub-device, and sends the instructions to the first-level sub-device. Based on the instructions received by the first-level sub-device, it forwards them to the target sub-device step by step through the MAC address in the communication whitelist, obtains the confirmation response of the target sub-device, and determines whether the instruction is successfully issued. If the instruction is successfully issued, the confirmation response is transmitted to the gateway through the uplink and the communication record is saved. If the issuance fails five times in a row, the gateway is triggered to rescan and reorganize the network and update the routing information.

3. A method for implementing BLE ad hoc network technology according to claim 2, characterized in that: The sub-device scans for a gateway or relay device to access the network, and if a gateway or relay device is found, the broadcast name is changed and the address of the upper sub-device is saved to establish an uplink communication link, including: After the sub-device is powered on, it scans the gateway identifier gateway0 or the relay device identifier SERGY, obtains the scan list, and saves the MAC address of the gateway or relay device; If the scan list contains the gateway identifier gateway0, the sub-device changes its broadcast name to SERGYn1, saves the gateway MAC address, and determines the uplink communication link of the first-level sub-device; If the scan list does not contain the gateway identifier gateway0, but contains the relay device identifier SERGY, the sub-device selects the relay device identifier SERGY with a stable signal and the lowest level to connect to, and obtains the relay device MAC address. After the connection is successful, the sub-device changes the broadcast name to SERGYn+1, saves the upper-level sub-device MAC address, and determines the multi-level uplink communication link; The sub-device establishes a connection with the upper-level sub-device through the MAC address in its communication whitelist, transmits uplink data, and determines whether the data is confirmed to be received by the upper-level sub-device; If the data is confirmed to be received by the upper-level sub-device, the upper-level sub-device will continue to transmit it to the upper-level sub-device through the MAC address in its communication whitelist, and then pass it to the gateway in turn to obtain the data upload completion status; If the data is not confirmed to be received by the upper-level sub-device, the sub-device stores the data, periodically initiates retransmission through the MAC address in its communication whitelist, and determines whether the number of retransmissions reaches 5; If the number of retransmissions reaches 5, the sub-device initiates network reconstruction, rescans the gateway or relay device, builds a new uplink communication link, and determines the network reorganization status.

4. A method for implementing BLE ad hoc network technology according to claim 3, characterized in that: The network stability verification mechanism is used to obtain signal strength stability and communication time interval data for each sub-device in the uplink network, and a stable connection link is determined using a preset network quality evaluation algorithm, including: The sub-device starts scanning, sequentially obtains RSSI data of the upper-level connectable sub-device, records the RSSI value of each scan, calculates RSSI stability, and obtains RSSI stability data. Based on the RSSI stability data, the sub-device uploads a packet of test data to the upper-level sub-device at a preset time interval, records the actual time interval for the upper-level sub-device to receive the data, and obtains the communication time interval data; Using RSSI stability data and communication time interval data, the sub-device calculates the connection stability and communication efficiency to determine the network quality score of the current upper-level sub-device; If the network quality score of the current upper-level sub-device meets the preset stable connection threshold, the sub-device saves the MAC address and link information of the upper-level sub-device to obtain a stable connection link; If the network quality score of the current upper-level sub-device does not meet the preset stable connection threshold, the sub-device scans the upper-level sub-device of the next level, repeatedly obtains RSSI stability and communication time interval data, and determines the new network quality score; If all the upper-level sub-devices at the next level do not have a link that meets the stable connection threshold, the sub-device sets a poor location flag and uses a comprehensive analysis algorithm of network quality and link length to determine the optimal link; Based on the optimal link, the sub-device establishes a connection with the upper-level sub-device through the MAC address in the communication whitelist, uploads the poor location flag to the gateway, obtains the gateway confirmation instruction, and after the gateway confirms the instruction, the sub-device uploads the poor location flag and link information to the cloud platform, triggering the operation and maintenance notification process, and obtains the link adjustment task stored in the cloud. Based on the link adjustment task stored in the cloud, the sub-device receives the optimized routing instruction issued by the gateway, updates the MAC address in the communication whitelist, and determines a new stable connection link.

5. A method for implementing BLE ad hoc network technology according to claim 4, characterized in that: The gateway scans the sub-devices and saves the communication list. If the network quality is stable, the list is saved. Otherwise, the unstable devices are removed and a secondary scan is initiated to build a downlink network, including: The gateway scans all sub-devices and obtains each broadcast signal, generating an initial sub-device communication list. Based on the initial sub-device communication list, the gateway connects to each sub-device one by one, evaluates the network quality parameters of each sub-device connection, and determines whether the network quality is stable. If the network quality is stable, the sub-device and its MAC address are saved to the stable communication list to obtain a stable downlink communication sub-device set; If the network quality is unstable, the unstable sub-device will be removed from the communication list to generate a sub-device list after removal. Through the sub-device list after removal, the gateway sends a secondary scan command to all sub-devices, triggering the sub-device broadcast name to be changed to SERGYX1n; After receiving the secondary scan command, the sub-device scans surrounding devices to determine whether there is a SERGYX0n broadcast in the scan list, and generates a sub-device scan result. Based on the sub-device scan result, if SERGYX0n is present and the network stability assessment passes, the sub-device establishes a secondary network connection with the device and determines the secondary network topology. Through the secondary network topology, the sub-device sends instructions to the lower-level sub-device, and the broadcast name of the lower-level sub-device is changed to SERGYX1n. The networking is expanded in sequence to obtain a complete downstream network structure; the gateway obtains the complete downstream network structure, saves the routing link MAC addresses of all sub-devices, and generates a downstream communication routing list.

6. A method for implementing BLE ad hoc network technology according to claim 5, characterized in that: The obtaining of independent communication data of the uplink network includes: The sub-device actively scans the gateway, obtains the gateway's broadcast signal, and determines whether it contains the gateway identifier gateway0. If so, it connects to the gateway and saves the gateway MAC address to obtain the initial connection to the upstream network; According to the initial connection of the upstream network, the sub-device changes the broadcast name to SERGYn1, obtains and stores the gateway MAC address, and determines whether the gateway identifier gateway or the relay device identifier SERGY appears in the scanning list for 20 consecutive seconds. If not, it enters the sleep broadcast mode to determine the sleep state of the upstream network; The relay device identification SERGY is detected by scanning the list, and the signal stability and relay level are obtained. It is determined whether there is a stable relay device with the lowest level. If so, the relay device is connected and the broadcast name is changed to SERGYn current level + 1 to obtain the hierarchical connection of the upstream network; Based on the hierarchical connection of the uplink network, network stability verification is performed to obtain RSSI and data transmission rate fluctuation data to determine whether the connection is stable. If stable, the communication list is saved to confirm the stable networking of the uplink network; The obtaining of independent communication data of the downlink network includes: After the gateway is powered on, it scans the sub-devices, obtains the sub-device broadcast signal, and determines whether the network quality is stable. If stable, it saves the communication list and issues a secondary scanning command to obtain the initial connection of the downlink network; Based on the initial connection of the downstream network, the child device changes the broadcast name to SERGYX1n, checks whether SERGYX0n is included in the scan list, and determines the network stability. If stable, a secondary network is constructed and instructions are sent to the lower-level device to determine the hierarchical connection of the downstream network. Through the hierarchical connection of the downstream network, the control instructions and routing link MAC address issued by the gateway are obtained to determine whether there is a matching first-level device MAC. If so, the instructions are transmitted to the next level through the communication whitelist connection to obtain the data transmission path of the downstream network; According to the data transmission path of the downlink network, the uplink network is used to transmit confirmation data, obtain the confirmation signal of the upper-level device, and determine whether the data is successfully uploaded to the gateway. If successful, a success command is sent to the sub-device that initiated the connection to confirm the completion of two-way communication; By completing two-way communication, we obtain records of five consecutive data transmission failures to determine whether network reconstruction is triggered. If so, we rescan and reconstruct the uplink and downlink networks to obtain a new network communication structure.

7. A method for implementing BLE ad hoc network technology according to claim 6, characterized in that: For data transmission on the uplink network, the sub-device connects to the upper sub-device through the communication whitelist address to transmit data. If the data transmission is successful, the sub-device disconnects and enters sleep mode. Otherwise, the data is stored and retransmitted periodically until network reconstruction is triggered, including: The sub-device initiates a connection request with the upper-level sub-device through the stored communication whitelist MAC address and obtains the connection status; If the connection status is successful, the sub-device sends the data to be transmitted to the upper-level sub-device via the Bluetooth protocol and obtains data transmission confirmation; If the data transmission confirmation indicates success, the sub-device disconnects from the upper-level sub-device, confirms that the data transmission is complete, and enters the sleep state; If the data transmission confirmation indicates failure, the sub-device stores the data to be transmitted in the local cache and determines the number of transmission failures; If the number of transmission failures does not reach 5, the sub-device will re-initiate the connection through the communication whitelist MAC address after the set time interval to obtain the new connection status; If the number of transmission failures reaches 5, the sub-device triggers the network reconstruction process to obtain a new network topology; According to the new network topology, the sub-device updates the communication whitelist MAC address and determines the new upper-level sub-device. Through the updated communication whitelist MAC address, the sub-device initiates a connection with the new upper-level sub-device and obtains the connection status. If the connection status is successful, the sub-device extracts the data to be transmitted from the local cache and sends it to the new upper-level sub-device, and obtains a data transmission confirmation.

8. A method for implementing BLE ad hoc network technology according to claim 7, characterized in that: According to the data transmission requirements of the downlink network, the gateway retrieves the routing list of the target sub-device, transmits the control instructions to the target sub-device step by step through the communication whitelist connection, and initiates retransmission or network reconstruction if the transmission fails, including: The gateway obtains the downlink communication list uploaded after the network is successfully established, determines the network routing list of the target sub-device, and generates a control instruction based on the network routing list of the target sub-device and carries the MAC address of the routing link, obtaining a control instruction data packet containing the MAC address; The gateway retrieves the MAC address of the primary device, uses the communication whitelist mechanism to establish a connection with the primary sub-device, and determines whether the connection is successful. If the primary sub-device is successfully connected, the primary sub-device retrieves the MAC address of the secondary sub-device, transmits the control command through the communication whitelist mechanism, and determines whether the command reaches the secondary sub-device. According to the command transmission result, if the command reaches the second-level sub-device, the MAC address of the subsequent sub-device is retrieved in sequence, and the communication whitelist mechanism is used to transmit the command step by step to obtain the final sub-device reception status. After the final sub-device receives the control command, it executes the command and generates a confirmation message, which is sent to the gateway through the uplink transmission path to determine whether the handshake confirmation is completed; If the handshake confirmation is not completed, the gateway initiates a control command retransmission after a preset time interval, obtains the number of retransmissions, and determines whether it has reached 5 times. If the number of retransmissions reaches 5 and is still unsuccessful, the gateway initiates network reconstruction, rescans the device and updates the downlink communication list to determine whether the target sub-device is in the network. If the target sub-device is not scanned after the network reconstruction, the gateway marks the sub-device as offline and generates a sub-device offline record.

9. A method for implementing BLE ad hoc network technology according to claim 8, characterized in that: The method of extending the network communication distance by adopting a cellular networking method includes: After the sub-device is powered on, it scans the gateway or relay device through the Bluetooth module, obtains the MAC address and signal strength of the gateway identifier gateway or relay device identifier SERGY in the scan list, and determines the list of connectable devices; According to the scan list, if there is a device with the gateway identifier gateway or the relay device identifier SERGY in the list, the sub-device compares the signal strength and relay level, and preferentially selects the device with the lowest level and the most stable signal for connection, and obtains the MAC address of the upper-level sub-device with successful connection; After the sub-device successfully connects, it changes its own broadcast name to SERGYn (the current level plus 1). By storing the MAC address of the upper-level sub-device, it builds a communication whitelist connection and determines its hierarchical position in the network. If the sub-device does not scan a device with the gateway identifier gateway or a relay device identifier SERGY for 20 consecutive seconds, it switches to sleep broadcast mode, obtains a low-power state, and determines whether to suspend the networking attempt. The sub-device periodically sends test data packets to the upper-level sub-device to obtain the network stability verification results. If the verification results are stable, it confirms that the network is successful and a stable communication link is confirmed; When a sub-device needs to transmit data uplink, it connects to the upper-level sub-device through the communication whitelist MAC address, transmits data and receives the confirmation signal from the upper-level sub-device to obtain the data transmission status; If the upper-level sub-device does not return a confirmation signal, the sub-device stores the data that was not successfully transmitted and triggers a retransmission mechanism through a timer to determine whether the threshold of 5 consecutive transmission failures has been reached; If the transmission fails for 5 times in a row, the sub-device initiates network reorganization, rescans the gateway or relay device, obtains the new upper-level sub-device MAC address, and determines the new networking path; After receiving the data uploaded by the sub-device, the gateway retrieves the routing link MAC address of the target sub-device through the downlink communication list, sends a control instruction and obtains the handshake confirmation of the sub-device to determine the data downlink transmission status.

10. A method for implementing BLE ad hoc network technology according to claim 9, characterized in that: The determination of whether the stability of the uplink network and the downlink network meets a preset threshold, and if not, triggering a network reconstruction process to rescan and reconstruct the uplink network or the downlink network to ensure the stability and real-time performance of the communication system, includes: After the gateway is powered on, it scans the sub-devices, obtains the RSSI value and connection response time of each sub-device, calculates the RSSI stability, and uploads a packet of test data to the sub-device at preset intervals based on the RSSI stability and connection response time, and records the actual time interval for the sub-device to receive data. A network quality assessment algorithm is used based on connection stability, RSSI stability, and communication time interval to output a quality score for each connection link. If the quality score of a connection link is lower than a preset threshold, the link is removed from the network list to obtain a list of links that meet the quality requirements. Based on the list of links that meet the quality requirements, the network topology is constructed layer by layer to determine the upper and lower level connection relationships of each sub-device. If, after the overall networking is completed, it is detected that a known sub-device has not been scanned, each sub-device in the current link is notified to scan for the sub-device and obtain its RSSI stability and communication time interval; Using the scan data of unscanned sub-devices, a network quality assessment algorithm is used to determine the optimal link to which sub-device in the current link the sub-device can connect. If the quality of the optimal link of the unscanned sub-device is still lower than the preset threshold, the network reconstruction process is triggered to rescan all sub-devices and build an uplink or downlink network. According to the reconstructed network topology, the network list and connection relationship are updated to determine a new stable communication link.

Citation Information

Patent Citations

  • Power line carrier ad-hoc network method, device and system

    CN104168281A

  • Self-organized networking method based on low-rate wireless network

    CN105072663A

  • Mesh networking method based on Bluetooth low energy and system thereof

    CN108738005A

  • Technologies for network path and topology management

    US20220124548A1

  • Game theoretic prioritization scheme for mobile ad HOC networks permitting hierarchal deference

    WO2006029297A2

Cited By

  • Equipment communication control method and device, gateway equipment and storage medium

    CN121334222A