A device connection method and system based on a distributed soft bus of the Hongmeng

By using a device connection method based on HarmonyOS distributed soft bus, multi-mode discovery and link quality adjustment are employed to solve the problems of connection stability and management efficiency in multi-device interconnection, achieving stable, secure, and adaptive interconnection between devices, thereby improving reliability and user experience.

CN121907634BActive Publication Date: 2026-07-07SHENZHEN HONGYUAN ZHITONG TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN HONGYUAN ZHITONG TECH CO LTD
Filing Date
2026-03-24
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing technologies suffer from poor connection stability and low connection management efficiency when interconnecting multiple devices. In particular, traditional wireless networks are susceptible to connection interruptions caused by environmental interference and device movement, and their connection management efficiency is low.

Method used

The device connection method based on HarmonyOS distributed soft bus is adopted. The target device is determined through multi-mode discovery, and the target connection device is selected according to HarmonyOS distributed registry and device capability description file. Security authentication is performed, and stable connection is maintained by adjusting link quality parameters.

Benefits of technology

It enables fast, secure, adaptive, and stable interconnection between devices, significantly reducing connection interruption rate and transmission latency, and improving the reliability and user experience of multi-device collaboration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121907634B_ABST
    Figure CN121907634B_ABST
Patent Text Reader

Abstract

The application provides a device connection method and system based on a distributed soft bus of a Hongmeng, and the method comprises the following steps: determining a discovery device within a preset range of a target device; determining a target connection device according to a device capability description file corresponding to the discovery device in a distributed register of the Hongmeng; performing security authentication with the target connection device according to a distributed identification of the Hongmeng of the target device, establishing a distributed soft bus connection of the Hongmeng, and adjusting a connection strategy according to a link quality parameter of the distributed soft bus connection of the Hongmeng, so that the target device and the target connection device are in a stable connection state. The application selects a target connection device and completes security authentication to establish a connection by generating a distributed identification and a capability description file for the device, and performs self-adaptive adjustment according to real-time link quality to maintain a stable connection state, so that fast, safe and self-adaptive stable interconnection between devices is realized, the connection interruption rate and the transmission delay are significantly reduced, and the reliability of multi-device cooperation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of distributed communication technology, and in particular to a device connection method and system based on HarmonyOS distributed soft bus. Background Technology

[0002] With the advent of the Internet of Things era, the demand for multi-device collaboration is growing in scenarios such as smart homes (e.g., mobile phones, TVs, air conditioners, cameras), industrial control (e.g., sensors, controllers, actuators), and vehicle connectivity (e.g., in-vehicle systems, mobile phones, navigation devices). Currently, multi-device interconnection mainly relies on traditional wireless networks (e.g., WiFi, Bluetooth) or wired networks (e.g., Ethernet), but there are the following key problems: Poor connection stability: Traditional WiFi / Bluetooth connections are easily affected by environmental interference (e.g., wall obstruction, electromagnetic radiation, signal superposition from multiple devices), leading to frequent connection interruptions (e.g., frequent stuttering when playing videos on a mobile phone and smart TV in a home setting); In industrial scenarios, equipment movement or vibration may cause wired connections to loosen, resulting in data transmission interruptions and affecting production processes; Low connection management efficiency: Traditional multi-device connections require manual pairing by the user (e.g., entering a PIN code for Bluetooth pairing, entering a password for WiFi pairing), and cannot dynamically adapt to changes in device status (e.g., needing to reconnect manually after a power outage and restart), especially in scenarios with a large number of devices (e.g., dozens of sensors in an industrial setting), where connection management efficiency is extremely low. Summary of the Invention

[0003] This application provides a device connection method and system based on HarmonyOS distributed soft bus to solve the problem of low connection stability of multi-device interconnection in related technologies.

[0004] The first aspect of this application provides a device connection method based on HarmonyOS distributed soft bus, the device connection method based on HarmonyOS distributed soft bus includes:

[0005] The target device is identified by using a multi-mode discovery method to determine the devices within a preset range.

[0006] The target connection device is determined based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry;

[0007] Security authentication is performed between the target device and the target connected device based on the first HarmonyOS distributed identifier of the target device, and a HarmonyOS distributed soft bus connection is established.

[0008] Based on the link quality parameters of the HarmonyOS distributed soft bus connection, the connection strategy is adjusted to control the target device and the target connected device to be in a stable connection state.

[0009] Optionally, in the first implementation of the first aspect of this application, before the step of determining the discovery device within the preset range of the target device through the multi-mode discovery mode, the method further includes:

[0010] The unique identifier and manufacturer information of the target device are encrypted and calculated to generate a first HarmonyOS distributed identifier;

[0011] Based on the HarmonyOS distributed capability framework, obtain the hardware interface type, maximum transmission bandwidth, and functional service information of the target device;

[0012] A second device capability description file is generated based on the hardware interface type, the maximum transmission bandwidth, and the functional service information.

[0013] The first HarmonyOS distributed identifier and the second device capability description file are stored in the HarmonyOS distributed registry.

[0014] Optionally, in the second implementation of the first aspect of this application, the step of determining the target connection device based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry includes:

[0015] Obtain the first device capability description file for each discovered device from the HarmonyOS distributed registry;

[0016] Based on the transmission capabilities recorded in the first device capability description file corresponding to each discovered device, a matching degree evaluation is performed with the current transmission requirements to obtain a matching degree evaluation result.

[0017] Based on the matching degree evaluation results and the real-time distance parameters, historical online stability parameters and security level parameters of each discovery device, a weighted calculation is performed to determine the connection priority score of each discovery device.

[0018] The target connection device is determined from the discovered devices based on the connection priority score.

[0019] Optionally, in the third implementation of the first aspect of this application, the step of performing security authentication with the target connection device based on the first HarmonyOS distributed identifier and establishing a HarmonyOS distributed soft bus connection includes:

[0020] The first authentication mode or the second authentication mode is determined based on the real-time distance between the target device and the target connected device.

[0021] When the first authentication mode is determined, the first HarmonyOS distributed identifier of the target device and the second HarmonyOS distributed identifier of the target connected device are exchanged via near-field wireless communication, and bidirectional encrypted authentication is performed based on the exchanged identifiers;

[0022] When the second authentication mode is determined, the second HarmonyOS distributed identifier of the target connected device is verified according to the HarmonyOS distributed registry, and a remote encrypted authentication based on the HarmonyOS distributed identifier is initiated after the verification is passed.

