Data transmission method and system, electronic equipment and storage medium
By establishing a physical link with multiple devices when a preset trigger signal is detected in wireless communication, the problem of difficulty in reducing connection delay and power consumption between devices is solved, and data sharing efficiency is improved.
Patent Information
- Application Number
- CN202410874201.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-12
- Publication Date
- 2024-11-08
AI Technical Summary
In the existing wireless communication technology, the connection delay between devices and device power consumption are difficult to reduce simultaneously, resulting in low data sharing efficiency.
When the preset trigger signal of the data to be shared is detected, the first device performs device discovery and establishes a physical link with the discovered multiple second devices to avoid high power consumption caused by the device always maintaining a connection, while selecting the target device while selecting the target device. A physical link has been established before data transmission to reduce connection delay.
It achieves relatively low device power consumption and connection delay, improves data sharing efficiency, and extends the standby time of the device.
Smart Images

Figure CN118921647A_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202110390636.1, and the original application date is April 12, 2021. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of wireless communication technology, and in particular to a data transmission method, system, electronic device and storage medium. Background Art
[0003] With the development of wireless communication technology, electronic devices such as smart phones and tablet computers have begun to support users in sharing data such as pictures and documents, thus improving data sharing efficiency.
[0004] Currently, if a user needs to share data from one device to another, data can be shared through Wireless Fidelity (Wifi). When sharing data through Wifi, the connection delay between devices is an important indicator for evaluating the efficiency of data sharing. In related technologies, if the devices are always connected, the connection delay is zero, but it also means higher device power consumption. If the connection between devices is started only when a device is selected for data transmission, it means a higher connection delay.
[0005] How to reduce connection latency while ensuring relatively low device power consumption, the relevant technology has not yet provided a suitable and effective solution. Summary of the invention
[0006] In view of this, a data transmission method, system, electronic device and storage medium are proposed. In the data transmission method provided by the embodiment of the present application, a first device performs device discovery when a preset trigger signal acting on the data to be shared is detected, and a physical link is established with the discovered n second devices before selecting a target device for data transmission, which reduces the connection delay between devices while ensuring the ease of user operation, and at the same time ensures relatively low device power consumption.
[0007] In a first aspect, an embodiment of the present application provides a data transmission method, which is used in a data transmission system including a first device and n second devices, where n is a positive integer, and the method includes:
[0008] Performing device discovery when the first device detects a preset trigger signal acting on the data to be shared;
[0009] The first device establishes a physical link with the discovered n second devices, and Wifi direct connection functions of the first device and the n second devices are both turned on;
[0010] When the first device detects a selection signal from a target device, the first device sends the data to be shared to the target device, where the target device is one of the n second devices.
[0011] In this implementation, when the first device detects a preset trigger signal acting on the data to be shared, device discovery is performed; when the Wi-Fi direct connection functions of the first device and the discovered n second devices are all turned on, the first device establishes a physical link with the n second devices, thereby avoiding the situation in the related art where the devices are always connected, resulting in high device power consumption, ensuring relatively low device power consumption and extending the standby time of the device; and, since the first device has established a physical link with the n second devices before selecting the target device for data transmission, the situation in the related art where the connection between devices is started only when a certain device is selected for data transmission, resulting in high connection delay, is avoided, thereby reducing the connection delay between devices and improving data sharing efficiency.
[0012] In a possible implementation, when the first device detects a preset trigger signal acting on the data to be shared, performing device discovery includes:
[0013] When the first device detects a preset trigger signal acting on the data to be shared, sending first information;
[0014] The first device establishes a physical link with the discovered n second devices, including:
[0015] For any second device among the n second devices, the second device establishes a physical link with the first device according to the received first information; or, after the first device receives the response information fed back by the second device, the first device establishes a physical link with the second device.
[0016] In this implementation, when the first device detects a preset trigger signal acting on the data to be shared, device discovery is performed by sending a first message, so that the first device establishes a physical link with n discovered second devices, or the discovered second device actively establishes a physical link with the first device, thereby avoiding the situation in the related technology where the devices are always connected, resulting in higher device power consumption, further ensuring relatively low device power consumption and extending the standby time of the device.
[0017] In another possible implementation manner, after the first device establishes a physical link with the discovered n second devices, the method further includes:
[0018] The first device establishes a logical link with at least one of the n second devices;
[0019] The sending the to-be-shared data to the target device when the first device detects a selection signal of the target device comprises:
[0020] When the first device detects a selection signal from the target device and the target device meets a first preset condition, sending the data to be shared to the target device;
[0021] The first preset condition includes that the physical link and the logical link are established between the first device and the target device.
[0022] In this implementation, before selecting a target device for data transmission, the first device establishes a logical link with at least one of n second devices. When the first device detects the selection signal of the target device, if the selected target device has established a physical link and a logical link with the first device, the first device can directly send the data to be shared to the target device, further reducing the connection delay between devices and improving data sharing efficiency.
[0023] In another possible implementation, the method further includes:
[0024] When the first device detects the selected signal of the target device and the target device does not meet the first preset condition, establishing the logical link with the target device;
[0025] After the logical link is successfully established, the first device sends the data to be shared to the target device.
[0026] In this implementation, when the first device detects a selection signal from a target device, if the selected target device has established a physical link with the first device but has not yet established a logical link, the first device can establish a logical link based on the physical link, and send the data to be shared to the target device after the logical link is successfully established. Compared with the situation in the related art where the physical link connection between devices is started only when a certain device is selected for data transmission, the connection delay between devices is reduced.
[0027] In another possible implementation manner, the first device establishing a logical link with at least one of the n second devices includes:
[0028] The first device sorts the n second devices according to a first preset rule;
[0029] The first device establishes the logical link with the second device that is ranked first m after sorting, where m is a positive integer less than n;
[0030] The first preset rule indicates that the sorting order of the second devices is related to the expected probability of the second devices being selected.
[0031] In this implementation, the first device sorts the n second devices according to the first preset rule, and selects some of the second devices with the highest sorting to establish a logical link. Since these second devices with the highest sorting have a greater probability of being selected, if the target devices selected subsequently are these second devices, then since the target device has established a physical link and a logical link with the first device, the first device can immediately start data transmission, thereby further reducing the connection delay between devices and improving data sharing efficiency.
[0032] In another possible implementation, the method further includes:
[0033] For at least one of the n second devices, starting a countdown after receiving the first information;
[0034] At least one of the second devices turns off the Wi-Fi direct connection function or enters a low power consumption state after the countdown times out.
[0035] In this implementation, the second device starts a countdown after receiving the first information sent by the first device, and turns off the Wi-Fi direct connection function or enters a low power consumption state after the countdown times out, so that the second device can intelligently decide whether to disconnect the physical link and / or logical link with the first device to avoid unnecessary device power consumption.
[0036] In another possible implementation, the method further includes:
[0037] When the first device detects the selected signal of the target device, sending second information;
[0038] The second devices other than the target device turn off the Wifi direct connection function or enter a low power consumption state according to the received second information.
[0039] In this implementation, the first device notifies other second devices except the target device to turn off the Wi-Fi direct connection function or enter a low power consumption state by sending the second information, so that the other second devices disconnect the physical link and / or logical link with the first device, further reducing the device power consumption of other second devices except the target device.
[0040] In another possible implementation, the method further includes:
[0041] After the data transmission between the first device and the target device is completed, the first device sends third information;
[0042] The n second devices other than the target device enable the Wifi direct connection function according to the received third information.
[0043] In this implementation, after the data transmission is completed, the first device notifies the surrounding second device to start the Wi-Fi direct connection function and wait for connection by sending the third information, which further reduces the connection delay between devices and improves the subsequent data sharing efficiency.
[0044] In another possible implementation, the method further includes:
[0045] The first device sends fourth information after the broadcast service ends;
[0046] The n second devices turn off the Wifi direct connection function or enter a low power consumption state according to the received fourth information.
[0047] In this implementation, after the broadcast service ends, the first device notifies n second devices to turn off the Wifi Direct function or enter a low power consumption state by sending a fourth message, so that the n second devices disconnect the physical link and / or logical link with the first device, avoiding unnecessary device power consumption.
[0048] In a second aspect, an embodiment of the present application provides a data transmission method, which is used in a first device, and the method includes:
[0049] Device discovery is performed when a preset trigger signal acting on the data to be shared is detected;
[0050] Establishing physical links with the discovered n second devices, wherein the Wi-Fi direct connection functions of the first device and the n second devices are all turned on;
[0051] When a selection signal of a target device is detected, the data to be shared is sent to the target device, where the target device is one of the n second devices.
[0052] In a possible implementation, performing device discovery when a preset trigger signal acting on the data to be shared is detected includes:
[0053] When a preset trigger signal acting on the data to be shared is detected, sending first information;
[0054] Among them, for any second device among the n second devices, the physical link between the second device and the first device is established by the second device according to the received first information, or is established by the first device after receiving the response information fed back by the second device.
[0055] In another possible implementation manner, after establishing the physical links with the discovered n second devices, the method further includes:
[0056] Establishing a logical link with at least one of the n second devices;
[0057] The sending the to-be-shared data to the target device when a selection signal of the target device is detected includes:
[0058] When a selection signal of the target device is detected and the target device meets a first preset condition, sending the data to be shared to the target device;
[0059] The first preset condition includes that the physical link and the logical link are established between the first device and the target device.
[0060] In another possible implementation, the method further includes:
[0061] When a selection signal of the target device is detected and the target device does not meet the first preset condition, establishing the logical link with the target device;
[0062] After the logical link is successfully established, the first device sends the data to be shared to the target device.
[0063] In another possible implementation manner, establishing a logical link with at least one of the n second devices includes:
[0064] Sorting the n second devices according to a first preset rule;
[0065] The logical link is established with the second devices that are ranked first m after sorting, where m is a positive integer less than n.
[0066] In another possible implementation, the first information further instructs at least one of the n second devices to start a countdown after receiving the first information, and to turn off the Wi-Fi direct connection function or enter a low power consumption state after the countdown times out.
[0067] In another possible implementation, the method further includes:
[0068] When the selection signal of the target device is detected, second information is sent, where the second information instructs the second devices other than the target device to turn off the Wifi direct connection function or enter a low power consumption state.
[0069] In another possible implementation, the method further includes:
[0070] After the data transmission between the target device is completed, third information is sent, and the third information instructs the n second devices other than the target device to enable the Wifi direct connection function.
[0071] In another possible implementation, the method further includes:
[0072] After the broadcast service ends, fourth information is sent, where the fourth information instructs the n second devices to turn off the Wifi direct connection function or enter a low power consumption state.
[0073] In a third aspect, an embodiment of the present application provides a data transmission system, comprising: a first device and n second devices; the data transmission system is used to execute the data transmission method provided by the above-mentioned first aspect or any possible implementation method of the first aspect.
[0074] In a fourth aspect, an embodiment of the present application provides an electronic device, the electronic device comprising:
[0075] processor;
[0076] a memory for storing processor-executable instructions;
[0077] The processor is configured to implement the data transmission method provided by the above-mentioned second aspect or any possible implementation manner of the second aspect when executing the instruction.
[0078] In a fifth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the data transmission method provided by the above-mentioned second aspect or any possible implementation method of the second aspect.
[0079] In a sixth aspect, a data transmission device is provided, the device comprising at least one unit, and the at least one unit is used to implement the data transmission method provided by the above-mentioned second aspect or any possible implementation method of the second aspect.
[0080] In the seventh aspect, an embodiment of the present application provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying a computer-readable code. When the computer-readable code is running in an electronic device, the processor in the electronic device executes the data transmission method provided by the above-mentioned second aspect or any possible implementation of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the present application and, together with the description, serve to explain the principles of the present application.
[0082] Figure 1 A schematic diagram of the link connection strategy provided by the related technology and the embodiment of the present application is shown.
[0083] Figure 2 A schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application is shown.
[0084] Figure 3 A flow chart of a data transmission method provided by an exemplary embodiment of the present application is shown.
[0085] Figure 4 A schematic diagram of an interface involved in a data transmission method provided by an exemplary embodiment of the present application is shown.
[0086] Figure 5 A flow chart of a data transmission method provided by another exemplary embodiment of the present application is shown.
[0087] Figure 6 A flow chart of a data transmission method provided by another exemplary embodiment of the present application is shown.
[0088] Figure 7 A flow chart of a data transmission method provided by another exemplary embodiment of the present application is shown.
[0089] Figure 8 A schematic diagram showing the principle of a data transmission method provided by an exemplary embodiment of the present application is shown.
[0090] Fig. 9 A block diagram of a data transmission device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0091] Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0092] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0093] In addition, in order to better illustrate the present application, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.
[0094] First, several terms involved in the embodiments of the present application are introduced.
[0095] 1. Physical link: A link between physical nodes. For example, a physical link includes a Wi-Fi connection between a computer and a router.
[0096] The physical link is a link formed after the data link layer is successfully established between two devices, where the data link layer is the data link layer in the Transmission Control Protocol (TCP) / Internet Protocol (IP) protocol. The process of establishing a physical link between two devices includes: both devices turn on the WiFi direct connection function, and the two devices exchange physical layer capability information (such as signal synchronization information, transmission frequency, transmission power, etc.), and allocate IP addresses and exchange information, which usually corresponds to the function of the data link layer in the TCP / IP protocol.
[0097] 2. Logical link: also called data link or service link, the link between logical nodes. Logical link is used to transmit service data and control signaling, etc. For example, a logical link includes a TCP protocol connection established when browsing a website.
[0098] In the embodiment of the present application, when both devices have the WiFi direct connection function turned on, a physical link can be established between the two devices. After the physical link is established between the two devices, a logical link can be established between the two devices. Among them, a physical link can include several different logical links.
[0099] A logical link is a link formed after the network layer and transport layer in the TCP / IP protocol are successfully established between two devices. The process of establishing a logical link between two devices includes: establishing a transport layer connection (such as the User Datagram Protocol (UDP) / TCP layer in the TCP / IP protocol, etc.) between the two devices, such as establishing an encrypted socket security channel. According to the requirements of the business scenario, the negotiation of communication keys between devices can also be carried out during the process of establishing a logical link. Subsequent services transmit data based on the established logical link.
[0100] It should be noted that the physical link is static, and its parameters such as maximum bandwidth and maximum throughput are fixed; while the logical link is dynamically changing. A logical link can be dynamically carried on any physical link. A new logical link can be created in the physical link according to the network conditions, and a logical link can also be deleted. The bandwidth of the logical link in the physical link also changes dynamically.
[0101] In the era of the Internet of Everything, a full-scenario distributed operating system needs to improve the efficiency of data sharing between devices, achieve seamless collaborative experience across devices, and enable users to enjoy the same experience between local and remote devices. The connection delay between devices is an important indicator for evaluating data sharing efficiency. In the related technology, if the devices are always connected, the connection delay is zero, but it also means higher device power consumption. If the connection between devices is started only when a certain device is selected for data transmission, it means a higher connection delay. How to reduce the connection delay while ensuring relatively low device power consumption, the related technology has not yet provided a suitable and effective solution.
[0102] Please refer to Figure 1 , which shows a schematic diagram of the link connection strategy provided by the relevant technology and the embodiment of the present application in the scenario of data sharing between devices via Wifi. Figure 1 As shown, in the related art, data sharing between devices via Wifi mainly includes the following two possible implementation methods. The first possible implementation method is a link constant connection scheme, that is, after the first device turns on the Wifi function, it keeps the physical link working all the time, performs device discovery when a trigger signal of the data to be shared is detected, and displays multiple discovered second devices after the device discovery is successful. When a selected signal of a second device is detected, a logical link is established, and data is transmitted after the logical link is successfully established. After the service is completed, the first device actively disconnects the logical link, but still maintains the physical link. However, in this implementation method, the physical link between devices is always in working condition, ensuring a low connection delay, but this results in higher device power consumption and a shorter standby time.
[0103] The second possible implementation is a scheme of connecting when the link is in use, that is, the first device performs device discovery when detecting a trigger signal of the data to be shared, and displays multiple discovered second devices after the device discovery is successful. When a selection signal of a second device is detected, a physical link is established, and a logical link is established after the physical link is successfully established. After the logical link is successfully established, data transmission is performed. However, in this implementation, since both the physical link and the logical link are established after the second device is selected, the period required for the connection between devices is relatively long, usually requiring 1-2 seconds to complete, resulting in a long connection delay between devices and low data sharing efficiency.
[0104] The data transmission method provided in the embodiment of the present application intelligently determines the link connection timing, that is, when the first device detects a preset trigger signal acting on the data to be shared, it performs device discovery; when the Wi-Fi direct connection functions of the first device and the discovered n second devices are all turned on, the first device establishes a physical link with the discovered n second devices, thereby avoiding the situation in the related art where the devices are always connected, resulting in high device power consumption, ensuring relatively low device power consumption and extending the standby time of the device; and when the first device detects a selection signal from one of the second devices, namely the target device, it sends the data to be shared to the target device. Since the first device has established a physical link with the n second devices before selecting the target device for data transmission, it avoids the situation in the related art where the connection between devices is started only when a certain device is selected for data transmission, resulting in high connection delay, thereby reducing the connection delay between devices and improving data sharing efficiency.
[0105] Optionally, after the logical link is established, a Secure Sockets Layer (SSL) encrypted connection is also established between the devices, which is not limited in the embodiments of the present application.
[0106] Please refer to Figure 2 , which shows a schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application.
[0107] The electronic device is a device with a Wifi function. Optionally, the electronic device also has a Bluetooth function.
[0108] The electronic device is the first device or the second device in the embodiment of the present application. The first device is also called a discovery device or a sending end device, and the second device is also called a discovered device or a receiving end device.
[0109] For example, the electronic device is a mobile phone, a vehicle terminal, an unmanned aerial vehicle, a tablet computer, an e-book reader, smart glasses, a smart watch, a Moving Picture Experts Group Audio Layer III (MP3) player, a Moving Picture Experts Group Audio Layer IV (MP4) player, a notebook computer, a laptop computer, a desktop computer, etc. The embodiments of the present application do not limit the type of electronic device.
[0110] like Figure 2 As shown, the electronic device includes a processor 10, a memory 20, a communication interface 30 and a display screen 40. Those skilled in the art will understand that Figure 2The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0111] The processor 10 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 20, and calling data stored in the memory 20, the processor 10 performs various functions of the electronic device and processes data, thereby controlling the electronic device as a whole. The processor 10 can be implemented by a CPU or a graphics processing unit (GPU).
[0112] The memory 20 can be used to store software programs and modules. The processor 10 executes various functional applications and data processing by running the software programs and modules stored in the memory 20. The memory 20 may mainly include a program storage area and a data storage area. Among them, the program storage area may store an operating system 21, a processing module 22, a sending module 23, and an application 24 required for at least one function; the data storage area may store data created according to the use of the electronic device. The memory 20 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a disk or an optical disk. Accordingly, the memory 20 may further include a memory controller to provide the processor 10 with access to the memory 20 .
[0113] The display screen 40 is used to display images, videos, etc. The display screen 40 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens 40, where N is a positive integer greater than 1. The display screen 40 can be used to display information input by a user or information provided to a user and various graphical user interfaces (GUI). For example, the display 40 can display photos, videos, web pages, or files, etc. For another example, the display 40 can display a graphical user interface. Among them, the graphical user interface includes a status bar, a hidden navigation bar, a time and weather widget, and application icons, such as a browser icon. The status bar includes the operator name, mobile network (such as 4G), time and remaining power. The navigation bar includes a back key icon, a home key icon and a forward key icon. In addition, it can be understood that in some embodiments, the status bar may also include a Bluetooth icon, a Wi-Fi icon, an external device icon, etc. It can also be understood that in other embodiments, the graphical user interface may also include a Dock bar, and the Dock bar may include commonly used application icons, etc. When the processor 10 detects a touch event of a user's finger (or a stylus, etc.) on a certain control, in response to the touch event, the user interface corresponding to the control is opened and displayed on the display 40.
[0114] In the embodiment of the present application, the display screen 40 may be an integrated flexible display screen, or a spliced display screen consisting of two rigid screens and a flexible screen located between the two rigid screens.
[0115] After the processor 10 runs the data transmission method provided in the embodiment of the present application, the electronic device can establish a connection with other electronic devices through the antenna 1, antenna 2 or a universal serial bus (USB) interface, and transmit data according to the data transmission method provided in the embodiment of the present application and control the display screen 40 to display a corresponding user interface.
[0116] When the electronic device is the first device in the embodiment of the present application, the processor 20 performs the following functions by running the processing module 22: performing device discovery when a preset trigger signal acting on the data to be shared is detected; establishing a physical link with the n second devices discovered, and the Wifi direct connection functions of the first device and the n second devices are turned on; the processor 20 performs the following functions by running the sending module 23: sending the data to be shared to the target device when a selection signal of the target device is detected, and the target device is one of the n second devices.
[0117] Below, several exemplary embodiments are used to introduce the data transmission method provided in the embodiments of the present application.
[0118] Please refer to Figure 3 , which shows a flow chart of a data transmission method provided by an exemplary embodiment of the present application, and this embodiment is illustrated by using the method in a data transmission system including a first device and n second devices. The method includes the following steps.
[0119] Step 301 : When a first device detects a preset trigger signal acting on data to be shared, device discovery is performed.
[0120] Optionally, when the first device detects a preset trigger signal acting on the data to be shared, the first device determines whether the Wifi direct connection function of the first device is turned on; if the Wifi direct connection function of the first device is not turned on, turn on the Wifi direct connection function and perform device discovery; if the Wifi direct connection function of the first device is turned on, directly perform device discovery.
[0121] The Wifi Direct function has higher power consumption than the normal standby state, and there is a certain connection time (for example, the connection time is any value from hundreds of milliseconds to several seconds). Optionally, the Wifi Direct function is a Wifi peer-to-peer (P2P) service, or a Wifi Neighborhood Aware Networking (NAN) service, or a manufacturer's proprietary Wifi connection service. This embodiment of the application is not limited to this.
[0122] Optionally, the type of data to be shared includes at least one of a link, a picture, an audio, a video, a text, an application, a file, and an instruction, which is not limited in the embodiment of the present application.
[0123] The preset trigger signal is a user operation signal for triggering device discovery. In an exemplary embodiment, the preset trigger signal includes any one or more combinations of a click operation signal, a slide operation signal, a press operation signal, and a long press operation signal.
[0124] In a possible implementation, the preset trigger signal is a second trigger signal acting on a sharing control of the data to be shared. In an illustrative example, when the first device detects the first trigger signal acting on the data to be shared, the sharing control corresponding to the data to be shared is displayed, and when the second trigger signal acting on the sharing control is detected, device discovery is performed and a sharing interface is displayed.
[0125] In other possible implementations, the preset trigger signal can also be implemented in the form of voice. Illustratively, the first device receives a voice signal input by a user, parses the voice signal to obtain voice content, and when there are keywords matching the preset information corresponding to the data to be shared in the voice content, the preset trigger signal acting on the data to be shared is detected.
[0126] Optionally, when the first device detects a preset trigger signal acting on the data to be shared, device discovery is performed and a sharing interface is displayed, wherein the sharing interface includes a device identifier of the discovered second device or a first prompt message, and the first prompt message indicates that the second device has not been discovered.
[0127] Optionally, during the device discovery process, the first device sequentially displays device identifiers of discovered second devices in the sharing interface.
[0128] Step 302: The first device establishes a physical link with the discovered n second devices, and the Wifi direct connection functions of the first device and the n second devices are all turned on.
[0129] Optionally, each time a second device is discovered, the first device establishes a physical link with the discovered second device. Alternatively, after the device discovery of n second devices is successful, the first device establishes a physical link with the discovered n second devices.
[0130] For any second device among the n second devices, the Wifi direct connection function of the second device may be enabled when the second device is discovered, or may be enabled after the second device is discovered.
[0131] It should be noted that the first device establishes a physical link with the discovered n second devices, and the physical connection between the first device and the second device may be actively established by the first device or the second device. This embodiment of the application does not limit this.
[0132] Optionally, after the first device successfully establishes a physical link with the n second devices, the first device establishes a logical link with the n second devices, that is, both the physical link and the logical link are established before the user selects the target device, further shortening the connection delay between the devices, so that when the first device detects the selection signal of the target device, it can immediately transmit data with the target device. Schematically, the logical link is an encrypted socket security channel.
[0133] However, since the first device will subsequently transmit data with a selected second device, namely the target device, if a logical link is established between the first device and each of the n second devices before that, unnecessary resource occupation will result. Therefore, the first device can select at least one second device from the n second devices and establish a logical link with the selected at least one second device.
[0134] It should be noted that the process of establishing a logical link between the first device and at least one of the n second devices may refer to the relevant details in the following embodiments, which will not be introduced here.
[0135] Step 303: When the first device detects a selection signal from a target device, the first device sends the data to be shared to the target device, where the target device is one of the n second devices.
[0136] The target device selection signal is a user operation signal for triggering the sending of the to-be-shared data to the target device. Schematically, the selection signal includes any one or more combinations of a click operation signal, a slide operation signal, a press operation signal, and a long press operation signal.
[0137] In one possible implementation, after the device is discovered successfully, the first device displays a device identification list, which includes the device identification corresponding to each of the n discovered second devices; when the first device receives a selection operation signal acting on the device identification in the device identification list, it means that the first device detects the selection signal of the second device corresponding to the device identification, i.e., the target device, and the first device performs data transmission with the target device, and the data transmission process includes the first device sending the data to be shared to the second device.
[0138] In other possible implementations, the selected signal of the target device may also be implemented in the form of voice, which is not limited in the embodiments of the present application.
[0139] Optionally, after the first device completes sending the data to be shared to the target device, it outputs a second prompt message, the second prompt message indicating that the data to be shared is successfully sent. Schematically, the second prompt message includes at least one of text, graphics, prompt sound, and flash light.
[0140] In an illustrative example, Figure 4 As shown, the data to be shared are three selected pictures. When device 1 detects a click operation signal (i.e., a preset trigger signal) acting on the sharing control 41, device discovery is performed and a sharing interface 42 is displayed (corresponding to the above step 301). During the device discovery process, device 1 displays the device identification "John's P40" of the discovered device 2 and the device identification "printer in the living room" of the device 3 in the sharing interface 42 in sequence, and device 1 establishes a physical link and a logical link with the discovered device 2 and device 3 respectively (corresponding to the above step 302). When device 1 detects a click operation signal (i.e., a selection signal) acting on the device identification "John's P40" of device 2, device 1 sends the selected three pictures to device 2 (corresponding to the above step 303). After the three pictures are sent, device 1 displays a prompt message "Sent successfully" on the sharing interface 42.
[0141] To summarize, when the first device detects a preset trigger signal acting on the data to be shared, device discovery is performed; the first device establishes a physical link with the discovered n second devices, thereby avoiding the situation in the related art where the devices are always connected, resulting in higher device power consumption, ensuring relatively low device power consumption and extending the standby time of the device; and, since the first device has established a physical link with the n second devices before selecting the target device for data transmission, the situation in the related art where the connection between devices is started only when a certain device is selected for data transmission, resulting in higher connection delay, is avoided, thereby reducing the connection delay between devices and improving data sharing efficiency.
[0142] Please refer to Figure 5 , which shows a flow chart of a data transmission method provided by another exemplary embodiment of the present application, and this embodiment is illustrated by using the method in a data transmission system including a first device and n second devices. The method includes the following steps.
[0143] Step 501: When a first device detects a preset trigger signal acting on data to be shared, the first device sends first information.
[0144] Optionally, when the first device detects a preset trigger signal acting on the data to be shared, the first device determines whether the Wifi direct connection function of the first device is turned on; if the Wifi direct connection function of the first device is not turned on, the Wifi direct connection function is turned on and the first information is sent; if the Wifi direct connection function of the first device is turned on, the first information is sent.
[0145] It should be noted that the step of enabling the Wi-Fi direct connection function of the first device can be executed before the step of sending the first information, or can be executed after the step, or can be executed in parallel, which is not limited in the embodiment of the present application.
[0146] Optionally, the first information is the first broadcast information. The first device sends the first broadcast information through a preset broadcast method, and the preset broadcast method is a broadcast method other than the Wifi direct connection function. Schematically, the preset broadcast method includes any one of Bluetooth (Bluetooh, BT) broadcast, Bluetooth low energy technology (Bluetooh Low Energy, BLE) broadcast, UltraWide Band (UWB) broadcast, WiFi broadcast, and near field communication technology (near field communication, NFC) broadcast. This embodiment of the present application is not limited to this.
[0147] In a possible implementation, the first information instructs the second device to enable a Wi-Fi direct connection function.
[0148] In another possible implementation, the first information carries a designated identifier, which indicates that the second device turns on the Wi-Fi direct connection function. For example, the designated identifier is 1, which is not limited in the embodiment of the present application.
[0149] Optionally, the first information includes a device identifier of the first device, first status information and first device information, the device identifier of the first device is used to uniquely identify the first device among multiple devices, and the first status information indicates that the device status of the first device is a state in which the Wi-Fi direct connection function is turned on and device discovery is performed.
[0150] The first device information indicates the attribute information of the first device, and optionally, the first device information includes at least one of the account information logged in on the first device, the device type, the device model, and the device identification of the first device. This embodiment of the application does not limit this.
[0151] Step 502: n second devices perform a second operation according to the received first information.
[0152] Optionally, the n second devices perform a second operation according to the received first information, including: for any second device among the n second devices, after receiving the first information sent by the first device, the second device determines whether the Wifi direct connection function of the second device is turned on, and if the Wifi direct connection function of the second device is not turned on, turns on the Wifi direct connection function. If the Wifi direct connection function of the second device is turned on, execute the subsequent step 503.
[0153] Optionally, the second device turns on the Wi-Fi direct connection function and feeds back response information to the first device. Correspondingly, the first device receives the response information fed back by the second device.
[0154] Optionally, the second device determines whether it needs to respond to the first information before determining whether the Wifi Direct function of the second device is turned on. In an illustrative example, after receiving the first information sent by the first device, the second device determines whether a third preset condition is met. If the third preset condition is met, it determines whether the Wifi Direct function of the second device is turned on and performs subsequent response steps; if the third preset condition is not met, the first information is ignored.
[0155] Illustratively, the third preset condition includes that the second device supports the Wifi Direct function, and the second device is not currently transmitting data with other devices. This embodiment of the present application is not limited to this.
[0156] Step 503: The first device establishes a physical link with the discovered n second devices.
[0157] The physical connection between the first device and the second device may be actively established by the first device or the second device.
[0158] Optionally, for any second device among the n second devices, the second device establishes a physical link with the first device according to the received first information.
[0159] Optionally, the second device feeds back response information based on the received first information, and establishes a physical link with the first device.
[0160] It should be noted that the step of the second device feeding back the response information may not be performed, and may be performed simultaneously with the step of establishing a physical link with the first device, or in a sequential order. This embodiment of the application is not limited to this.
[0161] After receiving the first information sent by the first device, the second device may directly establish a physical link with the first device, or may establish a physical link with the first device based on the connection information.
[0162] Illustratively, the second device feeds back response information to the first device. If the first device allows the second device to establish a physical link, the first device sends connection information to the second device, and the second device establishes a physical link with the first device based on the received connection information.
[0163] Optionally, the connection information includes frequency information and / or a media access control (MAC) address of the Wi-Fi of the first device. The frequency information indicates the frequency used to transmit data, for example, the frequency information is 160 MHz. This embodiment of the present application is not limited to this.
[0164] The wireless MAC address of the first device is sent by the first device. The frequency point information may be pre-set or sent by the first device.
[0165] Optionally, for any second device among the n second devices, the second device feeds back response information according to the received first information; after the first device receives the response information fed back by the second device, the first device establishes a physical link with the second device.
[0166] Optionally, the response information sent by the n second devices is received by the first device within a preset time period, where the preset time period is a preset time interval starting from the moment when the first device sends the first information, for example, the preset time period is 1 second.
[0167] Optionally, the response information includes a device identifier of the second device, second status information, and second device information, where the device identifier of the second device is used to uniquely identify the second device among multiple devices, and the second status information indicates that the device status of the second device is to enable the Wifi Direct function and wait for connection. The second device information indicates attribute information of the second device, such as the second device information including account information logged in on the second device. This embodiment of the application is not limited to this.
[0168] In a possible implementation, the above steps 501, 502 and 503 can be replaced and implemented as the following steps: when the first device detects a preset trigger signal acting on the data to be shared, it sends a first message; the first device establishes a physical link with the n discovered second devices, wherein the first device and the n second devices are devices with the Wifi Direct function turned on. It should be noted that the relevant details of each step can be referred to the relevant description in the above embodiment, and will not be repeated here. Step 504, the first device establishes a logical link with at least one of the n second devices.
[0169] Optionally, the first device sorts n second devices according to a first preset rule, and establishes a logical link with the first m second devices after the sorting, where m is a positive integer less than n.
[0170] Optionally, the first device sorts the n second devices according to device information corresponding to each of the n second devices and a first preset rule, wherein the second device information indicates attribute information of the second device.
[0171] Illustratively, the second device information includes at least one of the number of historical connections between the second device and the first device, the distance between the second device and the first device, the historical connection time between the second device and the first device, the number of historical uses of the Wifi Direct function by the second device, the device type of the second device, and the service information corresponding to the second device. This embodiment of the application is not limited to this.
[0172] Optionally, the first preset rule indicates that the sorting order of the second device is related to the estimated probability of the second device being selected. Illustratively, the sorting order of the second device is negatively correlated with the estimated probability of the second device being selected, that is, the greater the estimated probability of a second device being selected among the n second devices, the higher the sorting order of the second device, and the smaller the sorting number of the second device.
[0173] Optionally, the first preset rule includes at least one of the following: a least recently used (Least Recently Used, LRU) rule (i.e., in order of historical connection times from large to small), in order of historical connection times from near to far, in order of distances from near to far, in order of historical usage times from large to small, and in order of the degree of matching between device type and / or service information and the data transmission service of the first device from high to low.
[0174] The first device sorts the n second devices according to the device information corresponding to each of the n second devices and the first preset rule, including but not limited to the following possible implementations:
[0175] In a possible implementation, the first device sorts the n second devices in descending order according to their historical connection times, wherein the historical connection times of the second devices are the times the second devices are connected to the first device in a preset time period in history.
[0176] In another possible implementation, the first device sorts the n second devices in order of distances from the first device from near to far.
[0177] In another possible implementation, the first device sorts the n second devices in order of their historical connection times from recent to far, wherein the historical connection time of the second device is the time of the most recent connection between the second device and the first device in history.
[0178] In another possible implementation, the first device sorts the n second devices in descending order according to the historical usage times of the n second devices, wherein the historical usage times of the second devices are the times that the second devices have used the Wifi Direct function in history.
[0179] In another possible implementation, the first device sorts the n second devices in descending order according to the degree of matching between device types and / or service information of the n second devices and the data transmission service of the first device.
[0180] The device type of the second device indicates the type of electronic device to which the second device belongs. Optionally, the device type includes one of a terminal device and an Internet of Things (IoT) device, where the IoT device is a device connected to the IoT. For example, the terminal device is a mobile phone, and the IoT device is a printer. The embodiment of the present application does not limit the setting method of the device type.
[0181] The service information of the second device indicates the services supported by the second device. For example, if the second device is a printer, the service information of the second device may indicate that the second device supports data transmission services and printing services. The embodiment of the present application does not limit the setting method of the service information.
[0182] It should be noted that the above-mentioned possible implementations can be implemented individually, in pairs, in combination, in combination with any three possible implementations, in combination with any four possible implementations, or in combination with all five possible implementations. This is not limited in the embodiments of the present application.
[0183] For a second device among the n second devices, after the first device completes establishing a physical link with the second device, the first device establishing a logical link with the second device includes: the first device establishing a logical link with the second device according to the IP address of the second device. Alternatively, the first device establishes a logical link with the second device according to the IP address and port number of the second device. The port number may be pre-set or sent by the second device.
[0184] Step 505: When the first device detects a selection signal from the target device, the first device sends the data to be shared to the target device.
[0185] Optionally, after receiving response information sent by n second devices, the first device displays a device identification list, which includes device identifications corresponding to each of the n second devices; when the first device receives a selection operation signal acting on a device identification in the device identification list, it means that the first device detects a selection signal from the second device corresponding to the device identification, i.e., the target device, and the first device determines whether the target device meets a first preset condition, which includes that a physical link and a logical link are established between the first device and the target device.
[0186] Optionally, when the first device detects that the target device meets the first preset condition, which indicates that a physical link and a logical link are established between the first device and the target device, the first device directly sends the data to be shared to the target device.
[0187] Optionally, when the first device detects that the target device does not meet the first preset condition, it means that a physical link but no logical link is established between the first device and the target device. Then, the first device establishes a logical link with the target device. After the logical link is successful, the first device sends the data to be shared to the target device.
[0188] In an embodiment of the present application, the n second devices can decide the timing of opening and disconnecting the physical link and / or logical link between the n second devices and the first device. Optionally, for at least one second device among the n second devices, a countdown is started after receiving the first information; after the countdown times out, at least one second device turns off the Wifi Direct function or enters a low power consumption state.
[0189] The second device shutting down the Wifi direct function includes: the second device disconnecting the physical link and the logical link with the first device. The second device entering the low power consumption state includes: the second device disconnecting the logical link with the first device but maintaining the physical link with the first device.
[0190] Optionally, the low power state is a state in which data is only received but not sent, or the low power state is a state in which a sleep mode and a wake-up mode are periodically switched, wherein the second device does not receive data and does not send data in the sleep mode, and the second device only receives data but does not send data in the wake-up mode. Schematically, the duration of the sleep mode is greater than the duration of the wake-up mode. The embodiment of the present application does not limit the setting method of the low power state.
[0191] Optionally, the countdown is stopped after the second device completes the establishment of the logical link with the first device.
[0192] Optionally, for each second device, the second device obtains response information sent by n-1 other second devices to the first device, and the response information includes second device information; the second device sorts the n second devices according to the second device information corresponding to each of the n second devices (that is, the device information of the second device and the device information corresponding to each of the n-1 other second devices) according to a second preset rule, and determines the countdown duration of the second device according to the sorting result.
[0193] Optionally, the second device determines the countdown duration of the second device according to the sorting result, including: if the second device is in the first k after sorting, then the countdown duration of the second device is determined to be a first duration threshold; if the second device is not in the first k after sorting, then the countdown duration of the second device is determined to be a second duration threshold, the first duration threshold is greater than or equal to the second duration threshold, and k is a positive integer less than n. This embodiment of the present application is not limited to this.
[0194] Optionally, the countdown duration of the second device with which the logical link has been established is greater than or equal to the countdown duration of the second device with which the logical link has not been established.
[0195] Optionally, when the first device detects the selected signal of the target device, the second information is sent; and the second devices other than the target device turn off the Wi-Fi direct connection function or enter a low power consumption state according to the received second information.
[0196] The second information indicates that the first device and the target device are performing data transmission.
[0197] Optionally, after the data transmission between the first device and the target device is completed, the first device sends third information; and the other n second devices except the target device enable the Wifi direct connection function according to the received third information.
[0198] Optionally, after the data transmission between the first device and the target device is completed, the first device displays a device identification list and sends a third message, where the third message indicates that the data transmission between the first device and the target device is completed. For any second device among the n second devices other than the target device, the second device turns on the Wifi Direct function according to the received third information. After the second device turns on the Wifi Direct function, the first device re-establishes a physical link with the second device, or the first device re-establishes a physical link and a logical link with the second device. The first device again executes the step of sending the data to be shared to the second device when a selection signal of one of the second devices is detected.
[0199] Optionally, after the data transmission between the first device and the target device is completed, the target device turns off the Wifi Direct function, or keeps the Wifi Direct function turned on.
[0200] It should be noted that the process of the first device re-establishing a physical link and a logical link with the second device, and the first device re-executing the step of sending the data to be shared to the second device when a selection signal from one of the second devices is detected can be analogously referred to the description of the above-mentioned related steps, and will not be repeated here.
[0201] Optionally, after the broadcast service ends, the first device sends fourth information; the n second devices turn off the Wifi Direct function or enter a low power consumption state according to the received fourth information, wherein the fourth information indicates that the broadcast service of the first device ends.
[0202] It should be noted that the second information, the third information, and the fourth information in the embodiment of the present application may be broadcast information, which is sent in a preset broadcast mode. The process of sending the second information, the third information, or the fourth information in a preset broadcast mode can be analogously referred to the relevant details of sending the first information in the preset broadcast mode, and will not be repeated here.
[0203] In an illustrative example, the first device is device 1, the n second devices include device 2, device 3 and device 4, the target device is device 2, and the data transmission method includes the following steps: Figure 6 As shown: Step 601, when device 1 detects a preset trigger signal acting on the data to be shared, the Wifi direct function is turned on; Step 602, device 1 sends a first message through BLE broadcast; Step 603, device 2, device 3 and device 4 turn on the Wifi direct function according to the received first information; Step 604, device 2, device 3 and device 4 feedback response information to device 1; Step 605, device 1 establishes a physical link with device 2, device 3 and device 4 respectively; Step 606, device 1 connects device 2, device 3 and device 4 according to the first preset rule and device 4 are sorted, and a logical link is established with the first two devices (device 2 and device 3) after sorting; step 607, device 1 detects the selection signal of device 2; step 608, device 1 and device 2 perform data transmission (including device 1 sending the data to be shared to device 2); step 609, device 3 decides whether to disconnect the logical link and / or physical link with device 1, and device 4 decides whether to disconnect the physical link with device 1; step 610, after the data transmission between device 1 and device 2 is completed, device 2 disconnects the logical link and physical link with device 1.
[0204] It should be noted that the above step 605 may be performed before step 604, or after step 604, or in parallel with step 604. The above step 609 may be performed before step 607 and step 608, or after step 607 and step 608, or in parallel with step 607 and step 608. In addition, the relevant details of each step in the above example can be referred to the relevant description in the above embodiment, which will not be repeated here.
[0205] It should be noted that, in a possible implementation, the device state of the electronic device includes but is not limited to the following possible states.
[0206] Optionally, the device state of the first device includes a first main state, a second main state, a third main state and a fourth main state.
[0207] The first main state is a state in which the Wifi Direct function is turned off. In this state, no physical link and no logical link are established between the first device and each second device.
[0208] The second main state is the state of turning on the Wifi Direct function and performing device discovery. In this state, the first device discovers surrounding second devices, establishes physical links with n discovered second devices, and selects m of the second devices to establish logical links, where n is a positive integer and m is a positive integer less than or equal to n.
[0209] The third main state is a state of waiting for the user to select a target device. In this state, the first device establishes physical links with n second devices, and the first device also establishes logical links with m of the second devices.
[0210] The fourth main state is a data transmission state, that is, a state in which the first device and the target device are performing data transmission. In this state, a physical link and a logical link are established between the first device and the target device.
[0211] Optionally, the device state of the second device includes a first slave state, a second slave state, a third slave state, a fourth slave state and a fifth slave state.
[0212] The first slave state is a state in which the Wifi Direct function is turned off, in which no physical link and no logical link are established between the second device and the first device.
[0213] The second slave state is a state in which the Wifi direct function is turned on and the device is waiting for connection. In this state, the second device waits for the first device to establish a physical link and / or a logical link.
[0214] The third slave state is a state of waiting for data transmission, that is, a state in which the second device waits for the first device to send data. In this state, a physical link and a logical link are established between the second device and the first device.
[0215] The fourth slave state is a data transmission state, that is, a state in which the target device and the first device are performing data transmission, in which a physical link and a logical link are established between the target device and the first device.
[0216] The fifth slave state is a state in which the Wifi direct connection function is turned off or a low power consumption state. In the low power consumption state, a physical link is established between the second device and the first device, but no logical link is established.
[0217] Based on the device status described above, please refer to Figure 7, which shows a flow chart of a data transmission method provided by another exemplary embodiment of the present application, and this embodiment is illustrated by using the method in a data transmission system including a first device and n second devices. The method includes the following steps.
[0218] Step 701: When the first device detects a preset trigger signal acting on the data to be shared, the device state is switched from the first main state to the second main state, and the first information is sent.
[0219] The first information indicates that the device state of the first device is the second main state. The first main state is a state in which the Wifi direct function is turned off, and the second main state is a state in which the Wifi direct function is turned on and device discovery is performed.
[0220] Step 702: When the second device receives the first information sent by the first device, the device state is switched from the first slave state to the second slave state.
[0221] Taking the second device as an example, which is a device that supports the Wifi Direct function and is not currently transmitting data with other devices, for each second device, when the second device receives the first information sent by the first device, the device state is switched from the first slave state to the second slave state. The response information indicates that the device state of the second device is the second slave state. The first slave state is a state in which the Wifi Direct function is turned off, and the second slave state is a state in which the Wifi Direct function is turned on and waiting for connection.
[0222] Optionally, the second device switches the device state from the first slave state to the second slave state, and feeds back response information to the first device.
[0223] Step 703: The second device establishes a physical link with the first device.
[0224] Step 704: After the first device establishes a physical link with the n second devices, the first device establishes a logical link with at least one second device among the n second devices according to a first preset rule.
[0225] It should be noted that the process of the first device establishing a logical link with at least one of the n second devices according to the first preset rule can refer to the relevant details in the above embodiment, which will not be repeated here.
[0226] Optionally, for each second device, after the second device receives the first information sent by the first device, the countdown is started; after the countdown times out, the Wi-Fi direct connection function is turned off or the device enters a low power consumption state, that is, the device state of the second device is set to the fifth slave state.
[0227] Optionally, after successfully establishing the logical link, the first device switches the device state from the second master state to the third master state, where the third master state is a state of waiting for the user to select a target device. The second device that has established the logical link stops the countdown and switches the device state from the second slave state to the third slave state, where the third slave state is a state of waiting for data transmission.
[0228] Step 705: When the first device detects the selection signal of the target device, the device state is switched from the third main state to the fourth main state, and the second information is sent.
[0229] When the first device detects the selection signal of the target device, it switches the device state from the third main state to the fourth main state, performs data transmission with the target device, and sends second information. The second information indicates that the device state of the first device is the fourth main state, and the fourth main state is a data transmission state, indicating that the first device and the target device are performing data transmission.
[0230] Correspondingly, the target device receives the data and switches the device state from the third slave state to the fourth slave state, where the fourth slave state is a data transmission state.
[0231] Optionally, after receiving the second information, the second devices other than the target device turn off the Wifi direct connection function or enter a low power consumption state, that is, set the device state to the fifth slave state.
[0232] After the data transmission between the first device and the target device is completed, the first device displays a device identification list, switches the device state from the fourth master state to the second master state, and sends the third information, which indicates that the data transmission between the first device and the target device is completed; after receiving the third information, each second device resets the device state to the second slave state and waits for the connection of the first device.
[0233] Optionally, after the broadcast service ends, the first device sets the device state to the first master state and sends fourth information, where the fourth information indicates that the broadcast service of the first device ends; after receiving the fourth information, the second device resets the device state to the fifth slave state.
[0234] In an illustrative example, the first master state is state A0, the second master state is state A1, the third master state is state A2, the fourth master state is state A3, the first slave state is state B0, the second slave state is state B1, the third slave state is state B2, the fourth slave state is state B3, and the fifth slave state is state B4. For example, a user discovers multiple devices B that meet the conditions around through device A and selects one device C for data transmission. Figure 8As shown in Figure (a), when device A detects a preset trigger signal for the data to be shared, it discovers surrounding devices through BLE broadcast and turns on its own Wifi Direct function (state A1). Surrounding eligible devices B (for example, 4 devices B) respond to device A through BLE broadcast and turn on their own Wifi Direct function (state B1). Among them, the 4 devices B start the countdown after entering the waiting state (state B1). After the countdown times out, they turn off their own Wifi Direct function or enter the low power state (state B4).
[0235] like Figure 8 As shown in Figure (b), device A receives the response information sent by each of the four devices B within a preset time period (e.g., 1 second) and establishes a physical link with the four devices B. Device A sorts the four devices B and selects two of them for pre-connection, i.e., to establish a logical link. The two devices B that have established the logical link stop the countdown and enter the state of waiting for data transmission (state B2), and device A enters the state of waiting for the user to select a target device (state A2).
[0236] like Figure 8 As shown in Figure (c), when device A detects the selected signal of device C, device A and device C perform data transmission, device A enters the data transmission state (state A3), and device C enters the data transmission state (state B3). Device A sends information indicating that data transmission is in progress, and after receiving the information, the other three devices B except device C turn off their own Wi-Fi direct connection function or enter a low power consumption state (state B4).
[0237] like Figure 8 As shown in Figure (d), after the data transmission is completed, device A re-enters the state of device discovery (state A1), and the four surrounding devices B re-enter state B1 and re-execute the above steps. After the countdown times out, or when each device B receives information indicating that device A is transmitting data with other devices, or when it receives information indicating that the broadcast service of the first device has ended, it turns off its own Wi-Fi direct connection function or enters a low power consumption state (state B4).
[0238] To sum up, the embodiment of the present application also reduces the power consumption of other second devices except the target device by sending a second message to notify other second devices except the target device to turn off the Wi-Fi direct connection function or enter a low power consumption state after the data transmission starts.
[0239] The embodiment of the present application further reduces the connection delay between devices and improves data sharing efficiency by causing the first device to redisplay the device identification list after data transmission is completed, and notifying the surrounding second device to start the Wi-Fi direct connection function and wait for connection by sending a third message.
[0240] The embodiment of the present application also starts a countdown after the second device receives the first information sent by the first device, and turns off the Wi-Fi direct connection function or enters a low power consumption state after the countdown times out, so that the second device can intelligently decide whether to disconnect the physical link and / or logical link with the first device, thereby avoiding unnecessary device power consumption.
[0241] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0242] Please refer to Fig. 9 , which shows a block diagram of a data transmission device provided by an exemplary embodiment of the present application. The device can be implemented by software, hardware or a combination of both. Figure 2 The whole or part of the electronic device provided may include: a sending unit 910 and a processing unit 920.
[0243] The sending unit 910 is used to perform device discovery when a preset trigger signal acting on the data to be shared is detected;
[0244] The processing unit 920 is configured to establish a physical link with the discovered n second devices, wherein the Wi-Fi direct connection functions of the first device and the n second devices are both enabled;
[0245] The sending unit 910 is further configured to send the to-be-shared data to the target device when a selection signal of the target device is detected, where the target device is one of the n second devices.
[0246] In a possible implementation, the sending unit 910 is further configured to:
[0247] When a preset trigger signal acting on the data to be shared is detected, sending first information;
[0248] Among them, for any second device among the n second devices, the physical link between the second device and the first device is established by the second device according to the received first information, or is established by the first device after receiving the response information fed back by the second device.
[0249] In another possible implementation, the processing unit 920 is further configured to establish a logical link with at least one second device among the n second devices;
[0250] The sending unit 910 is further configured to send the data to be shared to the target device when a selection signal of the target device is detected and the target device meets a first preset condition;
[0251] The first preset condition includes that a physical link and a logical link are established between the first device and the target device.
[0252] In another possible implementation, the processing unit 920 is further configured to establish a logical link with the target device when a selection signal of the target device is detected and the target device does not meet the first preset condition;
[0253] The sending unit 910 is further configured to, after the logical link is successfully established, enable the first device to send the data to be shared to the target device.
[0254] In another possible implementation, the processing unit 920 is further configured to:
[0255] sorting the n second devices according to a first preset rule;
[0256] Establishing a logical link with the first m second devices after sorting, where m is a positive integer less than n;
[0257] The first preset rule indicates that the sorting order of the second devices is related to the estimated probability of the second device being selected.
[0258] In another possible implementation, the first information further instructs at least one of the n second devices to start a countdown after receiving the first information, and to turn off the Wifi direct connection function or enter a low power consumption state after the countdown times out.
[0259] In another possible implementation, the sending unit 910 is further configured to send second information when a selection signal of the target device is detected, where the second information instructs other second devices except the target device to turn off the Wi-Fi direct connection function or enter a low power consumption state.
[0260] In another possible implementation, the sending unit 910 is further configured to send third information after the data transmission with the target device is completed, where the third information instructs n second devices other than the target device to enable the Wi-Fi direct connection function.
[0261] In another possible implementation, the sending unit 910 is further configured to send fourth information after the broadcast service ends, where the fourth information instructs the n second devices to turn off the Wi-Fi direct connection function or enter a low power consumption state.
[0262] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0263] An embodiment of the present application provides an electronic device, which includes: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement the method performed by the first device or the second device in the above embodiment when executing the instructions.
[0264] An embodiment of the present application provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the method performed by the first device or the second device in the above embodiment.
[0265] An embodiment of the present application provides a data transmission system, which includes a first device and n second devices. The first device executes the method executed by the first device in the above embodiment, and the second device executes the method executed by the second device in the above embodiment.
[0266] An embodiment of the present application provides a non-volatile computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method performed by the first device or the second device in the above embodiment is implemented.
[0267] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing.
[0268] The computer-readable program instructions or codes described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0269] The computer program instructions for performing the operation of the present application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, by utilizing the state information of computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit can execute the computer-readable program instructions to implement various aspects of the present application.
[0270] Various aspects of the present application are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0271] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0272] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0273] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the device, system, method and computer program product according to multiple embodiments of the present application. In this regard, each square frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the square frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square frames can actually be executed substantially in parallel, and they can also be executed in reverse order sometimes, depending on the functions involved.
[0274] It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by hardware (such as a circuit or ASIC (Application Specific Integrated Circuit)) that performs the corresponding function or action, or can be implemented by a combination of hardware and software, such as firmware.
[0275] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0276] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A data transmission method, characterized in that: Used in a data transmission system, the data transmission system comprising a first device and n second devices, wherein n is a positive integer, the method comprising: Performing device discovery when the first device detects a preset trigger signal acting on the data to be shared; The first device establishes a physical link with the discovered n second devices, and Wifi direct connection functions of the first device and the n second devices are both turned on; When the first device detects a selection signal from a target device, the first device sends the data to be shared to the target device, where the target device is one of the n second devices.
2. The method according to claim 1, characterized in that The performing device discovery when the first device detects a preset trigger signal acting on the data to be shared includes: When the first device detects a preset trigger signal acting on the data to be shared, sending first information; The first device establishes a physical link with the discovered n second devices, including: For any second device among the n second devices, the second device establishes a physical link with the first device according to the received first information; or, after the first device receives the response information fed back by the second device, the first device establishes a physical link with the second device.
3. The method according to claim 2, characterized in that After the first device establishes a physical link with the discovered n second devices, the method further includes: The first device establishes a logical link with at least one of the n second devices; The sending the to-be-shared data to the target device when the first device detects a selection signal of the target device comprises: When the first device detects a selection signal from the target device and the target device meets a first preset condition, sending the data to be shared to the target device; The first preset condition includes that the physical link and the logical link are established between the first device and the target device.
4. The method according to claim 3, characterized in that The method further comprises: When the first device detects the selected signal of the target device and the target device does not meet the first preset condition, establishing the logical link with the target device; After the logical link is successfully established, the first device sends the data to be shared to the target device.
5. The method according to claim 3, characterized in that: The first device establishing a logical link with at least one of the n second devices includes: The first device sorts the n second devices according to a first preset rule; The first device establishes the logical link with the second device that is ranked first m after sorting, where m is a positive integer less than n; The first preset rule indicates that the sorting order of the second devices is related to the expected probability of the second devices being selected.
6. The method according to any one of claims 2 to 5, characterized in that: The method further comprises: For at least one of the n second devices, starting a countdown after receiving the first information; At least one of the second devices turns off the Wi-Fi direct connection function or enters a low power consumption state after the countdown times out.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: When the first device detects the selected signal of the target device, sending second information; The second devices other than the target device turn off the Wi-Fi direct connection function or enter a low power consumption state according to the received second information.
8. The method according to claim 6 or 7, characterized in that: The method further comprises: After the data transmission between the first device and the target device is completed, the first device sends third information; The n second devices other than the target device enable the Wi-Fi direct connection function according to the received third information.
9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: The first device sends fourth information after the broadcast service ends; The n second devices turn off the Wifi direct connection function or enter a low power consumption state according to the received fourth information.
10. A data transmission method, characterized in that: The method is used in a first device, comprising: Device discovery is performed when a preset trigger signal acting on the data to be shared is detected; Establishing physical links with the discovered n second devices, wherein the Wi-Fi direct connection functions of the first device and the n second devices are all turned on; When a selection signal of a target device is detected, the data to be shared is sent to the target device, where the target device is one of the n second devices.
11. The method according to claim 10, characterized in that The device discovery is performed when a preset trigger signal acting on the data to be shared is detected, including: When a preset trigger signal acting on the data to be shared is detected, sending first information; Among them, for any second device among the n second devices, the physical link between the second device and the first device is established by the second device according to the received first information, or is established by the first device after receiving the response information fed back by the second device.
12. The method according to claim 11, characterized in that After the physical links are established with the discovered n second devices, the method further includes: Establishing a logical link with at least one of the n second devices; The sending the to-be-shared data to the target device when a selection signal of the target device is detected includes: When a selection signal of the target device is detected and the target device meets a first preset condition, sending the data to be shared to the target device; The first preset condition includes that the physical link and the logical link are established between the first device and the target device.
13. The method according to claim 12, characterized in that The method further comprises: When a selection signal of the target device is detected and the target device does not meet the first preset condition, establishing the logical link with the target device; After the logical link is successfully established, the first device sends the data to be shared to the target device.
14. The method according to claim 12, characterized in that The establishing a logical link with at least one of the n second devices comprises: Sorting the n second devices according to a first preset rule; Establishing the logical link with the second device that is in the first m positions after sorting, where m is a positive integer less than n; The first preset rule indicates that the sorting order of the second devices is related to the expected probability of the second devices being selected.
15. The method according to any one of claims 11 to 14, characterized in that: The first information further instructs at least one of the n second devices to start a countdown after receiving the first information, and to turn off the Wifi direct connection function or enter a low power consumption state after the countdown times out.
16. The method according to any one of claims 10 to 15, characterized in that: The method further comprises: When the selection signal of the target device is detected, second information is sent, where the second information instructs the second devices other than the target device to turn off the Wifi direct connection function or enter a low power consumption state.
17. The method according to claim 15 or 16, characterized in that The method further comprises: After the data transmission between the target device is completed, third information is sent, and the third information instructs the n second devices other than the target device to enable the Wifi direct connection function.
18. The method according to any one of claims 10 to 17, characterized in that: The method further comprises: After the broadcast service ends, fourth information is sent, where the fourth information instructs the n second devices to turn off the Wifi direct connection function or enter a low power consumption state.
19. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method described in any one of claims 10-18 when executing the instructions.
20. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 10 to 18 is implemented.
