Networking method and device based on direct communication and storage medium

By establishing a first direct connection between electronic devices and automatically turning on the second direct connection communication service, the problem that the Wi-Fi direct connection function needs to be manually turned on and affects the performance of the device under normal opening state is solved, and automatic opening and performance are achieved optimization.

CN119485791APending Publication Date: 2025-02-18BOE TECHNOLOGY GROUP CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411586754.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the prior art, the Wi-Fi direct connection function needs to be turned on manually, and the normal opening state will lead to a degradation of equipment performance, such as large power consumption and resource consumption.

Method used

By establishing a first direct connection between the first electronic device and the second electronic device, the second direct connection opening command is automatically sent to the second electronic device, and the automatic activation of the second direct connection communication service is realized, thereby establishing the second direct connection Connect.

Benefits of technology

There is no need to manually enable the second direct communication service, which avoids the negative impact on the performance of the equipment under normal opening, such as reducing power consumption and resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119485791A_ABST
    Figure CN119485791A_ABST
Patent Text Reader

Abstract

The invention relates to a networking method and device based on direct communication and a storage medium. The networking method comprises the following steps: in response to establishment of first direct connection based on a first transmission mode between first electronic equipment and second electronic equipment, sending second direct connection starting instruction information to the second electronic equipment through a channel of the first direct connection, the second electronic equipment can start a second direct connection communication service based on a second transmission mode in response to the second direct connection starting instruction information; and in response to the second direct connection opening instruction information, opening a second direct connection communication service based on the second transmission mode, so that a second direct connection based on the second transmission mode can be established between the first electronic equipment and the second electronic equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a networking method, device and storage medium based on direct communication. Background Art

[0002] With the development of communication technology, people can use different communication methods to interact according to their needs. Wireless communication methods are becoming more and more widely used due to their advantages such as high flexibility, wide coverage, strong portability, high transmission rate, and low power consumption. Wireless communication methods include Bluetooth, Wireless-Fidelity (Wi-Fi), Near Field Communication (NFC), ultrasonic communication, infrared communication, etc.

[0003] Wi-Fi is a wireless local area network technology based on the Institute of Electrical and Electronics Engineers 802.11 standard. Wi-Fi Direct is also called Wi-Fi peer to peer (P2P) connection, which enables direct connection between terminal devices without the need for a wireless access point (AP) as an intermediary.

[0004] Wi-Fi Direct can be used in a variety of scenarios: File transfer: large files such as documents, pictures, and videos can be quickly transferred between two devices; Device connection: for example, displaying a mobile phone and a TV on the same screen, or transferring files between two mobile phones; Network sharing: in an environment without a Wi-Fi network, devices can share an Internet connection. Therefore, Wi-Fi Direct is increasingly widely used on smart devices. For example, a Wi-Fi Direct connection is established between a mobile phone and a smart speaker, allowing users to transfer calls to a smart speaker, a Wi-Fi Direct connection is established between a mobile phone and a projector, allowing users to play videos on the mobile phone on the projector, and a Wi-Fi Direct connection is established between a mobile phone and an intelligent office all-in-one machine, allowing users to forward files and videos to the intelligent office all-in-one machine, and the intelligent office all-in-one machine can also send files and recordings to the mobile phone.

[0005] In the related art, the Wi-Fi direct connection function needs to be manually turned on by the user, and the Wi-Fi direct connection function consumes a lot of power if it is always turned on, and it will occupy network resources and affect the normal hotspot connection performance. Summary of the invention

[0006] The present application provides a networking method, device and storage medium based on direct communication, which are used to solve the problem that the direct connection function needs to be manually turned on, and the direct connection function is often turned on, which will affect the performance of the device, such as high power consumption and occupation of resources.

[0007] In a first aspect, a networking method based on direct communication is provided, which is applied to a first electronic device. The networking method includes: in response to establishing a first direct connection based on a first transmission mode between the first electronic device and the second electronic device, sending a second direct connection start instruction message to the second electronic device through a channel of the first direct connection, so that the second electronic device can start a second direct communication service based on the second transmission mode in response to the second direct connection start instruction message; in response to the second direct connection start instruction message, start the second direct communication service based on the second transmission mode, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

[0008] In a second aspect, a networking method based on direct communication is provided, which is applied to a second electronic device. The networking method includes: in response to establishing a first direct connection based on a first transmission mode between a first electronic device and a second electronic device, receiving a second direct connection start instruction information sent by the first electronic device through a channel of the first direct connection; in response to the second direct connection start instruction information, starting a second direct communication service based on a second transmission mode, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

[0009] According to a third aspect, a networking device is provided, which is applied to a first electronic device, and the networking device includes: a sending module, which is configured to send a second direct connection activation instruction message to the second electronic device through a channel of the first direct connection in response to a first direct connection based on a first transmission mode being established between the first electronic device and the second electronic device, so that the second electronic device can activate a second direct communication service based on the second transmission mode in response to the second direct connection activation instruction message; and an activation module, which is configured to activate the second direct communication service based on the second transmission mode in response to the second direct connection activation instruction message, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

[0010] In a fourth aspect, a networking device is provided, which is applied to a second electronic device, and the networking device includes: a receiving module, configured to respond to establishing a first direct connection based on a first transmission mode between the first device and the second device, and receive a second direct connection start instruction information sent by the first device through a channel of the first direct connection; an opening module, configured to respond to the second direct connection start instruction information, and start a second direct communication service based on the second transmission mode, so that a second direct connection based on the second transmission mode can be established between the first device and the second device.

[0011] In a fifth aspect, an electronic device is provided, comprising: a memory; and at least one processor, wherein the memory stores a computer program, and the computer program can be executed by the at least one processor to implement the above method.

[0012] In a sixth aspect, an electronic device is provided, comprising: a memory; and at least one processor, wherein the memory stores a computer program, and the computer program can be executed by the at least one processor to implement the above method.

[0013] In a seventh aspect, an intelligent communication system is provided, comprising: the above-mentioned electronic device.

[0014] In an eighth aspect, a non-transitory computer-readable storage medium storing a computer program is provided, wherein the computer program implements the above method when executed by a processor.

[0015] In a ninth aspect, a computer program product is provided, comprising a computer program, which implements the above method when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 A flowchart of a networking method based on direct communication in some embodiments of the present application;

[0018] Figure 2 A flowchart of a networking method based on direct communication in some embodiments of the present application;

[0019] Figure 3 A flowchart of a networking process based on direct communication in some embodiments of the present application;

[0020] Figure 4 An interaction diagram of a networking process based on direct communication in some embodiments of the present application;

[0021] Figure 5 A block diagram of a networking device based on direct communication in some embodiments of the present application;

[0022] Figure 6 A block diagram of a networking device based on direct communication in some embodiments of the present application;

[0023] Figure 7 It is a block diagram of an electronic device in some embodiments of the present application. DETAILED DESCRIPTION

[0024] The technical solution of the present application will be described clearly and in detail below in conjunction with the drawings of the embodiments of the present application. Obviously, the embodiments described below are part of the embodiments of the present application rather than all of the embodiments, and are only used to more clearly illustrate the technical solution of the present application. Therefore, they are only used as examples, and the protection scope of the present application cannot be limited by this. Based on the described embodiments of the present application, all other embodiments that can be obtained by those skilled in the art without creative work belong to the scope of protection of the present application.

[0025] Unless otherwise defined, all technical and scientific terms used herein shall have the meanings commonly understood by technicians in the technical field of this application; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the embodiments of this application and any variations thereof are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the embodiments of this application are only used to distinguish different objects and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the embodiments of this application, unless otherwise stated, "multiple" means more than two.

[0026] The electronic device in the embodiments of the present application may be, but is not limited to, a cellular phone, a smart phone, a tablet computer, a wearable device, a desktop computer, or a laptop computer.

[0027] The electronic device may be configured with wireless communication services, including Bluetooth, Wi-Fi, NFC, ultrasonic communication, infrared communication, etc. Different wireless communication services have different transmission modes, for example, Bluetooth service uses Bluetooth technology to achieve data transmission.

[0028] A direct connection can be established between electronic devices. A direct connection can refer to establishing a wireless communication channel between electronic devices to communicate directly without the aid of a wireless access point AP. Depending on the transmission method, different direct connections can be established between electronic devices, such as a Bluetooth direct connection, an ultrasonic direct connection, and a Wi-Fi direct connection.

