A multi-door lock selected exit selection method and system

By combining device identifiers, router IDs, and transaction IDs, the problem of target determinism in control connections under anycast environments is solved, enabling fast, stable, and reliable transmission of control commands in physical access control systems on IP networks, thereby improving system response efficiency and user experience.

CN121814680BActive Publication Date: 2026-07-10DESSMANN CHINA MACHINERY & ELECTRONICS

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DESSMANN CHINA MACHINERY & ELECTRONICS
Filing Date
2026-03-06
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing technologies in IP network-based physical access control systems lack effective mechanisms to accurately identify and correct routes within anycast groups, which can lead to control connection requests being mistakenly sent to non-target locks, affecting system response efficiency and user experience.

Method used

By establishing an initial connection and obtaining an identifier, verifying and binding the control connection, forwarding messages and correcting incorrect routes, binding paths and transmitting commands, and using a combination of device identifiers, router IDs, and transaction IDs, control commands are ensured to be transmitted along the bound path, achieving fast, stable, and reliable transmission.

Benefits of technology

It enables fast, stable and reliable transmission of control commands from the user to the target door lock, improves the system's response efficiency and control success rate, avoids connection errors caused by routing fluctuations, and improves the stability and response speed of the control connection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121814680B_ABST
    Figure CN121814680B_ABST
Patent Text Reader

Abstract

The application discloses a multi-door lock selection exit selection method and system, and the method comprises the following steps: obtaining the device identifier, router ID and transaction ID of a target door lock according to a service request sent by a user APP to an anycast address; performing identifier comparison by a receiving door lock according to the device identifier carried in a control connection request initiated by the user APP, and triggering message forwarding based on the router ID and the transaction ID if the comparison fails; forwarding the request message to a specified router by an error receiving door lock, so that the correct delivery of the request message is realized; and recording the binding relationship between the transaction ID and the path according to a specific path flag bit in an acknowledgement message returned by a correct door lock, so that the user APP and the routers along the path ensure the transmission of subsequent control instructions along the binding path. By using the embodiment of the application, the fast, stable and reliable transmission of the control instructions from the user to the target door lock can be realized, and the response efficiency and the control success rate of the system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of smart door lock technology, and in particular to a method and system for selecting exits from multiple door locks. Background Technology

[0002] In current IP-based physical access control systems, to achieve remote unlocking, the user terminal (APP) needs to establish a reliable control connection with a specific target lock. However, when using efficient network addressing technologies such as anycast, although the initial request can reach a lock node through the "shortest path" principle, this node may not be the target device the user intends to control. Existing technologies lack an effective mechanism for accurate identification and route correction within anycast groups, causing control connection requests to easily reach non-target locks, leading to verification failures and connection interruptions. This process not only increases system processing latency but also makes the transmission path of subsequent control commands uncertain, making it difficult to guarantee low-latency, high-reliability transmission of control commands in complex network environments, thus affecting the response efficiency and user experience of the entire access control system. Summary of the Invention

[0003] The purpose of this invention is to provide an exit selection method and system for multiple door locks to overcome the shortcomings of the prior art, enabling fast, stable and reliable transmission of control commands from the user to the target door lock, and improving the system's response efficiency and control success rate.

[0004] One embodiment of this application provides an exit selection method with multiple door lock options, the method comprising:

[0005] Initial Connection Establishment and Identifier Acquisition: Based on the service request sent by the user APP to the anycast address, an initial connection is established with the nearest door lock through anycast routing, and the device identifier, router ID, and transaction ID of the target door lock are obtained. The initial connection establishment and identifier acquisition includes: Initial Service Request: Based on the video connection request sent by the user APP to the anycast address, the network routes the request to the door lock with the nearest topology according to the anycast routing policy; Connection Response and Identifier Return: Based on the connection request received by the target door lock, a connection confirmation message containing its own device identifier is generated and returned to the user APP; Path Information Recording: Based on the return message carrying the device identifier detected by the edge router, a unique transaction ID is generated, and a local mapping relationship is established between the device identifier, router ID, transaction ID, and door lock IP address; Information Delivery: Based on the edge router adding the router ID and transaction ID to the return message, it is forwarded to the user APP, enabling the user APP to obtain the device identifier, router ID, and transaction ID of the target door lock.

[0006] Control connection verification and binding: Based on the device identifier carried in the control connection request initiated by the user APP, the receiving door lock compares the identifier. If the match fails, it triggers packet forwarding based on the router ID and transaction ID.

[0007] Message forwarding and error routing correction: The request message is forwarded to the designated router by the incorrectly received door lock. The router queries the associated door lock address based on the transaction ID and reroutes to achieve the correct delivery of the request message. The designated router is the router corresponding to the router ID carried in the request message.

[0008] Path binding and command transmission: Based on the specific path flag in the confirmation message returned by the correct door lock, the user APP and the routers along the route record the binding relationship between the transaction ID and the path, ensuring that subsequent control commands are transmitted along the bound path.

[0009] Optionally, the control connection verification and binding includes:

[0010] Control connection initiation: Based on the PTZ control connection request initiated by the user APP, the destination address of the request is anycast address, and the request message carries the previously obtained device identifier, router ID and transaction ID;

