Data transmission medium switching method and apparatus, electronic device, and storage medium

CN122601568APending Publication Date: 2026-08-18BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610967146.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-30
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

当链路质量因温度升高、电磁干扰加剧等因素渐进劣化时,无法感知质量下降过程,只能被动承受大量数据重传和性能损失,直至链路完全中断才触发切换,导致严重的性能下降和数据延迟

Benefits of technology

[0015]第五方面,本公开实施例还提供了一种计算机程序产品,该计算机程序产品包括计算机程序或指令,该计算机程序或指令被处理器执行时实现如第一方面的方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122601568A_ABST
    Figure CN122601568A_ABST
Patent Text Reader

Abstract

The present disclosure relates to a data transmission medium switching method and device, electronic equipment and storage medium. By monitoring the signal quality parameters of the first path, real-time perception of the quality of the copper cable link can be realized, and when the quality continuously deteriorates and reaches a time window, the optical waveguide is switched to predictively, avoiding performance loss and data retransmission caused by passive waiting for link interruption; the time window mechanism prevents false switching caused by transient interference; through periodic detection of recovery quality parameters, the perception and automatic return of the copper cable recovery state are realized, ensuring that the copper cable with better cost is returned after the quality is recovered, and solving the problem of passive lag and large performance loss in switching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data transmission technology, and in particular to a data transmission medium switching method, apparatus, electronic device, and storage medium. Background Technology

[0002] In the field of high-speed data transmission, high-speed serial buses (such as computer bus standards and unlimited bandwidth technology) are widely used for data communication within and between devices. Copper cables and optical waveguides (fiber optics) are two main transmission media. Copper cables are low-cost and technologically mature, but their transmission distance is limited at high speeds, they consume a lot of power, and they are susceptible to electromagnetic interference. Optical waveguides have long transmission distances and strong anti-interference capabilities, but they require photoelectric conversion, introducing additional delay and cost.

[0003] In existing technologies, a primary / backup link scheme is typically used. This scheme only switches over when the link completely fails, which is a passive and delayed response. When the link quality gradually deteriorates due to factors such as increased temperature and electromagnetic interference, the process of quality degradation cannot be detected. The system can only passively endure a large amount of data retransmission and performance loss until the link is completely interrupted, which triggers a switchover and results in severe performance degradation and data delay. Summary of the Invention

[0004] To address the aforementioned technical problems, this disclosure provides a data transmission medium switching method, apparatus, electronic device, and storage medium.

[0005] In a first aspect, embodiments of this disclosure provide a method for switching data transmission media, the method comprising: The data stream to be transmitted is transmitted through the first path, and the signal quality parameters of the first path are monitored; wherein, the first path is a path that uses copper cable as the transmission medium; If the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window, the data stream is switched from the first path to the second path for transmission; wherein, the second path is a path that uses an optical waveguide as the transmission medium. During transmission through the second path, the signal quality of the first path is periodically detected to obtain recovery quality parameters; wherein, the recovery quality parameters are used to characterize the recovery status of the signal quality of the first path; If the recovery quality parameters meet the target recovery conditions, the data stream is switched from the second path back to the first path.

[0006] In some embodiments, switching the data stream from the first path to the second path for transmission when the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window includes: When the signal quality parameters continuously meet the target switching conditions for a duration of a preset time window, a switching signal is generated and sent to a multiplexer; wherein, the multiplexer is used to switch the transmission path of the data stream; Based on the switching signal, the multiplexer is controlled to switch from a first conducting state to a second conducting state; In the first conducting state, the output of the multiplexer is connected to the input of the first path and disconnected from the input of the second path; in the second conducting state, the output of the multiplexer is connected to the input of the second path and disconnected from the input of the first path; the multiplexer is used to switch the data stream from the input of the first path to the input of the second path in the second conducting state, so as to send the data stream to the remote device through the second path.

[0007] In some embodiments, the signal quality parameter includes the bit error rate, and after monitoring the signal quality parameter of the first path, the method further includes: Within multiple consecutive sampling periods, the bit error rate (BER) sample value corresponding to each sampling period is recorded. The BER change trend is calculated based on the BER sample value corresponding to each sampling period. This change trend characterizes the rate of BER degradation of the first path over time. If the change trend indicates that the BER continuously increases within the preset time window and the BER sample value corresponding to the current sampling period is greater than the switching threshold, it is determined that the signal quality parameter continuously meets the target switching condition and the duration reaches the preset time window; or... Within a preset time window, the bit error rate of the first path is acquired multiple times consecutively, and the number of times the acquired bit error rate exceeds the switching threshold is counted. When the number of times exceeds a preset quantity threshold, it is determined that the signal quality parameter continuously meets the target switching condition and the duration reaches the preset time window.

[0008] In some embodiments, the step of periodically detecting the signal quality of the first path during transmission through the second path to obtain recovered quality parameters includes: Set a detection cycle and generate a temporary switching command when each detection cycle is reached; Based on the temporary switching instruction, the output path of the data stream is temporarily switched from the second path to the first path; Test data is sent on the first path, and the signal quality during the transmission of the test data is detected to obtain the recovery quality parameters; The multiplexer is controlled to switch the output path of the data stream back to the second path.

[0009] In some embodiments, switching the data stream from the second path back to the first path when the recovery quality parameters meet the target recovery conditions includes: If the recovery quality parameters meet the target recovery conditions, a recovery signal is generated and sent to a multiplexer. Based on the recovery signal, the data stream is restored from the second path to the first path for transmission.

[0010] In some embodiments, the recovery quality parameter includes the bit error rate, and the method further includes: If the bit error rate of the first path is detected to be less than the recovery threshold, then the recovery quality parameter is determined to meet the target recovery condition, wherein the recovery threshold is less than the switching threshold.