[0029] In the related art, the user is required to manually enable the direct communication service, and if the direct communication service is always enabled, it may affect the performance of the device.

[0030] Based on this, the present application provides a networking method based on direct communication, which can respond to the establishment of a first direct connection between two electronic devices, wherein one electronic device starts a second direct communication service and sends a second direct opening instruction to another electronic device through the channel of the first direct connection, so that the other electronic device can also start the second direct communication service in response to the second direct opening instruction, thereby enabling the establishment of a second direct connection between the two electronic devices. Among them, the transmission mode of the first direct connection and the second direct connection is different, so that the second direct communication service can be started based on the first direct connection, without the need for the user to manually start the second direct communication service, and overcome the problem that the second direct communication service is often open and may affect the performance of the device, such as high power consumption and occupation of resources.

[0031] The technical solution of the present application can be applied to, but is not limited to, smart office scenarios.

[0032] The scheme in the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0033] According to some embodiments of the present application, a networking method based on direct communication is provided, which is applied to a first electronic device. Figure 1 As shown, the networking method includes:

[0034] Step S101: in response to establishing a first direct connection based on a first transmission mode between a first electronic device and a second electronic device, sending second direct connection start instruction information to the second electronic device through a channel of the first direct connection, and the second electronic device can start a second direct communication service based on a second transmission mode in response to the second direct connection start instruction information;

[0035] Step S102: In response to the second direct connection start instruction information, start a second direct communication service based on the second transmission mode, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

[0036] In the above technical solution, the first electronic device can automatically start the second direct communication service in response to establishing the first direct connection with the second electronic device and send the second direct connection start instruction information to the second electronic device, so that the second electronic device can automatically start the second direct communication service in response to the second direct connection start instruction information, so that the second direct connection can be established between the first electronic device and the second electronic device. As a result, there is no need to manually start the second direct communication service, and problems caused by the second direct communication service being always on can also be avoided, such as high power consumption and resource occupation.

[0037] In some embodiments, the power consumption when the first direct communication service is turned on may be less than the power consumption when the second direct communication service is turned on. By adopting the technical solution of the present application, the problem of high power consumption when the second direct communication service is always turned on can be overcome.

[0038] In some embodiments, the power consumption when transmitting data through the channel of the first direct connection for data interaction may be less than the power consumption when transmitting data through the channel of the second direct connection for data interaction. The technical solution of the present application transmits the second direct connection start instruction information through the channel of the first direct connection, which can reduce energy consumption.

[0039] That is, the impact on the performance of the electronic device when the first direct communication service is in the on state is less than the impact on the performance of the electronic device when the second direct communication service is in the on state. Therefore, by triggering the second direct communication service to be turned on through the first direct communication service, the impact on the performance of the electronic device can be reduced. It can be understood that the impact on the performance of the electronic device is not limited to power consumption, for example, it can also be resource occupation.

[0040] Direct communication services may include Bluetooth, Wi-Fi Direct, radio frequency, near field communication, ultrasonic communication, infrared communication, etc. In this case, the first direct communication service may be Bluetooth, radio frequency, near field communication, ultrasonic communication or infrared communication, and the second direct communication service may be Wi-Fi Direct. Since the first direct communication service can quickly transmit data with a data volume less than a preset threshold, and the power consumption is small. Wi-Fi Direct can be used to quickly transmit data greater than or equal to a preset threshold, and the power consumption is relatively large. By adopting the technical solution of the present application, for example, triggering the opening of the Wi-Fi Direct service through a Bluetooth connection or an ultrasonic communication connection and sending a Wi-Fi Direct opening instruction to open the Wi-Fi Direct service of another electronic device, a Wi-Fi Direct connection can then be established between the two electronic devices. Thus, the problem of high energy consumption caused by the constant opening of the Wi-Fi Direct service, which affects the normal Wi-Fi hotspot connection performance, can be overcome, and the Wi-Fi Direct service can be automatically opened without manually opening the Wi-Fi Direct service, thereby improving the user experience.

[0041] According to some embodiments of the present application, the first direct connection may include a first sub-direct connection and a second sub-direct connection. In this case, in response to at least one of the first sub-direct connection and the second sub-direct connection being established between the first electronic device and the second electronic device, second direct connection start instruction information can be sent to the second electronic device through the channel of the first direct connection, thereby ensuring the reliability of data transmission through the first direct connection.

[0042] In some embodiments, the first direct connection may include a Bluetooth connection or an ultrasonic connection, and the second direct connection may be a Wi-Fi direct connection. Thus, the electronic device only needs to configure Bluetooth and Wi-Fi direct connection, or ultrasonic communication and Wi-Fi direct connection.

[0043] In other embodiments, the first direct connection may include a Bluetooth connection and an ultrasonic connection, and the second direct connection is a Wi-Fi direct connection. Thus, the Wi-Fi direct communication start instruction information can be sent through at least one of the Bluetooth connection and the ultrasonic connection, ensuring that the opposite electronic device can receive the Wi-Fi direct communication start instruction information, thereby improving reliability.

[0044] Ultrasonic communication is a near-field communication technology similar to NFC, and the way to transmit data is symmetric encryption. Simply put, the sending end maps characters to frequencies, and then maps a frequency to a syllable signal (single-frequency sine wave), which is encoded into audio playback; after receiving the audio signal, the receiving end parses the frequency, and then finds the character corresponding to the frequency according to the common code table at both ends, thereby decoding the data.

[0045] In some embodiments, the sender can encrypt the text message into audio through the following three steps:

[0046] 1. Mapping from character table to frequency table.

[0047] The ASCII characters that can be input by the keyboard are actually only between 32 and 127. These 96 characters (0~9, A~Z, a~z, +, -, =) are used to create a character table with subscripts from 0 to 95. For Chinese characters, after first transcoding using the Base64 rule, only the 96 characters (0~9, A~Z, a~z, +, -, =) are needed. Therefore, for the data area used to transmit information, 96 frequencies in the data area are enough. Then create a frequency table with subscripts from 0 to 95, and map the subscripts of the character table to the subscripts of the frequency table. Then, frequencies 0 to 95 can replace the 96 characters. Characters and frequencies are mapped one by one. The frequency table also needs to add a start mark to tell the receiving end when to start parsing, and an end mark to tell the receiving end that the transmission is over.

[0048] 2. Convert the frequency into a sine wave audio signal.

[0049] After establishing a one-to-one mapping relationship between characters and frequencies, the frequency corresponding to the characters is converted into a sine wave through a sine wave function of a specific frequency. If the frequency corresponding to the text information is to produce a "single-frequency" sound, a sine function of a specific frequency needs to be constructed by the user. The sine wave function can be adjusted at will to ensure that the frequency of the information can be correctly reverse parsed.

[0050] 3. Save the sine wave in PCM data format.

[0051] If you record sound, there is no way to record the entire continuous sound signal. You can only sample discretely, collect data every once in a while, and convert the analog signal into a digital signal so that it can be stored in the digital world of the computer. If there are many sampling points, the quality is high, and it sounds less different from the original sound; conversely, if there are few sampling points, the quality is poor, and it sounds different from the original sound. The famous sampling theorem "Nyquist Theorem" states that if the sampling frequency is higher than twice the highest frequency of the signal, the digital signal after sampling can completely retain the information in the original signal. Because the human hearing range is 20HZ-20000HZ, the general sampling frequency is 44.1kHZ, which is 44100 times per minute. Choosing a sampling rate of 44100Hz can record sine waves very well.

[0052] It is better to have the character mapping range within the range of human hearing, because only in this way can general hardware devices play it. If it is too high or too low, it will not be compatible with all mobile phone models or other hardware devices. You can also use audio signals in the range of 18kHz to 21kHz (the human ear should try not to hear this sound, and the mobile phone should be able to receive this sound, which belongs to the ultrasonic range). The sender only needs to calculate the corresponding sine wave for each sampling point through the sine wave function and store it in 16-bit mono PCM format. The value calculated by the sine wave function is float. To convert it into a PCM file for the player to play, the float needs to be converted into a 16-bit integer first. The generated PCM file can be played directly through the player.

[0053] Similarly, the receiver can decrypt the text information corresponding to the audio through the following three steps:

[0054] 1. Convert the audio data format into a sine wave.

