Multi-level hierarchical networking method and device based on OpenHarmony softbus

By employing a multi-level hierarchical networking approach, the problems of connection count and device discovery efficiency of the OpenHarmony soft bus in large-scale IoT scenarios are solved, achieving network scalability expansion and stability improvement, making it suitable for application scenarios such as smart cities and Industry 4.0.

CN120956556BActive Publication Date: 2026-03-06HUNAN BOJIANG INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511485291.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2026-03-06
Estimated Expiration
2045-10-17

AI Technical Summary

Technical Problem

The OpenHarmony soft bus suffers from limitations in the number of connections and network performance and device discovery efficiency issues caused by broadcast messages in large-scale IoT scenarios, making it difficult to meet the needs of large-scale device collaboration in modern smart city and Industry 4.0 applications.

Method used

A multi-level hierarchical networking method is adopted, and a three-layer network architecture is established by electing a central node and leaf nodes, including a leaf node layer, a first central node layer, and a second central node layer. Hierarchical query and intelligent routing mechanisms are used to optimize device discovery and fault detection, thereby achieving network expansion and stability.

Benefits of technology

It effectively expanded the network scale, improved device discovery efficiency and network stability, reduced query response time and connection management burden, and enhanced overall network performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120956556B_ABST
    Figure CN120956556B_ABST
Patent Text Reader

Abstract

This application relates to a multi-level hierarchical networking method and apparatus based on the OpenHarmony soft bus. This embodiment achieves effective expansion of network scale through a multi-level hierarchical architecture. The original connection limit of the OpenHarmony soft bus is applied to internal area management. The first central node of each area still follows this limit, but through hierarchical management, multiple such areas can be supported. By increasing the number of levels, a larger-scale network deployment can be achieved, providing a highly scalable solution for large-scale IoT applications. Moreover, the process of any leaf node discovering another leaf node first involves querying the local cache. If the local cache does not contain the node, it queries the cache of the first central node in the corresponding network area. If it is still not found, the other leaf node may be a leaf node in a different area, which reduces query response time and improves the overall stability of the network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of OpenHarmony distributed networking technology, and in particular to a multi-level hierarchical networking method and apparatus based on the OpenHarmony soft bus. Background Technology

[0002] OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation. It aims to build an operating system for intelligent terminals in the era of full-scenario, full-connectivity, and full-intelligence. The OpenHarmony soft bus integrates multiple devices into a whole through four pillars: unified discovery, multi-link fusion, high-efficiency transmission, and comprehensive security, providing unlimited possibilities for distributed innovation of upper-layer applications.

[0003] The OpenHarmony soft bus has a fixed connection limit, specifying that a single soft bus network can only support a maximum of 30 stable connections, and the number of TCP connections is also limited to 30. This design is adequate for small-scale scenarios such as smart homes, but it becomes a major technical barrier in scenarios requiring the collaboration of hundreds or even thousands of devices, such as smart parks and the Industrial Internet. Furthermore, the OpenHarmony soft bus's discovery mechanism, which generates a large number of broadcast messages per round in a 30-device network, causes a quadratic increase in broadcast messages as the number of devices increases, significantly impacting network performance and device discovery efficiency.

[0004] These technical limitations restrict the application of OpenHarmony softbus in large-scale IoT scenarios, making it difficult to meet the needs of modern smart cities, Industry 4.0 and other application scenarios for large-scale device collaboration. Therefore, new technical solutions are needed to solve these problems. Summary of the Invention

[0005] The following is an overview of the subject matter described in detail herein. This overview is not intended to limit the scope of the claims.

[0006] The main objective of this disclosure is to propose a multi-level hierarchical networking method and apparatus based on the OpenHarmony soft bus, which provides a solution with good scalability and improves the overall stability of the network.

[0007] A first aspect of this application provides a multi-level hierarchical networking method based on the OpenHarmony soft bus, the method comprising:

[0008] According to the OpenHarmony election method, the first score of each node in each network region in the OpenHarmony soft bus network is determined, and the node with the highest first score is designated as the first center node of the corresponding network region, and the other nodes are designated as leaf nodes; all nodes in each network region are connected according to the OpenHarmony soft bus.

[0009] Based on the network area management capability, a second score is determined for each of the first central nodes, and at least one of the first central nodes is selected as the second central node of the OpenHarmony soft bus network in descending order of the second score; the first central nodes of any two network areas are connected according to the OpenHarmony soft bus.

[0010] The process by which the first leaf node in the OpenHarmony soft bus network discovers the second leaf node includes:

[0011] The first leaf node queries the information of the second leaf node in the local cache, and establishes a connection with the second leaf node based on the query result; both the first leaf node and the second leaf node are arbitrary leaf nodes.

[0012] If the second leaf node information is not found in the local cache, the first leaf node requests a query from the corresponding first central node so that the first central node returns the query result, updates the local cache based on the query result, and establishes a connection with the second leaf node based on the query result.

[0013] If the second leaf node information is not present in the local cache and the cache of the corresponding first central node, the first leaf node requests the corresponding first central node so that the first central node forwards the request to the second central node, returns the query result and route returned by the second central node to the first central node, updates the local cache according to the query result, and establishes a connection with the second leaf node according to the query result and route.

[0014] The multi-level hierarchical networking method based on the OpenHarmony soft bus provided in this embodiment has at least the following beneficial effects:

[0015] This embodiment achieves effective network scaling through a multi-level hierarchical architecture. The original connection limit of the OpenHarmony soft bus is applied to regional management, with the first central node in each region still adhering to this limit. However, hierarchical management allows for the support of multiple such regions. Increasing the number of layers enables larger-scale network deployments, providing a highly scalable solution for large-scale IoT applications. Furthermore, the process of any leaf node discovering another leaf node first involves querying its local cache. If the local cache doesn't contain the node, it queries the cache of the first central node in the corresponding network region. If still not found, the other leaf node might be a cross-regional leaf node. In this case, cross-regional communication between first central nodes is needed to discover the leaf node signal in the cache. Compared to the OpenHarmony soft bus's discovery mechanism, which requires generating a large number of broadcast messages per round in a 30-device network, this hierarchical query strategy improves discovery efficiency. Under the hierarchical architecture, most leaf node queries can be completed locally or within a region, avoiding network-wide broadcasts, reducing query response time, alleviating the connection management burden on terminal devices, and improving overall network stability.

[0016] A second aspect of this application provides a multi-level hierarchical networking device based on the OpenHarmony soft bus, the device comprising:

[0017] The regional networking module is used to determine the first score of the nodes in each network area in the OpenHarmony soft bus network according to the OpenHarmony election method, and to designate the node with the highest first score as the first center node of the corresponding network area, and the other nodes as leaf nodes; all nodes in each network area are connected according to the OpenHarmony soft bus.

[0018] The inter-regional networking module is used to determine the second score of each first central node based on the network region management capability, and select at least one first central node as the second central node of the OpenHarmony soft bus network in descending order of the second score; the first central nodes of any two network regions are connected according to the OpenHarmony soft bus.

[0019] The discovery process module is used to execute the process of the first leaf node discovering the second leaf node, which includes:

[0020] The first leaf node queries the information of the second leaf node in the local cache, and establishes a connection with the second leaf node based on the query result; both the first leaf node and the second leaf node are arbitrary leaf nodes.

[0021] If the second leaf node information is not found in the local cache, the first leaf node requests a query from the corresponding first central node so that the first central node returns the query result, updates the local cache based on the query result, and establishes a connection with the second leaf node based on the query result.

[0022] If the second leaf node information is not present in the local cache and the cache of the corresponding first central node, the first leaf node requests the corresponding first central node so that the first central node forwards the request to the second central node, returns the query result and route returned by the second central node to the first central node, updates the local cache according to the query result, and establishes a connection with the second leaf node according to the query result and route.

[0023] A third aspect of this application provides an electronic device including at least one controller and a memory for communicatively connecting to the controller; the memory stores instructions executable by the at least one controller, the instructions being executed by the at least one controller to cause the at least one controller to perform a multi-level hierarchical networking method based on the OpenHarmony soft bus as described above.

[0024] A fourth aspect of this application provides a computer-readable storage medium storing computer-executable instructions for causing a computer to perform a multi-level hierarchical networking method based on the OpenHarmony soft bus as described above.

[0025] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 This is a flowchart illustrating a multi-level hierarchical networking method based on the OpenHarmony soft bus provided in an embodiment of this application;

[0028] Figure 2 This is a schematic diagram illustrating the process by which the first leaf node discovers the second leaf node, as provided in an embodiment of this application.

[0029] Figure 3 This is a schematic diagram of the hierarchical device discovery and intelligent routing process provided in an embodiment of this application;

[0030] Figure 4 This is a flowchart illustrating the multi-level fault detection and recovery mechanism provided in the embodiments of this application;

[0031] Figure 5 This is a schematic diagram of the physical distribution and network connection architecture of the equipment within the park provided in the embodiments of this application;

[0032] Figure 6 This is a schematic diagram of the logical topology of a smart park provided in an embodiment of this application;

[0033] Figure 7 This is a diagram showing the internal structure and fault transfer of a region as provided in an embodiment of this application;

[0034] Figure 8 This is a schematic diagram of the structure of a multi-level hierarchical networking device based on the OpenHarmony soft bus provided in the embodiments of this application;

[0035] Figure 9 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0036] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0037] In the description of this application, the use of terms such as "first," "second," etc., is for the purpose of distinguishing technical features only and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated or the order of the technical features indicated.

[0038] In the description of this application, it should be understood that the orientation descriptions, such as up, down, etc., are based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed or function in a specific orientation, and therefore should not be construed as a limitation of this application.

[0039] like Figure 1 and Figure 2 As shown in one embodiment of this application, a multi-level hierarchical networking method based on the OpenHarmony soft bus is provided, which specifically includes the following steps:

[0040] Step S110: According to the OpenHarmony election method, determine the first score of the nodes in each network area of ​​the OpenHarmony soft bus network, and take the node with the highest first score as the first center node of the corresponding network area, and the other nodes as leaf nodes; all nodes in each network area are connected according to the OpenHarmony soft bus.

[0041] Step S120: Based on the network area management capability, determine the second score of each first central node, and select at least one first central node as the second central node for OpenHarmony soft bus networking in descending order of the second score; the first central nodes of any two network areas are connected according to OpenHarmony soft bus.

[0042] Step S130, the process of the first leaf node in the OpenHarmony soft bus network discovering the second leaf node includes the following steps S1310 to S1330:

[0043] Step S1310: The first leaf node queries the information of the second leaf node in the local cache, and establishes a connection with the second leaf node according to the query result; the first leaf node and the second leaf node are both arbitrary leaf nodes.