[0011] In some embodiments, after switching the data stream from the first path to the second path for transmission, the method further includes: Collect optical path quality parameters of the second path, wherein the optical path quality parameters include at least one of optical power and optical link bit error rate; When the optical path quality parameters are within a preset fault parameter range, the current recovery quality parameters of the first path are detected; If the current recovery quality parameters meet the target recovery conditions, then the data stream is switched back to the first path; If the current recovery quality parameters do not meet the target recovery conditions, an alarm signal is generated.

[0012] Secondly, embodiments of this disclosure provide a data transmission medium switching device, the device comprising: The monitoring module is used to transmit the data stream to be transmitted through the first path and monitor the signal quality parameters of the first path. The first switching module is used to switch the data stream from the first path to the second path for transmission when the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window. The detection module is used to periodically detect the signal quality of the first path during transmission through the second path to obtain the recovery quality parameters; The second switching module is used to switch the data stream from the second path back to the first path when the recovery quality parameters meet the target recovery conditions.

[0013] Thirdly, embodiments of this disclosure provide an electronic device, including: Memory; Processor; and Computer programs; The computer program is stored in memory and configured to be executed by a processor to implement the method as described in the first aspect.

[0014] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the method as described in the first aspect.

[0015] Fifthly, embodiments of this disclosure also provide a computer program product comprising a computer program or instructions that, when executed by a processor, implement the method as described in the first aspect.

[0016] The data transmission medium switching method, apparatus, electronic device, and storage medium provided in this disclosure transmit a data stream to be transmitted through a first path and monitor the signal quality parameters of the first path. When the signal quality parameters continuously meet the target switching conditions for a duration reaching a preset time window, the data stream is switched from the first path to a second path for transmission. Furthermore, during transmission through the second path, the signal quality of the first path is periodically detected to obtain recovery quality parameters. When the recovery quality parameters meet the target recovery conditions, the data stream is switched back from the second path to the first path. Compared to existing technologies, this disclosure, by monitoring the signal quality parameters of the first path, enables real-time perception of copper cable link quality. When quality continuously deteriorates and reaches a time window, a predictive switch to an optical waveguide is achieved, avoiding performance loss and data retransmission caused by passively waiting for link interruptions. The time window mechanism prevents erroneous switching caused by momentary interference. Periodic detection of recovery quality parameters enables perception of the copper cable recovery status and automatic re-switching, ensuring that a more cost-effective copper cable is returned after quality recovery, thus solving the problems of passive lag and significant performance loss during switching. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0018] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart of a data transmission medium switching method provided in an embodiment of the present disclosure; Figure 2 A flowchart of a data transmission medium switching method provided in another embodiment of this disclosure; Figure 3 A flowchart of a data transmission medium switching method provided in another embodiment of this disclosure; Figure 4 This is a schematic diagram of the architecture of a data transmission medium switching system provided in an embodiment of this disclosure; Figure 5 This is a schematic diagram of the structure of the data transmission medium switching device provided in the embodiments of this disclosure; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0020] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0021] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

[0022] In the field of high-speed data transmission, high-speed serial buses (such as computer bus standards and unlimited bandwidth technology) are widely used for data communication within and between devices. Copper cables and optical waveguides (fiber optics) are two main transmission media. Copper cables are low-cost and technologically mature, but their transmission distance is limited at high speeds, they consume a lot of power, and they are susceptible to electromagnetic interference. Optical waveguides have long transmission distances and strong anti-interference capabilities, but they require photoelectric conversion, introducing additional delay and cost.

[0023] In existing technologies, a primary / backup link scheme is typically used. This scheme only switches over when the link completely fails, which is a passive and delayed response. When the link quality gradually deteriorates due to factors such as increased temperature and electromagnetic interference, the process of quality degradation cannot be detected. The system can only passively endure a large amount of data retransmission and performance loss until the link is completely interrupted, which triggers a switchover and results in severe performance degradation and data delay.

[0024] To address this problem, this disclosure provides a method for switching data transmission media, which will be described below with reference to specific embodiments.

[0025] Figure 1This is a flowchart illustrating a data transmission medium switching method provided in an embodiment of this disclosure. The method is executed by an electronic device, which can be a transmitting device, i.e., a device that sends data. This method can be applied to scenarios involving data transmission medium switching.

[0026] It is understood that the data transmission medium switching method provided in this disclosure can also be applied in other scenarios.

[0027] High-speed serial bus: A communication technology used for high-speed data transmission within or between devices, such as PCIe (computer bus standard) and InfiniBand (infinite bandwidth technology). Its characteristic is the use of differential signal lines for point-to-point transmission.

[0028] The following is about Figure 1 The data transmission medium switching method shown is described below. This method can be applied to electronic devices, and the specific steps included in the method are as follows: S101. Transmit the data stream to be transmitted through the first path and monitor the signal quality parameters of the first path.

[0029] The first path is one that uses copper cable as the transmission medium.

[0030] In this step, copper cable is used for transmission by default. The data stream to be transmitted is transmitted through the first path, and the signal quality parameters of the first path are monitored. Specifically, such as... Figure 4 As shown, the signal quality monitoring module starts working, continuously collecting signal quality parameters, such as the bit error rate (BER), from the receiving end of the copper cable link. The BER is a core indicator for measuring data transmission quality and directly reflects the physical layer reliability of the link.

[0031] Copper cables are cables that use copper conductors as the transmission medium, such as twisted-pair cables and coaxial cables. Their advantages include low cost and mature technology; their disadvantages include limited transmission distance, susceptibility to electromagnetic interference, and high power consumption at high speeds.