[0055] The collection of audio signals is completed on the corresponding platform. The sampling rate, number of channels and number of data bits should be consistent with the sending end. When the sending end plays the sound, it generates audio signals continuously. After the receiving end parses the agreed start mark frequency in the audio information, it starts decoding. The audio signal after the start mark is the sound wave carrying information. A single-frequency sine wave carrying one character information is called a syllable. The role of the fast Fourier transform is to parse the frequency domain information contained in the audio signal from a parsing window (buffer). After decoding the frequency of the sine wave through the fast Fourier transform, the information frequency carried by the sine wave can be obtained. After the start syllable, it is only necessary to parse the audio data of each window in sequence, select the frequency with the largest amplitude in the 0-95 data frequency range, and store it in the frequency array in sequence. After identifying the end frequency, it means the end of this decoding, and the parsing from the sine wave audio signal to the corresponding frequency array is completed.

[0056] 2. Map the frequency array to the information frequency table.

[0057] 3. Search for the corresponding character information according to the information frequency table.

[0058] The data transmission process of Bluetooth connection can include:

[0059] 1. BLE broadcast process.

[0060] The peripheral device (GATT server, GATT is the abbreviation of Generic Attribute Profile, which is a core concept of the Bluetooth protocol and is used to define how devices combine and transmit data through Bluetooth) configures the broadcast UUID (Universally Unique Identifier) ​​and manufacturer ID, and publishes broadcasts at regular intervals. When receiving the search command sent by the intermediate device (GATT client), it returns the search callback information. After the intermediate device chooses to connect, the peripheral device returns to the connection state, completing the BLE channel establishment.

[0061] In the embodiment of the present application, the second electronic device may be configured as a GATT server, and the first electronic device may be configured as a GATT client. It is understandable that the first electronic device may also be configured as a GATT server, and the first electronic device may be configured as a GATT client.

[0062] 2. The data exchange process between the peripheral device (GATT server) and the intermediate device (GATT client).

[0063] After the peripheral device and the intermediate device are successfully connected, the intermediate device obtains the read, write and subscribe UUIDs and starts to exchange data with the peripheral device through the read and write UUIDs. You can also monitor the changes of the peripheral device by subscribing to the UUID.

[0064] According to some embodiments of the present application, the networking method may further include: in response to a preset operation, starting a first direct communication service (such as Bluetooth and / or ultrasonic communication) of the first electronic device, so that the first direct communication service can be automatically started in response to the preset operation.

[0065] In some embodiments, the first electronic device may be installed with a target application associated with the second electronic device. Exemplarily, the preset operation may be to open the target application, that is, the first direct communication service of the first electronic device may be automatically opened in response to the first electronic device opening the target application, and the first direct communication service of the second electronic device may be configured to be always open, so that after the first electronic device opens the application, the first direct connection can be automatically established between the first electronic device and the second electronic device without manually opening the first direct communication service. In addition, since the first direct communication service has little effect on the performance of the electronic device, the first direct communication service of the second electronic device being always open will not have a significant impact on the performance of the electronic device, and the connection efficiency can be improved by only automatically opening the first direct communication service on the first electronic device side in response to the preset operation.

[0066] In other embodiments, the first electronic device may be configured with an information representation for opening the first direct communication service. For example, an information representation (such as a button) for opening the first direct communication service may be set in the target application. The preset operation may be an operation for the information representation (such as clicking a button), that is, the first direct communication service of the first electronic device may be automatically opened in response to the target operation for the information representation. Exemplarily, the first direct communication service of the second electronic device may be configured to be normally open, so that after the first electronic device receives the target operation for the information representation, the first direct connection can be automatically established between the first electronic device and the second electronic device without manually opening the first direct communication service.

[0067] In a smart office scenario, the first electronic device may be a user terminal, and the second electronic device may be a server. In the above two embodiments, the first direct communication service on the server side is configured to be always on, which has less impact on the performance of the server and can improve the efficiency of establishing the first direct connection between the two devices.

[0068] It is understandable that the manner of establishing the first direct connection between the first electronic device and the second electronic device is not limited to the above manner. For example, the first electronic device may be manually turned on, and / or the first direct communication service of the second electronic device may be manually turned on. For another example, the first direct communication service of the first electronic device may be configured to be always on, because the impact of the first direct communication service on the device performance when it is in the on state is less than the impact of the second direct communication service on the device performance when it is in the on state. Therefore, by configuring the first direct communication service to be always on and triggering the activation of the second direct communication service in response to establishing the first direct connection with the second electronic device, there is no need to manually activate the second direct communication service, and the problem that the second direct communication service being always on has a greater impact on the device performance can be overcome.

[0069] In the technical solution of the embodiment of the present application, on the first electronic device side, in response to the first electronic device and the second electronic device establishing a first direct connection (for example, a Bluetooth connection and / or an ultrasonic communication connection), the first electronic device is triggered to turn on a second direct communication service (for example, a Wi-Fi direct communication service), and a second direct connection start instruction message is sent to the second electronic device, so that the second electronic device automatically turns on the second direct communication service in response to the second direct connection start instruction message.

[0070] According to some embodiments of the present application, the second direct connection start instruction information may include a first function code and a second direct connection start instruction, and the first function code is used to indicate the channel information of the first direct connection. For example, the first function code is used to indicate the channel on which the Bluetooth connection has been established, and / or the channel on which the ultrasonic communication connection has been established. Thus, after the first electronic device establishes the first direct connection between the first electronic device and the second electronic device, the first electronic device sends the second direct connection start instruction information to the second electronic device through a custom interaction protocol to automatically wake up the second electronic device and start the second direct communication service. Based on the custom interaction protocol, the second electronic device can determine through which channel the second direct connection start instruction is obtained, so as to facilitate subsequent data interaction.

[0071] Customized interaction protocol packages may include, for example:

[0072] Packet header: 1 byte, fixed value 0xAA;

[0073] Function code: 1 byte, where 0x01 represents function 1, 0x02 represents function 2, ..., 0x0N represents function N;

[0074] Key data:

[0075] Data packet length: 2 bytes 0x00 0x0N (integer);

[0076] Data packet content: N bytes of encrypted data, the encryption key is the function code;

[0077] CRC check code: 2 bytes;

[0078] Packet tail: 1 byte, fixed value 0xAA.

[0079] In some embodiments, the first function code is defined as follows: 0x01 indicates channel establishment of ultrasonic communication connection; 0x02 indicates channel establishment of Bluetooth connection; 0x03 indicates ultrasonic communication connection triggers the start of Wi-Fi direct connection; 0x04 indicates Bluetooth connection triggers the start of Wi-Fi direct connection.

[0080] The function codes of the receipt are defined as follows: 0x10 indicates that the ultrasonic communication connection channel is successfully established; 0x11 indicates that the ultrasonic communication connection channel is failed to be established; 0x20 indicates that the Bluetooth connection channel is successfully established; 0x21 indicates that the Bluetooth connection channel is failed to be established; 0x30 indicates that the ultrasonic communication connection triggers the start of Wi-Fi Direct successfully; 0x31 indicates that the ultrasonic communication connection triggers the start of Wi-Fi Direct failure; 0x40 indicates that the Bluetooth connection triggers the start of Wi-Fi Direct successfully; 0x41 indicates that the Bluetooth connection triggers the start of Wi-Fi Direct failure.

[0081] In some embodiments, when the second direct connection start instruction information includes the first function code and the second direct connection start instruction, sending the second direct connection start instruction information to the second electronic device through the channel of the first direct connection includes:

[0082] Encrypting the second direct connection opening instruction by using the first function code as a key to generate an encrypted second direct connection opening instruction; and

[0083] The first function code and the encrypted second direct connection opening instruction are sent to the second electronic device through the channel of the first direct connection.

[0084] Therefore, an encryption and decryption mechanism is set based on the custom protocol to send the second direct connection activation instruction information to the second electronic device to automatically wake up the second direct connection communication service activated by the second electronic device, which speeds up the query speed and ensures security.

[0085] Exemplarily, the second direct connection activation instruction can be encrypted using the first function code as a key using, but not limited to, an XOR encryption algorithm. The XOR encryption algorithm is simple to implement, has high encryption and decryption efficiency, and is conducive to rapid networking. The principle of the XOR encryption algorithm can be: by traversing each character of the plain text of the second direct connection activation instruction, and taking out one or more characters from the key according to the XOR operation rules, performing an XOR operation with the characters of the plain text, and synthesizing the XOR result into a new string. For example, the plain text is Text, and the key is key (first function code), and the first XOR will obtain the encrypted text EnText. After the second electronic device receives the key and the ciphertext, it uses the key to perform an XOR operation on the ciphertext, and the plain text Text will be restored.