[0011] Initial identifier verification: Depending on the anycast route, the request message may be routed to the target lock or a non-target lock;

[0012] Verification result processing: Based on the result of comparing the device identifier in the received door lock comparison request message with its own identifier: if the identifiers match, the control connection request is processed; if the identifiers do not match, message forwarding is triggered.

[0013] Optionally, the message forwarding and error routing correction includes:

[0014] Message re-encapsulation: Based on the result of the identifier comparison failure, the error receiving lock modifies the destination address of the original request message to the router ID carried in the request message and re-encapsulates it;

[0015] Message forwarded to designated router: Based on the destination address of the re-encapsulated message, the directly connected router that incorrectly received the lock forwards it to the designated router;

[0016] Address translation and rerouting: Based on the packet received by the specified router, the transaction ID is parsed, the local mapping table is queried to obtain the associated target door lock IP address, and the packet destination address is modified to the target door lock IP address before forwarding.

[0017] Optionally, the path binding and instruction transmission include:

[0018] Path binding confirmation: The confirmation message returned after the correct door lock processes the control connection request, which sets a specific path flag and carries the transaction ID;

[0019] Path status recording: Based on the specific path flag and transaction ID in the confirmation message parsed by the routers along the route, create or update the transaction ID table entry locally and record the next-hop path information corresponding to the transaction ID;

[0020] Binding information synchronization: Based on the confirmation message received by the user's APP, the specific path flag and transaction ID are parsed out, and the path binding for the transaction ID is marked locally;

[0021] Binding path transmission: Since subsequent control command messages sent by the user's APP all carry transaction IDs, routers along the route forward them according to the transaction ID entries, and no longer perform anycast routing selection.

[0022] Optionally, the method also includes a path switching mechanism for abnormal situations:

[0023] Fault Detection and Notification: Based on the fault detection results of the links between routers, the router that detects the fault updates its local routing table and sends a path fault notification to the user's APP and door lock;

[0024] Path update request: Based on the path failure notification received by the user APP, send a path update request carrying the original transaction ID and a special path marker to the anycast address;

[0025] Alternate path establishment: After the path update request message is routed through the alternative path, the routers along the way parse the special path marker and transaction ID, and establish a temporary forwarding rule that points to the target door lock through the alternative path;

[0026] Service recovery and rollback: Based on the establishment of temporary forwarding rules, the user's APP service traffic is switched to the backup path for transmission; when the original faulty link is restored, the system smoothly rolls the traffic back to the original path based on the path quality comparison results.

[0027] Another embodiment of this application provides an exit selection system with multiple door lock options, the system comprising:

[0028] The module establishes an initial connection and obtains an identifier: based on the service request sent by the user APP to the anycast address, it establishes an initial connection with the nearest door lock through anycast routing and obtains the target door lock's device identifier, router ID, and transaction ID. The initial connection establishment and identifier acquisition includes: an initial service request: based on the video connection request sent by the user APP to the anycast address, the network routes the request to the door lock with the nearest topology according to the anycast routing policy; a connection response and identifier return: based on the connection request received by the target door lock, it generates a connection confirmation message containing its own device identifier and returns it to the user APP; path information recording: based on the return message carrying the device identifier detected by the edge router, it generates a unique transaction ID and establishes a local mapping relationship between the device identifier, router ID, transaction ID, and door lock IP address; and information delivery: based on the edge router adding the router ID and transaction ID to the return message and forwarding it to the user APP, enabling the user APP to obtain the target door lock's device identifier, router ID, and transaction ID.

[0029] The verification module is used to control connection verification and binding: based on the device identifier carried in the control connection request initiated by the user APP, the receiving door lock compares the identifier. If the match fails, it triggers packet forwarding based on router ID and transaction ID.

[0030] The correction module is used for message forwarding and error routing correction: the incorrectly received door lock forwards the request message to the designated router. The router queries the associated door lock address based on the transaction ID and reroutes the message to ensure the correct delivery of the request message. The designated router is the router corresponding to the router ID carried in the request message.

[0031] The binding module is used for path binding and command transmission: based on the specific path flag in the confirmation message returned by the correct door lock, the user APP and the routers along the way record the binding relationship between the transaction ID and the path, ensuring that subsequent control commands are transmitted along the bound path.

[0032] Another embodiment of this application provides a storage medium storing a computer program, wherein the computer program is configured to execute the method described in any of the preceding claims when running.

[0033] Another embodiment of this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the method described in any of the preceding claims.

[0034] Compared with existing technologies, the present invention provides an exit selection method for multiple door locks. Based on the service request sent by the user APP to the anycast address, an initial connection is established with the nearest door lock through anycast routing, and the device identifier, router ID, and transaction ID of the target door lock are obtained. Based on the device identifier carried in the control connection request initiated by the user APP, the receiving door lock performs identifier comparison. If a match fails, message forwarding based on the router ID and transaction ID is triggered. The incorrectly receiving door lock forwards the request message to the designated router, ensuring correct delivery of the request message. Based on the specific path flag in the confirmation message returned by the correct door lock, the user APP and the routers along the path record the binding relationship between the transaction ID and the path, ensuring that subsequent control commands are transmitted along the bound path. This enables fast, stable, and reliable transmission of control commands from the user to the target door lock, improving system response efficiency and control success rate. Attached Figure Description