[0032] Optical waveguide: A medium that transmits optical signals using the principle of total internal reflection, such as optical fiber. Its advantages include long transmission distance, high bandwidth, and strong resistance to electromagnetic interference; its disadvantages include the need for photoelectric conversion, which increases cost, latency, and power consumption.

[0033] In some embodiments, signal quality parameters may also include signal amplitude, signal jitter, signal-to-noise ratio, forward error correction (FEC) rate, etc.

[0034] Signal amplitude: refers to the voltage swing of the differential signal. A decrease in amplitude usually indicates increased link attenuation or insufficient drive capability.

[0035] Signal jitter refers to the uncertainty of signal transitions on the time axis. Increased jitter means reduced timing margin, which can easily lead to sampling errors.

[0036] Signal-to-noise ratio (SNR): The ratio of signal strength to noise strength. A decrease in SNR is a direct reflection of link quality degradation.

[0037] Forward Error Correction (FEC) error correction rate: If the link uses FEC, monitoring the frequency of its error correction is also a good indicator. The more frequent the error correction, the worse the original link quality.

[0038] S102. When the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window, the data stream is switched from the first path to the second path for transmission.

[0039] The second path is one that uses an optical waveguide as the transmission medium.

[0040] In this step, after monitoring the signal quality parameters of the first path, the electronic device can compare the real-time monitored signal quality parameters with preset target switching conditions. To avoid erroneous switching due to momentary interference, this step requires that the signal quality parameters not only meet the target switching conditions, but that this state must also last for a preset time window. When both conditions are met, it is determined that the copper cable link quality is unreliable, and the data stream is switched from the first path to the second path. Figure 4 As shown, the data stream is then converted into an optical signal via the integrated optical waveguide module and sent to the remote device. The switching process is completed within microseconds and is transparent to upper-layer applications.

[0041] S103. During transmission through the second path, the signal quality of the first path is periodically detected to obtain the recovery quality parameters.

[0042] The recovery quality parameter is used to characterize the signal quality recovery of the first path.

[0043] In this step, while the optical waveguide path is operational, it is necessary to determine whether the copper cable link has been restored to usability. To this end, the signal quality of the copper cable link is periodically (e.g., once per second) rapidly assessed to obtain recovery quality parameters. These parameters characterize the signal quality recovery status of the first path. For example, this can be achieved through rapid link quality detection, which involves briefly switching the data stream back to the copper cable path while the optical waveguide path is operational to quickly assess its link quality and determine whether it has been restored to usability. This entire process is transparent to upper-layer applications.

[0044] S104. If the recovery quality parameters meet the target recovery conditions, switch the data stream from the second path back to the first path.

[0045] In this step, the restored quality parameters are compared with preset target restoration conditions. If the restored quality parameters meet the target restoration conditions, the copper link quality is determined to have been restored and is usable. At this point, the data stream is switched from the optical waveguide path back to the copper path. This step enables automatic migration to a lower-cost transmission medium after the copper link quality is restored, achieving an optimal balance between performance and cost.

[0046] In some embodiments, the health status of both links can be monitored to form a fully symmetrical dual-active link switching system. Dynamically selecting the optimal path based on real-time quality (lowest bit error rate BER, best signal quality) can further increase the robustness of the system.

[0047] This embodiment of the present disclosure transmits the data stream to be transmitted through a first path and monitors the signal quality parameters of the first path. When the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window, the data stream is switched from the first path to a second path for transmission. Furthermore, during transmission through the second path, the signal quality of the first path is periodically detected to obtain recovery quality parameters. When the recovery quality parameters meet the target recovery conditions, the data stream is switched back from the second path to the first path. Compared to the prior art, this embodiment of the present disclosure, by monitoring the signal quality parameters of the first path, can achieve real-time perception of the copper cable link quality. When the quality continuously deteriorates and reaches the time window, it predictively switches to the optical waveguide, avoiding performance loss and data retransmission caused by passively waiting for link interruption. The time window mechanism prevents erroneous switching caused by instantaneous interference. Periodic detection of recovery quality parameters enables perception of the copper cable recovery status and automatic back-switching, ensuring that a more cost-effective copper cable is returned after quality recovery, solving the problems of passive lag and significant performance loss during switching.

[0048] Figure 2 Here is a flowchart of a data transmission medium switching method provided in another embodiment of this disclosure, as shown below. Figure 2 As shown, the method includes the following steps: S201. Transmit the data stream to be transmitted through the first path and monitor the signal quality parameters of the first path.

[0049] The first path is one that uses copper cable as the transmission medium.

[0050] Specifically, the implementation process and principle of S201 and S101 are the same, and will not be repeated here.

[0051] In some embodiments, after monitoring the signal quality parameters of the first path, the method further includes: recording the bit error rate (BER) sample value corresponding to each sampling period within a series of sampling periods; calculating the BER change trend based on the BER sample value corresponding to each sampling period, wherein the BER change trend is used to characterize the rate of BER degradation of the first path over time; and determining that the signal quality parameters continuously meet the target switching conditions and the duration reaches the preset time window when the BER change trend characterizes that the BER continues to rise within the preset time window and the BER sample value corresponding to the current sampling period is greater than the switching threshold.