[0023] After the two-way encryption authentication or the remote encryption authentication is passed, a HarmonyOS distributed soft bus connection is established between the target device and the target connected device.

[0024] Optionally, in the fourth implementation of the first aspect of this application, the step of adjusting the connection strategy based on the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connection device to be in a stable connection state includes:

[0025] The signal strength, packet loss rate and transmission delay of the HarmonyOS distributed soft bus connection are collected according to a preset period to generate a link quality parameter set.

[0026] The link quality parameter set is compared with a preset stability threshold. When any parameter in the link quality parameter set exceeds the corresponding threshold for a preset number of consecutive times, it is determined as a connection quality degradation event.

[0027] The connection quality degradation events are analyzed to determine the types of interference sources that caused the degradation.

[0028] Communication frequency band switching or transmission time slot allocation is performed based on the type of interference source.

[0029] After the communication frequency band switching or transmission time slot allocation is completed, the link quality parameters of the HarmonyOS distributed soft bus connection are collected until the stability threshold is met and the connection is in a stable state.

[0030] Optionally, in the fifth implementation of the first aspect of this application, after the step of adjusting the connection strategy according to the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connection device to be in a stable connection state, it further includes:

[0031] Obtain the data tasks to be transmitted on the HarmonyOS distributed soft bus connection and their corresponding service priority tags;

[0032] Based on the business priority tags, the data tasks are divided into a high-priority task set and a low-priority task set;

[0033] Allocate guaranteed bandwidth that meets the transmission rate requirements to each task in the set of high-priority tasks, and generate a bandwidth allocation scheme.

[0034] Based on the total available bandwidth of the HarmonyOS distributed soft bus connection and the bandwidth allocation scheme, the remaining available bandwidth is determined and configured as the shared transmission bandwidth of the low-priority task set.

[0035] Optionally, in the sixth implementation of the first aspect of this application, after the step of adjusting the connection strategy according to the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connection device to be in a stable connection state, it further includes:

[0036] Receive data requests from non-HarmonyOS protocol devices and forward them through the protocol conversion gateway using non-HarmonyOS communication protocols;

[0037] The data request is parsed to extract the corresponding control commands and data payload;

[0038] The control commands and data payloads are repackaged based on the format of the HarmonyOS distributed soft bus protocol to generate a HarmonyOS protocol data stream.

[0039] The HarmonyOS protocol data stream is transmitted to the target connected device via the HarmonyOS distributed soft bus connection.

[0040] A second aspect of this application provides a device connection system based on HarmonyOS distributed soft bus, the device connection system based on HarmonyOS distributed soft bus being used to implement a device connection method based on HarmonyOS distributed soft bus, the device connection system based on HarmonyOS distributed soft bus comprising:

[0041] The discovery module is used to determine the discovery devices within a preset range of the target device through a multi-mode discovery method;

[0042] The determination module is used to determine the target connection device based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry;

[0043] The connection module is used to perform security authentication with the target connection device based on the first HarmonyOS distributed identifier and establish a HarmonyOS distributed soft bus connection.

[0044] The control module is used to perform connection strategy adjustments based on the link quality parameters of the HarmonyOS distributed soft bus connection, and to control the target device and the target connected device to be in a stable connection state.

[0045] A third aspect of this application provides an electronic device, including a memory and a processor, wherein the processor is configured to execute a computer program stored in the memory, and when the processor executes the computer program, it implements the steps of the device connection method based on HarmonyOS distributed soft bus provided in the first aspect of this application.

[0046] The fourth aspect of this application provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements the steps of the device connection method based on HarmonyOS distributed soft bus provided in the first aspect of this application.

[0047] In summary, the device connection method and system based on HarmonyOS distributed soft bus provided in this application determines the target device from within a preset range through a multi-mode discovery mode; determines the target connection device based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry; performs security authentication with the target connection device based on the first HarmonyOS distributed identifier of the target device to establish a HarmonyOS distributed soft bus connection; and adjusts the connection strategy based on the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connection device to maintain a stable connection state. This application selects the target connection device and completes security authentication to establish a connection by generating a distributed identifier and capability description file for the device, and then adaptively adjusts based on real-time link quality to maintain a stable connection state. This achieves fast, secure, and adaptive stable interconnection between devices, significantly reducing connection interruption rate and transmission latency, and improving the reliability and user experience of multi-device collaboration. Attached Figure Description

[0048] Figure 1 A schematic flowchart illustrating the device connection method based on HarmonyOS distributed soft bus provided in this application embodiment;

[0049] Figure 2 A schematic diagram of the program modules of a device connection system based on HarmonyOS distributed soft bus provided in an embodiment of this application;

[0050] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0051] To make the inventive objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0052] To address the issue of low connection stability in multi-device interconnection in related technologies, embodiments of this application provide a device connection method based on the HarmonyOS distributed soft bus, such as... Figure 1This is a flowchart illustrating the device connection method based on HarmonyOS distributed soft bus provided in this embodiment. The device connection method based on HarmonyOS distributed soft bus includes the following steps:

[0053] Step 110: Determine the target device within the preset range through the multi-mode discovery mode.

[0054] Specifically, after the target device starts up or enters the connection preparation state, it utilizes the multi-mode discovery technology provided by HarmonyOS distributed soft bus to detect surrounding communicable devices within a preset spatial range. This multi-mode discovery technology operates on the parallel basis of multiple wireless communication standards, achieving rapid sensing through short-range, low-power communication while expanding the detection coverage by combining medium- and long-range communication capabilities, thereby improving the success rate of discovery in complex environments. During the discovery process, the system uniformly analyzes and filters received broadcast information, excluding devices that lack connectivity capabilities or do not meet current communication conditions, ultimately forming a set of discovered devices with potential communication possibilities with the target device, avoiding invalid connection attempts and improving overall connection efficiency.

[0055] Step 120: Determine the target connection device based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry.

[0056] Specifically, the system analyzes the capabilities of discovered devices based on the HarmonyOS distributed registry to determine the most suitable target connection device. The HarmonyOS distributed registry pre-stores device capability descriptions for each discovered device, reflecting its communication capabilities, supported data types, and available functional services. After reading the relevant capability descriptions, the system matches and evaluates the recorded transmission capabilities against the actual communication needs of the current business scenario. It also comprehensively considers parameters such as real-time distance between devices, historical online stability, and security levels, and uses preset calculation rules to generate a connection priority score. In this way, the system can automatically filter out communication targets that are superior in performance, stability, and security from multiple discovered devices, thereby determining the target connection device.