[0035] Figure 1 A hardware structure block diagram of a computer terminal for an exit selection method with multiple lock selection provided in an embodiment of the present invention;

[0036] Figure 2 This is a flowchart illustrating an exit selection method for multiple lock selection provided in an embodiment of the present invention;

[0037] Figure 3 This is a schematic diagram of an exit selection system with multiple lock options provided in an embodiment of the present invention. Detailed Implementation

[0038] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0039] In the intelligent management of large venues such as stadiums and airports, a large number of smart lock devices are typically deployed. These locks not only have basic access control functions but also integrate cameras and PTZ control systems, supporting remote video monitoring and PTZ control. Users need to access specific lock devices through a mobile terminal APP to view real-time video and control the PTZ. In traditional solutions, users need to manually select the target lock, which is cumbersome and cannot guarantee optimal connection. While anycast technology can route user requests to the device with the closest topology, it has significant shortcomings in scenarios requiring stateful control connections with specific devices. Due to dynamic changes in network routing, the initially connected lock may not be the same as the specific lock to be controlled later, leading to interruption of the control session. Especially in scenarios requiring continuous and stable connections, such as PTZ control, traditional anycast technology cannot guarantee the accurate delivery of control commands. Therefore, a smart lock selection solution that combines the advantages of anycast technology with stable communication with specific devices is needed.

[0040] Anycast is a network addressing and routing technology that allows multiple different network nodes to use the same IP address. When a user sends a data packet to this anycast address, the network infrastructure automatically routes the packet to the "nearest" node based on calculations by the routing protocol. This "nearest" is typically determined based on metrics such as hop count, link latency, and bandwidth cost.

[0041] This invention first provides an exit selection method with multiple door lock options, which can be applied to electronic devices, such as computer terminals, specifically ordinary computers.

[0042] The following detailed explanation uses a computer terminal as an example. Figure 1 This is a hardware structure block diagram of a computer terminal for an exit selection method with multiple lock selection provided in an embodiment of the present invention. (See diagram below.) Figure 1 As shown, the computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include non-volatile storage media and internal memory.

[0043] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any of the multiple-door lock selection exit methods.

[0044] The processor provides computing and control capabilities, supporting the operation of the entire computer device.

[0045] Internal memory provides an environment for the execution of computer programs in non-volatile storage media. When the computer program is executed by the processor, it enables the processor to perform any exit selection method with multiple lock selection.

[0046] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 1 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0047] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be 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. Among these, a general-purpose processor can be a microprocessor or any conventional processor.

[0048] See Figure 2 The present invention provides an exit selection method for multiple door locks, which may include the following steps:

[0049] S201, Initial Connection Establishment and Identifier Acquisition: Based on the service request sent by the user APP to the anycast address, an initial connection is established with the nearest door lock through anycast routing, and the device identifier, router ID, and transaction ID of the target door lock are obtained; specifically, the initial connection establishment and identifier acquisition includes:

[0050] Initial service request: Based on the video connection request sent by the user's APP to the anycast address, the network routes the request to the door lock with the nearest topology according to the anycast routing policy;

[0051] Connection Response and Identifier Return: Based on the connection request received by the target door lock, generate a connection confirmation message containing its own device identifier and return it to the user APP;

[0052] Path information recording: Based on the return message carrying the device identifier detected by the edge router, a unique transaction ID is generated, and a local mapping relationship is established between the device identifier, router ID, transaction ID, and door lock IP address;

[0053] Information delivery: The edge router adds the router ID and transaction ID to the return message and forwards it to the user APP, so that the user APP can obtain the device identifier, router ID and transaction ID of the target door lock.

[0054] S202, Control Connection Verification and Binding: Based on the device identifier carried in the control connection request initiated by the user APP, the receiving door lock compares the identifier. If the match fails, message forwarding based on the router ID and transaction ID is triggered. Specifically, the control connection verification and binding includes:

[0055] Control connection initiation: Based on the PTZ control connection request initiated by the user APP, the destination address of the request is anycast address, and the request message carries the previously obtained device identifier, router ID and transaction ID;

[0056] Initial identifier verification: Depending on the anycast route, the request message may be routed to the target lock or a non-target lock;

[0057] Verification result processing: Based on the result of comparing the device identifier in the received door lock comparison request message with its own identifier: if the identifiers match, the control connection request is processed; if the identifiers do not match, message forwarding is triggered.

[0058] S203, Message Forwarding and Error Routing Correction: The incorrectly received lock forwards the request message to the designated router. This router queries the associated lock address based on the transaction ID and reroutes the message, thus ensuring correct delivery of the request message. The designated router is the router corresponding to the router ID carried in the request message. Specifically, the message forwarding and error routing correction includes:

[0059] Message re-encapsulation: Based on the result of the identifier comparison failure, the error receiving lock modifies the destination address of the original request message to the router ID carried in the request message and re-encapsulates it;