[0052] In this embodiment, the bit error rate (BER) sample value is recorded for each of the M consecutive sampling periods (e.g., 10 periods, each period being 1 microsecond), forming a BER time series data. The BER trend is calculated based on the M BER sample values, and this trend characterizes the rate of BER degradation of the copper cable link over time. For example, the difference or slope between adjacent sampling points can be calculated to identify a continuously rising BER trend. When the trend indicates that the BER is continuously rising within a preset time window, and the BER sample value corresponding to the current sampling period is greater than the switching threshold, it is determined that the signal quality parameters continuously meet the target switching conditions and the duration reaches the preset time window. This determination method not only focuses on whether the current value exceeds the standard but also on the rate and trend of degradation, thus possessing predictive capabilities. This embodiment achieves predictive identification by analyzing the rate of BER degradation over time—providing early warning even when the absolute value of the BER has not yet exceeded the threshold but the degradation rate is rapid.

[0053] In some embodiments, after monitoring the signal quality parameters of the first path, the method further includes: acquiring the bit error rate of the first path multiple times consecutively within a preset time window, counting the number of times the acquired bit error rate exceeds the switching threshold, and determining that the signal quality parameters continuously meet the target switching conditions and the duration reaches the preset time window when the number of acquisitions exceeds the preset quantity threshold.

[0054] In this embodiment, the bit error rate (BER) of the first path is acquired multiple times consecutively within a preset time window (e.g., 10 microseconds), with a fixed sampling interval each time. The number of times the BER exceeds the switching threshold is counted. For example, in 10 consecutive samples, the BER exceeds the switching threshold 8 times. When the count exceeds a preset threshold (e.g., 7 times), it is determined that the signal quality parameters continuously meet the target switching conditions and the duration reaches the preset time window. This mechanism ensures that the switching decision is not based on a single abnormal fluctuation, but on statistical evidence of continuous degradation. This embodiment filters out instantaneous noise and occasional fluctuations by using a determination method based on consecutive threshold counts, avoiding erroneous switching caused by a single abnormal sampling. It ensures that the switching decision is based on the objective fact of continuous link quality degradation, preventing frequent oscillating switching in critical states and improving the stability and reliability of the system.

[0055] S202. If, within a preset time window, the bit error rate of the first path is continuously monitored to be greater than the switching threshold multiple times, it is determined that the signal quality parameter continuously meets the target switching condition and the duration reaches the preset time window.

[0056] Specifically, the signal quality parameter is the bit error rate. A switching threshold and a time window parameter (e.g., 10 consecutive detection cycles) are pre-configured. Figure 4 As shown, the signal quality monitoring module collects the bit error rate (BER) of the copper cable link at a fixed detection period (e.g., once every millisecond). After each collection, the intelligent control logic unit compares the current BER with a switching threshold. Only when multiple consecutive (e.g., 10) monitoring results show that the BER is greater than the switching threshold is the switching condition finally determined to be met. If any monitoring result shows that the BER does not exceed the threshold, the counter is reset to zero and counting restarts. This mechanism ensures that the switching decision is based on the continuous degradation of link quality, rather than a single instantaneous interference or noise.

[0057] This embodiment effectively filters out transient disturbances by determining whether conditions are met for multiple consecutive cycles, thus ensuring the stability and reliability of the handover decision. Furthermore, the configurable time window length allows the system to adapt to the handover sensitivity requirements of different application scenarios.

[0058] S203. When the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window, a switching signal is generated and the switching signal is sent to the multiplexer.

[0059] The multiplexer is used to switch the transmission path of the data stream.

[0060] In this step, a switching signal is generated when the signal quality parameters continuously meet the target switching conditions for a duration reaching a preset time window. This signal carries path selection information (e.g., selecting an optical waveguide path). Then, this switching signal is sent to the control terminal of the multiplexer via the control bus. Figure 4 As shown, a multiplexer is an electronic circuit that can select one output from multiple input signals according to a selection control signal. Its output channel is determined by the signal received at its control terminal.

[0061] S204. Based on the switching signal, control the multiplexer to switch from the first conducting state to the second conducting state.

[0062] In the first conducting state, the output of the multiplexer is connected to the input of the first path and disconnected from the input of the second path; in the second conducting state, the output of the multiplexer is connected to the input of the second path and disconnected from the input of the first path; the multiplexer is used to switch the data stream from the input of the first path to the input of the second path in the second conducting state, so as to send the data stream to the remote device through the second path.

[0063] In this step, the multiplexer, upon receiving the switching control signal, switches its selection control terminal from a first on state to a second on state. In the second on state, the multiplexer's output is connected to the input of the second path (optical waveguide path) and disconnected from the input of the first path (copper cable path). In the second on state, the multiplexer switches the data stream from the input of the first path to the input of the second path. The data stream is then converted into an optical signal by the integrated optical waveguide module and transmitted to the remote device via the optical waveguide. Specifically, after receiving the switching signal, the multiplexer changes its internal switching state according to the signal content, disconnecting the data stream output from the data source from the previously connected copper cable path and connecting it to the optical waveguide path. This process is completed by pure hardware circuitry without software intervention, resulting in extremely fast switching speed. After the switching is complete, the data stream is transmitted to the remote device via the second path.

[0064] In some embodiments, Figure 2 Steps S203 and S204 shown can be used as Figure 1 One specific implementation of step S102 shown.

[0065] This embodiment achieves rapid switching by generating a switching signal and using a multiplexer for path switching. By sensing the signal quality parameters of the first path, it can predictively switch to the second path when the quality continuously deteriorates and reaches a time window. This avoids performance loss and data retransmission caused by passively waiting for link interruptions. The time window mechanism prevents erroneous switching caused by momentary interference, improving data transmission stability. This is completely transparent to upper-layer applications and does not affect the communication experience. Furthermore, the hardware-implemented decision-making logic is more reliable and deterministic, avoiding software-level latency and uncertainty.

[0066] S205. Set the detection cycle and generate a temporary switching command when each detection cycle is reached.