[0044] In step S1320, if the local cache does not contain information about the second leaf node, the first leaf node requests the cache of the corresponding first central node so that the first central node returns the query result, updates the local cache according to the query result, and establishes a connection with the second leaf node according to the query result.

[0045] In step S1330, if there is no information about the second leaf node in the local cache and the cache of the corresponding first central node, the first leaf node requests the corresponding first central node so that the first central node forwards the request to the second central node, and returns the query result and route returned by the second central node to the first central node, updates the local cache according to the query result, and establishes a connection with the second leaf node according to the query result and route.

[0046] In this application, the OpenHarmony soft bus network mainly uses a three-layer hierarchical network architecture, with the three layers including:

[0047] The leaf node layer consists of multiple leaf nodes (terminal devices) networked using the OpenHarmony soft bus, such as smartphones, IoT sensors, and smart home appliances. Each leaf node in this layer only needs to establish a connection with its corresponding primary central node, simplifying the network topology. This design reduces the connection management burden on terminal devices while improving the overall stability of the network.

[0048] The first central node layer includes multiple network regions. Each network region has a first central node and multiple leaf nodes. The first central node is selected from the multiple leaf nodes.

[0049] The second central node layer includes one or more second central nodes, wherein the second central node is selected from the first central nodes in multiple network regions.

[0050] The second central node layer sits at the top of the entire architecture. The nodes in this layer are elected from the first central nodes of all regions, thus physically assuming the dual responsibilities of both a supercenter and a regional center. As a highly available cluster, they collectively handle global coordination and cross-regional management. The first central node layer forms the middle layer of the network architecture. Each network region's first central node manages devices within a geographical or logical region. These regional first central nodes possess strong computing and communication capabilities, handling tasks such as device registration, state synchronization, routing management, and fault handling within the region. Each node still adheres to the connection limit of the OpenHarmony soft bus, but hierarchical management allows for expansion of the overall network scale and maintains connections with other first central nodes to support cross-regional communication. Leaf nodes in the leaf node layer only need to establish connections with the first central node of their respective network region, simplifying the complexity of the network topology.

[0051] To address the limitation of 30 device connections on the OpenHarmony soft bus, this embodiment achieves effective network scaling through a multi-level hierarchical architecture. The core idea of ​​the hierarchical architecture is to apply the original connection limit to the management within each region. The first central node of each region still follows this limit, but multiple such regions can be supported through hierarchical management. By increasing the number of levels, a larger-scale network deployment can be achieved, providing a scalable solution for large-scale IoT applications.

[0052] Furthermore, after selecting the first central node, second central node, and leaf nodes in the OpenHarmony soft bus network, the process of any leaf node discovering another leaf node first involves checking the local cache. If the local cache does not contain the leaf node, the cache of the first central node in the corresponding network area is checked. If the leaf node is still not found, it may be a leaf node in a different region. In this case, the discovery of the leaf node signal in the cache needs to be achieved through cross-regional communication between the first central nodes. Compared with the discovery mechanism of OpenHarmony soft bus, which requires generating a large number of broadcast messages in each round in a 30-device network, this layered query strategy improves the discovery efficiency. Under the layered architecture, most leaf node queries can be completed in the local cache or within the region, avoiding network-wide broadcasting, reducing query response time, alleviating the connection management burden of terminal devices, and improving the overall stability of the network.

[0053] In some embodiments, cross-regional communication requires routing and forwarding through upper-layer nodes. The intelligent routing algorithm dynamically calculates the optimal communication path with the lowest cost based on the global network topology provided by the second central node and combined with information such as the real-time load and link quality of each first central node, ensuring the efficiency and reliability of cross-regional data transmission.

[0054] In some embodiments, after selecting at least one first central node as the second central node for the OpenHarmony soft bus network in step S120 according to the second score from high to low, the method further includes:

[0055] Step S210: Select the timestamp of the first central node or the timestamp of the second central node as the starting timestamp;

[0056] Step S220: Within the first preset time period after the start timestamp, lock the first central node or the second central node and prohibit the replacement of the first central node or the second central node.

[0057] To prevent frequent changes in network topology (i.e., network jitter) caused by instantaneous fluctuations in the state of leaf nodes, this embodiment introduces role stickiness (or hysteresis mechanism). Once a leaf node is elected as a central node (whether it is the first or second central node), its identity will be locked for a first preset time period (e.g., 30 minutes). During this period, unless the node experiences a serious failure (such as going offline or experiencing a sharp decline in performance), a re-election will not be triggered to ensure the stability of the entire network.

[0058] In some embodiments, after locking the first central node or the second central node and prohibiting its replacement during a first preset time period after the start timestamp in step S210, the method further includes:

[0059] Step S310: If, within a first preset time period, the first score of the first leaf node exceeds a first threshold compared to the first score of the first center node in the corresponding network region, and the duration of exceeding the first threshold exceeds a second preset time period, the corresponding first center node is downgraded to a leaf node in the corresponding network region, and the first leaf node is upgraded to a first center node in the corresponding network region; wherein, the duration of the second preset time period is less than the duration of the first preset time period.

[0060] For a bottom-level leaf node to challenge the existing first central node's position, its first score must be consistently and stably higher than the current first central node's first score for a second preset time period (e.g., 5 minutes), and must exceed a certain threshold (e.g., 10%). This implementation in this embodiment avoids unnecessary role switching caused by brief performance spikes, ensuring that each role change is based on a stable improvement in the device's state.