[0060] Message forwarded to designated router: Based on the destination address of the re-encapsulated message, the directly connected router that incorrectly received the lock forwards it to the designated router;

[0061] Address translation and rerouting: Based on the packet received by the specified router, the transaction ID is parsed, the local mapping table is queried to obtain the associated target door lock IP address, and the packet destination address is modified to the target door lock IP address before forwarding.

[0062] S204, Path Binding and Command Transmission: Based on the specific path flag bit in the confirmation message returned by the correct door lock, the user APP and routers along the path record the binding relationship between the transaction ID and the path, ensuring that subsequent control commands are transmitted along the bound path. Specifically, the path binding and command transmission includes:

[0063] Path binding confirmation: The confirmation message returned after the correct door lock processes the control connection request, which sets a specific path flag and carries the transaction ID;

[0064] Path status recording: Based on the specific path flag and transaction ID in the confirmation message parsed by the routers along the route, create or update the transaction ID table entry locally and record the next-hop path information corresponding to the transaction ID;

[0065] Binding information synchronization: Based on the confirmation message received by the user's APP, the specific path flag and transaction ID are parsed out, and the path binding for the transaction ID is marked locally;

[0066] Binding path transmission: Since subsequent control command messages sent by the user's APP all carry transaction IDs, routers along the route forward them according to the transaction ID entries, and no longer perform anycast routing selection.

[0067] Furthermore, the method also includes a path switching mechanism in abnormal situations:

[0068] Fault Detection and Notification: Based on the fault detection results of the links between routers, the router that detects the fault updates its local routing table and sends a path fault notification to the user's APP and door lock;

[0069] Path update request: Based on the path failure notification received by the user APP, send a path update request carrying the original transaction ID and a special path marker to the anycast address;

[0070] Alternate path establishment: After the path update request message is routed through the alternative path, the routers along the way parse the special path marker and transaction ID, and establish a temporary forwarding rule that points to the target door lock through the alternative path;

[0071] Service recovery and rollback: Based on the establishment of temporary forwarding rules, the user's APP service traffic is switched to the backup path for transmission; when the original faulty link is restored, the system smoothly rolls the traffic back to the original path based on the path quality comparison results.

[0072] This invention provides a multi-lock intelligent selection scheme based on anycast technology and path binding. The core of this scheme lies in solving the target determinism problem of control connections in anycast environments through a device identifier verification mechanism and intelligent forwarding strategy. First, the user's app establishes an initial connection with the nearest lock via the anycast address, obtaining the target lock's device identifier and specific IP address. When a control connection needs to be established, device identifier verification ensures the connection's correctness, and in case of incorrect routing, the specific IP address is used for packet forwarding. Finally, a session path binding mechanism ensures the accurate transmission of subsequent control commands. This scheme maintains the advantages of anycast technology while ensuring the stability and reliability of control connections with specific devices. Core idea:

[0073] 1. The user app sends a packet to router R1 via anycast address IP-0. Based on the cost of the anycast route, it accesses the next-hop router R2 and then sends the packet to door lock A, establishing a video connection with door lock A. Door lock A returns a connection confirmation message to the user app, carrying the device ID of door lock A.