[0067] In this step, a periodic timer is set up, and the detection period can be configured as needed (e.g., once per second). Whenever the timer count reaches the preset period, a "temporary switching instruction" is generated. This instruction differs from the formal switching signal; its function is to perform a very brief path switch to complete the detection, rather than permanently changing the path.

[0068] S206. Based on the temporary switching instruction, temporarily switch the output path of the data stream from the second path to the first path.

[0069] In this step, the output path of the data stream can be temporarily switched from the second path to the first path according to the temporary switching instruction. Specifically, this can be implemented using a multiplexer, such as... Figure 4 As shown, after receiving a temporary switching command, the multiplexer instantly switches the output path of the data stream from the optical waveguide path to the copper cable path. This switching is brief, lasting only the time required to complete one link quality test.

[0070] S207. Send test data on the first path and detect the signal quality during the transmission of the test data to obtain the recovery quality parameters.

[0071] Specifically, in this step, after the path switches to copper cable, a short segment of test data is sent on the copper cable link (or an idle real data stream can be used). Simultaneously, the signal quality monitoring module collects signal quality parameters, such as the bit error rate, from the receiving end of the copper cable link during this data transmission process and completes the calculation within a very short time to obtain the recovery quality parameters. These recovery quality parameters reflect the physical quality of the copper cable link at the current moment.

[0072] S208. Control the multiplexer to switch the output path of the data stream back to the second path.

[0073] In this step, once the signal quality monitoring module completes data acquisition and reports the results, it immediately sends a control signal to the multiplexer again to switch the output path of the data stream back to the optical waveguide path, restoring normal optical waveguide transmission. The entire fast link quality detection process is typically completed within microseconds, is transparent to remote devices, and will not cause connection interruption or data loss.

[0074] In some embodiments, the recovery quality parameter includes the bit error rate, and the method further includes: if the bit error rate of the first path is detected to be less than a recovery threshold, then determining that the recovery quality parameter meets the target recovery condition, wherein the recovery threshold is less than the switching threshold.

[0075] In this embodiment, the recovery quality parameter can be measured using the bit error rate (BER). A recovery threshold is pre-configured, which is less than a switching threshold. After the signal quality monitoring module obtains the current BER of the copper cable link through a fast link quality detection mechanism, the intelligent control logic unit compares the BER with the recovery threshold. If the current BER is less than the recovery threshold, it is determined that the target recovery condition is met, triggering a switchback operation, i.e., switching back to the copper cable link; if the current BER is greater than or equal to the recovery threshold, it is determined that the copper cable link has not been fully recovered, and optical waveguide transmission continues.

[0076] This embodiment sets the recovery threshold to be more stringent than the switching threshold, only switching back to copper cable when the link quality significantly improves and exceeds the recovery threshold. This mechanism effectively avoids frequent oscillations near the critical point, ensuring system stability and deterministic switching.

[0077] S209. If the recovery quality parameters meet the target recovery conditions, switch the data stream from the second path back to the first path.

[0078] Specifically, the implementation process and principle of S209 and S104 are the same, and will not be repeated here.

[0079] This embodiment of the disclosure transmits the data stream to be transmitted through a first path and monitors the signal quality parameters of the first path. If, within a preset time window, the bit error rate of the first path is repeatedly found to be greater than a switching threshold, it is determined that the signal quality parameters continuously meet the target switching conditions for a duration exceeding the preset time window. Then, when the signal quality parameters continuously meet the target switching conditions for a duration exceeding the preset time window, a switching signal is generated and sent to a multiplexer. Based on the switching signal, the multiplexer is controlled to switch from a first conducting state to a second conducting state. Further, a detection period is set, and at the end of each detection period, a temporary switching command is generated. Based on the temporary switching command, the output path of the data stream is temporarily switched from the second path to the first path. Test data is transmitted on the first path, and the signal quality during the test data transmission process is detected to obtain the recovery quality parameters. The multiplexer is then controlled to switch the output path of the data stream back to the second path. Finally, when the recovery quality parameters meet the target recovery conditions, the data stream is switched back from the second path to the first path. This method, as disclosed in this embodiment, enables periodic monitoring of copper cable link quality without interrupting normal communication by generating temporary switching instructions, briefly switching paths, sending test data and detecting quality, and immediately switching back to the main path. Because the entire detection process is extremely short and incorporates a link-layer buffering mechanism, it is completely transparent to upper-layer applications. This mechanism allows the system to promptly detect the recovery status of the copper cable, providing a reliable basis for automatic reconnection.

[0080] Figure 3 Here is a flowchart of a data transmission medium switching method provided in another embodiment of this disclosure, as shown below. Figure 3 As shown, the method includes the following steps: S301. Transmit the data stream to be transmitted through the first path and monitor the signal quality parameters of the first path.

[0081] The first path is one that uses copper cable as the transmission medium.

[0082] Specifically, the implementation process and principle of S301 and S101 are the same, and will not be repeated here.

[0083] S302, when the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window, the data stream is switched from the first path to the second path for transmission.

[0084] The second path is one that uses an optical waveguide as the transmission medium.

[0085] Specifically, the implementation process and principle of S302 and S102 are the same, and will not be repeated here.

[0086] S303. Collect the optical path quality parameters of the second path, wherein the optical path quality parameters include at least one of optical power and optical link bit error rate.

[0087] An optical power monitor and an optical signal bit error rate detection circuit can be installed inside the integrated optical waveguide module or at its receiver. When operating within the optical waveguide path, such as... Figure 4 As shown, the intelligent control logic unit continuously collects these optical path quality parameters. The optical power parameter is obtained by converting the received light intensity into electrical signal amplitude using a photodetector; the optical link bit error rate is calculated by decoding and verifying the received data.

