Network exception processing method, electronic equipment and computer readable storage medium
The listener detects and cuts off the network connection between the access control equipment and the third-party platform, solves the problem of long wait time caused by network exceptions, improves the user experience, and ensures data integrity through cache processing.
Patent Information
- Application Number
- CN202411219174.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-13
AI Technical Summary
When a network abnormality occurs in access control equipment or third-party platforms, the user waits for a long time and experiences poorly. The existing technology can only rely on the timeout hang-up mechanism to handle it.
Through the listener, detect the network intercom connection between the access control device and the third-party platform, set up network abnormality detection strategies, such as timed heartbeat and delay time detection, and if an abnormality occurs, the connection will be cut off to achieve rapid hangup.
It greatly saves users' waiting time, improves user experience, and processes delayed queue data by cached databases to ensure that data is not lost after network recovery.
Smart Images

Figure CN119135561A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of mobile communication technology, and in particular to a network exception handling method, an electronic device, and a computer-readable storage medium. Background Art
[0002] At present, the intercom scenario of access control devices calling third parties has been widely used in daily life. When the access control device or the third-party platform encounters a network abnormality, the user can only rely on the timeout hang-up mechanism of the access control device or the third-party platform itself to hang up, resulting in long waiting time and poor experience for users. Summary of the invention
[0003] In order to solve the above technical problems, the present application provides a network exception handling method, an electronic device and a computer-readable storage medium.
[0004] In a first aspect, the present application provides a network anomaly handling method, the method comprising: a listener detects whether a network intercom connection is established between an access control device and a third-party platform; if so, a network anomaly detection strategy is set, and the network intercom process between the access control device and the third-party platform is monitored; when a network anomaly occurs during the network intercom process that satisfies the network anomaly detection strategy, the network intercom connection between the access control device and the third-party platform is cut off by controlling.
[0005] In one implementation, the network intercom connection includes: a video connection and a voice connection.
[0006] In one embodiment, the setting of the network anomaly detection strategy includes: when the listener monitors the third-party platform sending the first video or the first voice to the access control device, setting the output of a timed heartbeat to the third-party platform at every preset interval; if the timed heartbeat is not received and the time interval reaches a first preset duration, it is determined that a network anomaly occurs on the third-party platform, and the third-party platform is controlled to hang up, and the first preset duration is greater than the preset interval of the timed heartbeat.
[0007] In one embodiment, the setting of the network anomaly detection strategy also includes: the listener monitors the second video or the second voice sent by the access control device to the third-party platform; the listener determines whether the delay time of the second video or the delay time of the second voice is greater than a second preset duration; if the delay time is greater than the second preset duration, it is determined that the access control device network is abnormal, and the third-party platform is controlled to hang up.
[0008] In one embodiment, the method further includes: storing voice data or video data corresponding to the first video or the first voice or the second video or the second voice into a cache database to obtain cached intercom video data or cached intercom voice data.
[0009] In one embodiment, the method further includes: after the third-party platform hangs up, deleting the delay queue of the cached intercom video data or the cached intercom voice data.
[0010] In one embodiment, if the timed heartbeat is not received, the process further includes: if the network is restored when the time interval reaches a second preset duration, resetting the delay queue of the cached intercom video or the cached intercom voice, and the second preset duration is greater than the preset interval time of the timed heartbeat and less than the first preset duration.
[0011] In one embodiment, the listener is disposed in a device corresponding to the third-party platform, or the listener is disposed in the access control device, or the listener is disposed in a network relay device between the third-party platform and the access control device.
[0012] In a second aspect, the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is run by the processor, the network exception handling method provided in the first aspect is executed.
[0013] In a third aspect, the present application provides a computer-readable storage medium storing a computer program, which executes the network exception handling method provided in the first aspect when running on a processor.
[0014] The network exception handling method provided in the above application detects whether a network intercom connection is established between the access control device and the third-party platform through a listener; if yes, a network anomaly detection strategy is set, and the network intercom process between the access control device and the third-party platform is monitored; when the network intercom process satisfies the network anomaly detection strategy, a network anomaly occurs, and the network intercom connection between the access control device and the third-party platform is cut off. The present application sets a listener to monitor the network intercom process between the access control device and the third-party platform, determines whether a network anomaly occurs, and if an anomaly occurs, the connection is hung up, thereby realizing a quick hang-up between the access control device and the third-party platform, greatly saving user waiting time and improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are numbered similarly.
[0016] Figure 1 A schematic diagram of a process of a network exception handling method provided in an embodiment of the present application is shown;
[0017] Figure 2 Another schematic diagram of the process of handling network anomalies provided by an embodiment of the present application is shown;
[0018] Figure 3 Another schematic diagram of a process of handling network anomalies provided by an embodiment of the present application is shown;
[0019] Figure 4 Another schematic diagram of a process of handling network anomalies provided in an embodiment of the present application is shown;
[0020] Figure 5 Another schematic diagram of a process of handling network anomalies provided in an embodiment of the present application is shown;
[0021] Figure 6 Another schematic diagram of a process of handling network anomalies provided in an embodiment of the present application is shown;
[0022] Figure 7 A schematic diagram of the structure of a network exception handling system provided in an embodiment of the present application is shown;
[0023] Figure 8 Another structural schematic diagram of the network exception handling system provided by an embodiment of the present application is shown;
[0024] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown.
[0025] Icons: 700-network exception handling system; 701-third-party platform corresponding equipment; 702-access control equipment; 703-monitor; 704-relay equipment; 900-electronic equipment; 901-transceiver; 902-processor; 903-memory. DETAILED DESCRIPTION
[0026] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0027] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0028] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.
[0029] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.
[0030] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0031] Example 1
[0032] This application embodiment provides a method for handling network anomalies. Figure 1 The network exception handling method includes steps S101 to S103.
[0033] Step S110, the monitor detects whether a network intercom connection is established between the access control device and the third-party platform.
[0034] In this embodiment, the listener is a background service listener, and the third-party platform is a third-party applet; the background service listener is responsible for monitoring whether a network intercom connection is established between the access control device and the third-party applet.
[0035] In one implementation, the network intercom connection includes: a video connection and a voice connection.
[0036] It should be noted that during the network intercom connection process, the access control device interacts with the third-party platform, and the interactive data are video data and voice data.
[0037] Step S120: if yes, set a network anomaly detection strategy and monitor the network intercom process between the access control device and the third-party platform.
[0038] In this embodiment, in order to monitor whether there is a network anomaly between the access control device and the third-party platform, a network anomaly detection strategy is set, wherein the network anomaly detection strategy can be the timed heartbeat sent by the third-party platform to the listener during the monitoring intercom process, and / or the delay time of the access control device sending video or voice to the third-party platform. It should be noted that before setting the network anomaly detection strategy, the listener needs to be initialized first, and the effective interval time of the third-party platform heartbeat and the heartbeat failure interval time are set in the listener, wherein the effective heartbeat interval time is used to determine whether there is a network anomaly on the third-party platform, and the heartbeat failure interval time is used to determine whether the third-party platform network is restored. The effective heartbeat interval time can be set to, for example, 3 seconds, and the heartbeat failure interval time can be set to, for example, 10 seconds. The specific setting can be based on the actual situation and is not limited here. It should be noted that the listener provided in this embodiment includes but is not limited to a hardware listener, a software listener, a monitoring plug-in, and a combination of hardware and software listeners.
[0039] In one embodiment, see Figure 2 The setting of the network anomaly detection strategy includes steps S121 to S122.
[0040] Step S121, the monitor monitors the process in which the third-party platform sends the first video or the first voice to the access control device, and sets the monitor to output a timed heartbeat to the third-party platform at a preset interval.
[0041] During the network intercom connection process, if the listener does not receive the timed heartbeat sent by the third-party platform within the first preset time, that is, the heartbeat valid interval, it is determined that a network anomaly occurs on the third-party platform at this time.
[0042] Step S122: If the scheduled heartbeat is not received and the time interval reaches a first preset duration, it is determined that a network abnormality occurs on the third-party platform, and the third-party platform is controlled to hang up. The first preset duration is greater than the preset interval of the scheduled heartbeat.
[0043] Specifically, when it is determined that a network anomaly occurs on the third-party platform, the listener sends a hang-up instruction to the third-party platform through an appropriate communication protocol (such as TCP / IP, UDP, serial port communication, etc.). The instruction contains the identification information of the access control device, the reason for hang-up, a timestamp and other information. After receiving the hang-up instruction, the third-party platform will perform the corresponding hang-up operation according to the content of the instruction, so as to achieve a quick hang-up in the event of an abnormal network interruption of the access control device or the third-party platform, thereby reducing the user's waiting time.
[0044] In one embodiment, see Figure 3 , the setting of network anomaly detection strategy also includes:
[0045] Step S123: the monitor monitors the second video or second voice sent by the access control device to the third-party platform.
[0046] Step S124: The monitor determines whether the delay time of the second video or the delay time of the second voice is greater than a second preset duration.
[0047] Step S125: If the delay time is greater than the second preset time length, it is determined that the access control device network is abnormal, and the third-party platform is controlled to hang up.
[0048] In this embodiment, by comparing the delay time with the second preset time, it is determined whether a network abnormality occurs in the access control device. For example, the second preset time is 3S. During a certain period of time, the access control device sends a video to a third-party platform, and the delay time for the monitor to monitor the video is 5S. At this time, it can be determined that a network abnormality occurs in the access control device, and the monitor controls the third-party platform to hang up.
[0049] In one embodiment, see Figure 4 , before step S130, it also includes:
[0050] Step S140, storing the voice data or video data corresponding to the first video or the first voice or the second video or the second voice into a cache database to obtain cached intercom video data or cached intercom voice data.
[0051] In this embodiment, the cache database can be Redis (Remote Dictionary Server). Redis is a log-type, Key-Value database written in ANSI, C language, supports the network, can be based on memory or persistence, and provides APIs in multiple languages. Video data or voice data is stored in the cache database. When video data or voice data is needed, it can be quickly obtained from the cache database. Especially in high-concurrency scenarios, storing video data and voice data in the cache database can reduce the number of database accesses, and when problems occur in the original database, data can be obtained from the cache database.
[0052] In one embodiment, see Figure 5 , after step S130, further comprising:
[0053] Step S150, after the third-party platform hangs up, the delay queue of the cached intercom video data or the cached intercom voice data is deleted.
[0054] In this embodiment, after the third-party platform hangs up, deleting the delay queue in the cache database can prevent the video data or voice data in the delay queue from continuing to be sent after the network returns to normal, thereby reducing resource usage in the cache database and freeing up storage space.
[0055] In one embodiment, see Figure 6 , after step S130, further comprising:
[0056] Step S160: If the network is restored when the time interval reaches a second preset duration, the delay queue of the cached intercom video or the cached intercom voice is reset, and the second preset duration is greater than the preset interval time of the timed heartbeat and less than the first preset duration.
[0057] During the intercom process, if the listener receives the scheduled heartbeat sent by the third-party platform again within the second preset time, it can be determined that the network has been restored at this time. The cached intercom video or cached intercom voice obtained is equivalent to a thread. For example, if the third-party platform does not recover the network within the heartbeat failure interval, that is, the second preset time, the delay queue should be deleted at this time, and the events in the delay queue will no longer be executed. However, when the third-party platform network is restored and the scheduled heartbeat is received within the heartbeat failure interval, the cached intercom video data or cached intercom voice data is obtained from the cache database and re-entered into the delay queue for sorting. In this way, when the network is abnormal, the data will not be lost. The cached intercom video data or cached intercom voice data is obtained again, and the delay queue is reset to ensure that the data in the delay queue is still processed after the network is restored.
[0058] Step S130, when a network anomaly occurs during the network intercom process that satisfies the network anomaly detection strategy, control is performed to cut off the network intercom connection between the access control device and the third-party platform.
[0059] In this embodiment, a network anomaly detection strategy is set to determine whether the network is abnormal, and when a network anomaly occurs, the access control device and the third-party platform are disconnected in time, thereby avoiding long waiting times and improving the user experience.
[0060] In one embodiment, the listener is disposed in a device corresponding to the third-party platform, or the listener is disposed in the access control device, or the listener is disposed in a network relay device between the third-party platform and the access control device.
[0061] See also Figure 7 , Figure 7A structural schematic diagram of a network exception handling system provided by an embodiment of the present invention is shown, wherein the network exception handling system 700 includes a third-party platform corresponding device 701, a door access control device 702 and a listener 703, wherein the listener 703 can be arranged in the third-party platform corresponding device 701, or in the door access control device 702, and the third-party platform corresponding device 701 is electrically connected to the door access control device 702.
[0062] See also Figure 8 , Figure 8 Another structural schematic diagram of the network exception handling system provided by an embodiment of the present invention is shown, wherein the network exception handling system 700 also includes a relay device 704, and the listener 703 can be set in a third-party platform corresponding device 701, or in a door access control device 702, or in a relay device 704, and the third-party platform corresponding device 701, the relay device 704 and the door access control device 702 are electrically connected in sequence.
[0063] It should be noted that the location of the listener can be determined according to actual needs and is not limited here.
[0064] The network exception handling method provided in this embodiment detects whether a network intercom connection is established between the access control device and the third-party platform through a listener; if so, a network exception detection strategy is set, and the network intercom process between the access control device and the third-party platform is monitored; when the network intercom process satisfies the network exception detection strategy and a network exception occurs, the network intercom connection between the access control device and the third-party platform is controlled to be cut off, thereby realizing a quick disconnection between the access control device and the third-party platform, greatly saving user waiting time, and greatly improving user experience.
[0065] Example 2
[0066] In addition, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the network exception handling method provided in Embodiment 1 is executed.
[0067] For details, see Fig. 9 The electronic device 900 includes: a transceiver 901, a bus interface and a processor 902, wherein the processor 902 is used to monitor whether a network intercom connection is established between the access control device and the third-party platform; if yes, a network anomaly detection strategy is set, and the network intercom process between the access control device and the third-party platform is monitored; when the network intercom process satisfies the network anomaly detection strategy and a network anomaly occurs, the network intercom connection between the access control device and the third-party platform is controlled to be cut off.
[0068] In one implementation, the network intercom connection includes: a video connection and a voice connection.
[0069] In one embodiment, the processor 902 is also used for the listener to monitor the third-party platform sending the first video or the first voice to the access control device, and to set the third-party platform to output a timed heartbeat at a preset interval; if the timed heartbeat is not received and the time interval reaches a first preset duration, it is determined that the third-party platform has a network anomaly, and the third-party platform is controlled to hang up, and the first preset duration is greater than the preset interval of the timed heartbeat. In one embodiment, the processor 902 is also used for the listener to monitor the second video or the second voice sent by the access control device to the third-party platform; the listener determines whether the delay time of the second video or the delay time of the second voice is greater than the second preset duration; if the delay time is greater than the second preset duration, it is determined that the access control device network is abnormal, and the third-party platform is controlled to hang up.
[0070] In one embodiment, the processor 902 is further used to store the voice data or video data corresponding to the first video or the first voice or the second video or the second voice into a cache database to obtain cached intercom video data or cached intercom voice data.
[0071] In one implementation, the processor 902 is further configured to delete a delay queue of the cached intercom video data or the cached intercom voice data after the third-party platform is hung up.
[0072] In one embodiment, the processor 902 is also used to reset the delay queue of the cached intercom video or the cached intercom voice if the network is restored when the time interval reaches a second preset duration, and the second preset duration is greater than the preset interval time of the timed heartbeat and less than the first preset duration.
[0073] In one embodiment, the listener is disposed in a device corresponding to the third-party platform, or the listener is disposed in the access control device, or the listener is disposed in a network relay device between the third-party platform and the access control device.
[0074] In the embodiment of the present application, the electronic device 900 further includes: a memory 903. Fig. 9In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 902 and memory represented by memory 903. The bus architecture may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 901 may be a plurality of components, i.e., including a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium. The processor 902 is responsible for managing the bus architecture and general processing, and the memory 903 may store data used by the processor 902 when performing operations.
[0075] The electronic device 900 provided in the embodiment of the present application can execute the network exception handling method provided in the above method embodiment 1, and will not be described again here to avoid repetition.
[0076] The electronic device provided in this embodiment detects whether a network intercom connection is established between the access control device and the third-party platform through a listener; if so, a network anomaly detection strategy is set, and the network intercom process between the access control device and the third-party platform is monitored; when the network intercom process satisfies the network anomaly detection strategy and a network anomaly occurs, the network intercom connection between the access control device and the third-party platform is controlled to be cut off, thereby realizing a quick disconnection between the access control device and the third-party platform, greatly saving user waiting time, and greatly improving user experience.
[0077] Example 3
[0078] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the network exception handling method provided in Example 1 is implemented.
[0079] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0080] The computer-readable storage medium provided in this embodiment can implement the network exception handling method provided in Embodiment 1, and will not be described again here to avoid repetition.
[0081] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or terminal including the element.
[0082] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0083] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A network exception processing method, characterized in that: The method comprises: The monitor detects whether the access control device has established a network intercom connection with the third-party platform; If the answer is yes, set a network anomaly detection strategy and monitor the network intercom process between the access control device and the third-party platform; When the network intercom process meets the network anomaly detection strategy and a network anomaly occurs, control is performed to cut off the network intercom connection between the access control device and the third-party platform.
2. The network anomaly handling method according to claim 1, characterized in that: The network intercom connection includes: video connection and voice connection.
3. The network anomaly handling method according to claim 2, characterized in that: The setting of the network anomaly detection strategy includes: The monitor monitors the process in which the third-party platform sends the first video or the first voice to the access control device, and sets the third-party platform to output a timed heartbeat at a preset interval; If the scheduled heartbeat is not received and the time interval reaches a first preset duration, it is determined that a network anomaly occurs on the third-party platform, and the third-party platform is controlled to hang up, and the first preset duration is greater than the preset interval of the scheduled heartbeat.
4. The network anomaly handling method according to claim 3, characterized in that: The setting of the network anomaly detection strategy also includes: The monitor monitors the second video or the second voice sent by the access control device to the third-party platform; The monitor determines whether the delay time of the second video or the delay time of the second voice is greater than a second preset duration; If the delay time is greater than the second preset time length, it is determined that the access control device network is abnormal, and the third-party platform is controlled to hang up.
5. The network anomaly handling method according to claim 4, characterized in that: The method further comprises: The voice data or video data corresponding to the first video or the first voice or the second video or the second voice is stored in a cache database to obtain cached intercom video data or cached intercom voice data.
6. The network anomaly handling method according to claim 5, characterized in that: The method further comprises: After the third-party platform hangs up, the delay queue of the cached intercom video data or the cached intercom voice data is deleted.
7. The network anomaly handling method according to claim 6, characterized in that: If the timing heartbeat is not received, the method further includes: If the network is restored when the time interval reaches a second preset duration, the delay queue of the cached intercom video or the cached intercom voice is reset, and the second preset duration is greater than the preset interval of the timed heartbeat and less than the first preset duration.
8. The network anomaly handling method according to claim 1, characterized in that: The listener is arranged in the device corresponding to the third-party platform, or the listener is arranged in the access control device, or the listener is arranged in the network relay device between the third-party platform and the access control device.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the processor runs the computer program, the network exception handling method according to any one of claims 1 to 8 is executed.
10. A computer-readable storage medium, characterized in that: The computer program stores a computer program, and when the computer program is run on a processor, the network exception handling method according to any one of claims 1 to 8 is executed.