[0057] Step 130: Perform security authentication with the target connected device based on the first HarmonyOS distributed identifier of the target device, and establish a HarmonyOS distributed soft bus connection.

[0058] Specifically, after the target connection device is determined, security authentication is performed based on the HarmonyOS distributed identifier system, and a HarmonyOS distributed soft bus connection is established. Both the target device and the target connection device hold a distributed identifier generated by encryption of unique identification information, and select an appropriate authentication method based on the spatial distance between them. Under short-range communication conditions, both parties exchange identifiers via short-range wireless communication and perform bidirectional encrypted authentication based on the exchange result. Under long-range communication conditions, the validity of the identifier is verified through the HarmonyOS distributed registry, and remote encrypted authentication is initiated after successful verification. Upon successful authentication, a distributed soft bus connection is established based on the trusted identity, thereby ensuring the communication link possesses both identity trustworthiness and data transmission security.

[0059] Step 140: Adjust the connection strategy according to the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connected device to be in a stable connection state.

[0060] Specifically, after the distributed soft bus connection is established and put into operation, the communication status is continuously monitored through link quality awareness technology to maintain a stable connection. Key parameters such as signal strength, packet loss rate, and transmission delay during the connection process are collected at preset intervals, and the collected results are compared and analyzed with preset stability thresholds. When continuous degradation of link quality is detected, the system further determines the cause of the interference and dynamically adjusts the connection strategy based on the analysis results, such as performing communication frequency band switching or reallocating transmission time slots. Through this adaptive adjustment mechanism, the connection status is gradually restored to a level that meets stability requirements, thereby ensuring reliable and continuous data communication between the target device and the target connected device in complex environments.

[0061] In an optional implementation of this embodiment, before the step of determining the target device within a preset range through the multi-mode discovery mode, the method further includes: performing encrypted calculations on the unique identification information and manufacturer information of the target device to generate a first HarmonyOS distributed identifier; obtaining the hardware interface type, maximum transmission bandwidth, and functional service information of the target device based on the HarmonyOS distributed capability framework; generating a second device capability description file based on the hardware interface type, maximum transmission bandwidth, and functional service information; and storing the first HarmonyOS distributed identifier and the second device capability description file in the HarmonyOS distributed registry.

[0062] In this embodiment, before a device connects to the HarmonyOS distributed system, a trusted and unique distributed identity needs to be constructed for the target device. This process is based on the unique identification information fixed at the device's factory. This identification information can be a chip-level serial number or a unique number stored in the device's security unit, combined with manufacturer information as part of the identity source. Manufacturer information is used to distinguish devices from different manufacturers, preventing identification conflicts between devices from different sources in the distributed environment. The above information is concatenated according to a predetermined data structure and input into an encryption calculation process (the encryption algorithm includes, but is not limited to, the SM3 hash algorithm). This encryption calculation process uses an irreversible digest calculation method to map the original information into a fixed-length encrypted result. Since the calculation result cannot be reversed to restore the original data, the uniqueness of the identity is guaranteed while avoiding the leakage of sensitive device information. This encrypted result serves as the first HarmonyOS distributed identity. In a smart home scenario, for example, for a smart screen device, the distributed identity generated after the main control chip number and corresponding manufacturer code are encrypted as described above can serve as the unique identity credential for the smart screen in the home distributed network. After the distributed identity is generated, the capability information of the target device is collected and organized based on the HarmonyOS distributed capability framework. The HarmonyOS Distributed Capability Framework is a system component used to unify and abstract device capabilities, providing standardized descriptions of the hardware and functional characteristics of different types of devices. This framework can directly obtain the types of hardware interfaces supported by a target device, such as whether it has a wireless network interface, a short-range communication interface, or a wired data interface; it also obtains the maximum transmission bandwidth that the device can support under current hardware conditions, reflecting the data transmission capacity the device can carry under stable operating conditions; furthermore, it reads the device's registered functional service information, which describes the business capabilities the device can provide, such as video playback, audio output, or status control. In the aforementioned smart screen application scenario, the capability framework can identify that the device supports a high-speed wireless interface, has the bandwidth capability to meet high-definition content transmission, and has display and audio output-related functional services. After completing the capability information collection, the system integrates the hardware interface type, maximum transmission bandwidth, and functional service information to generate a second device capability description file. This capability description file uses a unified data organization format to structurally express the device capabilities, allowing other devices to understand the target device's communication and business capabilities without directly accessing hardware details. The capability description file is not only used for connection decisions but also provides a basis for bandwidth allocation and connection maintenance. After constructing the distributed identifier and capability description file, the first HarmonyOS distributed identifier and the second device capability description file are associated and stored in the HarmonyOS distributed registry. The HarmonyOS distributed registry is a logical storage unit for centrally managing device identity and capability information, supporting the registration, querying, and updating of device information.By storing identification and capability information in a unified manner, other devices in a distributed environment can quickly obtain the trusted identity and capability profile of a target device through the registry after discovering it, thereby reducing invalid connection attempts and improving connection efficiency.

[0063] In one optional implementation of this embodiment, the step of determining the target connection device based on the first device capability description file corresponding to the discovery device in the HarmonyOS distributed registry includes: obtaining the first device capability description file of each discovery device from the HarmonyOS distributed registry; performing a matching degree evaluation based on the transmission capabilities recorded in the first device capability description file corresponding to each discovery device and the current transmission requirements to obtain a matching degree evaluation result; performing a weighted calculation based on the matching degree evaluation result and the real-time distance parameters, historical online stability parameters, and security level parameters of each discovery device to determine the connection priority score of each discovery device; and determining the target connection device from the discovery devices based on the connection priority score.

[0064] In this embodiment, after completing device discovery and forming a set of discovered devices, the system first reads the capability information of each discovered device based on the HarmonyOS distributed registry. The HarmonyOS distributed registry, as a unified information management carrier in a distributed environment, internally maintains the mapping relationship between device distributed identifiers and device capability description files. When a discovered device is identified, the system can initiate a query request to the registry through the corresponding distributed identifier to obtain the first device capability description file corresponding to that discovered device. This capability description file records the data transmission characteristics that the device can support in a structured form, reflecting the actual carrying capacity of the device at the communication layer. In smart home application scenarios, for example, after a mobile terminal discovers a smart screen, smart speaker, and home gateway in the living room, it can obtain the corresponding capability description files for each of the three from the registry to further analyze their communication capabilities.