[0061] This embodiment can maintain the stability of the topology to the maximum extent while ensuring the optimality of the network architecture, thus providing a reliable network foundation for upper-layer applications.

[0062] In some embodiments, the status items in the OpenHarmony soft bus network are set with version number and priority; and the global status items of the OpenHarmony soft bus network are stored in the second central node, the regional status items of the network area are stored in the corresponding first central node, and the status items of the leaf nodes are stored in the local cache of the leaf nodes.

[0063] After selecting at least one first central node as the second central node for the OpenHarmony soft bus network in step S120 according to the second score from high to low, the method further includes:

[0064] Step S410: Determine the version number of the status item, and if the version number changes and the priority is the highest, synchronize the status item in the OpenHarmony soft bus network.

[0065] To ensure the consistency and synchronization efficiency of state information in the network, this embodiment designs a hierarchical state management architecture. Global state items are stored in the second central node, regional state items are stored in the first central node of each network region, and leaf nodes maintain local state items.

[0066] State synchronization employs an incremental update mechanism, transmitting only changed state information to reduce network overhead. The system maintains a version number and timestamp for each state item, quickly identifying data requiring synchronization through version comparison. State updates are categorized by priority; critical state changes are synchronized immediately, while general state changes can be synchronized in batches.

[0067] In some embodiments, to ensure state consistency, the network system can employ a distributed consensus protocol based on the Raft algorithm. When updating critical state items, confirmation from a majority of nodes is required before the changes can be committed. This mechanism ensures that the system maintains state consistency even in the event of network partitions or node failures.

[0068] In some embodiments, after selecting at least one first central node as the second central node for the OpenHarmony soft bus network in step S120 according to the second score from high to low, the method further includes:

[0069] Step S510: The second central node performs heartbeat detection on all the first central nodes according to the preset first time threshold.

[0070] Step S520: Each first central node performs heartbeat detection on all corresponding leaf nodes according to a preset second time threshold; wherein, the second time threshold is greater than the first time threshold.

[0071] This embodiment designs a hierarchical fault detection mechanism, with different monitoring strategies employed for nodes at different levels. The second and first central nodes, due to their critical management functions, can use more frequent heartbeat checks to detect faults within seconds. Leaf nodes can have relatively lower heartbeat check frequencies to reduce network overhead.

[0072] In some embodiments, after selecting at least one first central node as the second central node for the OpenHarmony soft bus network in step S120 according to the second score from high to low, the method further includes:

[0073] Step S610: Any first central node performs heartbeat detection on the second central node, and if no response is received from the second central node after the third time threshold, it sends a selection request to all first central nodes so that all first central nodes can perform distributed election to select a first central node as the first backup node.

[0074] Step S620: Activate the first backup node and synchronize the global status items of the first backup node, so that the first backup node can establish a management connection with other first central nodes.

[0075] In some embodiments, after selecting at least one first central node as the second central node for the OpenHarmony soft bus network in step S120 according to the second score from high to low, the method further includes:

[0076] Step S710: Select a leaf node from the network region based on the second score as the second backup node corresponding to the first central node;

[0077] In step S720, any leaf node performs a heartbeat detection on the corresponding first central node, and if it does not receive a response from the first central node after the third time threshold, it sends the fault status of the first central node to the second central node, so that the second central node can find the corresponding second backup node and activate the second backup node, so that the second backup node can establish a management connection with all leaf nodes in the network area.

[0078] This embodiment also includes a fault recovery mechanism, which employs a layered processing strategy. When the first central node fails, the system automatically activates a preset backup node or re-elects a backup node within the region and re-associates the devices in that region. When the second central node fails, the remaining second central nodes will supplement new members from the best first central nodes to maintain the robustness of the cluster.

[0079] To facilitate understanding, a set of embodiments is provided to offer a multi-level hierarchical networking method based on the OpenHarmony soft bus, specifically as follows:

[0080] like Figures 3 to 7 As shown, this embodiment addresses the limitations of OpenHarmony in its soft bus networking capabilities. When faced with large-scale device access, the OpenHarmony soft bus exposes significant technical bottlenecks and performance limitations:

[0081] 1) Connection limit: The OpenHarmony soft bus has a fixed connection limit, stipulating that a single soft bus network can support a maximum of 30 stable connections, and the number of TCP connections is also limited to 30;

[0082] 2) Broadcast device discovery: The existing OpenHarmony soft bus uses a network-wide broadcast method based on the CoAP protocol for device discovery. In networks with an increasing number of devices, the number of broadcast messages will increase exponentially, which will have a significant impact on network performance and device discovery efficiency, and the overhead is large.

[0083] 3) Fault detection and recovery latency: The heartbeat detection mechanism of the OpenHarmony soft bus is configured with a detection interval of 10 seconds, and the offline determination time of devices (i.e., nodes) exceeds 5 minutes. This configuration results in high fault detection latency and excessively long network fault recovery time, which cannot meet the application scenarios with high real-time requirements.

[0084] 4) Device caching capacity limitation: The system's device discovery cache size is limited to 100 devices. This limitation also restricts the network's scalability. When the number of devices in the network exceeds the cache capacity, frequent cache replacement will lead to a decrease in device discovery performance and increase network communication overhead.

[0085] 5) Flat network architecture: OpenHarmony soft bus adopts a completely flat peer-to-peer network architecture, where all devices have equal status in the network and lack a hierarchical management mechanism. Although the system implements a master node election mechanism, the elected master node only exists as an identifier and does not undertake actual network management functions. This design results in a lack of unified coordination and management of the network, making it impossible to achieve effective load balancing, fault isolation and resource optimization.

