A network distribution method, device, equipment and medium
By receiving and broadcasting data packets containing device identifiers and network login information, the problem of low device network configuration efficiency in existing technologies is solved, enabling fast and accurate device network access and improving network configuration efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUHAI PANTUM ELECTRONICS CO LTD
- Filing Date
- 2022-12-08
- Publication Date
- 2026-05-12
AI Technical Summary
现有技术中,设备配网效率低,尤其在多设备配网时需频繁建立连接导致效率低,或者在复杂网络环境中设备难以捕获登录信息,导致配网效率不高。
By receiving data packets broadcast by a second electronic device, the target device is identified, and a data packet containing device identification information and network login information is broadcast, enabling rapid network configuration of the target device and avoiding the need to establish a communication connection in advance.
It improves the network configuration efficiency of target devices, ensures that devices accurately obtain network login information, reduces network configuration time, and improves the overall efficiency of multi-device network configuration.
Smart Images

Figure CN116321358B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, specifically to a distribution network method, apparatus, equipment, and medium. Background Technology
[0002] With the popularization of IoT and internet technologies, more and more devices are equipped with wireless network access capabilities. Most of these devices are characterized by their small size and low power consumption, and do not have built-in input devices such as touchscreens and keyboards. They cannot connect to the network directly and need to use a smart terminal, such as a mobile phone, to send network login information to the device.
[0003] Currently, in related technologies, when devices need to be configured for network access, two methods are typically used. The first method involves establishing a connection between the smart terminal and the device, sending the target network's login information to the device via this connection, allowing the device to access the target network based on the received login information. The second method uses a broadcast protocol to transmit network configuration information; that is, the smart terminal broadcasts login information via broadcast, allowing the device to receive the login information and access the target network.
[0004] However, for the two network configuration methods mentioned above, the first method, when multiple devices need to transmit network login information, requires the smart terminal to establish a connection with the device before disconnecting after transmitting the login information each time. This makes it impossible to transmit login information to multiple devices in a short time, resulting in low network configuration efficiency. The second method, in complex network environments, makes it difficult for devices to capture the correct login information, leading to low network configuration efficiency as well. Summary of the Invention
[0005] In view of this, this application provides a power distribution method, apparatus, equipment and medium to help solve the problem of low power distribution efficiency in the prior art.
[0006] In a first aspect, embodiments of this application provide a network distribution method applied to a first electronic device, the method comprising:
[0007] The system receives a first data packet broadcast by a second electronic device; the first data packet carries device information of the second electronic device; the device information includes device identification information.
[0008] The target device is determined based on the device information of the second electronic device;
[0009] Obtain login information of the target network, and broadcast a second data packet to the target device based on the device information of the target device and the login information of the target network; the second data packet includes the device information of the target device and the login information of the target network.
[0010] In conjunction with the first aspect, one feasible implementation also includes:
[0011] Obtain the network distribution result information of the target device.
[0012] In conjunction with the first aspect, in one feasible implementation, determining the target device in the second electronic device includes:
[0013] In response to the user's selection, the target device is identified in the second electronic device.
[0014] In conjunction with the first aspect, in one feasible implementation, obtaining the login information of the target network includes:
[0015] When the first electronic device accesses the network, the network accessed by the first electronic device is determined as the target network, and the login information of the target network is obtained; or,
[0016] When the first electronic device is not connected to the network, it obtains the login information of the target network in response to the user's login information input operation.
[0017] In conjunction with the first aspect, in one feasible implementation, broadcasting the second data packet to the target device based on the device information of the target device and the login information of the target network includes:
[0018] According to the predetermined packet splitting rules, the login information of the target network is split into a preset number of second data packets, and each second data packet carries the device information of the target device;
[0019] Broadcast the preset number of second data packets to the target device.
[0020] In conjunction with the first aspect, in one feasible implementation, each second data packet further carries at least one of the following: a preset number of data, an index of data, and a random number of data generated by the first electronic device.
[0021] In conjunction with the first aspect, in one feasible implementation, broadcasting the preset number of second data packets to the target device includes:
[0022] The preset number of second data packets are encrypted according to a preset encryption key;
[0023] The preset number of encrypted second data packets are broadcast to the target device.
[0024] In conjunction with the first aspect, in one feasible implementation, broadcasting the preset number of second data packets to the target device includes:
[0025] The preset number of second data packets are broadcast to the target device at preset time intervals, and the broadcast order of the preset number of second data packets is predetermined or randomly determined. The broadcast order of each second data packet is the same as or different from the index information of the second data packet.
[0026] In conjunction with the first aspect, in one feasible implementation, the preset encryption key is device information obtained from the target device or other encryption keys.
[0027] In conjunction with the first aspect, in one feasible implementation, obtaining the distribution network result information of the target device includes:
[0028] Receive the third data packet broadcast by the target device, and obtain the network distribution result information based on the third data packet; wherein,
[0029] The third data packet includes: network distribution status information of the target device; the network distribution status information is used to characterize the access status of the target device to the target network; or,
[0030] The third data packet includes: a random number from the first electronic device and a network status identifier bit; the network status identifier bit is used to indicate the access status of the target device to the target network; or...
[0031] The third data packet includes: an Internet Protocol (IP) address indicating the network configuration status; wherein when the target device is in a successful network configuration state, the IP address is the target device's IP address; when the target device is in a non-configured network or failed network configuration state, the IP address is a first reserved IP address; when the target device is in a network configuration process state, the IP address is a second reserved IP address; wherein both the first reserved IP address and the second reserved IP address are different from the target device's IP address.
[0032] In conjunction with the first aspect, in one feasible implementation, the first data packet, the second data packet, and the third data packet include at least one BLE broadcast packet.
[0033] In conjunction with the first aspect, in one feasible implementation, obtaining the distribution network result information of the target device includes:
[0034] Broadcast the IP address and port number of the first electronic device to the target device;
[0035] If a Transmission Control Protocol (TCP) connection establishment request message is received from the target device, a TCP connection is established with the target device.
[0036] The network distribution result information is received through the TCP connection.
[0037] In conjunction with the first aspect, in one feasible implementation, obtaining the distribution network result information of the target device includes:
[0038] Establish a wireless connection with the target device;
[0039] The network configuration result information of the target device is obtained through the wireless connection.
[0040] In conjunction with the first aspect, one feasible implementation also includes:
[0041] If the network distribution result information sent by the target device is not received within the first preset time, the device identification information of the target device is obtained, and the target device is searched within the target network based on the device identification information of the target device.
[0042] If the target device is found within the second preset time, the network configuration is determined to be successful; otherwise, the network configuration is determined to be unsuccessful.
[0043] In conjunction with the first aspect, in one feasible implementation, obtaining the distribution network result information of the target device includes:
[0044] Obtain the device identification information of the target device, and search for the target device within the target network based on the device identification information of the target device;
[0045] If the target device is found within the third preset time, the network configuration is successful; otherwise, the network configuration fails.
[0046] In conjunction with the first aspect, one feasible implementation also includes:
[0047] Display network distribution results and related information to users.
[0048] In conjunction with the first aspect, in one feasible implementation, the instruction information for displaying the distribution network results to the user includes:
[0049] Display information to the user instructing them to observe the network indicator light status of the target device; or,
[0050] When the target device is successfully configured for network connection, the device information of the target device is displayed to the user.
[0051] In conjunction with the first aspect, in one feasible implementation, before broadcasting the second data packet to the target device based on the device identification information of the target device and the login information of the target network, the method further includes:
[0052] Send a prompt message to the user; the prompt message is used to prompt the user to trigger the target device to enter the scanning state.
[0053] In conjunction with the first aspect, in one feasible implementation, determining the target device based on the device information of the second electronic device includes:
[0054] In response to the user's selection action, the target device is determined based on the device information of the second electronic device.
[0055] In conjunction with the first aspect, in one feasible implementation, obtaining the login information of the target network includes:
[0056] When the first electronic device accesses the network, the network accessed by the first electronic device is determined as the target network, and the login information of the target network is obtained; or,
[0057] When the first electronic device is not connected to the network, it obtains the login information of the target network in response to the user's login information input operation.
[0058] Secondly, embodiments of this application provide a network distribution method applied to a target device, the method comprising:
[0059] A first data packet is broadcast to a first electronic device; the first data packet carries device information of the target device; the device information includes device identification information;
[0060] Obtain the second data packet broadcast by the first electronic device, the second data packet including device information and login information of the target network;
[0061] When the device information in the second data packet is the device information of the target device, the login information of the target network contained in the second data packet is obtained, and the target network is accessed based on the login information of the target network.
[0062] In conjunction with the second aspect, one feasible implementation also includes:
[0063] Send the distribution network result information to the first electronic device.
[0064] In conjunction with the second aspect, in one feasible implementation, obtaining the second data packet broadcast by the first electronic device includes:
[0065] Obtain a preset number of second data packets broadcast by the first electronic device;
[0066] When the device information in the second data packet is the device information of the target device, obtaining the login information of the target network contained in the second data packet includes:
[0067] When the device information in the preset number of second data packets are all device information of the target device, the login information of the target network carried in the preset number of second data packets is combined to obtain the complete login information of the target network.
[0068] In conjunction with the second aspect, in one feasible implementation, the second data packet also carries at least one of the following: preset number information, index information, and random number information generated by the first electronic device.
[0069] The step of combining the login information of the target network carried in a preset number of second data packets to obtain the complete login information of the target network includes: combining the login information of the target network carried in a preset number of second data packets according to the index information and / or preset number information carried in each second data packet to obtain the complete login information of the target network.
[0070] In conjunction with the second aspect, in one feasible implementation, sending the distribution network result information to the first electronic device includes:
[0071] Broadcast a third data packet to the first electronic device; wherein,
[0072] The third data packet includes: network distribution status information of the target device; the network distribution status information is used to characterize the access status of the target device to the target network; or,
[0073] The third data packet includes: a random number from the first electronic device and a network status identifier bit; the network status identifier bit is used to indicate the access status of the target device to the target network; or...
[0074] The third data packet includes: an IP address indicating the network configuration status; wherein when the target device is in a successful network configuration state, the IP address is the IP address of the target device; when the target device is in a non-configured network state or a failed network configuration state, the IP address is a first reserved IP address; when the target device is in a network configuration process state, the IP address is a second reserved IP address; wherein both the first reserved IP address and the second reserved IP address are different from the IP address of the target device.
[0075] In conjunction with the second aspect, in one feasible implementation, sending the distribution network result information to the first electronic device includes:
[0076] Listen for the IP address and port number of the first electronic device broadcast by the first electronic device;
[0077] When accessing the target network, a TCP connection establishment request message is sent to the first electronic device based on the IP address and port number of the first electronic device to establish a TCP connection with the first electronic device;
[0078] The network configuration result information is sent to the first electronic device through the TCP connection.
[0079] In conjunction with the second aspect, in one feasible implementation, sending the distribution network result information to the first electronic device includes:
[0080] Establish a wireless connection with the first electronic device;
[0081] The network configuration result information is sent to the first electronic device via the wireless connection.
[0082] In conjunction with the second aspect, in one feasible implementation, before obtaining the second data packet broadcast by the first electronic device, the method further includes:
[0083] In response to a user's trigger action, enter scanning mode.
[0084] Thirdly, embodiments of this application provide a power distribution method, including:
[0085] The first electronic device identifies the target device;
[0086] A prompt message is displayed, prompting the user to trigger the button on the target device to generate a scan indication signal and put it into scan mode;
[0087] The first electronic device broadcasts a second data packet, which includes device information of the target device and login information of the target network;
[0088] The target device enters a scanning state in response to the scanning instruction signal and begins to receive the second data packet broadcast by the first electronic device;
[0089] The target device accesses the target network based on the received second data packet.
[0090] In conjunction with the third aspect, in one feasible implementation, before the first electronic device confirms the target device, the process includes: the target device broadcasting a first data packet to the first electronic device, the first data packet carrying device information of the target device; the device information including device identification information.
[0091] In conjunction with the third aspect, in one feasible implementation, the distribution network method further includes obtaining the distribution network result information of the target device.
[0092] Fourthly, embodiments of this application provide a distribution network device, including: a first receiving unit, configured to receive a first data packet broadcast by a second electronic device; the first data packet carries device identification information of the second electronic device;
[0093] The first processing unit is configured to determine the target device based on the device information of the second electronic device;
[0094] The first processing unit is further configured to acquire login information of the target network, and broadcast a second data packet to the target device based on the device identification information of the target device and the login information of the target network; the second data packet includes the device information of the target device and the login information of the target network.
[0095] Fifthly, embodiments of this application provide a power distribution network device, including:
[0096] A broadcast unit is used to broadcast a first data packet to a first electronic device; the first data packet carries device information of the target device; the device information includes device identification information.
[0097] The second processing unit is used to acquire the second data packet broadcast by the first electronic device, the second data packet including device information and login information of the target network;
[0098] The second processing unit is further configured to, when the device information in the second data packet is the device information of the target device, obtain the login information of the target network contained in the second data packet, and access the target network based on the login information of the target network.
[0099] Sixthly, embodiments of this application provide a network distribution method applied to a first electronic device, the method comprising:
[0100] Obtain device information of the target device; the device information includes device identification information;
[0101] Establish a connection with the target device based on the device identification information of the target device;
[0102] A scan start command is sent to the target device via the connection; the scan start command is used to instruct the target device to enter the scanning state.
[0103] Obtain login information of the target network, and broadcast a first broadcast packet to the target device based on the device information of the target device and the login information of the target network; the first broadcast packet includes the device information of the target device and the login information of the target network.
[0104] In conjunction with the sixth aspect, in one feasible implementation, after broadcasting the first broadcast packet to the target device based on the device information of the target device and the login information of the target network, the method further includes:
[0105] Through the connection, a stop scanning command is sent to the target device; the stop scanning command is used to instruct the target device to stop scanning.
[0106] In conjunction with the sixth aspect, in one feasible implementation, sending a stop scanning command to the target device via the connection includes:
[0107] Upon receiving a first broadcast packet reception completion message from the target device, or when the time for completing the first broadcast packet reception reaches a preset time threshold, a stop scanning command is sent to the target device via the connection; the first broadcast packet reception completion message is used to indicate that the target device has completed the reception of the first broadcast packet.
[0108] In conjunction with the sixth aspect, in one feasible implementation, establishing a connection with the target device based on the device identification information of the target device includes:
[0109] When the first electronic device is connected to the wireless network, disconnect from the wireless network and establish a wireless connection with the target device based on the target device's device identification information; or...
[0110] If the first electronic device has not established a connection with the wireless network, a wireless connection with the target device is established based on the device identification information of the target device.
[0111] In conjunction with the sixth aspect, in one feasible implementation, after sending a stop scanning command to the target device via the connection, the method further includes:
[0112] Disconnect the wireless connection with the target device; establish a wireless connection with the target network based on the login information of the target network.
[0113] In conjunction with the sixth aspect, in one feasible implementation, before establishing a connection with the target device based on the identification information of the target device, the method further includes:
[0114] Send a prompt message to the user to enable the wireless connection function of the target device.
[0115] In conjunction with the sixth aspect, in one feasible implementation, obtaining the device information of the target device includes:
[0116] Scan the barcode identification information of the target device to obtain the device information of the target device; the barcode identification information of the target device contains the device information of the target device.
[0117] In conjunction with the sixth aspect, in one feasible implementation, obtaining the device information of the target device includes:
[0118] Receive a second broadcast packet broadcast by the target device, the second broadcast packet carrying device information of the target device;
[0119] Based on the second broadcast packet, obtain the device information of the target device.
[0120] In conjunction with the sixth aspect, in one feasible implementation, the device information of the target device further includes: the login information of the target device;
[0121] The step of establishing a connection with the target device based on the device identification information of the target device includes:
[0122] A connection is established with the target device based on the device identification information and login information of the target device.
[0123] In conjunction with the sixth aspect, in one feasible implementation, obtaining the login information of the target network includes:
[0124] When the first electronic device accesses the network, the network accessed by the first electronic device is determined as the target network, and the login information of the target network is obtained; or,
[0125] When the first electronic device is not connected to the network, it obtains the login information of the target network in response to the user's login information input operation.
[0126] In conjunction with the sixth aspect, in one feasible implementation, broadcasting the first broadcast packet to the target device based on the device information of the target device and the login information of the target network includes:
[0127] According to the predetermined packet splitting rules, the login information of the target network is split into a preset number of first broadcast packets, and each first broadcast packet carries the device information of the target device;
[0128] The preset number of first broadcast packets are broadcast to the target device.
[0129] In conjunction with the sixth aspect, in one feasible implementation, each first broadcast packet further carries at least one of the following: preset number information, index information, and random number information generated by the first electronic device.
[0130] In conjunction with the sixth aspect, in one feasible implementation, broadcasting the preset number of first broadcast packets to the target device includes:
[0131] The preset number of first broadcast packets are encrypted according to a preset encryption key;
[0132] The preset number of encrypted first broadcast packets are broadcast to the target device.
[0133] In conjunction with the sixth aspect, in one feasible implementation, broadcasting the preset number of first broadcast packets to the target device includes:
[0134] The preset number of first broadcast packets are broadcast to the target device at preset time intervals, and the broadcast order of the preset number of first broadcast packets is predetermined or randomly determined. The broadcast order of each first broadcast packet is the same as or different from the index information of the first broadcast packet.
[0135] In conjunction with the sixth aspect, one feasible implementation also includes:
[0136] Obtain the network distribution result information of the target device.
[0137] In conjunction with the sixth aspect, in one feasible implementation, obtaining the distribution network result information of the target device includes:
[0138] Receive a third broadcast packet broadcast by the target device, and obtain the network distribution result information based on the third broadcast packet; wherein,
[0139] The third broadcast packet includes: network distribution status information of the target device; the network distribution status information is used to characterize the access status of the target device to the target network; or...
[0140] The third broadcast packet includes: a random number from the first electronic device and a network status identifier bit; the network status identifier bit is used to indicate the access status of the target device accessing the target network; or...
[0141] The third broadcast packet includes: an Internet Protocol (IP) address indicating the network configuration status; wherein when the target device is in a successful network configuration state, the IP address is the target device's IP address; when the target device is in a non-configured network or failed network configuration state, the IP address is a first reserved IP address; when the target device is in a network configuration process state, the IP address is a second reserved IP address; wherein both the first reserved IP address and the second reserved IP address are different from the target device's IP address.
[0142] In conjunction with the fifth aspect, in one feasible implementation, the first broadcast packet, the second broadcast packet, and the third broadcast packet include at least one Bluetooth Low Energy (BLE) broadcast packet.
[0143] In conjunction with the sixth aspect, one feasible implementation also includes:
[0144] If the network distribution result information sent by the target device is not received within the first preset time, the device identification information of the target device is obtained, and the target device is searched within the target network based on the device identification information of the target device.
[0145] If the target device is found within the second preset time, the network configuration is determined to be successful; otherwise, the network configuration is determined to be unsuccessful.
[0146] In conjunction with the sixth aspect, in one feasible implementation, obtaining the distribution network result information of the target device includes:
[0147] Broadcast the IP address and port number of the first electronic device to the target device;
[0148] If a Transmission Control Protocol (TCP) connection establishment request message is received from the target device, a TCP connection is established with the target device.
[0149] The network distribution result information is received through the TCP connection.
[0150] In conjunction with the sixth aspect, in one feasible implementation, obtaining the distribution network result information of the target device includes:
[0151] Establish a wireless connection with the target device;
[0152] The network configuration result information of the target device is obtained through the wireless connection.
[0153] In conjunction with the sixth aspect, in one feasible implementation, obtaining the distribution network result information of the target device includes:
[0154] Obtain the device identification information of the target device, and search for the target device within the target network based on the device identification information of the target device;
[0155] If the target device is found within the third preset time, the network configuration is successful; otherwise, the network configuration fails.
[0156] In conjunction with the sixth aspect, one feasible implementation also includes:
[0157] Display network distribution results and related information to users.
[0158] In conjunction with the sixth aspect, in one feasible implementation, the instruction information for displaying the distribution network results to the user includes:
[0159] Display information to the user instructing them to observe the network indicator light status of the target device; or,
[0160] When the target device is successfully configured for network connection, the device information of the target device is displayed to the user.
[0161] Seventhly, embodiments of this application provide a power distribution method applied to a target device, the method comprising:
[0162] Establish a connection with the first electronic device;
[0163] Through the connection, the device receives a scan start command sent by the first electronic device and enters a scanning state in response to the scan start command; the scan start command is used to instruct the target device to enter a scanning state.
[0164] Obtain the first broadcast packet broadcast by the first electronic device, the first broadcast packet including device information and login information of the target network;
[0165] When the device information in the first broadcast packet is the device information of the target device, the login information of the target network contained in the first broadcast packet is obtained, and the target network is accessed based on the login information of the target network.
[0166] In conjunction with the seventh aspect, one feasible implementation also includes:
[0167] Through the connection, a stop scanning command sent by the first electronic device is received; the stop scanning command is used to instruct the target device to stop scanning;
[0168] In response to the stop scan command, the scan is stopped.
[0169] In conjunction with the seventh aspect, in one feasible implementation, prior to receiving the stop scanning command sent by the first electronic device via the connection, the method further includes:
[0170] Upon completion of receiving the first broadcast packet, a first broadcast packet reception completion message is sent to the first electronic device; the first broadcast packet reception completion message is used to indicate that the target device has completed receiving the first broadcast packet.
[0171] In conjunction with the seventh aspect, in one feasible implementation, prior to establishing the connection with the first electronic device, the method further includes:
[0172] In response to a user-triggered activation of the target device's wireless connection function, the wireless connection function is initiated.
[0173] In conjunction with the seventh aspect, one feasible implementation also includes:
[0174] Generate the barcode identification information of the target device; the barcode identification information of the target device contains the device information of the target device; the device information of the target device includes the device identification information of the target device.
[0175] In conjunction with the seventh aspect, in one feasible implementation, the device information of the target device also includes the login information of the target device.
[0176] In conjunction with the seventh aspect, in one feasible implementation, prior to establishing the connection with the first electronic device, the method further includes:
[0177] A second broadcast packet is broadcast to the first electronic device, the second broadcast packet carrying device information of the target device; the device information of the target device includes device identification information of the target device.
[0178] In conjunction with the seventh aspect, in one feasible implementation, obtaining the first broadcast packet broadcast by the first electronic device includes:
[0179] Obtain a preset number of first broadcast packets broadcast by the first electronic device;
[0180] When the device information in the first broadcast packet is the device information of the target device, obtaining the login information of the target network contained in the first broadcast packet includes:
[0181] When the device information in the first broadcast packets of the preset number are all device information of the target device, the login information of the target network carried in the first broadcast packets of the preset number are combined to obtain the complete login information of the target network.
[0182] In conjunction with the seventh aspect, in one feasible implementation, the first broadcast packet also carries at least one of the following: preset number information, index information, and random number information generated by the first electronic device.
[0183] The step of combining the login information of the target network carried in a preset number of first broadcast packets to obtain the complete login information of the target network includes:
[0184] Based on the index information and / or preset number information carried in each first broadcast packet, the login information of the target network carried in the preset number of first broadcast packets is combined to obtain the complete login information of the target network.
[0185] In conjunction with the seventh aspect, one feasible implementation also includes:
[0186] Send the distribution network result information to the first electronic device.
[0187] In conjunction with the seventh aspect, in one feasible implementation, sending the distribution network result information to the first electronic device includes:
[0188] A third broadcast packet is broadcast to the first electronic device; wherein...
[0189] The third broadcast packet includes: network distribution status information of the target device; the network distribution status information is used to characterize the access status of the target device to the target network; or...
[0190] The third broadcast packet includes: a random number from the first electronic device and a network status identifier bit; the network status identifier bit is used to indicate the access status of the target device accessing the target network; or...
[0191] The third broadcast packet includes: an IP address indicating the network configuration status; wherein when the target device is in a successful network configuration state, the IP address is the target device's IP address; when the target device is in a non-configured network state or a failed network configuration state, the IP address is a first reserved IP address; when the target device is in a network configuration process state, the IP address is a second reserved IP address; wherein both the first reserved IP address and the second reserved IP address are different from the target device's IP address.
[0192] In conjunction with the seventh aspect, in one feasible implementation, sending the distribution network result information to the first electronic device includes:
[0193] Listen for the IP address and port number of the first electronic device broadcast by the first electronic device;
[0194] When accessing the target network, a TCP connection establishment request message is sent to the first electronic device based on the IP address and port number of the first electronic device to establish a TCP connection with the first electronic device;
[0195] The network configuration result information is sent to the first electronic device through the TCP connection.
[0196] In conjunction with the seventh aspect, in one feasible implementation, sending the distribution network result information to the first electronic device includes:
[0197] Establish a wireless connection with the first electronic device;
[0198] The network configuration result information is sent to the first electronic device via the wireless connection.
[0199] Eighthly, embodiments of this application provide a power distribution network device, including:
[0200] The first acquisition unit is used to acquire device information of the target device; the device information includes device identification information.
[0201] The first establishing unit is used to establish a connection with the target device based on the device identification information of the target device;
[0202] The first sending unit is configured to send a scan start command to the target device via the connection; the scan start command is used to instruct the target device to enter the scanning state.
[0203] The first processing unit is configured to acquire login information of the target network and broadcast a first broadcast packet to the target device based on the device information of the target device and the login information of the target network; the first broadcast packet includes the device information of the target device and the login information of the target network.
[0204] Ninthly, embodiments of this application provide a power distribution network device, including:
[0205] The second establishing unit is used to establish a connection with the first electronic device;
[0206] The receiving unit is configured to receive a start scan command sent by the first electronic device through the connection, and to enter a scanning state in response to the start scan command; the start scan command is used to instruct the target device to enter a scanning state.
[0207] The second processing unit is used to obtain a first broadcast packet broadcast by the first electronic device, wherein the first broadcast packet includes device information and login information of the target network;
[0208] The second processing unit is further configured to, when the device information in the first broadcast packet is the device information of the target device, obtain the login information of the target network contained in the first broadcast packet, and access the target network based on the login information of the target network.
[0209] In a tenth aspect, embodiments of this application provide an electronic device, including a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method described in any of the first aspects; or execute the method described in any of the second aspects; or execute the method described in any of the fifth aspects; or execute the method described in any of the sixth aspects.
[0210] Eleventhly, embodiments of this application provide a computer-readable storage medium, the computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to perform the method described in any of the first aspects; or to perform the method described in any of the second aspects; or to perform the method described in any of the fifth aspects; or to perform the method described in any of the sixth aspects.
[0211] Using the solution provided in this application embodiment, after receiving a first data packet broadcast by at least one second electronic device, a target device can be identified among the at least one second electronic device, and the device identification information of the target device can be obtained based on the first data packet of the target device; the login information of the target network can be obtained, and a second data packet is broadcast to the target device based on the device identification information of the target device and the login information of the target network. The second data packet contains the device identification information of the target device and the login information of the target network. That is, in this application embodiment, the device identification information of the target device is added to the second data packet, and the second data packet is broadcast. In this way, since the broadcast second data packet carries the identification information of the target device, the target device can accurately obtain the second data packet, and thus obtain the login information of the target network from the second data packet, improving the network configuration efficiency of the target device. Furthermore, in this application, sending the second data packet by broadcasting does not require establishing a communication connection with the target device beforehand, further improving the network configuration efficiency of the target device. Attached Figure Description
[0212] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0213] Figure 1 This is a schematic diagram of a power distribution network system provided in an embodiment of this application;
[0214] Figure 2 A schematic flowchart of a power distribution method provided in an embodiment of this application;
[0215] Figure 3 A schematic diagram illustrating a distribution network method provided in an embodiment of this application;
[0216] Figure 4 A schematic diagram illustrating another network distribution method provided in this application embodiment;
[0217] Figure 5 A schematic flowchart illustrating another power distribution method provided in an embodiment of this application;
[0218] Figure 6 A schematic flowchart illustrating another power distribution method provided in an embodiment of this application;
[0219] Figure 7 A schematic diagram illustrating another network distribution method provided in this application embodiment;
[0220] Figure 8 This is a schematic diagram of the structure of a power distribution network device provided in an embodiment of this application;
[0221] Figure 9 This is a schematic diagram of another power distribution network device provided in an embodiment of this application;
[0222] Figure 10 This is a schematic diagram of another power distribution network device provided in an embodiment of this application;
[0223] Figure 11 This is a schematic diagram of another power distribution network device provided in an embodiment of this application;
[0224] Figure 12 A schematic flowchart illustrating another power distribution method provided in an embodiment of this application;
[0225] Figure 13 A schematic diagram illustrating another network distribution method provided in this application embodiment;
[0226] Figure 14 A schematic flowchart illustrating another power distribution method provided in an embodiment of this application;
[0227] Figure 15 A schematic flowchart illustrating another power distribution method provided in an embodiment of this application;
[0228] Figure 16 A schematic flowchart illustrating another power distribution method provided in an embodiment of this application;
[0229] Figure 17 This is a schematic diagram of another power distribution network device provided in an embodiment of this application;
[0230] Figure 18 This is a schematic diagram of another power distribution network device provided in an embodiment of this application;
[0231] Figure 19 This is a schematic diagram of another power distribution network device provided in an embodiment of this application;
[0232] Figure 20 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0233] To better understand the technical solution of this application, the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0234] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0235] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0236] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0237] Currently, in related technologies, when devices need to be configured for network access, two methods are typically used. The first method involves establishing a connection between the smart terminal and the device, sending the target network's login information to the device via this connection, allowing the device to access the target network based on the received login information. The second method uses a broadcast protocol to transmit network configuration information; that is, the smart terminal broadcasts login information via broadcast, allowing the device to receive the login information and access the target network.
[0238] However, for the two network configuration methods mentioned above, the first method, when multiple devices need to transmit network login information, requires the smart terminal to establish a connection with the device before disconnecting after transmitting the login information each time. This makes it impossible to transmit login information to multiple devices in a short time, resulting in low network configuration efficiency. The second method, in complex network environments, makes it difficult for devices to capture the correct login information, leading to low network configuration efficiency as well.
[0239] To address the aforementioned problems, this application provides a network configuration method. After receiving a first data packet broadcast by at least one second electronic device, a first electronic device can identify a target device among the at least one second electronic device and obtain the target device's device identification information based on the first data packet. It can also obtain the target network's login information and broadcast a second data packet to the target device based on the target device's device identification information and the target network's login information. The second data packet contains the target device's device identification information and the target network's login information. Specifically, in this application embodiment, the target device's device identification information is added to the second data packet, and the second data packet is broadcast. This way, since the broadcast second data packet carries the target device's identification information, the target device can accurately obtain the second data packet and thus obtain the target network's login information, improving the target device's network configuration efficiency. Furthermore, in this application, sending the second data packet via broadcast does not require pre-establishing a communication connection with the target device, further improving the target device's network configuration efficiency. A detailed description follows.
[0240] See Figure 1 This is a schematic diagram of a power distribution network system provided in an embodiment of this application.
[0241] The network distribution system of this application includes a first electronic device 100, a second electronic device, and a target network 300. The first electronic device 100 can identify the target device 200 from the second electronic device and broadcast a data packet containing the device identification information of the target device 200 and the login information of the target network 300 to the target device 200. Upon receiving this data packet, the target device 200 can access the target network 300. The electronic devices involved in this embodiment, such as the first electronic device 100 and the second electronic device, can be, in addition to mobile phones, tablet computers, personal computers (PCs), personal digital assistants (PDAs), smartwatches, netbooks, wearable electronic devices, augmented reality (AR) devices, virtual reality (VR) devices, desktop computers, other terminal devices without a control panel, or other mobile devices.
[0242] It should be noted that in some possible implementations, the electronic device may also be referred to as a terminal device, user equipment (UE), etc., and the embodiments of this application do not limit this.
[0243] The second electronic device may also be, but is not limited to, an image forming apparatus. An image forming apparatus is a device having at least one function related to image forming, which may include, but is not limited to, printing, scanning, copying, and faxing functions. For example, target device 200 may be a single-function printer, where a single-function printer refers to an image forming apparatus with only printing functionality. Alternatively, target device 200 may be a multifunction printer, where a multifunction printer refers to an image forming apparatus with printing, copying, scanning, and / or faxing functions, and may also selectively set the number of paper trays. Alternatively, target device 200 may be a digital multifunction printer, where a digital multifunction printer is an image forming apparatus that, based on copying functionality, has standard or optional printing, scanning, and faxing functions, uses digital principles, outputs documents via laser printing, can edit images and text as needed, has a large-capacity paper tray, high memory, large hard drive, strong network support, and multi-tasking parallel processing capabilities. There may be multiple target devices 200, such as a first target device, a second target device, etc.
[0244] The target network 300 can be the Internet, a local area network (LAN), or, in some scenarios, a WLAN (Wireless Local Area Network). Typically, electronic devices need login information to log in or access a WLAN. This login information may include a username (SSID, Service Set Identifier) and a password.
[0245] Example 1
[0246] See Figure 2 This is a flowchart illustrating a network distribution method provided in an embodiment of this application. The method is applied to the aforementioned first electronic device. For example... Figure 2 As shown, the method includes:
[0247] Step S201: Receive the first data packet broadcast by the second electronic device.
[0248] The first data packet carries device information for the second electronic device. This device information includes device identification information.
[0249] In this embodiment, the second electronic device, lacking input devices such as a touchscreen and keyboard, cannot directly connect to the network. It needs the assistance of a first electronic device, such as a mobile phone, to send network login information to the second electronic device. Only then can the second electronic device access the network based on the login information sent by the first electronic device. In other words, the second electronic device is a device awaiting network configuration and requires network configuration from the first electronic device to access the network. When the second electronic device needs network configuration, to more accurately obtain network login information, it can send its own device identification information to the first electronic device, allowing the first electronic device to send network login information to the second electronic device based on the device identification information. At this time, the second electronic device can obtain its own device information and encode it to generate a first data packet. Since the device information of the second electronic device is used to identify the second electronic device, it contains device identification information. The device identification information of the second electronic device is used to uniquely identify the second electronic device. For example, the device identification information of the second electronic device can be its serial number (SN). To more accurately identify the second electronic device, the device information of the second electronic device may also include other device information, such as the manufacturer ID (Identity Document), version number, device PID (Product ID), or other information that can uniquely identify itself. No specific restrictions are imposed here.
[0250] After encoding its acquired device information to generate a first data packet, the second electronic device broadcasts the first data packet to the first electronic device. The first electronic device receives the first data packet broadcast by the second electronic device.
[0251] It should be noted that the information contained in the device information of the second electronic device can be preset according to actual needs, and this application does not impose any restrictions on this.
[0252] In one possible implementation, the first data packet broadcast by the second electronic device and received by the first electronic device can be a data packet carrying complete device information. In this case, the first electronic device can receive one first data packet for each second electronic device. Alternatively, the first electronic device can receive a data packet broadcast by the second electronic device that carries partial device information, meaning the second electronic device divides the device information into multiple first data packets for broadcast. In this case, the first electronic device receives multiple first data packets broadcast by the second electronic device and combines these multiple first data packets to obtain the complete device information.
[0253] As one possible implementation, when the first electronic device receives multiple first data packets, each first data packet contains partial device information, index information, and the number of first data packets. After receiving the multiple first data packets, the first electronic device can combine the multiple first data packets according to the index information of each first data packet, and determine whether to acquire all the first data packets based on the number of first data packets. After acquiring all the first data packets, the device information of the second electronic device can be read from the combined multiple first data packets.
[0254] As one possible implementation, to reduce the power consumption of the first electronic device, it will not be in a scanning state for receiving the first data packet broadcast by the second electronic device at all times. It will only enter this state when needed. Therefore, before receiving the first data packet, the first electronic device must first enter a scanning state capable of receiving the first data packet broadcast by the second electronic device. Based on this, the first electronic device receiving the first data packet broadcast by the second electronic device includes: responding to a user's network configuration trigger operation, the first electronic device receiving the first data packet broadcast by the second electronic device.
[0255] In other words, when a user needs the first electronic device to perform network configuration operations for the second electronic device, the user can send a network configuration trigger operation to the first electronic device. At this time, after receiving the network configuration trigger operation, the first electronic device can start the scanning function and receive the first data packet broadcast by the second electronic device.
[0256] One possible implementation is that the first data packet is a BLE (Bluetooth Low Energy) broadcast packet. That is, the second electronic device broadcasts the first data packet via Bluetooth. The first electronic device receives the first data packet via Bluetooth. In this case, both the first and second electronic devices have Bluetooth functionality, which can reduce the power consumption of both devices.
[0257] Step S202: Determine the target device based on the device information of the second electronic device.
[0258] In this embodiment, after receiving a first data packet broadcast by a second electronic device, the first electronic device can parse the device information of the second electronic device and then obtain the device identification information of the second electronic device. The first electronic device can determine a target device among the second electronic devices based on the device information, such as the device identification information, so as to perform network configuration for the target device. Since there may be at least one second electronic device that requires network configuration from the first electronic device, the first electronic device can select at least one as the target network configuration device from the at least one second electronic device that broadcast the first data packet to it. When determining the target device among at least one second electronic device, the first electronic device can determine at least one second electronic device as the target device one by one based on the device information of the at least one second electronic device, thereby performing network configuration operations for at least one second electronic device sequentially. Alternatively, the first electronic device can determine all of the at least one second electronic devices as target devices and perform network configuration operations for at least one second electronic device simultaneously. Of course, the first electronic device can also determine the target device among at least one second electronic device in other ways, and this application does not limit this.
[0259] As one possible implementation, the first electronic device can determine the target device based on the device information of the second electronic device in the following manner: in response to a user's selection operation, the target device is determined based on the device information of the second electronic device.
[0260] In this embodiment, after receiving a first data packet from a second electronic device and parsing out the device identification information contained in the device information of the second electronic device, the first electronic device can display the parsed device identification information of the second electronic device on a display interface. The user can then select a target device based on the device identification information displayed on the display interface. At this time, based on the user's selection, the first electronic device identifies the second electronic device selected by the user as the target device and records the device information of the target device.
[0261] For example, the second electronic device is a printer. In this case, the first electronic device can receive the first data packet broadcast by the printer, parse the first data packet, obtain the printer's device identification information, and display the printer's device identification information on the display interface. The user can then select the target device based on the printer's device identification information displayed on the display interface. Figure 3 As shown.
[0262] As one possible implementation, to facilitate user selection, the device information of the target device may also include the device icon information of the second electronic device. In this way, the first electronic device can obtain the device icon information of the second electronic device by parsing the first data packet, and then display it on the display interface. This allows the user to determine which second electronic devices require network configuration based on the device image information, and subsequently identify the target device among the second electronic devices requiring network configuration and configure it accordingly.
[0263] Alternatively, as a possible implementation, when the first electronic device parses the device identification information of multiple second electronic devices, it can generate a list of the device identification information of the multiple second electronic devices and display the list on the display interface. As another possible implementation, the list information may include, but is not limited to, at least one of the following: historical network distribution records, distance information, and signal strength information. Users can quickly identify the target device based on the above information, facilitating user selection and improving the user experience.
[0264] Step S203: Obtain the login information of the target network, and broadcast the second data packet to the target device based on the device information of the target device and the login information of the target network.
[0265] The second data packet includes the target device's device information and the target network's login information.
[0266] In this embodiment, after the first electronic device identifies the target device, it needs to configure the network for the target device, which means sending network login information to the target device. At this time, the first electronic device can obtain the login information of the target network, generate a second data packet containing the login information of the target network and the device information of the target device based on the login information of the target network and the device information of the target device, and broadcast the second data packet to the target device.
[0267] As one possible implementation, the first electronic device can obtain the login information of the target network in the following way:
[0268] When the first electronic device connects to a network, the network it connects to is identified as the target network, and login information for the target network is obtained. Alternatively, when the first electronic device is not connected to a network, login information for the target network is obtained in response to the user's login input.
[0269] In other words, when the first electronic device is connected to a network, it can use the network it is connected to as the target network and directly retrieve the login information of the network it is connected to from its storage device. When the first electronic device is not connected to a network, the user can input the login information of the network. In this case, the first electronic device responds to the user's input of login information, retrieves the login information, and uses the retrieved login information as the login information of the target network.
[0270] In one possible implementation, the login information for the target network includes the Service Set Identifier (SSID) and password of the target network. In another possible implementation, when the first electronic device is connected to a network, it can use the network it is connected to as the target network and directly retrieve the SSID and password of the network it is connected to from its storage device. When the first electronic device is not connected to a network, in one implementation, the SSID of the target network can be directly obtained, and the user can input the password corresponding to the SSID. In this case, the first electronic device responds to the user's input, retrieves login information, and uses the retrieved login information as the login information for the target network. In yet another implementation, a list of services and identifiers of the target network is obtained. The user selects a target SSID based on the identifier list, and upon confirmation of the target SSID, the user inputs the corresponding password. In this case, the first electronic device responds to the user's login information input, retrieves the login information, and uses the retrieved login information as the login information for the target network.
[0271] After obtaining the login information of the target network, the first electronic device can encode the login information of the target network and the device information of the target device to generate a second data packet. When the first electronic device encodes the login information of the target network and the device information of the target device to generate the second data packet, the login information of the target network and the device information of the target device can be encoded into a single second data packet, in which case only one second data packet is generated for broadcast. To facilitate data decoding and improve data transmission security, the login information of the target network and the device information of the target device can also be encoded into multiple second data packets. That is, broadcasting a second data packet to the target device based on the device information of the target device and the login information of the target network includes:
[0272] According to the predetermined packet splitting rules, the login information of the target network is split into a preset number of second data packets, and each second data packet carries the device information of the target device; the preset number of second data packets are broadcast to the target device.
[0273] In this embodiment, during data packetization, each second data packet after each packetization must carry the target device's device information so that the target device can determine whether the received second data packet was intended for it based on the device information carried in the second data packet. Therefore, during data packetization, the login information of the target network is packetized, and each second data packet after packetization carries the target device's device information. To perform data packetization more quickly, packetization rules and the number of packets can be preset, so that the first electronic device can split the login information of the target network into a preset number of second data packets according to the preset packetization rules, and each second data packet carries the target device's device information. After generating the preset number of second data packets, the first electronic device broadcasts the preset number of second data packets to the target device.
[0274] For example, the target network's login information, including the SSID and password, can be stored as a JSON string. The default packet splitting rule is to split the data into 15-byte units. The default number is 5. After the first electronic device obtains the target device's device information and the target network's login information, it can split the login information according to the default packet splitting rule. During the splitting process, the data is split into 15-byte units, with the SSID and password information divided into 1-5 second data packets, such as... Figure 4 As shown. When splitting the login information of the target network into 1-5 second data packets, the device information of the target device is added to each second data packet, and the first electronic device broadcasts 1-5 second data packets to the target device.
[0275] It should be noted that when the first electronic device divides the login information of the target network into a preset number of second data packets in bytes, if the number of bytes in the target network's login information is insufficient to fill the preset number of second data packets—for example, if the number of bytes in the target network's login information is less than the number of bytes required for the preset number of second data packets—invalid data can be added after the login information to make the number of bytes in the target network's login information equal to the number of bytes required for the preset number of second data packets. Alternatively, if the number of bytes in the target network's login information is greater than the number of bytes required for the preset number of second data packets, the target network's login information can be normally divided according to a preset packet division rule for the preset number of second data packets. After the division is completed, all remaining login information is placed in the last second data packet. In this way, when the target network's login information is divided into the preset number of second data packets, the number of bytes of the target network's login information carried in the last second data packet is greater than the number of bytes of the target network's login information carried in the other second data packets. Of course, if the number of bytes of login information from the target network is insufficient to be divided into a preset number of second data packets, the login information from the target network can be divided into a preset number of second data packets according to preset rules through other means. This application does not impose any restrictions on this.
[0276] It should be understood that the aforementioned preset packet splitting rules can also take other forms, such as splitting the data according to the content of the login information, dividing the SSID and password contained therein into different second data packets. This application does not limit the specific packet splitting rules used.
[0277] As one possible implementation, to facilitate the target device in obtaining complete and correct login information of the target network, each second data packet also carries at least one of the following: preset number information, index information, and random number information generated by the first electronic device.
[0278] Specifically, when the first electronic device divides the device information of the target network into a preset number of second data packets according to a preset packetization rule, it can set index information for the second data packets according to the division order of the login information of the target network. The index information of the second data packet identifies the splitting order of the content carried in the second data packet during the target network's login information splitting process. Thus, the target device can determine the combination order of the content carried in each second data packet when combining login information based on the index information in each second data packet. Therefore, each second data packet can carry index information, ensuring that the target device obtains the correct login information. Each second data packet can also carry at least one of the following: a preset number of packets and random number information generated by the first electronic device. Carrying the preset number of packets in each second data packet allows the target device to know the total number of second data packets, enabling it to combine the preset number of second data packets according to the index information of each second data packet to obtain complete and correct login information for the target network. Carrying the random number information generated by the first electronic device in each second data packet allows the target device to determine that the received second data packets are all broadcast from the first electronic device, further improving the accuracy of obtaining the target network's login information. Understandably, in a multi-device distribution network environment, the random number generated by the device is also used to uniquely identify the device and serve as a communication signal between devices. When the data sent by the first electronic device includes its own randomly generated number, the second electronic device can scan this data and identify it as information sent by the other party, and then receive it accordingly. Alternatively, when the data received by the second electronic device includes the random number generated by the first electronic device, and the data sent by the second electronic device includes this random number, the first electronic device can receive the corresponding data through this random number. Therefore, this further improves the targeting and accuracy of data reception, and to a certain extent, also improves the efficiency of data reception.
[0279] As described in the example above, when dividing the login information of the target network into five second data packets in units of 15 bytes, the index information of the first second data packet is set to 1, the index information of the second second data packet to 2, the index information of the third second data packet to 3, the index information of the fourth second data packet to 4, and the index information of the fifth second data packet to 5, according to the division order of the login information of the target network. The first second data packet carries the content of bytes 1-15 of the login information of the target network. The second second data packet carries the content of bytes 16-30 of the login information of the target network. The third second data packet carries the content of bytes 31-45 of the login information of the target network. The fourth second data packet carries the content of bytes 46-60 of the login information of the target network. The fifth second data packet carries the remaining bytes of the login information of the target network. The first electronic device can also generate a random number, which is used to identify the first electronic device. While dividing the login information of the target network into five second data packets, the first electronic device adds the number 5 as a preset value to each second data packet, and also adds its generated random number information and the target device's device information to each second data packet. In this way, the first electronic device and the target device can quickly and accurately identify each other based on the random number information and device information, ensuring accurate communication between them, while preventing communication data from remaining in the air for extended periods or being intercepted by other devices, thus reducing packet loss.
[0280] The first electronic device broadcasts the aforementioned five second data packets to the target device.
[0281] As one possible implementation, to further improve the security of the second data packet transmission, the second data packet can be encrypted. In this case, broadcasting the preset number of second data packets to the target device includes: encrypting the preset number of second data packets according to a preset encryption key; and broadcasting the preset number of encrypted second data packets to the target device.
[0282] In this embodiment, since the second data packet may be received by other devices seeking network configuration, and these other devices are not located in the same network environment as the first electronic device, they may establish illegal network connections with the target network based on the login information of the target network carried in the second data packet, potentially threatening the network environment. To prevent this, the first electronic device can encrypt the second data packet; that is, the first electronic device can encrypt a preset number of second data packets using a preset encryption key and broadcast the encrypted preset number of second data packets.
[0283] As one possible implementation, the preset encryption key is device information obtained from the target device. The first electronic device can use the device information of the target device to encrypt a preset number of second data packets and broadcast the preset number of second data packets to the target device. Alternatively, the preset encryption key can be any other encryption key.
[0284] It should be noted that this application does not limit the specific method of using device information as the preset encryption key. It can use all the information in the device information as the preset encryption key, or it can use part of the content in the device information as the preset encryption key. For example, the device identification information of the target device can be used as the preset encryption key.
[0285] It should be understood that the preset encryption key can also be other pre-set keys, such as preset key information. In this case, the first device can directly use the preset key information to encrypt a preset number of second data packets. When the target device obtains the encrypted preset number of second data packets, it can use the preset key information to perform corresponding decoding processing to obtain the preset number of second data packets. This method of setting a preset key is relatively simple and not easily obtained by other devices, thus improving the security of the login information of the target network. Alternatively, the encryption key can be preset in other ways, and this application does not limit this.
[0286] Of course, other methods can also be used to encrypt the preset number of second data packets. For example, an encryption algorithm can be preset and used to encrypt the preset number of second data packets. The preset encryption algorithm can be a general encryption algorithm or a custom encryption algorithm; this application does not impose any restrictions on this. Alternatively, other methods can be used to encrypt the preset number of second data packets; this application does not impose any restrictions on this.
[0287] In this way, after encrypting a preset number of second data packets, during the broadcast to the target device, even if other devices waiting to be configured on the network obtain the second data packets, they will not be able to decrypt the login information of the target network carried in the second data packets because they do not know the decryption key or decryption algorithm, thus improving the security of the login information of the target network.
[0288] As one possible implementation, to reduce the power consumption of the first electronic device, the second data packet includes a BLE broadcast packet. That is, the first electronic device broadcasts a preset number of second data packets via Bluetooth.
[0289] As one possible implementation, when the first electronic device broadcasts a preset number of second data packets to the target device, in order to allow the target device sufficient time to acquire each second data packet, the first electronic device may broadcast the second data packets at regular intervals. That is, broadcasting a preset number of second data packets to the target device includes:
[0290] A preset number of second data packets are broadcast to the target device at preset time intervals, and the broadcast order of the preset number of second data packets is predetermined or randomly determined. The broadcast order of each second data packet is the same as or different from the index information of the second data packet.
[0291] In other words, in this embodiment, the first electronic device broadcasts a preset number of second data packets at preset time intervals. That is, after broadcasting one second data packet, it waits for the preset time interval before broadcasting the next second data packet. During the broadcasting process, the broadcast order of each second data packet can be pre-set. In this case, the first electronic device can broadcast the preset number of second data packets sequentially at preset time intervals according to the broadcast order of each second data packet. Alternatively, the broadcast order of each second data packet can be randomly determined. That is, the first electronic device can randomly select the second data packet to be broadcast from the unbroadcast second data packets at preset time intervals and broadcast it. The broadcast order of each second data packet can be the same as or different from its index information. That is, the broadcast order of each second data packet is not directly related to its index information; they can be the same or different.
[0292] As illustrated in the example above, assuming a preset time interval of 100ms, for second data packets with index information from 1 to 5, five second data packets can be broadcast sequentially at 100ms intervals, following the ascending order of index information. Alternatively, five second data packets can be broadcast sequentially at 100ms intervals, following the descending order of index information. Furthermore, the second data packet to be broadcast can be randomly selected from the unbroadcast second data packets at preset 100ms intervals. During the broadcasting process, the broadcast duration of each second data packet can be customized, for example, set to 20 seconds, etc.
[0293] In this way, since the second data packet carries the device information of the target device, the target device can accurately and timely obtain the second data packet broadcast to itself, and obtain the login information of the target network carried in the second data packet, thereby improving the efficiency of the distribution network.
[0294] See Figure 5 This is a flowchart illustrating a power distribution method provided in an embodiment of this application. The method is applied to the aforementioned target device. For example... Figure 5 As shown, the method includes:
[0295] Step S501: Broadcast the first data packet to the first electronic device.
[0296] The first data packet carries device information of the target device; the device information includes device identification information.
[0297] In this embodiment, when the target device accesses the network, it needs to obtain network login information first. At this time, it needs to obtain the network login information from the first electronic device. To facilitate the target device obtaining the network login information more accurately and promptly, the target device can pre-broadcast its own device information. The target device can then obtain its own device information, encode it into a first data packet, and send it to the first electronic device via broadcast. In fact, the target device's device information includes its device identifier. To more accurately identify the target device, the target device's device information can also include other device information, such as the manufacturer ID, version number, and device PID of the second electronic device.
[0298] As one possible implementation, to improve data processing efficiency, the target device's device information can be divided into multiple first data packets and broadcast. How the target device divides its device information into multiple first data packets can be referenced from the process described above where the first electronic device splits the target network's login information into a preset number of second data packets; this will not be elaborated upon here.
[0299] Step S502: Obtain the second data packet broadcast by the first electronic device.
[0300] The second data packet includes device information and login information for the target network.
[0301] In this embodiment of the application, after the target device broadcasts the first data packet, since the first electronic device broadcasts a second data packet to the target device carrying the device information of the target device and the login information of the target network, in order to receive the second data packet in a timely manner, the target device can listen in real time to whether the first electronic device has broadcast the second data packet, and receive the second data packet broadcast by the first electronic device when the first electronic device broadcasts the second data packet.
[0302] As one possible implementation, to ensure the security of login information on the target network, the first electronic device can split the login information into a preset number of second data packets and broadcast the preset number of second data packets to the target device. Based on this, the target device can listen to the preset number of second data packets. At this time, the target device acquiring the second data packets broadcast by the first electronic device includes: acquiring the preset number of second data packets broadcast by the first electronic device.
[0303] That is, when the first electronic device broadcasts a preset number of second data packets to the target device, the target device can receive the preset number of second data packets.
[0304] As one possible implementation, when the first electronic device broadcasts a preset number of second data packets at preset time intervals, the target device can receive a second data packet at certain intervals, thereby acquiring the preset number of second data packets.
[0305] Step S503: When the device information in the second data packet is the device information of the target device, obtain the login information of the target network contained in the second data packet, and access the target network based on the login information of the target network.
[0306] In this embodiment, after receiving the second data packet broadcast by the first electronic device, the target device can parse the second data packet to obtain the device information and login information of the target network carried in the second data packet. It then checks whether the device information carried in the second data packet is the target device's device information. If so, it indicates that the second data packet was broadcast from the first electronic device to the target device. At this time, the target device can access the target network based on the login information of the target network carried in the second data packet.
[0307] As one possible implementation, when the first electronic device broadcasts a preset number of second data packets to the target device, the target device can parse each second data packet it receives to extract the device information and partial login information of the target network. If the device information in the second data packet matches that of the target device, the first electronic device can save the partial login information of the target network carried in the second data packet. In this way, the target device can obtain the partial login information of the target network carried in the preset number of second data packets broadcast by the first electronic device. Then, when the target device obtains device information from all of the preset number of second data packets, it combines the login information of the target network carried in the preset number of second data packets to obtain the complete login information of the target network.
[0308] In other words, when the target device parses and finds that the device information carried in the predetermined number of second data packets broadcast by the first electronic device is indeed the target device's device information, the target device can parse out a predetermined number of partial login information of the target network from the predetermined number of second data packets. At this time, the target device can combine the partial login information of the target network carried in the predetermined number of second data packets to obtain the complete login information of the target network.
[0309] When the second data packet does not carry index information, the target device can perform all possible permutations and combinations of the partial login information of the target network carried in a preset number of second data packets to obtain a variety of possible login information.
[0310] As one possible implementation, in order to enable the target device to quickly obtain the login information of the target network and improve the network configuration efficiency, each of the preset number of second data packets also carries at least one of the following: preset number information, index information, and random number information generated by the first electronic device.
[0311] At this point, combining the login information of the target network carried in the preset number of second data packets to obtain the complete login information of the target network includes: combining the login information of the target network carried in the preset number of second data packets according to the index information and / or the preset number of information carried in each second data packet to obtain the complete login information of the target network.
[0312] In other words, since each of the preset number of second data packets also carries at least one of the following information: preset number information, index information, and random number information generated by the first electronic device, after the target device obtains and parses the second data packets, in addition to obtaining the device information and login information of the target network carried in each second data packet, it can also obtain at least one of the following information: preset number information, index information, and random number information generated by the first electronic device. When each second data packet carries random number information generated by the first electronic device, the target device can determine whether the currently received second data packet is a second data packet broadcast by the first electronic device based on the random number information generated by the first electronic device. Based on whether the device information in the second data packet is the device information of the target device, it can determine whether the current second data packet is a second data packet sent to the target device. If the random number carried in the current second data packet is the same as the random number carried in other second data packets, and the device information carried in the current second data packet is the device information of the target device, then it is determined that the current second data packet is a second data packet broadcast by the first electronic device and is a second data packet broadcast to the target device. When each second data packet carries a preset number of information, the target device can determine, based on the preset number of information carried in the current second data packet, that the first electronic device has split the login information of the target network into several second data packets, so as to combine the login information of the target network carried in the preset number of second data packets. When each second data packet carries index information, the target device can determine, based on the index information of the current second data packet, the splitting order of the login information of the target network carried in the current second data packet, thereby determining the combination order of the login information of the target network carried in the current second data packet. In the above manner, the target device can combine the login information of the target network carried in the preset number of second data packets according to their respective combination orders to obtain the complete login information of the target network.
[0313] As one possible implementation, to ensure the security of login information on the target network, the first electronic device encrypts a preset number of second data packets. Upon receiving these second data packets, the target device needs to decode them before it can parse them. In this case, the target device's decryption process corresponds to the first electronic device's encryption process. That is, the encryption and decryption keys or algorithms need to be agreed upon beforehand. When the first electronic device uses the target device's device information as the encryption key to encrypt the second data packets, the target device can then use its device information as the decryption key to decrypt them. Alternatively, after the first electronic device encrypts the second data packets using a preset encryption algorithm, the target device can use a preset decryption algorithm to decrypt them, obtaining the decrypted second data packets. In this case, the preset decryption algorithm corresponds to the preset encryption algorithm.
[0314] After obtaining complete login information for the target network, the target device can access the target network based on that login information.
[0315] In this way, since the second data packet carries the device information of the target device, the target device can accurately and timely obtain the second data packet broadcast to itself, and obtain the login information of the target network carried in the second data packet, thus improving the efficiency of the distribution network.
[0316] See Figure 6 This is a flowchart illustrating a power distribution method provided in an embodiment of this application. This method is applied to... Figure 1 In the aforementioned power distribution network system, this embodiment is different from the above-mentioned appendix. Figure 2 and Figure 5 The described embodiment adds an interactive process for displaying distribution network results. For example... Figure 6 As shown, the method includes:
[0317] Step S601: The target device broadcasts the first data packet to the first electronic device.
[0318] The first data packet carries device information of the target device, including device identification information. The second electronic device includes the target device.
[0319] For details, please refer to step S501 above, which will not be repeated here.
[0320] Step S602: In response to the user's network configuration search start operation, the first electronic device receives the first data packet broadcast by the second electronic device.
[0321] In this embodiment, if a user needs the first electronic device to configure the network for other electronic devices, the network configuration search function of the first electronic device can be triggered. In response to the user's network configuration search initiation operation, the first electronic device performs a search operation for devices to be configured. At this time, the first electronic device receives a first data packet broadcast by the second electronic device. It parses the first data packet to obtain the device information of the second electronic device, generates a device list based on the parsed device information, and displays the device list through a display interface so that the user can know which devices need network configuration.
[0322] For example, if the first electronic device has Bluetooth functionality, the user can enable Bluetooth to trigger the network configuration search initiation operation of the first electronic device. At this time, the first electronic device can use its Bluetooth function to search for a second electronic device that has Bluetooth enabled, and receive the first data packet broadcast by the second electronic device; that is, the first data packet is a BLE broadcast packet.
[0323] The first electronic device can obtain the device information of the second electronic device based on the first data packet broadcast by the second electronic device. The device information of the second electronic device may include manufacturer ID, version number, and serial number. Due to the length limitation of Bluetooth broadcast information, the serial number can be a partial number, such as the last 7 digits. The first electronic device can identify different second electronic devices based on the device information of the second electronic device.
[0324] Step S603: The first electronic device determines the target device based on the device information of the second electronic device.
[0325] For details, please refer to step S202 above, which will not be repeated here.
[0326] Step S604: The first electronic device sends a prompt message to the user.
[0327] The prompt message is used to prompt the user to trigger the target device to enter the scanning state.
[0328] In this embodiment, the target device is typically located in a complex network environment. If the target device is constantly in operation, such as continuously scanning or broadcasting, its power consumption will be high. Therefore, to reduce power consumption, the target device usually enters a sleep state after broadcasting the first data packet. To ensure that the target device receives the second data packet broadcast by the first electronic device in a timely manner, the first electronic device can prompt the user to trigger the target device to enter scanning mode before broadcasting the second data packet. At this time, the first electronic device can send a prompt message to the user to prompt the user to trigger the target device to enter scanning mode.
[0329] The first electronic device may send the prompt information to the user by displaying the prompt information on its display interface. Alternatively, the first electronic device may send the prompt information to the user via voice broadcast. Of course, the first electronic device may also send the prompt information to the user in other ways, and this application does not impose any restrictions on this.
[0330] Step S605: The target device responds to the user's trigger operation and enters the scanning state.
[0331] In this embodiment of the application, after receiving the prompt information sent by the first electronic device, the user can trigger the target device to start scanning. At this time, the user can trigger the network function key of the target device. After receiving the user's trigger operation on the network function key, the target device enters the scanning state to receive the second data packet broadcast by the first electronic device.
[0332] In this way, before broadcasting the second data packet to the target device, the first electronic device can prompt the user to trigger the target device to enter scanning mode, thus ensuring that the target device receives the second data packet in a timely manner. Furthermore, since the first electronic device prompts the user to start the target device's scanning function before broadcasting the second data packet, it only prompts the user to trigger the target device to enter scanning mode before the first electronic device needs to broadcast the second data packet. That is, the target device only enters scanning mode before it needs to receive the second data packet broadcast by the first electronic device, preventing the target device from remaining in scanning mode indefinitely and reducing the target device's power consumption. In addition, after the target device receives a user's trigger on its network function key to enter scanning mode, a timer can be set to determine the set time for entering scanning mode, and the scanning will stop after the set time, prompting the user with the scan results. It should be noted that the set time is the time to ensure the completion of receiving the second data packet, and is not specifically limited here. In this way, the target device only enters scanning mode before confirming that it needs to receive the second data packet broadcast by the first electronic device, and stops scanning after ensuring the completion of receiving the second data packet broadcast by the first electronic device, thus determining the time for entering scanning mode and further preventing the device from continuously maintaining scanning mode for extended periods, which would lead to increased power consumption.
[0333] Step S606: The first electronic device obtains the login information of the target network, and broadcasts a second data packet to the target device based on the target device's device information and the target network's login information. The target device obtains the second data packet broadcast by the first electronic device.
[0334] The second data packet includes the target device's device information and the target network's login information.
[0335] For details, please refer to steps S203 and S502 above, which will not be repeated here.
[0336] Step S607: When the device information of the target device in the second data packet is the device information of the target device, obtain the login information of the target network contained in the second data packet, and access the target network based on the login information of the target network.
[0337] For details, please refer to step S503, which will not be repeated here.
[0338] It should be noted that after the first electronic device broadcasts the second data packet, it can further determine whether the target device has successfully configured its network. After the target device accesses the target network based on its login information, it can send the configuration result information to the first electronic device, which then receives it. Alternatively, the target device may not send the configuration result information; in this case, the first electronic device needs to perform the detection itself. The first electronic device executes different steps depending on whether the target device sends the configuration result information. When the target device sends the configuration result information, the first electronic device executes step S608a or step S608b. When the target device does not send the configuration result information, the first electronic device executes step S608c.
[0339] Specifically as follows:
[0340] Step S608a: The target device sends distribution network result information to the first electronic device. The first electronic device obtains the distribution network result information of the target device.
[0341] In this embodiment, after obtaining the login information of the target network, the target device can access the target network based on the login information. Within a first preset time period, the target device can generate network configuration result information based on its access status to the target network, and then send the network configuration result information to the first electronic device. The first electronic device receives the network configuration result information from the target device. The first electronic device can determine whether the target device has successfully configured its network based on the network configuration result information.
[0342] The target device can send the network distribution result information to the first electronic device in the following ways, as follows:
[0343] One implementation: The target device generates a third data packet based on its current access to the target network. This third data packet is then broadcast to the first electronic device. The first electronic device receives the third data packet and uses it to obtain the network distribution result information.
[0344] The third data packet includes: network distribution status information of the target device. This network distribution status information is used to characterize the access status of the target device to the target network. Alternatively,
[0345] The third data packet includes: a random number from the first electronic device and a network status identifier. The network status identifier is used to indicate the access status of the target device to the target network. Alternatively,
[0346] The third data packet includes an IP (Internet Protocol) address indicating the network configuration status. Specifically, when the target device is in a successfully configured state, the IP address is the target device's IP address; when the target device is in a non-configured state or a configuration failure state, the IP address is a first reserved IP address; when the target device is in a configuration process state, the IP address is a second reserved IP address. Both the first and second reserved IP addresses are different from the target device's IP address.
[0347] In other words, the target device can determine the distribution network status information based on its access status to the target network. For example, if the target device is currently accessing the target network, the generated distribution network status information is "Distribution in progress"; if the target device has successfully accessed the target network, the generated distribution network status information is "Distribution successful"; if the target device has not accessed the target network, the generated distribution network status information is "Distribution identified". Furthermore, when determining the reason for not accessing the target network, the distribution network status information can also carry the failure reason. For example, the failure reason could be an incorrect login information for the target network. After generating the distribution network status information, the target device can generate a third data packet based on this information. The target device can directly use the distribution network status information as the content of the third data packet to generate the third data packet, in which case the third data packet carries the distribution network status information. Thus, when the first electronic device receives the third data packet sent by the target device, it can obtain the distribution network status information by parsing the third data packet, thereby determining the target device's access status to the target network.
[0348] Alternatively, to reduce the complexity of the third data packet, the target device can set a network distribution status flag based on the network distribution status information. This flag indicates the network distribution status; for example, 00x1 indicates network distribution in progress, 00x2 indicates network distribution failure, and 00x3 indicates network distribution success. In this case, the target device only needs to add the random number from the first electronic device and the network distribution status flag to the third data packet. After receiving the third data packet, the first electronic device can determine whether the third data packet was intended for it based on the total random number. If so, it can determine the target device's access status to the target network based on the network distribution status flag in the third data packet.
[0349] As one possible implementation, the target device can add a custom network distribution status flag to the third data packet based on existing data. That is, the third data packet includes a custom byte indicating the network distribution status. For example, the first byte is a random number (broadcast packet identifier) of the first electronic device, the second byte is the sequence number of the third data packet, and the third byte is the network distribution status flag. The network distribution status information can be sent in whole packets or in segments. In the case of segmented transmission, the target device divides the network distribution status flag into different third data packets. After receiving multiple third data packets, the first electronic device can combine the contents of the third byte of each third data packet according to its sequence number to obtain the complete network distribution status flag. Based on the complete network distribution status flag, it can then determine whether the target device has successfully accessed the target network.
[0350] It should be noted that different mapping relationships between network configuration status flags and network configuration status can be preset. For example, the third byte can be set to "11" to indicate network configuration in progress, "12" to indicate successful network configuration, "21" to indicate that the target network was not found, and "22" to indicate an incorrect password. Other mapping relationships can also be set. Of course, the network configuration status flags can be not only numbers, but also any combination of numbers, letters, symbols, and characters. There are no inherent restrictions on this.
[0351] Alternatively, to reduce the complexity of the third data packet and improve compatibility between devices, the network configuration status can be represented by an IP address. That is, when the target device is in a successfully configured state, the IP address is the target device's IP address; when the target device is in a non-configured or failed configuration state, the IP address is the first reserved IP address; when the target device is in the process of configuring, the IP address is the second reserved IP address; both the first and second reserved IP addresses are different from the target device's IP address. In this case, the target device can set the IP address in the third data packet according to the configuration result, without needing to carry other information. In this way, after receiving the third data packet, the first electronic device can determine whether the target device is connected to the target network by parsing the IP address in the third data packet. For example, after successful configuration, the target device can broadcast its own IP address, such as 192.168.0.1; if configuration fails, it can broadcast 0.0.0.0; and if configuration is in progress, it will broadcast 1.1.1.1. In this way, by simply setting different IP addresses in the third data packet, the network configuration result of the target device can be accurately identified without adding random numbers or flags to the third data packet, thus improving compatibility between devices.
[0352] As one possible implementation, the aforementioned third data packet includes a BLE broadcast packet. That is, when both the first electronic device and the target device have Bluetooth enabled, a third data packet can be broadcast via Bluetooth, and in this case, the third data packet can be a BLE broadcast packet.
[0353] The second implementation method involves establishing a wireless connection between the first electronic device and the target device. The target device sends network distribution result information to the first electronic device via the wireless connection. The first electronic device receives the network distribution result information via the wireless connection.
[0354] In other words, after the first electronic device broadcasts the second data packet, it can establish a wireless connection with the target device, such as a Bluetooth connection, an infrared connection, an AP (Access Point) connection, or other wireless connections. Data transmission can then occur between the first electronic device and the target device through this wireless connection. At this time, when the target device accesses the target network based on its login information, it can generate network configuration result information based on its access status, and then transmit this result information to the first electronic device via the wireless connection. The first electronic device can then receive the network configuration result information wirelessly.
[0355] The third implementation method: The first electronic device broadcasts its IP address and port number to the target device. The target device listens for the IP address and port number broadcast by the first electronic device. When accessing the target network, the target device sends a TCP (Transmission Control Protocol) connection establishment request message to the first electronic device based on the first electronic device's IP address and port number. Upon receiving the TCP connection establishment request message from the target device, the first electronic device establishes a TCP connection with both the target and target devices. The target device sends network configuration result information to the first electronic device through the TCP connection. The first electronic device receives the network configuration result information through the TCP connection.
[0356] In other words, the target device can send network configuration result information to the first electronic device through the target network. At this time, after broadcasting the second data packet, the first electronic device can broadcast its IP address and port number to the target device. The target device can then listen to the broadcast IP address and port number of the first electronic device. When the target device successfully accesses the target network, it can send a TCP connection establishment request message to the first electronic device based on the target network's IP address and port number. Upon receiving the TCP connection establishment request message, the first electronic device establishes a TCP connection with the target device. The target device then sends the network configuration result information to the first electronic device through the TCP connection. The first electronic device receives the network configuration result information through the TCP connection. At this point, the network configuration result information indicates successful configuration.
[0357] It should be noted that if the target device fails to configure the network or is in the process of configuring the network, a TCP connection cannot be established between the target device and the first electronic device, and the target device cannot send the network configuration result information to the first electronic device using this method. In this case, the target device can send the network configuration result information to the first electronic device through other means, or perform the following step S608b.
[0358] Step S608b: If the network distribution result information sent by the target device is not received within the first preset time, the first electronic device obtains the device identification information of the target device and searches for the target device in the target network based on the device identification information of the target device; if the target device is found within the second preset time, the network distribution is determined to be successful; otherwise, the network distribution is determined to be unsuccessful.
[0359] In this embodiment, if it is pre-agreed that the target device sends network distribution result information to the first electronic device, and due to certain factors, the network distribution result information sent by the target device is not transmitted to the first electronic device, i.e., the first electronic device does not receive the network distribution result information. In this case, if the first electronic device does not receive the network distribution result information sent by the target device within a first preset time, it can perform its own detection of the target device's network distribution result. That is, if the first electronic device does not receive the network distribution result information sent by the target device within the first preset time, it can obtain the target device's device identification information from the storage device and search for the target device within the target network based on the target device's device identification information; a second preset time is set as the search timeout. If the target device can be found within the second preset time, the target device is determined to have successfully configured the network; if the target device is not found within the second preset time, the target device is determined to have failed to configure the network.
[0360] For example, taking a printer as the target device, the first electronic device can search for printer services in the target network based on the printer's device identification information. The search interval can be customized, such as 1 second, 2 seconds, 4 seconds, 8 seconds, etc. The timeout period can also be preset, such as 30 seconds, 60 seconds, etc. If the target device responds within the timeout period, it is considered that the target device has successfully connected to the target network, and the network configuration is successful. If it does not respond within the timeout period, the network configuration of the target device is determined to have failed.
[0361] This implementation method can reduce the occupation of Bluetooth ports, because the network configuration process may take several seconds or tens of seconds, and using Bluetooth communication in this case may occupy too many Bluetooth ports.
[0362] It should be noted that both the first and second preset times are preset according to actual needs.
[0363] Step S608c: The first electronic device obtains the device identification information of the target device and searches for the target device in the target network based on the device identification information of the target device; if the target device is found within a third preset time, the network configuration is successful; otherwise, the network configuration fails.
[0364] For details, please refer to step S608b, which will not be repeated here.
[0365] Step S609: The first electronic device displays the distribution network result indication information to the user.
[0366] In this embodiment, the first electronic device can display indication information of the network distribution result to the user. The first electronic device can directly display the network distribution result of the target device through a display interface, or send it to the user via voice broadcast, or other means.
[0367] Alternatively, the first electronic device may not directly display the network configuration result information to the user, but instead can display information prompting the user to observe the network indicator light status of the target device. In this way, the user can determine the network configuration result of the target device by observing the network indicator light status. For example, if the target device successfully configures itself, the "WiFi light" on the target device will be on or flashing; if the network configuration fails, the "WiFi light" on the target device will remain off.
[0368] Optionally, the "WiFi light" status of the target device can further indicate the network configuration status by: indicating the number of times the "WiFi light" flashes or the on / off status of multiple "WiFi lights".
[0369] For example, if the target device's "WiFi light" remains on, it indicates that network configuration is successful; if the target device's "WiFi light" flashes, it indicates that network configuration is in progress; and if the target device's "WiFi light" remains off, it indicates that network configuration has failed.
[0370] Alternatively, upon successful network configuration of the target device, the device information of the target device can be displayed to the user. That is, when the first electronic device confirms that the target device has successfully configured for network use, it displays the device information to the user, informing them that the target device is now ready for use. Figure 7 As shown.
[0371] See Figure 8 This is a schematic diagram of the structure of a power distribution network device provided in an embodiment of this application. Figure 8 As shown, the distribution network device includes:
[0372] The first receiving unit 801 is used to receive the first data packet broadcast by the second electronic device.
[0373] The first data packet contains the device identification information of the second electronic device.
[0374] The first processing unit 802 is used to determine the target device based on the device information of the second electronic device.
[0375] The first processing unit 802 is also used to obtain login information of the target network and broadcast a second data packet to the target device based on the device identification information of the target device and the login information of the target network.
[0376] The second data packet includes the target device's device information and the target network's login information.
[0377] As one possible implementation, such as Figure 9 As shown, the distribution network device also includes:
[0378] The first acquisition unit 803 is used to acquire the distribution network result information of the target device.
[0379] As one possible implementation, the first processing unit 802 is specifically used to determine the target device in the second electronic device in response to the user's selection operation.
[0380] As one possible implementation, the first processing unit 802 is specifically used to, when the first electronic device accesses a network, determine the network accessed by the first electronic device as the target network and obtain the login information of the target network. Alternatively, when the first electronic device is not accessing a network, it obtains the login information of the target network in response to the user's login information input operation.
[0381] As one possible implementation, the first processing unit 802 is specifically used to split the login information of the target network into a preset number of second data packets according to a predetermined packet splitting rule, and each second data packet carries the device information of the target device; and broadcast the preset number of second data packets to the target device.
[0382] As one possible implementation, each second data packet also carries at least one of the following: a preset number of information, an index of information, and a random number of information generated by the first electronic device.
[0383] As one possible implementation, the first processing unit 802 is specifically used to encrypt a preset number of second data packets according to a preset encryption key; and broadcast the preset number of encrypted second data packets to the target device.
[0384] As one possible implementation, the first processing unit 802 is specifically used to broadcast a preset number of second data packets to the target device at preset time intervals, and the broadcast order of the preset number of second data packets is predetermined or randomly determined, and the broadcast order of each second data packet is the same as or different from the index information of the second data packet.
[0385] As one possible implementation, the preset encryption key is device information obtained from the target device or other encryption keys.
[0386] As one possible implementation, the first acquisition unit 803 is specifically used to receive the third data packet broadcast by the target device and acquire the distribution network result information based on the third data packet.
[0387] The third data packet includes: network configuration status information of the target device; the network configuration status information is used to characterize the access status of the target device accessing the target network. Alternatively, the third data packet includes: a random number of the first electronic device and a network configuration status identifier; the network configuration status identifier is used to indicate the access status of the target device accessing the target network. Alternatively, the third data packet includes: an IP address indicating the network configuration status. When the target device is in a successfully configured state, the IP address is the target device's IP address; when the target device is in a non-configured state or a configured state, the IP address is a first reserved IP address; when the target device is in a configured state, the IP address is a second reserved IP address. Both the first and second reserved IP addresses are different from the target device's IP address.
[0388] As one possible implementation, the third data packet includes BLE broadcast packets.
[0389] Alternatively, as a possible implementation, the first acquisition unit 803 is specifically used to broadcast the IP address and port number of the first electronic device to the target device; if a TCP connection establishment request message is received from the target device, a TCP connection is established with the target device; and the network distribution result information is received through the TCP connection.
[0390] Alternatively, as a possible implementation, the first acquisition unit 803 is specifically used to establish a wireless connection with the target device and acquire the network distribution result information of the target device through the wireless connection.
[0391] Alternatively, as a possible implementation, the first acquisition unit 803 is further configured to acquire the device identification information of the target device if it does not receive the distribution result information sent by the target device within a first preset time, and search for the target device in the target network based on the device identification information of the target device; if the target device is found within a second preset time, it is determined that the distribution is successful, otherwise it is determined that the distribution has failed.
[0392] Alternatively, as a possible implementation, the first acquisition unit 803 is specifically used to acquire the device identification information of the target device, and search for the target device in the target network based on the device identification information of the target device; if the target device is found within a third preset time, the network configuration is successful, otherwise the network configuration fails.
[0393] As one possible implementation, refer to Figure 9 As shown, the distribution network device also includes:
[0394] The first sending unit 804 is used to display indication information of the distribution network result to the user.
[0395] As one possible implementation, the first sending unit 804 is specifically used to display information to the user instructing the user to observe the network signal light display status of the target device; or, when the target device is successfully configured for network connection, to display the device information of the target device to the user.
[0396] As one possible implementation, the first sending unit 804 is also used to send a prompt message to the user.
[0397] The prompt message is used to prompt the user to trigger the target device to enter the scanning state.
[0398] As one possible implementation, the first processing unit 802 is specifically used to determine the target device based on the device information of the second electronic device in response to the user's selection operation.
[0399] As one possible implementation, the first processing unit 802 is specifically used to, when the first electronic device accesses the network, determine the network accessed by the first electronic device as the target network and obtain the login information of the target network. Alternatively,
[0400] When the first electronic device is not connected to the network, it obtains the login information of the target network in response to the user's login information input operation.
[0401] See Figure 10 This is a schematic diagram of another power distribution network device provided in an embodiment of this application. Figure 10 As shown, the distribution network device includes:
[0402] Broadcast unit 1001 is used to broadcast a first data packet to a first electronic device.
[0403] The first data packet contains device information for the target device. This device information includes device identification information.
[0404] The second processing unit 1002 is used to obtain the second data packet broadcast by the first electronic device and obtain the login information of the target network contained in the second data packet.
[0405] The second data packet includes the target device's device information and the target network's login information.
[0406] The second processing unit 1002 is also used to access the target network based on login information of the target network.
[0407] As one possible implementation, such as Figure 11 As shown, the distribution network device further includes:
[0408] The second sending unit 1003 is used to send distribution network result information to the first electronic device.
[0409] As one possible implementation, the second processing unit 1002 is specifically used to acquire a preset number of second data packets broadcast by the first electronic device. When the device information in the preset number of second data packets is all device information of the target device, the login information of the target network carried in the preset number of second data packets is combined to obtain the complete login information of the target network.
[0410] As one possible implementation, the second data packet also carries at least one of the following: a preset number of information, an index, and a random number generated by the first electronic device. In this case, the second processing unit 1002 is specifically used to combine the login information of the target network carried in a preset number of second data packets according to the index information and / or the preset number of information carried in each second data packet, to obtain the complete login information of the target network.
[0411] As one possible implementation, the second transmitting unit 1003 is specifically used to broadcast a third data packet to the first electronic device.
[0412] The third data packet includes: network configuration status information of the target device; the network configuration status information is used to characterize the access status of the target device to the target network. Alternatively, the third data packet includes: a random number of the first electronic device and a network configuration status identifier; the network configuration status identifier is used to indicate the access status of the target device to the target network. Alternatively, the third data packet includes: an IP address indicating the network configuration status; wherein when the target device is in a successful network configuration state, the IP address is the target device's IP address; when the target device is in a non-configured or failed configuration state, the IP address is a first reserved IP address; when the target device is in a configuration process state, the IP address is a second reserved IP address. Both the first and second reserved IP addresses are different from the target device's IP address.
[0413] Alternatively, as a possible implementation, the second sending unit 1003 is specifically used to listen to the IP address and port number of the first electronic device broadcast by the first electronic device; when accessing the target network, it sends a TCP connection establishment request message to the first electronic device based on the IP address and port number of the first electronic device to establish a TCP connection with the first electronic device; and sends network distribution result information to the first electronic device through the TCP connection.
[0414] Alternatively, as a possible implementation, the second transmitting unit 1003 is specifically used to establish a wireless connection with the first electronic device and to send distribution network result information to the first electronic device through the wireless connection.
[0415] As one possible implementation, the second processing unit 1002 is also used to enter a scanning state in response to a user's trigger operation.
[0416] In this way, since the second data packet carries the device information of the target device, the target device can accurately and timely obtain the second data packet broadcast to itself, and obtain the login information of the target network carried in the second data packet, thus improving the efficiency of the distribution network.
[0417] Example 2
[0418] See Figure 12 This is a flowchart illustrating a network distribution method provided in an embodiment of this application. The method is applied to the aforementioned first electronic device. For example... Figure 12 As shown, the method includes:
[0419] Step S1201: Obtain device information of the target device.
[0420] The device information includes device identification information.
[0421] In this embodiment, the target device, lacking input devices such as a touchscreen and keyboard, cannot directly connect to the network. It requires a first electronic device, such as a mobile phone, to send network login information to the target device. Only then can the target device access the network based on the login information sent by the first electronic device. In other words, the target device is a device awaiting network configuration and requires network configuration by the first electronic device to access the network. When the target device needs network configuration, to more accurately obtain the network login information, the first electronic device can first obtain the target device's device information. The first electronic device can obtain the target device's device information from the target device. Since the target device's device information is used to identify the target device, it includes device identification information. The target device's device identification information is used to uniquely identify the target device. For example, the target device's device identification information can be the target device's serial number (SN). To more accurately identify the target device, the target device's device information can also include other device information, such as the target device's manufacturer ID (Identity Document), version number, and device PID (Product ID).
[0422] It should be noted that the information contained in the device information of the second electronic device can be preset according to actual needs, and this application does not impose any restrictions on this.
[0423] As one possible implementation, obtaining the identification information of the target device includes: scanning the QR code identification information of the target device to obtain the identification information of the target device.
[0424] The target device's QR code identification information contains the target device's device information.
[0425] In other words, the target device can obtain its own device information in advance and generate scanning code information, such as a QR code, based on its own device information. The first electronic device can obtain the target device's device information by scanning the target device's scanning code information.
[0426] It should be understood that the scan code information in the embodiments of this application refers to information containing device information of the target device, and information that can be identified by scanning. This scan code information can be QR code information or other forms of information; this application does not impose any limitations on this.
[0427] In the above process, the target device's scan code information needs to be obtained first before the first electronic device can obtain the target device's device information. However, in practical applications, it may be impossible to obtain the target device's scan code information in advance, for example, the target device may not be able to generate scan code information beforehand. In this case, the first electronic device can obtain the target device's device information through broadcasting, as follows:
[0428] As one possible implementation, obtaining the device information of the target device includes receiving a second broadcast packet broadcast by the target device.
[0429] The second broadcast packet contains device information of the target device.
[0430] In other words, when a target device needs to send its own device information to a first electronic device via broadcast, the target device can encode its acquired device information to generate a second broadcast packet and then broadcast the second broadcast packet to the first electronic device. The first electronic device receives the second broadcast packet broadcast by the target device and obtains the target device's device information by parsing the second broadcast packet.
[0431] In one possible implementation, the second broadcast packet received by the first electronic device from the target device can be a data packet carrying complete device information. In this case, the first electronic device can receive one second broadcast packet from the target device. Alternatively, the second broadcast packet received by the first electronic device from the target device can be a data packet carrying partial device information, meaning the target device divides the device information into multiple second broadcast packets for broadcast. In this case, the first electronic device receives multiple second broadcast packets from the target device and combines these multiple second broadcast packets to obtain the complete device information.
[0432] As one possible implementation, when the first electronic device receives multiple second broadcast packets, each second broadcast packet contains at least one of the following: partial device information, index information, and the number of second broadcast packets. In this way, after receiving multiple second broadcast packets, the first electronic device can combine the multiple second broadcast packets according to the index information of each second broadcast packet, and determine whether all second broadcast packets have been acquired based on the number of second broadcast packets. After acquiring all the second broadcast packets, the device information of the target device can be read from the combined multiple second broadcast packets.
[0433] As one possible implementation, to reduce the power consumption of the first electronic device, it will not be in a scanning state constantly receiving the second broadcast packet broadcast by the target device. It will only enter this state when necessary. Therefore, the first electronic device needs to enter the scanning state before receiving the second broadcast packet. Based on this, the first electronic device obtains the target device's device information by: receiving the second broadcast packet broadcast by the target device in response to the user's network configuration trigger operation; and obtaining the target device's device information by parsing the second broadcast packet.
[0434] In other words, when a user needs the first electronic device to perform network configuration operations for the target device, the user can send a network configuration trigger operation to the first electronic device. At this time, after receiving the network configuration trigger operation, the first electronic device can start the scanning function and receive the second broadcast packet broadcast by the target device.
[0435] As one possible implementation, the second broadcast packet can be a BLE (Bluetooth Low Energy) broadcast packet. That is, the target device broadcasts the second broadcast packet via Bluetooth. The first electronic device receives the second broadcast packet via Bluetooth. In this case, both the first electronic device and the target device have Bluetooth functionality. This can reduce the power consumption of both the first electronic device and the target device.
[0436] In one possible implementation, in this embodiment, there may be multiple second electronic devices that require network configuration by the first electronic device. In this case, the first electronic device can receive second broadcast packets broadcast by multiple second electronic devices. By parsing the received second broadcast packets, the first electronic device can extract the device identification information of the multiple second electronic devices. The first electronic device can then select one of the multiple second electronic devices as the target device for network configuration. Alternatively, the first electronic device can determine the target device from among the multiple second electronic devices based on the user's selection. In this case, in response to the user's selection operation, the first electronic device determines the target device from among the multiple second electronic devices. That is, after receiving the first data packet from a second electronic device and parsing the device identification information contained in the device information of the second electronic device, the first electronic device can display the parsed device identification information of the second electronic device on a display interface. The user can then select the target device based on the device identification information displayed on the display interface. Based on the user's selection operation, the first electronic device determines the second electronic device selected by the user as the target device and records the device information of the target device.
[0437] As one possible implementation, to facilitate user selection, the device information of the target device may also include the device icon information of the second electronic device. In this way, the first electronic device can obtain the device icon information of the second electronic device by parsing the second broadcast packet, and then display it on the display interface. (Refer to...) Figure 13 As shown, this allows users to identify which second electronic devices need network configuration based on the device image information, and then determine the target device among the second electronic devices that need network configuration and configure it for network.
[0438] Step S1202: Establish a connection with the target device based on the device identification information of the target device.
[0439] In this embodiment, the first electronic device needs to broadcast the login information of the target network to the target device. However, the target device is unaware of when the first electronic device will broadcast. To prevent missing data packets broadcast by the first electronic device, the target device needs to be in a scanning state in real time, which will result in high power consumption. To reduce the power consumption of the target device, the first electronic device can trigger the target device to enter the scanning state before broadcasting the data packets. Based on this, the first electronic device can first establish a connection with the target device for transmitting command information, and control whether the target device enters the scanning state through this connection. The first electronic device can establish a connection with the target device based on the target device's device information. This connection can be a wired connection or a wireless connection.
[0440] For example, when establishing a wireless connection between a first electronic device and a target device, both devices need to have their wireless network functionality enabled. In this case, the first electronic device can send a connection establishment request message to the target device using the target device's device identification information, and the target device can send a connection establishment response message to the first electronic device, thus completing the wireless connection establishment.
[0441] As one possible implementation, establishing a connection with the target device based on the target device's device identification information includes:
[0442] If the first electronic device is connected to the wireless network, disconnect from the wireless network and establish a wireless connection with the target device based on the target device's device identification information. Alternatively, if the first electronic device is not connected to the wireless network, establish a wireless connection with the target device based on the target device's device identification information.
[0443] In other words, for ease of implementation, a wireless connection is established between the first electronic device and the target device. When establishing this connection, the first electronic device can only establish a wireless connection with one network at a time. Specifically, if the first electronic device is already connected to a wireless network (e.g., a Wi-Fi network), the connection between the first electronic device and the wireless network will be disconnected, and a wireless connection will be established with the target device. Alternatively, if the first electronic device is not connected to a wireless network, a wireless connection will be established directly with the target device.
[0444] In other words, when the first electronic device is connected to the wireless network, it disconnects from the wireless network and then establishes a wireless connection with the target device based on the target device's device identification information. Alternatively, when the first electronic device is not connected to the wireless network, it can establish a wireless connection with the target device based on the target device's device identification information.
[0445] One possible approach is to establish a wireless connection between the first electronic device and the target device.
[0446] When the first electronic device establishes a wireless connection with the target device, the target device can establish a temporary wireless connection with the first electronic device. In this temporary connection, no authentication is required, reducing user intervention as a password can be entered directly. This also reduces the time spent by the user entering the password and by the first electronic device verifying the password, thus improving connection speed. The first electronic device can also establish a secure wireless connection with the target device.
[0447] At this time, the device information of the target device acquired by the first electronic device also includes: the login information of the target device. The login information of the target device is the authentication information used by the target device when establishing a wireless connection. The first electronic device establishing a connection with the target device based on the target device's identification information includes: the first electronic device establishing a connection with the target device based on the target device's identification information and login information.
[0448] In other words, after obtaining the device information of the target device, the first electronic device can parse out the target device's device identification information and login information. Based on the target device's device identification information and login information, the first electronic device establishes a wireless connection with the target device. For example, when the first electronic device sends a connection establishment request message to the target device based on the target device's device identification information, this message carries the target device's login information. After receiving the connection establishment request message, the target device can parse out the target device's login information and compare it with its own stored login information to determine whether the first electronic device has permission to establish a wireless connection with the target device. When the target device detects that the login information carried in the connection establishment request message matches its own stored login information, it returns a connection establishment response message to the first electronic device, completing the establishment of the wireless connection.
[0449] As one possible implementation, the login information for the target device includes the Service Set Identifier (SSID) and password for the target device's wireless connection.
[0450] It should be noted that, as one possible implementation, a Bluetooth connection can also be established between the first electronic device and the target device.
[0451] It should be noted that, as one possible implementation, when establishing a wired connection between the first electronic device and the target device, the connection can be established directly through a network cable, which will not be elaborated further here.
[0452] Step S1203: Send a start scan command to the target device via connection.
[0453] The "Start Scan" command is used to instruct the target device to enter the scanning state.
[0454] In this embodiment, after a connection is established between the first electronic device and the target device, the first electronic device can send a scan start command to the target device through the connection, causing the target device to start its scanning function and enter a scanning state. In this way, the target device can start its scanning function and enter a scanning state only when it receives the scan start command, and disable the scanning function at other times, thereby reducing the power consumption of the target device.
[0455] In one possible implementation, since the duration of the scanning state directly affects power consumption, to minimize power consumption, the target device is further controlled to enter the scanning state for a preset time, such as 45s or 60s, and scanning is stopped after the preset time. The preset time is the time required to ensure the target device fully acquires the data packets broadcast by the first electronic device; the specific duration is not specifically limited here.
[0456] Step S1204: Obtain the login information of the target network, and broadcast a first broadcast packet to the target device based on the device information of the target device and the login information of the target network.
[0457] The first broadcast packet includes the target device's device information and the target network's login information.
[0458] In this embodiment, after the first electronic device sends a start scanning command to the target device through its connection with the target device, it can enter the process of configuring the network for the target device. That is, the first electronic device needs to send the login information of the target network to the target device. At this time, the first electronic device can obtain the login information of the target network, generate a first broadcast packet containing the login information of the target network and the device information of the target device based on the login information of the target network and the device information of the target device, and broadcast the first broadcast packet to the target device.
[0459] As one possible implementation, the first electronic device can obtain the login information of the target network in the following way:
[0460] When the first electronic device connects to a network, the network it connects to is identified as the target network, and login information for the target network is obtained. Alternatively, when the first electronic device is not connected to a network, login information for the target network is obtained in response to the user's login input.
[0461] In other words, when the first electronic device is connected to a network, it can use the network it is connected to as the target network and directly retrieve the login information of the network it is connected to from its storage device. When the first electronic device is not connected to a network, the user can input the login information of the network. In this case, the first electronic device responds to the user's input of login information, retrieves the login information, and uses the retrieved login information as the login information of the target network.
[0462] In one possible implementation, the login information for the target network includes the Service Set Identifier (SSID) and password of the target network. In another possible implementation, when the first electronic device is connected to a network, it can use the network it is connected to as the target network and directly retrieve the SSID and password of the network it is connected to from its storage device. When the first electronic device is not connected to a network, in one implementation, the SSID of the target network can be directly obtained, and the user can input the password corresponding to the SSID. In this case, the first electronic device responds to the user's input, retrieves login information, and uses the retrieved login information as the login information for the target network. In yet another implementation, a list of services and identifiers of the target network is obtained. The user selects a target SSID based on the identifier list, and upon confirmation of the target SSID, the user inputs the corresponding password. In this case, the first electronic device responds to the user's login information input, retrieves the login information, and uses the retrieved login information as the login information for the target network.
[0463] After obtaining the login information of the target network, the first electronic device can encode the login information of the target network and the device information of the target device to generate a first broadcast packet. When the first electronic device encodes the login information of the target network and the device information of the target device to generate the first broadcast packet, the login information of the target network and the device information of the target device can be encoded into a single first broadcast packet, in which case only one first broadcast packet is generated for broadcast. To facilitate data decoding and improve data transmission security, the login information of the target network and the device information of the target device can also be encoded into multiple first broadcast packets. That is, broadcasting a first broadcast packet to the target device based on the device information of the target device and the login information of the target network includes:
[0464] According to the predetermined packet splitting rules, the login information of the target network is split into a preset number of first broadcast packets, and each first broadcast packet carries the device information of the target device; the preset number of first broadcast packets are broadcast to the target device.
[0465] In this embodiment, during data packetization, each first broadcast packet after each packetization must carry the target device's device information so that the target device can determine whether the received first broadcast packet was sent to it based on the device information carried in the first broadcast packet. Therefore, during data packetization, only the login information of the target network is packetized, and each first broadcast packet after packetization carries the target device's device information. To perform data packetization more quickly, packetization rules and the number of packets can be preset, so that the first electronic device can split the login information of the target network into a preset number of first broadcast packets according to the preset packetization rules, and each first broadcast packet carries the target device's device information. After generating the preset number of first broadcast packets, the first electronic device broadcasts the preset number of first broadcast packets to the target device.
[0466] For example, the target network's login information, including the SSID and password, can be stored as a JSON string. The default packet splitting rule is to split the data into 15-byte units. The default number is 5. When the first electronic device obtains the target device's device information and the target network's login information, it can split the login information according to the default packet splitting rule. During the splitting process, the data is split into 15-byte units, with the SSID and password information split into 1-5 first broadcast packets. (Refer to...) Figure 4 As shown. When splitting the login information of the target network into 1-5 first broadcast packets, the device information of the target device is added to each first broadcast packet, and the first electronic device broadcasts 1-5 first broadcast packets to the target device.
[0467] It should be noted that when the first electronic device divides the login information of the target network into a preset number of first broadcast packets in bytes, if the number of bytes in the login information of the target network is insufficient to fill the preset number of first broadcast packets—for example, if the number of bytes in the login information of the target network is less than the number of bytes required to fill the preset number of first broadcast packets—invalid data can be added after the login information of the target network. This makes the number of bytes in the login information of the target network equal to the number of bytes required to fill the preset number of first broadcast packets. Alternatively, if the number of bytes in the login information of the target network is greater than the number of bytes required to fill the preset number of first broadcast packets, the login information of the target network can be normally divided according to the preset packet division rules for the preset number - 1 first broadcast packets. After the division is completed, all the remaining login information is set in the last preset number of first broadcast packets. In this way, when the login information of the target network is divided into the preset number of first broadcast packets, the number of bytes of the login information of the target network carried in the last first broadcast packet is greater than the number of bytes of the login information of the target network carried in other first broadcast packets. Of course, if the number of bytes of login information from the target network is insufficient to be divided into a preset number of first broadcast packets, the login information from the target network can be divided into a preset number of first broadcast packets according to preset rules through other means. This application does not impose any restrictions on this.
[0468] It should be understood that the aforementioned preset packet splitting rules can also take other forms, such as splitting the data according to the login information content, dividing the SSID and password contained therein into different first broadcast packets. This application does not limit the specific packet splitting rules used.
[0469] As one possible implementation, to facilitate the target device in obtaining complete and correct login information of the target network, each first broadcast packet also carries at least one of the following: preset number information, index information, and random number information generated by the first electronic device.
[0470] Specifically, when the first electronic device divides the device information of the target network into a preset number of first broadcast packets according to a preset packetization rule, it can set the index information of the first broadcast packets according to the division order of the login information of the target network. The index information of the first broadcast packets identifies the splitting order of the content carried in the first broadcast packet during the target network's login information splitting process. Thus, the target device can determine the combination order of the content carried in each first broadcast packet when combining login information based on the index information in each first broadcast packet. Therefore, each first broadcast packet can carry index information, ensuring that the target device obtains the correct login information. Each first broadcast packet can also carry at least one of the following: a preset number of information and random number information generated by the first electronic device. When each first broadcast packet carries the preset number of information, the target device can know the total number of first broadcast packets, and thus can combine the preset number of first broadcast packets according to the index information of each first broadcast packet to obtain complete and correct login information for the target network. By including random number information generated by the first electronic device in each first broadcast packet, the target device can determine that all first broadcast packets received are broadcast from the first electronic device, further improving the accuracy of login information for the target network.
[0471] As described in the example above, when dividing the login information of the target network into five first broadcast packets in units of 15 bytes, the index information of the first first broadcast packet is set to 1, the index information of the second first broadcast packet to 2, the index information of the third first broadcast packet to 3, the index information of the fourth first broadcast packet to 4, and the index information of the fifth first broadcast packet to 5, according to the division order of the login information of the target network. The first first broadcast packet carries the content of bytes 1-15 of the login information of the target network. The second first broadcast packet carries the content of bytes 16-30 of the login information of the target network. The third first broadcast packet carries the content of bytes 31-45 of the login information of the target network. The fourth first broadcast packet carries the content of bytes 46-60 of the login information of the target network. The fifth first broadcast packet carries the remaining bytes of the login information of the target network. The first electronic device can also generate a random number, which is used to identify the first electronic device. While dividing the login information of the target network into 5 first broadcast packets, the first electronic device adds 5 as a preset number to each first broadcast packet, and also adds its generated random number information and the target device's device information to each first broadcast packet. In this way, the first electronic device and the target device can quickly and accurately identify each other based on the random number information and device information, ensuring accurate communication between them, while preventing communication data from remaining in the air for extended periods or being intercepted by other devices, thus reducing packet loss.
[0472] The first electronic device broadcasts the aforementioned five first broadcast packets to the target device.
[0473] As one possible implementation, to further improve the security of the first broadcast packet transmission, the first broadcast packet can be encrypted. In this case, broadcasting the preset number of first broadcast packets to the target device includes: encrypting the preset number of first broadcast packets according to a preset encryption key; and broadcasting the preset number of encrypted first broadcast packets to the target device.
[0474] In this embodiment, since the first broadcast packet may be received by other devices seeking network configuration, and these other devices are those operating in a different network environment than the first electronic device, they may establish unauthorized network connections with the target network based on the login information of the target network carried in the first broadcast packet, potentially threatening the network environment. To prevent this, the first electronic device can encrypt the first broadcast packet; that is, the first electronic device can encrypt a preset number of first broadcast packets using a preset encryption key and then broadcast the encrypted preset number of first broadcast packets.
[0475] As one possible implementation, the preset encryption key is device information obtained from the target device. The first electronic device can use the device information of the target device to encrypt a preset number of first broadcast packets and broadcast the preset number of first broadcast packets to the target device. Alternatively, the preset encryption key can be any other encryption key.
[0476] It should be noted that this application does not limit the specific method of using device information as the preset encryption key. It can use all the information in the device information as the preset encryption key, or it can use part of the content in the device information as the preset encryption key. For example, the device identification information of the target device can be used as the preset encryption key.
[0477] It should be understood that the preset encryption key can also be other pre-set keys, such as preset key information. In this case, the first device can directly use the preset key information to encrypt a preset number of first broadcast packets. When the target device obtains the encrypted preset number of first broadcast packets, it can use the preset key information to perform corresponding decoding to obtain the preset number of first broadcast packets. This method of setting a preset key is relatively simple and not easily obtained by other devices, thus improving the security of the login information of the target network. Alternatively, the encryption key can be preset in other ways, and this application does not limit this.
[0478] Of course, other methods can also be used to encrypt the preset number of first broadcast packets. For example, an encryption algorithm can be preset and used to encrypt the preset number of first broadcast packets. The preset encryption algorithm can be a general encryption algorithm or a custom encryption algorithm; this application does not impose any restrictions on this. Alternatively, other methods can be used to encrypt the preset number of first broadcast packets; this application does not impose any restrictions on this.
[0479] In this way, after encrypting a preset number of first broadcast packets, even if other devices waiting to be configured to connect to the network obtain the first broadcast packets during the broadcast process, they will not be able to decrypt the login information of the target network carried in the first broadcast packets because they do not know the decryption key or decryption algorithm. This improves the security of the login information of the target network.
[0480] As one possible implementation, to reduce the power consumption of the first electronic device, the first broadcast packet includes a BLE broadcast packet. That is, the first electronic device broadcasts a preset number of first broadcast packets via Bluetooth.
[0481] As one possible implementation, when the first electronic device broadcasts a preset number of first broadcast packets to the target device, in order to allow the target device sufficient time to acquire each first broadcast packet, the first electronic device may broadcast the first broadcast packets at certain time intervals. That is, broadcasting the preset number of first broadcast packets to the target device includes:
[0482] A preset number of first broadcast packets are broadcast to the target device at preset time intervals, and the broadcast order of the preset number of first broadcast packets is predetermined or randomly determined. The broadcast order of each first broadcast packet is the same as or different from the index information of the first broadcast packet.
[0483] In other words, in this embodiment, the first electronic device broadcasts a preset number of first broadcast packets at preset time intervals. That is, after broadcasting one first broadcast packet, it waits for the preset time interval before broadcasting the next first broadcast packet. During the broadcasting process, the broadcast order of each first broadcast packet can be preset. In this case, the first electronic device can broadcast the preset number of first broadcast packets sequentially at preset time intervals according to the broadcast order of each first broadcast packet. Alternatively, the broadcast order of each first broadcast packet can be randomly determined. That is, the first electronic device can randomly select the first broadcast packet to be broadcast from the unbroadcast first broadcast packets at preset time intervals and broadcast it. The broadcast order of each first broadcast packet and its index information can be the same or different. That is, the broadcast order of each first broadcast packet and its index information are not directly related; they can be the same or different.
[0484] As illustrated in the example above, assuming a preset time interval of 100ms, for the first broadcast packets with index information from 1 to 5, five first broadcast packets can be broadcast sequentially at 100ms intervals, following the ascending order of index information. Alternatively, five first broadcast packets can be broadcast sequentially at 100ms intervals, following the descending order of index information. Furthermore, the first broadcast packet to be broadcast can be randomly selected from the unbroadcasted first broadcast packets at preset 100ms intervals. During the broadcasting process described above, the broadcast duration of each first broadcast packet can be customized, for example, set to 20 seconds, etc.
[0485] In this way, because the first broadcast packet carries the target device's device information, the target device can accurately and promptly obtain the first broadcast packet broadcast to it, and also obtain the target network login information carried in the first broadcast packet, thus improving the efficiency of network distribution. Furthermore, by sending a scan start command to the target device through the connection with the target device, the target device enters a scanning state. This allows the first electronic device to control whether the target device enters the scanning state; that is, the first electronic device only controls the target device to enter the scanning state when it needs to broadcast the first broadcast packet to the target device, which can reduce the power consumption of the target device.
[0486] See Figure 14 This is a flowchart illustrating a power distribution method provided in an embodiment of this application. The method is applied to the aforementioned target device. Figure 14 As shown, the method includes:
[0487] Step S1401: Establish a connection with the first electronic device.
[0488] In this embodiment, the target device needs to obtain network login information before accessing the network. Since the target device lacks input devices such as a touchscreen and keyboard, it needs to obtain the target network login information from a first electronic device to access the network. Because the first electronic device broadcasts the target network login information to the target device, the target device needs to enter a scanning state to receive the first broadcast packet carrying the target network login information sent by the first electronic device. To reduce power consumption, the target device is not always in a scanning state; it can enter the scanning state before the first electronic device broadcasts the first broadcast packet. Therefore, the first electronic device can control whether the target device enters the scanning state by sending a scan start command to the target device. Based on this, the first electronic device needs to establish a communication connection with the target device before sending the scan start command.
[0489] As one possible implementation method, the connection established between the target device and the first electronic device can be a wired connection or a wireless connection.
[0490] For example, when the target device establishes a wireless connection with the first electronic device, and the target device receives a connection establishment request message sent by the first electronic device, the target device can return a connection establishment response message to the first electronic device when it needs to establish a connection with the first electronic device, so as to establish a connection with the first electronic device.
[0491] As one possible implementation, a direct wireless connection is established between the first electronic device and the target device.
[0492] When the target device establishes a wireless connection with the first electronic device, a temporary wireless connection can be established between the target device and the first electronic device. During this temporary connection, no authentication is required, reducing user intervention. A wireless connection can be established directly without requiring a password, thus reducing the time spent by the user entering the password and by the first electronic device verifying the password, thereby improving connection speed. The first electronic device can also establish a secure wireless connection with the target device.
[0493] At this point, when the target device and the first electronic device establish a secure wireless connection, the first electronic device sends a connection establishment request message to the target device based on the target device's device identification information. This message carries the target device's login information. After receiving the connection establishment request message, the target device can parse the login information carried within it and compare it with its own stored login information to determine whether the first electronic device has permission to establish a wireless connection with the target device. When the target device detects that the login information carried in the connection establishment request message matches its own stored login information, it returns a connection establishment response message to the first electronic device, completing the establishment of the wireless connection with the first electronic device.
[0494] As one possible implementation, the login information for the target device includes the Service Set Identifier (SSID) and password for the target device's wireless connection.
[0495] It should be noted that when establishing a wired connection between the target device and the first electronic device, the connection can be established directly through a network cable, which will not be elaborated further here.
[0496] Step S1402: Receive a start scan command sent by the first electronic device through the connection, and enter the scan state in response to the start scan command.
[0497] The "Start Scan" command is used to instruct the target device to enter the scanning state.
[0498] In this embodiment, after the target device establishes a connection with the first electronic device, the first electronic device can control the target device to enter a scanning state before broadcasting the first broadcast packet to the target device. At this time, the first electronic device can send a start-scan command to the target device through the connection, and the target device receives the start-scan command through the connection. Upon receiving the start-scan command, the target device responds by initiating the scanning function and entering the scanning state.
[0499] In one possible implementation, since the duration of entering the scanning state has a significant impact on power consumption, the target device, upon receiving the start scan command, responds to the command by initiating the scanning function and entering the scanning state for a preset time, such as 60 seconds, to prepare for data acquisition.
[0500] As one possible implementation, after the target device receives the start command, it returns a response command to the source that sent the start scan command. This response command includes information related to the successful setting of the scan timeout and the device serial number (SN). The device SN can be used by the first electronic device to search for the target device.
[0501] Step S1403: Obtain the first broadcast packet broadcast by the first electronic device.
[0502] The first broadcast packet includes device information and login information for the target network.
[0503] In this embodiment of the application, since the first electronic device broadcasts a first broadcast packet carrying the device information of the target device and the login information of the target network to the target device, in order to receive the first broadcast packet in a timely manner, the target device enters the scanning state after receiving the start scanning command, so that the target device can listen in real time to whether the first electronic device has broadcast the first broadcast packet, and receive the first broadcast packet broadcast by the first electronic device when the first electronic device broadcasts the first broadcast packet.
[0504] As one possible implementation, to ensure the security of login information on the target network, the first electronic device can split the login information into a preset number of first broadcast packets and broadcast the preset number of first broadcast packets to the target device. Based on this, the target device can listen to the preset number of first broadcast packets. In this case, the target device acquiring the first broadcast packets broadcast by the first electronic device includes: acquiring the preset number of first broadcast packets broadcast by the first electronic device.
[0505] That is, when the first electronic device broadcasts a preset number of first broadcast packets to the target device, the target device can receive the preset number of first broadcast packets.
[0506] As one possible implementation, when the first electronic device broadcasts a preset number of first broadcast packets at a preset time interval, the target device can receive a first broadcast packet at a certain time interval, thereby obtaining the preset number of first broadcast packets.
[0507] Step S1404: When the device information in the first broadcast packet is the device information of the target device, obtain the login information of the target network contained in the first broadcast packet, and access the target network based on the login information of the target network.
[0508] In this embodiment, after receiving the first broadcast packet broadcast by the first electronic device, the target device can parse the first broadcast packet to obtain the device information and login information of the target network carried in the first broadcast packet. It can then detect whether the device information carried in the first broadcast packet is the target device's device information. If so, it indicates that the first broadcast packet was broadcast from the first electronic device to the target device. In this case, the target device can access the target network based on the login information of the target network carried in the first broadcast packet.
[0509] As one possible implementation, when the first electronic device broadcasts a preset number of first broadcast packets to the target device, the target device can parse each first broadcast packet it receives to extract the device information and partial login information of the target network. If the device information in the first broadcast packet matches the target device's device information, the first electronic device can save the partial login information of the target network carried in the first broadcast packet. In this way, the target device can obtain the partial login information of the target network carried in the preset number of first broadcast packets broadcast by the first electronic device. Then, when the target device obtains device information from all the preset number of first broadcast packets, it combines the login information of the target network carried in the preset number of first broadcast packets to obtain the complete login information of the target network.
[0510] In other words, when the target device parses and finds that the device information carried in a preset number of first broadcast packets broadcast by the first electronic device is indeed the target device's device information, the target device can parse a preset number of partial login information of the target network from the preset number of first broadcast packets. At this time, the target device can combine the partial login information of the target network carried in the preset number of first broadcast packets to obtain the complete login information of the target network.
[0511] When the first broadcast packet does not carry index information, the target device can perform all possible permutations and combinations of the partial login information of the target network carried in a preset number of first broadcast packets to obtain a variety of possible login information.
[0512] As one possible implementation, in order to enable the target device to quickly obtain the login information of the target network and improve the network configuration efficiency, each of the first broadcast packets in the preset number of first broadcast packets also carries at least one of the following: preset number information, index information, and random number information generated by the first electronic device.
[0513] At this point, combining the login information of the target network carried in the preset number of first broadcast packets to obtain the complete login information of the target network includes: combining the login information of the target network carried in the preset number of first broadcast packets according to the index information and / or preset number information carried in each first broadcast packet to obtain the complete login information of the target network.
[0514] In other words, since each of the preset number of first broadcast packets also carries at least one of the following information: preset number information, index information, and random number information generated by the first electronic device, after the target device receives and parses the first broadcast packets, in addition to obtaining the device information and login information of the target network carried in each first broadcast packet, it can also obtain at least one of the following information: preset number information, index information, and random number information generated by the first electronic device. When each first broadcast packet carries random number information generated by the first electronic device, the target device can determine whether the currently received first broadcast packet is broadcast by the first electronic device based on the random number information generated by the first electronic device. Based on whether the device information in the first broadcast packet is the target device's device information, it can determine whether the current first broadcast packet is a first broadcast packet sent to the target device. If the random number carried in the current first broadcast packet is the same as the random number carried in other first broadcast packets, and the device information carried in the current first broadcast packet is the target device's device information, then it is determined that the current first broadcast packet is broadcast by the first electronic device and is a first broadcast packet broadcast to the target device. When each first broadcast packet carries a preset number of information, the target device can determine, based on the preset number of information carried in the current first broadcast packet, that the first electronic device has split the login information of the target network into several first broadcast packets. Furthermore, based on the index information of the current first broadcast packet, the target device can determine the splitting order of the login information of the target network carried in the current first broadcast packet, thereby determining the combination order of the login information of the target network carried in the current first broadcast packet. In this way, the target device can combine the login information of the target network carried in the preset number of first broadcast packets according to their respective combination orders to obtain the complete login information of the target network.
[0515] As one possible implementation, to ensure the security of login information on the target network, the first electronic device encrypts a preset number of first broadcast packets. Upon receiving the first broadcast packets, the target device needs to decode them before it can parse them. In this case, the target device's decryption process corresponds to the first electronic device's encryption process. That is, the encryption and decryption keys or algorithms need to be agreed upon in advance. When the first electronic device uses the target device's device information as the encryption key to encrypt the first broadcast packets, the target device can then use its device information as the decryption key to decrypt the first broadcast packets. Alternatively, after the first electronic device encrypts the first broadcast packets using a preset encryption algorithm, the target device can use a preset decryption algorithm to decrypt the first broadcast packets, obtaining the decrypted first broadcast packets. In this case, the preset decryption algorithm corresponds to the preset encryption algorithm.
[0516] After obtaining complete login information for the target network, the target device can access the target network based on that login information.
[0517] In this way, because the first broadcast packet carries the target device's device information, the target device can accurately and promptly obtain the first broadcast packet broadcast to itself, and also obtain the target network login information carried in the first broadcast packet, thus improving network configuration efficiency. Furthermore, the target device only enters scanning mode upon receiving a scan start command, eliminating the need for constant scanning and reducing the target device's power consumption.
[0518] See Figure 15 This is a flowchart illustrating a power distribution method provided in an embodiment of this application. This method is applied to... Figure 1 In the aforementioned power distribution network system, this embodiment is different from the above-mentioned appendix. Figure 12 and Figure 14 The described embodiment adds an interactive process for distribution network results. There are two ways for the first electronic device to obtain the device information of the target device: one is by scanning the target device's device scan code, and the other is by broadcasting. In this embodiment, the example of the first electronic device obtaining the target device information by scanning is used for illustration. Figure 15 As shown, the method includes:
[0519] Step S1501: The first electronic device sends a prompt message to the user to enable the wireless connection function of the target device. The target device responds to the user's trigger to enable the wireless connection function and starts the wireless connection function.
[0520] In this embodiment, when the first electronic device needs to configure the target electronic device for network access, it needs to prompt the user to enable the wireless connection function of the target device so that the target device can start the wireless connection function and access the target network when it obtains the login information of the target network. At this time, the first electronic device can send a prompt message to the user to enable the wireless connection function of the target device.
[0521] The first electronic device may send the prompt information to the user by displaying the prompt information on its display interface. Alternatively, the first electronic device may send the prompt information to the user via voice broadcast. Of course, the first electronic device may also send the prompt information to the user in other ways, and this application does not impose any restrictions on this.
[0522] If a user activates the wireless connection function of the target device, for example, by clicking the wireless connection function button on the target device, the target device will respond to the user's activation of the wireless connection function and start the wireless connection function.
[0523] Step S1502: The target device generates its own barcode identification information. The first electronic device scans the target device's barcode identification information to obtain the target device's device information.
[0524] The target device's barcode identification information includes the target device's device information; the target device's device information includes the target device's device identification information.
[0525] In this embodiment, after activating its wireless connection, the target device needs to transmit its own device information to the first electronic device. At this time, the target device can obtain its own device information, such as its device identifier. To more accurately identify the target device, the device information may also include other device information, such as the manufacturer ID, version number, and device PID of the second electronic device. After obtaining its own device information, the target device generates a scan code based on the device information and sends it to the first electronic device. When the first electronic device needs to obtain the target device's device information, it can scan the target device's scan code to obtain the target device's device information.
[0526] For details, please refer to step S1201, which will not be repeated here.
[0527] As one possible implementation, the target device's device information may also include: the target device's login information.
[0528] Step S1503: The first electronic device establishes a connection with the target device based on the target device's device identification information. The target device establishes a connection with the first electronic device.
[0529] For details, please refer to steps S1202 and 1401, which will not be repeated here.
[0530] Step S1504: The first electronic device sends a start scan command to the target device via the connection. The target device receives the start scan command sent by the first electronic device via the connection and enters the scan state in response to the start scan command.
[0531] The "Start Scan" command is used to instruct the target device to enter the scanning state.
[0532] For details, please refer to steps S1203 and 1402, which will not be repeated here.
[0533] Step S1505: The first electronic device obtains the login information of the target network and broadcasts a first broadcast packet to the target device based on the device information of the target device and the login information of the target network. The target device obtains the first broadcast packet broadcast by the first electronic device.
[0534] The first broadcast packet includes the target device's device information and the target network's login information. The target device receives the first broadcast packet broadcast by the first electronic device.
[0535] For details, please refer to steps S1204 and 1403, which will not be repeated here.
[0536] Step S1506: When the device information in the first broadcast packet is the device information of the target device, the login information of the target network contained in the first broadcast packet is obtained, and the target network is accessed based on the login information of the target network.
[0537] For details, please refer to step S1404, which will not be repeated here.
[0538] Step S1507: The first electronic device sends a stop scanning command to the target device via the connection. The target device receives the stop scanning command sent by the first electronic device via the connection.
[0539] The stop scan command is used to instruct the target device to stop scanning.
[0540] In this embodiment, when the target device finishes receiving the first broadcast packet, the first electronic device needs to control the target device to disable its scanning function in order to reduce the power consumption of the target device. Therefore, when the first electronic device determines that the target device has finished receiving the first broadcast packet, it sends a stop scanning command to the target device through the connection with the target device. The target device can receive the stop scanning command through the connection with the first device.
[0541] Furthermore, before sending a stop scanning command to the target device through the connection with the target device, the first electronic device must first determine that the target device has received the first broadcast packet. The first electronic device can determine this in the following way.
[0542] In the first method, when the target device completes the reception of the first broadcast packet, it sends a first broadcast packet reception completion message to the first electronic device. Upon receiving this message, the first electronic device, through the connection, sends a stop scanning command to the target device.
[0543] The first broadcast packet reception completion message is used to indicate to the target device that the reception of the first broadcast packet has been completed.
[0544] Specifically, the first broadcast packet received by the target device contains information about the number of first broadcast packets. Therefore, the target device can determine whether it has completely received the first broadcast packets based on the number of first broadcast packets it has received. When the target device determines that it has received all the first broadcast packets, it can send a first broadcast packet reception completion message to the first electronic device to inform it that it has completed receiving the first broadcast packets. At this time, after receiving the first broadcast packet reception completion message, the first electronic device can know that the target device has completed receiving the first broadcast packets and can close the scanning function of the target device. At this time, the first electronic device sends a stop scanning command to the target device through the connection with the target device.
[0545] In the second approach, since the number of first broadcast packets sent by the first electronic device to the target device is fixed, and the transmission time of the first broadcast packets from the first electronic device to the target device can be obtained in advance, a time threshold can be preset. After the first electronic device finishes broadcasting the first broadcast, once this time threshold has elapsed, it can be considered that the target device has completed receiving the first broadcast packets, thus allowing the target device to disable its scanning function. Based on this, when the time for the first electronic device to complete broadcasting the first broadcast packets reaches the preset time threshold, it sends a stop scanning command to the target device via the connection.
[0546] Specifically, since the time it takes for the target device to receive the first broadcast packet after the first electronic device broadcasts it can be detected in advance, after a preset time threshold has elapsed since the first electronic device finished broadcasting the first broadcast packet, it can be considered that the target device has completed receiving the first broadcast packet. At this time, the first electronic device can record the time it took to complete the broadcast. When this time reaches the preset time threshold, it can be considered that the target device has completed receiving the first broadcast packet. At this time, the first electronic device sends a stop scanning command to the target device through the connection with the target device.
[0547] In one possible implementation, since the duration of entering the scanning state directly affects power consumption, to minimize power consumption, in addition to sending a stop scanning command at an appropriate time through the established connection as described above, the number of stop scanning commands can be reduced. Instead, after establishing the connection, when sending a start scanning command to the target device, a request for the target device to enter the scanning state is sent. By controlling the target device to enter the scanning state for a preset time, such as 45s or 60s, the target device only needs to enter the scanning state for the preset time, and then automatically stops scanning after the preset time, thereby reducing device power consumption. The preset time is the time required for the target device to obtain the data packets broadcast by the fully electronic device; the specific length of this time is not specifically limited here.
[0548] Step S1508: The target device responds to the stop scanning command and stops scanning.
[0549] In this embodiment of the application, after receiving a stop scanning command through the connection with the first electronic device, the target device knows that it needs to turn off the scanning function. At this time, the target device can turn off the scanning function and stop scanning.
[0550] Step S1509: The first electronic device disconnects from the wireless connection with the target device and establishes a wireless connection with the target network based on the login information of the target network.
[0551] In this embodiment of the application, after the first electronic device controls the target device to stop scanning, it can disconnect from the target device and reconnect to the wireless network. At this time, the first electronic device can connect to the target network according to the login information of the target network it has obtained.
[0552] It should be noted that after the first electronic device broadcasts the first broadcast packet, it can further determine whether the target device has successfully configured its network. After the target device accesses the target network based on its login information, it can send the configuration result information to the first electronic device, which then receives it. Alternatively, the target device may not send the configuration result information; in this case, the first electronic device needs to perform the detection itself. The first electronic device executes different steps depending on whether the target device sends the configuration result information. When the target device sends the configuration result information, the first electronic device executes either step S1510a or step S1510b. When the target device does not send the configuration result information, the first electronic device executes step S1510c.
[0553] Specifically as follows:
[0554] Step S1510a: The target device sends distribution network result information to the first electronic device. The first electronic device obtains the distribution network result information of the target device.
[0555] In this embodiment, after obtaining the login information of the target network, the target device can access the target network based on the login information. Within a first preset time period, the target device can generate network configuration result information based on its access status to the target network, and then send the network configuration result information to the first electronic device. The first electronic device receives the network configuration result information from the target device. The first electronic device can determine whether the target device has successfully configured its network based on the network configuration result information.
[0556] The target device can send the network distribution result information to the first electronic device in the following ways, as follows:
[0557] One implementation: The target device generates a third broadcast packet based on its current access status to the target network. This third broadcast packet is then broadcast to the first electronic device. The first electronic device receives the third broadcast packet and obtains the network distribution result information based on it.
[0558] The third broadcast packet includes: network distribution status information of the target device. This network distribution status information is used to characterize the access status of the target device to the target network. Alternatively,
[0559] The third broadcast packet includes: a random number from the first electronic device and a network status flag. The network status flag is used to indicate the access status of the target device to the target network. Alternatively,
[0560] The third broadcast packet includes an IP (Internet Protocol) address indicating the network configuration status. Specifically, when the target device is in a successfully configured state, the IP address is the target device's IP address; when the target device is in a non-configured state or a configuration failure state, the IP address is a first reserved IP address; when the target device is in a configuration process state, the IP address is a second reserved IP address. Both the first and second reserved IP addresses are different from the target device's IP address.
[0561] In other words, the target device can determine the distribution network status information based on its access status to the target network. For example, if the target device is currently accessing the target network, the generated distribution network status information is "Distribution in progress"; if the target device has successfully accessed the target network, the generated distribution network status information is "Distribution successful"; if the target device has not accessed the target network, the generated distribution network status information is "Distribution identified". Furthermore, when determining the reason for not accessing the target network, the distribution network status information can also carry the failure reason. For example, the failure reason could be an incorrect login information for the target network. After generating the distribution network status information, the target device can generate a third broadcast packet based on this information. The target device can directly use the distribution network status information as the content of the third broadcast packet, thus carrying the distribution network status information within the third broadcast packet. In this way, the first electronic device, upon receiving the third broadcast packet sent by the target device, can obtain the distribution network status information by parsing the third broadcast packet, thereby determining the target device's access status to the target network.
[0562] Alternatively, to reduce the complexity of the third broadcast packet, the target device can set a network distribution status flag based on the network distribution status information. This flag indicates the network distribution status; for example, 00x1 indicates network distribution in progress, 00x2 indicates network distribution failure, and 00x3 indicates network distribution success. In this case, the target device only needs to add the random number from the first electronic device and the network distribution status flag to the third broadcast packet. After receiving the third broadcast packet, the first electronic device can determine whether the third broadcast packet was sent to it based on the total random number. If so, it can determine the target device's access status to the target network based on the network distribution status flag in the third broadcast packet.
[0563] As one possible implementation, the target device can add a custom network distribution status flag to the third broadcast packet based on existing data. That is, the third broadcast packet includes a custom byte indicating the network distribution status. For example, the first byte is a random number (broadcast packet identifier) of the first electronic device, the second byte is the packet sequence number of the third broadcast packet, and the third byte is the network distribution status flag. The network distribution status information can be broadcast in whole packets or in segments. In the case of segmented transmission, the target device divides the network distribution status flag into different third broadcast packets. After receiving multiple third broadcast packets, the first electronic device can combine the contents of the third byte of each third broadcast packet according to its packet sequence number to obtain the complete network distribution status flag. Based on the complete network distribution status flag, it can then determine whether the target device has successfully accessed the target network.
[0564] It should be noted that different mapping relationships between network configuration status flags and network configuration status can be preset. For example, the third byte can be set to "11" to indicate network configuration in progress, "12" to indicate successful network configuration, "21" to indicate no target network was found, and "22" to indicate an incorrect password. Other mapping relationships can also be set. Of course, the network configuration status flags can be not only numbers, but also any combination of numbers, letters, symbols, and text. There are no inherent restrictions on this.
[0565] Alternatively, to reduce the complexity of the third broadcast packet and improve compatibility between devices, the network configuration status can be represented by an IP address. That is, when the target device is in a successfully configured state, the IP address is the target device's IP address; when the target device is in a non-configured or failed configuration state, the IP address is the first reserved IP address; when the target device is in the process of configuring, the IP address is the second reserved IP address; both the first and second reserved IP addresses are different from the target device's IP address. In this case, the target device can set the IP address in the third broadcast packet according to the configuration result, without needing to carry other information. In this way, after receiving the third broadcast packet, the first electronic device can determine whether the target device is connected to the target network by parsing the IP address in the third broadcast packet. For example, after successful configuration, the target device can broadcast its own IP address, such as 192.168.0.1; if configuration fails, it can broadcast 0.0.0.0; and if configuration is in progress, it will broadcast 1.1.1.1. In this way, by simply setting different IP addresses in the third broadcast packet, the network configuration result of the target device can be accurately identified without adding random numbers or flags to the third broadcast packet, thus improving compatibility between devices.
[0566] As one possible implementation, the aforementioned third broadcast packet includes a BLE broadcast packet. That is, when both the first electronic device and the target device have Bluetooth enabled, a third broadcast packet can be broadcast via Bluetooth, in which case the third broadcast packet can be a BLE broadcast packet.
[0567] The second implementation method involves establishing a wireless connection between the first electronic device and the target device. The target device sends network distribution result information to the first electronic device via the wireless connection. The first electronic device receives the network distribution result information via the wireless connection.
[0568] In other words, after the first electronic device broadcasts its first broadcast packet, it can establish a wireless connection with the target device, such as a Bluetooth connection, an infrared connection, an AP (Access Point) connection, or other wireless connections. Data transmission can then occur between the first electronic device and the target device through this wireless connection. At this time, when the target device accesses the target network based on its login information, it can generate network configuration result information based on its access status, and then transmit this result information to the first electronic device via the wireless connection. The first electronic device can then receive the network configuration result information wirelessly.
[0569] The third implementation method: The first electronic device broadcasts its IP address and port number to the target device. The target device listens for the IP address and port number broadcast by the first electronic device. When accessing the target network, the target device sends a TCP (Transmission Control Protocol) connection establishment request message to the first electronic device based on the first electronic device's IP address and port number. Upon receiving the TCP connection establishment request message from the target device, the first electronic device establishes a TCP connection with both the target and target devices. The target device sends network configuration result information to the first electronic device through the TCP connection. The first electronic device receives the network configuration result information through the TCP connection.
[0570] In other words, the target device can send network configuration result information to the first electronic device through the target network. After broadcasting its first broadcast packet, the first electronic device can broadcast its IP address and port number to the target device. The target device can then listen to this broadcast IP address and port number. Upon successful access to the target network, the target device can send a TCP connection establishment request message to the first electronic device based on its IP address and port number. After receiving the TCP connection establishment request message, the first electronic device establishes a TCP connection with the target device. The target device then sends the network configuration result information to the first electronic device through the TCP connection. The first electronic device receives the network configuration result information through the TCP connection. At this point, the network configuration result information indicates successful configuration.
[0571] It should be noted that if the target device fails to configure the network or is in the process of configuring the network, a TCP connection cannot be established between the target device and the first electronic device, and the target device cannot send the network configuration result information to the first electronic device using this method. In this case, the target device can send the network configuration result information to the first electronic device through other means, or perform the following step S608b.
[0572] Step S1510b: If the network distribution result information sent by the target device is not received within the first preset time, the first electronic device obtains the device identification information of the target device and searches for the target device in the target network based on the device identification information of the target device; if the target device is found within the second preset time, the network distribution is determined to be successful; otherwise, the network distribution is determined to be unsuccessful.
[0573] In this embodiment, if it is pre-agreed that the target device sends network distribution result information to the first electronic device, and due to certain factors, the network distribution result information sent by the target device is not transmitted to the first electronic device, i.e., the first electronic device does not receive the network distribution result information. In this case, if the first electronic device does not receive the network distribution result information sent by the target device within a first preset time, it can perform its own detection of the target device's network distribution result. That is, if the first electronic device does not receive the network distribution result information sent by the target device within the first preset time, it can obtain the target device's device identification information from the storage device and search for the target device within the target network based on the target device's device identification information; a second preset time is set as the search timeout. If the target device can be found within the second preset time, the target device is determined to have successfully configured the network; if the target device is not found within the second preset time, the target device is determined to have failed to configure the network.
[0574] For example, taking a printer as the target device, the first electronic device can search for printer services in the target network based on the printer's device identification information. The search interval can be customized, such as 1 second, 2 seconds, 4 seconds, 8 seconds, etc. The timeout period can also be preset, such as 30 seconds, 60 seconds, etc. If the target device responds within the timeout period, it is considered that the target device has successfully connected to the target network, and the network configuration is successful. If it does not respond within the timeout period, the network configuration of the target device is determined to have failed.
[0575] This implementation method can reduce the occupation of Bluetooth ports, because the network configuration process may take several seconds or tens of seconds, and using Bluetooth communication in this case may occupy too many Bluetooth ports.
[0576] It should be noted that both the first and second preset times are preset according to actual needs.
[0577] Step S1510c: The first electronic device obtains the device identification information of the target device and searches for the target device in the target network based on the device identification information of the target device; if the target device is found within a third preset time, the network configuration is successful; otherwise, the network configuration fails.
[0578] For details, please refer to step S1510b, which will not be repeated here.
[0579] Step S1511: The first electronic device displays the indication information of the distribution network result to the user.
[0580] In this embodiment, the first electronic device can display indication information of the network distribution result to the user. The first electronic device can directly display the network distribution result of the target device through a display interface, or send it to the user via voice broadcast, or other means.
[0581] Alternatively, the first electronic device may not directly display the network configuration result information to the user, but instead can display information prompting the user to observe the network indicator light status of the target device. In this way, the user can determine the network configuration result of the target device by observing the network indicator light status. For example, if the target device successfully configures itself, the "WiFi light" on the target device will be on or flashing; if the network configuration fails, the "WiFi light" on the target device will remain off.
[0582] Optionally, the "WiFi light" status of the target device can further indicate the network configuration status by: indicating the number of times the "WiFi light" flashes or the on / off status of multiple "WiFi lights".
[0583] For example, if the target device's "WiFi light" remains on, it indicates that network configuration is successful; if the target device's "WiFi light" flashes, it indicates that network configuration is in progress; and if the target device's "WiFi light" remains off, it indicates that network configuration has failed.
[0584] Alternatively, upon successful network configuration of the target device, the device information of the target device can be displayed to the user. That is, when the first electronic device confirms successful network configuration of the target device, it displays the device information of the target device to the user, informing them that the target device has been successfully configured and is ready for use. (See reference.) Figure 7 As shown.
[0585] See Figure 16 This is a flowchart illustrating a power distribution method provided in an embodiment of this application. This method is applied to... Figure 1 In the aforementioned power distribution network system, the embodiments of this application are relative to... Figure 15 The embodiments described differ only in the method by which the first electronic device obtains the device information of the target device. In this embodiment, the example of the first electronic device obtaining the device information of the target device via broadcasting will be used for illustration. Figure 16 As shown, the method includes:
[0586] Step S1601: The target device broadcasts a second broadcast packet to the first electronic device.
[0587] The second broadcast packet contains the device information of the target device, including the device identification information of the target device.
[0588] In this embodiment, when the target device accesses the network, it needs to obtain network login information first. At this time, it needs to obtain the network login information from the first electronic device. To facilitate the target device obtaining the network login information more accurately and promptly, the target device can pre-broadcast its own device information. The target device can then obtain its own device information, encode it into a second broadcast packet, and send it to the first electronic device via broadcast. In fact, the target device's device information includes its device identifier. To more accurately identify the target device, the target device's device information can also include other device information, such as the manufacturer ID, version number, and device PID of the second electronic device.
[0589] As one possible implementation, to improve data processing efficiency, the target device's device information can be divided into multiple first data packets and broadcast. How the target device divides its device information into multiple first data packets can be referenced from the process described above where the first electronic device splits the target network's login information into a preset number of second data packets; this will not be elaborated upon here.
[0590] Step S1602: In response to the user's network configuration search start operation, the first electronic device receives the second broadcast packet broadcast by the target electronic device.
[0591] In this embodiment, if a user needs the first electronic device to configure the network for other electronic devices, the network configuration search function of the first electronic device can be triggered. The first electronic device responds to the user's network configuration search initiation operation and performs a search operation for devices to be configured. At this time, the first electronic device receives a second broadcast packet broadcast by the second electronic device. It parses the second broadcast packet to obtain the device information of the second electronic device, generates a device list based on the parsed device information, and displays the device list on a display interface so that the user can know which devices need network configuration. The user can select a target device based on the device identifier information of the second electronic device displayed on the display interface. Based on the user's selection, the first electronic device identifies the second electronic device selected by the user as the target device and records the device information of the target device.
[0592] For example, if the first electronic device has Bluetooth functionality, the user can enable Bluetooth to trigger the network configuration search initiation operation. At this time, the first electronic device can use its Bluetooth function to search for a second electronic device that has Bluetooth enabled, and receive a second broadcast packet (BLE broadcast packet) broadcast by the second electronic device.
[0593] The first electronic device can obtain the device information of the second electronic device based on the second broadcast packet broadcast by the second electronic device. The device information of the second electronic device may include manufacturer ID, version number, and serial number. Due to the length limitation of Bluetooth broadcast information, the serial number can be a partial number, such as the last 7 digits. The first electronic device can identify different second electronic devices based on the device information of the second electronic device.
[0594] Step S1603: The first electronic device sends a prompt message to the user to enable the wireless connection function of the target device. The target device responds to the user's trigger to enable the wireless connection function and starts the wireless connection function.
[0595] For details, please refer to step S1501, which will not be repeated here.
[0596] Step S1604: The first electronic device establishes a connection with the target device based on the target device's device identification information. The target device establishes a connection with the first electronic device.
[0597] For details, please refer to step S1503, which will not be repeated here.
[0598] Step S1605: The first electronic device sends a start scan command to the target device via the connection. The target device receives the start scan command sent by the first electronic device via the connection and enters the scan state in response to the start scan command.
[0599] The "Start Scan" command is used to instruct the target device to enter the scanning state.
[0600] For details, please refer to step S1504, which will not be repeated here.
[0601] Step S1606: The first electronic device obtains the login information of the target network and broadcasts a first broadcast packet to the target device based on the device information of the target device and the login information of the target network.
[0602] The first broadcast packet includes the target device's device information and the target network's login information. The target device receives the first broadcast packet broadcast by the first electronic device.
[0603] For details, please refer to step S1505, which will not be repeated here.
[0604] Step S1607: When the device information in the first broadcast packet is the device information of the target device, the login information of the target network contained in the first broadcast packet is obtained, and the target network is accessed based on the login information of the target network.
[0605] For details, please refer to step S1506, which will not be repeated here.
[0606] Step S1608: The first electronic device sends a stop scanning command to the target device via the connection. The target device receives the stop scanning command sent by the first electronic device via the connection.
[0607] The stop scan command is used to instruct the target device to stop scanning.
[0608] For details, please refer to step S1507, which will not be repeated here.
[0609] Step S1609: The target device responds to the stop scanning command and stops scanning.
[0610] For details, please refer to step S1508, which will not be repeated here.
[0611] Step S1610: The first electronic device disconnects from the wireless connection with the target device and establishes a wireless connection with the target network based on the login information of the target network.
[0612] For details, please refer to step S1509, which will not be repeated here.
[0613] It should be noted that after the first electronic device broadcasts the first broadcast packet, it can further determine whether the target device has successfully configured its network. After the target device accesses the target network based on its login information, it can send the configuration result information to the first electronic device, which then receives it. Alternatively, the target device may not send the configuration result information; in this case, the first electronic device needs to perform the detection itself. The first electronic device executes different steps depending on whether the target device sends the configuration result information. When the target device sends the configuration result information, the first electronic device executes step S1611a or step S1611b. When the target device does not send the configuration result information, the first electronic device executes step S1611c.
[0614] Specifically as follows:
[0615] Step S1611a: The target device sends distribution network result information to the first electronic device. The first electronic device obtains the distribution network result information of the target device.
[0616] For details, please refer to step S1510a, which will not be repeated here.
[0617] Step S1611b: If the network distribution result information sent by the target device is not received within the first preset time, the first electronic device obtains the device identification information of the target device and searches for the target device in the target network based on the device identification information of the target device; if the target device is found within the second preset time, the network distribution is determined to be successful; otherwise, the network distribution is determined to be unsuccessful.
[0618] For details, please refer to step S1510b, which will not be repeated here.
[0619] Step S1611c: The first electronic device obtains the device identification information of the target device and searches for the target device in the target network based on the device identification information of the target device; if the target device is found within a third preset time, the network configuration is successful; otherwise, the network configuration fails.
[0620] For details, please refer to step S1510c, which will not be repeated here.
[0621] Step S1612: The first electronic device displays the indication information of the distribution network result to the user.
[0622] For details, please refer to step S1511, which will not be repeated here.
[0623] See Figure 17 This is a schematic diagram of the structure of a power distribution network device provided in an embodiment of this application. Figure 17 As shown, the distribution network device includes:
[0624] The first acquisition unit 1701 is used to acquire device information of the target device.
[0625] The equipment information includes equipment identification information.
[0626] The first establishing unit 1702 is used to establish a connection with the target device based on the device identification information of the target device.
[0627] The first sending unit 1703 is used to send a start scanning command to the target device via a connection.
[0628] The "Start Scan" command is used to instruct the target device to enter the scanning state.
[0629] The first processing unit 1704 is used to obtain the login information of the target network and broadcast a first broadcast packet to the target device based on the device information of the target device and the login information of the target network.
[0630] The first broadcast packet includes the target device's device information and the target network's login information.
[0631] As one possible implementation, the first transmitting unit 1703 is also used to send a stop scanning command to the target device via a connection.
[0632] The stop scan command is used to instruct the target device to stop scanning.
[0633] As one possible implementation, the first sending unit 1703 is specifically used to send a stop scanning command to the target device via a connection when it receives a first broadcast packet reception completion message sent by the target device, or when the time to complete broadcasting the first broadcast packet reaches a preset time threshold.
[0634] The first broadcast packet reception completion message is used to indicate to the target device that the reception of the first broadcast packet has been completed.
[0635] As one possible implementation, the first establishing unit 1702 is specifically used to disconnect from the wireless network when the first electronic device is connected to the wireless network, and establish a wireless connection with the target device based on the device identification information of the target device. Alternatively, when the first electronic device is not connected to the wireless network, it establishes a wireless connection with the target device based on the device identification information of the target device.
[0636] As one possible implementation, the first establishment unit 1702 is also used to disconnect the wireless connection with the target device and establish a wireless connection with the target network based on the login information of the target network.
[0637] As one possible implementation, the first transmitting unit 1703 is also used to send a prompt message to the user to enable the wireless connection function of the target device.
[0638] As one possible implementation, the first acquisition unit 1701 is specifically used to scan the barcode identification information of the target device to obtain the device information of the target device.
[0639] The target device's QR code identification information contains the target device's device information.
[0640] As one possible implementation, the first acquisition unit 1701 is specifically used to receive a second broadcast packet broadcast by the target device. Based on the second broadcast packet, it acquires the device information of the target device.
[0641] The second broadcast packet contains device information of the target device.
[0642] As one possible implementation, the target device's device information may also include: the target device's login information.
[0643] The first establishment unit 1702 is specifically used to establish a connection with the target device based on the device identification information and login information of the target device.
[0644] As one possible implementation, the first processing unit 1704 is specifically used to, when the first electronic device accesses a network, determine the network accessed by the first electronic device as the target network and obtain the login information of the target network. Alternatively, when the first electronic device is not accessing a network, it obtains the login information of the target network in response to the user's login information input operation.
[0645] As one possible implementation, the first processing unit 1704 is specifically used to split the login information of the target network into a preset number of first broadcast packets according to a predetermined packet splitting rule, and each first broadcast packet carries the device information of the target device; and broadcast the preset number of first broadcast packets to the target device.
[0646] As one possible implementation, each first broadcast packet also carries preset number information, index information, and random number information generated by the first electronic device.
[0647] As one possible implementation, the first processing unit 1704 is specifically used to encrypt a preset number of first broadcast packets according to a preset encryption key; and broadcast the preset number of encrypted first broadcast packets to the target device.
[0648] As one possible implementation, the preset encryption key is device information obtained from the target device or other encryption keys.
[0649] As one possible implementation, the first processing unit 1704 is specifically used to broadcast a preset number of first broadcast packets to the target device at preset time intervals, and the broadcast order of the preset number of first broadcast packets is predetermined or randomly determined, and the broadcast order of each first broadcast packet is the same as or different from the index information of the first broadcast packet.
[0650] As one possible implementation, the first processing unit 1704 is also used to obtain the distribution network result information of the target device.
[0651] As one possible implementation, the first processing unit 1704 is specifically used to receive the third broadcast packet broadcast by the target device and obtain the distribution network result information based on the third broadcast packet.
[0652] The third broadcast packet includes: the target device's network distribution status information; this information characterizes the target device's access status to the target network. Alternatively,
[0653] The third broadcast packet includes: a random number from the first electronic device and a network status flag; the network status flag is used to indicate the access status of the target device to the target network. Alternatively,
[0654] The third broadcast packet includes: an Internet Protocol (IP) address indicating the network configuration status; wherein when the target device is in a successful network configuration state, the IP address is the target device's IP address; when the target device is in a non-configured or failed configuration state, the IP address is a first reserved IP address; when the target device is in a configuration process state, the IP address is a second reserved IP address; wherein both the first and second reserved IP addresses are different from the target device's IP address.
[0655] As one possible implementation, the third broadcast packet includes a Bluetooth Low Energy (BLE) broadcast packet.
[0656] As one possible implementation, the first processing unit 1704 is further configured to, if it does not receive network distribution result information sent by the target device within a first preset time, obtain the device identification information of the target device and search for the target device within the target network based on the device identification information of the target device. If the target device is found within a second preset time, the network distribution is determined to be successful; otherwise, the network distribution is determined to have failed.
[0657] In one possible implementation, the first processing unit 1704 is specifically used to broadcast the IP address and port number of the first electronic device to the target device. If a Transmission Control Protocol (TCP) connection establishment request message is received from the target device, a TCP connection is established with the target device. Network distribution result information is received through the TCP connection.
[0658] As one possible implementation, the first processing unit 1704 is specifically used to establish a wireless connection with the target device and obtain the network distribution result information of the target device through the wireless connection.
[0659] As one possible implementation, the first processing unit 1704 is specifically used to obtain the device identification information of the target device and search for the target device in the target network based on the device identification information of the target device; if the target device is found within a third preset time, the network configuration is successful, otherwise the network configuration fails.
[0660] As one possible implementation, the first sending unit 1703 is also used to display indication information of the distribution network result to the user.
[0661] As one possible implementation, the first sending unit 1703 is specifically used to display information to the user instructing the user to observe the network signal light display status of the target device; or, when the target device is successfully configured for network connection, to display the device information of the target device to the user.
[0662] See Figure 18 This is a schematic diagram of the structure of a power distribution network device provided in an embodiment of this application. Figure 18 As shown, the distribution network device includes:
[0663] The second establishment unit 1801 is used to establish a connection with the first electronic device.
[0664] The receiving unit 1802 is used to receive a start scan command sent by the first electronic device via a connection, and to enter the scan state in response to the start scan command.
[0665] The scan start command is used to instruct the target device to enter the scan state.
[0666] The second processing unit 1803 is used to acquire the first broadcast packet broadcast by the first electronic device.
[0667] The first broadcast packet includes device information and login information for the target network.
[0668] The second processing unit 1803 is further configured to, when the device information in the first broadcast packet is the device information of the target device, obtain the login information of the target network contained in the first broadcast packet, and access the target network based on the login information of the target network.
[0669] As one possible implementation, the receiving unit 1802 is also used to receive a stop scanning command sent by the first electronic device via a connection.
[0670] The stop scan command is used to instruct the target device to stop scanning.
[0671] The second processing unit 1803 is also configured to stop scanning in response to the stop scanning command.
[0672] As one possible implementation, such as Figure 19 As shown, the above-mentioned distribution network device also includes:
[0673] The second transmitting unit 1804 is used to send a first broadcast packet reception completion message to the first electronic device when the reception of the first broadcast packet is completed.
[0674] The first broadcast packet reception completion message is used to indicate to the target device that the reception of the first broadcast packet has been completed.
[0675] As one possible implementation, the second processing unit 1803 is also used to start the wireless connection function in response to a user-triggered activation of the target device's wireless connection function.
[0676] As one possible implementation, the second processing unit 1803 is also used to generate the barcode identification information of the target device.
[0677] The target device's barcode identification information includes the target device's device information; the target device's device information includes the target device's device identification information.
[0678] As one possible implementation, the target device's device information also includes the target device's login information.
[0679] As one possible implementation, the second processing unit 1803 is also used to broadcast a second broadcast packet to the first electronic device.
[0680] The second broadcast packet contains the device information of the target device, including the device identification information of the target device.
[0681] As one possible implementation, the second processing unit 1803 is specifically used to acquire a preset number of first broadcast packets broadcast by the first electronic device. When the device information in the preset number of acquired first broadcast packets is all device information of the target device, the login information of the target network carried in the preset number of first broadcast packets is combined to obtain the complete login information of the target network.
[0682] As one possible implementation, the first broadcast packet also carries at least one of the following: preset number information, index information, and random number information generated by the first electronic device.
[0683] The second processing unit 1803 is specifically used to combine the login information of the target network carried in a preset number of first broadcast packets according to the index information and / or preset number information carried in each first broadcast packet, so as to obtain the complete login information of the target network.
[0684] As one possible implementation, the second processing unit 1803 is also used to send distribution network result information to the first electronic device.
[0685] As one possible implementation, the second processing unit 1803 is specifically used to broadcast a third broadcast packet to the first electronic device.
[0686] The third broadcast packet includes: network distribution status information of the target device; the network distribution status information is used to characterize the access status of the target device to the target network. Alternatively,
[0687] The third broadcast packet includes: a random number from the first electronic device and a network status flag; the network status flag is used to indicate the access status of the target device to the target network. Alternatively,
[0688] The third broadcast packet includes: an IP address indicating the network configuration status; wherein when the target device is in a successful network configuration state, the IP address is the target device's IP address; when the target device is in a non-configured or failed configuration state, the IP address is a first reserved IP address; when the target device is in a configuration process state, the IP address is a second reserved IP address; wherein both the first and second reserved IP addresses are different from the target device's IP address.
[0689] As one possible implementation, the second processing unit 1803 is specifically used to listen for the IP address and port number of the first electronic device broadcast by the first electronic device. Upon accessing the target network, it sends a TCP connection establishment request message to the first electronic device based on the first electronic device's IP address and port number, establishing a TCP connection with the first electronic device. Then, it sends network configuration result information to the first electronic device through the TCP connection.
[0690] As one possible implementation, the second processing unit 1803 is specifically used to establish a wireless connection with the first electronic device and send network distribution result information to the first electronic device through the wireless connection.
[0691] Corresponding to the above embodiments, this application also provides an electronic device. Figure 20 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. The electronic device 2000 may include a processor 2001, a memory 2002, and a communication unit 2003. These components communicate through one or more buses. Those skilled in the art will understand that the structure of the server shown in the figure does not constitute a limitation on the embodiment of the present invention. It may be a bus topology or a star topology, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0692] The communication unit 2003 is used to establish a communication channel, enabling the storage device to communicate with other devices. It receives user data from other devices or sends user data to other devices.
[0693] The processor 2001 serves as the control center of the storage device, connecting various parts of the electronic device via various interfaces and lines. It executes software programs and / or modules stored in the memory 2002, and retrieves data stored in the memory, to perform various functions of the electronic device and / or process data. The processor can be composed of integrated circuits (ICs), such as a single packaged IC or multiple packaged ICs with the same or different functions connected together. For example, the processor 2001 may consist only of a central processing unit (CPU). In this embodiment of the invention, the CPU may have a single processing core or include multiple processing cores.
[0694] The memory 2002 is used to store the execution instructions of the processor 2001. The memory 2002 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0695] When the execution instructions in memory 2002 are executed by processor 2001, the electronic device 2000 is able to perform operations. Figure 2 or Figure 5 or Figure 12 or Figure 14 Some or all of the steps in the illustrated embodiments.
[0696] In a specific implementation, the present invention also provides a computer storage medium, wherein the computer storage medium may store a program, which, when executed, may include some or all of the steps in the various embodiments of the network distribution method provided by the present invention. The storage medium may be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0697] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments of the present invention.
[0698] The same or similar parts between the various embodiments in this specification can be referred to mutually. In particular, the device embodiments and terminal embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.
Claims
1. A power distribution network method, characterized in that, Applied to a first electronic device, the method includes: The system receives a first data packet broadcast by a second electronic device; the first data packet carries device information of the second electronic device; the device information includes device identification information. The target device is determined based on the device information of the second electronic device; Obtain login information of the target network, and broadcast a second data packet to the target device based on the device information of the target device and the login information of the target network; the second data packet includes the device information of the target device and the login information of the target network. Before broadcasting the second data packet to the target device based on the device information of the target device and the login information of the target network, the method further includes: Based on the device identification information of the target device, a connection is established with the target device, and a start scan command is sent to the target device through the connection. The start scan command is used to instruct the target device to enter the scan state.
2. The method according to claim 1, characterized in that, Also includes: Obtain the network distribution result information of the target device.
3. The method according to claim 1, characterized in that, The step of broadcasting the second data packet to the target device based on the device information of the target device and the login information of the target network includes: According to the predetermined packet splitting rules, the login information of the target network is split into a preset number of second data packets, and each second data packet carries the device information of the target device; Broadcast the preset number of second data packets to the target device.
4. The method according to claim 3, characterized in that, Each second data packet also carries at least one of the following: a preset number of information, an index of information, and a random number of information generated by the first electronic device.
5. The method according to claim 3, characterized in that, The broadcasting of the preset number of second data packets to the target device includes: The preset number of second data packets are encrypted according to a preset encryption key; The preset number of encrypted second data packets are broadcast to the target device.
6. The method according to claim 3, characterized in that, The broadcasting of the preset number of second data packets to the target device includes: The preset number of second data packets are broadcast to the target device at preset time intervals, and the broadcast order of the preset number of second data packets is predetermined or randomly determined. The broadcast order of each second data packet is the same as or different from the index information of the second data packet.
7. The method according to claim 5, characterized in that, The preset encryption key is device information obtained from the target device or other encryption keys.
8. The method according to claim 2, characterized in that, The process of obtaining the network distribution result information of the target device includes: Receive the third data packet broadcast by the target device, and obtain the network distribution result information based on the third data packet; wherein, The third data packet includes: network distribution status information of the target device; the network distribution status information is used to characterize the access status of the target device to the target network; or, The third data packet includes: a random number from the first electronic device and a network status identifier bit; the network status identifier bit is used to indicate the access status of the target device to the target network; or... The third data packet includes: an Internet Protocol (IP) address indicating the network configuration status; wherein when the target device is in a successful network configuration state, the IP address is the target device's IP address; when the target device is in a non-configured network or failed network configuration state, the IP address is a first reserved IP address; when the target device is in a network configuration process state, the IP address is a second reserved IP address; wherein both the first reserved IP address and the second reserved IP address are different from the target device's IP address.
9. The method according to claim 1 or 8, characterized in that, The first data packet, the second data packet, and the third data packet each include at least one BLE broadcast packet.
10. The method according to claim 8 or 9, characterized in that, Also includes: If the network distribution result information sent by the target device is not received within the first preset time, the device identification information of the target device is obtained, and the target device is searched within the target network based on the device identification information of the target device. If the target device is found within the second preset time, the network configuration is determined to be successful; otherwise, the network configuration is determined to be unsuccessful.
11. The method according to claim 2, characterized in that, The process of obtaining the network distribution result information of the target device includes: Broadcast the IP address and port number of the first electronic device to the target device; If a Transmission Control Protocol (TCP) connection establishment request message is received from the target device, a TCP connection is established with the target device. The network distribution result information is received through the TCP connection.
12. The method according to claim 2, characterized in that, The process of obtaining the network distribution result information of the target device includes: Establish a wireless connection with the target device; The network configuration result information of the target device is obtained through the wireless connection.
13. The method according to claim 2, characterized in that, The process of obtaining the network distribution result information of the target device includes: Obtain the device identification information of the target device, and search for the target device within the target network based on the device identification information of the target device; If the target device is found within the third preset time, the network configuration is successful; otherwise, the network configuration fails.
14. The method according to claim 1, characterized in that, Also includes: Display network distribution results and related information to users.
15. The method according to claim 14, characterized in that, The instruction information for displaying the network distribution results to the user includes: Display information to the user instructing them to observe the network indicator light status of the target device; or, When the target device is successfully configured for network connection, the device information of the target device is displayed to the user.
16. The method according to claim 1, characterized in that, Before broadcasting the second data packet to the target device based on the device identification information of the target device and the login information of the target network, the method further includes: Send a prompt message to the user; the prompt message is used to prompt the user to trigger the target device to enter the scanning state.
17. The method according to claim 1, characterized in that, The determination of the target device based on the device information of the second electronic device includes: In response to the user's selection action, the target device is determined based on the device information of the second electronic device.
18. The method according to claim 1, characterized in that, The acquisition of login information for the target network includes: When the first electronic device accesses the network, the network accessed by the first electronic device is determined as the target network, and the login information of the target network is obtained; or, When the first electronic device is not connected to the network, it obtains the login information of the target network in response to the user's login information input operation.
19. A power distribution network method, characterized in that, Applied to a target device, the method includes: A first data packet is broadcast to a first electronic device; the first data packet carries device information of the target device; the device information includes device identification information; Obtain the second data packet broadcast by the first electronic device, the second data packet including device information and login information of the target network; When the device information in the second data packet is the device information of the target device, the login information of the target network contained in the second data packet is obtained, and the target network is accessed based on the login information of the target network; Before obtaining the second data packet broadcast by the first electronic device, the method further includes: Establish a connection with the first electronic device, receive a start scan command sent by the first electronic device through the connection, and enter the scan state in response to the start scan command.
20. The method according to claim 19, characterized in that, Also includes: Send the distribution network result information to the first electronic device.
21. The method according to claim 19, characterized in that, The step of obtaining the second data packet broadcast by the first electronic device includes: Obtain a preset number of second data packets broadcast by the first electronic device; When the device information in the second data packet is the device information of the target device, obtaining the login information of the target network contained in the second data packet includes: When the device information in the preset number of second data packets are all device information of the target device, the login information of the target network carried in the preset number of second data packets is combined to obtain the complete login information of the target network.
22. The method according to claim 21, characterized in that, The second data packet also carries at least one of the following: preset number information, index information, and random number information generated by the first electronic device; The step of combining the login information of the target network carried in a preset number of second data packets to obtain the complete login information of the target network includes: combining the login information of the target network carried in a preset number of second data packets according to the index information and / or preset number information carried in each second data packet to obtain the complete login information of the target network.
23. The method according to claim 20, characterized in that, Sending the distribution network result information to the first electronic device includes: Broadcast a third data packet to the first electronic device; wherein, The third data packet includes: network distribution status information of the target device; the network distribution status information is used to characterize the access status of the target device to the target network; or, The third data packet includes: a random number from the first electronic device and a network status identifier bit; the network status identifier bit is used to indicate the access status of the target device to the target network; or... The third data packet includes: an IP address indicating the network configuration status; wherein when the target device is in a successful network configuration state, the IP address is the IP address of the target device; when the target device is in a non-configured network state or a failed network configuration state, the IP address is a first reserved IP address; when the target device is in a network configuration process state, the IP address is a second reserved IP address; wherein both the first reserved IP address and the second reserved IP address are different from the IP address of the target device.
24. The method according to claim 20, characterized in that, Sending the distribution network result information to the first electronic device includes: Listen for the IP address and port number of the first electronic device broadcast by the first electronic device; When accessing the target network, a TCP connection establishment request message is sent to the first electronic device based on the IP address and port number of the first electronic device to establish a TCP connection with the first electronic device; The network configuration result information is sent to the first electronic device through the TCP connection.
25. The method according to claim 20, characterized in that, Sending the distribution network result information to the first electronic device includes: Establish a wireless connection with the first electronic device; The network configuration result information is sent to the first electronic device via the wireless connection.
26. The method according to claim 19, characterized in that, Before obtaining the second data packet broadcast by the first electronic device, the method further includes: In response to a user's trigger action, enter scanning mode.
27. A power distribution network device, characterized in that, include: The first receiving unit is used to receive the first data packet broadcast by the second electronic device; The first data packet carries the device identification information of the second electronic device; The first processing unit is configured to determine the target device based on the device information of the second electronic device; The first processing unit is further configured to acquire login information of the target network, and broadcast a second data packet to the target device based on the device identification information of the target device and the login information of the target network; the second data packet includes the device information of the target device and the login information of the target network; The first processing unit is further configured to, before broadcasting the second data packet to the target device based on the device information of the target device and the login information of the target network, establish a connection with the target device based on the device identification information of the target device, and send a start scan command to the target device through the connection, wherein the start scan command is used to instruct the target device to enter the scanning state.
28. A power distribution network device, characterized in that, include: A broadcast unit is used to broadcast a first data packet to a first electronic device; The first data packet carries device information of the target device; The device information includes device identification information; The second processing unit is used to acquire the second data packet broadcast by the first electronic device, the second data packet including device information and login information of the target network; The second processing unit is further configured to, when the device information in the second data packet is the device information of the target device, obtain the login information of the target network contained in the second data packet, and access the target network based on the login information of the target network; The second processing unit is further configured to establish a connection with the first electronic device before acquiring the second data packet broadcast by the first electronic device, receive a start scan command sent by the first electronic device through the connection, and enter a scanning state in response to the start scan command.
29. An electronic device, characterized in that, It includes a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to perform the method according to any one of claims 1-18, or to perform the method according to any one of claims 19-26.
30. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the method according to any one of claims 1-18, or to perform the method according to any one of claims 19-26.