[0065] After obtaining the capability description files of each discovered device, the system conducts a matching degree assessment based on the transmission requirements of the current business scenario. Transmission requirements describe the communication capability requirements of the current business to be executed, such as whether it involves high-bitrate video streams, real-time audio data, or low-speed control commands. The system reads key information such as the maximum transmission bandwidth and data stream type supported by each discovered device from the capability description files and compares this information with the current transmission requirements item by item. If the device's capabilities can cover or exceed the transmission conditions required by the current business, the corresponding matching degree is judged to be high; if it can only partially meet the requirements, the matching degree is correspondingly lowered. Through this assessment process, the system generates a matching degree assessment result for each discovered device that reflects its business adaptability. In the aforementioned smart home scenario, when a mobile terminal needs to select a display device for 4K video playback, the smart screen obtains a high matching degree due to its high bandwidth and video processing capabilities recorded in its capability description file, while the smart speaker's matching degree is significantly lower because it lacks video display capabilities.

[0066] After completing the matching degree assessment, multi-dimensional parameters are further introduced to comprehensively rank the discovered devices. These multi-dimensional parameters include, but are not limited to, real-time distance parameters, historical online stability parameters, and security level parameters. The real-time distance parameter reflects the spatial proximity between the target device and the discovered device; this parameter can be calculated using methods such as wireless signal strength to assess communication stability and energy consumption. The historical online stability parameter reflects the reliability of the discovered device in maintaining online connectivity during past operations; this parameter can be formed based on statistics such as the number of disconnections and online duration. The security level parameter describes the device's level of identity trustworthiness and data protection capabilities. The matching degree assessment results and the above parameters are incorporated into a weighted calculation process, where different parameters participate in the scoring according to pre-set weight ratios to form a connection priority score. After calculating the connection priority score for each discovered device, they are ranked according to the score results, and the device with the highest score is selected as the target connection device, thereby ensuring that the selected device can achieve an optimal balance in terms of transmission capacity, connection stability, and security in the current business scenario.

[0067] In one optional implementation of this embodiment, the step of establishing a HarmonyOS distributed soft bus connection by performing security authentication with the target connected device based on the first HarmonyOS distributed identifier includes: determining a first authentication mode or a second authentication mode based on the real-time distance between the target device and the target connected device; when the first authentication mode is determined, exchanging the first HarmonyOS distributed identifier of the target device and the second HarmonyOS distributed identifier of the target connected device through near-field wireless communication, and performing bidirectional encrypted authentication based on the exchanged identifier; when the second authentication mode is determined, verifying the second HarmonyOS distributed identifier of the target connected device according to the HarmonyOS distributed registry, and initiating remote encrypted authentication based on the HarmonyOS distributed identifier after successful verification; and establishing a HarmonyOS distributed soft bus connection between the target device and the target connected device after successful bidirectional encrypted authentication or remote encrypted authentication.

[0068] In this embodiment, after determining the target connected device, a security authentication phase is initiated. This phase selects an appropriate authentication method based on the real-time distance between the target device and the target connected device. The real-time distance is calculated using physical characteristics such as signal strength and propagation delay generated during wireless communication, reflecting the spatial proximity of the two devices in the current environment. This distance information dynamically reflects whether the devices are within a directly perceptible short-range area, thus providing an objective basis for authentication method selection. When the real-time distance is within a preset short-range interval, the first authentication mode is adopted to fully utilize the low latency of short-range communication. In the first authentication mode, the target device and the target connected device exchange identity information via short-range wireless communication. Short-range wireless communication refers to a communication form with limited coverage and rapid signal attenuation. Its physical characteristics determine that communication content can only be received within a very small space, which helps improve the security of the identity exchange process. During communication, both parties send their respective HarmonyOS distributed identifiers, which have been encrypted and generated in the aforementioned process, making it impossible to deduce the original identity information. A session key is generated based on the identifiers received by both parties, and the authentication result calculated based on this key is returned to the other party to verify whether the communicating party truly possesses the corresponding identifier. This interaction process is completed simultaneously in two directions, thus forming a two-way encrypted authentication, ensuring the authenticity of the identities of both communicating parties and that they have not been tampered with during communication. For example, when a mobile phone and a smart speaker use the HarmonyOS "Tap to Connect" function, the devices automatically exchange HarmonyOS distributed identifiers and complete two-way encrypted authentication after touching each other. The encryption method for two-way encrypted authentication can use the SM4 hash algorithm. When the real-time distance does not meet the close-range condition, a second authentication mode can be used. In this case, the target device cannot directly perceive the physical existence of the target connected device. The authentication process relies on trusted information stored in the HarmonyOS distributed registry, submitting the distributed identifier of the target connected device to the HarmonyOS distributed registry and requesting a validity verification of the identifier. The verification process is used to confirm whether the identifier has been legally registered, whether it is in an available state, and whether it is consistent with the registered device capability information. After successful two-way encrypted authentication or remote encrypted authentication, a HarmonyOS distributed soft bus connection is created based on the established trusted identity relationship. This connection serves as a logical channel for distributed communication, used to carry subsequent data transmission and collaborative interaction, thereby achieving stable communication between the target device and the target connected device while ensuring identity trustworthiness and data security.

[0069] In one optional implementation of this embodiment, the step of adjusting the connection strategy based on the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connected device to be in a stable connection state includes: collecting the signal strength, packet loss rate, and transmission delay of the HarmonyOS distributed soft bus connection according to a preset period to generate a link quality parameter set; comparing the link quality parameter set with a preset stability threshold, and determining a connection quality degradation event when any parameter in the link quality parameter set exceeds the corresponding threshold for a preset number of consecutive times; analyzing the connection quality degradation event to determine the type of interference source causing the degradation; switching the communication frequency band or allocating transmission time slots according to the type of interference source; and collecting the link quality parameters of the HarmonyOS distributed soft bus connection after the communication frequency band switching or transmission time slot allocation is completed until the stability threshold is met and the connection is in a stable connection state.

