Communication control method of equipment, equipment and storage medium

By using a delayed switching mechanism, the real-time distance is calculated based on the physical characteristics of the signal, and the communication mode is switched after a delay when the distance exceeds a preset range. This solves the problem of unstable communication of the device near the critical point and achieves a more stable communication connection.

CN121585528APending Publication Date: 2026-02-27STATE GRID HEBEI ELECTRIC POWER CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511719371.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-21
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

In existing technologies, devices frequently switch communication modes near critical points due to instantaneous fluctuations in signal quality, leading to communication link instability.

Method used

A delay switching mechanism based on continuous judgment is introduced. By analyzing the physical characteristics of the communication signal, real-time distance information is calculated. When the distance exceeds the preset range, the system switches to the alternative communication mode after a preset delay.

Benefits of technology

This avoids frequent switching caused by signal jitter at critical points, thus improving the stability and continuity of communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121585528A_ABST
    Figure CN121585528A_ABST
Patent Text Reader

Abstract

The invention provides a communication control method of equipment, the equipment and a storage medium, and relates to the technical field of communication. According to the invention, a delay switching mechanism taking continuous judgment as a core is introduced, the communication signal of the target equipment is received based on the first communication mode, and the real-time distance information with the target equipment is calculated by analyzing the physical characteristics of the signal. And when the system detects that the distance information exceeds a preset communication distance interval of the first communication mode, starting accumulative timing and continuously detecting the distance information, and when the accumulative target duration reaches or exceeds a preset duration threshold, determining a second communication mode from the alternative communication modes according to the distance information at the moment, according to the method, the first communication mode and the second communication mode are switched, and the switching operation from the first communication mode to the second communication mode is executed, so that frequent and unnecessary switching behaviors caused by jitter of critical point signals are avoided in mechanism, meanwhile, mode communication is interrupted due to link switching, and the stability of communication switching is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a communication control method, device, and storage medium for a device. Background Technology

[0002] In related technologies, devices typically continuously monitor the signal quality of the communication link with the target device and dynamically switch communication methods to ensure efficient and stable connections. For example, they may use Received Signal Strength Indication (RSSI) or Signal-to-Noise Ratio (SNR) and preset signal quality thresholds. When the device detects that the signal quality of the current communication link is below this threshold, it triggers a communication method switching process, such as switching from Wi-Fi to Bluetooth, or from Bluetooth to NFC, to seek a more stable connection.

[0003] However, wireless signals can experience temporary fading and fluctuations during propagation due to obstruction, multipath effects, or transient interference. Near the critical point of communication distance, signal quality may fluctuate around a threshold. In this case, if switching is based solely on instantaneous signal quality, the communication link will be forcibly interrupted and enter a reconnection process during the issuance or execution of the switching command. This makes a direct switching strategy based on instantaneous signal quality judgment prone to causing unnecessary communication interruptions in critical areas, reducing communication stability. Summary of the Invention

[0004] This invention provides a communication control method, device, and storage medium for a device, which solves the problem of communication stability being affected by frequent switching of communication modes.

[0005] In a first aspect, the present invention provides a communication control method for a device, the method comprising: receiving a communication signal of a target device based on a first communication mode; determining distance information of the target device according to the communication signal; if the distance information does not match the communication distance range of the first communication mode, recording the duration of the mismatch between the distance information and the communication distance range; if the duration is greater than or equal to a preset duration, determining a second communication mode according to the distance information; and switching the communication mode of the target device from the first communication mode to the second communication mode.

[0006] In one possible implementation, before recording the duration of the mismatch between the distance information and the communication distance range if the distance information does not match the communication distance range of the first communication method, the method further includes: determining the communication task to be executed, as well as the task type and data volume requirement of the communication task to be executed, based on the communication signal of the target device; querying a preset communication strategy table according to the task type and the data volume requirement to determine the target communication distance that matches the communication task to be executed; and updating the communication distance range of the first communication method based on the target communication distance.

[0007] In one possible implementation, before recording the duration of the mismatch between the distance information and the communication distance range if the distance information does not match the communication distance range of the first communication method, the method further includes: obtaining device capability information of the target device, the device capability information including device type and target communication protocol supported by the target device; selecting a target configuration template corresponding to the target device from a preset communication configuration template according to the device type and the target communication protocol; and adjusting the communication distance range of the first communication method based on the configuration parameters defined in the target configuration template.

[0008] In one possible implementation, before recording the duration of the mismatch between the distance information and the communication distance range if the distance information does not match the communication distance range of the first communication method, the method further includes: detecting the current battery level and processor load rate, as well as the instantaneous strength of the communication signal; determining the signal fluctuation variance of the communication signal based on the instantaneous strength at each moment within a preset time period; calculating an adjustment coefficient for the communication distance range using a preset trade-off algorithm based on the battery level, processor load rate, and signal fluctuation variance; and adjusting the communication distance range of the first communication method based on the adjustment coefficient.

