Data transmission method, device and electronic equipment
By obtaining the quality of communication links between electronic devices and dynamically determining the transmission channel and capacity, the problem of slow data transmission among contacts between electronic devices is solved, and more efficient data transmission is achieved.
Patent Information
- Application Number
- CN202411987972.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, the data transmission speed of contact persons between electronic devices is slow, mainly due to the dependence of a fixed transmission mode.
By acquiring the quality of the communication link between the first electronic device and the second electronic device, the transmission channel and transmission capacity are dynamically determined, and the contact data is encapsulated and transmitted according to the selected transmission capacity.
Select appropriate transmission channels and capacity according to the quality of the communication link, make full use of network resources, and improve the speed and efficiency of data transmission.
Smart Images

Figure CN119789228A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and specifically relates to a data transmission method, device and electronic equipment. Background Art
[0002] With the development of communication technology, interconnection between electronic devices has become more common. In order to share communication functions such as calls and text messages between different electronic devices, or to share information between different electronic devices, it is often necessary to transmit contact data between different electronic devices.
[0003] However, in the related art, data transmission between electronic devices usually relies on a fixed transmission mode, which may result in a slow transmission speed of contact data. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a data transmission method, device and electronic device, which can solve the technical problem of slow transmission speed of existing contact data.
[0005] In a first aspect, an embodiment of the present application provides a data transmission method, the method comprising:
[0006] Acquiring the quality of the communication link between the first electronic device and the second electronic device;
[0007] Determine a transmission channel and a transmission capacity according to the communication link quality;
[0008] Encapsulating the contact data to be transmitted according to the transmission capacity to obtain a data set;
[0009] The data set is sent to the second electronic device through the transmission channel.
[0010] In a second aspect, an embodiment of the present application provides a data transmission device, the device comprising:
[0011] A first acquisition module, used to acquire the quality of the communication link between the first electronic device and the second electronic device;
[0012] A first determination module, configured to determine a transmission channel and a transmission capacity according to the communication link quality;
[0013] A packaging module, used for packaging the contact data to be transmitted according to the transmission capacity to obtain a data set;
[0014] A sending module is used to send the data set to the second electronic device through the transmission channel.
[0015] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method provided in the first aspect are implemented.
[0016] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method provided in the first aspect are implemented.
[0017] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method provided in the first aspect.
[0018] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method provided in the first aspect.
[0019] In the data transmission method, device and electronic device of the present application, the quality of the communication link between electronic devices can be obtained; and the transmission channel and transmission capacity can be determined according to the quality of the communication link; then the data can be encapsulated according to the selected transmission capacity, and the encapsulated data can be transmitted through the selected transmission channel. In this way, the transmission channel can be selected according to the quality of the communication link to ensure that the transmission process uses a better network channel. At the same time, the transmission capacity is determined according to the quality of the communication link, and the maximum carrying capacity of the transmission channel is fully utilized, thereby increasing the speed of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flowchart of a data transmission method provided by an embodiment of the present application;
[0021] Figure 2 is a schematic diagram of an interface of a second electronic device provided by an embodiment of the present application;
[0022] Figure 3 is a schematic diagram of an interface of a second electronic device provided by another embodiment of the present application;
[0023] Figure 4 is a structural schematic diagram of a data transmission device provided by another embodiment of the present application;
[0024] Figure 5 is a structural schematic diagram of an electronic device provided by another embodiment of the present application;
[0025] Figure 6 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0027] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0028] In order to solve the above technical problems, the present application provides a data transmission method. The data transmission method provided by the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.
[0029] like Figure 1 As shown, Figure 1 : is a flow chart of a data transmission method provided by an embodiment of the present application. The embodiment of the present application provides a data transmission method, which is applied to a first electronic device. The method may include:
[0030] S101, obtaining a communication link quality between a first electronic device and a second electronic device;
[0031] In this embodiment, the first electronic device may be a device with independent communication capabilities, such as a mobile phone with a SIM card, which stores contact data and has a communication sharing function. The second electronic device does not have independent communication capabilities and needs to rely on the communication sharing function of the first electronic device to realize communication functions such as phone calls or text messages, such as a Pad.
[0032] In the process of the second electronic device relying on the first electronic device for communication sharing, the first electronic device needs to transfer the contact data stored therein to the second electronic device. In addition, before the data transmission, the first electronic device will detect the quality of the communication link between the first electronic device and the second electronic device. The quality of the communication link may include signal strength, bandwidth and stability. Based on the detected quality of the communication link, it can be evaluated whether the current network is suitable for efficient transmission.
[0033] S102, determining a transmission channel and a transmission capacity according to the communication link quality;
[0034] In this embodiment, after the first electronic device detects the quality of the communication link, it can dynamically select a transmission channel for the contact data according to the quality of the communication link. Different transmission channels correspond to different single transmission capacities, which can ensure transmission efficiency and reliability.
[0035] For example, parameters such as signal strength, transmission delay, and packet loss rate between different transmission channels can be detected, and the communication link quality of each transmission channel can be determined based on the above parameters, where the transmission channel can include a P2P (Peer-to-Peer) channel and a Bluetooth channel. If the communication link quality of the P2P channel is good, a high-bandwidth P2P channel can be selected, and the corresponding transmission capacity can be set to 800KB. If the communication link quality of the P2P channel is poor, and the communication link quality of the Bluetooth channel is good, it can be switched to the Bluetooth channel, and the corresponding transmission capacity is set to 50KB.
[0036] S103: Encapsulate the contact data to be transmitted according to the transmission capacity to obtain a data set.
[0037] In the embodiment of the present application, after the transmission channel and the transmission capacity are determined, the contact data in the first electronic device can be dynamically packaged into one or more data sets according to the selected transmission capacity. During the packaging process, each contact data can be added to the data set in turn until the capacity of the data set just reaches the transmission capacity.
[0038] Specifically, in some embodiments, encapsulating the contact data to be transmitted according to the transmission capacity to obtain a data set includes:
[0039] Get the initialized byte array;
[0040] Encapsulating the contact data into the byte array one by one according to the arrangement order of the contact data;
[0041] Until the amount of data accumulated in the byte array reaches the transmission capacity, stop encapsulating the contact data into the byte array to obtain the data set.
[0042] In this embodiment, during the encapsulation process of the contact data, the system may first initialize an empty byte array as a storage container, and then convert each piece of contact data into a byte stream according to the arrangement order of the contact data in the first electronic device, and write them into the byte array one by one.
[0043] At the same time, after each contact data is written into the byte array, the system will dynamically calculate the amount of data accumulated in the current byte array. If the total amount of data in the byte array does not exceed the transmission capacity after adding new contact data, the encapsulation will continue; once the transmission capacity is reached, the encapsulation will stop and the byte array will be sent as a complete data set.
[0044] In this embodiment, the size of each data set can be controlled by dynamically encapsulating each data set one by one, ensuring that the data set can adapt to the capacity requirements of different transmission channels, thereby achieving fast and stable data transmission.
[0045] In some embodiments, before encapsulating the contact data into the byte array one by one according to the arrangement order of the contact data, the method further includes:
[0046] Obtaining version information, sending time and data type of the byte array;
[0047] Generate a metadata header according to the version information, the sending time and the data type;
[0048] Add the metadata header to the byte array.
[0049] In this embodiment, after obtaining the initialized byte array, before encapsulating the contact data into the byte array one by one, the system can first obtain the basic description information of the entire byte array, including version information, sending time, and data type. A metadata header is generated based on this information as the descriptive part of the collection. Among them, the version information is used to identify the format or protocol version of the data collection, the sending time is the estimated sending time of the data collection, and the data type is used to characterize the type of contact data.
[0050] After the metadata header is generated, it will be written to the head of the byte array first to ensure that it is the starting content of the data set and provide guidance for the receiving end to parse the data set. After the metadata header is added, the system will encapsulate the contact data one by one according to the order in which the contact data is arranged.
[0051] In this way, the format of the data collection can be ensured to be standardized, and it is also convenient for the receiving end to efficiently parse and process the specific content in the collection.
[0052] In some embodiments, encapsulating the contact data into the byte array one by one includes:
[0053] For any piece of contact data, obtain the contact identifier and contact information corresponding to the contact data;
[0054] Determine the data length of the contact information;
[0055] The contact identifier, the data length and the contact information are converted into byte streams in sequence and written into the byte array in order to complete the encapsulation of the contact data.
[0056] In this embodiment, during the packaging process of the contact data, for each piece of contact data, the corresponding contact identifier (contact_id) can be determined based on the arrangement order of the contact data, and the contact information of the contact can be extracted. The contact information may include the name, phone number, and email address of the contact.
[0057] After extracting the contact information of the contact, the size of the contact information in the byte stream can be calculated based on the extracted contact information to obtain the data length (data_length). Then, the contact identifier, data length and contact information are converted into byte streams in sequence, and the byte streams are written into the byte array in sequence to ensure that the contact data of the same contact can be compactly arranged in the byte array to complete the encapsulation of the contact data.
[0058] This encapsulation method can significantly improve data transmission efficiency by converting the contact ID, data length and contact information into a compact byte stream and writing it into a byte array in sequence. At the same time, it ensures that the data format is clear, making it easier for the receiving end to quickly parse and accurately process each contact data.
[0059] S104: Send the data set to the second electronic device through the transmission channel.
[0060] In the present application, after the data set is packaged, the first electronic device can send the data set to the second electronic device through the currently selected transmission channel. In addition, during the transmission process, if the network conditions change, the system can dynamically switch the transmission channel based on the real-time communication link quality and continue to send the unfinished data to ensure that the data transmission is not interrupted.
[0061] In the embodiment of the present application, the quality of the communication link between electronic devices can be obtained; and the transmission channel and transmission capacity can be determined based on the quality of the communication link; then data can be encapsulated according to the selected transmission capacity, and the encapsulated data can be transmitted through the selected transmission channel. In this way, the transmission channel can be selected according to the quality of the communication link to ensure that the transmission process uses a better network channel. At the same time, the transmission capacity is determined based on the quality of the communication link, and the maximum carrying capacity of the transmission channel is fully utilized, thereby increasing the speed of data transmission.
[0062] In some embodiments, after sending the data set to the second electronic device through the transmission channel, the method further includes:
[0063] After the network between the first electronic device and the second electronic device is disconnected and reconnected, obtaining a resume transmission instruction sent by the second electronic device;
[0064] Parsing the resume instruction to obtain a first import time and a first contact identifier, wherein the first contact identifier is a contact identifier of the first contact data, the first import time is an import time of the first contact data, and the first contact data is the last successfully imported contact data before the network is interrupted;
[0065] Starting from the contact data next to the first contact data, the contact data continues to be sent to the second electronic device.
[0066] In this embodiment, when the network between the first electronic device and the second electronic device is interrupted and reconnected, the first electronic device receives a resume instruction from the second electronic device, which is used to instruct to continue transmitting contact data to the second electronic device, and the resume instruction includes relevant information of the contact data successfully imported last time.
[0067] Specifically, the first electronic device parses the retransmission instruction, determines the contact information of the last contact data successfully imported before the network interruption, that is, the first import time and the first contact identifier, and based on the first import time and the first contact identifier, the first electronic device can determine the last first contact data successfully imported before the network interruption. It can also determine the next contact data of the first contact data, and then start packaging from the next contact data of the first contact data, and continue to transmit the unfinished contact data to the second electronic device.
[0068] In this way, the untransmitted data can be accurately located and the transmission can be continued from the interruption point, avoiding repeated transmission of completed data, which greatly improves the transmission efficiency.
[0069] In addition, an embodiment of the present application provides another data transmission method, which is applied to a second electronic device and may include:
[0070] receiving a data set sent by the first electronic device, wherein a transmission capacity of the data set is determined based on a quality of a communication link between the first electronic device and the second electronic device;
[0071] Parsing the data set to obtain contact data;
[0072] The contact data are imported into the second electronic device in batches, wherein the contact data in one data set belong to the same batch.
[0073] In this embodiment, the second electronic device is the receiving end of the contact data. The second electronic device receives a data set sent from the first electronic device. The transmission capacity of the data set is dynamically adjusted according to the quality of the communication link between the two devices. Specifically, when the quality of the communication link is better, the transmission capacity is larger and the transmission efficiency is higher.
[0074] After receiving the data set, the received data set is parsed step by step to extract the contact data in the set, and the parsed contact data is imported into the second electronic device in batches, wherein all the contact data in a data set are regarded as the same batch.
[0075] The above-mentioned method of importing contact data in batches simplifies the import process, improves the efficiency of data import, and ensures the integrity of the data.
[0076] In some embodiments, parsing the data set to obtain contact data includes:
[0077] Obtaining a metadata header of the data set;
[0078] Parsing the metadata header to obtain version information, sending time and data type of the data set;
[0079] Determine a target parsing method according to the version information, the sending time and the data type;
[0080] The data set is parsed according to the target parsing method to obtain the contact data in the data set.
[0081] In this embodiment, since the metadata header is located at the beginning of the data set and is used to describe the overall information of the set, after the metadata header, multiple contact data are arranged in sequence. Then, after the second electronic device receives the data set, it can extract the metadata header from the head of the data set, and then parse the metadata header to obtain the version information, sending time and data type of the data set.
[0082] And according to the parsed version information and data type, a suitable target parsing method can be selected to correctly parse the contact data in the data set. Finally, the contact data can be extracted one by one from the data set according to the determined target parsing method.
[0083] In the above method, the parsing method of the contact data can be dynamically adjusted by parsing the result of the metadata header to dynamically adapt to different versions of the data set format, thereby ensuring the compatibility and accuracy of the parsing.
[0084] In some embodiments, parsing the data set according to the target parsing method to obtain the contact data in the data set includes:
[0085] Obtaining any contact identifier in the data set;
[0086] Obtaining the data length from the length flag corresponding to the contact identifier;
[0087] Extracting contact information corresponding to the data length from the data set;
[0088] The contact information is parsed to obtain contact data corresponding to the contact identifier.
[0089] In this embodiment, when parsing any contact data by target parsing, the unique contact identifier (contact_id) of the contact data can be first extracted, and the contact identifier is used to mark the ownership of the contact data. After obtaining the contact identifier, the length flag (data_length) corresponding to the contact data can be found according to the contact identifier. The flag stores the data length of the contact information of the contact, and the data boundary of the contact data can be determined by the data length.
[0090] Subsequently, the data length obtained from the length flag can be used to extract the byte stream after the length flag in the data set according to the data length, and the extracted byte stream can be parsed and converted into readable contact information corresponding to the contact identifier, which may include information such as the contact's name and phone number.
[0091] In this way, by obtaining the contact ID and data length, the contact information of each contact data can be accurately located and extracted, avoiding data confusion during the parsing process and improving the efficiency of data import.
[0092] In some embodiments, after parsing the data set to obtain the contact data, the method further includes:
[0093] Obtaining a first contact identifier of a first contact data in the first batch of contact data, wherein the first contact data is the last contact data in the first batch, and the first batch is any batch of contact data;
[0094] generating an import progress prompt according to the first contact identifier;
[0095] importing the first batch of contact data into the second electronic device;
[0096] During the import process of the first batch of contact data, the import progress prompt is displayed.
[0097] In this embodiment, since the contact data is imported in batches, taking the first batch of contact data as an example, after the first batch of contact data is parsed, the first contact identifier of the last contact data in the first batch of contact data is determined, and the first contact identifier is used to mark the overall import progress of the first batch.
[0098] Then, the percentage of the import progress can be calculated based on the position of the first batch of contact data in all contact data, and an import progress prompt can be generated according to the first contact identifier and the percentage. Then, during the import of the first batch of contact data, the import progress prompt is dynamically displayed so that the user can check the import status of the data at any time.
[0099] For example Figure 2 As shown, the first electronic device is a mobile phone, and the second electronic device is a tablet computer. During the import process, the tablet computer may display an import progress prompt 201, which may be a text message "Importing XXX from mobile phone, 50%".
[0100] This method can generate and display an import progress prompt to prompt the user of the current import status in an intuitive form.
[0101] In some embodiments, after importing the first batch of contact data into the second electronic device, the method further includes:
[0102] In the event that import of contact data in the first batch fails, all contact data in the first batch are re-imported.
[0103] In this embodiment, since the contact data is imported in batches, that is, multiple contact data in the same batch are packaged for import processing. Then, if any contact data fails to be imported during the import of the first batch of contact data, the system will retry to import all contact data in the batch instead of only importing the failed contact data. Compared with importing contact data one by one, batch import reduces the frequency of calling the storage system, greatly reducing system overhead and network communication costs.
[0104] In the above solution, by re-importing the entire batch of data, the error handling logic is simplified and the complexity of item-by-item verification and re-transmission is avoided.
[0105] In some embodiments, after importing the contact data into the second electronic device in batches, the method further includes:
[0106] If there is no failure in importing the contact data in the first batch, obtaining the first contact identifier and the import time of the first contact data;
[0107] Generate import information according to the first contact identifier and the import time;
[0108] The imported information is stored.
[0109] In this embodiment, when all the contact data of the first batch are successfully imported, the system will record the first contact ID of the last contact data in the batch and the import time when the import is completed. Then, import information can be generated based on the first contact ID and the import time, and stored for subsequent data transmission status tracking and breakpoint resumption.
[0110] Then, by recording the import information, the system can accurately locate the data that has been successfully imported, avoiding repeated operations in subsequent transmissions, thereby improving efficiency. In addition, this method provides a basis for breakpoint resumption, ensuring that progress can be quickly resumed after a transmission interruption, reducing resource waste and improving data integrity.
[0111] In some embodiments, after storing the import information, the method further includes:
[0112] After the network between the first electronic device and the second electronic device is disconnected and reconnected, generating and displaying a first control;
[0113] In case of receiving a first input to the first control, in response to the first input, obtaining the most recently generated import information, wherein the first input is used to instruct to continue transmitting the unfinished contact data from the location where the network was last interrupted;
[0114] Generate a resume instruction according to the first contact identifier and the first import time in the import information;
[0115] The resume transmission instruction is sent to the first electronic device, so that the first electronic device continues to send contact data starting from the next contact data of the first contact data corresponding to the first contact identifier and the first import time.
[0116] In this embodiment, when the contact data is not completely transmitted and the network between the first electronic device and the second electronic device is disconnected, the transmission of the contact data is correspondingly interrupted. Then, after the network is reconnected, the system can generate and display a first control on the second electronic device. The first control is used to prompt the user to choose to continue transmitting the unfinished data from the interrupted position.
[0117] like Figure 3 As shown, the first electronic device is a mobile phone, and the second electronic device is a tablet computer. When the contact data is not transmitted, and the network between the first electronic device and the second electronic device is disconnected and reconnected, a text message "The last time the contacts were imported from the mobile phone, an interruption occurred. M contacts were detected and can be imported. Do you want to continue importing?" is displayed on the second electronic device, and a first control 301 "Agree button" and a second control 302 "Reject button" are displayed. If the user makes a first input to the first control, it means that the user agrees to continue to transmit the unfinished data from the interrupted position. If the user makes an input to the second control, it means that the user does not want to continue to transmit the data temporarily.
[0118] When the user performs the first input on the first control, it means that the user wants to continue transferring the unfinished data from the interrupted position. Then, when the user performs the first input on the first control, the system can obtain the most recently generated import information, which includes the first contact identifier and the first import time of the last successful import. This information records the specific location of the last batch of contact data that was transferred.
[0119] Then, a resume instruction can be generated according to the first contact identifier and the first import time, and the resume instruction is used to instruct to resume the transmission from the next contact data of the first contact data that was successfully imported last. Subsequently, the second electronic device sends the resume instruction to the first electronic device, and the first electronic device repackages the unfinished contact data from the interruption position and continues to send it, completing the breakpoint resume.
[0120] In this way, since the import progress is recorded in the import information, after the network is interrupted and reconnected, a resume instruction can be generated according to the recorded import information, thereby achieving accurate breakpoint resume, avoiding repeated data transmission, and improving data transmission efficiency.
[0121] Figure 4 is a schematic diagram of the structure of a data transmission device provided by another embodiment of the present application, such as Figure 4 As shown, the data transmission device may include:
[0122] A first acquisition module 401 is used to acquire the quality of a communication link between a first electronic device and a second electronic device;
[0123] A first determination module 402, configured to determine a transmission channel and a transmission capacity according to the communication link quality;
[0124] The encapsulation module 403 is used to encapsulate the contact data to be transmitted according to the transmission capacity to obtain a data set;
[0125] The sending module 404 is used to send the data set to the second electronic device through the transmission channel.
[0126] In this application, the quality of the communication link between electronic devices can be obtained; and the transmission channel and transmission capacity can be determined based on the quality of the communication link; then the data can be encapsulated according to the selected transmission capacity, and the encapsulated data can be transmitted through the selected transmission channel. In this way, the transmission channel can be selected according to the quality of the communication link to ensure that the transmission process uses a better network channel. At the same time, the transmission capacity is determined based on the quality of the communication link, and the maximum carrying capacity of the transmission channel is fully utilized, thereby increasing the speed of data transmission.
[0127] In another optional example, the encapsulation module 403 includes:
[0128] A first acquisition unit, used for acquiring an initialized byte array;
[0129] An encapsulation unit, configured to encapsulate the contact data one by one into the byte array according to the arrangement order of the contact data;
[0130] The stopping unit is used to stop encapsulating the contact data into the byte array until the amount of data accumulated in the byte array reaches the transmission capacity to obtain the data set.
[0131] In another optional example, the data transmission device further includes:
[0132] A second acquisition module is used to acquire version information, sending time and data type of the byte array;
[0133] A first generating module, used to generate a metadata header according to the version information, sending time and data type;
[0134] An adding module is used to add the metadata header to the byte array.
[0135] In another optional example, the encapsulation unit further includes:
[0136] A first acquisition subunit is used to acquire, for any piece of contact data, a contact identifier and contact information corresponding to the contact data;
[0137] A first determining subunit, used to determine the data length of the contact information;
[0138] The conversion subunit is used to convert the contact identifier, the data length and the contact information into byte streams in sequence and write them into the byte array in order to complete the encapsulation of the contact data.
[0139] In another optional example, the data transmission device further includes:
[0140] A third acquisition module, configured to acquire a resume transmission instruction sent by the second electronic device after the network between the first electronic device and the second electronic device is disconnected and reconnected;
[0141] A first parsing module, configured to parse the resume instruction to obtain a first import time and a first contact identifier, wherein the first contact identifier is a contact identifier of first contact data, the first import time is an import time of the first contact data, and the first contact data is the last successfully imported contact data before the network is interrupted;
[0142] The retransmission module is used to continue sending the contact data to the second electronic device starting from the next contact data of the first contact data.
[0143] The data transmission device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than the terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.
[0144] The data transmission device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0145] The data transmission device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0146] Alternatively, if Figure 5 As shown, an embodiment of the present application also provides an electronic device 100, including a processor 110, a memory 119, and a program or instruction stored in the memory 119 and executable on the processor 110. When the program or instruction is executed by the processor 110, each process of the above-mentioned data transmission method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0147] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0148] Please refer to Figure 6 , Figure 6 The hardware structure diagram of an electronic device for implementing an embodiment of the present application is shown in FIG. The electronic device 100 includes, but is not limited to, a radio frequency unit 121, a network module 122, an audio output unit 123, an input unit 124, a sensor 125, a display unit 126, a user input unit 127, an interface unit 128, a memory 129, and a processor 120.
[0149] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 120 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0150] The processor 120 is configured to obtain the quality of the communication link between the first electronic device and the second electronic device;
[0151] The processor 120 is configured to determine a transmission channel and a transmission capacity according to the communication link quality;
[0152] The processor 120 is configured to encapsulate the contact data to be transmitted according to the transmission capacity to obtain a data set;
[0153] The network module 122 is used to send the data set to the second electronic device through the transmission channel.
[0154] In this application, the quality of the communication link between electronic devices can be obtained; and the transmission channel and transmission capacity can be determined based on the quality of the communication link; then the data can be encapsulated according to the selected transmission capacity, and the encapsulated data can be transmitted through the selected transmission channel. In this way, the transmission channel can be selected according to the quality of the communication link to ensure that the transmission process uses a better network channel. At the same time, the transmission capacity is determined based on the quality of the communication link, and the maximum carrying capacity of the transmission channel is fully utilized, thereby increasing the speed of data transmission.
[0155] In another optional example, the processor 120 is further configured to:
[0156] Get the initialized byte array;
[0157] Encapsulating the contact data into the byte array one by one according to the arrangement order of the contact data;
[0158] Until the amount of data accumulated in the byte array reaches the transmission capacity, stop encapsulating the contact data into the byte array to obtain the data set.
[0159] In another optional example, the processor 120 is further configured to:
[0160] Obtaining version information, sending time and data type of the byte array;
[0161] Generate a metadata header according to the version information, the sending time and the data type;
[0162] Add the metadata header to the byte array.
[0163] In another optional example, the processor 120 is further configured to:
[0164] For any piece of contact data, obtain the contact identifier and contact information corresponding to the contact data;
[0165] Determine the data length of the contact information;
[0166] The contact identifier, the data length and the contact information are converted into byte streams in sequence and written into the byte array in order to complete the encapsulation of the contact data.
[0167] In another optional example, the data transmission device further includes:
[0168] The processor 120 is configured to obtain a resume transmission instruction sent by the second electronic device after the network between the first electronic device and the second electronic device is disconnected and reconnected;
[0169] Processor 120, configured to parse the resume instruction to obtain a first import time and a first contact identifier, wherein the first contact identifier is a contact identifier of first contact data, the first import time is an import time of the first contact data, and the first contact data is the last successfully imported contact data before the network is interrupted;
[0170] The network module 122 is used to continue sending the contact data to the second electronic device starting from the next contact data of the first contact data.
[0171] It should be understood that in the embodiment of the present application, the input unit 124 may include a graphics processor (Graphics Processing Unit, GPU) 1241 and a microphone 1242, and the graphics processor 1241 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 126 may include a display panel 1261, and the display panel 1261 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 127 includes a touch panel 1271 and at least one of other input devices 1272. The touch panel 1271 is also called a touch screen. The touch panel 1271 may include two parts: a touch detection device and a touch controller. Other input devices 1272 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0172] The memory 129 can be used to store software programs and various data. The memory 129 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 129 may include a volatile memory or a non-volatile memory, or the memory 129 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 129 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0173] The processor 120 may include one or more processing units; optionally, the processor 120 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 120.
[0174] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned data transmission method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0175] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0176] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data transmission method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0177] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0178] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the data transmission method embodiment as described above, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0179] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0180] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0181] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data transmission method, characterized in that: The method is applied to a first electronic device, comprising: Acquiring the quality of the communication link between the first electronic device and the second electronic device; Determine a transmission channel and a transmission capacity according to the communication link quality; Encapsulating the contact data to be transmitted according to the transmission capacity to obtain a data set; The data set is sent to the second electronic device through the transmission channel.
2. The method according to claim 1, characterized in that: The step of encapsulating the contact data to be transmitted according to the transmission capacity to obtain a data set includes: Get the initialized byte array; Encapsulating the contact data into the byte array one by one according to the arrangement order of the contact data; Until the amount of data accumulated in the byte array reaches the transmission capacity, stop encapsulating the contact data into the byte array to obtain the data set.
3. The method according to claim 2, characterized in that Before encapsulating the contact data into the byte array one by one according to the arrangement order of the contact data, the method further includes: Obtaining version information, sending time and data type of the byte array; Generate a metadata header according to the version information, the sending time and the data type; Add the metadata header to the byte array.
4. The method according to claim 2, characterized in that: The step of encapsulating the contact data into the byte array one by one includes: For any piece of contact data, obtain the contact identifier and contact information corresponding to the contact data; Determine the data length of the contact information; The contact identifier, the data length and the contact information are converted into byte streams in sequence and written into the byte array in order to complete the encapsulation of the contact data.
5. The method according to claim 1, characterized in that After sending the data set to the second electronic device through the transmission channel, the method further includes: After the network between the first electronic device and the second electronic device is disconnected and reconnected, obtaining a resume transmission instruction sent by the second electronic device; Parsing the resume instruction to obtain a first import time and a first contact identifier, wherein the first contact identifier is a contact identifier of the first contact data, the first import time is an import time of the first contact data, and the first contact data is the last successfully imported contact data before the network is interrupted; Starting from the contact data next to the first contact data, the contact data continues to be sent to the second electronic device.
6. A data transmission device, characterized in that: include: A first acquisition module, used to acquire the quality of the communication link between the first electronic device and the second electronic device; A first determination module, configured to determine a transmission channel and a transmission capacity according to the communication link quality; A packaging module, used for packaging the contact data to be transmitted according to the transmission capacity to obtain a data set; A sending module is used to send the data set to the second electronic device through the transmission channel.
7. The device according to claim 6, characterized in that The packaging module comprises: A first acquisition unit, used for acquiring an initialized byte array; An encapsulation unit, configured to encapsulate the contact data one by one into the byte array according to the arrangement order of the contact data; The stopping unit is used to stop encapsulating the contact data into the byte array until the amount of data accumulated in the byte array reaches the transmission capacity to obtain the data set.
8. The device according to claim 7, characterized in that The data transmission device also includes: A second acquisition module is used to acquire version information, sending time and data type of the byte array; A first generating module, used to generate a metadata header according to the version information, sending time and data type; An adding module is used to add the metadata header to the byte array.
9. The device according to claim 7, characterized in that The packaging unit comprises: A first acquisition subunit is used to acquire, for any piece of contact data, a contact identifier and contact information corresponding to the contact data; A first determining subunit, used to determine the data length of the contact information; The conversion subunit is used to convert the contact identifier, the data length and the contact information into byte streams in sequence and write them into the byte array in order to complete the encapsulation of the contact data.
10. The device according to claim 6, characterized in that The data transmission device also includes: A third acquisition module, configured to acquire a resume transmission instruction sent by the second electronic device after the network between the first electronic device and the second electronic device is disconnected and reconnected; A first parsing module, configured to parse the resume instruction to obtain a first import time and a first contact identifier, wherein the first contact identifier is a contact identifier of first contact data, the first import time is an import time of the first contact data, and the first contact data is the last successfully imported contact data before the network is interrupted; The retransmission module is used to continue sending the contact data to the second electronic device starting from the next contact data of the first contact data.
11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the data transmission method according to any one of claims 1 to 5 are implemented.
Citation Information
Cited By
Real-time water regimen mobile acquisition system
CN120378927A
Real-time mobile hydrological data acquisition system
CN120378927B