A method for judging network access and withdrawal, a computer device and a computer readable storage medium
By recording and comparing the power-on/off timing and equipment parameters of the controlled devices, the problem of abnormal equipment disconnection from the network was solved, and stable equipment connection and low maintenance costs were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUHAI LTECH TECH
- Filing Date
- 2022-12-21
- Publication Date
- 2026-05-19
AI Technical Summary
In existing technologies, the network entry and exit methods are not stable and reliable enough, resulting in high maintenance costs and poor user experience when equipment is abnormally removed from the network.
By recording the power-on and power-off sequence of the controlled equipment, we can determine its matching with the preset power-on and power-off sequence. Combined with the timeout mechanism and equipment parameter comparison, we can determine whether the equipment needs to be disconnected from the grid or reconnected to the grid, ensuring that the equipment maintains a stable connection when the grid fluctuates.
This reduced the occurrence of abnormal equipment outages, lowered maintenance workload, improved equipment stability and reliability, and enhanced user experience.
Smart Images

Figure CN115835264B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, specifically to a method for determining network access and deactivation, a computer device, and a computer-readable storage medium. Background Technology
[0002] Most communications involve network access and de-networking. In some wireless communication products, such as those based on Bluetooth and Wi-Fi, network access and de-networking management is particularly important. If a product is accidentally accessed or de-networked due to some special circumstances, at best some devices may become uncontrollable, and at worst the control unit may be affected, leading to the paralysis of the entire control system.
[0003] Currently, most grid connection and deactivation methods on the market are based on the configuration process. That is, the system performs grid connection and deactivation operations on each device during the system setup. Once the configuration is completed, it can be put into use. When the device cannot be controlled due to grid fluctuations or other reasons, the corresponding maintenance is performed. The final analysis may conclude that the device has been deactivated. At this time, the grid connection is re-entered. The above solution is not stable and reliable, has high maintenance costs, and has a poor user experience. Summary of the Invention
[0004] The primary objective of this invention is to provide a method for determining network access and deactivation that can ensure stable equipment operation and reduce maintenance costs.
[0005] A second objective of the present invention is to provide a computer device for implementing the above-described method for determining network entry and exit.
[0006] A third objective of this invention is to provide a computer-readable storage medium that implements the above-described network entry / exit determination method during runtime.
[0007] To achieve the aforementioned first objective, the present invention provides a method for determining network access and de-network access, comprising the following steps: recording the current power-on / off sequence of the controlled device, wherein the power-on / off sequence is the sequence of the power-off state and power-on state of the controlled device after accessing the network; determining whether the current power-on / off sequence matches a preset power-on / off sequence, and if so, controlling the controlled device to de-network access; wherein the preset power-on / off sequence includes at least two power-on / off cycles, and the duration of the power-off state and the duration of the power-on state in each power-on / off cycle are preset values.
[0008] As can be seen from the above scheme, the present invention, by pre-setting the power outage sequence, can determine that the controlled device meets the de-grid conditions only when the recorded current power outage sequence of the controlled device matches the pre-set power outage sequence. At this time, the controlled device is controlled to de-grid, thereby avoiding the phenomenon of abnormal de-grid of the controlled device due to grid fluctuations, reducing maintenance workload, and making the overall grid entry and exit scheme more stable and reliable.
[0009] A further solution is to determine whether the controlled device has joined other networks within a preset time period if the current power-on / off sequence matches the preset power-on / off sequence. If so, the controlled device information is deleted.
[0010] Therefore, it can be seen that, based on the above-mentioned preset power-on / off sequence, a timeout mechanism is introduced, which can further determine whether the currently controlled equipment needs to be disconnected from the network.
[0011] A further approach is to determine whether the controlled device has joined another network within a preset time period, including whether a heartbeat packet sent by the controlled device has been received.
[0012] A further solution is to update the network access configuration information to the controlled device if the current power-on / off sequence matches the preset power-on / off sequence and the controlled device has not joined other networks within the preset time.
[0013] This demonstrates that the controlled device can be guaranteed to be in a normal network access state.
[0014] A further option is that the duration of the power outage state in at least one power-on / off cycle is different from the duration of the power outage state in another power-on / off cycle; and / or the duration of the power-on state in at least one power-on / off cycle is different from the duration of the power-on state in another power-on / off cycle.
[0015] Therefore, it is evident that the differences in preset power-on and power-off sequences can be further increased, thereby more accurately determining whether the controlled equipment needs to be disconnected from the network.
[0016] A further approach is to record the preset device parameters of the controlled device before recording the current power-on / off sequence of the controlled device; obtain the current device parameters of the controlled device according to the preset time interval, and determine whether the current device parameters are consistent with the preset device parameters. If not, write the preset device parameters into the controlled device.
[0017] Therefore, it can be seen that when the controlled equipment is affected by interference and its parameters change and cannot be controlled, control over the controlled equipment can still be restored by writing the preset equipment parameters into the controlled equipment.
[0018] A further approach is to preset device parameters including the MAC address and network ID of the preset device.
[0019] To achieve the second objective mentioned above, the present invention provides a computer device, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the above-mentioned network entry / exit determination method.
[0020] To achieve the third objective mentioned above, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-mentioned network entry / exit judgment method when it is executed. Attached Figure Description
[0021] Figure 1 This is a flowchart of an embodiment of the network entry / exit judgment method of the present invention.
[0022] Figure 2 This is a schematic diagram of the preset power-off timing sequence in an embodiment of the grid entry / exit judgment method of the present invention.
[0023] The present invention will be further described below with reference to the accompanying drawings and embodiments. Detailed Implementation
[0024] Example of network entry / exit judgment method:
[0025] Devices typically join a network in two ways: active and passive. Active joining involves adding the device to a specified network through its own logic, while passive joining involves adding the controlled device to a specified network through a master control device.
[0026] Device decommissioning from the network can generally be divided into two types: proactive and reactive. Proactive decommissioning refers to the device directly exiting the current network through a preset process. This process usually does not require external communication intervention and directly deletes the device's relevant information. Reactive decommissioning involves the master device interacting with the controlled device to inform the controlled device to exit the corresponding network.
[0027] This invention addresses the issue of abnormal network disconnection. By implementing power-on / off timing, a timeout mechanism, and periodic queries of preset device parameters, it can detect whether a device has abnormally disconnected from the network, reducing maintenance workload. This embodiment is applied to a master control device and a controlled device based on Bluetooth or Wi-Fi. The master control device controls the controlled device to enter or leave the network controlled by the master control device. For example, the master control device can be a network master controller. In a smart lighting network, the master control device can be a lighting controller or a smartphone, and the controlled devices are the various lighting fixtures connected to the network.
[0028] Specifically, the network entry / exit determination method of this embodiment is implemented through a computer program running on the main control device. See [link to relevant documentation]. Figure 1 First, step S1 is executed to record the network access configuration information and preset device parameters of the controlled device. Specifically, when the controlled device successfully joins the network controlled by the master device, the master device will record the network access configuration information and preset device parameters at this time. The network access configuration information indicates the settings required for the controlled device to successfully connect to the network controlled by the master device. That is, the controlled device sets up according to the network access configuration information so that it can connect to the network controlled by the master device. The preset device parameters are used to indicate the status of the preset device. The master device sends instructions to the controlled device according to the preset device parameters to control the controlled device. The preset device parameters include the MAC address and the network ID. The network ID is the identifier of the network joined by the controlled device.
[0029] Continue with step S2 to record the current power-on / off sequence of the controlled device. Specifically, after the controlled device successfully joins the network controlled by the master device, the master device will continuously record the power-on / off status of the controlled device, i.e., the current power-on / off sequence. The current power-on / off sequence is the sequence of the power-off and power-on states of the controlled device after it joins the network.
[0030] Then, step S3 is executed to determine whether the current power-on / off sequence matches the preset power-on / off sequence. The preset power-on / off sequence includes at least two power-on / off cycles, and the duration of the power-off state and the duration of the power-on state in each power-on / off cycle are preset values. See [link to relevant documentation]. Figure 2 The power-on / off sequence in this embodiment includes six power-on / off cycles. The power-on duration of the first power-on / off cycle can differ from the power-off duration of the second power-on / off cycle. When the controlled device experiences a power outage due to unstable power supply, and then regains power after the supply stabilizes, the controlled device will be removed from the network controlled by the master device, resulting in abnormal network disconnection. In this embodiment, the master device compares the recorded current power-on / off sequence with a preset power-on / off sequence. The current power-on / off sequence of the controlled device must satisfy the following conditions: there are six power-on / off cycles, and the power-off duration and power-on duration of each power-on / off cycle must be the same as the preset power-on / off sequence. Only then will the master device determine that the controlled device meets the network disconnection conditions and needs to be disconnected. In other embodiments, the preset power-on / off sequence may also allow the power-off duration within one power-on / off cycle to differ from the power-off duration within another power-on / off cycle.
[0031] If the result of step S3 is yes, it confirms that the current power-on / off sequence matches the preset power-on / off sequence. This eliminates the possibility of power outages and power-on failures caused by unstable power supply, and determines that the controlled device may need to be de-networked. The controlled device enters a pre-de-networking state, and further confirmation is needed regarding whether it needs to be de-networked. Step S11 is then executed to determine whether the controlled device has joined another network within a preset time. Specifically, the master control device can obtain the status flag bit of the controlled device through the protocol layer. The status flag bit has two states: 0 and 1. 0 indicates that the controlled device has joined another network, and 1 indicates that it has not joined another network. Therefore, the status flag bit can be used to determine whether the controlled device has joined another network. If the status flag bit is damaged and cannot be read due to interference such as static electricity, pulses, or surges, a heartbeat packet can be obtained from the controlled device to confirm whether it has joined another network. In this embodiment, if the controlled device joins another network within 5 minutes after satisfying the preset power-on / off sequence, it is determined that the controlled device needs to be de-networked, and step S12 is executed to control the controlled device to de-network. The master control device deletes the controlled device's information, completing the controlled device's de-networking. If step S11 results in no, meaning the controlled device hasn't joined another network within 5 minutes of meeting the above power-on / off sequence, the controlled device needs to return from the pre-de-networking state to the network-joining state. Specifically, step S21 is executed, where the master control device updates the network-joining configuration information to the controlled device. It should be noted that the pre-de-networking state indicates the controlled device may de-network, but it remains in the network-joining state; in this state, the controlled device is still powered on.
[0032] If the result of step S3 is negative, it is determined that the current power-on sequence does not match the preset power-off sequence. This may be due to unstable power supply or other reasons causing the controlled device to power off and on. In this case, the controlled device does not need to be disconnected from the network, and step S4 is executed.
[0033] Then, step S4 is executed to obtain the current device parameters of the controlled device. The current device parameters also include the network ID and MAC address.
[0034] Then, step S5 is executed to determine whether the current device parameters are consistent with the preset device parameters. When the controlled device is interfered with by factors such as static electricity, pulse, or surge during operation, the preset device parameters will change, causing the master control device to be unable to control the controlled device. Therefore, the master control device obtains the current device parameters of the controlled device according to a preset time interval and determines whether the current device parameters are consistent with the preset device parameters saved when the device successfully joined the network. For example, whether the network ID and / or MAC address are consistent. If they are consistent, it means that the controlled device is operating normally. If any parameter in the preset device parameters is inconsistent, step S6 needs to be executed to write the preset device parameters into the controlled device, thereby ensuring that the controlled device keeps the preset device parameters unchanged.
[0035] Computer device embodiment:
[0036] The computer device in this embodiment includes a processor and a memory. The memory stores a computer program, and when the processor executes the computer program, it implements the various steps of the above-described network entry / exit determination method embodiment.
[0037] A computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that a computer device may include more or fewer components, or a combination of certain components, or different components; for example, a computer device may also include input / output devices, network access devices, buses, etc.
[0038] For example, a processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microcontroller or any conventional processor. The processor is the control center of a computer device, connecting all parts of the computer device through various interfaces and lines.
[0039] The memory can be used to store computer programs and / or modules. The controller implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. For example, the memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (e.g., sound receiving function, sound-to-text function, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (e.g., audio data, text data, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0040] Examples of computer-readable storage media:
[0041] If the modules integrated into the computer device in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes of the network entry / exit determination method embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a controller, it can implement the steps of the above network entry / exit determination method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The storage medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content contained in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0042] In summary, the network entry / exit determination method of the present invention sets a preset power-off sequence, and then determines whether the preset power-off sequence is met by comparing the current power-off sequence of the controlled device with the preset power-off sequence. If the preset power-off sequence is met, it is determined whether the controlled device has joined another network within a preset time, thereby determining whether the controlled device needs to exit the network. During the operation of the controlled device, the current device parameters of the controlled device are also obtained according to a preset time interval. By comparing the current device parameters with the preset device parameters, the stable operation of the controlled device is ensured.
Claims
1. A method for determining network entry / exit, applied to a main control device, characterized in that, Includes the following steps: Record the preset equipment parameters of the controlled equipment; Record the current power-off and power-on sequence of the controlled device, wherein the power-off and power-on sequence is the sequence of the power-off state and the power-on state of the controlled device after it is connected to the network; Determine whether the current power-on / off sequence matches the preset power-on / off sequence; if so, determine whether the controlled device joins another network within a preset time. If the controlled device does not join another network within the preset time, update the network access configuration information to the controlled device; if the controlled device joins another network within the preset time, delete the controlled device information and control the controlled device to leave the network. When the current power-on / off sequence does not match the preset power-on / off sequence, the current device parameters of the controlled device are obtained according to the preset time interval, and it is determined whether the current device parameters are consistent with the preset device parameters. If not, the preset device parameters are written into the controlled device. The preset power-on / off sequence includes at least two power-on / off cycles, and the duration of the power-off state and the duration of the power-on state in each power-on / off cycle are preset values.
2. The network entry / exit determination method as described in claim 1, characterized in that: Determining whether the controlled device joins another network within the preset time period includes determining whether a heartbeat packet sent by the controlled device is received.
3. The method for determining network entry / exit as described in claim 1 or 2, characterized in that: The duration of the power outage state in at least one of the power outage cycles is different from the duration of the power outage state in another power outage cycle; and / or The duration of the power-on state in at least one of the power-off cycles is different from the duration of the power-on state in another power-off cycle.
4. The network entry / exit determination method as described in claim 1, characterized in that: The preset device parameters include the MAC address and network ID of the preset device.
5. A computer device, comprising a processor and a memory, characterized in that: The memory stores a computer program, which, when executed by the processor, implements the network entry / exit determination method according to any one of claims 1 to 4.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program implements the network entry / exit judgment method according to any one of claims 1 to 4 when it runs.