[0009] In one possible implementation, before receiving the communication signal of the target device based on the first communication method, the method further includes: sending a device identifier acquisition request to the target device when the target device is detected to enter the communication range; acquiring the device identifier based on the acquisition response returned by the target device, binding the device identifier with the network address of the target device, and recording the device identifier in a local device list; and matching and receiving the communication signal of the target device in the local device list based on the device identifier.

[0010] In one possible implementation, switching the communication mode of the target device from the first communication mode to the second communication mode includes: establishing a connection pool associated with the target device, the connection pool being used to maintain physical connections for at least two communication modes; determining communication quality information for each communication mode based on the distance information and the physical connections; selecting a second communication mode based on the communication quality information for each communication mode; and routing data packets transmitted by the first communication mode through the connection pool to the target communication link corresponding to the second communication mode to transmit the data packets.

[0011] In one possible implementation, the method further includes: establishing and maintaining at least two long connections for each communication method in the connection pool; sending heartbeat probe data packets to the target device through each long connection according to a preset time period; determining that the long connection that has not received a heartbeat probe response packet has failed if no heartbeat probe response packet is received within a preset time interval for each long connection; and routing the data stream transmitted by the failed long connection to other long connections.

[0012] In one possible implementation, receiving a communication signal from a target device based on a first communication method and determining the distance information of the target device based on the communication signal includes: when sending data to be transmitted to the target device via the current communication method, dividing the data to be transmitted into multiple data fragments according to a preset data volume of the current communication method; assigning a sequence identifier to each data fragment, sending the data fragments sequentially to the target device based on the sequence identifier, and receiving an acknowledgment response from the target device based on the data fragments; determining unresponsive data fragments based on the acknowledgment response, and recording the waiting time of the unresponsive data fragments using a retransmission timer; if the waiting time exceeds a retransmission time threshold, performing a retransmission action on the unresponsive data fragments.

[0013] Secondly, embodiments of the present invention provide a communication control device for a device, the communication control device comprising: a communication module and a processing module; the communication module being configured to receive a communication signal from a target device based on a first communication method; the processing module being configured to determine distance information of the target device based on the communication signal; if the distance information does not match the communication distance range of the first communication method, record the duration of the mismatch between the distance information and the communication distance range; if the duration is greater than or equal to a preset duration, determine a second communication method based on the distance information; and switch the communication method of the target device from the first communication method to the second communication method.

[0014] Thirdly, embodiments of the present invention provide a communication control device, which includes a memory and a processor. The memory stores a computer program, and the processor is used to call and run the computer program stored in the memory to perform the steps of the method as described in the first aspect and any possible implementation thereof.

[0015] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method as described in the first aspect and any possible implementation thereof.

[0016] This invention provides a communication control method, device, and storage medium for a device. By introducing a delay-based switching mechanism with continuous judgment as its core, the invention receives communication signals from a target device based on a first communication method and calculates the real-time distance information between the target device and the first communication method by analyzing the physical characteristics of the signal. When the system detects that the distance information exceeds the preset optimal communication distance range of the first communication method, it initiates an accumulation timing process based on this abnormal distance state and continuously monitors the distance information. When the accumulated target duration reaches or exceeds a preset duration threshold, a second communication method is determined from the candidate communication methods based on the current distance information, and a switching operation from the first communication method to the second communication method is performed. This mechanism avoids frequent and unnecessary switching behavior caused by critical point signal jitter, and also prevents communication interruptions due to link switching, thus improving the stability of communication switching. Attached Figure Description

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

[0018] Figure 1 This is a flowchart illustrating a communication control method for a device provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of a communication control device for a device provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a communication control device provided in an embodiment of the present invention. Detailed Implementation

[0019] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.

[0020] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner to facilitate understanding.

[0021] Furthermore, the terms "comprising" and "having," and any variations thereof, used in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not limited to the steps or modules listed, but may optionally include other steps or modules not listed, or may optionally include other steps or modules inherent to such process, method, product, or device.

[0022] To make the objectives, technical solutions, and advantages of the present invention clearer, the following description will be provided in conjunction with the accompanying drawings and specific embodiments.

[0023] The main solution of this application embodiment is as follows: Based on a first communication method, receive the communication signal of the target device; determine the distance information of the target device according to the communication signal; if the distance information does not match the communication distance range of the first communication method, record the duration of the mismatch between the distance information and the communication distance range; if the duration is greater than or equal to a preset duration, determine a second communication method according to the distance information; switch the communication method of the target device from the first communication method to the second communication method.