[0088] S304. If the optical path quality parameters are within the preset fault parameter range, detect the current recovery quality parameters of the first path.

[0089] Specifically, the preset fault parameter range includes optical power below the power threshold and optical link bit error rate exceeding the optical path fault threshold. When the optical path quality parameters are detected to fall within the fault range, it is determined that the optical waveguide path may be faulty (such as laser aging, fiber bending, connector contamination, etc.). At this time, a fast link quality detection mechanism is immediately activated to detect the current recovery quality parameters (such as bit error rate) of the copper cable link to determine whether the copper cable is usable.

[0090] S305. If the current recovery quality parameters meet the target recovery conditions, then switch the data stream back to the first path.

[0091] If the current recovery quality parameters meet the target recovery conditions, the copper cable link is determined to be currently healthy and available. The data stream is actively switched from the optical waveguide path back to the copper cable path to avoid data errors or interruptions caused by continued transmission on the faulty optical waveguide.

[0092] S306. If the current recovery quality parameters do not meet the target recovery conditions, an alarm signal is generated.

[0093] If the current recovery quality parameters do not meet the target recovery conditions, it indicates that the copper cable link is also in a degraded state. In this case, both paths are unavailable. An alarm signal is generated and reported to the upper-level system to notify the operation and maintenance personnel that the link is about to be completely interrupted. They can try to reduce the speed or enter the error recovery state.

[0094] This embodiment enables the sensing of the health status of the optical waveguide path itself. In the event of an optical waveguide failure, it actively detects the recovery status of the copper cable, actively switches back to the copper cable when it is available, and issues an alarm when the copper cable is unavailable. This allows for bidirectional active switching, a mechanism that significantly increases the robustness and reliability of the system.

[0095] S307. During transmission through the second path, the signal quality of the first path is periodically detected to obtain the recovery quality parameters.

[0096] The recovery quality parameter is used to characterize the signal quality recovery of the first path.

[0097] Specifically, the implementation process and principle of S307 and S103 are the same, and will not be repeated here.

[0098] S308. If the recovery quality parameters meet the target recovery conditions, generate a recovery signal and send the recovery signal to the multiplexer.

[0099] In this step, the recovery quality parameters are compared with preset recovery conditions. When the recovery conditions are met (e.g., the bit error rate is less than the recovery threshold), a recovery signal is generated. This recovery signal, similar to a switching signal, is an electronic control command carrying path selection information (selecting the copper cable path). Then, this recovery signal is sent to the control terminal of the multiplexer via the control bus.

[0100] S309. Based on the recovery signal, the data stream is restored from the second path to the first path for transmission.

[0101] In this step, the data stream can be restored from the second path to the first path for transmission based on the recovery signal. Specifically, this can be achieved using a multiplexer. After receiving the recovery signal, the multiplexer changes its internal switching state according to the signal's content, disconnecting the data stream from the current optical waveguide path and reconnecting it to the copper cable path. After the switching is complete, the data stream resumes transmission to the remote device via the first path (copper cable). This restoration process is also completed by hardware circuitry, is extremely fast, and transparent to upper-layer applications.

[0102] This embodiment achieves automatic, fast, and transparent path recovery by generating a recovery signal and controlling the multiplexer to perform a switchback. Hardware-level execution ensures the switchback operation is completed in microseconds, without affecting ongoing communication. Furthermore, the recovery signal is generated based on objective recovery quality parameters, avoiding subjective or arbitrary decision-making.

[0103] This embodiment of the disclosure transmits the data stream to be transmitted through a first path and monitors the signal quality parameters of the first path. When the signal quality parameters continuously meet the target switching conditions for a duration reaching a preset time window, the data stream is switched from the first path to a second path for transmission. Then, the optical path quality parameters of the second path are acquired. If the optical path quality parameters are within a preset fault parameter range, the current recovery quality parameters of the first path are detected. If the current recovery quality parameters meet the target recovery conditions, the data stream is switched back to the first path; if the current recovery quality parameters do not meet the target recovery conditions, an alarm signal is generated. Simultaneously, during transmission through the second path, the signal quality of the first path is periodically detected to obtain recovery quality parameters. When the recovery quality parameters meet the target recovery conditions, a recovery signal is generated and sent to a multiplexer. Based on the recovery signal, the data stream is restored from the second path to the first path for transmission. Compared to existing technologies, the embodiments disclosed herein achieve the perception of the health status of the optical waveguide path itself. In the event of an optical waveguide failure, the recovery status of the copper cable is actively detected, and the copper cable is actively switched back when available, and an alarm is issued when the copper cable is unavailable. This enables bidirectional active switching, a mechanism that significantly increases the robustness and reliability of the system.

[0104] The solutions in the embodiments of this disclosure can be used individually or in combination without conflict. For example, S204, controlling the multiplexer to switch from a first conducting state to a second conducting state based on the switching signal, and S308, generating a recovery signal and sending the recovery signal to the multiplexer when the recovery quality parameters meet the target recovery conditions, can be used in combination, and no specific limitation is made here.

[0105] Figure 4 This is a schematic diagram of the architecture of a data transmission medium switching system provided in an embodiment of this disclosure. The system mainly includes the following modules, and their connection relationships are as follows: Figure 4 As shown: Data source: Devices that generate high-speed serial data.

[0106] Intelligent switching circuit: Internally includes a multiplexer, copper cable path, integrated optical waveguide module, signal quality monitoring module, intelligent control logic unit and switching execution circuit.