[0074] 2. When router R2 receives the message returned by door lock A to user APP, it detects that the message carries the device ID of door lock. It binds the device ID of door lock, router ID (using the router's loopback interface IP), transaction ID (the router generates a transaction ID based on the IP address of door lock A and the IP address of user APP) and the IP address of door lock A, and adds the router ID and transaction ID to the message.

[0075] 3. The user app receives the message returned by door lock A, obtains the device ID of door lock A, as well as the router ID and transaction ID added from router R2;

[0076] 4. The user app needs to continue to access the PTZ of door lock A (this belongs to another transaction and session, usually with a different destination port number, which causes the packet forwarding to choose a different path under the condition of equal-cost routing). The app carries the device ID, router ID, transaction ID, and needs to access another port number of anycast address IP-0. The packet is sent to router R1. Because anycast address IP-0 is equivalent on router R1, the packet is randomly selected to go to R2 and then to door lock A, or to R3 and then to door lock B.

[0077] 5. If it is connected to door lock A, and the device ID is found to be consistent by comparison, then continue with the subsequent process;

[0078] 6. If it is connected to door lock B, door lock B will compare the device ID and find that the IDs are inconsistent. It will then consider the message to be sent incorrectly, modify the destination address of the message to the router ID, re-encapsulate the message, and send it to router R3.

[0079] 7. The message passes through router R3 and is forwarded to router R2;

[0080] 8. Router R2 finds that the destination address is its own router ID, then matches it with the transaction ID, and changes the destination address of the packet to the IP address associated with the transaction ID (the IP address of door lock A), and then forwards it to door lock A;

[0081] 9. After receiving the message, door lock A compares the device ID with the device ID. If they match, it returns the message to the user APP with the source IP address being anycast address IP-0, and carries the transaction ID and a specific path flag.

[0082] 10. When router R2 receives a packet, it finds a specific path flag and a transaction ID. It then updates the local transaction ID table entry. If there is no corresponding transaction ID table entry, it records the transaction ID. The next hop is door lock A, and it continues to forward the packet to R1. If there is already a corresponding transaction ID table entry, it checks whether the table entry is accurate. If it is inaccurate, it needs to update the table entry information.

[0083] 11. R1 receives the message, records the transaction ID, the next hop is router R2, and forwards the message to the user's APP;

[0084] 12. When the user's app receives this message and finds a specific path flag, it will carry this transaction ID in subsequent messages sent to the PTZ.

[0085] 13. Router R1 receives a packet with a destination address of anycast address IP-0, carrying a transaction ID. Based on the next hop of the session ID, it forwards the packet to R2, and then to door lock A, thus achieving accurate communication of PTZ control messages. Detailed implementation:

[0086] System architecture and network composition:

[0087] The system network consists of three parts: user mobile terminals, routers, and smart door lock devices. User terminals have a dedicated app installed. The router devices are network devices that support anycast routing, including core router R1, edge routers R2 and R3. Each router is configured with a unique router ID, typically using the router's loopback interface IP address (e.g., R2's router ID is 10.0.0.2, and R3's router ID is 10.0.0.3). The smart door lock devices include door lock A and door lock B, both configured with the same anycast address IP-0, but with different device identifiers. Router R2 is directly connected to door lock A; router R3 is directly connected to door lock B. All router devices maintain anycast routing tables, supporting cost-based routing decisions. Routers R2 and R3 advertise anycast address IP-0 routes and their router IDs. The network topology adopts a hierarchical structure. The user app connects to router R1 via a wireless network, and routers R1, R2, and R3 are connected via the backbone network.

[0088] Initial connection establishment process:

[0089] After the user app starts, it first sends a video connection request packet to the anycast address IP-0. The destination IP of this packet is the anycast address of the door lock, and the destination port is the video service port. After receiving the request, router R1 queries its local anycast routing table and selects the optimal next hop based on the path cost. Assuming that the path cost to router R2 is small, the packet is forwarded to R2 and eventually reaches door lock A. After receiving the connection request, door lock A establishes a video transmission session and simultaneously returns a response packet to the user app. The response packet contains the device identifier ID_A of door lock A.

[0090] When router R2 receives a message from door lock A to the user's app, it detects that the message carries the door lock's device ID. It then binds the door lock's device ID, router ID (using the router's loopback interface IP), transaction ID (generated by router R2 based on door lock A's IP address (anycast address IP-0), device ID, and the user's app's IP address, ensuring uniqueness), and door lock A's IP address (anycast address IP-0) to establish a local mapping relationship, and adds the router ID and transaction ID to the message.

[0091] For router R2, it may be directly connected to multiple door locks, using the same anycast IP address, and different transaction IDs can be generated based on different device IDs.

[0092] The message is forwarded to the user's app, which parses the response message, saves the device identifier, router ID, and transaction ID, and completes the initial connection establishment.

[0093] PTZ control connection established:

[0094] When a user needs to control the PTZ (pan-tilt-zoom) of door lock A, the user's app constructs a PTZ control connection request message. (This belongs to a separate transaction and session, usually with a different destination port number, causing the message forwarding to choose a different path under equal-cost routing conditions.) The destination IP of the message is still an anycast address, but it uses a different service port number. The message payload carries the previously obtained device identifier ID_A, router ID, and transaction ID. The user app sends the request message to router R1. Since there are multiple equal-cost paths on router R1 for anycast routing, the message may be randomly forwarded to router R2 or router R3.

[0095] When the message is correctly routed to door lock A, door lock A parses the device identifier in the message and compares it with its own identifier. If the identifiers match, door lock A continues processing the connection request, preparing to establish a PTZ control session. At this point, door lock A records the transaction ID, sets a specific path flag, and returns a connection confirmation message to the user's app. The confirmation message uses an anycast address as its source IP, and the payload contains the session identifier and path flag.

[0096] When a message is incorrectly routed to lock B, lock B parses the device identifier in the message and compares it with its own identifier ID_B, finding a discrepancy. Lock B determines that the message is not intended for it and initiates its intelligent forwarding mechanism. Lock B re-encapsulates the original request message based on the router ID carried in the message payload (e.g., the router ID of R2). The destination address of the new message is set to the router ID, the source address is the address of lock B, and the payload retains the original request content (including the device ID and transaction ID). Lock B then sends the encapsulated message to the directly connected router R3.

[0097] Error routing correction process:

[0098] After receiving a forwarded packet from lock B, router R3 checks the destination address to find its router ID (e.g., 10.0.0.2). By querying its routing table, router R3 discovers that router ID belongs to the network segment managed by router R2, and therefore forwards the packet to router R2. Upon receiving the packet, router R2 resolves the destination address to its own router ID and then extracts the transaction ID from the packet. Router R2 queries its local transaction ID table entry and finds the IP address (anycast address IP-0) of lock A associated with that transaction ID. Router R2 modifies the packet's destination address to the anycast address IP-0 and forwards it to lock A, while simultaneously updating the usage status of the transaction ID entry locally.

[0099] After receiving the packet forwarded by router R2, door lock A decapsulates it to extract the original PTZ control connection request. Door lock A verifies the consistency between the device identifier in the request packet and its own identifier. If a match is confirmed, the connection request is processed. Door lock A records the corresponding transaction ID, sets a specific path flag, and constructs a connection confirmation packet. The source IP of the confirmation packet uses an anycast address, the destination address is the user's APP IP address, and the payload contains the specific path flag and the transaction ID.

[0100] Session path binding mechanism:

[0101] After receiving the connection acknowledgment message from door lock A, router R2 parses the specific path flag and transaction ID in the message. Router R2 updates the transaction ID entry locally, recording that the session corresponding to the transaction ID has established a path binding, and associates the next-hop information (door lock A). Then, it forwards the message to router R1 according to the routing table.

[0102] After receiving the acknowledgment message, router R1 detects the specific path flag and transaction ID. Router R1 creates a session state record locally, establishing an association between the transaction ID and the next-hop router R2. It then forwards the message to the user application.

[0103] The user app receives the connection confirmation message and parses out the specific path flag and transaction ID. The user app saves the transaction ID and marks it locally as having established a path binding. All subsequent control messages sent to this door lock PTZ will carry this transaction ID.

[0104] Control command transmission process:

[0105] When a user app sends a PTZ control command, the constructed control message has an anycast address as its destination IP and carries a transaction ID. After receiving the control message, router R1 parses the transaction ID and queries its local transaction table. Upon finding a matching entry, router R1 forwards the message directly to router R2 based on the recorded next-hop information, without performing anycast routing.

[0106] After receiving the control message, router R2 also queries its local transaction table using the transaction ID. Finding the corresponding next-hop information (lock A), it forwards the message to lock A. Lock A receives the control message, verifies the validity of the transaction ID, and executes the corresponding PTZ control operation. The execution result is returned to the user's app via the same path.

[0107] Exception handling scenarios:

[0108] When the direct path between routers R1 and R2 fails, the system needs to ensure uninterrupted video streaming and PTZ control services between the user's app and door lock A. Traditional solutions have two main problems in this scenario: first, excessively long path switching times lead to service interruptions; second, the new path may incorrectly route to door lock B. This solution addresses these issues through intelligent path management and session persistence mechanisms. The path switching mechanism design includes:

[0109] Fault detection and notification:

[0110] Router R1 continuously monitors the status of its direct link with R2, employing the Bidirectional Forwarding Detection (BFD) protocol to achieve millisecond-level fault detection. When a link failure is detected, R1 immediately performs the following operations: First, it updates its local routing table, changing the next hop to the anycast address IP-0 of door lock A to router R3; simultaneously, it generates a path failure notification message and sends it to the user app and door lock A via an alternative path. This notification message includes the fault type, estimated recovery time, and switch path information.

[0111] After receiving a path failure notification, the user app initiates a fast reconnection mechanism. However, unlike establishing a completely new connection, the app maintains the existing session state and only updates the path information. The app sends a path update request to anycast address IP-0, which carries the original transaction ID, a special path marker, and the router ID (R2), indicating that a path switch is needed instead of establishing a new connection.

[0112] Path establishment process:

[0113] A path update request message is sent to router R1. Due to a direct path failure, R1 forwards the message to router R3 according to the updated routing table. Upon receiving the message, R3 identifies the special path marker and transaction ID and performs the following key operations: queries its local device mapping table to confirm that the carried router ID belongs to the jurisdiction of router R2; creates a temporary forwarding rule locally, directing all messages associated with that transaction ID to R2; and sends a path establishment request to router R2.

[0114] After receiving the path establishment request, router R2 verifies the validity of the transaction ID. If correct, R2 updates its local transaction table, adding a new path record via R3. Simultaneously, R2 sends a path update notification to door lock A, which adjusts its transmission path accordingly.

[0115] Business traffic forwarding:

[0116] Once the path is established, the user's app's service traffic is transmitted along the new path. Video streams and control messages still use the anycast address IP-0 as the destination address, but carry a transaction ID and path marker. After receiving these messages, router R1 matches the new forwarding path using the transaction ID and sends the messages to R3.

[0117] Router R3 directs the packet to R2 according to pre-established forwarding rules. The key to this process is that R3 not only routes based on IP address but also checks the transaction ID and path marker to ensure the packet is not mistakenly forwarded to lock B. R3 maintains a fine-grained forwarding policy table, making forwarding decisions based on a combination of transaction ID, device identifier, and path state.

[0118] After receiving the packet, router R2 performs normal decapsulation and forwarding operations, delivering the packet to door lock A. The return path uses the same logic to ensure consistency of bidirectional traffic.

[0119] Automatic switchback strategy:

[0120] When the direct connection between R1 and R2 is restored, the system will not immediately switch back. Instead, it will first compare the path quality to ensure that the quality of the direct connection is better than the current path. The switchback process uses a smooth migration method, first switching new traffic to the direct connection, and then completely switching back after the traffic on the original path has been transmitted.

[0121] Beneficial effects: This solution effectively solves the target determinism problem of control connections in anycast environments through device identification verification and message forwarding. Compared with traditional solutions, this method has the following advantages: First, it ensures the accurate delivery of control commands and avoids connection errors caused by routing fluctuations; second, it improves the stability and response speed of control connections through the session path binding mechanism.

[0122] The main innovations of this solution include: 1. A device identifier-based verification mechanism is proposed to ensure the accuracy of control connection targets; 2. An intelligent packet forwarding strategy based on router ID and transaction ID: In case of incorrect routing, the router ID and transaction ID are used to achieve correct packet forwarding, replacing the original reliance on specific IP addresses and improving flexibility and reliability; 3. Transaction ID entry management and session path binding mechanism: The router generates and maintains transaction ID entries, associating them with door lock IPs and user information to achieve efficient route correction and stable transmission of subsequent control commands; 4. Fast path switching and anomaly handling: In case of link failure, transaction IDs are used to achieve fast path reconstruction and service recovery, ensuring high availability of the connection.

[0123] As can be seen, based on the service request sent by the user's APP to the anycast address, an initial connection is established with the nearest door lock through anycast routing, and the device identifier, router ID, and transaction ID of the target door lock are obtained. Based on the device identifier carried in the control connection request initiated by the user's APP, the receiving door lock compares the identifiers. If the match fails, packet forwarding based on the router ID and transaction ID is triggered. The incorrectly receiving door lock forwards the request packet to the designated router, thus achieving correct delivery of the request packet. Based on the specific path flag in the confirmation packet returned by the correct door lock, the user's APP and the routers along the path record the binding relationship between the transaction ID and the path, ensuring that subsequent control commands are transmitted along the bound path. This enables fast, stable, and reliable transmission of control commands from the user to the target door lock, improving the system's response efficiency and control success rate.

[0124] Another embodiment of the present invention provides an exit selection system with multiple door lock options, see [link to relevant documentation]. Figure 3 The system may include:

[0125] Module 301 is used for initial connection establishment and identifier acquisition: based on the service request sent by the user APP to the anycast address, an initial connection is established with the nearest door lock through anycast routing, and the device identifier, router ID, and transaction ID of the target door lock are obtained; wherein, the initial connection establishment and identifier acquisition includes: initial service request: based on the video connection request sent by the user APP to the anycast address, the network routes the request to the door lock with the nearest topology according to the anycast routing policy; connection response and identifier return: based on the connection request received by the target door lock, a connection confirmation message containing its own device identifier is generated and returned to the user APP; path information recording: based on the return message carrying the device identifier detected by the edge router, a unique transaction ID is generated, and a local mapping relationship between the device identifier, router ID, transaction ID, and door lock IP address is established; information delivery: based on the edge router adding the router ID and transaction ID to the return message, and forwarding it to the user APP, so that the user APP obtains the device identifier, router ID, and transaction ID of the target door lock;

[0126] The verification module 302 is used for control connection verification and binding: based on the device identifier carried in the control connection request initiated by the user APP, the receiving door lock compares the identifier. If the match fails, it triggers message forwarding based on the router ID and transaction ID.

[0127] The correction module 303 is used for message forwarding and error routing correction: the incorrectly received door lock forwards the request message to the designated router. The router queries the associated door lock address according to the transaction ID and reroutes to achieve the correct delivery of the request message. The designated router is the router corresponding to the router ID carried in the request message.

[0128] Binding module 304 is used for path binding and command transmission: Based on the specific path flag in the confirmation message returned by the correct door lock, the user APP and the routers along the way record the binding relationship between the transaction ID and the path, ensuring that subsequent control commands are transmitted along the bound path.

[0129] This invention also provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.

[0130] This invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0131] Specifically, the aforementioned electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the aforementioned processor, and the input / output device is connected to the aforementioned processor.