[0024] Currently, communication is typically maintained by continuously monitoring the signal quality of the communication link with the target device and dynamically switching communication methods to ensure efficient and stable connections. For example, signal strength indicators (RSSI) or signal-to-noise ratios (SNR) are received, and a signal quality threshold is preset. When the device detects that the signal quality of the current communication link is below this threshold, a communication method switching process is triggered, such as switching from Wi-Fi to Bluetooth, or from Bluetooth to NFC, to seek a more stable connection. However, wireless signals can experience temporary fading and fluctuations during propagation due to obstruction, multipath effects, or transient interference. Near the critical point of communication distance, signal quality may fluctuate around the threshold. In such cases, if switching is based solely on instantaneous signal quality, the communication link will be forcibly interrupted and enter a reconnection process during the issuance or execution of the switching command. This makes a direct switching strategy based on instantaneous signal quality judgment prone to causing unnecessary communication interruptions in critical areas, reducing communication stability.

[0025] This application introduces a delayed switching mechanism based on continuous judgment. It receives communication signals from the target device using a first communication method and calculates the real-time distance information between the target device and the signal by analyzing the physical characteristics of the signal. When the system detects that the distance information exceeds the preset optimal communication distance range of the first communication method, it initiates a cumulative timing process based on this abnormal distance state and continuously monitors the distance information. When the accumulated target duration reaches or exceeds a preset duration threshold, it determines a second communication method from the candidate communication methods based on the current distance information and performs a switching operation from the first to the second communication method. This mechanism avoids frequent and unnecessary switching behavior caused by critical point signal jitter, and also improves the stability of communication switching by preventing communication interruptions due to link switching.

[0026] To better understand the above technical solutions, exemplary embodiments of this application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.

[0027] It should be noted that the executing entity in this embodiment can be a communication device, or a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or communication control device capable of performing the above functions. This embodiment does not specifically limit it in this regard. The following uses a communication device as an example to describe this embodiment and the following embodiments.

[0028] like Figure 1As shown, this embodiment of the invention provides a communication control method for a device. The method includes steps S101-S105.

[0029] S101. Receive the communication signal from the target device based on the first communication method.

[0030] In some embodiments, the first communication method refers to the currently used wireless communication protocol, such as Bluetooth. The communication signal refers to a signal emitted by the target device, containing radio waves with physical characteristics that can be used for ranging. This communication signal can be emitted by the target device based on a communication distance test or based on communication content. It should be noted that the aforementioned communication device is a smart device with multi-mode wireless communication capabilities and computing processing capabilities. It can be a consumer electronic device, such as a smartphone, tablet, smartwatch, or laptop; or an IoT gateway or hub, such as a smart home hub or industrial gateway responsible for aggregating data from multiple sub-devices; or an edge computing node or in-vehicle smart terminal, possessing at least two communication modules with technologies such as Bluetooth communication signals, Wireless Fidelity (WiFi) communication signals, or Near Field Communication (NFC) to support switching between different communication methods.

[0031] S102. Determine the distance information of the target device based on the communication signal.

[0032] In some embodiments, the communication device first continuously scans and receives communication signals broadcast by the target device through its communication module. The communication device extracts the key parameter, the received signal strength indicator (RSI), from the received communication signals. This RSI can be a signal based on communication technologies such as Bluetooth, Wi-Fi, or near-field communication. The communication device invokes an internally preset signal propagation model, which defines the mathematical relationship between the RSI and the transmission distance. The communication device substitutes the extracted RSI into this model to calculate a quantified distance estimate, thereby determining the distance information of the target device.

[0033] For example, a communication device establishes a connection with a target device via its Wi-Fi module and requests channel state information data of the signal transmitted by the target device. The communication device extracts raw phase data from multiple subcarriers from the received channel state information. Due to initial frequency deviations between the crystal oscillators at the transmitting and receiving ends, the raw phase contains a significant amount of error. The communication device needs to perform a phase calibration algorithm to eliminate this fixed phase deviation. The communication device performs a linear fit on the calibrated, clean phase information, where the phase change is proportional to the signal's time of flight, i.e., the propagation distance. Based on the fitted slope and the radio wave propagation speed, the distance to the target device is calculated.

[0034] In another example, the communication device receives a signal broadcast by the target device via its Bluetooth module and reads the received signal strength indicator value of that signal through its internal driver interface. It then retrieves a preset radio wave propagation model from its memory, which describes the mathematical relationship between signal strength and distance attenuation under specific environmental conditions. The communication device uses the read signal strength value as input parameter and substitutes it into the attenuation model for calculation. To improve estimation accuracy, it also uses an environmental calibration coefficient to fine-tune the calculation result. This calibration coefficient is obtained through on-site calibration at a known distance. The communication device outputs a calibrated distance estimate, thus completing the signal-to-distance conversion.

