Data transmission method and system, computer device and storage medium
By listening to data transmission signals and switching preset conditions on the first communication channel of IoT devices, and using an analog switch to achieve two-way communication, the high cost and resource consumption caused by multiple communication systems are solved, and efficient communication switching and stability are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG CHINT IOT TECH CO LTD
- Filing Date
- 2023-06-16
- Publication Date
- 2026-04-10
AI Technical Summary
In existing technologies, IoT devices require multiple communication systems, resulting in high costs and high processor resource consumption. Furthermore, existing improvement solutions use multiple communication interfaces, which consume a significant amount of processor resources.
By listening to the data transmission signal of the first communication channel to detect the data symbol transmission status, switching to the auxiliary channel for data transmission, and switching back to the main channel when the preset transmission conditions are met, two-way communication is realized using an analog switch.
It enables two-way communication without the need for multiple communication systems and processor interfaces, reducing costs and avoiding resource consumption, while ensuring the stability of the main channel communication.
Smart Images

Figure CN116708500B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, in particular to a data transmission method, system, computer device and storage medium. BACKGROUND
[0002] In the application scenario of Internet of Things, the device usually needs to have the ability of multi-channel communication, so as to complete the data transmission with different external devices. For example, for an electric energy meter, in the production scene, it needs to communicate with the production tool through a communication channel, so as to complete the transmission of metering data, and also needs to communicate with the host computer through another communication channel, so as to complete the transmission of command frame data of operations such as meter calibration, meter checking and parameter issuing; in the operation and maintenance scene, it needs to communicate with the mobile terminal through another communication channel, so as to complete the transmission of operation and maintenance data, and also needs to communicate with the host computer through another communication channel, so as to complete the transmission of abnormal data.
[0003] The prior art usually adopts multiple sets of communication systems, each set of communication system including a corresponding processor and communication device, which is very high in cost. Some improved schemes also exist, such as selecting a processor with multiple communication interfaces, and connecting the multiple communication interfaces with corresponding communication devices, but this will occupy more resources of the processor, and the cost is also not low. SUMMARY
[0004] In view of the deficiencies in the prior art, the present application provides a data transmission method, system, computer device and storage medium.
[0005] In a first aspect, in one embodiment, the present application provides a data transmission method, comprising:
[0006] performing first data transmission signal detection on the first communication channel to obtain a first data transmission detection result;
[0007] if the first data transmission detection result indicates that there is data symbol transmission on the first communication channel, switching to the first communication channel and transmitting data through the first communication channel, and if the first data transmission detection result indicates that there is no data symbol transmission on the first communication channel, not performing the action of switching to the first communication channel;
[0008] performing second data transmission signal detection on the first communication channel to obtain a second data transmission detection result;
[0009] if the second data transmission detection result meets a preset transmission condition, switching back to the second communication channel, and if the second data transmission detection result does not meet the preset transmission condition, not performing the action of switching back to the second communication channel.
[0010] In one embodiment, the first communication channel is subjected to data transmission signal detection to obtain a data transmission detection result, including:
[0011] detecting a level of the first communication channel signal;
[0012] if the level of the first communication channel changes, obtaining a data transmission detection result indicating that the first communication channel has data symbol transmission;
[0013] if the level of the first communication channel does not change, obtaining a data transmission detection result indicating that the first communication channel has no data symbol transmission.
[0014] In one embodiment, if the level of the first communication channel changes, a data transmission detection result indicating that the first communication channel has data symbol transmission is obtained, including:
[0015] if the level of the first communication channel changes from high to low, a data transmission detection result indicating that the first communication channel has data symbol transmission is obtained.
[0016] In one embodiment, the first byte of the data transmitted by the first communication channel is a preamble.
[0017] In one embodiment, the first communication channel is subjected to second data transmission signal detection to obtain a second data transmission detection result, including:
[0018] after switching to the first communication channel and transmitting data through the first communication channel, detecting a data transmission time length of the first communication channel;
[0019] if the data transmission time length is not less than a first preset time length, and the received data is a target data unit, a second data transmission detection result indicating that the data transmission of the first communication channel satisfies a preset transmission condition is obtained;
[0020] if the data transmission time length is less than the first preset time length, and / or the received data does not reach a target data unit, a second data transmission detection result indicating that the data transmission of the first communication channel does not satisfy the preset transmission condition is obtained.
[0021] In one embodiment, the first communication channel is subjected to second data transmission signal detection to obtain a second data transmission detection result, including:
[0022] after switching to the first communication channel and transmitting data through the first communication channel, detecting a data transmission time length of the first communication channel;
[0023] if the data transmission time length is not less than a second preset time length, a second data transmission detection result indicating that the data transmission of the first communication channel satisfies a preset transmission condition is obtained;
[0024] If the data transmission duration is less than the second preset duration, a second data transmission detection result is obtained, which indicates that the data transmission of the first communication channel does not meet the preset transmission condition.
[0025] In a second aspect, in one embodiment, the present application provides a data transmission system, comprising:
[0026] a processor, a switching unit, a first communication unit and a second communication unit;
[0027] The processor is configured to perform first data transmission signal listening on the first communication channel to obtain a first data transmission detection result. If the first data transmission detection result indicates that the first communication channel has data symbol transmission, the processor is configured to switch to the first communication channel and transmit data through the first communication channel. If the first data transmission detection result indicates that the first communication channel has no data symbol transmission, the processor is configured to not perform the switching action to the first communication channel.
[0028] The processor is further configured to perform second data transmission signal listening on the first communication channel to obtain a second data transmission detection result. If the second data transmission detection result meets a preset transmission condition, the processor is configured to switch back to the second communication channel. If the second data transmission detection result does not meet the preset transmission condition, the processor is configured to not perform the switching action back to the second communication channel.
[0029] In one embodiment, the switching unit comprises an analog switch.
[0030] The first communication end of the analog switch is electrically connected to the communication end of the processor, the second communication end of the analog switch is electrically connected to the communication end of the first communication unit, the third communication end of the analog switch is electrically connected to the communication end of the second communication unit, and the response end of the analog switch is electrically connected to the control end of the processor.
[0031] The first state of the analog switch indicates that the first communication end of the analog switch is electrically connected to the second communication end of the analog switch, and the second state of the analog switch indicates that the first communication end of the analog switch is electrically connected to the third communication end of the analog switch.
[0032] In a third aspect, in one embodiment, the present application provides a computer device, comprising a memory and a processor. The memory stores a computer program, and the processor is configured to run the computer program in the memory to perform the steps in the data transmission method in any of the above embodiments.
[0033] In a fourth aspect, in one embodiment, the present application provides a storage medium, which stores a computer program. The computer program is loaded by a processor to perform the steps in the data transmission method in any of the above embodiments.
[0034] By the data transmission method, system, computer device and storage medium, two-way communication is realized by switching, without using multiple communication systems, and without requiring the processor to have multiple communication interfaces, so that the processor does not occupy more resources, and the cost is greatly reduced. Although the two-way communication cannot be performed simultaneously, the first communication channel is usually an auxiliary channel, and the communication amount is small, so the first communication channel is switched only when data symbols are transmitted, and the second communication channel is switched back to the main channel when the data transmission of the first communication channel meets the preset transmission condition, so that the communication of the second channel as the main channel is basically not affected. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0036] Figure 1 The application scenario diagram of the data transmission method in one embodiment of the present application is shown.
[0037] Figure 2 The flowchart of the data transmission method in one embodiment of the present application is shown.
[0038] Figure 3 The structure diagram of the data transmission system in one embodiment of the present application is shown.
[0039] Figure 4 The structure diagram of the data transmission system in another embodiment of the present application is shown.
[0040] Figure 5 The flowchart of the data transmission method in another embodiment of the present application is shown.
[0041] Figure 6 The structure diagram of the computer device in one embodiment of the present application is shown. DETAILED DESCRIPTION
[0042] The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0043] In the description of the present application, it should be understood that the terms "first", "second" are used only for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined as "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "a plurality of" is two or more, unless otherwise specifically limited. In the present application, the word "exemplary" is used to mean "serving as an example, instance, or illustration". Any embodiment described as "exemplary" in the present application is not necessarily construed as preferred or advantageous over other embodiments. In order to enable any person skilled in the art to implement and use the present application, the following description is given. In the following description, details are listed for the purpose of explanation. It should be understood that those skilled in the art can realize the present application without using these specific details. In other examples, well-known structures and processes will not be described in detail to avoid unnecessary details making the description of the present application obscure. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope consistent with the principles and characteristics disclosed in the present application.
[0044] The data transmission method in the embodiments of the present application is applied to a data transmission device, and the data transmission device is arranged in a computer device. The computer device can be a terminal, such as a mobile phone or a tablet computer. The computer device can also be a server or a service cluster composed of multiple servers.
[0045] As shown in Figure 1 , the application scenario of the data transmission method in the embodiments of the present application is shown in Figure 1 . The application scenario of the data transmission method in the embodiments of the present application includes a computer device 100 (the data transmission device is integrated in the computer device 100), and a computer readable storage medium corresponding to the data transmission method is run in the computer device 100 to execute the steps of the data transmission method.
[0046] It can be understood that Figure 1 the computer device in the application scenario of the data transmission method or the device contained in the computer device does not constitute a limitation on the embodiments of the present application, that is, the number and type of devices contained in the application scenario of the data transmission method, or the number and type of devices contained in each device do not affect the overall implementation of the technical solution in the embodiments of the present application, and can be regarded as equivalent replacement or derivation of the technical solution claimed in the embodiments of the present application.
[0047] The computer device 100 in the embodiments of the present application can be a stand-alone device, or a device network or device cluster composed of devices. For example, the computer device 100 described in the embodiments of the present application includes but is not limited to a computer, a network host, a single network device, a plurality of network device sets, or a cloud device composed of a plurality of devices. The cloud device is composed of a large number of computers or network devices based on cloud computing.
[0048] Those skilled in the art can understand that Figure 1 The application scenarios shown in the above embodiments are only one of the application scenarios corresponding to the technical solutions of the present application, and do not constitute a limitation on the application scenarios of the technical solutions of the present application. Other application scenarios can include more or fewer computer devices, or computer device network connection relationships, for example Figure 1 Only one computer device is shown in the above embodiments. It can be understood that the application scenarios of the data transmission method can also include one or more other computer devices, and the specific number of computer devices is not limited here. The computer device 100 can also include a memory for storing information related to the data transmission method. Figure 1 In addition, the computer device 100 in the application scenarios of the data transmission method in the embodiments of the present application can be provided with a display device, or the computer device 100 can be connected in communication with an external display device 200 without being provided with a display device. The display device 200 is used to output the results of the execution of the data transmission method in the computer device. The computer device 100 can access a background database 300 (the background database 300 can be a local memory of the computer device 100, and the background database 300 can also be provided on a cloud). The background database 300 stores information related to the data transmission method.
[0049] It should be noted that
[0050] The application scenarios of the data transmission method shown in the above embodiments are only one example. The application scenarios of the data transmission method described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Figure 1 Based on the above application scenarios of the data transmission method, embodiments of the data transmission method are provided.
[0051] In a first aspect, as shown in the above embodiments, in one embodiment, the present application provides a data transmission method, including:
[0052] Figure 2 Step 201: performing first data transmission signal detection on a first communication channel to obtain a first data transmission detection result;
[0053] Step 201: performing first data transmission signal detection on a first communication channel to obtain a first data transmission detection result;
[0054] The first communication channel is mainly an auxiliary communication channel and is used to transmit occasional data. For example, for an electric energy meter, in a production scenario, the first communication channel is used to enable the electric energy meter to communicate with an upper computer, thereby completing the transmission of command frame data of operations such as meter calibration, meter checking, and parameter issuing. For example, in an operation and maintenance scenario, the first communication channel is used to enable the electric energy meter to communicate with the upper computer, thereby completing the transmission of abnormal data. It can be understood that, between the electric energy meter and the upper computer, whether it is command frame data of operations such as meter calibration, meter checking, and parameter issuing or abnormal data, it is transmitted once occasionally at some time, rather than continuously.
[0055] As can be known from the foregoing description, the first communication channel is only connected and performs corresponding data transmission when there is data symbol transmission. Therefore, in this step, the first data transmission signal detection of the first communication channel, that is, whether the first communication channel has data symbol transmission, is obtained. There are two kinds of first data transmission signal detection, one indicating that the first communication channel has data symbol transmission, and the other indicating that the first communication channel does not have data symbol transmission.
[0056] The first data transmission signal detection can be performed in any manner. For example, the first communication unit corresponding to the first communication channel has a signal sending function. When there is data symbol transmission, the first communication unit generates a corresponding trigger signal and sends the trigger signal to the execution subject (i.e., the processor) of the data transmission method in this embodiment, so that the corresponding first data transmission signal detection can be obtained according to whether the trigger signal sent by the first communication unit is received. Specifically, if the trigger signal sent by the first communication unit is received, the first data transmission signal detection indicating that the first communication channel has data symbol transmission is obtained. Conversely, if the trigger signal sent by the first communication unit is not received, the first data transmission signal detection indicating that the first communication channel does not have data symbol transmission is obtained. In other embodiments, data detection can also be performed in other manners, which will not be described herein.
[0057] In step 202, if the first data transmission detection result indicates that the first communication channel has data symbol transmission, the first communication channel is switched to and data is transmitted through the first communication channel. If the first data transmission detection result indicates that the first communication channel does not have data symbol transmission, no action of switching to the first communication channel is performed.
[0058] The switching to the first communication channel means that the first communication channel can be used to transmit corresponding data, that is, after the switching, the first communication channel and the processor have an electrical connection condition for realizing communication; and the second communication channel is a main communication channel and is used to transmit frequent data; for example, for an electric energy meter, in a production scene, the second communication channel is used to enable the electric energy meter to communicate with a production tooling, thereby completing transmission of metering data; for example, in an operation and maintenance scene, the second communication channel is used to enable the electric energy meter to communicate with a mobile terminal, thereby completing transmission of operation and maintenance data; it can be understood that, between the electric energy meter and the production tooling or between the electric energy meter and the mobile terminal, whether metering data or operation and maintenance data, is continuously transmitted (at least needs to be continuously transmitted in a time period) rather than transmitted once occasionally;
[0059] It should be noted that, in the embodiment, the first communication channel is switched, that is, before the switching, the relative second communication channel is always used to transmit corresponding data, that is, before the switching, the first communication channel and the processor do not have an electrical connection condition for realizing communication, and the second communication channel and the processor have the electrical connection condition for realizing communication;
[0060] In step 203, second data transmission signal detection is performed on the first communication channel, and a second data transmission detection result is obtained.
[0061] The first communication channel is an auxiliary communication channel and the second communication channel is a main communication channel. Therefore, the data transmission of the first communication channel as an auxiliary communication channel is only temporary. If the first communication channel is used for corresponding data transmission without limitation, it will affect the data transmission of the second communication channel as a main communication channel, and even cause serious consequences, such as in the production scene of an electric energy meter, if the metering data cannot be transmitted for a long time, the entire metering system may eventually malfunction, which increases the cost of subsequent data error correction. Therefore, although the first communication channel is switched to the first communication channel for corresponding data transmission when data symbols are detected, the specific transmission process needs to be limited to ensure that the second communication channel as a main communication channel can be switched back within the maximum disconnection time it can withstand. In this embodiment, considering that the data amount transmitted by the first communication channel is usually small and the transmission time is short, the corresponding second data transmission detection result can be determined according to whether the data transmission of the first communication channel is completed (it should be noted that whether the data transmission is completed needs to be determined within a certain limit, such as one data, for example, if multiple command frame data are sent at a certain time interval, one command frame data needs to be used as the basis for judgment, and if the data transmission of a certain command frame data is completed, it can be determined that the data transmission of the first communication channel is completed).
[0062] The second data transmission detection result has two types: one is a transmission detection result indicating that the data transmission of the first communication channel meets the preset transmission condition, and the other is a transmission detection result indicating that the data transmission of the first communication channel does not meet the preset transmission condition. In combination with the above example of judging whether the data transmission is completed, the preset transmission condition is that the data transmission is completed, that is, the data transmission meets the preset transmission condition, and the data transmission does not meet the preset transmission condition. In other embodiments, the preset transmission condition can also be any other condition in any form or content, which will not be described here.
[0063] Step 204: If the second data transmission detection result meets the preset transmission condition, switch back to the second communication channel. If the second data transmission detection result does not meet the preset transmission condition, do not switch back to the second communication channel.
[0064] When the preset transmission condition is set, the time required to meet the preset transmission condition is determined to be less than the maximum disconnection time that the second communication channel can withstand. Therefore, when the data transmission of the first communication channel meets the preset transmission condition, the second communication channel is switched back immediately, so as not to affect the data transmission of the second communication channel and ensure the reliability of the entire data transmission system.
[0065] By the above data transmission method, two-way communication is realized by switching, without the need to use multiple communication systems, and the processor does not need to have multiple communication interfaces, which will not occupy more resources of the processor, and greatly reduces the cost. Although the two-way communication cannot be performed simultaneously, the first communication channel is usually an auxiliary channel, and the communication amount is small, so the first communication channel is switched only when there is data symbol transmission, and the second communication channel is switched back to the main channel when the data transmission of the first communication channel meets the preset transmission condition, so as to ensure that the second channel communication as the main channel is basically not affected.
[0066] In one embodiment, data detection is performed on the first communication channel to obtain a data detection result, including:
[0067] The level of the first communication channel is detected.
[0068] The first communication unit corresponding to the first communication channel can have a signal sending function, so that the corresponding data detection result can be determined according to whether a trigger signal sent by the first communication unit is received, but this way has requirements for the performance of the first communication unit, which will additionally increase the cost. Therefore, in this embodiment, the level of the first communication channel can be directly detected. It can be understood that the transmitted data is recorded in the form of continuous change of high and low levels. When there is no data symbol transmission, the level of the first communication channel is always in a high level state. When there is data symbol transmission, the level of the first communication channel changes, and the change depends on the data to be transmitted.
[0069] If the level of the first communication channel changes, a data transmission detection result indicating that the first communication channel has data symbol transmission is obtained.
[0070] When the level change of the first communication channel is detected, the data detection result indicating that the first communication channel has data symbol transmission is obtained. However, it should be noted that the data transmission format is composed of 10 symbols per byte, the first symbol is a data start bit with low level, the stop bit is high level, and the remaining 8 symbols are data. The level of the first communication channel without data symbol transmission is always in a high level state. When there is data transmission, the data start bit is low level, and the level change from high level to low level is detected, so it can be determined that there is data symbol transmission. Although it is detected that the first channel has data symbol transmission, the communication device has start bit symbol loss when switching the first channel, so the first byte is not received. Therefore, the host computer issues the first byte of each frame as a preamble. When switching to the first communication channel, the first byte preamble is discarded or the preamble is received, which can ensure that the data to be transmitted can be transmitted completely.
[0071] If the first communication channel level is not transformed, a data transmission detection result is obtained, which indicates that there is no data symbol transmission in the first communication channel.
[0072] In one embodiment, the second data transmission signal of the first communication channel is listened to, and a second data transmission detection result is obtained, including:
[0073] After switching to the first communication channel and transmitting data through the first communication channel, the data transmission time length of the first communication channel is detected.
[0074] If the data transmission time length is not less than the first preset time length, and the received data is a target data unit, a second data transmission detection result is obtained, which indicates that the data transmission of the first communication channel meets the preset transmission condition.
[0075] If the data transmission time length is less than the first preset time length, and / or the received data does not reach a target data unit, a second data transmission detection result is obtained, which indicates that the data transmission of the first communication channel does not meet the preset transmission condition.
[0076] In this embodiment, the integrity of the data transmission of the first communication channel is ensured as the switching condition.
[0077] In one embodiment, the second data transmission signal of the first communication channel is listened to, and a second data transmission detection result is obtained, including:
[0078] After switching to the first communication channel and transmitting data through the first communication channel, the data transmission time length of the first communication channel is detected.
[0079] In the above embodiments, it has been mentioned that the second data transmission detection result of whether the preset transmission condition is met can be obtained according to whether the data transmission of the first communication channel is completed. However, this method is based on the fact that the data amount transmitted by the first communication channel is small, and the required transmission time length is short (relative to the maximum disconnection time length that the second communication channel can withstand), so as not to affect the data transmission of the second communication channel. However, there may be exceptions, i.e., the data amount transmitted by the first communication channel is large, so that the required transmission time length is greater than the maximum disconnection time length that the second communication channel can withstand, which easily affects the data transmission of the second communication channel. As can be seen, according to whether the data transmission of the first communication channel is completed, the second data transmission detection result of whether the preset transmission condition is met has certain risks, resulting in low reliability. Therefore, in this embodiment, the data transmission time length of the first communication channel is directly used as the preset transmission condition.
[0080] The second preset time length is not greater than a maximum disconnection time length that the second communication channel can bear.
[0081] If the data transmission time length is not less than the second preset time length, a second data transmission detection result is obtained, which indicates that the data transmission of the first communication channel meets the preset transmission condition.
[0082] If the data transmission time length is less than the second preset time length, a second data transmission detection result is obtained, which indicates that the data transmission of the first communication channel does not meet the preset transmission condition.
[0083] The second data transmission detection result is obtained by detecting the data transmission time length, which directly limits the time length and avoids the exception caused by detecting whether the data transmission is completed, thereby improving the reliability of the transmission detection.
[0084] In one embodiment, if the second data transmission detection result meets the preset transmission condition, the second communication channel is switched back, including:
[0085] If the second data transmission detection result indicates that the data transmission of the first communication channel meets the preset transmission condition, a completion degree detection result is obtained by detecting the completion degree of the data transmission of the first communication channel.
[0086] If the completion degree detection result indicates that the first communication channel has target data that is not completed, the target data is discarded and the second communication channel is switched back.
[0087] As mentioned in the above embodiment, the second data transmission detection result that meets the preset transmission condition is obtained when the data transmission time length is not less than the second preset time length, and the second communication channel is switched back. However, there is a problem in this method. When the data transmission time length is not less than the second preset time length, the data transmission of the first communication channel is not completed. If the second communication channel is directly switched back without any operation, the data symbol transmission of the first communication channel will be detected immediately after the second communication channel is switched back, and the first communication channel is switched back again. This makes the disconnection time length of the second communication channel greater than the maximum disconnection time length that the second communication channel can bear, thereby affecting the data transmission of the second communication channel. Therefore, in this embodiment, the target data that is not completed is discarded when the data transmission time length is not less than the second preset time length, so as to avoid switching back to the first communication channel immediately after the second communication channel is switched back.
[0088] By discarding the target data that is not completed when the transmission time length is not less than the first preset time length, the stability of switching back to the second communication channel is ensured.
[0089] In one embodiment, the data transmission of the first communication channel is subjected to completion degree detection to obtain a completion degree detection result, including:
[0090] detecting the level of the first communication channel;
[0091] if the level of the first communication channel does not change within a first preset time length, obtaining a completion degree detection result representing the target data of the first communication channel having incomplete transmission;
[0092] As mentioned in the above embodiments, the level detection can be used to determine whether the first communication channel has data symbol transmission, and similarly, in this embodiment, the level detection can also be used to determine whether the data transmission is completed. It should be noted that, in determining whether there is data symbol transmission, as long as the level change is detected, it can be determined that there is data stream transmission. However, in determining whether the data transmission is completed, if there is no level change, it is actually impossible to directly determine that the data transmission is completed. Since there are various encoding methods for data, it can cause a part of the data to be continuously at a low level or continuously at a high level. Thus, in detecting the level, the result of no level change is obtained, but actually the data transmission is not completed. If the data transmission is determined to be completed based on the result at this time, and thus the corresponding data discarding operation is not performed, it can cause the switching back to the first communication channel immediately after the switching to the second communication channel, thereby affecting the data transmission of the second communication channel. Therefore, in this embodiment, only when no level change is detected within the first preset time length, the completion degree detection result representing the target data of the first communication channel having incomplete transmission can be obtained. The first preset time length is greater than the transmission time length required for the continuous low level or continuous high level of the data caused by encoding. Therefore, even if there is continuous low level or continuous high level of the data caused by encoding, it will not affect the accuracy of the completion degree detection, thereby improving the reliability of the completion degree detection.
[0093] if the level of the first communication channel changes within the first preset time length, obtaining a completion degree detection result representing the target data of the first communication channel having no incomplete transmission.
[0094] In one embodiment, after receiving the data transmitted by the first communication channel, the starting character of the data is detected through a corresponding program algorithm. If the data is complete, the data is processed. If the data is not complete, the data is not processed and no feedback is performed.
[0095] In one embodiment, the application provides a data transmission system, as shown in Figure 3 In one embodiment, the application provides a data transmission system, as shown in
[0096] a processor, a switching unit, a first communication unit, and a second communication unit;
[0097] It should be noted that the first communication unit is used to provide a first communication channel, and the second communication unit is used to provide a second communication channel. The first communication unit and the second communication unit can be independent devices or two independent communication units in a communication device.
[0098] For an electricity meter, the first communication unit can be a wired communication device for local transmission, and the second communication unit can be a wireless communication device for remote transmission.
[0099] The switching unit can be a mechanical switch, etc.
[0100] The processor can be an MCU (microcontroller);
[0101] The processor is used to listen to the first data transmission signal of the first communication channel and obtain the first data transmission detection result; if the first data transmission detection result indicates that the first communication channel has data symbol transmission, the processor switches to the first communication channel and transmits data through the first communication channel; if the first data transmission detection result indicates that the first communication channel does not have data symbol transmission, the processor does not switch to the first communication channel.
[0102] The processor is also used to listen for the second data transmission signal on the first communication channel and obtain the second data transmission detection result; if the second data transmission detection result meets the preset transmission conditions, it switches back to the second communication channel; if the second data transmission detection result does not meet the preset transmission conditions, it does not switch back to the second communication channel.
[0103] The aforementioned data transmission system achieves two-way communication through switching, eliminating the need for multiple communication systems and processors with multiple communication interfaces. This reduces processor resource consumption and significantly lowers costs. Although the two communication channels cannot operate simultaneously, the first communication channel is typically an auxiliary channel with lower traffic. Therefore, it only switches to the first communication channel when data symbols are being transmitted. Furthermore, when the data transmission in the first communication channel meets preset transmission conditions, it switches back to the second communication channel, which is the primary channel, to ensure that the communication of the primary channel remains largely unaffected.
[0104] like Figure 4 As shown, in one embodiment, the switching unit includes an analog switch B;
[0105] The first communication end (i.e. IN and OUT) of the analog switch B is electrically connected with the communication end (i.e. TX and RX) of the processor A, the second communication end (i.e. IN2 and OUT2) of the analog switch B is electrically connected with the communication end (i.e. TX2 and RX2) of the first communication unit D, the third communication end (i.e. IN1 and OUT1) of the analog switch B is electrically connected with the communication end (i.e. TX1 and RX1) of the second communication unit C, and the response end (i.e. the port receiving the CTRL signal) of the analog switch B is electrically connected with the control end (i.e. the port sending the CTRL signal) of the processor A;
[0106] The first state of the analog switch B represents that the first communication end of the analog switch B is electrically connected with the second communication end of the analog switch B, and the second state of the analog switch B represents that the first communication end of the analog switch B is electrically connected with the third communication end of the analog switch B.
[0107] The analog switch B is composed of a plurality of switch tubes and other devices, and has a one-to-many function. Details and principles thereof can be referred to related prior art, which will not be described herein.
[0108] As shown in FIG. 1, Figure 5 In one embodiment, the present application provides a data transmission method applied to the above data transmission system in the Internet of Things electric meter, which comprises the following steps:
[0109] When the Internet of Things electric meter is powered on, the default wireless communication interaction mode is adopted, and whether the local communication unit has a level change is detected by the processor of the Internet of Things electric meter;
[0110] If not, no switching to wired communication is performed, and the current wireless communication is maintained. If yes, the switching unit is controlled to switch to the wired communication for local data transmission, so as to enter the local communication interaction mode, and then whether the wired communication transmission meets the preset transmission condition (such as whether the transmission of one target data unit or the data transmission of one time slot transmission unit (in this embodiment, one time slot transmission unit can be one second, and in other embodiments, can be any other value) is completed) is detected.
[0111] If yes, the switching unit is controlled to switch back to the wireless communication for remote data transmission. If not, no switching back to the wireless communication is performed, and the current wired communication is maintained.
[0112] In a third aspect, in one embodiment, the present application provides a computer device, as shown in FIG. 3, Figure 6 which shows the structure of the computer device involved in the present application, and specifically:
[0113] The computer device can include a processor 401 with one or more processing cores, a memory 402 with one or more computer readable storage media, a power supply 403, and an input unit 404, etc. Those skilled in the art can understand that Figure 6 The structure of the computer device shown in the figure is not a limitation on the computer device, and can include more or fewer components than shown, or combine certain components, or different component arrangements. Among them:
[0114] The processor 401 is the control center of the computer device, which connects various parts of the computer device through various interfaces and lines, and performs various functions and processes data of the computer device by running or executing software programs and / or modules stored in the memory 402 and calling data stored in the memory 402, thereby overall monitoring the computer device. Optionally, the processor 401 can include one or more processing cores; preferably, the processor 401 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and computer programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 401.
[0115] The memory 402 can be used to store software programs and modules, and the processor 401 executes various functions and data processing by running the software programs and modules stored in the memory 402. The memory 402 can mainly include a program storage area and a data storage area, wherein the program storage area can store the operating system, at least one computer program required by the function (such as sound playing function, image playing function, etc.), etc.; the data storage area can store data created according to the use of the server, etc. In addition, the memory 402 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device. Accordingly, the memory 402 can also include a memory controller to provide access for the processor 401 to the memory 402.
[0116] The computer device also includes a power supply 403 for powering various components, and preferably the power supply 403 can be logically connected to the processor 401 through a power management system, so as to realize the functions of managing charging, discharging, and power consumption management, etc. through the power management system. The power supply 403 can also include one or more direct current or alternating current power supplies, a recharging system, a power supply failure detection circuit, a power supply converter or inverter, a power supply state indicator, etc. any component.
[0117] The computer device can also include an input unit 404, which can be used to receive inputted digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0118] Although not shown, the computer device can also include a display unit and the like, which will not be described here. Specifically in the present embodiment, when the computer device is a master station, the processor 401 in the computer device will load one or more executable files corresponding to processes of one or more computer programs into the memory 402 according to the following instructions, and run the computer programs stored in the memory 402 by the processor 401 to perform the following steps:
[0119] performing first data transmission signal sensing on the first communication channel to obtain a first data transmission detection result;
[0120] if the first data transmission detection result indicates that there is data symbol transmission on the first communication channel, switching to the first communication channel and transmitting data through the first communication channel, and if the first data transmission detection result indicates that there is no data symbol transmission on the first communication channel, not performing the action of switching to the first communication channel;
[0121] performing second data transmission signal sensing on the first communication channel to obtain a second data transmission detection result;
[0122] if the second data transmission detection result meets a preset transmission condition, switching back to the second communication channel, and if the second data transmission detection result does not meet the preset transmission condition, not performing the action of switching back to the second communication channel.
[0123] Through the above computer device, two-way communication is achieved by switching, without the need for multiple communication systems or the processor having multiple communication interfaces, which does not occupy more resources of the processor and greatly reduces the cost. Although the two-way communication cannot be performed simultaneously, the first communication channel is usually an auxiliary channel with less communication volume, so it is only switched to the first communication channel when there is data symbol transmission on the first communication channel, and it is switched back to the second communication channel as the main channel when the data transmission on the first communication channel meets the preset transmission condition, so as to ensure that the communication of the second channel as the main channel is basically not affected.
[0124] Those of ordinary skill in the art can understand that all or part of the steps in any of the methods of the above embodiments can be completed by a computer program, or by relevant hardware controlled by a computer program, which can be stored in a computer readable storage medium and loaded and executed by a processor.
[0125] In a fourth aspect, in one embodiment, the present application provides a storage medium, wherein a plurality of computer programs are stored in the storage medium, and the computer programs can be loaded by a processor to perform the following steps:
[0126] performing first data transmission signal detection on the first communication channel to obtain a first data transmission detection result;
[0127] if the first data transmission detection result indicates that there is data symbol transmission on the first communication channel, switching to the first communication channel and transmitting data through the first communication channel, and if the first data transmission detection result indicates that there is no data symbol transmission on the first communication channel, not switching to the first communication channel;
[0128] performing second data transmission signal detection on the first communication channel to obtain a second data transmission detection result;
[0129] if the second data transmission detection result meets a preset transmission condition, switching back to the second communication channel, and if the second data transmission detection result does not meet the preset transmission condition, not switching back to the second communication channel.
[0130] Through the above storage medium, two-way communication is realized by switching, without the need to use multiple communication systems, and without the need for the processor to have multiple communication interfaces, so that the processor does not occupy more resources and the cost is greatly reduced. Although the two-way communication cannot be performed at the same time, the first communication channel is usually an auxiliary channel and has less communication volume, so it is only switched to the first communication channel when there is data symbol transmission on the first communication channel, and it is switched back to the second communication channel as the main channel when the data transmission on the first communication channel meets the preset transmission condition, so as to ensure that the communication of the second channel as the main channel is basically not affected.
[0131] As will be appreciated by one skilled in the art, any reference to storage, storage media, database or other medium can include a non-transitory and / or transitory medium. Non-limiting, non-transitory media can include random access memory (RAM), read only memory (ROM), electrically programmable read only memory (EPROM or EEPROM), flash memory, or any other device(s) or portion(s) that are non-transitory. Transitory media can include, for example, bus addresses, register locations, processor registers, processor caches, volatile memory, and any other device(s) or portion(s) that are transitory. As one skilled in the art will appreciate, the data transmission method of any of the embodiments provided herein can be implemented using a storage medium, and the storage medium can include any of the non-transitory and / or transitory media described above.
[0132] The steps in the data transmission method of any of the embodiments provided herein can be executed by the computer program stored in the storage medium, and thus the beneficial effects of the data transmission method of any of the embodiments provided herein can be achieved. For details, please refer to the foregoing embodiments, which will not be repeated here.
[0133] The specific implementation of the above operations can refer to the foregoing embodiments, which will not be repeated here.
[0134] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can refer to the detailed description of other embodiments above, which will not be repeated here.
[0135] The above describes in detail the data transmission method, system, computer device and storage medium provided by the present application. The specific examples are applied to the principle and implementation mode of the present application, and the above embodiment description is only used to help understand the method and core idea of the present application. Meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed, and the above description should not be understood as the limitation of the present application.
[0136] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described, however, as long as the combinations of the technical features do not exist contradictions, they should be considered as the scope of the present application.
Claims
1. A data transmission method, characterized by, The method comprises the following steps: performing first data transmission signal detection on the first communication channel to obtain a first data transmission detection result; if the first data transmission detection result indicates that the first communication channel has data symbol transmission, switching to the first communication channel and transmitting data through the first communication channel, and if the first data transmission detection result indicates that the first communication channel has no data symbol transmission, not switching to the first communication channel; performing second data transmission signal detection on the first communication channel to obtain a second data transmission detection result; if the second data transmission detection result meets a preset transmission condition, switching back to the second communication channel, and if the second data transmission detection result does not meet the preset transmission condition, not switching back to the second communication channel; the second data transmission signal detection on the first communication channel comprises the following steps: after switching to the first communication channel and transmitting data through the first communication channel, detecting the length of time without data transmission or the length of time with data transmission of the first communication channel; if the length of time without data transmission is not less than a first preset length of time and the received data is a target data unit, or the length of time with data transmission is not less than a second preset length of time, obtaining a second data transmission detection result indicating that the data transmission of the first communication channel meets the preset transmission condition; if the length of time without data transmission is less than the first preset length of time, and / or the received data does not reach a target data unit, and / or the length of time with data transmission is less than the second preset length of time, obtaining a second data transmission detection result indicating that the data transmission of the first communication channel does not meet the preset transmission condition.
2. The data transmission method of claim 1, wherein, the data transmission signal detection on the first communication channel comprises the following steps: detecting the level of the first communication channel signal; if the level of the first communication channel changes, obtaining a data transmission detection result indicating that the first communication channel has data symbol transmission; if the level of the first communication channel does not change, obtaining a data transmission detection result indicating that the first communication channel has no data symbol transmission.
3. The data transmission method of claim 2, wherein, if the level of the first communication channel changes, obtaining a data transmission detection result indicating that the first communication channel has data symbol transmission, which comprises the following steps: if the level of the first communication channel changes from high to low, obtaining a data transmission detection result indicating that the first communication channel has data symbol transmission.
4. The data transmission method of claim 1, wherein, The first byte of the data transmitted by the first communication channel is a preamble.
5. A data transmission system, characterized by The method comprises the following steps: a processor, a switching unit, a first communication unit, and a second communication unit; the processor is configured to perform first data transmission signal detection on the first communication channel to obtain a first data transmission detection result, and if the first data transmission detection result indicates that the first communication channel has data symbol transmission, switch to the first communication channel and transmit data through the first communication channel, and if the first data transmission detection result indicates that the first communication channel has no data symbol transmission, not switch to the first communication channel. The processor is further configured to perform second data transmission signal detection on the first communication channel to obtain a second data transmission detection result; if the second data transmission detection result meets a preset transmission condition, switching back to the second communication channel; if the second data transmission detection result does not meet the preset transmission condition, not switching back to the second communication channel. The processor is specifically configured to detect a data transmission duration or a data non-transmission duration of the first communication channel after switching to the first communication channel and transmitting data through the first communication channel. If the data non-transmission duration is not less than a first preset duration and the received data is a target data unit, or the data transmission duration is not less than a second preset duration, a second data transmission detection result is obtained, which indicates that the data transmission of the first communication channel meets the preset transmission condition. If the data non-transmission duration is less than the first preset duration, and / or the received data does not reach a target data unit, and / or the data transmission duration is less than the second preset duration, a second data transmission detection result is obtained, which indicates that the data transmission of the first communication channel does not meet the preset transmission condition.
6. The data transmission system of claim 5, wherein, The switching unit comprises an analog switch. The first communication end of the analog switch is electrically connected with the communication end of the processor, the second communication end of the analog switch is electrically connected with the communication end of the first communication unit, the third communication end of the analog switch is electrically connected with the communication end of the second communication unit, and the response end of the analog switch is electrically connected with the control end of the processor. The first state of the analog switch indicates that the first communication end of the analog switch is electrically connected with the second communication end of the analog switch, and the second state of the analog switch indicates that the first communication end of the analog switch is electrically connected with the third communication end of the analog switch.
7. A computer device, characterized by The memory stores a computer program, and the processor is configured to run the computer program in the memory to execute the steps in the data transmission method of any one of claims 1 to 4.
8. A storage medium, characterized by The storage medium stores a computer program, and the computer program is loaded by the processor to execute the steps in the data transmission method of any one of claims 1 to 4.
Citation Information
Patent Citations
Channel selection method and device, storage medium and electronic equipment
CN112770369A
Method for selecting at least one transmission channel, corresponding access point and corresponding computer program
WO2011058274A1