[0132] The above description, based on the embodiments shown in the figures, details the structure, features, and effects of the present invention. The above description is only a preferred embodiment of the present invention, but the present invention is not limited to the scope of implementation shown in the figures. Any changes made in accordance with the concept of the present invention, or equivalent embodiments modified to have equivalent changes, that do not exceed the spirit covered by the specification and figures, should be within the protection scope of the present invention.

Claims

1. A method for selecting an exit from multiple locks, characterized in that, The method includes: Initial Connection Establishment and Identifier Acquisition: Based on the service request sent by the user APP to the anycast address, an initial connection is established with the nearest door lock through anycast routing, and the device identifier, router ID, and transaction ID of the target door lock are obtained. The initial connection establishment and identifier acquisition includes: Initial Service Request: Based on the video connection request sent by the user APP to the anycast address, the network routes the request to the door lock with the nearest topology according to the anycast routing policy; Connection Response and Identifier Return: Based on the connection request received by the target door lock, a connection confirmation message containing its own device identifier is generated and returned to the user APP; Path Information Recording: Based on the return message carrying the device identifier detected by the edge router, a unique transaction ID is generated, and a local mapping relationship is established between the device identifier, router ID, transaction ID, and door lock IP address; Information Delivery: Based on the edge router adding the router ID and transaction ID to the return message, it is forwarded to the user APP, enabling the user APP to obtain the device identifier, router ID, and transaction ID of the target door lock. Control connection verification and binding: Based on the device identifier carried in the control connection request initiated by the user APP, the receiving door lock compares the identifier. If the match fails, it triggers packet forwarding based on the router ID and transaction ID; where the destination address of the request is an anycast address. Message forwarding and error routing correction: The incorrectly received door lock forwards the request message to the designated router. The router queries the local mapping relationship based on the transaction ID carried in the request message to obtain the associated door lock address and reroutes, thus achieving the correct delivery of the request message. The designated router is the router corresponding to the router ID carried in the request message. Path binding and command transmission: Based on the specific path flag in the confirmation message returned by the correct door lock, the user APP and the routers along the route record the binding relationship between the transaction ID and the path, ensuring that subsequent control commands are transmitted along the bound path.