[0086] The first electronic device sending the second direct connection activation instruction to the second electronic device can trigger the two devices to activate the second direct communication service. After activating the second direct communication service, the first electronic device and the second electronic device can be networked based on the second direct connection.

[0087] According to some embodiments of the present application, a process of establishing a second direct connection based on a second transmission mode between a first electronic device and a second electronic device includes:

[0088] The second direct connection instruction information is sent to the second electronic device through the first direct connection channel, so that a second direct connection based on the second transmission mode is established between the first electronic device and the second electronic device.

[0089] That is to say, after the first electronic device and the second electronic device start the second direct communication service, the second direct connection instruction information can be transmitted through the channel of the first direct connection, so that the second direct connection based on the second transmission mode is established between the first electronic device and the second electronic device. Since the energy consumption of transmitting interactive data based on the first direct connection is less than the energy consumption of transmitting interactive data based on the first direct connection, therefore, transmitting the second direct connection instruction information based on the first direct connection is conducive to reducing the energy consumption of the device and further reducing the impact on the performance of the device.

[0090] In some embodiments, the second direct connection instruction information may include a second function code and a second direct connection instruction, and the second function code is used to indicate the channel information of the first direct connection. Thus, after the second direct communication service is started between the first electronic device and the second electronic device, the second electronic device sends the second direct connection instruction information to the first electronic device through a custom interaction protocol to establish a second direct connection between the first electronic device and the second electronic device. Based on the custom interaction protocol, it can be determined through which channel the second direct connection instruction information is obtained to facilitate subsequent data interaction.

[0091] Here, the interaction protocol customized by the second electronic device for sending the second direct connection instruction information can refer to the interaction protocol used by the first electronic device to send the second direct connection start instruction in the above content, and the specific definition method is not detailed again.

[0092] In some embodiments, the second direct connection instruction information sent by the first electronic device may be encrypted information. For example, the second direct connection instruction in the second direct connection instruction information may be a ciphertext obtained by encrypting the plaintext of the second direct connection instruction using the second function code as a key. The second electronic device may decrypt the ciphertext of the second direct connection instruction using the second function code as a key to obtain the plaintext of the second direct connection instruction, so as to establish a second direct connection with the first electronic device.

[0093] When the first electronic device and the second electronic device are configured with ultrasonic communication and Bluetooth services, and the second direct communication service is a Wi-Fi direct service, the first direct connection may include an ultrasonic communication connection and a Bluetooth connection. In some embodiments, the connection instruction information of the Wi-Fi direct connection may be transmitted simultaneously through the ultrasonic communication connection and the Bluetooth connection. This ensures the reliability of data transmission and ensures that the Wi-Fi direct service can be automatically triggered.

[0094] It is understandable that the connection instruction information of the Wi-Fi direct connection may also be transmitted via an ultrasonic communication connection or a Bluetooth connection. In this case, the first electronic device and the second electronic device may only be configured with ultrasonic communication or Bluetooth services.

[0095] In the case where the first electronic device and the second electronic device configure other types of first direct communication services, the manner of transmitting the second direct connection instruction information based on the first direct connection is similar to the above.

[0096] The following takes the example that the first direct communication service includes ultrasonic communication connection and / or Bluetooth connection, and the second direct communication service is a Wi-Fi direct service as an example, and describes the networking process based on direct communication in detail in combination with several specific scenarios.

[0097] The first scenario is a direct connection scenario to the same hotspot.

[0098] The first electronic device and the second electronic device are simultaneously connected to the same Wi-Fi hotspot, and the dynamically assigned IP addresses are in the same network segment. In this scenario, there are many methods for Wi-Fi direct connection. You can let the second electronic device send a broadcast or multicast with Wi-Fi direct command information, and the first electronic device receives the broadcast and parses the information; you can also use the solution in the embodiment of this application, that is, the first electronic device transmits the Wi-Fi direct connection instruction through the channel connected by ultrasonic communication and / or the channel connected by BLE, and the second electronic device receives the information and parses it, so as to achieve the purpose of starting the Wi-Fi direct connection process.

[0099] The second scenario is the direct connection scenario between personal hotspot and routing network.

[0100] The second electronic device can start its own hotspot function, and the first electronic device can connect to the Wi-Fi hotspot. At this time, the dynamically allocated IP address is in a different network segment. In this scenario, Wi-Fi Direct cannot be started through the local area network, and can only adopt the solution in the embodiment of the present application, that is, the first electronic device transmits the Wi-Fi Direct connection instruction through the channel connected by ultrasonic communication and / or the channel connected by BLE, and the second electronic device receives the information and parses it, thereby achieving the purpose of starting the Wi-Fi Direct process.

[0101] The third scenario is a direct connection scenario where two routers are separated from the same LAN.

[0102] The first electronic device is connected to a Wi-Fi hotspot, and the second electronic device is connected to another Wi-Fi hotspot. The two connected WiFi hotspots are located in the same local area network and can communicate with each other. At this time, the dynamically allocated IP addresses are in different network segments. In this scenario, the Wi-Fi direct connection method allows the second electronic device to send a broadcast with direct connection command information. Multicast is not possible. The first electronic device receives the broadcast and parses the information. The solution in the embodiment of the present application can also be adopted, that is, the first electronic device transmits the Wi-Fi direct connection instruction through the channel connected by ultrasonic communication and / or the channel connected by BLE, and the second electronic device receives the information and parses it, thereby achieving the purpose of starting the Wi-Fi direct connection process.

[0103] The fourth scenario is a direct connection scenario without connecting to any network.

[0104] The first electronic device is connected to a Wi-Fi hotspot, the second electronic device is connected to another Wi-Fi hotspot, or the first electronic device and the second electronic device are not connected to any Wi-Fi hotspot, at which time there may be one or both of the dynamically allocated IP addresses. In this scenario, Wi-Fi Direct cannot be started through a local area network, and can only adopt the solution in the embodiment of the present application, that is, the first electronic device transmits the Wi-Fi Direct connection instruction through the channel connected by ultrasonic communication and / or the channel connected by BLE, and the second electronic device receives the information and parses it, thereby achieving the purpose of starting the Wi-Fi Direct process.

[0105] For the third and fourth scenarios, only through the solution in the embodiments of the present application can the Wi-Fi direct networking of the first electronic device and the second electronic device be realized, overcoming the problem in the related art that the Wi-Fi direct networking of the first electronic device and the second electronic device cannot be realized for the third and fourth scenarios.

[0106] According to some embodiments of the present application, the networking method further includes:

[0107] In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, detecting a connection state of the second direct connection using a detection mechanism;

[0108] Wherein, based on the detection result obtained by using the detection mechanism, it is determined whether the interaction between the first electronic device and the second electronic device is completed.

[0109] By detecting the connection status of the second direct connection through the detection mechanism, it is possible to monitor the connection and disconnection status between devices, achieve fast and accurate interconnection between devices, and greatly improve the user operation experience and success rate.

[0110] In some embodiments, in response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, a bidirectional forwarding detection mechanism (Bidirectional Forwarding Detection, referred to as "BFD") is used to detect the connection state of the second direct connection. BFD detection can quickly detect connection interruptions and facilitate timely processing.

[0111] BFD is a high-speed fault detection mechanism based on the RFC 5880 standard. After two systems establish a BFD session, they periodically send BFD packets on the channel between them. If one party does not receive a BFD packet within the negotiated detection time, it is considered that a fault has occurred on the bidirectional channel.