[0086] 6) State synchronization efficiency issues: In a flat architecture, each device needs to maintain the state information of all devices in the network. State synchronization adopts a full broadcast method and lacks incremental update and hierarchical synchronization mechanisms. As the network scale grows, the network overhead of state synchronization increases exponentially, affecting system performance and scalability.

[0087] These technical limitations restrict the application of OpenHarmony softbus in large-scale IoT scenarios, making it difficult to meet the needs of modern smart cities, Industry 4.0 and other application scenarios for large-scale device collaboration. Therefore, new technical solutions are needed to solve these problems.

[0088] To address the aforementioned technical shortcomings, this embodiment aims to overcome the technical limitations of the OpenHarmony soft bus and improve network scale and performance, specifically in the following aspects:

[0089] Firstly, it enables the election of central nodes within and between regions;

[0090] First, the election of the first central node in the network area;

[0091] Within each predefined network region (or logical group), the devices (nodes) initiate the first round of elections. This election follows OpenHarmony's election algorithm, which comprehensively evaluates factors such as hardware performance (CPU, memory), device type weight (e.g., PCs and TVs have higher weight than sensors), network connection quality, and historical stability to calculate each node's first score. The node with the highest first score is elected as the first central node for that region, and the remaining devices become leaf nodes and report to it.

[0092] Secondly, the election of the second central node;

[0093] After each network region elects its first central node, these first central nodes will initiate a second, higher-level election. This round of elections considers not only their initial score but also macro-level metrics such as cross-network region connectivity quality, load capacity, and the size of their managed regions (i.e., network region management capabilities) to form a second score. Ultimately, the 3-5 first central nodes with the highest second scores will be elected as second central nodes, forming a highly available global management cluster. Other unelected first central nodes will register and synchronize their state with the second central node cluster.

[0094] Secondly, the role stickiness and stabilization mechanism;

[0095] To prevent frequent changes in network topology (i.e., "network jitter") caused by instantaneous fluctuations in node states, this embodiment introduces role stickiness: once a node is elected as a central node (whether it is the first or second central node), its role will be locked for a preset period of time (e.g., 30 minutes). During this period, unless the node experiences a serious failure (such as going offline or a sharp performance degradation), a re-election will not be triggered to ensure the stability of the upper-layer architecture;

[0096] For a regular leaf node to challenge the position of the current first-center node, its first score must be consistently and stably higher than a certain threshold (e.g., 10%) of the current first-center node over a continuous period of time (e.g., 5 minutes). This avoids unnecessary role switching due to brief performance spikes and ensures that each role change is based on a stable improvement in the device's state.

[0097] This embodiment can maintain the stability of the topology to the maximum extent while ensuring the optimality of the network architecture, thus providing a reliable network foundation for upper-layer applications.

[0098] Thirdly, hierarchical device discovery and intelligent routing;

[0099] like Figure 3Traditional device discovery mechanisms rely on network-wide broadcasting, which can lead to performance issues in large-scale networks. This embodiment designs a hierarchical device discovery mechanism, improving discovery efficiency through multi-level caching and intelligent query strategies.

[0100] When the first leaf node needs to find the second leaf node of the target:

[0101] First, query the local cache of the first leaf node. If a match is found, return the result immediately (in milliseconds).

[0102] If a local match is not found, a query is initiated to the primary central node. The primary central node maintains the real-time status of all leaf nodes within its region, and the vast majority of discovery requests can be satisfied at this level (within 10-50 milliseconds), effectively avoiding unnecessary network broadcasts.

[0103] The first central node will only initiate a global query to the second central node when the second leaf node confirms that it is not in the local network area. The second central node quickly locates the area where the second leaf node is located based on the global device registry and returns routing information (within 50-100 milliseconds).

[0104] Secondly, the intelligent routing mechanism;

[0105] In this embodiment, different regional centers correspond to physically isolated network segments; therefore, cross-regional communication requires routing and forwarding through upper-layer nodes; intelligent routing algorithms can be used, which dynamically calculate the optimal communication path with the lowest cost based on the global network topology provided by the second center node and combined with information such as the real-time load and link quality of each first center node, to ensure the efficiency and reliability of cross-regional data transmission.

[0106] Fourthly, a multi-level fault detection and recovery mechanism;

[0107] like Figure 4 This embodiment designs a hierarchical fault detection mechanism, with different monitoring strategies for nodes at different levels. The second and first central nodes, due to their critical management functions, use more frequent heartbeat checks to detect faults within seconds; the heartbeat check frequency of leaf nodes can be relatively lower to reduce network overhead.

[0108] The embodiment also includes a fault recovery mechanism. When a leaf node fails, only the first central node needs to update its local state, which will not affect the operation of other areas. When the first central node fails, the system will automatically activate a preset backup node or re-elect one in the area and re-associate the devices in that area. When the second central node fails, the remaining second central nodes will add new members from the better first central nodes to maintain the robustness of the cluster.

[0109] Fifthly, distributed state management and synchronization;

[0110] To ensure the consistency and synchronization efficiency of state information in large-scale networks, this embodiment designs a hierarchical state management architecture. Global state items are stored in the second central node, regional state items are stored in each first central node, and terminal devices maintain local state items.

