Data Transmission Method, Apparatus, Electronic Device, and Computer-Readable Storage Medium
By acquiring and comparing operation data in electronic devices, determining the target data type and generating the target heartbeat packet, the problem of high data transmission bandwidth occupancy of the heartbeat packet is solved and data transmission efficiency is improved.
Patent Information
- Application Number
- CN202211123578.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-15
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2042-09-15
AI Technical Summary
During the operation of electronic devices, when sending heartbeat packets periodically, more data is carried, resulting in a high data transmission bandwidth occupancy and affecting data transmission efficiency.
During each detection cycle, multiple different types of operation data of the electronic device are obtained and compared with the operation data of the previous detection cycle. The type to which the inconsistent operation data belongs is determined as the target data type, and the target heartbeat packet is generated based on the operation data in the target data type, and sent to the receiving device.
It avoids repeated uploads of unchanged running data in each detection cycle, reduces repeated uploads of invalid data, reduces the data transmission bandwidth occupied by sending heartbeat packets, and improves the efficiency of data transmission.
Smart Images

Figure CN115499347B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data transmission, and more particularly, to a data transmission method, apparatus, electronic device, and computer-readable storage medium. Background Art
[0002] During the operation of an electronic device, the electronic device may need to transmit heartbeat packets to other devices (such as a host computer).
[0003] Generally, the electronic device periodically sends heartbeat packets according to a preset fixed frequency. When the data carried in the heartbeat packet is relatively large, periodically sending heartbeat packets will occupy a relatively large data transmission bandwidth, affecting the data transmission efficiency of the electronic device for heartbeat packets. Summary of the Invention
[0004] To solve the above technical problems, embodiments of the present application provide a data transmission method, apparatus, electronic device, and computer-readable storage medium, which improve the data transmission efficiency.
[0005] Other features and advantages of the present application will become apparent through the following detailed description, or be learned in part through the practice of the present application.
[0006] According to one aspect of the embodiments of the present application, a data transmission method is provided. The method includes: in each detection period, obtaining various different types of operation data of the electronic device; respectively comparing each operation data with the operation data of the previous detection period; determining the type of the operation data with inconsistent comparison as the target data type; generating a target heartbeat packet according to the operation data corresponding to the target data type, and sending the target heartbeat packet to a preset receiving device.
[0007] According to one aspect of the embodiments of the present application, a data transmission apparatus is provided. The apparatus includes: an obtaining module configured to obtain various different types of operation data of the electronic device in each detection period; a comparison module configured to respectively compare each operation data with the operation data of the previous detection period; a determination module configured to determine the type of the operation data with inconsistent comparison as the target data type; a sending module configured to generate a target heartbeat packet according to the operation data corresponding to the target data type, and send the target heartbeat packet to a preset receiving device.
[0008] According to one aspect of the embodiments of the present application, an electronic device is provided, including: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, enabling the electronic device to implement the data transmission method as described above.
[0009] According to one aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer is enabled to execute the data transmission method as described above.
[0010] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above various alternative embodiments.
[0011] In the technical solution provided by the embodiments of the present application, the data transmission method of the present application can obtain various different types of operation data of an electronic device, and compare each piece of operation data with the operation data in the previous detection period. When it is detected that there is operation data with inconsistent comparison, the type to which the operation data with inconsistent comparison belongs is determined as the target data type, a target heartbeat packet is generated according to the operation data in the target data type, and the target heartbeat packet is sent to a receiving device. Thereby, the electronic device can avoid repeatedly uploading the unchanged operation data in each detection period, reduce the repeated upload of invalid data, reduce the data transmission bandwidth occupied by sending heartbeat packets, and improve the efficiency of data transmission.
[0012] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings here are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts. In the drawings:
[0014] Figure 1 is a schematic diagram of the implementation environment of the data transmission method shown in an exemplary embodiment;
[0015] Figure 2 is a flowchart of the data transmission method shown in an exemplary embodiment of the present application;
[0016] Figure 3 is a schematic diagram of the comparison of the effects of the amount of data transmitted in the data transmission method;
[0017] Figure 4 is a schematic flowchart of the overall solution of an exemplary data transmission method of the present application;
[0018] Figure 5 It is a block diagram schematic of a data transmission device shown in an exemplary embodiment of the present application;
[0019] Figure 6 It shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application. Detailed implementation manners
[0020] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0021] The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0022] The flowcharts shown in the drawings are only exemplary descriptions and do not necessarily include all contents and operations / steps, nor do they necessarily need to be executed in the described order. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined. Therefore, the actual execution order may change according to the actual situation.
[0023] The "plurality" mentioned in the present application refers to two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.
[0024] First of all, it should be noted that data transmission exists in all aspects. For example, an electronic device can report the operation data of each functional module to the host computer so that the host computer can determine the communication status and operation status of each functional module based on the reported operation data. In the related art, the electronic device usually uploads the heartbeat data in the heartbeat packet at a fixed frequency. Specifically, the electronic device will report the heartbeat packet generated from all the detected operation data in each detection period. However, in some scenarios, it is possible that some or all of the operation data detected in the current detection period has not changed compared with the corresponding operation data detected in the previous detection period, but the unchanged operation data is still transmitted to the receiving device, resulting in the problem of repeated uploading of invalid data.
[0025] Based on this, in order to avoid repeated uploading of invalid data and improve data transmission efficiency, the embodiments of the present application propose a data transmission method, device, electronic device, and computer-readable storage medium. Specifically, when it is determined that the operation data of various different types is inconsistent with the corresponding operation data in the previous detection period, the data type to which the inconsistent operation data belongs is determined as the target data type, and a target heartbeat packet is generated according to all the operation data corresponding to the target data type, and the target heartbeat packet is sent to the receiving device. Thereby, it is possible to avoid repeated uploading of the operation data that has not changed in each detection period, reduce the data transmission bandwidth occupied by sending the heartbeat packet, and improve the data transmission efficiency.
[0026] Figure 1 It is a schematic diagram of the implementation environment of the data transmission method shown in an exemplary embodiment. The implementation environment includes an electronic device 110 and a receiving device 120, and a wired or wireless network connection is established between the electronic device 110 and the receiving device 120 in advance.
[0027] As Figure 1 shown, during the data transmission process, the electronic device 110 detects various different types of operation data in each detection period, compares the detected operation data with the operation data in the previous detection period, and then generates a target heartbeat packet based on all the operation data belonging to the type with inconsistent comparison, and then sends the target heartbeat packet to the receiving device 120.
[0028] Figure 1The electronic device 110 shown may be a self - moving device or other devices that can perform operation data detection. The receiving device 120 may be any device that supports receiving operation data, such as a smart phone, in - vehicle computer, tablet computer, laptop computer, or wearable device, etc., but is not limited thereto. Exemplarily, the self - moving device may be a device with a self - moving assistance function. Among them, the self - moving assistance function may be implemented by an in - vehicle terminal, and the corresponding self - moving device may be a vehicle equipped with the in - vehicle terminal. The self - moving device may also be a semi - self - moving device or a fully autonomous moving device. For example, a lawn mower, a floor sweeper, a robot with navigation function, etc. The receiving device may also be a server. For example, it may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. There is no limitation here either. Figure 1 The electronic device 110 in Figure 1 can communicate with the receiving device 120 through wired communication methods such as Controller Area Network (CAN) bus, 3G (the third - generation mobile information technology), 4G (the fourth - generation mobile information technology), 5G (the fifth - generation mobile information technology), etc. and / or wireless communication methods. There is no limitation here either.
[0029] Exemplarily, if the electronic device 110 is a robot and the receiving device 120 is a smart phone, data transmission between the robot and the smart phone can be achieved through wireless communication methods such as Wi - Fi, Bluetooth, coaxial cable, etc. and / or wired communication methods.
[0030] Please refer to Figure 2 , Figure 2 which is a flowchart of the data transmission method shown in an exemplary embodiment of this application. This method can be applied to Figure 1 the implementation environment shown, and is specifically executed by the electronic device 110 in this implementation environment. It should be understood that this method can also be applicable to other exemplary implementation environments and be specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment applicable to this method.
[0031] Next, the data transmission method proposed in the embodiments of this application will be introduced in detail with the electronic device as the specific execution subject.
[0032] As Figure 2As shown, in an exemplary embodiment, the data transmission method at least includes steps S210 to S240, which are introduced in detail as follows:
[0033] Step S210, in each detection period, obtain various different types of operation data of the electronic device.
[0034] In step S210, the detection period refers to the time interval between two adjacent reported heartbeat packets.
[0035] The specific duration of the above detection period can be set according to actual needs. Specifically, in some implementations, the detection period can be a preset fixed value.
[0036] In some other embodiments, the size of the detection period can also be associated with the working state of the electronic device. Among them, considering that the electronic device includes a working state and an idle state, and all types of operation data in the electronic device may change in the working state, while mainly the operation data corresponding to the battery data type and the operation data corresponding to the common data type in the electronic device change in the idle state. Therefore, the detection period when the electronic device is in the working state can be set to be less than the detection period when the electronic device is in the idle state. It should be noted that the durations corresponding to each detection period can be the same or different. If the durations corresponding to each detection period are the same, the electronic device can detect operation data according to a certain regular frequency; if the durations corresponding to each detection period are different, the electronic device detects operation data at an irregular frequency.
[0037] The types to which the operation data in the electronic device belongs include one or more of data types such as common data type common_data, battery data type battery_data, electronic device working data type work_data, signal data type signal_data, and record data type record_data.
[0038] Exemplarily, assume that the size of the operation data corresponding to the common data type is 24 bytes, the size of the operation data corresponding to the battery data type is 31 bytes, the operation data corresponding to the electronic device working data type is 21 bytes, the operation data corresponding to the signal data type is 45 bytes, and the operation data corresponding to the record data type is 20 bytes. If the electronic device uploads all the detected operation data in each detection period, the total detected operation data is 141 bytes, totaling 0.13 KB.
[0039] It should be noted that the common data types refer to the data frequently used during data transmission or the data with a relatively high data transmission frequency. Exemplarily, in some embodiments, the running data corresponding to the common data types can be the resource occupancy data in the electronic device, the CPU usage rate data in the electronic device, or the memory usage rate data in the electronic device; in other embodiments, the running data corresponding to the common data types can also be the data used to determine the communication connection between the electronic device and the receiving device when there is no data change between the previous and subsequent detection cycles; in other embodiments, the common data types can also include the battery data type or the signal data type, which are generally the data with a relatively high transmission frequency when the electronic device is in the idle state or the working state; in other embodiments, the running data corresponding to the common data types can also be the data that changes between the previous and subsequent detection cycles, such as the change in the percentage of the remaining battery power, the change in the positioning signal state, etc., so that only by transmitting the running data corresponding to the common data types, the data transmission situation and the running situation of the self-mobile device in the idle state or the working state can be determined.
[0040] The above running data can be the battery power data of the battery type, the common data of the common data type, the RTK (Real-time kinematic) signal data of the signal type, etc.
[0041] In each detection cycle, the electronic device acquires different types of running data in the electronic device. Exemplarily, in one example, the electronic device can acquire the detected running data in each detection cycle and classify the detected running data to obtain the running data belonging to different types; in another example, the electronic device can also directly obtain the running data and the type to which the running data belongs from the corresponding functional module.
[0042] Step S220: Compare each piece of running data with the running data of the previous detection cycle respectively.
[0043] In step S220, the previous detection cycle refers to the previous detection cycle whose detection time is earlier than the current detection cycle. It should be noted that in some other possible implementation manners, the previous detection cycle can also be understood as the previous two or three detection cycles whose detection time is earlier than the current detection cycle. The embodiments of the present application do not limit this. Additionally, it should be noted that the current detection cycle refers to the detection cycle in which the electronic device is currently performing running data detection.
[0044] The purpose of the comparison is to determine whether there is a difference between the running data obtained in the current detection cycle and the corresponding running data in the previous detection cycle.
[0045] The electronic device compares the operation data in the current detection period with the corresponding operation data in the previous detection period. If the comparison result shows that the operation data in the current detection period is consistent with the corresponding operation data in the previous detection period, it indicates that the corresponding operation data has not changed in the two consecutive detection periods. If the comparison result shows that the operation data in the current detection period is inconsistent with the corresponding operation data in the previous detection period, then step S230 is executed.
[0046] Step S230: Determine the type of the operation data with inconsistent comparison as the target data type.
[0047] In step S230, the target data type refers to the type to which the operation data with inconsistent comparison belongs. Exemplarily, if the type to which the operation data with inconsistent comparison belongs is the battery data type, then the battery data type is determined as the target data type.
[0048] The electronic device determines the type of the operation data with inconsistent comparison as the target data type.
[0049] Step S240: Generate a target heartbeat packet based on the operation data corresponding to the target data type, and send the target heartbeat packet to a preset receiving device.
[0050] In step S240, the target heartbeat packet is generated based on the target heartbeat data, and the target heartbeat data refers to the operation data corresponding to the target data type. Exemplarily, if the target data type is the battery data type, then the battery data in the battery data type is the operation data and also the target heartbeat data at this time.
[0051] The electronic device generates a target heartbeat packet based on the operation data corresponding to the target data type, and sends the target heartbeat packet to the receiving device.
[0052] It should be noted that the type of the operation data determined by the electronic device to be inconsistent in comparison can be one or more types among the common data type common_data, the battery data type battery_data, the electronic device working data type work_data, the signal data type signal_data, and the record data type record_data. Compared with the related art where the heartbeat data is in a data structure and all the heartbeat data in the data structure needs to be uploaded when all the heartbeat data in the data structure is detected in each detection period, the method of the present application determines the type of the operation data that has changed in the previous and current detection periods as the target data type, and transmits the operation data corresponding to the target data type to the receiving device, effectively reducing the transmission of duplicate and invalid data and improving the data transmission efficiency.
[0053] Please continue to refer to Figure 3 ,Figure 3 A comparison chart of the data transfer volume between the data transfer method in the related art and the data transfer method of the present application is shown.
[0054] As an example, in the related art, all the running data is in a data structure, and the data size in the entire data structure is 109 bytes. When the electronic device communicates with the receiving device, the electronic device usually reports heartbeat data at a fixed frequency of 1HZ, so that the data size transmitted by the electronic device in one minute is 6540 bytes, totaling 6.38KB, and then the heartbeat data transmitted in one hour is 392400 bytes, totaling 383.2KB.
[0055] As another example, when the electronic device is in the working state, the main change in the running data of the electronic device is the change in battery information. The battery information changes from 100% to 60% within one hour. During this one hour, the running data in the common data type is reported 40 times, and the reported running data size is 960 bytes, totaling 0.93KB. The running data in the battery data type is reported 40 times, and the reported running data size is 1240 bytes, totaling 1.21KB. The running data in the working data type of the electronic device is reported once every 2 seconds, and is reported 1800 times within one hour. The reported running data size is 37800 bytes, totaling 36.9KB. The running data in the signal data type is actively reported once every 0.2HZ on average, and the reported data size is 30240 bytes, totaling 29.5KB. The running data in the record data type is actively reported once every 0.2HZ on average, and the reported data size is 14400 bytes, totaling 14.06KB. It can be seen that the average running data size transmitted by the electronic device in one minute in the working state is 1410 bytes, totaling 1.37KB, and a total of 84640 bytes are uploaded in one hour, totaling 82.6KB.
[0056] As another example, when the electronic device is in the idle state, the main change in the running data of the electronic device is the change in battery information. The battery information changes from 100% to 95% within one hour. During this one hour, the running data in the common data type is reported 5 times, and the reported running data size is 120 bytes, totaling 0.11KB. The running data in the battery data type is reported 5 times, and the reported running data size is 155 bytes, totaling 0.15KB. Other types do not change and are not reported when the electronic device is in the idle state. It can be seen that the average running data size transmitted by the electronic device in one minute in the idle state is 144 bytes, totaling 0.14KB, and a total of 8915 bytes are uploaded in one hour, totaling 8.7KB.
[0057] Based on the above examples, in the data transmission method of the related art, the amount of data transmitted per minute is 6.38 KB, and the amount of data transmitted per hour is 383.2 KB; when the electronic device in this application is in the working state, the amount of data transmitted per minute is 1.37 KB, and the amount of data transmitted per hour is 82.6 KB; when the electronic device in this application is in the idle state, the amount of data transmitted per minute is 0.14 KB, and the amount of data transmitted per hour is 8.7 KB.
[0058] Therefore, the data transmission method provided in this application can greatly reduce the transmission of duplicate and invalid data. For example, referring to the above examples, compared with the 6.38 KB of data transmitted per minute in the related art, the amount of data transmitted per minute by the electronic device in the working state of this application is 1.37 KB, and the 1.37 KB of data transmitted per minute by the electronic device in the working state of this application is only 21% of the 6.38 KB of the total data uploaded per minute in the related art.
[0059] For another example, compared with the 6.38 KB of data transmitted per minute in the related art, the amount of data transmitted per minute by the electronic device in the idle state of this application is 0.14 KB, and the 0.14 KB of data transmitted per minute by the electronic device in the idle state of this application is only 2% of the 6.38 KB of the total data uploaded per minute in the related art.
[0060] For another example, compared with the 383.2 KB of data transmitted per hour in the related art, the amount of data transmitted per hour by the electronic device in the working state of this application is 82.6 KB, and the 82.6 KB of data transmitted per hour by the electronic device in the working state of this application is only 21% of the 383.2 KB of the total data uploaded per hour in the related art.
[0061] For another example, compared with the 383.2 KB of data transmitted per hour in the related art, the amount of data transmitted per hour by the electronic device in the idle state of this application is 8.7 KB, and the 8.7 KB of data transmitted per hour by the electronic device in the idle state of this application is only 2% of the 383.2 KB of the total data uploaded per hour in the related art.
[0062] Based on the above embodiments, the process of step S220 comparing each operation data with the operation data of the previous detection period may further include: calculating the difference between each operation data and the operation data corresponding to the previous detection period, if the difference is greater than or equal to a preset first threshold, it is determined that the operation data is inconsistent with the operation data corresponding to the previous detection period; if the difference is less than the set first threshold, it is determined that the operation data is consistent with the operation data corresponding to the previous detection period.
[0063] Among them, the difference between the operation data in the current detection period and the operation data corresponding to the previous detection period is used to measure the difference in the size of the operation data corresponding to the operation data in the previous and current detection periods. Exemplarily, if the difference in the size of the operation data corresponding to the operation data in the previous and current detection periods is zero, it indicates that the operation data corresponding to the previous and current detection periods are equal; if the difference in the size of the operation data corresponding to the operation data in the previous and current detection periods is not zero, it indicates that the operation data corresponding to the previous and current detection periods are not equal.
[0064] It should be noted that considering the existence of data errors, in order to more accurately determine the operation data with inconsistencies, the embodiments of the present application set that an allowable error can occur in the difference in the size of the operation data corresponding to the operation data in the previous and current detection periods. That is to say, when the difference in the size of the operation data corresponding to the operation data in the previous and current detection periods is not zero, it can also be determined that the operation data corresponding to the previous and current detection periods are equal. At this time, the first threshold may not be set to zero, and the specific value of the first threshold can be set according to the actual situation of the error. The embodiments of the present application do not limit this.
[0065] In addition, it should be noted that in order to feedback to the receiving device that the communication connection between the receiving device and the electronic device is normal, when the electronic device in the embodiments of the present application determines that the operation data corresponding to the previous and current detection periods are consistent, it can send a basic heartbeat packet indicating that the communication between the electronic device and the receiving device is normal to the receiving device. The basic heartbeat packet at this time can include the operation data corresponding to common data types, or other operation data used to identify that the communication between the electronic device and the receiving device is normal.
[0066] Based on the above embodiments, considering that after the electronic device and the receiving device establish a communication connection for the first time, if the data transmission method in the above embodiments is directly adopted, the operation data of the previous detection period cannot be determined. Therefore, before the process of obtaining various different types of operation data of the electronic device in each detection period in step S210, the data transmission method of the embodiments of the present application further includes: after the electronic device and the receiving device establish a communication connection, obtaining various different types of operation data of the electronic device and sending various different types of operation data to the receiving device. Specifically, the electronic device can classify the first detected operation data to obtain different types of operation data and send the different types of operation data to the receiving device.
[0067] Based on the above embodiments, considering the situation where the receiving device actively queries the detection data, at this time, the receiving device can send a status query message to the electronic device. After receiving the status query message sent by the receiving device, the electronic device can send a basic heartbeat packet to the receiving device based on the status query message.
[0068] Among them, the status consultation information can be understood as a message for the receiving device to request the electronic device to send operation data.
[0069] The basic heartbeat packet data is determined based on the current status of the electronic device.
[0070] As an example, when the receiving device requests data and the electronic device is in the working state, the electronic device queries the corresponding operation data in the electronic device working data type according to the status consultation information sent by the receiving device, and feeds back the corresponding operation data in the queried electronic device working data type to the receiving device, so that the receiving device determines the current working state of the electronic device based on the operation data in the queried electronic device working data type.
[0071] As another example, when the receiving device requests data and the electronic device is in the idle state, the electronic device queries the corresponding operation data in the common data type according to the status consultation information sent by the receiving device, and feeds back the corresponding operation data in the queried common data type to the receiving device, so that the receiving device determines that the electronic device is in the idle state based on the corresponding operation data in the queried common data type.
[0072] As another example, when the receiving device requests data and the electronic device is in the charging state, the electronic device queries the corresponding operation data in the battery data type according to the status consultation information sent by the receiving device, and feeds back the corresponding operation data in the queried battery data type to the receiving device, so that the receiving device displays the charging information based on the corresponding operation data in the queried battery data type.
[0073] In other examples, the receiving device can also request other types of operation data, and the specifically requested operation data can be determined based on the status consultation information. In other words, the receiving device can carry the data type required to be requested in the status consultation information sent to the electronic device to instruct the electronic device to feedback the heartbeat packet carrying the operation data of the corresponding data type.
[0074] Please continue to refer to Figure 4 , Figure 4 which is a schematic flow chart of the overall solution of an exemplary data transmission method of this application. In the exemplary embodiment, the electronic device is a robot, the receiving device is a smart phone, and the robot and the smart phone are connected by means of a wireless network and / or a wired network, etc.
[0075] First, when the robot and the smartphone first establish a communication connection, the robot transmits all types of operation data detected during the current detection period to the smartphone; the robot detects the operation data according to the detection period, compares the operation data in the current detection period with the corresponding operation data in the previous detection period, determines the type of operation data with inconsistent comparison as the target data type, and transmits all the operation data in the target data type to the smartphone.
[0076] Further, during the detection process, the smartphone can also actively request operation data from the robot. Specifically, in response to the user's data request operation on the smartphone, the smartphone sends a status consultation message to the robot, and the robot receives the status consultation message sent by the smartphone and feeds back a basic heartbeat packet to the smartphone according to the robot's status.
[0077] Figure 5 It is a block diagram schematic of a data transmission device shown in an exemplary embodiment of the present application. This data transmission device can be applied to Figure 1 the shown implementation environment. This data transmission device can also be applicable to other exemplary implementation environments and is specifically configured in other devices. This embodiment does not limit the implementation environment applicable to this device.
[0078] As Figure 5 shown, the exemplary data transmission device 500 includes: an acquisition module 510, a comparison module 520, a determination module 530, and a sending module 540. Specifically:
[0079] The acquisition module 510 is configured to acquire various different types of operation data of the electronic device in each detection period.
[0080] The comparison module 520 is configured to compare each operation data with the operation data in the previous detection period respectively.
[0081] The determination module 530 is configured to determine the type to which the operation data with inconsistent comparison belongs as the target data type.
[0082] The sending module 540 is configured to generate a target heartbeat packet according to the corresponding operation data in the target data type and send the target heartbeat packet to a preset receiving device.
[0083] In this exemplary data transmission device, when it is determined that the operation data of various different types is inconsistent with the corresponding operation data in the previous detection period, a heartbeat packet is generated according to all the operation data in the data type to which the inconsistent operation data belongs, and the target heartbeat packet is sent to the receiving device, thereby avoiding the repeated upload of the heartbeat packets generated by the unchanged operation data in each detection period, reducing the repeated upload of invalid data, and improving the data transmission efficiency.
[0084] Based on the above exemplary embodiments, the data transmission device 500 further includes: an association module. Specifically:
[0085] The association module is configured such that the size of the detection period is associated with the operating state of the electronic device.
[0086] Based on the above exemplary embodiments, the data transmission device 500 further includes: a detection period setting module. Specifically:
[0087] The detection period setting module is configured such that the detection period of the electronic device in the operating state is less than the detection period in the idle state.
[0088] Based on the above exemplary embodiments, the comparison module 520 further includes: a calculation module, a first determination module, and a second determination module. Specifically:
[0089] The calculation module is configured to calculate the difference between the operation data and the operation data obtained in the previous detection period.
[0090] The first determination module is configured to determine that the operation data is inconsistent with the operation data obtained in the previous detection period if the difference is greater than or equal to a preset first threshold.
[0091] The second determination module is configured to determine that the operation data is consistent with the operation data obtained in the previous detection period if the difference is less than the preset first threshold.
[0092] Based on the above exemplary embodiments, before the acquisition module 510, the data transmission device 500 further includes: a multi-type operation data acquisition module. Specifically:
[0093] The multi-type operation data acquisition module is configured to acquire various different types of operation data of the electronic device after establishing a communication connection between the electronic device and the receiving device, and send the various different types of operation data to the receiving device.
[0094] Based on the above exemplary embodiments, after the determination module 530, the data transmission device 500 further includes: a first basic heartbeat packet sending type. Specifically:
[0095] The first basic heartbeat packet sending module is configured to send a basic heartbeat packet to the receiving device if the target data type is not detected.
[0096] Based on the above exemplary embodiments, after the determination module 530, the data transmission device 500 further includes: a second basic heartbeat packet sending type. Specifically:
[0097] The second basic heartbeat packet sending module is configured to send a basic heartbeat packet to the receiving device when receiving the status query information sent by the receiving device.
[0098] It should be noted that the data transmission device provided in the above embodiments and the data transmission method provided in the above embodiments belong to the same concept. The specific manners in which each module and unit perform operations have been described in detail in the method embodiments and will not be elaborated here. In practical applications, the data transmission device provided in the above embodiments may, according to needs, allocate the above functions to different functional modules, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above. This is not limited herein either.
[0099] An embodiment of the present application further provides an electronic device, including: one or more processors; a storage device for storing one or more programs, which, when executed by the one or more processors, cause the electronic device to implement the data transmission methods provided in the above various embodiments.
[0100] Figure 6 FIG. shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application. It should be noted that, Figure 6 the shown computer system 600 of the electronic device is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present application.
[0101] As Figure 6 shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage section 608 into the random access memory (RAM) 603, such as executing the data transmission method described in the above embodiments. In the RAM 603, various programs and data required for system operations are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.
[0102] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as required. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as required so that a computer program read therefrom is installed into the storage section 608 as required.
[0103] Specifically, according to an embodiment of the present application, the processes described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 605, and / or installed from the removable medium 611. When the computer program is executed by a central processing unit (CPU) 601, various functions defined in the system of the present application are executed.
[0104] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, which carries a computer-readable computer program. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also 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 computer program contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0105] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. Among them, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0106] The units involved in the embodiments described in this application can be implemented in software or in hardware, and the described units can also be provided in a processor. Among them, the names of these units do not constitute a limitation on the units themselves in certain cases.
[0107] Another aspect of this application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the flash read / write method as described above. The computer-readable storage medium can be included in the electronic device described in the above embodiments, or can exist alone without being assembled into the electronic device.
[0108] Another aspect of this application also provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the flash read / write method provided in each of the above embodiments.
[0109] The above content is only a preferred exemplary embodiment of this application and is not used to limit the implementation of this application. Those of ordinary skill in the art can easily make corresponding adaptations or modifications according to the main concept and spirit of this application. Therefore, the protection scope of this application should be subject to the protection scope required by the claims.
Claims
1. A data transmission method, applied to an electronic device, characterized in that, The method includes: In each detection period, obtaining various different types of operation data of the electronic device; Respectively comparing each piece of the operation data with the operation data of the previous detection period; Determining the type of the operation data with inconsistent comparison as the target data type; Generating a target heartbeat packet according to the operation data corresponding to the target data type, and sending the target heartbeat packet to a preset receiving device; If the target data type is not detected, sending a basic heartbeat packet to the receiving device, where the basic heartbeat packet contains data for determining that there is a communication connection between the electronic device and the receiving device.
2. The method according to claim 1, characterized in that, The size of the detection period is associated with the working state of the electronic device.
3. The method according to claim 2, characterized in that, The electronic device includes a working state and an idle state; the detection period of the electronic device in the working state is less than that in the idle state.
4. The method as claimed in claim 1, characterized in that, The step of respectively comparing each piece of the operation data with the operation data of the previous detection period includes: for each piece of operation data, Calculating the difference between the operation data and the operation data obtained in the previous detection period; If the difference is greater than or equal to a preset first threshold, determining that the operation data is inconsistent with the operation data obtained in the previous detection period; If the difference is less than the preset first threshold, determining that the operation data is consistent with the operation data obtained in the previous detection period.
5. The method as claimed in claim 1, characterized in that, Before the step of obtaining various different types of operation data of the electronic device in each detection period, the method further includes: After establishing a communication connection between the electronic device and the receiving device, obtaining various different types of operation data of the electronic device, and sending various pieces of the different types of operation data to the receiving device.
6. The method according to any one of claims 1 - 4, after determining the type of the running data with inconsistent comparison as the target data type, further comprising: When receiving status inquiry information sent by the receiving device, sending a basic heartbeat packet to the receiving device.
7. A data transmission device, characterized in that, The apparatus includes: An obtaining module, configured to obtain various different types of operation data of an electronic device in each detection period; A comparison module, configured to respectively compare each piece of the operation data with the operation data of the previous detection period; A determination module, configured to determine the type of the operation data with inconsistent comparison as the target data type; A sending module, configured to generate a target heartbeat packet according to the operation data corresponding to the target data type, and send the target heartbeat packet to a preset receiving device; if the target data type is not detected, sending a basic heartbeat packet to the receiving device, where the basic heartbeat packet contains data for determining that there is a communication connection between the electronic device and the receiving device.
8. An electronic device, characterized in that, Includes: One or more processors; A storage device for storing one or more programs, which when executed by the one or more processors, cause the electronic device to implement the data transmission method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, A computer-readable instruction is stored thereon, which when executed by a processor of a computer, causes the computer to execute the data transmission method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Information interaction method and device, robot and storage medium
CN110572315A
Household appliance data extraction method and device, equipment and storage medium
CN113282652A
Robot real-time operation data processing method and device, server and medium
CN114490775A