[0112] BFD establishes a session between two network devices to detect the bidirectional forwarding path (physical link, logical link, tunnel, etc.) between network devices and serves as a reference for the upper layer. After the session is established, BFD packets are sent periodically and quickly. If no BFD packets are received within the detection time and the bidirectional forwarding path is considered to be faulty, the upper layer application of the service is notified to perform corresponding processing. BFD detection modes include asynchronous mode and query mode. Asynchronous mode: BFD packets are sent periodically according to a certain regular cycle to ensure the connectivity of the session state. Query mode (bat radar): Multiple control packets are continuously sent to the other end to see if a response can be obtained. It is generally used to detect the operator system. BFD detects the session state, and the establishment and removal of the state machine adopt a three-way handshake mechanism to ensure that both systems can know the state change. Down state: When the down state is received, it changes to the init state. When the init state is received, it directly changes to the up state. When a state higher than itself is received, a layer is added on the basis of the received state. Init state: When the down state is received, it remains unchanged (only accepts a higher level than itself). When the init or up state is received, it directly changes to up. When the state lower than itself is received, it remains unchanged. When the state higher than itself is received, it increases by one layer. Up state: Remains unchanged upon receiving init or up. Remains unchanged upon receiving lower level or higher level (except down). Regardless of whether it is in init or up state, it will directly change to down state as long as it receives timer state. BFD detection time: The actual sending time interval of local BFD packets = MAX{the sending time interval configured locally, the receiving time interval configured by the other end}; The actual receiving time interval of local BFD packets = MAX{the receiving time interval configured locally, the sending time interval configured by the other end}; Asynchronous mode: The actual detection time of local BFD packets = the actual receiving time interval of local BFD packets × the BFD detection multiple configured by the other end; Query mode: The actual detection time of local BFD packets = the actual receiving time interval of local BFD packets × the BFD detection multiple configured by the local end.

[0113] In an embodiment of the present application, after the first electronic device and the second electronic device complete data interaction through the channel of the second direct connection, the second direct communication service can be automatically closed to avoid the impact on device performance when the second direct communication service is in the turned-on state, and the automatic closing method does not require human intervention, thereby improving the user experience.

[0114] How to automatically close the second direct communication service will be described below in conjunction with a specific embodiment.

[0115] According to some embodiments of the present application, the networking method may further include:

[0116] In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, interacting with the second electronic device through a channel of the second direct connection; and

[0117] In response to determining that the interaction between the first electronic device and the second electronic device is completed, the second direct communication service is closed.

[0118] Therefore, after the first electronic device and the second electronic device complete data transmission through the second direct connection (such as Wi-Fi), the second direct communication service can be automatically triggered to be closed, thereby preventing the second direct communication service from remaining open after the interaction is completed and affecting the performance of the device, and there is no need to manually close the second direct communication service, thereby improving the user experience.

[0119] In an exemplary embodiment, the detection result obtained by the detection mechanism may be used to determine whether the interaction between the first electronic device and the second electronic device is completed.

[0120] In another exemplary embodiment, taking the case where the first electronic device sends data to the second electronic device as an example, the second electronic device can determine whether the data transmitted through the second direct connection is completed based on the interactive protocol. For example, an end field is added to the end of the transmitted data packet. In response to receiving the end field, the second electronic device can determine that the data transmission is completed, which triggers the closure of the second direct communication service. Further, the second electronic device can send a second direct connection closure instruction message to the first electronic device in response to closing the second direct communication service, and the first electronic device closes the second direct communication service in response to the second direct connection closure instruction message. It can be understood that the case where the second electronic device sends data to the first electronic device is similar to the above.

[0121] In some embodiments, a preset time period may also be set, and the second electronic device automatically triggers closing the second direct communication service in response to no other device establishing a second direct connection with it within the preset time period. Further, the second electronic device may send a second direct connection closing instruction message to the second electronic device in response to closing the second direct communication service, and the first electronic device closes the second direct communication service in response to the second direct connection closing instruction message.

[0122] According to some other embodiments of the present application, the networking method further includes:

[0123] In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, interacting with the second electronic device through a channel of the second direct connection; and

[0124] In response to determining that the interaction between the first electronic device and the second electronic device is completed, a second direct connection closing instruction message is sent to the second electronic device through the channel of the first direct connection, and the second electronic device can close the second direct communication service based on the second transmission mode in response to the second direct connection opening instruction message.

[0125] Therefore, after the first electronic device and the second electronic device complete data transmission through the second direct connection (such as Wi-Fi), a second direct connection closing instruction message can be sent to the second electronic device to automatically trigger the second electronic device to close the second direct communication service, thereby preventing the second direct communication service from remaining turned on after the interaction is completed and affecting the performance of the device, and there is no need to manually turn off the second direct communication service, thereby improving the user experience.

[0126] In an exemplary embodiment, the detection result obtained by the detection mechanism may be used to determine whether the interaction between the first electronic device and the second electronic device is completed.

[0127] In another exemplary embodiment, the second electronic device can determine whether the data transmitted through the second direct connection is completed based on the interactive protocol. For example, an end field is added to the end of the transmitted data packet. In response to receiving the end field, the second electronic device can determine that the data transmission is completed and feedback the receipt information of the completion of the data transmission to the first electronic device. In response to receiving the receipt information, the first electronic device determines that the first electronic device and the second electronic device have completed the data transmission through the second direct connection (such as Wi-Fi), and sends a second direct connection closing instruction information to the second electronic device to automatically trigger the second electronic device to close the second direct communication service. It can be understood that the situation where the second electronic device sends data to the first electronic device is similar to the above.

[0128] In some embodiments, the first electronic device may close the second direct communication service in response to sending the second direct connection closing instruction information to the second electronic device.

[0129] In other embodiments, when the first electronic device has installed a target application associated with the second electronic device, the first electronic device may automatically close the first direct communication service in response to closing the target application, and automatically close the second direct communication service in response to closing the first direct communication service.

[0130] In other embodiments, an information representation for closing the first direct communication service may be set in the target application, and in response to a preset operation (e.g., click) on the information representation, the first direct communication service is closed, and in response to closing the first direct communication service, the second direct communication service is automatically closed. Further, in response to closing the second direct communication service, a second direct connection closing instruction message may be sent to the second electronic device, and the second electronic device closes the second direct communication service in response to the second direct connection closing instruction message.

[0131] It is understandable that the method of shutting down the second direct communication service is not limited to the above method, as long as the second direct communication service can be shut down automatically and timely to reduce the impact on the device performance.

[0132] According to some embodiments of the present application, another networking method based on direct communication is also provided, which is applied to a second electronic device. Figure 2 As shown, the networking method includes:

[0133] Step S201: in response to a first direct connection based on a first transmission mode being established between a first electronic device and a second electronic device, receiving second direct connection start instruction information sent by the first electronic device through a channel of the first direct connection;

[0134] Step S202: In response to the second direct connection start instruction information, start a second direct communication service based on the second transmission mode, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

[0135] In the above technical solution, the first electronic device can automatically start the second direct communication service in response to establishing the first direct connection with the second electronic device and send the second direct connection start instruction information to the second electronic device, and the second electronic device automatically starts the second direct communication service in response to the second direct connection start instruction information, so that the second direct connection can be established between the first electronic device and the second electronic device. As a result, there is no need to manually start the second direct communication service, and problems caused by the second direct communication service being always on can also be avoided, such as high power consumption and resource occupation.

[0136] The second electronic device cooperates with the first electronic device to implement networking based on a direct connection. In the embodiment of the present application, the solution implementation on the second electronic device side is similar to or cooperates with the solution implementation on the first electronic device side. For example, the type of direct communication service and the process of implementing the first direct connection and the second direct connection can be found in the above description and will not be described in detail here.

[0137] According to some embodiments of the present application, the first direct communication service can be turned on in response to turning on the second electronic device. That is, the second electronic device is configured to always turn on the first direct communication service (e.g., Bluetooth service and / or ultrasonic communication service), thereby facilitating the first electronic device and the second electronic device to quickly establish the first direct connection, and then quickly establish the second direct connection.

[0138] In a smart office scenario, the first electronic device can be a user terminal, and the second electronic device can be a server. Configuring the first direct communication service on the server side to be always on has less impact on the performance of the server and can improve the efficiency of establishing the first direct connection between the two devices.

[0139] It is understandable that the first direct communication service of the second electronic device can also be manually opened. Referring to the way in which the first electronic device opens the first direct communication service, a target application associated with the first electronic device can also be installed in the second electronic device, and in response to opening the target application, the second electronic device opens the first direct communication service. Alternatively, the second electronic device is configured with an information representation for opening the first direct communication service. For example, an information representation (such as a button) for opening the first direct communication service can be set in the target application. The second electronic device can open the first direct communication service in response to a preset operation for the information representation (such as clicking a button).