[0035] S103. If the distance information does not match the communication distance range of the first communication method, then record the duration of the mismatch between the distance information and the communication distance range.

[0036] S104. If the duration is greater than or equal to the preset duration, determine the second communication method based on the distance information.

[0037] In some embodiments, the first communication method is the communication method used when the communication device is currently communicating with the target device, which may be a Bluetooth communication signal, a wireless fidelity transmission communication signal, or a near-field communication, etc.

[0038] Optionally, communication devices can perform communication actions with target devices based on the HarmonyOS system. It should be noted that the HarmonyOS communication protocol, as a core supporting technology of the distributed operating system, achieves seamless collaboration between devices through an innovative soft bus architecture. It establishes a unified communication standard across devices, eliminates protocol barriers between different hardware, ensures real-time interaction capabilities with millisecond-level latency, meets the needs of scenarios such as smart homes and in-vehicle systems, and simultaneously constructs an end-to-end security protection system to ensure that the entire data transmission process is trustworthy and controllable. In terms of protocol stack architecture, HarmonyOS adopts a layered design concept, divided from bottom to top into a physical transport layer, a protocol adaptation layer, a service discovery layer, and an application interaction layer. Among them, the physical transport layer integrates multiple wireless technologies such as 4G / 5G, LoRa (Long Range Radio), NB-IoT, Bluetooth 5.2, Wi-Fi 6, and / or NFC, dynamically switching communication methods based on device distance through an adaptive selection algorithm.

[0039] For example, the first device compares the calculated communication distance information with the communication distance range of the current first communication method, Bluetooth. If the distance information is still within the communication distance range, it indicates that the current communication is relatively stable, and no action is triggered. When the first device detects that the distance information is greater than the right end of the communication distance range or less than the left end of the communication distance range, it determines that the current communication distance exceeds the communication distance range of the first communication method. The communication device starts a timer to accumulate a target duration. This target duration reflects the time during which the communication distance is not within the communication distance range, i.e., the duration during which the communication device determines the connection to be unstable. During the timer's operation, the first device continuously performs distance measurement and judgment, and continues timing only when the distance information remains in a mismatched state. If the distance recovers to within the range before the timer expires, the timer is paused or reset.

[0040] For example, the communication device uses an adaptive selection algorithm to calculate the priority of different communication methods based on the current communication distance information and the preset distance ranges corresponding to different communication methods, combined with communication task information, and dynamically switches the communication methods according to the priority.

[0041] Optionally, the system pre-stores distance weight values ​​for different communication methods at different communication distances. For example, the distance weight value for NFC varies from 1 to 0.8 within a 0-5 meter range. Simultaneously, based on the communication requirements corresponding to different communication tasks, such as the amount of data to be transmitted or communication stability requirements, the task weight values ​​for different communication methods are calculated and determined. By performing a weighted summation based on the distance weight values ​​and task weight values, the distance range for different communication methods can be obtained, and the communication method can be switched based on this distance range.

[0042] Optionally, the communication device can also determine the communication distance range based on a preset fixed distance boundary value, such as prioritizing NFC for 0-5 meters, using Bluetooth for 5-50 meters, and switching to Wi-Fi for distances above 50 meters.

[0043] Optionally, the communication device may dynamically adjust the communication distance range based on the communication task to be performed, the communication device's capability information, the target device's capability information, and / or the device's real-time information.

[0044] As one possible implementation, before step S103, this embodiment of the invention can determine the communication task to be executed, as well as the task type and data volume requirement of the communication task to be executed, based on the communication signal of the target device; query a preset communication strategy table according to the task type and the data volume requirement to determine the target communication distance matching the communication task to be executed; and update the communication distance range of the first communication method based on the target communication distance.

[0045] As another possible implementation, before step S103, this embodiment of the invention can obtain the device capability information of the target device, which includes the device type and the target communication protocol supported by the target device; according to the device type and the target communication protocol, select the target configuration template corresponding to the target device from the preset communication configuration template; and adjust the communication distance range of the first communication method based on the configuration parameters defined in the target configuration template.

[0046] For example, the communication policy table and communication configuration template can be based on administrator-defined configurations to adjust the switching strategy for communication methods. Alternatively, the communication policy table and communication configuration template can also be trained by a neural network model such as deep learning, based on historical communication records and / or user profiles.

[0047] As another possible implementation, before step S103, this embodiment of the invention can detect the current battery level and processor load rate, as well as the instantaneous strength of the communication signal; determine the signal fluctuation variance of the communication signal based on the instantaneous strength at each moment within a preset time period; calculate the adjustment coefficient of the communication distance interval based on the battery level, processor load rate, and signal fluctuation variance using a preset trade-off algorithm; and adjust the communication distance interval of the first communication method based on the adjustment coefficient.