[0107] Multiplexer: The input terminals are connected to the data source and two transmission paths respectively, and the output terminal selects which path to send the data to based on the control signal.

[0108] Copper cable path: Includes the copper cable driver, which is responsible for sending electrical signals through the copper cable.

[0109] Integrated optical waveguide module: Includes a miniature laser driver, photodetector, and optical waveguide interface. When this path is selected, it converts electrical signals into optical signals for transmission through the optical waveguide.

[0110] Signal quality monitoring module: Connected to the copper cable link, it collects quality parameters such as bit error rate and signal amplitude in real time.

[0111] Intelligent control logic unit: Receives data from the signal quality monitoring module, has built-in dual threshold and anti-oscillation algorithms, and generates switching control signals according to preset logic.

[0112] Switching execution circuit: Based on the control signal, the physical path is actually connected or disconnected.

[0113] Remote device: Data receiving end.

[0114] like Figure 4 As shown, the data stream generated by the data source enters the intelligent switching circuit. This circuit monitors the quality of the copper cable link in real time through the signal quality monitoring module, and the intelligent control logic unit determines whether the data stream is transmitted to the remote device via the copper cable path or the integrated optical waveguide module.

[0115] Figure 5 This is a schematic diagram of the structure of a data transmission medium switching device provided in an embodiment of this disclosure. The data transmission medium switching device can be an electronic device as described in the above embodiment, or it can be a component or assembly within that electronic device. The data transmission medium switching device provided in this embodiment can execute the processing flow provided in the data transmission medium switching method embodiment, such as... Figure 5 As shown, the data transmission medium switching device 50 includes: a monitoring module 51, a first switching module 52, a detection module 53, and a second switching module 54; wherein, the monitoring module 51 is used to transmit the data stream to be transmitted through a first path and monitor the signal quality parameters of the first path; the first switching module 52 is used to switch the data stream from the first path to a second path for transmission when the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window; the detection module 53 is used to periodically detect the signal quality of the first path during transmission through the second path to obtain recovery quality parameters; the second switching module 54 is used to switch the data stream from the second path back to the first path when the recovery quality parameters meet the target recovery conditions.

[0116] Optionally, when the first switching module 52 switches the data stream from the first path to the second path for transmission when the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window, it is specifically used to: generate a switching signal and send the switching signal to a multiplexer when the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window; wherein, the multiplexer is used to switch the transmission path of the data stream; control the multiplexer to switch from a first conducting state to a second conducting state based on the switching signal; wherein, in the first conducting state, the output terminal of the multiplexer is in a conducting state with the input terminal of the first path and in a disconnected state with the input terminal of the second path; in the second conducting state, the output terminal of the multiplexer is in a conducting state with the input terminal of the second path and in a disconnected state with the input terminal of the first path; the multiplexer is used to switch the data stream from the input terminal of the first path to the input terminal of the second path in the second conducting state, so as to send the data stream to a remote device through the second path.

[0117] Optionally, the signal quality parameter includes the bit error rate (BER). After monitoring the signal quality parameter of the first path, the device 50 further includes: a determination module 55, configured to record the BER sample value corresponding to each sampling period within multiple consecutive sampling periods, calculate the BER change trend based on the BER sample value corresponding to each sampling period, the change trend being used to characterize the rate of BER degradation of the first path over time; if the change trend characterizes the BER continuously rising within the preset time window and the BER sample value corresponding to the current sampling period is greater than the switching threshold, determine that the signal quality parameter continuously meets the target switching condition and the duration reaches the preset time window; or, within the preset time window, continuously acquire the BER of the first path multiple times, count the number of times the continuously acquired BER exceeds the switching threshold, and when the number is greater than a preset quantity threshold, determine that the signal quality parameter continuously meets the target switching condition and the duration reaches the preset time window.

[0118] Optionally, when the detection module 53 periodically detects the signal quality of the first path during transmission through the second path to obtain the recovery quality parameters, it is specifically used to: set a detection period and generate a temporary switching instruction when each detection period arrives; based on the temporary switching instruction, temporarily switch the output path of the data stream from the second path to the first path; send test data on the first path and detect the signal quality during the transmission of the test data to obtain the recovery quality parameters; and control the multiplexer to switch the output path of the data stream back to the second path.

[0119] Optionally, when the second switching module 54 switches the data stream from the second path back to the first path when the recovery quality parameters meet the target recovery conditions, it is specifically used to: generate a recovery signal and send the recovery signal to the multiplexer when the recovery quality parameters meet the target recovery conditions; and restore the data stream from the second path to the first path for transmission based on the recovery signal.

[0120] Optionally, the recovery quality parameter includes the bit error rate, and the determining module 55 is further configured to: determine that the recovery quality parameter meets the target recovery condition when the bit error rate of the first path is detected to be less than the recovery threshold, wherein the recovery threshold is less than the switching threshold.

[0121] Optionally, after switching the data stream from the first path to the second path for transmission, the device 50 further includes: a control module 56; the control module 56 is used to collect optical path quality parameters of the second path, the optical path quality parameters including at least one of optical power and optical link bit error rate; when the optical path quality parameters are within a preset fault parameter range, detect the current recovery quality parameters of the first path; if the current recovery quality parameters meet the target recovery condition, switch the data stream back to the first path; if the current recovery quality parameters do not meet the target recovery condition, generate an alarm signal.

[0122] Figure 5 The data transmission medium switching device of the illustrated embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and will not be repeated here.

[0123] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. See below for details. Figure 6 It shows a schematic diagram of a structure suitable for implementing the electronic device 600 in the embodiments of this disclosure. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0124] like Figure 6As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603 to implement the data transmission medium switching method as described in the embodiments of this disclosure. The RAM 603 also stores various programs and data required for the operation of electronic device 600. The processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. An input / output (I / O) interface 605 is also connected to bus 604.