[0140] In some embodiments, the first direct connection includes a first direct connection sub-connection and a second direct connection sub-connection. In response to at least one of the first direct connection sub-connection and the second direct connection sub-connection being established between the first electronic device and the second electronic device, the second direct connection start instruction information sent by the first electronic device is received through the channel of the first direct connection, thereby ensuring the reliability of data transmission through the first direct connection.

[0141] The first direct-sub-connection and the second direct-sub-connection may be, for example but not limited to, a Bluetooth connection and an ultrasonic connection, respectively.

[0142] According to some embodiments of the present application, the second direct connection start instruction information may include a first function code and the second direct connection start instruction, wherein the first function code is used to indicate channel information of the first direct connection. In this case, in response to the second direct connection start instruction information, starting the second direct connection communication service based on the second transmission mode includes:

[0143] Parsing the second direct connection start instruction received from the first electronic device to obtain a first function code;

[0144] Decrypting the second direct connection opening instruction using the first function code as a key to obtain a decrypted second direct connection opening instruction;

[0145] Based on the second direct connection start instruction, a second direct connection communication service based on the second transmission mode is started.

[0146] Thus, after the first electronic device establishes the first direct connection between the first electronic device and the second electronic device, the first electronic device sends the second direct connection activation instruction information to the second electronic device through the customized interaction protocol to automatically wake up the second direct communication service activated by the second electronic device. The second electronic device can determine through which channel the second direct connection activation instruction is obtained based on the customized interaction protocol to facilitate subsequent data interaction.

[0147] The definition of the interactive protocol and the first function code can be found above and will not be described in detail.

[0148] The first electronic device sending the second direct connection activation instruction to the second electronic device can trigger the two devices to activate the second direct communication service. After activating the second direct communication service, the first electronic device and the second electronic device can be networked based on the second direct connection.

[0149] According to some embodiments of the present application, Figure 3 As shown, the process of establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device may include:

[0150] Step S301: generating a second direct connection invitation frame in response to receiving second direct connection instruction information sent by the first electronic device;

[0151] Step S302: Acquire a target image including a second direct connection invitation frame;

[0152] Step S303, obtaining the position information indicated by the information indicating the connection confirmation in the target image;

[0153] Step S304: Based on the location information, the software simulates the user's connection confirmation operation for the information representation to complete the connection confirmation;

[0154] Step S305: In response to the connection confirmation operation, second direct connection confirmation information is sent to the first electronic device through the channel of the first direct connection.

[0155] Therefore, when the first electronic device and the second electronic device are connected for the first time, the connection invitation is confirmed through software simulation, thereby eliminating the need for manual confirmation and improving user experience.

[0156] In some embodiments, a picture template library for invitation box button pictures can be established; a system screenshot command is called in the second direct connection invitation box (for example, a WiFi direct connection invitation box) interface to pop up a box interface picture; the template matching function of the OpenCV library is used to complete the position matching of the button template in the captured pop-up box interface picture, and obtain the position information of the confirmation button in the pop-up box interface picture; the click function is completed by simulating a touch event through the position information, and the automatic confirmation of the second direct connection invitation box is completed.

[0157] On the Android platform, you can simulate touch events through the InputManager class. The following are the basic steps and code examples for simulating touch events:

[0158] 1. Get the InputManager instance: Get the instance of the system service InputManager.

[0159] 2. Create MotionEvent: Create a MotionEvent object, which represents a touch event.

[0160] 3. Set touch event parameters: Set the parameters of the MotionEvent object, including action type, position coordinates, timestamp, etc.

[0161] 4. Send touch events: Use the sendInputEvent method of InputManager to send touch events.

[0162] Since simulating touch events involves system-level operations, you need to ensure that your application has the corresponding permissions.

[0163] In some embodiments, the process of establishing a second direct connection based on a second transmission mode between the first electronic device and the second device may further include:

[0164] Create groups;

[0165] In response to receiving a scan instruction sent by the first electronic device, a scan result is sent to the first electronic device, the scan result includes a group identifier, and the first electronic device sends second direct connection instruction information to the second electronic device based on the group identifier.

[0166] Therefore, the query rate can be increased and the networking efficiency can be improved through group identification.

[0167] According to some embodiments of the present application, a process of establishing a second direct connection based on a second transmission mode between a first electronic device and a second electronic device may include:

[0168] The second direct connection instruction information is sent to the second electronic device through the first direct connection channel, so that a second direct connection based on the second transmission mode is established between the first electronic device and the second electronic device.

[0169] That is to say, after the first electronic device and the second electronic device start the second direct communication service, the second direct connection instruction information can be sent to the second electronic device through the channel of the first direct connection, so that the first electronic device and the second electronic device establish a second direct connection based on the second transmission mode. Since the energy consumption of transmitting interactive data based on the first direct connection is less than the energy consumption of transmitting interactive data based on the first direct connection, therefore, transmitting the second direct connection instruction information based on the first direct connection is conducive to reducing the energy consumption of the device and further reducing the impact on the performance of the device.

[0170] The implementation scheme of transmitting the second direct connection instruction information through the channel of the first direct connection can refer to the above content.

[0171] According to some embodiments of the present application, the networking method may further include:

[0172] In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, detecting a connection state of the second direct connection using a detection mechanism;

[0173] Wherein, based on the detection result obtained by using the detection mechanism, it is determined whether the interaction between the first electronic device and the second electronic device is completed.

[0174] By detecting the connection status of the second direct connection through the detection mechanism, it is possible to monitor the connection and disconnection status between devices, achieve fast and accurate interconnection between devices, and greatly improve the user operation experience and success rate.

[0175] In some embodiments, the networking method may further include:

[0176] In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, a bidirectional forwarding detection mechanism is used to detect the connection state of the second direct connection. BFD detection can quickly detect connection interruptions and facilitate timely processing.

[0177] In an embodiment of the present application, after the first electronic device and the second electronic device complete data interaction through the channel of the second direct connection, the second direct communication service can be automatically closed to avoid the impact on device performance when the second direct communication service is in the turned-on state, and the automatic closing method does not require human intervention, thereby improving the user experience.

[0178] How to automatically close the second direct communication service will be described below in conjunction with a specific embodiment.

[0179] According to some embodiments of the present application, the networking method may further include:

[0180] In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, interacting with the first electronic device through a channel of the second direct connection; and

[0181] In response to determining that the interaction between the first electronic device and the second electronic device is completed, the second direct communication service is closed.

[0182] Therefore, after the first electronic device and the second electronic device complete data transmission through the second direct connection (such as Wi-Fi), the second direct communication service can be automatically triggered to be closed, thereby preventing the second direct communication service from remaining open after the interaction is completed and affecting the performance of the device, and there is no need to manually close the second direct communication service, thereby improving the user experience.

[0183] There are many ways to confirm whether the data transmission between the first electronic device and the second electronic device is completed through the second direct connection (such as Wi-Fi). For example, the detection result obtained by the detection mechanism can be used to determine whether the interaction between the first electronic device and the second electronic device is completed. For another example, an end field can be added to the transmitted data packet to determine whether the interaction between the first electronic device and the second electronic device is completed based on the end field.

[0184] According to some other embodiments of the present application, the networking method may further include:

[0185] In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, interacting with the first electronic device through a channel of the second direct connection; and

[0186] In response to determining that the interaction between the first electronic device and the second electronic device is completed, receiving second direct connection closing instruction information sent by the first electronic device through the first direct connection channel;

[0187] In response to the second direct connection closing instruction information, the second direct connection communication service based on the second transmission mode is closed.

[0188] Therefore, after the first electronic device and the second electronic device complete data transmission through the second direct connection (such as Wi-Fi), the second direct connection closing instruction information can be received from the first electronic device to automatically trigger the second electronic device to close the second direct communication service, thereby avoiding the second direct communication service from remaining turned on after the interaction is completed and affecting the performance of the device, and there is no need to manually turn off the second direct communication service, thereby improving the user experience.

[0189] According to some other embodiments of the present application, the networking device may further include:

[0190] In response to the first electronic device establishing the second direct connection with the second electronic device being empty, the second direct communication service based on the second transmission mode is closed.

[0191] Thus, a preset time period may be set, and the second electronic device automatically triggers closing of the second direct communication service in response to no other device establishing a second direct connection with it within the preset time period.