[0048] Optionally, the communication device can also perform time series analysis and curve fitting based on location information at different time points to determine the movement trajectory of the current communication device and the target device, and determine the change information of distance information based on the movement trajectory. Furthermore, based on this change information, combined with user profiles and / or environmental information, the communication device can perform predictive actions on the distance information to determine the target distance information at the target time point, thereby switching the corresponding communication mode in advance when the communication distance is about to exceed the communication distance range.

[0049] S105. Switch the communication mode of the target device from the first communication mode to the second communication mode.

[0050] In some embodiments, the communication device supports at least one communication method other than the first communication method, and selects a second communication method among the communication methods, thereby switching between the first communication method and the second communication method by migrating the data volume.

[0051] For example, when a user uses their mobile phone as a communication device and performs control actions on a TV based on the HarmonyOS system, there is a process of holding and moving the phone. Specifically, when the phone detects a distance of 10 meters from the TV, exceeding the Bluetooth range, it starts a 2-second timer. During the next 2 seconds, the distance fluctuates between 11.5 meters and 13 meters, and the timer continues to accumulate. After 2 seconds, the accumulated target duration reaches the preset 2-second threshold.

[0052] As one possible implementation, the first device maintains the communication connection between the first module corresponding to the first communication method and the target device, and establishes a new communication connection based on the second communication method, and smoothly migrates the data stream currently being transmitted to the newly established Wi-Fi link.

[0053] Optionally, to ensure communication quality after the handover, the first device will briefly monitor the performance of the Wi-Fi link for a short period after the handover is completed. After confirming that the Wi-Fi connection is stable, the first device controls the Bluetooth module to enter an idle or low-power state, thereby completing the entire handover process.

[0054] As another possible implementation, a connection pool associated with the target device is established, the connection pool being used to maintain physical connections for at least two communication methods; based on the distance information and the physical connections, communication quality information for each communication method is determined; based on the communication quality information for each communication method, a second communication method is selected; and data packets transmitted by the first communication method are routed in the connection pool to the target communication link corresponding to the second communication method to transmit the data packets.

[0055] It should be noted that connection pooling technology, by maintaining multiple communication link connections simultaneously, replaces the hard switching that could lead to service interruption with a smooth, optimized route, thereby improving the continuity, stability, and overall user experience of data transmission between devices.

[0056] For example, after determining that a switch is needed, the first device does not immediately disconnect the first communication method. Instead, it first ensures that the connection pool with the target device has been initialized and contains physical connections for the second communication method. Specifically, the first device invokes the connection pool management module, which checks whether an available second communication method link already exists in the pool, such as a pre-established or on-demand Wi-Fi TCP connection. If the link does not exist, the management module immediately initiates a second communication method handshake process with the target device to create the link and add it to the pool for management.

[0057] After ensuring that both the first and second communication methods are active links in the connection pool, the first device initiates dynamic route evaluation. The routing decision engine periodically or triggeredly collects real-time communication quality information for each link, including but not limited to the link's instantaneous bandwidth, transmission latency, packet loss rate, and signal stability indicators. This quality data is quantified and input into a preset scoring algorithm, which calculates a comprehensive quality score for each link.

[0058] Based on this overall quality score, the routing decision engine executes a routing strategy. When the link quality score of the second communication method consistently outperforms that of the first communication method and exceeds a set threshold, the engine generates a routing switch instruction. Subsequently, the data plane takes over execution, redirecting subsequent data packets from the first communication method's link to the high-quality link of the second communication method via the connection pool interface. Notably, during this process, the link of the first communication method is typically not immediately destroyed but instead enters a standby or low-power state as a hot backup path. The entire data flow migration process is completely transparent to the application currently communicating; the application continues to exchange data with the unified connection pool interface, unaware of the underlying physical link change, thus achieving seamless switching.

[0059] This application introduces a delayed switching mechanism based on continuous judgment. It receives communication signals from the target device using a first communication method and calculates the real-time distance information between the target device and the signal by analyzing the physical characteristics of the signal. When the system detects that the distance information exceeds the preset optimal communication distance range of the first communication method, it initiates a cumulative timing process based on this abnormal distance state and continuously monitors the distance information. When the accumulated target duration reaches or exceeds a preset duration threshold, it determines a second communication method from the candidate communication methods based on the current distance information and performs a switching operation from the first to the second communication method. This mechanism avoids frequent and unnecessary switching behavior caused by critical point signal jitter, and also improves the stability of communication switching by preventing communication interruptions due to link switching.

[0060] Based on the same inventive concept, this application also provides a second embodiment, in which the communication control method of the device further includes steps S201 to S204 before step S101.