[0111] State synchronization employs an incremental update mechanism, transmitting only changed state items to reduce network overhead. The system maintains a version number and timestamp for each state item, quickly identifying data requiring synchronization through version comparison. State updates are categorized by priority, with critical state changes synchronized immediately, while general state changes can be synchronized in batches.

[0112] To ensure state consistency, the system employs a distributed consensus protocol based on the Raft algorithm. When performing critical state updates, a majority of nodes must confirm the changes before they can be committed. This mechanism ensures that the system maintains state consistency even in the event of network partitions or node failures.

[0113] The method provided in this embodiment has the following effects:

[0114] 1) Effective Network Scaling: Addressing the 30-device connection limit of the OpenHarmony soft bus, this embodiment achieves effective network scaling through a multi-level hierarchical architecture. The core idea of ​​this hierarchical architecture is to apply the original connection limit to regional management. Each primary central node still adheres to this limit, but hierarchical management allows for the support of multiple such regions. For example, with 30 primary central nodes, each managing 30 devices, the entire network can support 900 devices. This architecture supports multi-level scaling; by increasing the number of levels, larger-scale network deployments can be achieved, providing a highly scalable solution for large-scale IoT applications.

[0115] 2) Improved Device Discovery Efficiency: Compared to the OpenHarmony soft bus discovery mechanism, which requires generating a large number of broadcast messages per round in a 30-device network, this embodiment employs a hierarchical query strategy to improve discovery efficiency. Under the hierarchical architecture, most device queries can be completed locally or within a specific region, avoiding network-wide broadcasts. Local cache query response times are in the millisecond range, while regional query response times are in the 10-50 millisecond range. This hierarchical query mechanism reduces the complexity of network broadcast traffic, and its advantages become increasingly apparent as the network scales up.

[0116] 3) Improved Fault Recovery Speed: Addressing the OpenHarmony soft bus's 10-second heartbeat interval and over 5-minute fault recovery time, this embodiment implements a hierarchical differentiated fault detection mechanism. The hierarchical architecture allows for different heartbeat detection frequencies for nodes at different levels; critical management nodes use more frequent heartbeat detection, while ordinary leaf nodes maintain their original detection frequency. This hierarchical fault isolation mechanism limits the impact of localized faults, shortens fault recovery time, and improves network availability.

[0117] 4) Optimized network communication efficiency: Layered management reduces the number of connections that need to be maintained. In this architecture, each node primarily maintains connections with its superior and subordinate nodes. The intelligent routing mechanism dynamically selects the optimal path based on network topology and load conditions, resulting in higher communication efficiency compared to the random path selection in the original soft bus.

[0118] 5) Enhanced caching and state management capabilities: Compared to the OpenHarmony soft bus's caching limit of 100 devices, this embodiment implements a multi-level caching architecture. Different levels can be configured with different cache sizes, and the cache capacity of each level can be optimized according to its management scope. This hierarchical caching architecture improves cache hit rate and reduces network query overhead. The incremental state synchronization mechanism only transmits changed state information, significantly reducing network overhead compared to the original soft bus's full broadcast synchronization.

[0119] Improved system scalability and maintainability: The layered architecture makes network expansion easier, allowing for linear expansion simply by adding a first central node, without requiring large-scale adjustments to the existing network structure. Intelligent fault detection and automatic recovery mechanisms reduce manual maintenance workload, enhancing the system's self-healing capabilities and fault tolerance.

[0120] Figure 5 This diagram illustrates the physical distribution of equipment and network connections within the park.

[0121] Physical Zones: The campus is divided into different physical buildings, such as “teaching buildings”, “library” and “dormitory buildings”.

[0122] Equipment Distribution: Various types of equipment are deployed within each building. Among them, devices with strong computing and networking capabilities (such as servers, edge gateways, and smart screens) are candidates for central nodes. Other devices (such as cameras, sensors, and smart lights) exist as ordinary terminals.

[0123] Network connectivity: All buildings are interconnected through the park's backbone network, forming a unified physical network.

[0124] Figure 6 A schematic diagram of the logical topology of a smart park;

[0125] This diagram illustrates a three-tier management architecture built on top of a physical network through intelligent election.

[0126] Regional Division and Election: The "Teaching Building" is divided into Region A, and the most capable "Server A" is elected as the region center. Similarly, the "Library" and "Dormitory Building" become Region B and Region C respectively, and "Smart Screen B" and "Smart Screen C" are elected as their respective region centers.

[0127] Super Center Election: A second round of elections will be held among all regional centers (Server A, Smart Screen B, Smart Screen C), and the server with the strongest performance, "Server A", will be elected to assume the responsibilities of the second center node.

[0128] Logical hierarchy: This ultimately forms a clear three-layer logical structure:

[0129] Super Central Layer: Consists of the global management functions of server A.

[0130] Regional center layer: Consists of the regional management functions of server A, smart screen B, and smart screen C.

[0131] Leaf node layer: consists of ordinary devices (cameras, sensors, etc.) in each area.

[0132] Figure 7 Internal structure and fault transfer diagram of the region;

[0133] This diagram delves into a specific "region," showcasing its microstructure and high availability mechanisms.

[0134] Primary / backup relationship: Each region consists of one active primary central node and one backup node. Under normal circumstances, the primary node is responsible for managing all leaf nodes within the region.

[0135] Failover: The system continuously monitors the health of the primary node through mechanisms such as heartbeats. Once the primary node fails, the system automatically triggers a failover process, activating a backup node to take over all the responsibilities of the primary node, thereby ensuring the continuity and stability of regional services.