[0192] It is understandable that the method of shutting down the second direct communication service is not limited to the above method, as long as the second direct communication service can be shut down automatically and timely to reduce the impact on the device performance.

[0193] The following will use a specific example to illustrate the networking process of the first electronic device (client) and the second electronic device (server), where both the first electronic device and the second electronic device are configured with Bluetooth and ultrasonic communication services, as well as Wi-Fi direct connection services. The Bluetooth and ultrasonic communication services of the second electronic device are configured to be always on.

[0194] See also Figure 4 As shown, the networking process based on ultrasonic connection may include:

[0195] First, the client starts the ultrasonic communication service;

[0196] Secondly, the server uses its own sound receiving device to monitor the sound waves and establish an ultrasonic connection with the server;

[0197] Afterwards, the client encodes the command code of the Wi-Fi Direct activation instruction information into sound waves of different frequencies and transmits them outward using its own sound playback device;

[0198] Then, when the sound receiving device on the server side receives the sound waves sent by the client side, it decodes the received sound waves, decodes the Wi-Fi Direct connection start instruction information, immediately starts the Wi-Fi Direct communication service, and creates a group. At the same time, the client also starts the Wi-Fi Direct communication service and scans. After receiving the scan instruction, the server side returns the scan result, which includes the group identifier. The client sends a Wi-Fi Direct connection instruction to the second electronic device based on the group identifier; after receiving the Wi-Fi Direct connection instruction, the server side generates a Wi-Fi Direct invitation box, and returns the connection status by confirming the connection. This enables fast network configuration of Wi-Fi Direct devices.

[0199] Similarly, see Figure 4 As shown, the Bluetooth-based networking process may include:

[0200] First, the client starts Bluetooth;

[0201] Secondly, the server publishes a BLE broadcast and monitors the connection;

[0202] After that, the client searches for the BLE broadcast service and establishes a Bluetooth connection with the server. At the same time, it sends the Wi-Fi Direct start command information to the server;

[0203] Then, when the server receives the Wi-Fi Direct start instruction information, it immediately starts the WiFi Direct communication service and creates a group. At the same time, the client also starts the Wi-Fi Direct communication service and scans. After receiving the scan instruction, the server returns the scan result, which includes the group identifier. The client sends a Wi-Fi Direct connection instruction to the second electronic device based on the group identifier; after receiving the Wi-Fi Direct connection instruction, the server generates a Wi-Fi Direct invitation box, and returns the connection status by confirming the connection. This enables fast network configuration of Wi-Fi Direct devices.

[0204] After a Wi-Fi Direct connection is established between the server and the client, start the BFD detection and netd service, and use the BFD detection mechanism to detect the connection status of the Wi-Fi connection.

[0205] In response to the BFD detection result indicating that the server and the client have completed the interaction, the Wi-Fi direct communication service between the server and the client is automatically triggered to be closed.

[0206] According to some embodiments of the present application, a networking device is also provided, which is applied to a first electronic device. Figure 5 As shown, the networking device 500 includes:

[0207] The sending module 501 is configured to, in response to a first direct connection based on a first transmission mode being established between the first electronic device and the second electronic device, send second direct connection start instruction information to the second electronic device through a channel of the first direct connection, so that the second electronic device can start a second direct communication service based on the second transmission mode in response to the second direct connection start instruction information;

[0208] The enabling module 502 is configured to enable a second direct communication service based on a second transmission mode in response to the second direct connection enabling instruction information, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

[0209] According to some embodiments of the present application, a networking device is also provided, which is applied to a second electronic device. Figure 6 As shown, the networking device 600 includes:

[0210] The receiving module 601 is configured to, in response to a first direct connection based on a first transmission mode being established between the first electronic device and the second electronic device, receive second direct connection start instruction information sent by the first electronic device through a channel of the first direct connection;

[0211] The enabling module 602 is configured to enable a second direct communication service based on a second transmission mode in response to the second direct connection enabling instruction information, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

[0212] The operation of each module of the networking device is similar to the operation of each step of the networking method described above, and will not be repeated here.

[0213] According to some embodiments of the present application, there is also provided an electronic device, comprising: a memory; and at least one processor, wherein the memory stores a computer program, and the computer program can be executed by the at least one processor to implement the above method.

[0214] According to some embodiments of the present application, an intelligent communication system is also provided, including: the above-mentioned electronic device.

[0215] According to some embodiments of the present application, a non-transitory computer-readable storage medium storing a computer program is also provided, wherein the computer program implements the above method when executed by a processor.

[0216] According to some embodiments of the present application, a computer program product is also provided, including a computer program, and the computer program implements the above method when executed by a processor.

[0217] See also Figure 7 , a block diagram of an electronic device 700 that can be used as the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device can be a computer device of different types, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0218] Figure 7 1 shows a block diagram of an electronic device according to an embodiment of the present disclosure. Figure 7As shown, the electronic device 700 may include at least one processor 701 , a working memory 702 , an I / O device 704 , a display device 705 , a storage device 706 , and a communication interface 707 that can communicate with each other via a system bus 703 .

[0219] The processor 701 may be a single processing unit or multiple processing units, all of which may include a single or multiple computing units or multiple cores. The processor 701 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, state machines, logic circuits, and / or any device that manipulates signals based on operating instructions. The processor 701 may be configured to obtain and execute computer-readable instructions stored in a working memory 702, a storage device 706, or other computer-readable media, such as program codes of an operating system 702a, program codes of an application 702b, and the like.

[0220] The working memory 702 and the storage device 706 are examples of computer-readable storage media for storing instructions, which are executed by the processor 701 to implement the various functions described above. The working memory 702 may include both volatile memory and non-volatile memory (e.g., RAM, ROM, etc.). In addition, the storage device 706 may include a hard disk drive, a solid-state drive, a removable medium, including external and removable drives, a memory card, a flash memory, a floppy disk, an optical disk (e.g., CD, DVD), a storage array, a network attached storage, a storage area network, etc. The working memory 702 and the storage device 706 may all be collectively referred to herein as memory or computer-readable storage media, and may be a non-transitory medium capable of storing computer-readable, processor-executable program instructions as computer program code, which may be executed by the processor 501 as a specific machine configured to implement the operations and functions described in the examples herein.

[0221] The I / O device 704 may include an input device and / or an output device. The input device may be any type of device capable of inputting information to the electronic device 700, and may include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output device may be any type of device capable of presenting information, and may include but is not limited to a video / audio output terminal, a vibrator, and / or a printer.

[0222] The communication interface 707 allows the electronic device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as a Bluetooth™ device, an 802.11 device, a Wi-Fi device, a WiMax device, a cellular communication device and / or the like.

[0223] The application 702b in the working register 702 can be loaded to execute the various methods and processes described above, such as Figure 1 In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 700 via the storage device 706 and / or the communication interface 707. When the computer program is loaded and executed by the processor 701, one or more steps of the networking method described above may be executed.

[0224] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0225] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0226] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0227] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0228] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0229] A computing system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

[0230] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be performed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document is not limited here.

[0231] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.

Claims

1. A networking method based on direct communication, applied to a first electronic device, characterized in that: The networking method comprises: In response to establishing a first direct connection based on a first transmission mode between the first electronic device and the second electronic device, sending second direct connection start instruction information to the second electronic device through a channel of the first direct connection, so that the second electronic device can start a second direct communication service based on a second transmission mode in response to the second direct connection start instruction information; In response to the second direct connection start instruction information, a second direct communication service based on a second transmission mode is started, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

2. The networking method according to claim 1, characterized in that: The energy consumption of the first direct communication service based on the first transmission mode when being in an enabled state is less than the energy consumption of the second direct communication service when being in an enabled state.

3. The networking method according to claim 2, characterized in that: The first direct connection includes a Bluetooth connection and / or an ultrasonic connection, and the second direct connection is a Wi-Fi direct connection.

4. The networking method according to claim 1, characterized in that: Also includes: In response to a preset operation, a first direct communication service of the first electronic device is started.

5. The networking method according to claim 4, characterized in that: The preset operation includes a target operation indicated by the user for opening the first direct communication service, and / or opening a target application.

6. The networking method according to claim 1, characterized in that: The second direct connection start instruction information includes a first function code and the second direct connection start instruction, wherein the first function code is used to indicate channel information of the first direct connection.