[0070] In this embodiment, after the HarmonyOS distributed soft bus connection is established and carries service data transmission, the communication quality is dynamically monitored through a continuously running link status awareness mechanism. Signal strength reflects the effective signal level perceived by the receiver during wireless communication; this parameter is directly related to communication distance, environmental obstruction, and the degree of wireless interference. Packet loss rate describes the proportion of data that fails to reach the receiver within a unit of time and can be used to reflect link reliability. Transmission latency measures the time it takes for data to travel from the sender to the receiver and is a key indicator for judging real-time service availability. The HarmonyOS system reads the above parameters from the HarmonyOS distributed soft bus connection at preset time intervals and integrates multiple data points obtained within the same acquisition period to form a link quality parameter set, thereby reflecting the current connection status with a unified data structure. After generating the link quality parameter set, it is compared with a pre-set stability threshold. The stability threshold defines the minimum conditions required for the connection to be in an acceptable state; different parameters correspond to different threshold ranges to avoid frequent adjustments caused by a single abnormal indicator. When any parameter in the link quality parameter set exceeds its corresponding threshold for a preset number of consecutive times, the current connection is determined to have experienced a sustained quality degradation, and this state is marked as a connection quality degradation event. After the connection quality degradation event is confirmed, the characteristics of the relevant parameter changes are further analyzed to determine the type of interference source causing the degradation. The interference source type describes the main cause affecting communication quality, such as external electromagnetic interference or contention among multiple devices in the same frequency band. When the signal strength decreases significantly and the packet loss rate increases simultaneously, external electromagnetic interference can be identified; when the signal strength remains stable but the packet loss rate and latency increase significantly, congestion caused by communication resource conflicts can be identified. After identifying the type of interference source, corresponding connection strategy adjustments are executed based on the analysis results. When electromagnetic interference is identified, the HarmonyOS distributed soft bus connection is switched to a backup communication frequency band with lower interference levels to avoid the currently affected wireless environment; when resource conflicts are identified, the communication time slots are reallocated by adjusting the data transmission order and time occupation ratio, so that high-priority services can obtain more sufficient transmission resources. After completing the communication frequency band switching or transmission time slot allocation, the link quality parameters of the HarmonyOS distributed soft bus connection are collected again and compared with the stability threshold. This process continues until all parameters fall back to the threshold range, thus confirming that the connection has returned to a stable state. Through the above closed-loop adjustment process, stable communication between the target device and the target connected device can be dynamically maintained under complex environmental changes, ensuring the continuous and reliable operation of distributed collaborative services.

[0071] In one optional implementation of this embodiment, after the step of adjusting the connection strategy according to the link quality parameters of the HarmonyOS distributed soft bus connection and controlling the target device and the target connected device to be in a stable connection state, the method further includes: obtaining the data tasks to be transmitted on the HarmonyOS distributed soft bus connection and their corresponding service priority tags; dividing the data tasks into a high-priority task set and a low-priority task set based on the service priority tags; allocating guaranteed bandwidth that meets the transmission rate requirements to each task in the high-priority task set and generating a bandwidth allocation scheme; determining the remaining available bandwidth based on the total available bandwidth of the HarmonyOS distributed soft bus connection and the bandwidth allocation scheme, and configuring the remaining available bandwidth as the shared transmission bandwidth of the low-priority task set.

[0072] In this embodiment, after the HarmonyOS distributed soft bus connection is in a stable operating state, it is necessary to schedule multiple types of service data carried on the same connection in an orderly manner to ensure the transmission quality of critical services. To this end, the data waiting to be sent in the current connection is identified and organized. Each piece of data to be transmitted is considered an independent data task, representing a continuous or discrete data transmission behavior. Simultaneously, the service priority tag associated with the data task is read. This tag reflects the importance and timeliness requirements of the service in the current application scenario. The service priority tag is attached by the upper-layer service when the data is generated, for example, to identify the order of video streams, audio streams, or control commands in distributed coordination. After obtaining the data task and its service priority tag, the data task is classified according to the tag content. Data tasks with high real-time and continuity requirements are assigned to the high-priority task set, which is more sensitive to transmission interruptions or rate fluctuations; other data tasks with relatively lower real-time requirements are assigned to the low-priority task set. This classification process uses the service priority tag as the basis for judgment, ensuring that different types of services receive differentiated treatment on the same communication link. After task classification, bandwidth guarantee configuration is performed around the high-priority task set. Bandwidth describes the amount of data a communication link can carry per unit time and is a core resource affecting service quality. Based on the transmission rate requirements of the high-priority tasks, the minimum bandwidth value required to meet continuous service transmission is calculated, and corresponding bandwidth resources are reserved for each high-priority task within the total available bandwidth of the HarmonyOS distributed soft bus connection. This reservation process aims to ensure service needs, forming a clear bandwidth allocation scheme so that the transmission rate of high-priority tasks is not reduced due to other services occupying bandwidth. After completing the bandwidth allocation for high-priority tasks, the total available bandwidth of the current HarmonyOS distributed soft bus connection and the allocated bandwidth are calculated to obtain the remaining available bandwidth. The remaining available bandwidth is used to carry data transmission in the low-priority task set. This portion of bandwidth is configured as a shared transmission resource, allowing multiple low-priority tasks to share the bandwidth without affecting high-priority services. This allows device status synchronization or control feedback data to be transmitted using the remaining bandwidth, and even if there is a brief delay, it will not have a significant impact on the overall user experience. Through the above bandwidth allocation and sharing mechanism, parallel transmission of multiple services can be achieved with limited communication resources, and link utilization efficiency can be improved while ensuring the stability of critical services.

[0073] In one optional implementation of this embodiment, after adjusting the connection strategy according to the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connected device to be in a stable connection state, the method further includes: receiving data requests from non-HarmonyOS protocol devices and forwarding them through a protocol conversion gateway; parsing the data requests to extract the corresponding control commands and data payloads; re-encapsulating the control commands and data payloads based on the format of the HarmonyOS distributed soft bus protocol to generate a HarmonyOS protocol data stream; and transmitting the HarmonyOS protocol data stream to the target connected device through the HarmonyOS distributed soft bus connection.