[0136] Management Relationships: Leaf nodes within the region (such as mobile phones, sensors, etc.) only need to establish a connection with the currently active central node, without needing to perceive the complex failover process.

[0137] like Figure 8 One embodiment of this application provides a multi-level hierarchical networking device based on the OpenHarmony soft bus, the device comprising:

[0138] The regional networking module 1100 is used to determine the first score of the nodes in each network area in the OpenHarmony soft bus network according to the OpenHarmony election method, and to take the node with the highest first score as the first center node of the corresponding network area, and the other nodes as leaf nodes; all nodes in each network area are connected according to the OpenHarmony soft bus.

[0139] The inter-regional networking module 1200 is used to determine the second score of each first central node based on the network area management capability, and select at least one first central node as the second central node of the OpenHarmony soft bus network in descending order of the second score; the first central nodes of any two network areas are connected according to the OpenHarmony soft bus.

[0140] The discovery process module 1300 is used to execute the process of the first leaf node discovering the second leaf node, wherein the process of the first leaf node discovering the second leaf node includes:

[0141] The first leaf node queries the information of the second leaf node in its local cache and establishes a connection with the second leaf node based on the query result; both the first leaf node and the second leaf node are arbitrary leaf nodes.

[0142] If the second leaf node information is not found in the local cache, the first leaf node requests the corresponding first central node to query, so that the first central node returns the query result, updates the local cache according to the query result, and establishes a connection with the second leaf node according to the query result.

[0143] If the second leaf node information is not found in the local cache and the cache of the corresponding first central node, the first leaf node requests the corresponding first central node so that the first central node forwards the request to the second central node, returns the query results and routes returned by the second central node to the first central node, updates the local cache according to the query results, and establishes a connection with the second leaf node according to the query results and routes.

[0144] It should be noted that the multi-level hierarchical networking device based on OpenHarmony soft bus provided in this embodiment is based on the same inventive concept as the multi-level hierarchical networking method based on OpenHarmony soft bus described above. Therefore, the content of the multi-level hierarchical networking device based on OpenHarmony soft bus described in this embodiment is also applicable to the content of the multi-level hierarchical networking method based on OpenHarmony soft bus described above, and will not be repeated here.

[0145] like Figure 9One embodiment of this application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned multi-level hierarchical networking method based on the OpenHarmony soft bus. The electronic device includes:

[0146] At least one battery;

[0147] At least one memory;

[0148] At least one processor;

[0149] At least one program;

[0150] The program is stored in memory, and the processor executes at least one program to implement the above-described multi-level hierarchical networking method based on the OpenHarmony soft bus.

[0151] This electronic device can be any smart terminal, including mobile phones, tablets, personal digital assistants (PDAs), and in-vehicle computers.

[0152] The electronic devices according to embodiments of this application will now be described in detail.

[0153] The processor 1600 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this disclosure.

[0154] The memory 1700 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 1700 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1700 and is called and executed by the processor 1600 to execute a multi-level hierarchical networking method based on the OpenHarmony soft bus according to an embodiment of this disclosure.

[0155] The input / output interface 1800 is used to implement information input and output.

[0156] The communication interface 1900 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0157] Bus 2000 transmits information between various components of the device (e.g., processor 1600, memory 1700, input / output interface 1800, and communication interface 1900);

[0158] The processor 1600, memory 1700, input / output interface 1800 and communication interface 1900 are connected to each other within the device via bus 2000.

[0159] This disclosure also provides a storage medium, which is a computer-readable storage medium storing computer-executable instructions for causing a computer to execute the above-described multi-level hierarchical networking method based on the OpenHarmony soft bus.

[0160] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0161] The embodiments described in this disclosure are for the purpose of more clearly illustrating the technical solutions of this disclosure and do not constitute a limitation on the technical solutions provided by this disclosure. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by this disclosure are also applicable to similar technical problems.

[0162] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this disclosure, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0163] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0164] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0165] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0166] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0167] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0168] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0169] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0170] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0171] The above is a detailed description of the preferred embodiments of this application. However, the embodiments of this application are not limited to the above-described implementation methods. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the embodiments of this application. All such equivalent modifications or substitutions are included within the scope defined by the claims of the embodiments of this application.

Claims

1. A multi-level hierarchical networking method based on an openharmony software bus, characterized in that, The method comprises: According to the openharmony election method, the first score of the node in each network area in the openharmony soft bus networking is determined, and the node with the highest first score is taken as the first center node of the corresponding network area, and the other nodes are taken as leaf nodes; all nodes in each network area are connected according to the openharmony soft bus; According to the network area management capability, the second score of each first center node is determined, and at least one first center node is selected as the second center node of the openharmony soft bus networking in the order from high to low according to the second score; the first center nodes of any two network areas are connected according to the openharmony soft bus; The process of discovering the second leaf node by the first leaf node in the openharmony soft bus networking comprises: The first leaf node queries the second leaf node information in the local cache, and establishes a connection with the second leaf node according to the query result; the first leaf node and the second leaf node are both arbitrary leaf nodes; In the case that the second leaf node information does not exist in the local cache, the first leaf node requests the corresponding first center node to query, so that the first center node returns the query result, and the local cache is updated according to the query result, and a connection with the second leaf node is established according to the query result; In the case that the second leaf node information does not exist in the local cache and the cache of the corresponding first center node, the first leaf node requests the corresponding first center node, so that the first center node forwards the request to the second center node, and the second center node returns the query result and the route to the first center node, and the local cache is updated according to the query result, and a connection with the second leaf node is established according to the query result and the route.