[0061] S201. When a target device is detected to have entered the communication range, a request to obtain the device identifier is sent to the target device.

[0062] S202. Based on the acquisition response received from the target device, acquire the device identifier, bind the device identifier to the network address of the target device, and record the device identifier in the local device list.

[0063] S203. Based on the device identifier, match and receive the communication signal of the target device in the local device list.

[0064] In some embodiments, the first device continuously discovers devices across multiple wireless frequency bands through its multimode communication sensing layer. When an unknown device signal is detected via any communication method, such as a Wi-Fi probe frame or LoRa broadcast, the first device determines that a target device has entered its communication range. Subsequently, the first device sends a standardized device identifier request command to the detected device via the same communication channel. This request aims to obtain a globally unique identification code assigned to the target device at the factory or during initialization. This code is the core identity credential of the device in the distributed network and is independent of any specific communication protocol.

[0065] Upon receiving the request, the target device replies with a data packet containing its unique device identifier via the corresponding communication protocol. After successfully receiving the packet, the first device first parses the data to extract the clean device identifier. Next, the first device performs a crucial binding operation, creating a new mapping entry in its secure storage area and strongly associating the globally unique device identifier with the temporary network address used by the target device for this communication, such as a Wi-Fi MAC address or a LoRa device short address. Finally, this complete identity-address mapping relationship is persistently recorded in the first device's local trusted device list, which serves as the fundamental basis for all subsequent communication permission determinations.

[0066] After registration, the first device enters a normal communication monitoring state. Regardless of the communication method used to receive a signal, the first device's first reaction is to extract the network address of the signal source and immediately query the local trusted device list for the device identifier corresponding to that address. Only when the address lookup successfully matches a bound, trusted device identifier will the first device consider the communication signal legitimate and allow it to proceed to the subsequent process, namely, performing the signal analysis and distance calculation described in claim 1. If no valid device identifier is matched, the communication signal will be considered to originate from an unauthorized device and will be directly discarded, thereby preventing unauthorized access at the architectural level.

[0067] It's worth noting that HarmonyOS adopts a layered design in its protocol stack architecture, dividing it from bottom to top into the physical transport layer, protocol adaptation layer, service discovery layer, and application interaction layer. The key innovation of the protocol adaptation layer lies in the development of a unique device identifier (UDID) mechanism, which automatically generates a 128-bit globally unique identifier for each access device, solving the problem of heterogeneous network address mapping. The service discovery layer uses an improved mDNS (Multicast DNS) protocol. The application interaction layer provides two core communication modes: a message-oriented publish / subscribe mode and a service-oriented remote procedure call (RPC) mode. The message-oriented publish / subscribe mode is implemented based on an optimized Message Queuing Telemetry Transport (MQTT) protocol, supporting QoS2-level message guarantees. The service-oriented RPC call mode uses the lightweight gRPC framework.

[0068] This application embodiment introduces a unified device identifier management process decoupled from the communication method, which builds a front-end security barrier for communication control, ensuring that all subsequent distance sensing, status assessment and communication switching decisions are based on strict identity authentication, significantly improving the security level and reliability of the entire system.

[0069] Since the system described in Embodiment 2 of this application is a system used to implement the method of Embodiment 1 of this application, those skilled in the art can understand the specific structure and variations of the system based on the method described in Embodiment 1 of this application, and therefore will not be described again here. All systems used in the method of Embodiment 1 of this application fall within the scope of protection of this application.

[0070] Based on the same inventive concept, this application also provides a third embodiment, which, after step S105, further includes steps S301 to S304: S301. Establish and maintain at least two long connections for each communication method in the connection pool.

[0071] S302. Send heartbeat detection data packets to the target device through each long connection according to a preset time period.

[0072] S303. For each long connection, if no heartbeat response packet is received within a preset time interval, the long connection that has not received a heartbeat response packet is determined to have failed.

[0073] S304. Redirect the data stream transmitted by the failed long-lived connection to other long-lived connections.

[0074] In some embodiments, when the first device communicates with the target device through a connection pool, its connection pool management module initiates an independent heartbeat detection thread for each active physical link in the pool, such as two parallel Wi-Fi long connections. The heartbeat thread sends a lightweight heartbeat detection data packet to the target device through its respective physical link at preset intervals, such as every second. The target device should immediately reply with a corresponding response data packet upon receiving the packet. The first device sets a timeout window for receiving responses for each link, such as 300 milliseconds. The connection pool management module continuously monitors the responses. If a response is successfully received from a link within the timeout period, it is marked as healthy. Conversely, if a link fails to return a heartbeat response multiple times within the timeout period, the management module determines that it has failed or the connection has expired, such as due to network port congestion or complete signal loss.