7. The networking method according to claim 6, characterized in that: The sending second direct connection start instruction information to the second electronic device through the first direct connection channel includes: Encrypting the second direct connection opening instruction by using the first function code as a key to generate an encrypted second direct connection opening instruction; The first function code and the encrypted second direct connection opening instruction are sent to the second electronic device through the channel of the first direct connection.

8. The networking method according to claim 7, characterized in that: The second direct connection opening instruction is encrypted using an XOR encryption algorithm and the first function code as a key.

9. The networking method according to claim 1, characterized in that: Also includes: In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, interacting with the second electronic device through a channel of the second direct connection; as well as In response to determining that the interaction between the first electronic device and the second electronic device is completed, closing the second direct communication service.

10. The networking method according to claim 1, characterized in that: Also includes: In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, interacting with the second electronic device through a channel of the second direct connection; as well as In response to determining that the interaction between the first electronic device and the second electronic device is completed, a second direct connection closing instruction message is sent to the second electronic device through the channel of the first direct connection, and the second electronic device can close the second direct communication service based on the second transmission mode in response to the second direct connection opening instruction message.

11. The networking method according to claim 10, characterized in that: Also includes: In response to the second direct connection closing instruction information, the second direct connection communication service is closed.

12. The networking method according to any one of claims 9 to 11, characterized in that: Also includes: In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, detecting a connection state of the second direct connection using a detection mechanism; Wherein, based on the detection result obtained by using the detection mechanism, it is determined whether the interaction between the first electronic device and the second electronic device is completed.

13. The networking method according to claim 1, characterized in that: Also includes: In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, a connection state of the second direct connection is detected using a bidirectional forwarding detection mechanism.

14. The networking method according to any one of claims 1 to 11 and 13, characterized in that: The first direct connection includes a first direct-connection sub-connection and a second direct-connection sub-connection; In response to at least one of a first direct connection and a second direct connection being established between the first electronic device and the second electronic device, second direct connection start instruction information is sent to the second electronic device through the channel of the first direct connection.

15. The networking method according to any one of claims 1 to 11 and 13, characterized in that: The process of establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device includes: The second direct connection instruction information is sent to the second electronic device through the first direct connection channel, so that a second direct connection based on the second transmission mode is established between the first electronic device and the second electronic device.

16. The networking method according to claim 15, characterized in that: The second direct connection includes a Wi-Fi direct connection, and one of the first electronic device and the second electronic device starts a Wi-Fi hotspot service, and the other electronic device is connected to the Wi-Fi hotspot.

17. The networking method according to claim 15, characterized in that: The second direct connection includes a Wi-Fi direct connection, and at most one of the first electronic device and the second electronic device is connected to any Wi-Fi hotspot.

18. The networking method according to claim 15, characterized in that: The second direct connection instruction information includes a second function code and a second direct connection instruction, where the second function code is used to indicate channel information of the first direct connection.

19. A networking method based on direct communication, applied to a second electronic device, characterized in that: The networking method comprises: In response to establishing a first direct connection based on a first transmission mode between the first electronic device and the second electronic device, receiving second direct connection start instruction information sent by the first electronic device through a channel of the first direct connection; In response to the second direct connection start instruction information, a second direct communication service based on a second transmission mode is started, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

20. The networking method according to claim 19, characterized in that: In response to turning on the second electronic device, the first direct communication service is started.

21. The networking method according to claim 19, characterized in that: The second direct connection opening instruction information includes a first function code and the second direct connection opening instruction, wherein the first function code is used to indicate channel information of the first direct connection; In response to the second direct connection start instruction information, starting a second direct connection communication service based on a second transmission mode includes: Parsing the second direct connection start instruction received from the first electronic device to obtain the first function code; Decrypting the second direct connection opening instruction by using the first function code as a key to obtain the decrypted second direct connection opening instruction; Based on the second direct connection start instruction, a second direct connection communication service based on the second transmission mode is started.

22. The networking method according to claim 19, characterized in that: Also includes: In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, interacting with the first electronic device through a channel of the second direct connection; as well as In response to determining that the interaction between the first electronic device and the second electronic device is completed, closing the second direct communication service.

23. The networking method according to claim 19, characterized in that: Also includes: In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, interacting with the first electronic device through a channel of the second direct connection; as well as In response to determining that the interaction between the first electronic device and the second electronic device is completed, receiving second direct connection closing instruction information sent by the first electronic device through the channel of the first direct connection; In response to the second direct connection closing instruction information, the second direct connection communication service based on the second transmission mode is closed.

24. The networking method according to claim 22 or 23, characterized in that: Also includes: In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, detecting a connection state of the second direct connection using a detection mechanism; Wherein, based on the detection result obtained by using the detection mechanism, it is determined whether the interaction between the first electronic device and the second electronic device is completed.

25. The networking method according to claim 19, characterized in that: Also includes: In response to the first electronic device establishing the second direct connection with the second electronic device being empty, closing the second direct communication service based on the second transmission mode.

26. The networking method according to claim 19, characterized in that: Also includes: In response to establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device, a connection state of the second direct connection is detected using a bidirectional forwarding detection mechanism.

27. The method according to any one of claims 19-23, 25 and 26, characterized in that: The first direct connection includes a first direct-connection sub-connection and a second direct-connection sub-connection; In response to at least one of a first direct connection and a second direct connection being established between the first electronic device and the second electronic device, second direct connection start instruction information sent by the first electronic device is received through the channel of the first direct connection.

28. The method according to any one of claims 19-23, 25 and 26, characterized in that The process of establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device includes: In response to receiving the second direct connection instruction information sent by the first electronic device, generating a second direct connection invitation frame; Obtaining a target image including the second direct connection invitation frame; Obtaining location information indicated by information used to indicate connection confirmation in the target image; Based on the location information, simulating a connection confirmation operation of the user for the information indication through software to complete the connection confirmation; In response to the connection confirmation operation, second direct connection confirmation information is sent to the first electronic device through the channel of the first direct connection.

29. The method according to claim 27, characterized in that: The process of establishing a second direct connection based on a second transmission mode between the first electronic device and the second device further includes: Create groups; In response to receiving a scan instruction sent by the first electronic device, a scan result is sent to the first electronic device, the scan result includes an identifier of the group, and the first electronic device sends second direct connection instruction information to the second electronic device based on the group identifier.

30. The method according to any one of claims 19-23, 25 and 26, characterized in that: The process of establishing a second direct connection based on a second transmission mode between the first electronic device and the second electronic device includes: The second direct connection instruction information is sent to the second electronic device through the first direct connection channel, so that a second direct connection based on the second transmission mode is established between the first electronic device and the second electronic device.

31. A networking device, applied to a first electronic device, characterized in that: The networking device comprises: a sending module configured to, in response to a first direct connection based on a first transmission mode being established between the first electronic device and the second electronic device, send second direct connection start instruction information to the second electronic device through a channel of the first direct connection, so that the second electronic device can start a second direct communication service based on a second transmission mode in response to the second direct connection start instruction information; The activation module is configured to activate a second direct communication service based on a second transmission mode in response to the second direct connection activation instruction information, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

32. A networking device, applied to a second electronic device, characterized in that: The networking device comprises: a receiving module configured to, in response to a first direct connection based on a first transmission mode being established between the first electronic device and the second electronic device, receive second direct connection start instruction information sent by the first electronic device through a channel of the first direct connection; The activation module is configured to activate a second direct communication service based on a second transmission mode in response to the second direct connection activation instruction information, so that a second direct connection based on the second transmission mode can be established between the first electronic device and the second electronic device.

33. An electronic device, characterized in that: include: Memory; At least one processor, the memory stores a computer program, and the computer program can be executed by the at least one processor to implement the method according to any one of claims 1 to 18.

34. An electronic device, characterized in that: include: Memory; At least one processor, the memory stores a computer program, and the computer program can be executed by the at least one processor to implement the method according to any one of claims 19 to 30.

35. An intelligent communication system, characterized in that: include: The electronic device as claimed in claims 33 and 34.

36. A non-transitory computer-readable storage medium storing a computer program, wherein: When the computer program is executed by a processor, the computer program implements the method according to any one of claims 1 to 18 or any one of claims 19 to 30.

37. A computer program product, comprising a computer program, which, when executed by a processor, implements the method of any one of claims 1-18, or any one of claims 19-30.

Citation Information

Cited By

  • Networking method and device of portable equipment, portable equipment and medium

    CN120050636A