2. The multi-level hierarchical networking method based on the openharmony software bus according to claim 1, characterized in that, After the at least one first center node is selected as the second center node of the openharmony soft bus networking in the order from high to low according to the second score, the method further comprises: Taking the timestamp of the selected first center node or the timestamp of the second center node as a starting timestamp; Locking the first center node or the second center node in a first preset time period after the starting timestamp, and prohibiting the replacement of the first center node or the second center node.

3. The multi-level hierarchical networking method based on the openharmony software bus according to claim 2, characterized in that, After locking the first center node or the second center node in a first preset time period after the starting timestamp, and prohibiting the replacement of the first center node or the second center node, the method further comprises: In the first preset time period, if the first score of the first leaf node exceeds the first score of the first center node corresponding to the network region by more than a first threshold value, and the duration of exceeding the first threshold value exceeds a second preset time period, the first center node corresponding to the first center node is downgraded to a leaf node corresponding to the network region, and the first leaf node is upgraded to the first center node in the network region; wherein the duration of the second preset time period is less than the duration of the first preset time period.

4. The multi-level layered networking method based on the openharmony software bus according to claim 1, characterized in that, The state item in the openharmony soft bus networking is provided with a version number and a priority; and the global state item of the openharmony soft bus networking is stored in the second center node, the regional state item of the network region is stored in the corresponding first center node, and the state item of the leaf node is stored in the local cache of the leaf node; After the at least one first center node is selected as the second center node of the openharmony soft bus networking in the order from high to low according to the second score, the method further comprises: Judging the version number of the state item, and in the case that the version number changes and the priority is the highest, synchronizing the state item in the openharmony soft bus networking.

5. The multi-level hierarchical networking method based on the openharmony software bus according to claim 1, characterized in that, After the at least one first center node is selected as the second center node of the openharmony soft bus networking in the order from high to low according to the second score, the method further comprises: The second center node performs heartbeat detection on all the first center nodes according to a preset first time threshold value; Each first center node performs heartbeat detection on all the corresponding leaf nodes according to a preset second time threshold value; wherein the second time threshold value is greater than the first time threshold value.

6. The multi-level hierarchical networking method based on the openharmony software bus according to claim 5, characterized in that, After the at least one first center node is selected as the second center node of the openharmony soft bus networking in the order from high to low according to the second score, the method further comprises: Any first center node performs heartbeat detection on the second center node, and in the case that no response from the second center node is received within a third time threshold value, sends a selection request to all the first center nodes, so that all the first center nodes perform distributed election to select one first center node as a first backup node; The first backup node is activated, and the first backup node synchronizes the global state item, so that the first backup node establishes a management connection with other first center nodes.

7. The multi-level hierarchical networking method based on the openharmony software bus according to claim 6, characterized in that, After the at least one first center node is selected as the second center node of the openharmony soft bus networking in the order from high to low according to the second score, the method further comprises: According to the second score, one leaf node is selected from the network region as a second backup node of the first center node; Any of the leaf nodes performs heartbeat detection on the corresponding first center node, and in a case where no response of the first center node is received beyond a third time threshold, sends a failure state of the first center node to the second center node, so that the second center node finds the corresponding second backup node and activates the second backup node, so that the second backup node establishes a management connection with all the leaf nodes in the network area.

8. A multi-level layered networking device based on an openharmony software bus, characterized in that, The device comprises: An intra-area networking module configured to determine a first score of a node in each network area in openharmony soft bus networking according to an openharmony election method, and take a node with the highest first score as a first center node of the corresponding network area and other nodes as leaf nodes; and all nodes in each network area are connected according to an openharmony soft bus; An inter-area networking module configured to determine a second score of each first center node according to network area management capability, and select at least one first center node as a second center node of the openharmony soft bus networking in descending order of the second score; and the first center nodes of any two network areas are connected according to an openharmony soft bus; A discovery process module configured to perform a process in which a first leaf node discovers a second leaf node, wherein the process in which the first leaf node discovers the second leaf node comprises: The first leaf node queries second leaf node information in a local cache, and establishes a connection with the second leaf node according to a query result; and the first leaf node and the second leaf node are any leaf nodes; In a case where the second leaf node information does not exist in the local cache, the first leaf node requests a corresponding first center node to query, so that the first center node returns a query result, and the local cache is updated according to the query result, and a connection with the second leaf node is established according to the query result; In a case where the second leaf node information does not exist in the local cache and a cache of the corresponding first center node, the first leaf node requests a corresponding first center node, so that the first center node forwards the request to the second center node, and returns a query result and a route returned by the second center node to the first center node, and the local cache is updated according to the query result, and a connection with the second leaf node is established according to the query result and the route.

9. An electronic device, comprising: The device comprises at least one controller and a memory connected in communication with the controller; the memory stores instructions executable by the at least one controller, and the instructions are executed by the at least one controller to enable the at least one controller to perform a multi-level hierarchical networking method based on an openharmony soft bus according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer readable storage medium stores computer executable instructions for causing a computer to execute the multi-level layered networking method based on the openharmony software bus according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Internet of Things control method and platform based on OpenHarmony

    CN119814596A

  • Multi-master election method and device based on OpenHarmony soft bus

    CN120750732A