[0075] After determining a fault, a recovery mechanism is initiated. The connection pool management module isolates the faulty link from the list of currently available links and marks it as unavailable to prevent subsequent data packets from being sent to it. Simultaneously, a routing policy is triggered, and all data streams originally transmitted through the faulty link are automatically and immediately rerouted to other healthy physical links in the connection pool. The management module attempts to automatically rebuild the faulty link in the background and, upon successful reconstruction, reinstates it to the available resource pool.

[0076] This application embodiment enables the first device to quickly detect and isolate link failures by constructing redundant links across protocols in the connection pool and implementing unified heartbeat monitoring, and enables seamless service migration across communication methods.

[0077] Since the system described in Embodiment 3 of this application is a system used to implement the method of Embodiment 1 of this application, those skilled in the art can understand the specific structure and variations of the system based on the method described in Embodiment 1 of this application, and therefore will not be described again here. All systems used in the method of Embodiment 1 of this application fall within the scope of protection of this application.

[0078] Based on the same inventive concept, this application also provides a fourth embodiment, in which the communication control method of the device of the present invention further includes steps S401 to S404: S401. When sending data to be transmitted to the target device through the current communication method, the data to be transmitted is divided into multiple data fragments according to the preset data volume of the current communication method.

[0079] S402. Assign a sequence identifier to each data fragment, send the data fragments sequentially to the target device based on the sequence identifier, and receive an acknowledgment response from the target device based on the data fragments.

[0080] S403. Determine the unresponsive data fragment based on the confirmation response, and record the waiting time of the unresponsive data fragment through a retransmission timer.

[0081] S404. If the waiting time is greater than the retransmission time threshold, retransmission is performed on the unresponsive data fragments.

[0082] In this embodiment, the performance optimization strategies in the communication device include connection pool management, data fragmentation and compression, and retransmission.

[0083] For example, when a first device needs to send a complete data file to a target device, it first considers the link characteristics of the currently active communication method. The first device queries the optimal transmission unit for that communication method; for example, Ethernet typically uses 1500 bytes. Subsequently, the first device's transport layer protocol module logically segments the application data to be transmitted based on the Maximum Transmission Unit (MTU) value, generating a series of data fragments of compliant size. This adapts to the underlying network's frame structure and distributes the transmission risk of large data blocks across multiple independent units. The first device assigns a unique sequence identifier to each generated data fragment, typically a monotonically increasing sequence number. The core function of this sequence identifier is to allow the receiver to clearly identify the order of each data fragment, ensuring correct reassembly of the original data even if they arrive out of order. Based on the sequence number order, these data fragments are sequentially sent to the target device through the established communication link. After successfully receiving and verifying each data fragment, the target device sends an acknowledgment message to the first device, explicitly containing the sequence identifier of the successfully received data fragment.

[0084] After sending a data fragment, the first device maintains a sending window state machine and continuously listens for acknowledgment messages from the target device. By comparing the set of sent fragment sequence numbers with the set of received acknowledgment messages, the first device can accurately diagnose which data fragments are unacknowledged fragments—fragments that have been sent but have not yet received positive acknowledgment. For each such unacknowledged fragment, the first device starts an independent retransmission timer to accumulate the waiting time experienced by the fragment since its first transmission. The first device's background task continuously scans the retransmission timers corresponding to all unacknowledged data fragments. The reading of each timer is compared with a preset retransmission timeout threshold, which is set through dynamic estimation of network round-trip time. When the waiting time of a data fragment is confirmed to exceed this threshold, the first device determines that the fragment has been lost in transit. The transmission control module retrieves the original data copy of the fragment from the sending buffer, repackages it, and performs a retransmission until the corresponding acknowledgment is received.

[0085] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0086] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.

[0087] Figure 2A schematic diagram of a communication control device 500 provided in an embodiment of the present invention is shown. The communication control device 500 includes a communication module 501 and a processing module 502.

[0088] The communication module 501 is used to receive communication signals from the target device based on the first communication method.

[0089] The processing module 502 is configured to determine the distance information of the target device based on the communication signal; if the distance information does not match the communication distance range of the first communication method, record the duration of the mismatch between the distance information and the communication distance range; if the duration is greater than or equal to a preset duration, determine the second communication method based on the distance information; and switch the communication method of the target device from the first communication method to the second communication method.

[0090] Figure 3 This is a schematic diagram of a communication control device provided in an embodiment of the present invention. The communication control device 600 includes: a processor 601, a memory 602, and a computer program 603 stored in the memory 602 and executable on the processor 601. When the processor 601 executes the computer program 603, it implements the steps in the above-described method embodiments. Alternatively, when the processor 601 executes the computer program 603, it implements the functions of each module / unit in the above-described device embodiments.

[0091] For example, the computer program 603 can be divided into one or more modules / units, which are stored in the memory 602 and executed by the processor 601 to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 603 in the communication control device 600.