[0074] In this embodiment, in a distributed collaborative environment, when a non-HarmonyOS protocol device needs to interact with a target connected device, its communication request first enters the HarmonyOS distributed system through a protocol conversion gateway. Non-HarmonyOS protocol devices refer to terminals or control nodes that do not run the HarmonyOS system and whose communication data follows other communication standards. Data requests generated by such devices are encapsulated according to their own protocol format. The protocol conversion gateway, as an intermediate node connecting different communication systems, has the ability to simultaneously identify multiple communication protocols and forward data. Its role is to receive data requests from non-HarmonyOS communication protocols and introduce them into the communication flow that the HarmonyOS distributed soft bus can handle. In smart home application scenarios, for example, when a mobile terminal running another operating system initiates a control request to a smart screen in the home, this request will first be received by the home gateway and forwarded as a non-HarmonyOS communication protocol data request. After the data request enters the protocol conversion gateway, the communication protocol used by the request is parsed. Protocol parsing refers to disassembling the data content according to the format rules of the communication protocol to distinguish the meaning carried by different fields. During the parsing process, the control instruction part representing the operation intention and the data payload part carrying specific business data are identified. Control commands describe the specific operations that non-HarmonyOS protocol devices want the target connected device to perform, such as play, pause, or parameter adjustment; the data payload carries the specific data content related to this operation. In the smart home scenario described above, a playback command from a non-HarmonyOS mobile terminal can be parsed into a control command to start the playback function of the smart screen, along with the corresponding video resource address or parameter information as the data payload. After completing protocol parsing and obtaining the control commands and data payload, the parsing results are repackaged according to the data organization format defined by the HarmonyOS Distributed Soft Bus. The HarmonyOS Distributed Soft Bus protocol is a unified data format for efficient communication between distributed devices. Its characteristic is the standardized description of control information and data content to support cross-device and cross-hardware collaborative transmission. The repackaging process maps the parsed control commands into control fields recognizable by the HarmonyOS Distributed Soft Bus, while organizing the data payload according to the soft bus's data carrying specifications, thereby forming a structurally complete HarmonyOS protocol data stream. The data stream maintains semantic consistency with the original request, but its format fully complies with the processing requirements of the HarmonyOS distributed communication environment. The converted HarmonyOS protocol data stream can be sent to the target connected device via the HarmonyOS distributed soft bus connection. The response data from the target connected device can then undergo reverse protocol adaptation through the protocol conversion gateway, converting the response data into a communication format that the target device can recognize. Through this bidirectional protocol conversion and soft bus carrying mechanism, devices with different communication systems can achieve seamless interaction in the same distributed environment, while avoiding intrusive changes to the original device communication logic, thereby improving the overall system's compatibility and scalability.

[0075] Optionally, in a distributed collaborative environment, to enable resource-constrained lightweight devices to stably connect to the HarmonyOS distributed soft bus system, a lightweight device adaptation mechanism is used to extend communication capabilities. Lightweight devices refer to terminal devices without a complete operating system and with limited computing and storage resources. These devices often only possess basic control and sensing functions and cannot directly run complete distributed communication components. To address this issue, the device integrates a lightweight communication unit that supports the HarmonyOS ecosystem, enabling it to participate in distributed communication without altering its original hardware architecture. This communication unit integrates streamlined data processing and encryption functions, allowing for point-to-point communication with HarmonyOS devices under low resource consumption. After integrating the communication unit, the lightweight device connects to the HarmonyOS distributed system through a simplified capability registration process. This registration process does not rely on a complete capability framework but instead uses predefined capability templates to describe the basic functions and communication characteristics that the device can support. The capability templates express the control types the device can respond to, the supported communication frequency bands, and the response latency requirements, enabling the system to identify the capability boundaries of lightweight devices in a unified manner. In smart home applications, smart light bulbs, as lightweight devices, can be described as supporting on / off control and brightness adjustment. Their communication frequency is limited to low-power wireless channels, and their response time remains within a preset range. During communication establishment, the HarmonyOS distributed soft bus employs a streamlined data interaction process for lightweight devices. This process reduces unnecessary control fields and interactions, lowering computational and transmission overhead during communication, enabling stable data exchange under limited resource conditions. Control commands are compressed into a compact data format before transmission, retaining only the core information required for execution. The receiving end can directly drive the corresponding function after parsing. For example, when a mobile terminal sends a light-on command to a smart light bulb, the command content only includes the device identifier and target status information, thus shortening the processing path and improving response speed. To ensure communication stability, the distributed soft bus's connection maintenance mechanism continuously monitors the communication status during interaction with lightweight devices. When a decline in communication quality or an increase in response latency is detected, communication is restored primarily by adjusting the transmission rhythm and retry interval, rather than introducing a complex connection reconstruction process, thereby avoiding additional burden on the lightweight device. For example, when the wireless channel is briefly interfered with, the smart bulb can still respond to control commands under the adjusted communication conditions without needing to re-establish a connection. Through this lightweight device adaptation mechanism, while ensuring the consistency of distributed communication, the requirements for device hardware resources are significantly reduced, enabling terminals that were previously unable to participate in complex distributed collaboration to stably access the HarmonyOS distributed soft bus environment. For instance, lightweight devices such as smart bulbs and sensors can form a unified collaborative network with complete HarmonyOS devices such as mobile terminals and smart screens, thereby achieving reliable cross-device control and status linkage, further expanding the coverage and application value of the distributed system.

[0076] According to the device connection method based on HarmonyOS distributed soft bus provided in this application, the following steps are taken: First, a multi-mode discovery method is used to determine the target device from within a preset range. Then, a target connection device is determined based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry. Next, security authentication is performed between the target device and the target connection device using the first HarmonyOS distributed identifier, establishing a HarmonyOS distributed soft bus connection. Finally, a connection strategy adjustment is executed based on the link quality parameters of the HarmonyOS distributed soft bus connection to maintain a stable connection between the target device and the target connection device. This application selects the target connection device and completes security authentication to establish a connection by generating a distributed identifier and capability description file for the device. Then, it adaptively adjusts the connection based on real-time link quality to maintain a stable connection. This achieves fast, secure, and adaptive stable interconnection between devices, significantly reducing connection interruption rate and transmission latency, and improving the reliability and user experience of multi-device collaboration.

[0077] Figure 2 This application provides a device connection system based on HarmonyOS distributed soft bus, which can be used to implement the device connection method based on HarmonyOS distributed soft bus in the aforementioned embodiments. Figure 2 As shown, the device connection system based on HarmonyOS distributed soft bus mainly includes:

[0078] Discovery module 10 is used to determine the discovery devices within a preset range of the target device through multi-mode discovery;

[0079] The determination module 20 is used to determine the target connection device based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry.

[0080] Connection module 30 is used to perform security authentication with the target connection device based on the first HarmonyOS distributed identifier and establish a HarmonyOS distributed soft bus connection;

