Equipment access method and electronic equipment
By detecting the local area network address and subnet mask of the network equipment, and automatically determining and accessing the network video recorder, the problem of low device access efficiency in the prior art is solved, and fast and efficient device access is achieved.
Patent Information
- Application Number
- CN202510300095.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-07-25
AI Technical Summary
In a network configured with multiple routers, when the network camera is connected to the network recorder, the prior art requires additional equipment or manual configuration of the user, resulting in low device access efficiency.
Through a network camera, the local area network addresses of multiple network devices are detected, the subnet mask is obtained, the address range of the device is determined, and the address range is detected and connected to the network recorder is detected according to the address range to realize automated equipment access.
Regardless of whether the network recorder and the network camera are mounted on the same router, the network recorder is quickly determined and connected to the network recorder through automated methods, which improves the equipment access efficiency.
Smart Images

Figure CN120378405A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of communications, and in particular, to a device access method and an electronic device. Background Art
[0002] In a certain network environment, a gateway device and multiple routers can be configured. Various devices can access the network by accessing different routers. Various devices can include network cameras and network video recorders, etc.
[0003] If in a network configured with multiple routers, a network camera mounted under a certain router wants to connect to a network video recorder in the network, there may be a situation where the router where the network video recorder is located is different from the router where the network camera is located. Currently, in order to solve the connection problem between devices under different routers, it can be achieved by adding a relay device in the network or manually configuring the device connection by the user, etc.
[0004] In the above process, it is necessary to add additional devices or manually configure the device connection by the user, resulting in low device access efficiency. Summary of the Invention
[0005] The embodiments of the present application provide a device access method and an electronic device to solve the defect in the prior art that additional devices need to be added or the device connection needs to be manually configured by the user, resulting in low device access efficiency.
[0006] In a first aspect, the present application provides a device access method applied to a network camera, and the method includes:
[0007] Detect the first local area network addresses of multiple network devices. The multiple network devices and the network camera are in the same local area network. The network devices are routing devices or gateway devices, and the first local area network address is the address corresponding to the network device in the local area network;
[0008] For any one of the network devices, obtain the subnet mask corresponding to the network device, and determine the address range corresponding to the network device according to the first local area network address and the subnet mask of the network device. The local area network addresses of the devices mounted under the network device are within the address range;
[0009] Perform device detection processing according to the address ranges corresponding to the network devices, detect at least one network video recorder, and determine the target local area network addresses corresponding to the at least one network video recorder respectively. The network video recorders are mounted under the multiple network devices;
[0010] Access the target network video recorder in the at least one network video recorder according to at least one of the target local area network addresses.
[0011] Second aspect, the present application provides a device access method, which is applied to a network video recorder. The method includes:
[0012] Receiving a data acquisition request sent by the network camera;
[0013] According to the data acquisition request, sending a data acquisition response to the network camera, where the data acquisition response includes device information of the network video recorder, and the device information is used for the network camera to determine the target local area network address of the network video recorder;
[0014] Receiving an access request sent by the network camera according to the target local area network address;
[0015] According to the access request, accessing the network camera in the network video recorder;
[0016] Wherein, the data acquisition request is: after the network camera detects the first local area network addresses of multiple network devices and the address ranges corresponding to each network device, and the local area network address of the device mounted under the network device is within the address range, the network camera sends the data acquisition request to the network video recorder.
[0017] Third aspect, the present application provides a device access device, which is applied to a network camera. The device includes:
[0018] A first detection module, configured to detect the first local area network addresses of multiple network devices. The multiple network devices and the network camera are in the same local area network, the network devices are routing devices or gateway devices, and the first local area network address is the address corresponding to the network device in the local area network;
[0019] A determination module, configured to, for any one of the network devices, obtain the subnet mask corresponding to the network device, and determine the address range corresponding to the network device according to the first local area network address of the network device and the subnet mask, where the local area network address of the device mounted under the network device is within the address range;
[0020] A second detection module, configured to perform device detection processing according to the address ranges corresponding to the network devices, detect at least one network video recorder, and determine the target local area network addresses corresponding to the at least one network video recorder respectively. The network video recorder is mounted under the multiple network devices;
[0021] An access module, configured to access a target network video recorder in the at least one network video recorder according to at least one of the target local area network addresses.
[0022] Fourth aspect, the present application provides a device access device, which is applied to a network video recorder. The device includes:
[0023] A receiving module, configured to receive a data acquisition request sent by the network camera;
[0024] A sending module, configured to send a data acquisition response to the network camera according to the data acquisition request. The data acquisition response includes device information of the network video recorder, and the device information is used for the network camera to determine the target local area network address of the network video recorder;
[0025] The receiving module is further configured to receive an access request sent by the network camera according to the target local area network address;
[0026] An access module, configured to access the network camera in the network video recorder according to the access request;
[0027] Wherein, the data acquisition request is: after the network camera detects the first local area network addresses of multiple network devices and the corresponding address ranges of each network device, the network camera sends the data acquisition request to the network video recorder, and the local area network address of the device mounted under the network device is within the address range.
[0028] Fifth aspect, the present application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0029] The memory stores computer execution instructions;
[0030] The processor executes the computer execution instructions stored in the memory to implement the method according to any one of the first aspect.
[0031] Sixth aspect, the present application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0032] The memory stores computer execution instructions;
[0033] The processor executes the computer execution instructions stored in the memory to implement the method according to any one of the second aspect.
[0034] Seventh aspect, the present application provides a computer-readable storage medium, in which computer execution instructions are stored, and when the computer execution instructions are executed by a processor, they are used to implement the method according to any one of the first aspect.
[0035] In an eighth aspect, the present application provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the method according to any one of the second aspect when executed by a processor.
[0036] In a ninth aspect, the present application provides a computer program product including a computer program, which implements the method according to any one of the first aspect when executed by a computer.
[0037] In a tenth aspect, the present application provides a computer program product including a computer program, which implements the method according to any one of the second aspect when executed by a computer.
[0038] An apparatus access method, device, storage medium, and program product provided in an embodiment of the present application obtain first LAN addresses of multiple network devices through detection. The multiple network devices and the network camera are in the same local area network. The network device is a routing device or a gateway device, and the first LAN address is the address corresponding to the network device within the local area network. For any one of the network devices, obtain the subnet mask corresponding to the network device, and determine the address range corresponding to the network device according to the first LAN address and the subnet mask of the network device. The LAN addresses of the devices mounted under the network device are within the address range. Perform device detection processing according to the address ranges corresponding to the respective network devices, detect at least one network video recorder, and determine the target LAN addresses respectively corresponding to the at least one network video recorder. The network video recorder is mounted under multiple network devices. Access the target network video recorder among the at least one network video recorders according to the at least one target LAN address. In this way, whether the network video recorder and the network camera are mounted under the same router or not, the network camera can quickly determine the target LAN address of the network video recorder through the address ranges corresponding to the multiple network devices obtained by detection, and access the network video recorder, improving the device access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0040] Figure 1 FIG. is a schematic diagram of an application scenario provided in an embodiment of the present application;
[0041] Figure 2 FIG. is a flowchart of an apparatus access method provided in an embodiment of the present application;
[0042] Figure 3 Schematic flowchart of another device access method provided by an embodiment of this application;
[0043] Figure 4 Schematic flowchart of yet another device access method provided by an embodiment of this application;
[0044] Figure 5 Schematic flowchart of another device access method provided by an embodiment of this application;
[0045] Figure 6 Schematic flowchart of yet another device access method provided by an embodiment of this application;
[0046] Figure 7 Schematic flowchart of another device access method provided by an embodiment of this application;
[0047] Figure 8 Schematic flowchart of yet another device access method provided by an embodiment of this application;
[0048] Figure 9 Schematic structural diagram of a device access device provided by an embodiment of this application;
[0049] Figure 10 Schematic structural diagram of another device access device provided by an embodiment of this application;
[0050] Figure 11 Schematic structural diagram of an electronic device provided by an embodiment of this application.
[0051] Through the above-mentioned accompanying drawings, the clear embodiments of this application have been shown, and there will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of this application in any way, but to illustrate the concept of this application to those skilled in the art by referring to specific embodiments. Detailed implementation manners
[0052] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are some, but not all, of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of this application without creative efforts shall fall within the scope of protection of this application.
[0053] It should be noted that although the terms "first", "second", etc. are used in the embodiments of the present application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. Optionally, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information.
[0054] It should be understood that the terms "comprising" and "including" indicate the presence of the previously mentioned features, steps, operations, but do not exclude the presence, appearance or addition of one or at least one other feature, step, operation. The term "and / or" used in the present application can be interpreted inclusively, or means any one or any combination. Optionally, "A and / or B" means "any one of the following: A; B; A and B". Additionally, the character " / " in this text generally indicates an "or" relationship between the associated objects before and after.
[0055] In a certain network environment, a gateway device and multiple routers can be configured. Various devices can access the network by connecting to different routers. Various devices can include network cameras and network video recorders, etc.
[0056] Next, in combination with Figure 1 , an example of a certain network environment will be given.
[0057] Figure 1 FIG. is a schematic diagram of an application scenario provided by an embodiment of the present application. Please refer to Figure 1 , Figure 1 It may include a home network 100, and the home network 100 may include a gateway device 101, multiple routers 102, a network camera 103, and a network video recorder 104.
[0058] The gateway device 101 can be used to access the external network provided by the operator.
[0059] For example, the gateway device 101 can be an optical modem, and the external optical fiber can be connected to the optical modem at the user's home. The optical modem converts the received optical signal into an electrical signal that can be recognized and further processed by the router, realizing the conversion processing of network access.
[0060] The gateway device 101 can also be used to connect multiple routers 102 to achieve network coverage.
[0061] The router 102 can be used to provide a wireless network signal to devices within the wireless network signal coverage range. The devices can include a network camera 103 and a network video recorder 104.
[0062] The network camera 103 can be a video surveillance device used in a network environment to achieve functions such as security monitoring, remote viewing, and management.
[0063] The network video recorder 104 can be used to receive the video streams transmitted by at least one connected network camera 103 and centrally store these video data.
[0064] In a network configured with multiple routers, if a network camera mounted under a certain router wants to connect to a network video recorder in this network, there may be a situation where the router where the network video recorder is located is different from the router where the network camera is located.
[0065] For example, in this home network 100, the network camera 103 and the network video recorder 104 can be respectively mounted under different routers.
[0066] In the related art, to solve the connection problem between devices under different routers, it can be achieved by adding a relay device in the network or manually configuring the device connection by the user, etc.
[0067] In the above process, it is necessary to add additional devices or manually configure the device connection by the user, resulting in a low device access efficiency.
[0068] To solve the above technical problems, the embodiment of the present application provides a device access method. The first local area network addresses of multiple network devices are detected by a network camera, and the network devices are routing devices or gateway devices. For any one of the detected network devices, according to the first local area network address corresponding to the network device, the address range corresponding to the network device is determined, and the local area network addresses of the devices mounted under the network device are within this address range. According to the address ranges of each network device, the target local area network addresses of at least one network video recorder are determined, and according to at least one target local area network address, the target network video recorder in at least one network video recorder is accessed. In this way, whether the network video recorder and the network camera are mounted under the same router or not, the network camera can quickly determine the target local area network address of the network video recorder through the address ranges respectively corresponding to the multiple detected network devices and access the network video recorder, improving the device access efficiency.
[0069] Next, the technical solution shown in the present application will be described in detail through specific embodiments. It should be noted that the following several embodiments can exist independently or be combined with each other, and the same or similar content will not be repeated in different embodiments.
[0070] Figure 2 It is a schematic flow chart of a device access method provided by the embodiment of the present application. The execution subject of the embodiment of the present application can be a network camera. See Figure 2 , and this method includes:
[0071] S201. Detect the first local area network addresses of multiple network devices.
[0072] Multiple network devices and network cameras are in the same local area network.
[0073] The network device is a routing device or a gateway device.
[0074] The first local area network address is the address corresponding to the network device within the local area network. The first local area network address can be used to identify the network device.
[0075] The network camera can detect the first local area network addresses of multiple network devices through the Internet Control Message Protocol (ICMP) protocol, or can also detect through other protocols, which is not limited here.
[0076] Optionally, an address list in the storage space can be obtained, and according to the multiple local area network addresses in the address list, address determination requests are sent respectively, response information corresponding to the multiple address determination requests is obtained, and according to the multiple response information, the first local area network addresses of the multiple network devices are determined.
[0077] Among them, the address list may include multiple local area network addresses detected during a historical period. The address determination request can be used to determine whether the address is the address corresponding to the network device within the local area network. The response information can be used to determine that the address is the address corresponding to the network device within the local area network.
[0078] Optionally, multiple probe messages can be sent through the ICMP protocol, and according to the response messages corresponding to the multiple probe messages respectively, the first local area network addresses of multiple network devices are detected.
[0079] It should be noted that the first local area network addresses of multiple network devices can be detected according to any feasible implementation manner, and the embodiments of the present application do not limit this.
[0080] Optionally, the first local area network addresses of multiple network devices can be detected in the following manner: determine multiple Time-To-Live (TTL) values of the message; in the order of the multiple TTL values from small to large, according to the multiple TTL values, perform multiple message probe processes until the first local area network addresses of multiple network devices are detected.
[0081] Among them, the multiple TTL values can sequentially increase by a preset value in the order from small to large.
[0082] The preset value can be 1.
[0083] The Time-To-Live (TTL) can be used to indicate the effective duration during which the probe message can exist and be forwarded.
[0084] When a detection message is transmitted in the network, each time it passes through a network device, the value of the TTL is decremented by 1. When the value of the TTL is decremented to 0, the network device where the detection message is located can discard the detection message and send a response message to the network camera. The response message includes the first LAN address of the network device where the detection message is located.
[0085] S202. For any network device, obtain the subnet mask corresponding to the network device, and determine the address range corresponding to the network device according to the first LAN address and the subnet mask of the network device.
[0086] The subnet mask can be used to divide the network part and the host part of the first LAN address to determine the subnet range to which the device belongs.
[0087] The LAN addresses of the devices mounted under the network device are within the address range.
[0088] The start address and the end address of the address range can be determined according to the first LAN address and the subnet mask.
[0089] Next, among the multiple network devices detected, take any one network device as an example:
[0090] The subnet mask corresponding to the network device can be obtained through the configuration information. According to the first LAN address and the subnet mask of the network device, calculate the network address and the broadcast address. Determine the address immediately following the network address as the start address, and determine the address immediately preceding the broadcast address as the end address. Determine the address range corresponding to the network device according to the start address and the end address.
[0091] Among them, the network address can be used to identify the range of the subnet.
[0092] The network address and the broadcast address can be calculated according to the first LAN address and the subnet mask of the network device in the following way: Perform binary conversion processing on the first LAN address and the subnet mask to obtain the first value corresponding to the first LAN address and the second value corresponding to the subnet mask. Perform logical AND operation processing on the first value and the second value to obtain the third value. Perform decimal conversion processing on the third value to obtain the network address. Determine the host bits according to the second value of the subnet mask. Set all the host bits in the third value to 1 to obtain the fourth value. Perform decimal conversion processing on the fourth value to obtain the broadcast address.
[0093] For example, assume that the first LAN address is 192.168.1.100 and the subnet mask is 255.255.255.0. Perform binary conversion processing on the first LAN address and the subnet mask to obtain the first value: 11000000.10101000.00000001.01100100, and the second value: 11111111.11111111.11111111.00000000. Perform logical AND operation processing on the first value and the second value to obtain the third value: 11000000.10101000.00000001.00000000. Perform decimal conversion processing on the third value to obtain the network address: 192.168.1.0. According to the second value of the subnet mask, determine that the host bits are the last eight bits. Set all the host bits in the third value to 1 to obtain the fourth value: 11000000.10101000.00000001.11111111. Perform decimal conversion processing on the fourth value to obtain the broadcast address 192.168.1.255. Determine the next address adjacent to the network address 192.168.1.0 as the starting address: 192.168.1.1, and determine the previous address adjacent to the broadcast address 192.168.1.255 as the ending address: 192.168.1.254. According to the starting address 192.168.1.1 and the ending address 192.168.1.254, determine the address range corresponding to the network device: 192.168.1.1 - 192.168.1.254.
[0094] S203. Perform device detection processing according to the address range corresponding to each network device, detect at least one network video recorder, and determine the target LAN address corresponding to each network video recorder.
[0095] The network video recorder is mounted under multiple network devices.
[0096] The target LAN address is the address corresponding to the network video recorder within the LAN.
[0097] The device detection processing can be used to detect the device information of the device.
[0098] The device detection processing can be performed according to the address range corresponding to each network device in the following two ways to detect at least one network video recorder and determine the target LAN address corresponding to each network video recorder:
[0099] Method 1: Multiple second LAN addresses can be determined according to the address range corresponding to each network device, and device detection processing is performed on the multiple second LAN addresses to obtain at least one network video recorder and determine the target LAN address corresponding to each network video recorder.
[0100] Method 2: For any network device, at least one device detection process can be performed within the address range corresponding to the network device until a network video recorder is detected, and the target LAN address corresponding to the network video recorder is determined.
[0101] Among them, the device detection process can send a data acquisition request to the device corresponding to the address within the address range through a preset protocol, and receive the data acquisition response corresponding to the data acquisition request. The data acquisition response includes the device information of the device.
[0102] The preset protocol can be a preset private protocol. The preset protocol can be the Over-The-Air Provisioning (OTAP) protocol.
[0103] Both the network camera and the network video recorder support the preset protocol.
[0104] The data acquisition request can be used to request the device information of the device.
[0105] The device information can include information such as the serial number, device identifier, device type, and device name.
[0106] If the device corresponding to the address within the address range does not support the preset protocol, the device will not send a data acquisition response when receiving the data acquisition request. If the device corresponding to the address within the address range is a network video recorder or other device that supports the preset protocol, the device can send a data acquisition response according to the data acquisition request.
[0107] Optionally, the above different methods can be determined through the user's selection operation on the detection method selection control.
[0108] It should be noted that, according to any feasible implementation method, device detection processing can be performed according to the address ranges corresponding to each network device, at least one network video recorder is detected, and the target LAN addresses corresponding to at least one network video recorder are determined. The embodiments of the present application do not limit this.
[0109] S204. Access the target network video recorder among at least one network video recorder according to at least one target LAN address.
[0110] The target LAN address can be the LAN address corresponding to the network video recorder.
[0111] There can be at least one network video recorder in the local area network.
[0112] At least one network video recorder includes the target network video recorder.
[0113] An access request can be sent to at least one network video recorder according to at least one target local area network address, an access success response sent by the target network video recorder is received, and the target video recorder is accessed according to the access success response.
[0114] Among them, the network camera can send an access request to at least one network video recorder. Only the target network video recorder among the at least one network video recorder can access the network camera according to the access request, generate an access success response, and send the access success response to the network camera.
[0115] It should be noted that the target network video recorder in at least one network video recorder can be accessed according to at least one target local area network address, and the embodiments of the present application do not limit this.
[0116] The device access method provided in this embodiment obtains the first local area network addresses of multiple network devices through detection. The multiple network devices and the network camera are in the same local area network. The network devices are routing devices or gateway devices, and the first local area network address is the address corresponding to the network device within the local area network. For any network device, the subnet mask corresponding to the network device is obtained, and according to the first local area network address and the subnet mask of the network device, the address range corresponding to the network device is determined. The local area network addresses of the devices mounted under the network device are within the address range. Device detection processing is performed according to the address ranges corresponding to the respective network devices, at least one network video recorder is detected, and the target local area network addresses respectively corresponding to the at least one network video recorder are determined. The network video recorders are mounted under multiple network devices. The target network video recorder in at least one network video recorder is accessed according to at least one target local area network address. In this way, regardless of whether the network video recorder and the network camera are mounted under the same router, the network camera can quickly determine the target local area network address of the network video recorder through the address ranges respectively corresponding to the multiple network devices detected, and access the network video recorder, improving the device access efficiency.
[0117] Next, in combination with Figure 3 , the process (S201) of detecting the first local area network addresses of multiple network devices will be explained.
[0118] Figure 3 It is a schematic flowchart of another device access method provided by an embodiment of the present application. On the basis of the above embodiment, refer to Figure 3 , and this method will be described in detail. This method includes:
[0119] S301. Determine multiple time-to-live (TTL) values of the message.
[0120] Configuration information can be obtained, and according to the configuration information, multiple time-to-live (TTL) values of the message are determined.
[0121] The configuration information may include protocol formats, multiple message survival durations, etc., which are not limited herein.
[0122] Each message survival duration increases by a preset value in sequence.
[0123] The preset value may be 1, which is not limited herein.
[0124] For example, assume that the multiple message generation durations can be 2. The first TTL can be 1 and the second TTL can be 2.
[0125] Another example, assume that the multiple message generation durations can be 3. The first TTL can be 1, the second TTL can be 2, and the third TTL can be 3.
[0126] Optionally, the configuration information may include an initial survival duration, an interval value, and a generation count. Multiple survival durations can be determined based on the initial survival duration, the interval value, and the generation count.
[0127] S302. Initialize i to 1.
[0128] S303. Generate the i-th probe message according to the i-th TTL.
[0129] The TTL of the probe message is the i-th TTL.
[0130] The i-th probe message can be generated through the Internet Control Message Protocol according to the i-th TTL.
[0131] The format of the i-th probe message can be a preset format. The i-th probe message may include a header field and a data part. The header field may include a field representing the survival duration, and the data part may include the IP address corresponding to the network camera.
[0132] S304. Receive the i-th response message corresponding to the i-th probe message. The i-th response message includes the first LAN address of the i-th network device detected.
[0133] The i-th network device can be a router or a gateway device.
[0134] For example, assume that the network camera sends the first probe message. According to the first TTL, it is determined that the TTL corresponding to the first probe message is 1. The first network device receives the first probe message, the TTL is decremented by 1, and it is determined that the TTL is 0. The first network device sends the first response message to the network camera. The first response message includes the first LAN address of the first network device.
[0135] For another example, assume that the network camera sends the second probe message. According to the second TTL, it is determined that the TTL corresponding to the second probe message is 2. The first network device receives the second probe message, decrements the TTL by 1, and determines that the TTL is 1. The first network device forwards it to the second network device. The second network device receives the second probe message, decrements the TTL by 1, and determines that the TTL is 0. The second network device sends the second response message to the network camera, and the second response message includes the first LAN address of the second network device.
[0136] For another example, assume that the network camera sends the third probe message. According to the third TTL, it is determined that the TTL corresponding to the third probe message is 3. The first network device receives the third probe message, decrements the TTL by 1, and determines that the TTL is 2. The first network device forwards the third probe message to the second network device. The second network device receives the third probe message, decrements the TTL by 1, and determines that the TTL is 1. The second network device forwards the third probe message to the third network device, decrements the TTL by 1, and determines that the TTL is 0. The third network device sends the third response message to the network camera, and the third response message includes the first LAN address of the third network device.
[0137] S305. Determine whether the first LAN address of the i-th network device is the LAN address of the gateway device.
[0138] If so, execute S306;
[0139] If not, execute S307.
[0140] It is possible to determine whether the first LAN address of the i-th network device is the LAN address of the gateway device based on the i-th response message.
[0141] If the i-th response message includes an Internet Control Message Protocol timeout, it is determined that the first LAN address of the i-th network device is not the LAN address of the gateway device;
[0142] If the i-th response message includes an Internet Control Message Protocol echo reply, it is determined that the first LAN address of the i-th network device is the LAN address of the gateway device.
[0143] S306. Determine the first LAN addresses of multiple network devices obtained by detection.
[0144] For example, if the first LAN address of the third network device is the LAN address of the gateway device, it is determined that the detected first LAN addresses are: the first LAN address of the first network device, the first LAN address of the second network device, and the first LAN address of the third network device.
[0145] For another example, when i = N, it is determined that the first LAN addresses of the first network device, the second network device, ..., and the Nth network device are detected.
[0146] S307. Determine whether i is less than N.
[0147] If yes, execute S308;
[0148] If not, execute S306.
[0149] S308. Update i to i + 1.
[0150] After S308, execute S303.
[0151] For the implementation content of each step in the embodiments of the present application, reference may be made to the description of the corresponding steps or operations in the above method embodiments, and the repeated content will not be elaborated.
[0152] A device access method provided in this embodiment determines multiple time-to-live (TTL) values of a message; generates an ith probe message according to the ith TTL, where the TTL of the probe message is the ith TTL; receives an ith response message corresponding to the ith probe message, and the ith response message includes the detected first LAN address of the ith network device; where i takes values of 1, 2, ..., until i is N, or when the detected first LAN address is the LAN address of a gateway device, it is determined that the first LAN addresses of multiple network devices are detected; N is the number of multiple TTLs, and N is a positive integer. In this way, regardless of whether the network video recorder and the network camera are mounted under the same router, the network camera can quickly determine the target LAN address of the network video recorder through the LAN addresses corresponding to the multiple detected network devices and access the network video recorder, improving the device access efficiency.
[0153] Next, in combination with Figure 4 , the process of performing device detection processing according to the address ranges corresponding to each network device, detecting at least one network video recorder, and determining the target LAN addresses corresponding to at least one network video recorder respectively (S203) will be explained.
[0154] Figure 4 It is a flowchart of another device access method provided in the embodiments of the present application. On the basis of the above embodiments, refer to Figure 4 , this method includes:
[0155] S401. Determine multiple second LAN addresses within the address ranges corresponding to each network device.
[0156] The second LAN address can be an available LAN address.
[0157] Each network device corresponds to an address range, which includes multiple LAN addresses that can be allocated within the LAN managed by the network device.
[0158] It is possible to obtain unavailable LAN addresses, and determine multiple second LAN addresses based on the address ranges corresponding to each network device and the address ranges corresponding to each network device.
[0159] S402. For any one of the second LAN addresses, send a data acquisition request to the device corresponding to the second LAN address, and receive the data acquisition response corresponding to the data acquisition request.
[0160] The data acquisition response includes the device information corresponding to the second LAN address.
[0161] It is possible to send a data acquisition request to the device corresponding to the second LAN address through a preset protocol, and receive the data acquisition response corresponding to the data acquisition request through the preset protocol.
[0162] The preset protocol can be a preset private protocol.
[0163] The preset protocol can be the Over-The-Air Provisioning (OTAP) protocol.
[0164] If the device corresponding to the address within the address range does not support the preset protocol, when the device receives the data acquisition request, it will not send a data acquisition response. If the device corresponding to the address within the address range is a network video recorder or other device that supports the preset protocol, when the device receives the data acquisition request, it can send a data acquisition response according to the data acquisition request.
[0165] S403. Based on the device information, determine whether at least one network video recorder is mounted under multiple network devices.
[0166] The device information can include the device name, device model, device identifier, etc., which are not limited here.
[0167] It is possible to input the obtained device information into a device type recognition model to determine whether at least one network video recorder is mounted under multiple network devices.
[0168] It is possible to determine whether at least one network video recorder is mounted under multiple network devices based on the device model or device name or device identifier.
[0169] It should be noted that it is possible to determine whether at least one network video recorder is mounted under multiple network devices based on any feasible implementation manner according to the device information. The embodiments of the present application do not limit this.
[0170] S404. If so, determine the second LAN addresses respectively corresponding to at least one network video recorder as at least one target LAN address.
[0171] If it is determined that at least one network video recorder is mounted under multiple network devices, the second LAN addresses respectively corresponding to at least one network video recorder can be determined, and the second LAN addresses respectively corresponding to at least one network video recorder are determined as at least one target LAN address.
[0172] For the implementation content of each step in the embodiments of the present application, reference may be made to the description of the corresponding steps or operations in the above method embodiments, and repeated content will not be elaborated.
[0173] An equipment access method provided in this embodiment determines multiple second LAN addresses within the address ranges corresponding to each network device; for any one of the second LAN addresses, sends a data acquisition request to the device corresponding to the second LAN address, and receives the data acquisition response corresponding to the data acquisition request, where the data acquisition response includes the device information corresponding to the second LAN address; determines whether at least one network video recorder is mounted under multiple network devices according to the device information; if so, determines the second LAN addresses respectively corresponding to at least one network video recorder as at least one target LAN address. In this way, regardless of whether the network video recorder and the network camera are mounted under the same router, the network camera can quickly determine the target LAN address of the network video recorder through the address ranges respectively corresponding to the multiple network devices detected, and access the network video recorder, improving the equipment access efficiency.
[0174] Next, in conjunction with Figure 5 , the process (S203) of performing equipment detection processing according to the address ranges corresponding to each network device, detecting at least one network video recorder, and determining the target LAN addresses respectively corresponding to at least one network video recorder will be explained.
[0175] Figure 5 is a schematic flow chart of another equipment access method provided in the embodiments of the present application. On the basis of the above embodiments, for any one of the multiple network devices, reference may be made to Figure 5 , and this method includes:
[0176] S501. Initialize j to 1.
[0177] S502. In the address range corresponding to the network device, determine the j-th address, send a data acquisition request to the device corresponding to the j-th address, and receive the data acquisition response corresponding to the data acquisition request, where the data acquisition response includes the device information corresponding to the j-th address.
[0178] The j-th address can be determined in ascending order of the numerical values of the addresses within the address range, a data acquisition request is sent to the device corresponding to the j-th address through a preset protocol, and a data acquisition response corresponding to the data acquisition request is received through the preset protocol. The data acquisition response includes the device information corresponding to the j-th address.
[0179] S503. Determine whether the device information corresponding to the j-th address is the device information of a network video recorder.
[0180] If so, execute S504;
[0181] If not, execute S505.
[0182] The device information may include a device name, a device model, a device identifier, etc., which are not limited herein.
[0183] The device information can be input into a device type recognition model to determine whether the device information corresponding to the j-th address is the device information of a network video recorder.
[0184] It is possible to determine whether the device information corresponding to the j-th address is the device information of a network video recorder according to the device model or the device name or the device identifier.
[0185] It should be noted that it is possible to determine whether the device information corresponding to the j-th address is the device information of a network video recorder according to any feasible implementation manner, and the embodiments of the present application do not make limitations thereto.
[0186] S504. Determine the j-th address as the target local area network address.
[0187] S505. Determine whether j is less than M.
[0188] If so, execute S506;
[0189] If not, end.
[0190] M is the quantity corresponding to the address range, and M is a positive integer.
[0191] S506. Update j to j + 1.
[0192] After S506, execute S502.
[0193] In the embodiments of the present application, the implementation content of each step can refer to the description of the corresponding step or operation in the above method embodiment, and the repeated content will not be elaborated.
[0194] An equipment access method provided in this embodiment is as follows. For any network device, within the address range corresponding to the network device, the j-th address is determined, a data acquisition request is sent to the device corresponding to the j-th address, and a data acquisition response corresponding to the data acquisition request is received. The data acquisition response includes the device information corresponding to the j-th address. It is judged whether the device information corresponding to the j-th address is the device information of a network video recorder. If so, the j-th address is determined as the target local area network address. Here, j takes values of 1, 2,... in sequence until j is M or the j-th address is determined as the target local area network address. M is the quantity corresponding to the address range, and M is a positive integer. In this way, regardless of whether the network video recorder and the network camera are mounted under the same router, the network camera can quickly determine the target local area network address of the network video recorder through the address ranges corresponding to multiple detected network devices and access the network video recorder, improving the equipment access efficiency.
[0195] Next, in combination with Figure 6 , the process (S204) of accessing the target network video recorder in at least one network video recorder according to at least one target local area network address will be explained.
[0196] Figure 6 It is a schematic flowchart of another equipment access method provided in an embodiment of this application. On the basis of the above embodiment, refer to Figure 6 , this method includes:
[0197] S601. In response to a configuration operation by the user in the network camera, the device identifier and verification code are determined.
[0198] The configuration operation can be used for the user to input the configuration information of the target network video recorder to be accessed in the network camera.
[0199] The configuration information includes the device identifier and verification code of the target network video recorder to be accessed.
[0200] The device identifier and verification code can be used for permission authentication of the access request.
[0201] It is possible to determine the configuration information in response to a configuration operation by the user in the network camera, and determine the device identifier and verification code according to the configuration information.
[0202] S602. Generate a first access request according to the device identifier and verification code.
[0203] The first access request includes the device identifier and verification code.
[0204] It is possible to perform a packaging process on the device identifier and verification code to generate a first access request.
[0205] S603. Send a first access request to at least one network video recorder according to at least one target local area network address.
[0206] The first access request can be sent to at least one network video recorder respectively according to at least one target local area network address through a preset protocol.
[0207] S604. Receive the first access success response sent by the target network video recorder.
[0208] At least one network video recorder includes the target network video recorder.
[0209] The device identifier is the identifier of the target network video recorder.
[0210] The verification code is the verification code corresponding to the target network video recorder.
[0211] The target network video recorder is the network video recorder that sends the first access success response.
[0212] The network video recorder can receive the first access request, determine the device identifier and the verification code according to the first access request, perform verification processing on the device identifier and the verification code to obtain a verification result. If the verification result is passed, send a first access success response to the network camera. If the verification result is not passed, the network video recorder has no response.
[0213] The network camera can receive the first access success response sent by the target network video recorder through a preset protocol.
[0214] S605. Access the target network video recorder according to the first access success response.
[0215] A connection with the target network video recorder can be established according to the first access success response to access the target network video recorder.
[0216] After accessing the target network video recorder, the real-time monitoring screen, playback video, etc. of the network camera can be sent to the target network video recorder.
[0217] For the implementation content of each step in the embodiments of the present application, reference can be made to the description of the corresponding steps or operations in the above method embodiments, and the repeated content will not be elaborated.
[0218] A device access method provided in this embodiment determines a device identifier and a verification code by responding to a configuration operation of a user in a network camera; generates a first access request according to the device identifier and the verification code, where the first access request includes the device identifier and the verification code; sends the first access request to at least one network video recorder according to at least one target local area network address; receives a first access success response sent by a target network video recorder, where the at least one network video recorder includes the target network video recorder, the device identifier is the identifier of the target network video recorder, and the verification code is the verification code corresponding to the target network video recorder; and accesses the target network video recorder according to the first access success response. In this way, regardless of whether the network video recorder and the network camera are mounted under the same router, the network camera can quickly determine the target local area network address of the network video recorder and access the target network video recorder, improving the device access efficiency.
[0219] Next, with reference to Figure 7 , the process (S204) of accessing the target network video recorder in at least one network video recorder according to at least one target local area network address will be explained.
[0220] Figure 7 It is a schematic flowchart of another device access method provided in an embodiment of the present application. On the basis of the above embodiment, refer to Figure 7 , and this method includes:
[0221] S701. Send a second access request to at least one network video recorder according to at least one target local area network address.
[0222] The second access request is used to request an authentication instruction of the network video recorder.
[0223] The authentication instruction instructs the network video recorder to allow the network camera to access.
[0224] The second access request can be generated according to preset configuration information, and the second access request is sent to at least one network video recorder according to at least one target local area network address.
[0225] Among them, the preset configuration information may include a request format and protocol, as well as device information of the network camera, etc.
[0226] S702. Receive a second access success response corresponding to the second access request sent by the target network video recorder.
[0227] The second access success response includes an authentication instruction of the target network video recorder.
[0228] The target network video recorder is the network video recorder that sends the second access success response.
[0229] The second access success response corresponding to the second access request sent by the target network video recorder can be received through a preset protocol.
[0230] S703. Access the target network video recorder according to the second access success response.
[0231] A connection with the target network video recorder can be established according to the second access success response to access the target network video recorder.
[0232] After accessing the target network video recorder, the real-time monitoring screen, playback video, etc. of the network camera can be sent to the target network video recorder.
[0233] For the implementation content of each step in the embodiments of the present application, reference can be made to the description of the corresponding steps or operations in the above method embodiments, and repeated content will not be elaborated.
[0234] The device access method provided in this embodiment sends a second access request to at least one network video recorder according to at least one target local area network address. The second access request is used to request an authentication instruction of the network video recorder, and the authentication instruction instructs the network video recorder to allow the network camera to access; receive the second access success response corresponding to the second access request sent by the target network video recorder, and the second access success response includes the authentication instruction of the target network video recorder; access the target network video recorder according to the second access success response. In this way, regardless of whether the network video recorder and the network camera are mounted under the same router, the network camera can quickly determine the target local area network address of the network video recorder and access the target network video recorder, improving the device access efficiency.
[0235] Next, in combination with Figure 8 , the device access process on the network video recorder side will be explained.
[0236] Figure 8 It is a schematic flowchart of another device access method provided in the embodiments of the present application. On the basis of the above embodiments, reference can be made to Figure 8 , and the method includes:
[0237] S801. Receive a data acquisition request sent by the network camera.
[0238] The data acquisition request can be used to request the device information of the network video recorder.
[0239] The data acquisition request sent by the network camera can be received through a preset protocol.
[0240] S802. Send a data acquisition response to the network camera according to the data acquisition request.
[0241] The data acquisition response includes the device information of the network video recorder, and the device information is used for the network camera to determine the target local area network address of the network video recorder.
[0242] The access request can be parsed and processed to obtain the device identifier and the verification code; the device identifier and the verification code are verified to obtain the verification result; if the verification result is verification passed, a first access success response is sent to the network camera, and the network camera is connected to the network video recorder.
[0243] Among them, the verification result includes verification passed and verification failed.
[0244] The first access success response is used to indicate that the network video recorder allows the network camera to access.
[0245] The access request can be parsed and processed to generate an access confirmation interface; in response to the user's selection operation on the confirm access control in the confirmation interface, a second access success response is sent to the network camera, and the network camera is connected to the network video recorder.
[0246] Among them, the second access success response includes the authentication instruction of the network video recorder, and the authentication instruction indicates that the network video recorder allows the network camera to access.
[0247] The confirmation interface is used to confirm whether the user allows the network camera to access the network video recorder. The access confirmation interface includes a confirm access control and a reject access control.
[0248] S803. Receive the access request sent by the network camera according to the target local area network address.
[0249] The access request sent by the network camera according to the target local area network address can be received through a preset protocol.
[0250] S804. Connect the network camera to the network video recorder according to the access request.
[0251] The data acquisition request is: after the network camera detects the first local area network addresses of multiple network devices and the address ranges corresponding to each network device, it is sent to the network video recorder, and the local area network address of the device mounted under the network device is within the address range.
[0252] The first local area network address is determined by the network camera in the following way: determining multiple time-to-live (TTL) values of the packet; in the order of the multiple TTL values from small to large, according to the multiple TTL values, performing multiple packet detection processes until the first local area network addresses of multiple network devices are detected.
[0253] For the implementation content of each step in the embodiments of the present application, reference can be made to the description of the corresponding steps or operations in the above method embodiments, and repeated content will not be elaborated.
[0254] The device access method provided in this embodiment includes receiving a data acquisition request sent by the network camera; according to the data acquisition request, sending a data acquisition response to the network camera, where the data acquisition response includes device information of the network video recorder, and the device information is used for the network camera to determine the target LAN address of the network video recorder; receiving an access request sent by the network camera according to the target LAN address; and according to the access request, accessing the network camera in the network video recorder; where the data acquisition request is: after the network camera detects the first LAN addresses of multiple network devices and the address ranges corresponding to each network device, the network camera sends the data acquisition request to the network video recorder, and the LAN address of the device mounted under the network device is within the address range. In this way, regardless of whether the network video recorder and the network camera are mounted under the same router, the network camera can quickly determine the target LAN address of the network video recorder and access the target network video recorder, improving the device access efficiency.
[0255] Figure 9 The following is a schematic structural diagram of a device access device provided in an embodiment of the present application. Please refer to Figure 9 , applied to a network camera, the device access device 900 includes a first detection module 901, a determination module 902, a second detection module 903, and an access module 904, where
[0256] The first detection module 901 is configured to detect the first LAN addresses of multiple network devices, where the multiple network devices and the network camera are in the same local area network, the network devices are routing devices or gateway devices, and the first LAN address is the address corresponding to the network device in the local area network;
[0257] The determination module 902 is configured to, for any one of the network devices, obtain the subnet mask corresponding to the network device, and determine the address range corresponding to the network device according to the first LAN address of the network device and the subnet mask, where the LAN address of the device mounted under the network device is within the address range;
[0258] The second detection module 903 is configured to perform device detection processing according to the address ranges corresponding to the network devices, detect at least one network video recorder, and determine the target LAN addresses corresponding to the at least one network video recorder respectively, where the network video recorder is mounted under the multiple network devices;
[0259] The access module 904 is configured to access the target network video recorder in the at least one network video recorder according to at least one of the target LAN addresses.
[0260] In a possible implementation, the first detection module 901 is specifically configured to:
[0261] Determine multiple Time-To-Live (TTL) values of the packet;
[0262] According to the ascending order of the multiple TTL values, perform multiple packet detection processes based on the multiple TTL values until the first local area network (LAN) addresses of the multiple network devices are detected;
[0263] The step of performing multiple packet detection processes according to the ascending order of the multiple TTL values and based on the multiple TTL values until the first LAN addresses of the multiple network devices are detected includes:
[0264] Generate an i-th detection packet according to the i-th TTL, where the TTL of the detection packet is the i-th TTL;
[0265] Receive an i-th response packet corresponding to the i-th detection packet, where the i-th response packet includes the first LAN address of the i-th network device detected;
[0266] Wherein, i sequentially takes values of 1, 2,..., until i is N, or when the first LAN address detected is the LAN address of the gateway device, it is determined that the first LAN addresses of the multiple network devices are detected; N is the number of the multiple TTL values, and N is a positive integer.
[0267] In a possible implementation, the determination module 902 is specifically configured to:
[0268] Determine multiple second LAN addresses within the address range corresponding to each of the network devices;
[0269] For any one of the second LAN addresses, send a data acquisition request to the device corresponding to the second LAN address, and receive a data acquisition response corresponding to the data acquisition request, where the data acquisition response includes device information corresponding to the second LAN address;
[0270] Judge whether at least one network video recorder is mounted under the multiple network devices according to the device information;
[0271] If so, determine the second LAN addresses corresponding to the at least one network video recorder respectively as at least one target LAN address.
[0272] In a possible implementation, the determination module 902 is specifically configured to:
[0273] For any one of the network devices, in the address range corresponding to the network device, determine the j-th address, send a data acquisition request to the device corresponding to the j-th address, and receive a data acquisition response corresponding to the data acquisition request, where the data acquisition response includes device information corresponding to the j-th address;
[0274] Determine whether the device information corresponding to the j-th address is the device information of a network video recorder. If so, determine the j-th address as the target local area network address;
[0275] Wherein, j sequentially takes 1, 2,..., until j is M or the j-th address is determined as the target local area network address, M is the quantity corresponding to the address range, and M is a positive integer.
[0276] In a possible implementation manner, the access module 904 is specifically configured to:
[0277] In response to a configuration operation of the user in the network camera, determine a device identifier and a verification code;
[0278] Generate a first access request according to the device identifier and the verification code, where the first access request includes the device identifier and the verification code;
[0279] Send the first access request to at least one of the network video recorders according to at least one of the target local area network addresses;
[0280] Receive a first access success response sent by a target network video recorder, where the at least one network video recorder includes the target network video recorder, the device identifier is the identifier of the target network video recorder, and the verification code is the verification code corresponding to the target network video recorder;
[0281] Access the target network video recorder according to the first access success response.
[0282] In a possible implementation manner, the access module 904 is specifically configured to:
[0283] Send a second access request to at least one of the network video recorders according to at least one of the target local area network addresses, where the second access request is used to request an authentication instruction of the network video recorder, and the authentication instruction instructs the network video recorder to allow the network camera to access;
[0284] Receive a second access success response corresponding to the second access request sent by the target network video recorder, where the second access success response includes the authentication instruction of the target network video recorder;
[0285] Access the target network video recorder according to the second access success response.
[0286] Figure 10 This is a schematic structural diagram of another device access device provided by an embodiment of the present application. Please refer to Figure 10 , which is applied to a network video recorder. The device access device 1000 includes a receiving module 1001, a sending module 1002, and an access module 1003. Among them,
[0287] The receiving module 1001 is configured to receive a data acquisition request sent by the network camera;
[0288] The sending module 1002 is configured to send a data acquisition response to the network camera according to the data acquisition request. The data acquisition response includes device information of the network video recorder, and the device information is used by the network camera to determine the target local area network address of the network video recorder;
[0289] The receiving module 1001 is further configured to receive an access request sent by the network camera according to the target local area network address;
[0290] The access module 1003 is configured to access the network camera in the network video recorder according to the access request;
[0291] Among them, the data acquisition request is: after the network camera detects the first local area network addresses of multiple network devices and the address ranges corresponding to each network device, the data acquisition request is sent to the network video recorder, and the local area network address of the device mounted under the network device is within the address range.
[0292] In a possible implementation manner, the first local area network address is determined by the network camera in the following manner:
[0293] Determine multiple time-to-live (TTL) values of the packet;
[0294] According to the multiple TTL values in ascending order, perform multiple packet detection processes according to the multiple TTL values until the first local area network addresses of the multiple network devices are detected.
[0295] In a possible implementation manner, the access module 1003 is specifically configured to:
[0296] Parse the access request to obtain a device identifier and a verification code; perform a verification process on the device identifier and the verification code to obtain a verification result; if the verification result is verification passed, send a first access success response to the network camera and access the network camera in the network video recorder; where the first access success response is used to indicate that the network video recorder allows the network camera to access; or
[0297] Parse and process the access request to generate an access confirmation interface for confirming whether the user allows the network camera to access the network video recorder. The access confirmation interface includes an access confirmation control and a rejection access control. In response to the user's selection operation on the access confirmation control, send a second access success response to the network camera and access the network camera in the network video recorder. The second access success response includes an authentication instruction of the network video recorder, and the authentication instruction instructs the network video recorder to allow the network camera to access.
[0298] Figure 11 This is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Please refer to Figure 11 The electronic device 1100 may include: a memory 1101, a processor 1102, and a transceiver 1103.
[0299] The memory 1101 is used to store program instructions.
[0300] The processor 1102 is used to execute the program instructions stored in the memory to enable the electronic device 1100 to execute the above method.
[0301] The transceiver 1103 may include: a transmitter and / or a receiver. The transmitter may also be referred to as a sender, a transmitter, a transmission port, or a transmission interface, etc. The receiver may also be referred to as a receiver, a receiving port, or a receiving interface, etc. Exemplarily, the memory 1101, the processor 1102, and the transceiver 1103 are interconnected with each other through a bus 1104.
[0302] The embodiment of the present application also provides a computer program product, which can be executed by a processor. When the computer program product is executed, the above method can be implemented.
[0303] The device access device, the electronic device, the computer-readable storage medium, and the computer program product of the embodiment of the present application can execute the technical solutions shown in the embodiment of the above device access method. The implementation principle and the beneficial effects are similar, and will not be elaborated here.
[0304] All or part of the steps of the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a readable memory. When the program is executed, it performs the steps including the above method embodiments; and the foregoing memory (storage medium) includes: read-only memory (ROM), random access memory (RAM), flash memory, hard disk, solid state drive, magnetic tape, floppy disk, optical disc, and any combination thereof.
[0305] Embodiments of the present application are described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer-executable instructions. These computer-executable instructions can be provided to the processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device access device to generate a machine, such that the instructions executed by the processing unit of the computer or other programmable device access device generate a device for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0306] These computer-executable instructions can also be stored in a computer-readable memory that can direct a computer or other programmable device access device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0307] These computer-executable instructions can also be loaded onto a computer or other programmable device access device, such that a series of operation steps are performed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0308] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these changes and modifications.
Claims
1. A device access method, characterized in that, Applied to an IP camera, the method includes: Detecting first LAN addresses of multiple network devices. The multiple network devices and the IP camera are in the same local area network (LAN). The network devices are routing devices or gateway devices, and the first LAN address is the address corresponding to the network device within the LAN. For any one of the network devices, obtaining the subnet mask corresponding to the network device, and determining the address range corresponding to the network device according to the first LAN address and the subnet mask of the network device. The LAN addresses of the devices connected under the network device are within the address range. Performing device detection processing according to the address ranges corresponding to the network devices, detecting at least one network video recorder, and determining the target LAN addresses corresponding to the at least one network video recorder respectively. The network video recorders are connected under the multiple network devices. Accessing a target network video recorder among the at least one network video recorder according to at least one of the target LAN addresses.
2. The method according to claim 1, characterized in that Detecting first LAN addresses of multiple network devices includes: Determining multiple time-to-live (TTL) values of packets. Performing multiple packet detection processes in ascending order of the multiple TTL values until the first LAN addresses of the multiple network devices are detected. The performing multiple packet detection processes in ascending order of the multiple TTL values until the first LAN addresses of the multiple network devices are detected includes: Generating an i-th detection packet according to the i-th TTL, where the TTL of the detection packet is the i-th TTL. Receiving an i-th response packet corresponding to the i-th detection packet, where the i-th response packet includes the first LAN address of the i-th network device detected. Wherein, i sequentially takes values of 1, 2,..., until i is N, or when the detected first LAN address is the LAN address of the gateway device, it is determined that the first LAN addresses of the multiple network devices are detected. N is the number of the multiple TTL values, and N is a positive integer.
3. The method according to claim 1, wherein Performing device detection processing according to the address ranges corresponding to the network devices, detecting at least one network video recorder, and determining the target LAN addresses corresponding to the at least one network video recorder respectively includes: Determining multiple second LAN addresses within the address ranges corresponding to the network devices. For any one of the second LAN addresses, sending a data acquisition request to the device corresponding to the second LAN address, and receiving a data acquisition response corresponding to the data acquisition request. The data acquisition response includes device information corresponding to the second LAN address. Judging whether at least one network video recorder is connected under the multiple network devices according to the device information. If so, determining the second LAN addresses corresponding to the at least one network video recorder respectively as at least one target LAN address.
4. The method according to claim 1, wherein Perform device detection processing according to the address range corresponding to each of the network devices, detect at least one network video recorder, and determine the target LAN addresses respectively corresponding to the at least one network video recorder, including: For any one of the network devices, in the address range corresponding to the network device, determine the j-th address, send a data acquisition request to the device corresponding to the j-th address, and receive the data acquisition response corresponding to the data acquisition request, where the data acquisition response includes the device information of the device corresponding to the j-th address; Determine whether the device information corresponding to the j-th address is the device information of a network video recorder. If so, determine the j-th address as the target LAN address; Wherein, j sequentially takes 1, 2,..., until j is M or it is determined that the j-th address is the target LAN address, M is the quantity corresponding to the address range, and M is a positive integer.
5. The method according to any one of claims 1 to 4, characterized in that, Access the target network video recorder among the at least one network video recorder according to at least one of the target LAN addresses, including: In response to a configuration operation by the user in the network camera, determine the device identifier and the verification code; Generate a first access request according to the device identifier and the verification code, where the first access request includes the device identifier and the verification code; Send the first access request to the at least one network video recorder according to at least one of the target LAN addresses; Receive a first access success response sent by the target network video recorder, where the at least one network video recorder includes the target network video recorder, the device identifier is the identifier of the target network video recorder, and the verification code is the verification code corresponding to the target network video recorder; Access the target network video recorder according to the first access success response.
6. The method according to any one of claims 1-4, characterized in that Access the target network video recorder among the at least one network video recorder according to at least one of the target LAN addresses, including: Send a second access request to the at least one network video recorder according to at least one of the target LAN addresses, where the second access request is used to request an authentication instruction of the network video recorder, and the authentication instruction instructs the network video recorder to allow the network camera to access; Receive a second access success response corresponding to the second access request sent by the target network video recorder, where the second access success response includes the authentication instruction of the target network video recorder; Access the target network video recorder according to the second access success response.
7. A device access method, characterized in that, Applied to a network video recorder, the method includes: Receive the data acquisition request sent by the network camera; Send a data acquisition response to the network camera according to the data acquisition request, where the data acquisition response includes the device information of the network video recorder, and the device information is used by the network camera to determine the target LAN address of the network video recorder; Receive the access request sent by the network camera according to the target LAN address; Access the network camera in the network video recorder according to the access request. Among them, the data acquisition request is sent by the network camera to the network video recorder after detecting the first local area network addresses of multiple network devices and the address ranges corresponding to each network device, and the local area network address of the device mounted under the network device is within the address range.
8. The method according to claim 7, wherein The first local area network address is determined by the network camera in the following manner: Determine multiple time-to-live (TTL) values of the packet; According to the order of the multiple TTLs from small to large, perform multiple packet detection processes based on the multiple TTLs until the first local area network addresses of the multiple network devices are detected.
9. The method according to claim 7 or 8, characterized in that, Connecting the network camera to the network video recorder according to the access request includes: Performing parsing processing on the access request to obtain a device identifier and a verification code; performing verification processing on the device identifier and the verification code to obtain a verification result; if the verification result is verification passed, sending a first access success response to the network camera and connecting the network camera to the network video recorder; where the first access success response is used to indicate that the network video recorder allows the network camera to access; or Performing parsing processing on the access request to generate an access confirmation interface, the confirmation interface is used to confirm whether the user allows the network camera to access the network video recorder, the access confirmation interface includes an access confirmation control and a reject access control; in response to the user's selection operation on the access confirmation control, sending a second access success response to the network camera and connecting the network camera to the network video recorder; where the second access success response includes an authentication instruction of the network video recorder, and the authentication instruction indicates that the network video recorder allows the network camera to access.
10. An electronic device, characterized in that, It includes: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 6 or the method according to any one of claims 7 to 9.