[0092] The processor 601 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0093] The memory 602 can be an internal storage unit of the communication control device 600, such as a hard disk or memory of the communication control device 600. The memory 602 can also be an external storage device of the communication control device 600, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the communication control device 600. Furthermore, the memory 602 can include both internal storage units and external storage devices of the communication control device 600. The memory 602 is used to store the computer program and other programs and data required by the terminal. The memory 602 can also be used to temporarily store data that has been output or will be output.

[0094] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention 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 the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A communication control method for a device, characterized in that, include: Based on the first communication method, receive communication signals from the target device; Based on the communication signal, the distance information of the target device is determined; If the distance information does not match the communication distance range of the first communication method, then record the duration of the mismatch between the distance information and the communication distance range; If the duration is greater than or equal to the preset duration, a second communication method is determined based on the distance information; The communication mode of the target device is switched from the first communication mode to the second communication mode.

2. The communication control method for the device according to claim 1, characterized in that, Before recording the duration of the mismatch between the distance information and the communication distance range if the distance information does not match the communication distance range of the first communication method, the method further includes: Based on the communication signals of the target device, determine the communication task to be executed, as well as the task type and data volume requirements of the communication task to be executed; Based on the task type and the data volume requirement, a preset communication strategy table is queried to determine the target communication distance that matches the communication task to be executed; Based on the target communication distance, update the communication distance range of the first communication method.

3. The communication control method for the device according to claim 1, characterized in that, Before recording the duration of the mismatch between the distance information and the communication distance range if the distance information does not match the communication distance range of the first communication method, the method further includes: Obtain the device capability information of the target device, including the device type and the target communication protocol supported by the target device; Based on the device type and the target communication protocol, select the target configuration template corresponding to the target device from the preset communication configuration templates; Based on the configuration parameters defined in the target configuration template, adjust the communication distance range of the first communication method.

4. The communication control method for the device according to claim 1, characterized in that, Before recording the duration of the mismatch between the distance information and the communication distance range if the distance information does not match the communication distance range of the first communication method, the method further includes: Detect the current battery level and processor load rate, as well as the instantaneous strength of the communication signal; The signal fluctuation variance of the communication signal is determined based on the instantaneous intensity at each moment within a preset time period; Based on the battery level, processor load rate, and signal fluctuation variance, an adjustment coefficient for the communication distance range is calculated using a preset trade-off algorithm. The communication distance range of the first communication method is adjusted according to the adjustment coefficient.

5. The communication control method for the device according to claim 1, characterized in that, Before receiving the communication signal from the target device based on the first communication method, the method further includes: When a target device is detected to have entered the communication range, a request to obtain the device identifier is sent to the target device; Based on the acquisition response received from the target device, the device identifier is obtained, and the device identifier is bound to the network address of the target device, and the device identifier is recorded in the local device list; Based on the device identifier, the communication signal of the target device is matched and received from the local device list.

6. The communication control method for the device according to claim 1, characterized in that, The step of switching the communication mode of the target device from the first communication mode to the second communication mode includes: Establish a connection pool associated with the target device, the connection pool being used to maintain physical connections for at least two communication methods; Based on the distance information and the physical connection, the communication quality information of each communication method is determined; Based on the communication quality information of each communication method, a second communication method is selected. The data packets transmitted by the first communication method are routed in the connection pool to the target communication link corresponding to the second communication method to transmit the data packets.

7. The communication control method for the device according to claim 6, characterized in that, The method further includes: At least two long-lived connections are established and maintained for each communication method in the connection pool; According to a preset time period, heartbeat detection data packets are sent to the target device through each long connection; For each long connection, if no heartbeat response packet is received within a preset time interval, the long connection that has not received a heartbeat response packet is determined to have failed. The data stream transmitted by the failed long-lived connection is routed to other long-lived connections.

8. The communication control method for the device according to claim 1, characterized in that, The method further includes: When sending data to be transmitted to the target device through the current communication method, the data to be transmitted is divided into multiple data fragments according to the preset data volume of the current communication method; Assign a sequence identifier to each data fragment, send the data fragments sequentially to the target device based on the sequence identifier, and receive an acknowledgment response from the target device based on the data fragments; The unresponsive data fragments are determined based on the confirmation response, and the waiting time of the unresponsive data fragments is recorded by a retransmission timer; If the waiting time exceeds the retransmission time threshold, retransmission is performed on the unresponsive data fragments.

9. A communication control device, characterized in that, The communication control device includes a memory and a processor. The memory stores a computer program, and the processor is used to call and run the computer program stored in the memory to perform the method as described in any one of claims 1 to 8.

10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the communication control method of the device as described in any one of claims 1 to 8.