Automatic relay method and device, storage medium and WiFi relay equipment
By automatically detecting and connecting to wireless networks and automatically updating the relay depth value based on network quality parameters, the complex configuration of relay equipment is solved, and automated configuration and efficient network expansion are realized.
Patent Information
- Application Number
- CN202510099358.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-01-22
AI Technical Summary
In the existing wireless LAN technology, the configuration process of relay devices is complicated and requires users to complete it manually, which increases the difficulty of operation and may cause the device to fail to work properly or cause interference to the entire network.
An automatic relay method and device is provided, which simplifies the configuration process by detecting wired network connections, automatically selecting a working mode, scanning surrounding APs or relay devices, and automatically connecting and updating relay depth values based on network quality parameters.
The automatic configuration and deployment of relay equipment is realized, and the requirements of user professional knowledge are reduced, ensuring that relay equipment can expand network coverage stably and efficiently, enhance signal strength, and improve communication quality.
Smart Images

Figure CN119946767A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of wireless communications, and in particular to an automatic relay method, device, storage medium and WiFi relay equipment. Background Art
[0002] As wireless local area network (WLAN) technology becomes increasingly popular, wireless access points (APs) are an important part of network infrastructure, serving as a bridge between wireless stations (STAs) and wired networks or other wireless networks. However, in actual deployment and application, the performance of APs and the communication quality between APs and STAs are often affected by a variety of factors.
[0003] A significant problem is that the AP may be blocked by physical obstacles or its own transmission power is low, resulting in limited signal coverage, making it impossible for STAs in certain locations to establish a stable and reliable connection with the AP. This situation not only affects the efficiency and quality of data transmission between STAs and APs, but may also further hinder data transmission between different STAs communicating through the AP, seriously affecting the overall performance of the wireless network and user experience.
[0004] In order to solve the above problems, a common approach in the prior art is to introduce relay devices. Relay devices can receive wireless signals from APs or STAs, amplify them, and then forward them to the target device, thereby effectively expanding the coverage of the wireless network, enhancing signal strength, and improving communication quality. However, to realize this function of the relay device, a series of complex network parameter configurations are required, including but not limited to working frequency bands, channel selection, encryption methods, network authentication information, etc.
[0005] Currently, most of the configuration of these network parameters needs to be done manually by users, and users are required to have certain wireless network professional knowledge and operation skills. This is undoubtedly a huge challenge for ordinary users, which not only increases the difficulty and complexity of operation, but also may cause the relay equipment to fail to work properly due to improper configuration, and even cause interference or security risks to the entire wireless network.
[0006] Therefore, how to simplify the configuration process of relay equipment, reduce the requirements for user professional knowledge, and at the same time ensure that the relay equipment can stably and efficiently realize its functions of expanding network coverage and enhancing signal strength has become a technical problem that needs to be urgently solved in the current field of wireless LAN technology. Summary of the invention
[0007] The automatic relay method, device, storage medium and WiFi relay device provided in the embodiments of the present application can solve the problem that the relay device in the related art needs to be manually configured and the configuration is difficult. The technical solution is as follows:
[0008] In a first aspect, an embodiment of the present application provides an automatic relay method, the method comprising:
[0009] After the first WiFi relay device is powered on, the STA function and the AP function are started at the same time, and the relay depth value relaydeep is initialized to 0;
[0010] The first WiFi relay device detects whether it is connected to a wired network via a network cable;
[0011] If yes, update the relay depth value of the first WiFi relay device to 1, and broadcast the relay information of the first WiFi relay device to the outside through beacon frames and scan response frames, where the relay information includes the relay depth value and the network quality parameter value; the WiFi relay device with a relay depth value equal to 1 is the root node;
[0012] If not, scan the surrounding APs to obtain an AP list, select an AP with the best network quality from the AP list for connection; after successfully connecting to the selected AP, update the relay depth value of the first WiFi relay device to 1; or the first WiFi relay device scans the surrounding WiFi relay devices to obtain a relay device list; select an upper-level WiFi relay device with a relay depth value greater than 0 and the best network quality from the relay device list, and send a connection request frame carrying the relay information of the first WiFi relay device to the upper-level WiFi relay device; when the first WiFi relay device receives a connection permission frame returned from the upper-level WiFi relay device based on the connection request frame, the first WiFi relay device updates its own relay depth value to the relay depth value of the upper-level WiFi relay device + 1;
[0013] The first WiFi relay device receives a connection request frame from a second WiFi relay device, the connection request frame carrying relay information of the second WiFi relay device, and sends the relay information of the first WiFi relay device to the outside through a beacon frame and a scan response frame;
[0014] After parsing the received connection request frame, the relay information of the second WiFi relay device is obtained, and according to the network quality parameter in the parsed relay information, whether to allow access of the second WiFi relay device is allowed, if yes, a connection permission frame is sent to the second WiFi relay device, so that the second WiFi relay device updates its own relay depth value to the relay depth value of the first WiFi relay device + 1 based on the received connection permission frame;
[0015] When the first WiFi relay device detects a disconnection, it resets its own relay depth value to 0, disconnects all lower-level relay WiFi devices, and maintains the connection of all STAs to avoid forming a relay loop.
[0016] In a second aspect, an embodiment of the present application provides an automatic relay device, the automatic relay device comprising:
[0017] The startup unit is used to start the STA function and the AP function at the same time after the power is turned on, and to initialize the relay depth value relaydeep to 0;
[0018] A detection unit, used for detecting whether a wired network is connected via a network cable;
[0019] a wired connection unit, configured to, if yes, update the relay depth value of the first WiFi relay device to 1, and broadcast the relay information of the first WiFi relay device to the outside through a beacon frame and a scan response frame, wherein the relay information includes the relay depth value and the network quality parameter value; the WiFi relay device with a relay depth value equal to 1 is a root node;
[0020] A wireless connection unit, configured to, if the answer is no, scan the surrounding APs to obtain an AP list, select an AP with the best network quality from the AP list for connection; after successfully connecting to the selected AP, update the relay depth value of the first WiFi relay device to 1; or scan the surrounding WiFi relay devices to obtain a relay device list; select an upper-level WiFi relay device with a relay depth value greater than 0 and the best network quality from the relay device list, and send a connection request frame carrying the relay information of the first WiFi relay device to the upper-level WiFi relay device; when receiving a connection permission frame returned by the upper-level WiFi relay device based on the connection request frame, update the relay depth value of the upper-level WiFi relay device to the relay depth value of the upper-level WiFi relay device + 1;
[0021] a transceiver unit, configured to receive a connection request frame from a second WiFi relay device, the connection request frame carrying relay information of the second WiFi relay device, and to send the relay information of the first WiFi relay device to the outside through a beacon frame and a scan response frame;
[0022] an access control unit, configured to parse the received connection request frame to obtain relay information of the second WiFi relay device, determine whether to allow access of the second WiFi relay device according to the network quality parameter in the parsed relay information, and if yes, send a connection permission frame to the second WiFi relay device, so that the second WiFi relay device updates its own relay depth value to the relay depth value of the first WiFi relay device + 1 based on the received connection permission frame;
[0023] The disconnection processing unit is used to reset its own relay depth value to 0 when detecting a disconnection, disconnect all lower-level relay WiFi devices, and maintain the connection of all STAs to avoid forming a relay loop.
[0024] In a fourth aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
[0025] In a fifth aspect, an embodiment of the present application provides a WiFi relay device, which may include: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.
[0026] The beneficial effects brought about by the technical solutions provided by some embodiments of the present application include at least:
[0027] Automatic relay configuration and deployment: After the relay device is powered on, it automatically starts the STA and AP functions, and intelligently selects the working mode based on whether it is connected to a wired network via a network cable. If it is connected to a wired network, it broadcasts its relay information as a root node (relay depth value is 1); if there is no network cable connection, it automatically scans and connects to the best AP or upper-level relay device, and automatically updates the relay depth value based on the connection status. This process does not require manual configuration by the user, greatly simplifying the deployment process of the relay device.
[0028] Dynamic network quality assessment and selection: When selecting the AP or upper relay device to connect to, the relay device makes the best choice based on network quality parameters (such as signal strength, delay, etc.) to ensure the stability and efficiency of the relay link. At the same time, when the relay device receives a connection request from a lower relay device, it also determines whether to allow access based on network quality parameters, further ensuring the performance of the entire relay network.
[0029] Avoiding relay loops and disconnection processing: A disconnection detection mechanism is designed in the technical solution. When a relay device detects a disconnection, it resets the relay depth value and disconnects all lower-level relay devices, but keeps the STA connected, effectively avoiding the formation of relay loops while ensuring that the STA's basic network connection is not affected.
[0030] Scalability and flexibility: This technical solution allows relay devices to be connected in a hierarchical manner. Each relay device can automatically adjust its role (root node, intermediate node or leaf node) according to the current network environment. This dynamic adjustment mechanism makes the relay network have good scalability and flexibility, and can adapt to wireless network environments of different scales and complexities. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 is an architecture diagram of a WiFi wireless communication system provided in an embodiment of the present application;
[0033] Figure 2 It is an interactive schematic diagram of an automatic relay method provided in an embodiment of the present application;
[0034] Figure 3 It is a structural schematic diagram of an automatic relay device provided by the present application;
[0035] Figure 4 This is another structural schematic diagram of a WiFi relay device provided by this application. DETAILED DESCRIPTION
[0036] In order to make the objectives, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0037] refer to Figure 1 , Figure 1 The wireless fidelity communication system includes: a wireless station 10, a WiFi relay device 11, a WiFi relay device 13, a wireless access point 12 and a wireless station 14. The above devices communicate with each other through the wireless WiFi protocol.
[0038] The WiFi relay device 11 and the WiFi relay device 13 have the functions of both STA and AP. A non-root node WiFi relay device can be connected to one or more subordinate WiFi relay devices, and can also be connected to a STA.
[0039] Among them, the wireless station in the embodiment of the present application can be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a notebook, a desktop computing device, etc.
[0040] The following will be combined with the attached Figure 2 , the automatic relay method provided in the embodiment of the present application is described in detail. Among them, the automatic relay method in the embodiment of the present application can be Figure 1 Sites in .
[0041] See also Figure 2 , is a flow chart of an automatic relay method provided in an embodiment of the present application. The method of the present application may include the following steps:
[0042] S201: After the first WiFi relay device is powered on, the STA function and the AP function are started at the same time, and the relay depth value relay deep is initialized to 0.
[0043] After the first WiFi relay device is powered on, it first performs hardware and software initialization operations. Hardware initialization may include checking network interfaces (wired and wireless), power status, etc.; software initialization involves loading the operating system, driver, and WiFi relay-related applications.
[0044] After initialization is complete, the device starts both the STA function and the AP function. The STA function allows the device to scan and attempt to connect to surrounding WiFi networks as a client, while the AP function enables the device to act as a hotspot and provide WiFi signals for other devices to connect. Starting these two functions usually involves configuring network interface parameters (such as SSID, password), starting network monitoring services, etc.
[0045] In addition, the device also initializes an internal variable called "relay depth" to 0. This variable is used to identify the hierarchical position of the device in the entire WiFi relay network. A relay depth value of 0 means that the device has not yet been connected to any upper-level relay device or wired network and is an independent node.
[0046] S202: The first WiFi relay device detects whether it is connected to a wired network via a network cable.
[0047] Among them, the device detects a wired network connection by checking the physical connection status of the network interface and attempting to communicate through a wired network protocol (such as Ethernet). The physical connection status can be obtained by reading the status register of the network interface, and the communication attempt may involve sending and receiving test packets.
[0048] If the device detects that a wired network connection exists and is stable, it will proceed to the next step S203; otherwise, it will execute step S204 to try a wireless connection.
[0049] Furthermore, the first WiFi relay device detects the physical connection status by reading the status register of the network interface (such as the Ethernet interface). These status registers usually contain information about the connection status of the network interface, such as whether the link is established, the connection speed, the duplex mode, etc. Or the first WiFi relay device may also determine whether the network cable is connected and whether the connection is stable by detecting physical layer signals (such as voltage, current, etc.). For example, the Ethernet interface will detect a specific voltage change when the connection is established, thereby confirming the existence of the physical connection.
[0050] S203. If yes, update the relay depth value of the first WiFi relay device to 1, and broadcast the relay information of the first WiFi relay device to the outside through the beacon frame and the scan response frame, where the relay information includes the relay depth value and the network quality parameter value; the WiFi relay device with a relay depth value equal to 1 is the root node.
[0051] Once the device detects a wired network connection, it will do the following:
[0052] Update the relay depth value to 1, indicating that the device is now the root node (i.e. the starting point of the entire relay network).
[0053] Generate a relay information packet containing relay depth value and network quality parameter values (such as signal strength, link delay, etc.). These parameters can be obtained through network diagnostic tools or protocols.
[0054] The relay information is broadcasted by sending beacon frames and probe response frames. Beacon frames are sent periodically to inform surrounding devices of the existence of the hotspot; the probe response frame is sent when the device receives a probe request frame.
[0055] S204, if not, scan the surrounding APs to obtain an AP list, select an AP with the best network quality in the AP list for connection; after successfully connecting to the selected AP, update the relay depth value of the first WiFi relay device to 1; or the first WiFi relay device scans the surrounding WiFi relay devices to obtain a relay device list; selects a superior WiFi relay device with a relay depth value greater than 0 and the best network quality in the relay device list, and sends a connection request frame carrying the relay information of the first WiFi relay device to the superior WiFi relay device; when the first WiFi relay device receives a connection permission frame returned from the superior WiFi relay device based on the connection request frame, the first WiFi relay device updates its own relay depth value to the relay depth value of the superior WiFi relay device + 1; and sends the relay information of the first WiFi relay device to the outside through a beacon frame and a scan response frame.
[0056] If the device does not detect a wired network connection, it will perform one of the following steps to try a wireless connection:
[0057] 1. Scan and connect to the best AP:
[0058] The device starts the wireless scanning function, scans the surrounding APs and generates an AP list.
[0059] Sort the AP list based on network quality parameters such as signal strength, stability, support for required security protocols, etc.
[0060] Select an optimal AP and try to connect using the configured SSID and password.
[0061] If the connection is successful, the device updates the relay depth value to 1 and prepares to broadcast its relay information (if configured to allow relaying).
[0062] 2. Scan and connect to the best upper relay device:
[0063] If the device is configured to support relay-to-relay connections, it will start the wireless scanning function to scan for surrounding WiFi relay devices and generate a list of relay devices.
[0064] Sort the relay device list according to the relay depth value and network quality parameters. Note that to avoid relay link loops, the device may select a device with a relay depth value greater than 0 that is not its own as the upper relay.
[0065] Select an optimal upper relay device and send a connection request frame carrying its own relay information to it. The connection request frame may contain the device's SSID, password (if required by the upper relay), relay depth value, network quality parameters and other information.
[0066] Wait for the response from the upper relay device. If a connection permission frame is received, the device updates its own relay depth value to the relay depth value of the upper relay device plus 1, and starts broadcasting its own relay information (if configured to allow relaying).
[0067] For example: The first WiFi relay device does not detect a wired network connection, so it starts scanning the surrounding APs and relay devices. It finds two APs (AP1 and AP2) and one relay device (Relay-A). Based on signal strength and stability, it chooses to connect to AP1 (signal strength -65dBm, high stability). After the connection is successful, it updates the relay depth value to 1 and prepares to broadcast its relay information.
[0068] In another case, if the first WiFi relay device is configured to support relay-to-relay connections and finds that Relay-A is a better choice (relay depth value is 1, signal strength -60dBm), it will send a connection request frame to Relay-A. After receiving the connection permission frame from Relay-A, it will update its own relay depth value to 2 (Relay-A's relay depth value 1 plus 1) and start broadcasting its own relay information.
[0069] S205. The first WiFi relay device receives a connection request frame from the second WiFi relay device, where the connection request frame carries relay information of the second WiFi relay device.
[0070] As an AP or relay device, the first WiFi relay device can receive connection request frames from other WiFi relay devices (such as the second WiFi relay device). These request frames usually contain information such as the SSID, password (if applicable), relay depth value, network quality parameters, etc. of the relay device requesting connection.
[0071] The device first verifies the legitimacy of the connection request frame (such as checking whether the SSID and password match). If it is legitimate, it will proceed to the next step; otherwise, it will ignore the request frame.
[0072] S206. After parsing the received connection request frame, obtain relay information of the second WiFi relay device, determine whether to allow access of the second WiFi relay device according to the network quality parameter in the parsed relay information, and if yes, send a connection permission frame to the second WiFi relay device, so that the second WiFi relay device updates its own relay depth value to the relay depth value of the first WiFi relay device + 1 based on the received connection permission frame.
[0073] The device parses the received connection request frame and obtains the relay information of the second WiFi relay device (including relay depth value and network quality parameters, etc.). Then, it decides whether to allow the second WiFi relay device to access based on this information as well as its own configuration and network status.
[0074] The decision-making process may involve factors such as:
[0075] Relay depth limit: The device may be configured with a maximum relay depth value. If the relay depth value of the second WiFi relay device plus its own relay depth value exceeds this limit, the device will reject the access request.
[0076] Network quality: The device may evaluate the feasibility of the connection based on the network quality parameters of the second WiFi relay device (such as signal strength, stability, etc.). If the network quality is poor, the device may reject the access request or require the second WiFi relay device to adjust its transmission power or position.
[0077] Avoid loopback: The device needs to check whether the second WiFi relay device is already its subordinate device or whether it will cause a loopback in the relay link. If so, the device will reject the access request.
[0078] If the device decides to allow access, it will send a connection permission frame to the second WiFi relay device, which may contain some additional configuration information (such as the specified channel, transmit power, etc.). At the same time, it instructs the second WiFi relay device to update its own relay depth value to the device's relay depth value plus 1.
[0079] The first WiFi relay device needs to regularly detect the connection status with the upper relay device or the wired network, which can be achieved by sending heartbeat packets, monitoring the network interface status, or checking the routing table.
[0080] If the device detects a disconnection (i.e., a line break), it will do the following: Reset its own relay depth value to 0, indicating that it is no longer a relay node. Disconnect all lower-level relay WiFi devices. This can be achieved by sending a disconnect command or stopping broadcasting relay information. Note that in order to avoid affecting the STA's connection, the device may need to first notify the lower-level relay devices that they need to handle the disconnection operation themselves. Keep all STA connections unchanged. This means that the device will continue to provide services to STAs as an AP, even if it is no longer a relay node.
[0081] It should be noted that the first WiFi relay device can try to re-establish the connection with the upper relay device or the wired network. If successful, it will update the relay depth value and restore the relay function.
[0082] In summary, the beneficial effects of implementing the embodiments of the present application include:
[0083] Automatic relay configuration and deployment: After the relay device is powered on, it automatically starts the STA and AP functions, and intelligently selects the working mode based on whether it is connected to a wired network via a network cable. If it is connected to a wired network, it broadcasts its relay information as a root node (relay depth value is 1); if there is no network cable connection, it automatically scans and connects to the best AP or upper-level relay device, and automatically updates the relay depth value based on the connection status. This process does not require manual configuration by the user, greatly simplifying the deployment process of the relay device.
[0084] Dynamic network quality assessment and selection: When selecting the AP or upper relay device to connect to, the relay device makes the best choice based on network quality parameters (such as signal strength, delay, etc.) to ensure the stability and efficiency of the relay link. At the same time, when the relay device receives a connection request from a lower relay device, it also determines whether to allow access based on network quality parameters, further ensuring the performance of the entire relay network.
[0085] Avoiding relay loops and disconnection processing: A disconnection detection mechanism is designed in the technical solution. When a relay device detects a disconnection, it resets the relay depth value and disconnects all lower-level relay devices, but keeps the STA connected, effectively avoiding the formation of relay loops while ensuring that the STA's basic network connection is not affected.
[0086] Scalability and flexibility: This technical solution allows relay devices to be connected in a hierarchical manner. Each relay device can automatically adjust its role (root node, intermediate node or leaf node) according to the current network environment. This dynamic adjustment mechanism makes the relay network have good scalability and flexibility, and can adapt to wireless network environments of different scales and complexities.
[0087] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0088] See also Figure 3 , which shows a schematic diagram of the structure of an automatic relay device provided by an exemplary embodiment of the present application. The device can be implemented as all or part of the terminal through software, hardware or a combination of both. The automatic relay device 3 (referred to as device 3) includes: a starting unit 301, a detection unit 302, a wired connection unit 303, a wireless connection unit 304, a transceiver unit 305, an access control unit 306 and a disconnection processing unit 307.
[0089] The startup unit 301 is used to start the STA function and the AP function at the same time after the power is turned on, and to initialize the relay depth value relaydeep to 0;
[0090] A detection unit 302 is used to detect whether a wired network is connected via a network cable;
[0091] The wired connection unit 303 is configured to update the relay depth value of the first WiFi relay device to 1 if the answer is yes, and broadcast the relay information of the first WiFi relay device to the outside through a beacon frame and a scan response frame, wherein the relay information includes the relay depth value and the network quality parameter value; the WiFi relay device with a relay depth value equal to 1 is a root node;
[0092] The wireless connection unit 304 is configured to, if the answer is no, scan the surrounding APs to obtain an AP list, select an AP with the best network quality from the AP list for connection; after successfully connecting to the selected AP, update the relay depth value of the first WiFi relay device to 1; or scan the surrounding WiFi relay devices to obtain a relay device list; select an upper-level WiFi relay device with a relay depth value greater than 0 and the best network quality from the relay device list, and send a connection request frame carrying the relay information of the first WiFi relay device to the upper-level WiFi relay device; when receiving a connection permission frame returned by the upper-level WiFi relay device based on the connection request frame, update the relay depth value of the upper-level WiFi relay device to the relay depth value of the upper-level WiFi relay device + 1;
[0093] The transceiver unit 305 is configured to receive a connection request frame from a second WiFi relay device, the connection request frame carrying relay information of the second WiFi relay device, and to send the relay information of the first WiFi relay device to the outside through a beacon frame and a scan response frame;
[0094] The access control unit 306 is configured to parse the received connection request frame to obtain relay information of the second WiFi relay device, determine whether to allow access of the second WiFi relay device according to the network quality parameter in the parsed relay information, and if yes, send a connection permission frame to the second WiFi relay device, so that the second WiFi relay device updates its own relay depth value to the relay depth value of the first WiFi relay device + 1 based on the received connection permission frame;
[0095] The disconnection processing unit 307 is used to reset its own relay depth value to 0 when a disconnection is detected, disconnect all lower-level relay WiFi devices, and maintain the connection of all STAs to avoid forming a relay loop.
[0096] In a possible implementation manner, the first WiFi relay device detects whether it is connected to a wired network through a network cable, including:
[0097] Whether the network is connected to a wired network through a network cable can be determined by reading the status register of the network interface or by detecting the physical layer signal.
[0098] In a possible implementation manner, the network quality parameter value includes: signal strength and link delay.
[0099] It should be noted that, when the device 3 provided in the above embodiment executes the automatic relay method, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the touch operation response device provided in the above embodiment and the touch operation response method embodiment belong to the same concept, and the implementation process thereof is detailed in the method embodiment, which will not be repeated here.
[0100] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0101] The present application also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded and executed by a processor as described above. Figure 2 The method steps of the embodiment shown in the figure can be found in the specific implementation process. Figure 2 The specific description of the illustrated embodiment will not be repeated here.
[0102] The present application also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the automatic relay method described in the above embodiments.
[0103] See also Figure 4 , is a schematic diagram of the structure of a WiFi relay device provided in an embodiment of the present application. Figure 4 As shown, the WiFi relay device 400 may include: at least one processor 401 , a communication interface 403 , a memory 404 , and at least one communication bus 402 .
[0104] The communication bus 402 is used to realize the connection and communication between these components.
[0105] The communication interface 403 includes a WiFi interface, which can be used for data packets of the WiFi protocol.
[0106] The processor 401 may include one or more processing cores. The processor 401 uses various interfaces and lines to connect various parts of the entire terminal 400, and executes various functions of the terminal 400 and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 404, and calling data stored in the memory 404.
[0107] Among them, the memory 404 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 404 includes a non-transitory computer-readable storage medium. The memory 404 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 404 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 404 may also be optionally at least one storage device located away from the aforementioned processor 401. As Figure 4 As shown, the memory 404 as a computer storage medium may include an operating system, a network communication module, and an application program.
[0108] exist Figure 4 In the WiFi relay device 400 shown in FIG. 1 , the processor 401 can be used to call the application stored in the memory 404 and specifically execute the following steps: Figure 2 The specific process can be referred to Figure 2 As shown, no further description is given here.
[0109] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0110] What is disclosed above is only a preferred embodiment of the present application, and it certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made according to the claims of the present application are still within the scope of the invention.
Claims
1. An automatic relay method, characterized in that: The method comprises: After the first WiFi relay device is powered on, the STA function and the AP function are started at the same time, and the relay depth value relay deep is initialized to 0; The first WiFi relay device detects whether it is connected to a wired network via a network cable; If yes, update the relay depth value of the first WiFi relay device to 1, and broadcast the relay information of the first WiFi relay device to the outside through beacon frames and scan response frames, where the relay information includes the relay depth value and the network quality parameter value; the WiFi relay device with a relay depth value equal to 1 is the root node; If not, scan the surrounding APs to obtain an AP list, select an AP with the best network quality from the AP list for connection; after successfully connecting to the selected AP, update the relay depth value of the first WiFi relay device to 1; or the first WiFi relay device scans the surrounding WiFi relay devices to obtain a relay device list; select an upper-level WiFi relay device with a relay depth value greater than 0 and the best network quality from the relay device list, and send a connection request frame carrying the relay information of the first WiFi relay device to the upper-level WiFi relay device; when the first WiFi relay device receives a connection permission frame returned from the upper-level WiFi relay device based on the connection request frame, the first WiFi relay device updates its own relay depth value to the relay depth value of the upper-level WiFi relay device + 1; The first WiFi relay device receives a connection request frame from a second WiFi relay device, the connection request frame carrying relay information of the second WiFi relay device, and sends the relay information of the first WiFi relay device to the outside through a beacon frame and a scan response frame; After parsing the received connection request frame, the relay information of the second WiFi relay device is obtained, and according to the network quality parameter in the parsed relay information, whether to allow access of the second WiFi relay device is allowed, if yes, a connection permission frame is sent to the second WiFi relay device, so that the second WiFi relay device updates its own relay depth value to the relay depth value of the first WiFi relay device + 1 based on the received connection permission frame; When the first WiFi relay device detects a disconnection, it resets its own relay depth value to 0, disconnects all lower-level relay WiFi devices, and maintains the connection of all STAs to avoid forming a relay loop.
2. The method according to claim 1, characterized in that The first WiFi relay device detects whether it is connected to a wired network through a network cable, including: Whether the network is connected to a wired network through a network cable can be determined by reading the status register of the network interface or by detecting the physical layer signal.
3. The method according to claim 1 or 2, characterized in that: Network quality parameter values include: signal strength and link delay.
4. An automatic relay device, characterized in that: include: The startup unit is used to start the STA function and AP function at the same time after powering on, and to initialize the relay depth value to 0; A detection unit, used for detecting whether a wired network is connected via a network cable; a wired connection unit, configured to, if yes, update the relay depth value of the first WiFi relay device to 1, and broadcast the relay information of the first WiFi relay device to the outside through a beacon frame and a scan response frame, wherein the relay information includes the relay depth value and the network quality parameter value; the WiFi relay device with a relay depth value equal to 1 is a root node; A wireless connection unit, configured to, if the answer is no, scan surrounding APs to obtain an AP list, and select an AP with the best network quality from the AP list for connection; After successfully connecting to the selected AP, the relay depth value of the first WiFi relay device is updated to 1; or a relay device list is obtained after scanning the surrounding WiFi relay devices; a superior WiFi relay device with a relay depth value greater than 0 and the best network quality is selected from the relay device list, and a connection request frame carrying the relay information of the first WiFi relay device is sent to the superior WiFi relay device; when receiving a connection permission frame returned by the superior WiFi relay device based on the connection request frame, the relay depth value of the own is updated to the relay depth value of the superior WiFi relay device + 1; a transceiver unit, configured to receive a connection request frame from a second WiFi relay device, the connection request frame carrying relay information of the second WiFi relay device, and to send the relay information of the first WiFi relay device to the outside through a beacon frame and a scan response frame; an access control unit, configured to parse the received connection request frame to obtain relay information of the second WiFi relay device, determine whether to allow access of the second WiFi relay device according to the network quality parameter in the parsed relay information, and if yes, send a connection permission frame to the second WiFi relay device, so that the second WiFi relay device updates its own relay depth value to the relay depth value of the first WiFi relay device + 1 based on the received connection permission frame; The disconnection processing unit is used to reset its own relay depth value to 0 when detecting a disconnection, disconnect all lower-level relay WiFi devices, and maintain the connection of all STAs to avoid forming a relay loop.
5. A computer storage medium, characterized in that: The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 3.
6. A WiFi relay device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps as claimed in any one of claims 1 to 3.
Citation Information
Patent Citations
Ad hoc network method and device based on WiFi, storage medium and wireless node
CN113179509A
Data transmission method, data acquiring method, and electronic device
US20150237660A1