2. The method according to claim 1, characterized in that, The control connection verification and binding includes: Control connection initiation: Based on the PTZ control connection request initiated by the user APP, the destination address of the request is anycast address, and the request message carries the previously obtained device identifier, router ID and transaction ID; Initial identifier verification: Depending on the anycast route, the request message may be routed to the target lock or a non-target lock; Verification result processing: Based on the result of comparing the device identifier in the received door lock comparison request message with its own identifier: if the identifiers match, the control connection request is processed; if the identifiers do not match, message forwarding is triggered.

3. The method according to claim 2, characterized in that, The message forwarding and error routing correction include: Message re-encapsulation: Based on the result of the identifier comparison failure, the error receiving lock modifies the destination address of the original request message to the router ID carried in the request message and re-encapsulates it; Message forwarded to designated router: Based on the destination address of the re-encapsulated message, the directly connected router that incorrectly received the lock forwards it to the designated router; Address translation and rerouting: Based on the packet received by the specified router, the transaction ID is parsed, the local mapping table is queried to obtain the associated target door lock IP address, and the packet destination address is modified to the target door lock IP address before forwarding.

4. The method according to claim 3, characterized in that, The path binding and command transmission include: Path binding confirmation: The confirmation message returned after the correct door lock processes the control connection request, which sets a specific path flag and carries the transaction ID; Path status recording: Based on the specific path flag and transaction ID in the confirmation message parsed by the routers along the route, create or update the transaction ID table entry locally and record the next-hop path information corresponding to the transaction ID; Binding information synchronization: Based on the confirmation message received by the user's APP, the specific path flag and transaction ID are parsed out, and the path binding for the transaction ID is marked locally; Binding path transmission: Since subsequent control command messages sent by the user's APP all carry transaction IDs, routers along the route forward them according to the transaction ID entries, and no longer perform anycast routing selection.