[0081] The control module 40 is used to perform connection strategy adjustment based on the link quality parameters of the HarmonyOS distributed soft bus connection, and to control the target device and the target connected device to be in a stable connection state.

[0082] In an optional implementation of this embodiment, the discovery module is further configured to: perform encrypted calculations on the unique identification information and manufacturer information of the target device to generate a first HarmonyOS distributed identifier; obtain the hardware interface type, maximum transmission bandwidth, and functional service information of the target device based on the HarmonyOS distributed capability framework; generate a second device capability description file based on the hardware interface type, maximum transmission bandwidth, and functional service information; and store the first HarmonyOS distributed identifier and the second device capability description file in the HarmonyOS distributed registry.

[0083] In one optional implementation of this embodiment, the determining module is specifically used for: obtaining the first device capability description file of each discovered device from the HarmonyOS distributed registry; performing a matching degree evaluation based on the transmission capabilities recorded in the first device capability description file of each discovered device and the current transmission requirements, and obtaining a matching degree evaluation result; performing a weighted calculation based on the matching degree evaluation result and the real-time distance parameters, historical online stability parameters and security level parameters of each discovered device to determine the connection priority score of each discovered device; and determining the target connection device from the discovered devices based on the connection priority score.

[0084] In one optional implementation of this embodiment, the connection module is used to: determine a first authentication mode or a second authentication mode based on the real-time distance between the target device and the target connected device; when the first authentication mode is determined, exchange the first HarmonyOS distributed identifier of the target device and the second HarmonyOS distributed identifier of the target connected device through near-field wireless communication, and perform bidirectional encrypted authentication based on the exchanged identifiers; when the second authentication mode is determined, verify the second HarmonyOS distributed identifier of the target connected device according to the HarmonyOS distributed registry, and initiate remote encrypted authentication based on the HarmonyOS distributed identifier after the verification is passed; after the bidirectional encrypted authentication or remote encrypted authentication is passed, establish a HarmonyOS distributed soft bus connection between the target device and the target connected device.

[0085] In one optional implementation of this embodiment, the control module is specifically used to: collect signal strength, packet loss rate, and transmission delay of the HarmonyOS distributed soft bus connection according to a preset period to generate a link quality parameter set; compare the link quality parameter set with a preset stability threshold, and determine a connection quality degradation event when any parameter in the link quality parameter set exceeds the corresponding threshold for a preset number of consecutive times; analyze the connection quality degradation event to determine the type of interference source causing the degradation; perform communication frequency band switching or transmission time slot allocation according to the type of interference source; after the communication frequency band switching or transmission time slot allocation is completed, collect the link quality parameters of the HarmonyOS distributed soft bus connection until the stability threshold is met and the connection is in a stable state.

[0086] In an optional implementation of this embodiment, the control module is further configured to: acquire the data tasks to be transmitted on the HarmonyOS distributed soft bus connection and their corresponding service priority tags; divide the data tasks into a high-priority task set and a low-priority task set based on the service priority tags; allocate guaranteed bandwidth to each task in the high-priority task set to meet the transmission rate requirements, and generate a bandwidth allocation scheme; determine the remaining available bandwidth based on the total available bandwidth of the HarmonyOS distributed soft bus connection and the bandwidth allocation scheme, and configure the remaining available bandwidth as the shared transmission bandwidth of the low-priority task set.

[0087] In one optional implementation of this embodiment, the control module is further configured to: receive data requests from non-HarmonyOS protocol devices and forward them through a protocol conversion gateway; perform protocol parsing on the data requests to extract the corresponding control commands and data payloads; repackage the control commands and data payloads based on the format of the HarmonyOS distributed soft bus protocol to generate a HarmonyOS protocol data stream; and transmit the HarmonyOS protocol data stream to the target connected device via the HarmonyOS distributed soft bus connection.

[0088] According to the device connection system based on HarmonyOS distributed soft bus provided in this application, the system determines the target device from within a preset range through a multi-mode discovery mode; determines the target connection device based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry; performs security authentication with the target connection device based on the first HarmonyOS distributed identifier of the target device to establish a HarmonyOS distributed soft bus connection; and adjusts the connection strategy based on the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connection device to maintain a stable connection state. This application selects the target connection device and completes security authentication to establish a connection by generating a distributed identifier and capability description file for the device, and then adaptively adjusts based on real-time link quality to maintain a stable connection state. This achieves fast, secure, adaptive, and stable interconnection between devices, significantly reducing connection interruption rate and transmission latency, and improving the reliability and user experience of multi-device collaboration.

[0089] According to the scheme provided in this application Figure 3 An electronic device is provided as an embodiment of this application. This electronic device can be used to implement the device connection method based on HarmonyOS distributed soft bus in the foregoing embodiments, mainly including:

[0090] The system includes a memory 301, a processor 302, and a computer program 303 stored on the memory 301 and executable on the processor 302. The memory 301 and the processor 302 are connected via communication. When the processor 302 executes the computer program 303, it implements the device connection method based on the HarmonyOS distributed soft bus described in the foregoing embodiments. The number of processors can be one or more.

[0091] The memory 301 can be a high-speed random access memory (RAM) or a non-volatile memory, such as a disk storage device. The memory 301 is used to store executable program code, and the processor 302 is coupled to the memory 301.

[0092] Furthermore, embodiments of this application also provide a computer-readable storage medium, which may be disposed in the electronic device described in the above embodiments, and the computer-readable storage medium may be as described above. Figure 3 The memory in the illustrated embodiment.

[0093] The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the device connection method based on the HarmonyOS distributed soft bus described in the foregoing embodiments. Furthermore, the computer-readable storage medium can also be a USB flash drive, external hard drive, read-only memory (ROM), RAM, magnetic disk, or optical disk, or any other medium capable of storing program code.

[0094] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0095] 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 several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0096] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A device connection method based on HarmonyOS distributed soft bus, characterized in that, include: The multi-mode discovery method identifies the target device within a preset range; The target connection device is determined based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry; wherein, when the target connection device is a lightweight device, the device capability information of the lightweight device is obtained through a predefined capability template, the capability template being used to describe the basic functions and communication characteristics supported by the lightweight device; Security authentication is performed between the target device and the target connected device based on the first HarmonyOS distributed identifier of the target device, and a HarmonyOS distributed soft bus connection is established; wherein, when the target connected device is a lightweight device, a simplified data interaction process is enabled, and the simplified data interaction process reduces the communication overhead of the lightweight device by reducing control fields and the number of interactions; The connection strategy is adjusted based on the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connected device to be in a stable connection state; wherein, when a decrease in the communication quality or an increase in the response delay of the lightweight device is detected, communication is restored by adjusting the transmission rhythm and retry interval.

