A data transmission method and device
By employing a simplified transmission protocol and reducing the header field in near-field high-speed transmission, and utilizing the Wi-Fi channel to transmit data, the latency problem caused by the TCP protocol is solved, achieving low-latency, high-throughput data transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2021-07-31
- Publication Date
- 2026-07-14
Smart Images

Figure CN115250453B_ABST
Abstract
Description
[0001] This application claims priority to Chinese Patent Application No. 202110456191.2, filed on April 26, 2021, entitled “A High-Performance Near-Field Communication Method”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of terminals, and more particularly to a data transmission method and device. Background Technology
[0003] As devices become increasingly diverse, scenarios involving multiple devices working together are becoming more frequent. Because the Transmission Control Protocol (TCP) has relatively robust acknowledgment, retransmission, and congestion control mechanisms, devices typically use the kernel's TCP protocol stack to transmit data through the kernel's packet forwarding process in order to ensure the reliability of data exchange between devices.
[0004] However, precisely because TCP has relatively complete acknowledgment, retransmission, and congestion control mechanisms, kernel-based TCP data transmission requires a cumbersome kernel message forwarding process, resulting in significant data transmission latency. Summary of the Invention
[0005] This application provides a data transmission method and device that, in near-field high-speed transmission, sends data based on a simplified transmission protocol instead of using kernel TCP for packet forwarding, thereby reducing near-field transmission latency and increasing near-field transmission throughput.
[0006] In a first aspect, embodiments of this application provide a data transmission method, which may include: when a first device sends application data to a second device, if the first device and the second device have established a first Wi-Fi channel, the first device sends the application data to the second device through the first Wi-Fi channel based on a simplified transmission protocol; or, if the first device discovers the second device through near-field communication, it establishes a second Wi-Fi channel and sends the application data to the second device through the second Wi-Fi channel based on a simplified transmission protocol; wherein the transport layer header of the simplified transmission protocol is reduced by at least one of the following fields compared to the transport control protocol header: acknowledgment number, header length, reserved fields, flag fields, checksum, urgent pointer, and optional fields; and / or, the network layer header of the simplified transmission protocol is reduced by at least one of the following fields compared to the network protocol header: identifier, flags, segment offset, protocol, checksum, and optional fields.
[0007] In this method, if the first device is determined to be in a near-field high-speed transmission scenario (the first device has already established a Wi-Fi channel with the second device, or the first device can establish a Wi-Fi channel with the second device), then data transmission is performed based on a simplified transmission protocol. Since near-field high-speed transmission is a short-thickness pipeline (high bandwidth, short transmission distance), the packet loss rate is very low, and it does not require the complex acknowledgment, retransmission, and congestion control mechanisms of TCP. Using a simplified transmission protocol in near-field high-speed transmission avoids the cumbersome packet forwarding process associated with TCP data transmission, thus reducing the latency of near-field high-speed transmission.
[0008] In conjunction with the first aspect, in one possible design, the first device discovers the second device via short-range communication and establishes a first Wi-Fi channel between the first and second devices. The first device receives a first operation from a user requesting that the first device share its application data with the second device. In response to this first operation, the first device sends the application data to the second device via the first Wi-Fi channel based on a simplified transmission protocol. In this scenario, when the first device sends application data to the second device, a Wi-Fi channel has already been established between the first and second devices.
[0009] In conjunction with the first aspect, in one possible design, the first device receives a second operation from a user sharing application data from the first device. In response to the second operation, the first device discovers the second device via short-range communication and establishes a second Wi-Fi channel between the first and second devices. The first device then receives a third operation from the user sharing application data from the first device to the second device. In response to the third operation, the first device sends application data to the second device via the second Wi-Fi channel based on a simplified transmission protocol. This scenario is where the first device has not yet established a Wi-Fi channel with the second device. When the first device sends application data to the second device, the first and second devices discover each other via short-range communication and establish a Wi-Fi channel.
[0010] In conjunction with the first aspect, in one possible design approach, the Wi-Fi channel includes a channel based on Wi-Fi P2P mode, or a channel based on Wi-Fi AP mode, or a channel based on Wi-Fi STA mode.
[0011] In conjunction with the first aspect, one possible design approach for short-range communication includes NFC, Bluetooth, or infrared.
[0012] In conjunction with the first aspect, in one possible design, before the first device sends application data to the second device, the first device sorts the application data according to its transmission priority from high to low. The transmission priority is determined based on the data type of the application data, which includes message data, stream data, byte data, and file data. The transmission priorities of the following data types, from high to low, are: message data, stream data, byte data, and file data.
[0013] This avoids large file data or byte data consuming high bandwidth for extended periods, which could affect timely message delivery. For example, when a video on a mobile phone is streamed to a large screen for playback, the video data type is streaming data. During the streaming data transmission, the mobile phone sends control messages such as adjusting volume and playback progress to the large screen. Since the sending priority of message data is higher than that of streaming data, control messages such as adjusting volume and playback progress are sent before the unsent video streaming data, allowing adjustments to volume and playback progress during video playback and ensuring timely delivery of control messages.
[0014] In conjunction with the first aspect, in one possible design, the first device receives a first message from the second device; and according to the data packet number in the first message, retransmits the data packet corresponding to that data packet number to the second device.
[0015] In this method, the simplified transport protocol segments the application data to be sent into data packets and numbers each data packet. If the receiving device confirms that it has not received the Nth data packet of application data from the sending device, it sends a first message to the sending device, which includes the number of the unreceived data packet. That is, the second device does not need to send an ACK to the first device every time it receives a packet; instead, it sends a NACK to the first device when packet loss is determined. Generally, the packet loss rate is low in near-field high-speed transmission scenarios. Compared with the mechanism of acknowledging each message in TCP, the message acknowledgment mechanism of the simplified transport protocol can reduce the number of message exchanges between the sending and receiving devices.
[0016] In conjunction with the first aspect, in one possible design, the first device also adjusts the congestion window for sending data packets based on the amount of application data to be sent and the number of first messages received per unit time.
[0017] Secondly, this application provides a device capable of implementing the data transmission method described in the first aspect and its possible design embodiments. This device can implement the method through software, hardware, or hardware executing corresponding software. In one possible design, the device may include a communication interface, a processor, and a memory; wherein the memory includes main memory and external storage. The processor is configured to support the device in performing the corresponding functions described in the first aspect and its possible design embodiments. The memory is coupled to the processor and stores necessary program instructions and data for the device.
[0018] Thirdly, embodiments of this application provide a computer-readable storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the data transmission method as described in the first aspect and its possible design embodiments.
[0019] Fourthly, embodiments of this application provide a computer program product that, when run on a computer, causes the computer to perform the data transmission method as described in the first aspect and its possible design embodiments above.
[0020] Fifthly, embodiments of this application provide a communication system including a device that implements the corresponding methods in the first aspect and its possible design embodiments described above.
[0021] The technical effects of the device described in the second aspect, the computer-readable storage medium described in the third aspect, the computer program product described in the fourth aspect, and the communication system described in the fifth aspect are the same as those of the corresponding methods described above, and will not be repeated here. Attached Figure Description
[0022] Figure 1 This is a schematic diagram of the system architecture applicable to the data transmission method provided in the embodiments of this application;
[0023] Figure 2 This is a schematic diagram of the system architecture applicable to the data transmission method provided in the embodiments of this application;
[0024] Figure 3 This is a schematic diagram of the system architecture applicable to the data transmission method provided in the embodiments of this application;
[0025] Figure 4 This is a schematic diagram of the device hardware structure provided in the embodiments of this application;
[0026] Figure 5 A schematic diagram illustrating a scenario example of the data transmission method provided in this application embodiment;
[0027] Figure 6A schematic diagram illustrating a scenario example of the data transmission method provided in this application embodiment;
[0028] Figure 7 This is a schematic diagram of a data transmission method provided in an embodiment of this application;
[0029] Figure 8 This is a schematic diagram of a data transmission method provided in an embodiment of this application;
[0030] Figure 9 This is a schematic diagram of the structural composition of a device provided in an embodiment of this application. Detailed Implementation
[0031] The terminology used in the following embodiments is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to also include expressions such as “one or more,” unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of this application, “at least one” and “one or more” refer to one or more (including two). The term “and / or” is used to describe the relationship between related objects, indicating that three relationships can exist; for example, A and / or B can indicate: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character “ / ” generally indicates that the preceding and following related objects are in an “or” relationship.
[0032] References to "one embodiment" or "some embodiments" as used in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized. The term "connection" includes both direct and indirect connections, unless otherwise stated.
[0033] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0034] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0035] This application provides a data transmission method, applicable to... Figure 1 The system shown. (As shown) Figure 1 As shown, the system includes device 100 and device 200. Device 100 sends data to device 200 via wireless communication. Device 100 or device 200 may include mobile phones, tablets, laptops, personal computers (PCs), ultra-mobile personal computers (UMPCs), handheld computers, netbooks, smart home devices (e.g., smart TVs, smart screens, large screens, smart speakers, etc.), personal digital assistants (PDAs), wearable devices (e.g., smartwatches, smart bracelets, etc.), in-vehicle devices, virtual reality devices, etc., and this application embodiment does not impose any limitations on these. The aforementioned wireless communication includes mobile communication, the Internet, wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc.
[0036] Device 100 sends data to device 200 via wireless transmission. In the data transmission method provided in this application embodiment, if the wireless transmission method from device 100 to device 200 is near-field high-speed transmission, data transmission is performed based on a simplified transmission protocol. If the wireless transmission method from device 100 to device 200 is not near-field high-speed transmission, data transmission is performed based on other transport layer protocols (such as TCP). Since near-field high-speed transmission is a short-thickness pipeline (high bandwidth, short transmission distance), the packet loss rate is very low, and it does not require the complex acknowledgment mechanism, retransmission mechanism, and congestion control mechanism of TCP. Using a simplified transmission protocol in near-field high-speed transmission can avoid the cumbersome packet forwarding process required by TCP data transmission, thus reducing the latency of near-field high-speed transmission.
[0037] The aforementioned near-field high-speed transmission includes Wi-Fi Direct (also known as Wi-Fi Direct or Wi-Fi P2P) transmission, or wireless LAN transmission with fewer hops, or high-speed transmission methods that do not require the participation of the operator's network, etc.
[0038] In one example, such as Figure 2 As shown, the mobile phone and tablet establish a Wi-Fi Direct connection channel to exchange data, that is, the mobile phone and tablet exchange data through high-speed near-field transmission.
[0039] In another example, such as Figure 3 As shown, devices such as mobile phones, tablets, TVs, and PCs are connected to the same router, forming a local area network (LAN). Data interaction between devices within the LAN is essentially near-field high-speed transmission. This data interaction, as we understand it, includes data exchange between devices within the LAN via data forwarding through the router. It should be noted that... Figure 3 This example illustrates a local area network (LAN) formed by devices such as mobile phones, tablets, TVs, and PCs connected to the same router. In other examples, a LAN may include multiple routers, with devices belonging to the same network segment. Near-field high-speed transmission involves data interaction between devices connected to different routers within the same LAN. Devices within the LAN establish Wi-Fi channels for data transmission. In some examples, devices connected to the LAN activate Wi-Fi access point (AP) mode to establish a Wi-Fi channel; in other examples, devices activate Wi-Fi station (STA) mode to establish a Wi-Fi channel.
[0040] It should be noted that in some scenarios, device 100 and device 200 can establish both a direct Wi-Fi connection and a local area network Wi-Fi connection.
[0041] Non-near-field high-speed transmission includes far-field transmission; for example, data exchange between mobile phones, tablets, TVs, or PCs within the local area network and devices not belonging to the local area network. Non-near-field high-speed transmission also includes near-field low-speed transmission; for example, a mobile phone sending data to a PC via Bluetooth.
[0042] For example, Figure 4 A schematic diagram of one structure of the aforementioned device 100 is shown. For example... Figure 4 As shown, the aforementioned device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, a sensor module 170, etc. The sensor module may include pressure sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, accelerometers, distance sensors, proximity sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, bone conduction sensors, etc.
[0043] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on device 100. In other embodiments of this application, device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0044] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0045] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0046] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0047] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0048] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C buses. The I2S interface can be used for audio communication. The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 to the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. The MIPI interface can be used to connect the processor 110 to peripheral devices. MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc. The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or a data signal.
[0049] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge device 100, and can also be used for data transfer between device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.
[0050] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the device 100. In other embodiments of this application, the device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0051] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.
[0052] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, internal memory 121, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.
[0053] The wireless communication function of device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0054] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. Each antenna in device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.
[0055] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low-noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via the antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
[0056] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device or displays images or videos through a display screen. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0057] The wireless communication module 160 can provide solutions for wireless communication applications on device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR). The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0058] In some embodiments, antenna 1 of device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).
[0059] A digital signal processor (DSP) is used to process digital signals. Besides digital image signals, it can also process other digital signals. For example, when device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.
[0060] Video codecs are used to compress or decompress digital video. Device 100 may support one or more video codecs. Thus, device 100 can play or record video in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG 2, MPEG 3, MPEG 4, etc.
[0061] NPU stands for Neural Network (NN) Computing Processor. By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0062] Internal memory 121 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM).
[0063] Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, fifth generation DDR SDRAM is generally called DDR5 SDRAM), etc.
[0064] Non-volatile memory can include disk storage devices and flash memory. Flash memory can be classified according to its operating principle, such as NOR flash, NAND flash, and 3D NAND flash; according to the level of its storage cells, such as single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), and quad-level cell (QLC); and according to its storage specification, such as universal flash storage (UFS) and embedded multimedia card (eMMC).
[0065] The external memory interface 120 can be used to connect to external non-volatile memory, thereby expanding the storage capacity of the device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to perform data storage functions. For example, music, video, and other files can be stored in the external non-volatile memory.
[0066] The data transmission method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0067] For example, device 100 sends data applied on device 100 to device 200; that is, device 100 is the sending device and device 200 is the receiving device.
[0068] In one scenario, when device 100 sends application data to device 200, a Wi-Fi channel has already been established between device 100 and device 200 (e.g., Wi-Fi P2P mode, Wi-Fi AP mode, or Wi-Fi STA mode channel). Device 100 sends application data to device 200 through the established Wi-Fi channel based on a simplified transmission protocol.
[0069] For example, such as Figure 5 As shown, the interface 101 of mobile phone 100 includes multiple images. A user can select an image and share it to other devices. For example, the user clicks on image 102 to select it. Interface 101 also includes a sharing list, which includes one or more names (such as device name, user name, etc.). A user can select a name in the sharing list and share the selected image to the device corresponding to that name. For example, the sharing list includes a "User 1's Mobile Phone" button 103 and a "User 2's Tablet" button 104. "User 1's Mobile Phone" and "User 2's Tablet" are the names of devices that mobile phone 100 has saved that have established a wireless connection with mobile phone 100. For example, "User 1's Mobile Phone" is the name of mobile phone 300, and "User 2's Tablet" is the name of tablet 400.
[0070] In one example, mobile phones 100 and 300 discover each other via near-field communication (NFC, Bluetooth, etc.) and establish a Wi-Fi channel. The user clicks on image 102, selecting it; and then clicks the "User 1's Mobile Phone" button 103, selecting it. Mobile phone 100 receives the user's selection of the "User 1's Mobile Phone" button 103 and determines the corresponding device (mobile phone 300) based on the device identifier associated with "User 1's Mobile Phone". Once mobile phone 100 confirms that a Wi-Fi channel has been established with mobile phone 300, it sends image 102 to mobile phone 300 through this established Wi-Fi channel, based on a simplified transmission protocol.
[0071] In one example, tablet 400 does not have Bluetooth or NFC enabled. The user taps image 102, selecting it; then taps the "User 2's Tablet" button 104, selecting it as well. Mobile phone 100 receives the user's selection of the "User 2's Tablet" button 104 and identifies the corresponding device (tablet 400) based on the device identifier associated with "User 2's Tablet". Mobile phone 100 determines that it cannot discover tablet 400 via near-field communication (e.g., Bluetooth, NFC). Mobile phone 100 then sends image 102 to tablet 400 via the internet using TCP.
[0072] In one scenario, when device 100 sends application data to device 200, device 100 discovers device 200 through short-range communication and establishes a Wi-Fi channel (e.g., Wi-Fi P2P mode, Wi-Fi AP mode, or Wi-Fi STA mode channel). Based on a simplified transmission protocol, device 100 sends application data to device 200 through the established Wi-Fi channel.
[0073] For example, such as Figure 6 As shown, the interface 101 of mobile phone 100 includes multiple images. Users can select an image and share it to other devices. For example, a user can tap image 102 to select it. Interface 101 also includes a sharing list, which includes one or more names (such as device name, user name, etc.). Users can select a name in the sharing list and share the selected image to the device corresponding to that name. Interface 101 also includes a "More" button 105. Users can select the "More" button 105 to find devices that can be mutually discovered by mobile phone 100.
[0074] In one example, the user clicks on image 102, selecting image 102; and then clicks the "More" button 105. Mobile phone 100 receives the user's click on the "More" button 105 and searches for the device via near-field communication (e.g., Bluetooth, NFC). For example, mobile phone 100 discovers mobile phone 500 via Bluetooth, displaying the "User 3's Mobile Phone" button 106 on interface 101. The user clicks the "User 3's Mobile Phone" button 106, selecting it. Mobile phone 100 receives the user's selection of the "User 3's Mobile Phone" button 106, determines the corresponding device (mobile phone 500) based on the device identifier corresponding to "User 3's Mobile Phone," and establishes a Wi-Fi channel (e.g., a Wi-Fi P2P mode channel) with mobile phone 500. Based on a simplified transmission protocol, mobile phone 100 sends image 102 to mobile phone 500 through this established Wi-Fi channel.
[0075] In one implementation, such as Figure 7As shown, the application of the transmitting device (e.g., device 100) calls the system framework interface to send data to the receiving device; the input parameters include indication information used to indicate the device identifier of the receiving device (e.g., device 200). The scene recognition unit in the system framework determines the wireless transmission method based on the device identifier of the receiving device; the wireless transmission method includes near-field high-speed transmission (Wi-Fi channel transmission) and non-near-field high-speed transmission. In one implementation, if it is determined that the receiving device and the transmitting device have established a near-field high-speed transmission channel (e.g., a Wi-Fi direct connection channel or a Wi-Fi channel within a local area network); or the receiving device and the transmitting device discover each other through short-range communication methods such as NFC, Bluetooth, and infrared to establish a near-field high-speed transmission channel; or the receiving device and the transmitting device belong to a converged network or trust ring that includes near-field high-speed transmission; then the wireless transmission method is determined to be near-field high-speed transmission. If the scene recognition unit determines that it is near-field high-speed transmission, it sends data to the receiving device based on a simplified transmission protocol; reducing the latency of near-field high-speed transmission while ensuring data transmission reliability. If the scene recognition unit determines that it is a non-near-field high-speed transmission, it sends data to the receiving device based on other transport layer protocols; for example, TCP can be used to ensure the reliability of data transmission; or User Datagram Protocol (UDP) can be used for fast response and to ensure low latency of data transmission.
[0076] Simplified Transport Protocol (STP) is a reliable server / client (C / S) mode transport protocol. In one implementation, one or more socket channels are established between the sending device (client) and the receiving device (server) before sending application data. Table 1 provides examples of interface functions for creating a server socket and for creating a client socket.
[0077] Table 1
[0078]
[0079] The receiving device calls `StartServer()` to create a server and returns a socket identifier; the sending device calls `StartClient()` to create a client that communicates with the server and returns a socket identifier, establishing a socket channel between the sending and receiving devices. For example, each service on the sending device corresponds to one socket channel. The sending device also maintains the mapping between the receiving device's device identifier and its socket identifier.
[0080] After the socket channel is established, the application on the sending device calls the simplified transport protocol's data sending interface to send data to the receiving device. Application data can include message data, byte data, stream data, or file data. In one implementation, message data, byte data, stream data, and file data each have a dedicated data sending interface. The application can call the simplified transport protocol's message sending interface to transmit message data, its byte sending interface to transmit byte data, its stream sending interface to transmit stream data, or its file sending interface to transmit file data.
[0081] For example, Table 2 shows an example of a simplified data sending interface function for a transport protocol.
[0082] Table 2
[0083]
[0084] In another implementation, a data sending interface function can be provided for sending message data, byte data, stream data, or file data; the input parameters of this data sending interface function include the data type, which indicates whether the application data being sent is message data, byte data, stream data, or file data.
[0085] Optionally, the receiving device can call the interface provided by the system framework to set the storage path for the received application data. For example, Table 3 shows an example of an interface function for setting the application data storage path on the receiving device.
[0086] Table 3
[0087]
[0088] It should be noted that the above-described interface functions are merely examples. In other embodiments, the interface functions may take different forms. For instance, the input parameters of the file sending interface may include the application data storage path parameter; when a client calls the file sending interface to send file data, it can specify the storage path of that file data on the server.
[0089] In one implementation, the simplified transmission protocol includes a priority control mechanism, which sends application data in descending order of sending priority. For example, the sending priority of application data is determined based on its data type. Exemplarily, the sending priority of application data from highest to lowest is: message data > stream data > byte data > file data. In another implementation, based on the priority control mechanism, the application data to be sent in the application data sending queue is sorted in descending order of sending priority, with application data having a higher sending priority being sent first. In one example, the data to be sent from the same application is sorted in descending order of sending priority, meaning the data to be sent from each application is sorted separately in descending order of sending priority. In another example, the data to be sent from different applications in the sending queue is sorted in descending order of sending priority. This avoids large file data or byte data occupying high bandwidth for extended periods, affecting timely message delivery. For example, a video on a mobile phone is streamed to a large screen for playback; the video data type is stream data. During the streaming data transmission, the mobile phone sends control messages such as adjusting volume and playback progress to the large screen. Since message data has a higher priority than streaming data, control messages such as adjusting volume and playback progress are sent before unsent video stream data. This allows for volume and playback progress adjustments to be made during video playback, ensuring timely delivery of control messages.
[0090] In one implementation, the simplified transport protocol includes a message acknowledgment mechanism. The simplified transport protocol segments the application data to be sent into data packets and numbers each data packet. If the receiving device acknowledges that it has not received the Nth data packet of application data from the sending device, it sends a first message (e.g., a Non-acknowledge (NACK) message) to the sending device; the first message includes the number of the unreceived data packet. Upon receiving the first message, the sending device retransmits the data packet corresponding to the number of the unreceived data packet in the first message to the receiving device. For example, each data packet of application data to be sent on the sending device is numbered and written into a sending queue in numerical order for transmission. The receiving device sorts each received data packet by number and writes it into a receiving queue; if the data packet numbers in the receiving queue are consecutive, the data packets in the receiving queue are written sequentially into the service read buffer; if the data packet numbers in the receiving queue are not consecutive, the receiving device replies with a NACK message, which includes the number of the unreceived data packet. Upon receiving the NACK message, the sending device retransmits the corresponding data packet according to the number in the NACK message. Generally speaking, the packet loss rate is low in near-field high-speed transmission scenarios. Compared with the mechanism of acknowledging each message in TCP, the message acknowledgment mechanism of the simplified transmission protocol can reduce the number of message exchanges between the sending and receiving devices in near-field high-speed transmission scenarios.
[0091] In one implementation, the simplified transport protocol includes a congestion control mechanism. The transmitting device dynamically adjusts the congestion window based on the amount of data to be sent in the application data transmission queue and the number of first messages received. In one example, if the amount of data to be sent in the application data transmission queue is greater than M (M is a preset value, e.g., M=10) times the amount of network data transmitted per unit time (exemplarily, in seconds), and the number of first messages (e.g., NACK messages) received per unit time is less than a first preset threshold (e.g., 10), the congestion window is increased (e.g., adjusted to twice the current congestion window size). In another example, if the amount of network data transmitted per unit time (exemplarily, in seconds) is less than a second preset threshold, or the number of first messages (e.g., NACK messages) received per unit time is greater than a third preset threshold (the third preset threshold may be the same as or different from the first preset threshold), the congestion window is decreased (e.g., adjusted to half the amount of network data transmitted per unit time). Optionally, if after reducing the congestion window for a first duration, the network data transmission volume within a unit time (for example, in seconds) does not meet the second preset threshold, and the number of first messages (such as NACK messages) received within a unit time does not meet the third preset threshold, the application data transmission rate is increased (for example, the application data transmission rate is increased by 50%). The larger the congestion window, the larger the number of data packets sent at once, i.e., the higher the application data transmission rate.
[0092] In other implementations, simplifying the transmission protocol may also include: load balancing of different socket channels for near-field high-speed transmission, dynamically adjusting the bandwidth of a socket channel, etc. Simplifying the transmission protocol may also include: load balancing of different physical links for near-field high-speed transmission (e.g., Wi-Fi direct connection channels, Wi-Fi channels between devices within a local area network, etc.), or multi-channel transmission, etc.
[0093] Simplified Transport Protocol (STP) adds a Simplified Transport Protocol header to each datagram. In one example, compared to the TCP / IP header, the Simplified Transport Protocol header reduces at least one of the following fields:
[0094] a) The simplified transport layer header of a transport protocol reduces at least one of the following fields compared to the Transmission Control Protocol (TCP) header: Acknowledgment number (32 bits), header length (4 bits), reserved fields (6 bits), flag fields (U, A, P, R, S, F) (6 bits), checksum (16 bits), urgent pointer (16 bits), and optional fields (0-40 bytes). For example, the TCP header is shown in Table 4, and a simplified transport layer header is shown in Table 5.
[0095] Table 4
[0096]
[0097] Table 5
[0098]
[0099] b) The network layer header of the simplified transport protocol is reduced by at least one of the following fields compared to the Internet Protocol (IP) header: Identifier (16 bits), Flags (3 bits), Segment Offset (13 bits), Protocol (8 bits), Checksum (16 bits), and Optionals (0 to 40 bytes).
[0100] For example, the IP packet header is shown in Table 6, and the network layer packet header of a simplified transport protocol is shown in Table 7.
[0101] Table 6
[0102]
[0103] Table 7
[0104]
[0105] Understandably, the aforementioned reduction refers to the direct removal of fields. With direct field removal, the processing flow for these removed fields can also be simplified or eliminated.
[0106] For example, the simplified transport layer header of a TCP packet acknowledgment (SLT) removes the acknowledgment number compared to the TCP header. The acknowledgment number is used in TCP's packet acknowledgment mechanism. For instance, when a sending device sends a packet to a receiving device via TCP, the acknowledgment number in the packet header is 1, instructing the receiving device to reply with an ACK message upon receiving the packet. Upon receiving the packet and confirming that the acknowledgment number in the received packet header is 1, the receiving device replies with an ACK message. The acknowledgment number in the ACK message header is the sum of the data number in the received packet header and the data length of the packet. It is understandable that since the SLT's transport layer header does not include the acknowledgment number, the sending and receiving devices can omit the aforementioned acknowledgment number-based packet acknowledgment mechanism during the sending process.
[0107] It should be noted that in one implementation, to ensure the integrity of the message header, the simplified transport protocol header includes a 16-bit (2-byte) checksum. Thus, compared to the TCP / IP message header, the simplified transport protocol header can save 16 to 96 bytes, increasing the amount of data carried in the data packet and improving the data packet's effective payload rate.
[0108] In some embodiments, such as Figure 8 As shown, application data is processed based on the priority control mechanism, congestion control mechanism, and / or message acknowledgment mechanism of the Simplified Transport Protocol (STP). Data packets, based on the STP kernel and with an added STP header, are then sent to the receiving device via the physical link. Transmitting application data using the STP avoids the complex acknowledgment, retransmission, and congestion control mechanisms of TCP, reducing latency in near-field high-speed transmission.
[0109] In other embodiments, after the application data is processed based on the priority control mechanism, congestion control mechanism and / or message acknowledgment mechanism of the simplified transport protocol, it can be sent to the receiving device through the physical link after adding a UDP header based on the UDP kernel.
[0110] In other embodiments, after the application data is processed based on the priority control mechanism, congestion control mechanism and / or message acknowledgment mechanism of the simplified transmission protocol, it can be sent to the receiving device through the physical link after adding a TCP header based on the TCP kernel.
[0111] It is understood that, in order to achieve the aforementioned functions, the device includes corresponding hardware structures and / or software modules for performing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.
[0112] This application embodiment can divide the above-described device into functional modules based on the method example described above. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0113] In one example, please refer to Figure 9 The diagram illustrates a possible structural schematic of the device involved in the above embodiments. The device 700 includes: a processing unit 701, a storage unit 702, and a communication unit 703.
[0114] The processing unit 701 is used to control and manage the actions of the device 700. For example, it can be used to determine the wireless transmission mode, process application data based on a simplified transmission protocol (e.g., priority control of application data, congestion control of application data, message acknowledgment, etc.), process application data based on TCP, process application data based on UDP, and / or other processing steps in the embodiments of this application.
[0115] Storage unit 702 is used to store the program code and data of device 700. For example, it can be used to store the correspondence between the identifier of the receiving device and the socket identifier.
[0116] The communication unit 703 is used to support communication between the device 700 and other electronic devices. For example, it can be used to discover each other with the receiving device, establish a Wi-Fi direct connection, access a local area network, or send application data to the receiving device via near-field high-speed transmission.
[0117] Of course, the unit modules in the device 700 include, but are not limited to, the processing unit 701, the storage unit 702, and the communication unit 703. For example, the device 700 may also include a display unit, a power supply unit, etc. The display unit is used to display the interface of the device 700, and the power supply unit is used to supply power to the device 700.
[0118] The processing unit 701 can be a processor or controller, such as a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The storage unit 702 can be a memory. The communication unit 703 can be a transceiver, transceiver circuitry, etc.
[0119] For example, processing unit 701 is a processor (such as...) Figure 4 The processor 110 shown can be a memory (such as a storage unit 702). Figure 4 The internal memory 121 shown, and the communication unit 703, which can be called the communication interface, include a mobile communication module (such as...). Figure 4 The mobile communication module 150 and wireless communication module shown are shown. Figure 4 The wireless communication module 160 shown is shown. The device 700 provided in this embodiment of the application can be a wireless communication module 160. Figure 4The device 100 shown. The aforementioned processor, memory, communication interface, etc., can be connected together, for example, via a bus.
[0120] This application also provides a computer-readable storage medium storing computer program code. When a processor executes the computer program code, the electronic device performs the method described in the above embodiments.
[0121] This application also provides a computer program product that, when run on a computer, causes the computer to perform the methods described in the above embodiments.
[0122] In this application, the device 700, computer-readable storage medium, or computer program product provided in the embodiments are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0123] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0124] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0125] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional unit.
[0126] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROMs, magnetic disks, or optical disks.
[0127] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A data transmission method, applied to a first device, characterized in that, The method includes: The first device sorts the application data of the first device in descending order of transmission priority; the transmission priority is determined according to the data type of the application data, which includes message data, stream data, byte data and file data; When the first device sends application data to the second device, If the first device and the second device have established a first Wi-Fi channel, the first device sends the application data to the second device through the first Wi-Fi channel based on a simplified transmission protocol; or, If the first device discovers the second device through short-range communication, it establishes a second Wi-Fi channel and sends the application data to the second device through the second Wi-Fi channel based on a simplified transmission protocol; The simplified transmission protocol includes: The simplified transport protocol's transport layer header is reduced by at least one of the following fields compared to the Transmission Control Protocol header: Confirmation number, header length, reserved fields, flag fields, checksum, urgent pointer, optional; And / or, The simplified transport protocol's network layer header is reduced from at least one of the following fields compared to the network protocol header: Identifier, flag bit, segment offset, protocol, checksum, optional; The method further includes: The first device receives a first message from the second device; The first device resends the data packet corresponding to the data packet number in the first message to the second device.
2. The method according to claim 1, characterized in that, If the first device and the second device have established a first Wi-Fi channel, then the first device sending the application data to the second device through the first Wi-Fi channel based on a simplified transmission protocol includes: The first device discovers the second device through short-range communication and establishes a first Wi-Fi channel between the first device and the second device; The first device receives a first operation from the user to share the application data of the first device to the second device. In response to the first operation, the first device sends the application data to the second device through the first Wi-Fi channel based on a simplified transmission protocol.
3. The method according to claim 1, characterized in that, If the first device discovers the second device via short-range communication, then establishing a second Wi-Fi channel and sending the application data to the second device through the second Wi-Fi channel based on a simplified transmission protocol includes: The first device receives a second operation from the user sharing application data of the first device. In response to the second operation, the first device discovers the second device through near-field communication and establishes a second Wi-Fi channel between the first device and the second device. The first device receives a third operation from the user to share the application data of the first device to the second device. In response to the third operation, the first device sends the application data to the second device through the second Wi-Fi channel based on a simplified transmission protocol.
4. The method according to any one of claims 1-3, characterized in that, The Wi-Fi channel includes a Wi-Fi P2P mode channel, a Wi-Fi AP mode channel, or a Wi-Fi STA mode channel.
5. The method according to any one of claims 1-3, characterized in that, The short-range communication methods include NFC, Bluetooth, or infrared.
6. The method according to claim 1, characterized in that, The following data types have the following sending priorities from highest to lowest: message data, stream data, byte data, and file data.
7. The method according to claim 1, characterized in that, The method further includes: The first device adjusts the congestion window for sending data packets based on the amount of application data to be sent and the number of first messages received per unit time.
8. A device, characterized in that, The device includes: A communication interface, a memory, the memory including RAM and external storage; The processor invokes one or more computer programs stored in the memory, the one or more computer programs comprising instructions that, when executed by the processor, cause the device to perform: The device sorts the application data according to the sending priority from high to low; the sending priority is determined based on the data type of the application data, which includes message data, stream data, byte data, and file data. When the device sends application data to the second device If the device has established a first Wi-Fi channel with the second device, the device sends the application data to the second device through the first Wi-Fi channel based on a simplified transmission protocol; or, If the device discovers the second device through short-range communication, it establishes a second Wi-Fi channel and sends the application data to the second device through the second Wi-Fi channel based on a simplified transmission protocol; The simplified transmission protocol includes: The simplified transport protocol's transport layer header is reduced by at least one of the following fields compared to the Transmission Control Protocol header: Confirmation number, header length, reserved fields, flag fields, checksum, urgent pointer, optional; And / or, The simplified transport protocol's network layer header is reduced from at least one of the following fields compared to the network protocol header: Identifier, flag bit, segment offset, protocol, checksum, optional; When the instruction is executed by the processor, it also causes the device to perform: The device receives a first message from the second device; The device resends the data packet corresponding to the data packet number in the first message to the second device.
9. The device according to claim 8, characterized in that, If the device and the second device have established a first Wi-Fi channel, then the device sending the application data to the second device through the first Wi-Fi channel based on a simplified transmission protocol specifically includes: The device discovers the second device via short-range communication and establishes a first Wi-Fi channel between the device and the second device; The device receives a first operation from the user to share the device's application data to the second device. In response to the first operation, the device sends the application data to the second device through the first Wi-Fi channel based on a simplified transmission protocol.
10. The device according to claim 8, characterized in that, If the device discovers the second device via short-range communication, then establishing a second Wi-Fi channel and sending the application data to the second device through the second Wi-Fi channel based on a simplified transmission protocol specifically includes: The device receives a second operation from a user sharing application data of the device. In response to the second operation, the device discovers the second device via near-field communication and establishes a second Wi-Fi channel between the device and the second device. The device receives a third operation from the user to share the device's application data with the second device. In response to the third operation, the device sends the application data to the second device through the second Wi-Fi channel based on a simplified transmission protocol.
11. The device according to any one of claims 8-10, characterized in that, The Wi-Fi channel includes a Wi-Fi P2P mode channel, a Wi-Fi AP mode channel, or a Wi-Fi STA mode channel.
12. The device according to any one of claims 8-10, characterized in that, The short-range communication methods include NFC, Bluetooth, or infrared.
13. The device according to claim 8, characterized in that, The following data types have the following sending priorities from highest to lowest: message data, stream data, byte data, and file data.
14. The device according to claim 8, characterized in that, When the instruction is executed by the processor, it also causes the device to perform: The device adjusts the congestion window for sending data packets based on the amount of application data to be sent and the number of first messages received per unit time.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-7.