[0125] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0126] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts, thereby implementing the data transmission medium switching method described above. In such embodiments, the computer program can be downloaded and installed from a network via communication device 609, or installed from storage device 608, or installed from ROM 602. When the computer program is executed by processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.

[0127] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0128] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0129] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0130] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: The data stream to be transmitted is transmitted through the first path, and the signal quality parameters of the first path are monitored; wherein, the first path is a path that uses copper cable as the transmission medium; If the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window, the data stream is switched from the first path to the second path for transmission; wherein, the second path is a path that uses an optical waveguide as the transmission medium. During transmission through the second path, the signal quality of the first path is periodically detected to obtain recovery quality parameters; wherein, the recovery quality parameters are used to characterize the recovery status of the signal quality of the first path; If the recovery quality parameters meet the target recovery conditions, the data stream is switched from the second path back to the first path.

[0131] Optionally, when one or more of the above-described procedures are executed by the electronic device, the electronic device may also execute other steps of the above embodiments.

[0132] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0133] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0134] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0135] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.

[0136] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0137] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0138] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0139] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for switching data transmission media, characterized in that, The method includes: The data stream to be transmitted is transmitted through the first path, and the signal quality parameters of the first path are monitored; wherein, the first path is a path that uses copper cable as the transmission medium; If the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window, the data stream is switched from the first path to the second path for transmission; wherein, the second path is a path that uses an optical waveguide as the transmission medium. During transmission through the second path, the signal quality of the first path is periodically detected to obtain recovery quality parameters; wherein, the recovery quality parameters are used to characterize the recovery status of the signal quality of the first path; If the recovery quality parameters meet the target recovery conditions, the data stream is switched from the second path back to the first path.

2. The method according to claim 1, characterized in that, The step of periodically detecting the signal quality of the first path during transmission through the second path to obtain recovered quality parameters includes: Set a detection cycle and generate a temporary switching command when each detection cycle is reached; Based on the temporary switching instruction, the output path of the data stream is temporarily switched from the second path to the first path; Test data is sent on the first path, and the signal quality during the transmission of the test data is detected to obtain the recovery quality parameters; The multiplexer is controlled to switch the output path of the data stream back to the second path.

3. The method according to claim 1, characterized in that, After switching the data stream from the first path to the second path for transmission, the method further includes: Collect optical path quality parameters of the second path, wherein the optical path quality parameters include at least one of optical power and optical link bit error rate; When the optical path quality parameters are within a preset fault parameter range, the current recovery quality parameters of the first path are detected; If the current recovery quality parameters meet the target recovery conditions, then the data stream is switched back to the first path; If the current recovery quality parameters do not meet the target recovery conditions, an alarm signal is generated.

4. The method according to claim 1, characterized in that, When the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window, switching the data stream from the first path to the second path for transmission includes: When the signal quality parameters continuously meet the target switching conditions for a duration of a preset time window, a switching signal is generated and sent to a multiplexer; wherein, the multiplexer is used to switch the transmission path of the data stream; Based on the switching signal, the multiplexer is controlled to switch from a first conducting state to a second conducting state; In the first conducting state, the output of the multiplexer is connected to the input of the first path and disconnected from the input of the second path; in the second conducting state, the output of the multiplexer is connected to the input of the second path and disconnected from the input of the first path; the multiplexer is used to switch the data stream from the input of the first path to the input of the second path in the second conducting state, so as to send the data stream to the remote device through the second path.

5. The method according to claim 1, characterized in that, The signal quality parameters include the bit error rate. After monitoring the signal quality parameters of the first path, the method further includes: Within multiple consecutive sampling periods, the bit error rate (BER) sample value corresponding to each sampling period is recorded. The BER change trend is calculated based on the BER sample value corresponding to each sampling period. This change trend characterizes the rate of BER degradation of the first path over time. If the change trend indicates that the BER continuously increases within the preset time window and the BER sample value corresponding to the current sampling period is greater than the switching threshold, it is determined that the signal quality parameter continuously meets the target switching condition and the duration reaches the preset time window; or... Within a preset time window, the bit error rate of the first path is acquired multiple times consecutively, and the number of times the acquired bit error rate exceeds the switching threshold is counted. When the number of times exceeds a preset quantity threshold, it is determined that the signal quality parameter continuously meets the target switching condition and the duration reaches the preset time window.

6. The method according to claim 1, characterized in that, When the recovery quality parameters meet the target recovery conditions, switching the data stream from the second path back to the first path includes: When the recovery quality parameters meet the target recovery conditions, a recovery signal is generated; Based on the recovery signal, the data stream is restored from the second path to the first path for transmission.

7. The method according to claim 3, characterized in that, The recovery quality parameters include the bit error rate, and the method further includes: If the bit error rate of the first path is detected to be less than the recovery threshold, then the recovery quality parameter is determined to meet the target recovery condition, wherein the recovery threshold is less than the switching threshold.

8. A data transmission medium switching device, characterized in that, The device includes: The monitoring module is used to transmit the data stream to be transmitted through the first path and monitor the signal quality parameters of the first path. The first switching module is used to switch the data stream from the first path to the second path for transmission when the signal quality parameters continuously meet the target switching conditions and the duration reaches a preset time window. The detection module is used to periodically detect the signal quality of the first path during transmission through the second path to obtain the recovery quality parameters; The second switching module is used to switch the data stream from the second path back to the first path when the recovery quality parameters meet the target recovery conditions.

9. An electronic device, characterized in that, include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-7.