5. The method according to claim 4, characterized in that, The method also includes a path switching mechanism in case of abnormal situations: Fault Detection and Notification: Based on the fault detection results of the links between routers, the router that detects the fault updates its local routing table and sends a path fault notification to the user's APP and door lock; Path update request: Based on the path failure notification received by the user APP, send a path update request carrying the original transaction ID and a special path marker to the anycast address; Alternate path establishment: After the path update request message is routed through the alternative path, the routers along the way parse the special path marker and transaction ID, and establish a temporary forwarding rule that points to the target door lock through the alternative path; Service recovery and rollback: Based on the establishment of temporary forwarding rules, the user's APP service traffic is switched to the backup path for transmission; when the original faulty link is restored, the system smoothly rolls the traffic back to the original path based on the path quality comparison results.

6. An exit selection system with multiple door lock options, characterized in that, The system includes: The module establishes an initial connection and obtains an identifier: based on the service request sent by the user APP to the anycast address, it establishes an initial connection with the nearest door lock through anycast routing and obtains the target door lock's device identifier, router ID, and transaction ID. The initial connection establishment and identifier acquisition includes: an initial service request: based on the video connection request sent by the user APP to the anycast address, the network routes the request to the door lock with the nearest topology according to the anycast routing policy; a connection response and identifier return: based on the connection request received by the target door lock, it generates a connection confirmation message containing its own device identifier and returns it to the user APP; path information recording: based on the return message carrying the device identifier detected by the edge router, it generates a unique transaction ID and establishes a local mapping relationship between the device identifier, router ID, transaction ID, and door lock IP address; and information delivery: based on the edge router adding the router ID and transaction ID to the return message and forwarding it to the user APP, enabling the user APP to obtain the target door lock's device identifier, router ID, and transaction ID. The verification module is used for connection verification and binding: based on the device identifier carried in the control connection request initiated by the user APP, the receiving door lock compares the identifier. If the match fails, it triggers packet forwarding based on the router ID and transaction ID; the destination address of the request is an anycast address. The correction module is used for message forwarding and error routing correction: the incorrectly received door lock forwards the request message to the designated router. The router queries the local mapping relationship based on the transaction ID carried in the request message to obtain the associated door lock address and reroutes, so as to achieve the correct delivery of the request message. The designated router is the router corresponding to the router ID carried in the request message. The binding module is used for path binding and command transmission: based on the specific path flag in the confirmation message returned by the correct door lock, the user APP and the routers along the way record the binding relationship between the transaction ID and the path, ensuring that subsequent control commands are transmitted along the bound path.

7. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method of any one of claims 1-5 when it is run.

8. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method of any one of claims 1-5.