2. The device connection method based on HarmonyOS distributed soft bus according to claim 1, characterized in that, Before the step of determining the target device within a preset range through multi-mode discovery, the method further includes: The unique identifier and manufacturer information of the target device are encrypted and calculated to generate a first HarmonyOS distributed identifier; Based on the HarmonyOS distributed capability framework, the hardware interface type, maximum transmission bandwidth, and functional service information of the target device are obtained. A second device capability description file is generated based on the hardware interface type, the maximum transmission bandwidth, and the functional service information. The first HarmonyOS distributed identifier and the second device capability description file are stored in the HarmonyOS distributed registry.

3. The device connection method based on HarmonyOS distributed soft bus according to claim 1, characterized in that, The step of determining the target connection device based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry includes: Obtain the first device capability description file for each discovered device from the HarmonyOS distributed registry; Based on the transmission capabilities recorded in the first device capability description file corresponding to each discovered device, a matching degree evaluation is performed with the current transmission requirements to obtain a matching degree evaluation result. Based on the matching degree evaluation results and the real-time distance parameters, historical online stability parameters and security level parameters of each discovery device, a weighted calculation is performed to determine the connection priority score of each discovery device. The target connection device is determined from the discovered devices based on the connection priority score.

4. The device connection method based on HarmonyOS distributed soft bus according to claim 1, characterized in that, The step of establishing a HarmonyOS distributed soft bus connection by performing security authentication with the target connected device based on the first HarmonyOS distributed identifier of the target device includes: The first authentication mode or the second authentication mode is determined based on the real-time distance between the target device and the target connected device. When the first authentication mode is determined, the first HarmonyOS distributed identifier of the target device and the second HarmonyOS distributed identifier of the target connected device are exchanged via near-field wireless communication, and bidirectional encrypted authentication is performed based on the exchanged identifiers; When the second authentication mode is determined, the second HarmonyOS distributed identifier of the target connected device is verified according to the HarmonyOS distributed registry, and a remote encrypted authentication based on the HarmonyOS distributed identifier is initiated after the verification is passed. After the two-way encryption authentication or the remote encryption authentication is passed, a HarmonyOS distributed soft bus connection is established between the target device and the target connected device.

5. The device connection method based on HarmonyOS distributed soft bus according to claim 1, characterized in that, The step of adjusting the connection strategy based on the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connected device to be in a stable connection state includes: The signal strength, packet loss rate and transmission delay of the HarmonyOS distributed soft bus connection are collected according to a preset period to generate a link quality parameter set. The link quality parameter set is compared with a preset stability threshold. When any parameter in the link quality parameter set exceeds the corresponding threshold for a preset number of consecutive times, it is determined as a connection quality degradation event. The connection quality degradation events are analyzed to determine the types of interference sources that caused the degradation. Communication frequency band switching or transmission time slot allocation is performed based on the type of interference source. After the communication frequency band switching or transmission time slot allocation is completed, the link quality parameters of the HarmonyOS distributed soft bus connection are collected until the stability threshold is met and the connection is in a stable state.

6. The device connection method based on HarmonyOS distributed soft bus according to claim 1, characterized in that, After the step of adjusting the connection strategy based on the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connected device to be in a stable connection state, the method further includes: Obtain the data tasks to be transmitted on the HarmonyOS distributed soft bus connection and their corresponding service priority tags; Based on the business priority tags, the data tasks are divided into a high-priority task set and a low-priority task set; Allocate guaranteed bandwidth that meets the transmission rate requirements to each task in the set of high-priority tasks, and generate a bandwidth allocation scheme. Based on the total available bandwidth of the HarmonyOS distributed soft bus connection and the bandwidth allocation scheme, the remaining available bandwidth is determined and configured as the shared transmission bandwidth of the low-priority task set.

7. The device connection method based on HarmonyOS distributed soft bus according to claim 1, characterized in that, After the step of adjusting the connection strategy based on the link quality parameters of the HarmonyOS distributed soft bus connection to control the target device and the target connected device to be in a stable connection state, the method further includes: Receive data requests from non-HarmonyOS protocol devices and forward them through the protocol conversion gateway using non-HarmonyOS communication protocols; The data request is parsed to extract the corresponding control commands and data payload; The control commands and data payloads are repackaged based on the format of the HarmonyOS distributed soft bus protocol to generate a HarmonyOS protocol data stream. The HarmonyOS protocol data stream is transmitted to the target connected device via the HarmonyOS distributed soft bus connection.

8. A device connection system based on HarmonyOS distributed soft bus, characterized in that, The device connection system based on HarmonyOS distributed soft bus is used to implement the device connection method based on HarmonyOS distributed soft bus as described in claim 1, and the device connection system based on HarmonyOS distributed soft bus includes: The discovery module is used to determine the discovery devices within a preset range of the target device through a multi-mode discovery method; The determination module is used to determine the target connection device based on the first device capability description file corresponding to the discovered device in the HarmonyOS distributed registry; wherein, when the target connection device is a lightweight device, the device capability information of the lightweight device is obtained through a predefined capability template, and the capability template is used to describe the basic functions and communication characteristics supported by the lightweight device; The connection module is used to perform security authentication with the target connection device based on the first HarmonyOS distributed identifier and establish a HarmonyOS distributed soft bus connection; wherein, when the target connection device is a lightweight device, a simplified data interaction process is enabled, which reduces the communication overhead of the lightweight device by reducing control fields and interaction times; The control module is used to perform connection strategy adjustment based on the link quality parameters of the HarmonyOS distributed soft bus connection, and control the target device and the target connected device to be in a stable connection state; wherein, when a decrease in the communication quality or an increase in the response delay of the lightweight device is detected, communication is restored by adjusting the transmission rhythm and retry interval.

9. An electronic device, characterized in that, Includes memory and processor, of which: The processor is used to execute computer programs stored in the memory; When the processor executes the computer program, it implements the steps in the device connection method based on HarmonyOS distributed soft bus as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps in the device connection method based on HarmonyOS distributed soft bus as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Network access method and equipment

    CN116017310A

  • Power edge cloud collaborative management method based on swan OS

    CN120018207A