Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The application is illustrated below with reference to examples:
According to an aspect of the embodiment of the present application, there is provided a connection method of devices, alternatively, in this embodiment, the connection method of devices described above may be applied to a hardware environment constituted by a server 101 and a terminal device 103 as shown in fig. 1. As shown in fig. 1, a server 101 is connected to a terminal device 103 via a network, and can be used to provide services to the terminal device or an application 107 installed on the terminal device, such as a video application, an instant messaging application, a browser application, an educational application, a game application, and the like. The database 105 may be provided on a server or independent of the server, and may be used to provide a data storage service for the server 101, for example, a game data storage server, where the above network may include, but is not limited to, a wired network, a wireless network, where the wired network includes a local area network, a metropolitan area network, and a wide area network, where the wireless network includes a bluetooth, WIFI, and other networks implementing wireless communication, and the terminal device 103 may be a terminal configured with an application program, and may include, but is not limited to, at least one of a Mobile phone (such as an Android Mobile phone, an iOS Mobile phone, etc.), a notebook computer, a tablet computer, a palm computer, a MID (Mobile INTERNET DEVICES, a Mobile internet device), a PAD, a desktop computer, a smart television, a smart voice interaction device, a smart home appliance, a vehicle-mounted terminal, an aircraft, a Virtual Reality (VR) terminal, an augmented Reality (Augmented Reality, an AR) terminal, a Mixed Reality (MR) terminal, etc., where the above server may be a single server, or may be a cloud server.
As shown in fig. 1, the connection method of the above-mentioned devices may be performed by an electronic device, which may be a terminal device or a server, and the connection method of the above-mentioned devices may be implemented by the terminal device or the server, respectively, or by both the terminal device and the server.
The above is merely an example, and the present embodiment is not particularly limited.
Optionally, as an optional embodiment, as shown in fig. 2, the connection method of the device includes:
S202, responding to connection of at least one network power supply device with a back-end device through a target port corresponding to a target switch, and setting a corresponding network address for each network power supply device in the at least one network power supply device based on a dynamic host configuration protocol;
Optionally, in the embodiment of the present application, the network power supply device refers to a device that receives power and transmits data through an ethernet cable, including but not limited to a POE camera, a network sensor, and the like, the target switch refers to a network device located between a back-end device and a network power supply device, and is used for implementing data forwarding between the back-end device and the network power supply device, including but not limited to a two-layer or three-layer switch, the back-end device is a device for storing and processing data, including but not limited to a network hard disk video recorder (NVR), a server, various intelligent terminal devices, and the like, and is responsible for receiving and managing data uploaded by the front-end device, the target port refers to a port on the target switch that is directly connected to the back-end device, and is used for performing data interaction with the network power supply device, and the dynamic host configuration protocol, that is DHCP, is a protocol that allows the server to dynamically allocate network configuration parameters (such as IP addresses) to a client.
In an application scenario of an IP monitoring system, when an NVR is connected to a target switch through a target port and a plurality of POE cameras (network power supply devices) are connected under the switch, a DHCP server on the NVR automatically allocates a unique IP address to each POE camera in response to the connection of the plurality of POE cameras, and in the allocation process, the NVR intelligently binds the IP address with the switch port according to the sequence of the connection of the POE cameras and the current port usage, so as to ensure that each POE camera in the plurality of POE cameras can obtain an IP address in the same network segment, thereby forming a clear device map on the NVR and realizing automatic online and data transmission.
In an exemplary embodiment, fig. 3 is a schematic diagram of an alternative connection method of devices according to an embodiment of the present application, as shown in fig. 3, including a network power supply device, a backend device, and a target switch, where 3 POE cameras are connected under the target switch as the network power supply device, and the target switch is connected to the backend device through a target port.
It should be noted that, in the embodiment of the present application, the process of obtaining the network address by the network power supply device through DHCP may be automatically triggered when the device is first accessed, or may be a periodic re-request to adapt to a change of a network environment or reconfiguration of the device, which is not limited in any way.
It should be further noted that the application of the dynamic host configuration protocol is not limited to IP address assignment, but may be extended to other network configuration parameters, such as subnet mask, default gateway, etc., so as to provide a more comprehensive automatic configuration service for the network device for the user, and the target switch may be of any type capable of supporting DHCP relay or proxy functions, so that the NVR can indirectly assign an address to the network power supply device connected thereto, and meanwhile, the ports of the backend device may include, but are not limited to, POE ports, or other network ports capable of transmitting data.
S204, generating a first network address and a second network address in the case that at least one network power supply device comprises a first network power supply device and a second network power supply device, wherein the first network address and the second network address are in the same network segment;
Optionally, in the embodiment of the present application, the at least one network power supply device refers to a plurality of network devices powered by ethernet, including but not limited to POE cameras, network phones, wireless access points, and the like, the first network power supply device and the second network power supply device represent network power supply devices accessing the backend device through the target switch, and the first network address and the second network address refer to network addresses for network communication generated by the first network power supply device and the second network power supply device, where the first network address and the second network address are located in a same network segment.
In an application scenario of the video monitoring system, it is assumed that a network hard disk recorder (a back-end device) is connected to a plurality of network power supply devices (including a first network power supply device and a second network power supply device) through a POE switch (a target switch), when the first network power supply device (such as POE camera a) accesses the POE switch, a DHCP server on the network hard disk recorder immediately responds, and a specific IP address, that is, a first network address, is allocated to the POE camera a.
Likewise, when the second network power supply device (such as POE camera B) is also connected to the same POE switch, the network hard disk video recorder continues to generate a second network address for POE camera B, which is also located in the network segment, so as to ensure that POE camera A, POE camera B can communicate with the network hard disk video recorder independently, and automatic online and data transmission can be realized without additional network configuration adjustment, including but not limited to pulling and monitoring of video data.
It should be noted that, in the embodiment of the present application, the same network segment refers to a group of IP addresses with the same network prefix, and these IP addresses may be directly communicated with each other without forwarding through an intermediate routing device, in addition, the embodiment of the present application may dynamically generate the first network address and the second network address, in other words, each time the network power supply device requests to access the backend device, a corresponding network address may be automatically allocated to the network power supply device, or may be pre-planned, including but not limited to presetting an address pool according to the access sequence or type of the device, so as to implement finer network resource management.
It should be further noted that, the above-mentioned backend device is not only used for network address allocation of the network power supply device, but also used for device status monitoring, fault diagnosis, security policy implementation, etc. of the network power supply device, and the present application is not limited in particular to the access sequence and type of the above-mentioned network power supply device.
S206, binding a target port with the first network power supply equipment based on a first network address and binding an idle port with the second network power supply equipment based on a second network address under the condition that the first network power supply equipment establishes connection with the back-end equipment before the second network power supply equipment, wherein the idle port represents a port which does not participate in data transmission in a plurality of ports corresponding to the back-end equipment;
Optionally, in the embodiment of the present application, the idle port refers to a port in the backend device that is not occupied by other devices for data transmission, and may include, but is not limited to, a POE port or other types of network ports.
In a video monitoring system, it is assumed that an NVR (back-end device) is connected to a POE switch (target switch) through a target port, when a first POE camera (as a first network power supply device) accesses the POE switch for the first time and sends a DHCP request, a DHCP server on the NVR responds to and assigns a first network address to the first POE camera, the NVR binds the target port to the network address of the first POE camera, so as to realize automatic identification of the device and directional transmission of a data stream, and then when a second POE camera (as a second network power supply device) accesses the same POE switch, the NVR automatically detects that a new device connection request is generated, and based on the second network address, the NVR binds an unoccupied idle port with the second POE camera, so as to ensure that the second device can also independently exchange data with the NVR.
It should be noted that, the port allocation and device binding policy of the back-end device may also be performed according to a specific network environment and device type, for example, when receiving multiple network power supply device connection requests at the same time, the back-end device may preferentially use a high bandwidth port to bind with a high definition network power supply device to optimize video transmission quality, and in turn allocate other network power supply devices to an idle port to bind, where in addition, the back-end device may have multiple network interfaces, and different interfaces may serve different types or functions of network power supply devices.
In other words, the connection of the back-end device before the back-end device can be adjusted according to the access time, and possibly based on the priority of the device or the network policy, so as to ensure that the important or high-demand network power supply device can obtain the service preferentially.
S208, pulling preview pictures of the first network power supply equipment and the second network power supply equipment based on the target port and the idle port.
Optionally, in an embodiment of the present application, the preview screen refers to a video stream or an image captured by the network power supply device and transmitted to the backend device.
In an extended application scenario of the home monitoring system, it is assumed that a home user has an NVR (back-end device) and is connected to a POE switch (target switch) through a target port thereof, when the user accesses an IP camera (as a first network power supply device) to the POE switch for the first time, the NVR allocates a network address to the IP camera based on DHCP, and then establishes communication with a new device through the target port, starts to pull a real-time video stream transmitted by the camera, i.e., a preview picture, and is presented on a monitoring screen connected to the NVR;
Then, in order to further expand the monitoring range, the user accesses the second IP camera (as the second network power supply device) to the same POE switch, at this time, the NVR automatically detects a new device connection, allocates a network address to the second camera based on DHCP, and then establishes a connection with the second camera by using the idle port, and starts pulling the preview screen of the second camera.
In an exemplary embodiment, fig. 4 is a flowchart of an alternative method for connecting devices according to an embodiment of the present application, where in a video monitoring application scenario, for a backend device, as shown in fig. 4:
S402, starting;
S404, the back-end equipment initiates broadcast searching through an application protocol (which can be a user-defined searching protocol or a standard onvif searching protocol, etc.);
S406, an online network power supply device (comprising the network power supply device) in the network responds;
S408, the back-end equipment stores all online equipment reply information (the information comprises physical address, network address information, ports used by streaming and other necessary information records) into a mapping table 1;
For a network powered device, as shown in fig. 4:
s410, starting the network power supply equipment, and discovering a DHCP (dynamic host configuration protocol) server;
s412, the DHCP processes of the network power supply equipment and the back-end equipment negotiate and allocate a designated network address;
S414, the similar switch self-learning algorithm automatically establishes a plurality of mapping relations < MAC, IP > (physical address, network address) and ports for binding;
s416, storing the mapping relation into a mapping table 2, wherein the mapping table 2 comprises a plurality of pairs of physical addresses and mapping relation among network addresses;
It should be noted that any of the steps S402 to S408 and any of the steps S410 to S416 may be performed synchronously, and no sequence exists, for example, the steps S402 and S410 may be performed at the same time, which is not limited in the present application.
Further, after the above mapping table 1 and mapping table 2 are obtained, the following operations may be performed as shown in fig. 4:
S418, using MAC-IP as a key value to compare mapping table 1 with mapping table 2, if the comparison is successful, the mapping table 1 is used as network power supply equipment, and the subsequent processing is carried out according to the rest information of the mapping table 2 and mapping table 1 (the hardware port, the stream pulling port and the stream pulling protocol of the network power supply equipment are used for stream pulling preview, so as to realize the automatic online function and add the stream pulling preview to the corresponding port channel);
S420, ending.
According to the embodiment of the application, in response to the connection of at least one network power supply device with a back-end device through a target port corresponding to a target switch, a corresponding network address is set for each network power supply device in the at least one network power supply device based on a dynamic host configuration protocol, under the condition that the at least one network power supply device comprises a first network power supply device and a second network power supply device, a first network address and a second network address are generated under the same network segment, under the condition that the first network power supply device is connected with the back-end device before the second network power supply device, the target port is bound with the first network power supply device based on the first network address, the idle port is bound with the second network power supply device based on the second network address, and a preview picture of the first network power supply device and the second network power supply device is pulled based on the target port and the idle port.
As an alternative scheme, the method for setting a corresponding network address for each of the at least one network power supply device based on a dynamic host configuration protocol includes establishing a connection between the at least one network power supply device and a target switch and allocating the target port to the target switch, creating a server on the at least one network power supply device according to the dynamic host configuration protocol and managing a network address pool through the server to allocate a network address to the network power supply device requesting connection, and setting a corresponding network address for the network power supply device based on negotiation of the dynamic host configuration protocol in response to the network power supply device being connected to the at least one network power supply device through the target port.
Optionally, in the embodiment of the present application, the network address pool is an IP address set managed by a DHCP server and is used for dynamically allocating to the network power supply device requesting connection, and negotiation between the backend device and the network power supply device may be understood as an interaction process between the network power supply device and the DHCP server of the backend device, so as to obtain network configuration parameters (such as information of an IP network address, etc.) corresponding to the network power supply device.
In an application scenario of enterprise-level video monitoring deployment, a physical connection between an NVR (backend device) and a target switch is established through a network cable, a target port is set on the NVR and is used for receiving and managing cascaded network power supply devices, then a DHCP server is started on the NVR, the network address pool is created, the network address pool comprises a plurality of IP addresses prepared in advance and located in a preset network segment and used for being distributed to network power supply devices which subsequently access the NVR, when a certain network power supply device is connected to the target switch and requests data communication with the NVR through the target switch, the DHCP server on the NVR responds to the request of the network power supply device and automatically distributes an IP address to the network power supply device through negotiation, so that the network power supply device can be enabled to be connected and begin transmitting video streams.
It should be noted that, the size of the network address pool, the range of the network segment, and the access sequence and type of the device are not limited in the embodiments of the present application, and may include, but not limited to, adjusting the network environment and the requirements of a specific service scenario to achieve optimal network resource allocation and management.
In an exemplary embodiment, assuming that a retail store wishes to install POE cameras at each corner to enhance in-store monitoring, but the number of POE ports of the NVR is limited, in this service scenario, through the embodiment of the present application, the NVR may be connected to a target switch having multiple POE ports through the target port, then a DHCP service is started on the NVR, creating a network address pool containing multiple IP addresses, when the POE camera accesses any port of the switch, the DHCP server of the NVR automatically allocates the first available IP address in response to a request thereof, and binds the network address of the POE camera with the target port, and then, when more network power devices (which may be POE devices of the same type, or may be other types of devices, such as a sensor, etc.) access different ports of the switch, the NVR continuously allocates network addresses for them, so as to implement automatic online and monitoring service deployment of multiple devices.
According to the embodiment of the application, the DHCP protocol is matched with the target switch, so that the network configuration of the network power supply equipment is automatically managed by the back-end equipment, the purpose of efficiently expanding the number of the network power supply equipment at the front end under the limited port resources of the back-end equipment is achieved, and meanwhile, the independence among the network power supply equipment and the stability of network communication are ensured.
As an alternative, the method for binding the target port and the first network power supply device based on the first network address and binding the idle port and the second network power supply device based on the second network address when the first network power supply device establishes a connection with the back-end device earlier than the second network power supply device, includes generating a first mapping relationship between the first network address and the target port based on a switch self-learning algorithm when the first network power supply device establishes a connection with the back-end device, acquiring the idle port when the second network power supply device establishes a connection with the back-end device, generating a second mapping relationship between the second network address and the idle port based on the switch self-learning algorithm, and storing a record form corresponding to the back-end device in the first mapping relationship and the second mapping relationship so as to bind the target port and the first network power supply device and binding the idle port and the second power supply device.
Optionally, in the embodiment of the present application, the switch self-learning algorithm is a network management mechanism, and is used for automatically learning and recording a correspondence between a MAC address of a network device and a network port to optimize a data forwarding path, where the recording form refers to a database or a list in the back-end device, where the database or the list is used for storing a network mapping relationship.
In an exemplary deployment scenario of an intelligent traffic monitoring system (ITS), a traffic monitoring center uses an NVR as a back-end device, and is connected to a POE switch (target switch) supporting POE functions through a target port, when a first IP camera (serving as a first network power supply device) accesses the POE switch, a DHCP server on the NVR allocates a first network address to the POE switch, and at the same time, the NVR enables a switch self-learning algorithm, automatically detects and establishes a one-to-one mapping relationship between the first network address and the target port, records the one-to-one mapping relationship in a database of the NVR, and ensures smooth data communication with the first IP camera.
Then, when a second IP camera (serving as second network power supply equipment) accesses to different ports of the same POE switch, the NVR automatically detects a connection request of the equipment, selects one of the idle ports for data transmission, and distributes a second network address for the second IP camera through DHCP, and at the moment, the NVR generates and stores a mapping relation between the second network address and the idle ports by applying a switch self-learning algorithm again, so that independent communication of the second IP camera is ensured.
It should be noted that, in the embodiment of the present application, connection and address allocation between the network power supply device and the backend device may also be implemented by, but not limited to, an automation script, a network protocol (such as ARP, ICMP, etc.), and a security policy matching method.
It should be noted that, the storage and management of the first mapping relationship and the second mapping relationship are not limited to form, but may be other data structures, such as hash table or tree structure, which is not limited in any way by the present application.
According to the embodiment of the application, the mode of combining the self-learning algorithm of the switch and the DHCP protocol is adopted, so that the network mapping relation of the network power supply equipment is automatically managed and maintained by the back-end equipment, the purposes of automatic identification and high-efficiency communication in a multi-cascade equipment environment are achieved, and the complexity and cost of the network management of the back-end equipment are reduced.
The method comprises the steps of receiving a request from a second network power supply device, wherein the request comprises a request from a second network power supply device, and the request comprises a request from the second network power supply device, wherein the request comprises a request from the second network power supply device, and the request comprises a request from the second network power supply device.
Optionally, in the embodiment of the present application, the preset application protocol refers to a network protocol used for searching and managing a front-end device, including but not limited to an ONVIF protocol, a PSIA protocol, a custom search protocol, and the like, where the preset application protocol allows the back-end device to actively initiate a search request to discover and manage the front-end device in a network, the target lan may be understood as a specific network environment where the back-end device communicates with a network power supply device, such as an office, a home, a warehouse, or any network communication area with an internal network connection, the online network power supply device refers to a front-end device that is currently running in the target lan and is capable of responding to a network search request, including but not limited to a POE camera, a network sensor, and the like, the network address refers to an IP address allocated to the network power supply device, the physical address refers to an MAC address allocated to the network power supply device, the port used on the back-end device is currently communicating with a certain network power supply device, and the port set of ports refers to a network port available for data transmission owned by the back-end device.
In an application scenario of smart city public security monitoring, for example, the NVR actively initiates a broadcast search through a preset application protocol (such as ONVIF) as a back-end device to determine a network power supply device (such as a POE IP camera installed on a street or square) currently on-line in a target local area network (such as a city monitoring network).
Further, under the condition that the online network power supply equipment is determined, the NVR can continuously acquire the network address (IP address), the physical address (MAC address) and the currently-communicating use port of each online network power supply equipment, intelligently analyze and determine the idle ports based on the current use port information and the set of all available ports of the NVR, reserve the idle ports for other network power supply equipment, and ensure the smoothness of network communication and the high efficiency of equipment management.
By adopting the mode of active searching and intelligent port management of the preset application protocol, the embodiment of the application realizes the technical effect of dynamically expanding the network data communication coverage range under the condition of not interrupting the existing data communication service, achieves the purpose of intelligently and efficiently configuring and managing the network power supply equipment, and further realizes the technical effect of improving the resource utilization rate.
The method for storing the first mapping relation and the second mapping relation in the record form corresponding to the back-end device to enable the target port to be bound with the first network power supply device, and the idle port to be bound with the second network power supply device comprises the steps of storing the first mapping relation and the second mapping relation in the record form corresponding to the back-end device, traversing the record form according to a first address pair and a second address pair, binding the target port with the first address pair, and binding the idle port with the second address pair, wherein the first address pair comprises the first network address and a first physical address with the mapping relation, and the second address pair comprises the second network address and a second physical address with the mapping relation.
Optionally, in an embodiment of the present application, the first address pair and the second address pair refer to a combination of a network address and a physical address that establish a mapping relationship.
It should be noted that in the embodiment of the present application, the first mapping relationship and the second mapping relationship may be stored in a record form according to different network architectures and configurations of the backend device, for example, a distributed database is used to efficiently store and retrieve a large amount of mapping information, and the record form may be queried based on multiple traversal search algorithms, including but not limited to linear search, binary search, hash search, and the like.
In one exemplary embodiment, assuming that a school is upgrading its video monitoring system, an NVR is used as a back-end device and is connected to a POE switch (target switch) through a target port, and a plurality of POE IP cameras (network power supply devices) are cascaded under the switch, then, the NVR generates a first mapping relationship and a second mapping relationship based on a switch self-learning algorithm, in other words, saves a network address (IP) and a physical address (MAC) of each POE IP camera and switch port information connected thereto to a record form.
Further, if a new POE IP camera is accessed, the NVR traverses the record form, and searches for a first address pair and a second address pair, that is, a combination of a network address and a physical address, so as to bind the target port with the first address pair and bind the idle port with the second address pair.
According to the embodiment of the application, a mode of combining the self-learning algorithm of the switch with the recording form is adopted, so that each network power supply device is ensured to have an independent communication port, the distribution of a data transmission path and network resources is optimized, the resource conflict among devices is avoided, on the other hand, the management flow of the back-end device is simplified, and the network operation and maintenance cost is reduced.
As an alternative scheme, the response that at least one network power supply device is connected with a back-end device through a target port corresponding to a target switch, a corresponding network address is set for each network power supply device in the at least one network power supply device based on a dynamic host configuration protocol, the response comprises the steps of receiving a broadcast message initiated by the at least one network power supply device when a network port of the at least one network power supply device is inserted into a power supply network port of the back-end device, establishing connection between the back-end device and the target switch based on the broadcast message, distributing the target port to the target switch, determining that the at least one network power supply device is connected with the back-end device, and setting a corresponding network address for each network power supply device in the at least one network power supply device based on the dynamic host configuration protocol.
Optionally, in the embodiment of the present application, the power supply network port refers to a port with a POE power supply function on a back-end device, and the broadcast message may be understood as a discovery request, such as DHCPdiscover message, sent by the network power supply device when the network power supply device is started or when network configuration is required.
In an exemplary embodiment, it is assumed that an NVR is used as a back-end device, a POE switch (target switch) is connected through a power supply network port, and multiple POE IP cameras are cascaded under the switch to be used as network power supply devices, when any POE IP camera accesses to a POE port of the switch, a broadcast message (such as DHCPdiscover) will be automatically sent, after receiving these messages, a DHCP server on the NVR immediately responds, and based on the broadcast message, a connection between the NVR and the target switch is established, and at the same time, a target port is allocated to the switch, and for the NVR, a unique network address may also be allocated to each POE IP camera accessed through a DHCP protocol.
It should be noted that, in the embodiment of the present application, the allocation policy of the network address may include, but is not limited to, dynamic allocation, static allocation, or hybrid allocation.
According to the embodiment of the application, the dynamic host configuration protocol is combined with the switch self-learning algorithm, so that the network address of the network power supply equipment is automatically identified and configured by the back-end equipment, and the utilization rate of network resources is effectively improved.
In an exemplary embodiment, the method and the device can be applied to an application environment of a back-end device cascading POE front-end device, can solve the technical problem that POE devices (the network power supply devices) cannot be automatically online and can normally outflow at the same time, and can also receive data transmitted by a plurality of POE devices under a network hard disk video recorder with a single POE port.
Taking a network hard disk video recorder NVR as an example of a back-end device, fig. 5 is a device connection schematic diagram of an alternative device connection method according to an embodiment of the present application, as shown in fig. 5, the network hard disk video recorder may be provided with a plurality of common main network ports and POE network ports, where the network hard disk video recorder may be directly connected with a network camera through the common main network ports, and after the network hard disk video recorder receives an add request of a device, connection with the network camera is established to obtain a monitoring picture of the network camera, and furthermore, the network hard disk video recorder may also automatically add a POE camera (the above network power supply device) through the POE network ports to perform a monitoring service.
It should be noted that, in the related art, if the network hard disk video recorder needs to obtain video pictures of 3 POE cameras at the same time, 3 POE ports need to be provided by itself to access 3 POE cameras, that is, under the condition that no POE ports are added, the network hard disk video recorder cannot meet the requirement that a plurality of POE cameras automatically access services, even if an application scenario is as shown in fig. 3, a switch is set to cascade 3 POE cameras, the existing related art also only receives video pictures transmitted by one POE camera corresponding to the POE1 port by judging which POE camera is firstly broadcast, searching and replying to be on line and marking as the POE1 port, and resource contention inevitably occurs between the 3 POE cameras.
In other words, in the prior art, a POE device under a POE network card of a back-end device is searched by using an ARP (address resolution protocol) broadcast packet, then, a designated network address is set to a designated POE camera through ARP, whether the network address is connected or not can be judged through a ping instruction, if the network address is connected, the self-learning is considered to be successful, the pair of IP address and MAC address is recorded, one POE camera is accessed to a POE network port of a network hard disk video recorder, the pair of IP address and MAC address is bound to a port of the POE, and if another POE camera is accessed to another POE network port, a corresponding pair of IP address and MAC address is obtained in the same way and bound to a port of another POE.
Further, because different POE cameras are bound with different POE ports, the number of local video channels converted into the network hard disk video recorder by the corresponding POE ports can be multiple, however, if the device crosses the switch to perform data communication once and passes the window period, the ARP distribution IP mechanism will fail, in general, in the prior art, only one POE port of the back-end device can store the camera information of one POE, only one POE port can return one IP address and MAC information, which cannot meet the service requirement of the application layer.
In view of this technical problem, the present application proposes a way of using DHCP to allocate a network address and automatically gradually building a frame exchange table (the above-mentioned recording table) based on a self-learning algorithm of a switch, so as to solve the technical problem that a network power supply device cannot be simultaneously on line in the case that a back-end device cascades the network power supply device, and in addition, for a back-end device without multiple POE ports, one gateway device (the above-mentioned target switch) may be cascade-connected through one POE port, and multiple network power supply devices are downloaded and mounted by the gateway device, specifically:
S1, when a POE camera network port is inserted into a network hard disk video recorder POE network port, waiting for the POE camera to initiate a DHCP broadcast message (in the stages of DHCP discovery (DHCPDISCOVER), providing (DHCPOFFER), requesting (DHCPREQUEST) and confirming (DHCPACK)), searching a DHCP server, namely a DHCP server end of the network hard disk video recorder, and allocating an IP address to the POE camera for replying by the network hard disk video recorder, and waiting for the POE camera to respond to successfully set the IP address;
S2, for a switch cascaded by POE network ports of the network hard disk video recorder, the IP address and the MAC address of the POE camera can be obtained in a message with successful IP address setting, the MAC-IP pair is bound to the POE port, and if another POE camera is accessed to the switch, the information of the port switch of the same POE for MAC and IP discovery can be obtained and also bound to the POE port.
S3, because the first POE camera and the second POE camera are both bound with the same POE port, the corresponding POE port is converted into a local video channel C1 of the network hard disk video recorder, the local video channel C1 can be added to the POE camera on line first and recorded as POE1-1, the POE camera on line later can search and determine a channel corresponding to an idle port (not POE port and POE port can be both) to add a pull stream service number POE1-2, the pull stream preview service is carried out under different channels under the cascade condition, the technical problem that the network cameras of different network segments can not be automatically added in time through other schemes is solved, and the network port positioning range corresponding to the POE camera is primarily narrowed according to the number POE1-1 and the like.
It should be noted that, aiming at the technical problems that the back-end device and the camera are in the same local area network but different in network segments, even if the operation such as stream pulling and configuration acquisition is not possible, the embodiment of the application can solve the problems by controlling the network address of the camera to be modified to be in the same network segment with the POE network port, thereby realizing the operations such as automatic addition, stream pulling and configuration acquisition preview.
It will be appreciated that in the specific embodiments of the present application, related data such as user information is involved, and when the above embodiments of the present application are applied to specific products or technologies, user permissions or consents need to be obtained, and the collection, use and processing of related data need to comply with related laws and regulations and standards of related countries and regions.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
According to another aspect of the embodiment of the present application, there is also provided a connection device for implementing the connection method of the device. As shown in fig. 6, the apparatus includes:
A setting module 602, configured to set, in response to the at least one network power supply device being connected to the backend device through a target port corresponding to the target switch, a corresponding network address for each of the at least one network power supply device based on a dynamic host configuration protocol;
A generating module 604, configured to generate a first network address and a second network address in a case where the at least one network power supply device includes a first network power supply device and a second network power supply device, where the first network address and the second network address are in a same network segment;
a binding module 606, configured to bind, when the first network power supply device establishes a connection with the back-end device before the second network power supply device, the target port with the first network power supply device based on the first network address, and bind, based on the second network address, the idle port with the second network power supply device, where the idle port represents a port that does not participate in data transmission in a plurality of ports corresponding to the back-end device;
and a pulling module 608, configured to pull the preview frames of the first network power supply device and the second network power supply device based on the target port and the idle port.
As an alternative, the device is used for responding that at least one network power supply device is connected with the back-end device through a target port corresponding to a target switch, setting a corresponding network address for each network power supply device in the at least one network power supply device based on a dynamic host configuration protocol, establishing connection between the back-end device and the target switch, distributing the target port for the target switch, creating a server on the back-end device according to the dynamic host configuration protocol, managing a network address pool through the server to distribute network addresses to the network power supply devices requesting connection, responding that the network power supply device is connected with the back-end device through the target port, negotiating with the network power supply device based on the dynamic host configuration protocol, and setting the corresponding network addresses for the network power supply devices.
As an alternative scheme, the device is used for binding a target port with first network power supply equipment based on a first network address and binding an idle port with second network power supply equipment based on a second network address when the first network power supply equipment is connected with the back-end equipment before the second network power supply equipment is connected with the back-end equipment, generating a first mapping relation between the first network address and the target port based on a switch self-learning algorithm when the first network power supply equipment is connected with the back-end equipment, acquiring the idle port when the second network power supply equipment is connected with the back-end equipment, generating a second mapping relation between the second network address and the idle port based on the switch self-learning algorithm, and storing the first mapping relation and the second mapping relation in a record form corresponding to the back-end equipment so that the target port is bound with the first network power supply equipment and the idle port is bound with the second network power supply equipment.
The device is used for acquiring the idle port under the condition that the second network power supply equipment and the back-end equipment are connected, and the idle port is determined based on the use port and a port set configured for the back-end equipment.
The device is used for storing a first mapping relation and a second mapping relation to a record form corresponding to the back-end device so that the target port is bound with the first network power supply device, the idle port is bound with the second network power supply device, the first mapping relation and the second mapping relation are stored to the record form corresponding to the back-end device, traversing is carried out on the record form according to a first address pair and a second address pair, the target port is bound with the first address pair, and the idle port is bound with the second address pair, wherein the first address pair comprises a first network address and a first physical address with the mapping relation, and the second address pair comprises a second network address and a second physical address with the mapping relation.
As an alternative scheme, the device is used for responding to the fact that at least one network power supply device is connected with the back-end device through a target port corresponding to the target switch, setting a corresponding network address for each network power supply device in the at least one network power supply device based on a dynamic host configuration protocol, receiving a broadcast message initiated by the at least one network power supply device when a network port of the at least one network power supply device is inserted into a power supply network port of the back-end device, establishing connection between the back-end device and the target switch based on the broadcast message, distributing the target port for the target switch, and determining that the at least one network power supply device is connected with the back-end device, and setting the corresponding network address for each network power supply device in the at least one network power supply device based on the dynamic host configuration protocol.
In the present embodiment, the term "module" or "unit" refers to a computer program or a part of a computer program having a predetermined function and working together with other relevant parts to achieve a predetermined object, and may be implemented in whole or in part by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Also, a processor (or multiple processors or memories) may be used to implement one or more modules or units. Furthermore, each module or unit may be part of an overall module or unit that incorporates the functionality of the module or unit.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
Fig. 7 schematically shows a block diagram of a computer system of an electronic device for implementing an embodiment of the application.
It should be noted that, the computer system 700 of the electronic device shown in fig. 7 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 7, the computer system 700 includes a central processing unit 701 (Central Processing Unit, CPU) which can perform various appropriate actions and processes according to a program stored in a Read-Only Memory 702 (ROM) or a program loaded from a storage section 708 into a random access Memory 703 (Random Access Memory, RAM). In the random access memory 703, various programs and data necessary for the system operation are also stored. The central processing unit 701, the read only memory 702, and the random access memory 703 are connected to each other via a bus 704. An Input/Output interface 705 (i.e., an I/O interface) is also connected to bus 704.
Connected to the input/output interface 705 are an input section 706 including a keyboard, a mouse, and the like, an output section 707 including a Cathode Ray Tube (CRT), a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), and the like, and a speaker, and the like, a storage section 708 including a hard disk, and the like, and a communication section 709 including a network interface card such as a local area network card, a modem, and the like. The communication section 709 performs communication processing via a network such as the internet. The drive 710 is also connected to the input/output interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read therefrom is mounted into the storage section 708 as necessary.
In particular, the processes described in the various method flowcharts may be implemented as computer software programs according to embodiments of the application. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 709, and/or installed from the removable medium 711. The computer programs, when executed by the central processor 701, perform the various functions defined in the system of the present application.
In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 709, and/or installed from the removable medium 711. When executed by the central processor 701, performs the various functions provided by embodiments of the present application.
According to still another aspect of the embodiment of the present application, there is also provided an electronic device for implementing the connection method of the device, which may be the terminal device or the server shown in fig. 1. The present embodiment is described taking the electronic device as a terminal device as an example. As shown in fig. 8, the electronic device comprises a memory 802 and a processor 804, the memory 802 having stored therein a computer program, the processor 804 being arranged to perform the steps of any of the method embodiments described above by means of the computer program.
Alternatively, in this embodiment, the electronic device may be located in at least one network device of a plurality of network devices of the computer network.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the method in the embodiments of the present application by a computer program.
Alternatively, it will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 8 is merely illustrative, and that fig. 8 is not intended to limit the configuration of the electronic device described above. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 8, or have a different configuration than shown in FIG. 8.
The memory 802 may be used to store software programs and modules, such as program instructions/modules corresponding to the connection method and apparatus of the device in the embodiment of the present application, and the processor 804 executes the software programs and modules stored in the memory 802, thereby performing various functional applications and data processing, that is, implementing the connection method of the device. Memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 802 may further include memory remotely located relative to processor 804, which may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 802 may be used to store, but is not limited to, information such as video pictures of the network power supply device. As an example, as shown in fig. 8, the memory 802 may include, but is not limited to, a setting module 602, a binding module 604, a generating module 606, and a pulling module 608 in a connection device including the apparatus. In addition, other module units in the connection device of the above apparatus may be included, but are not limited to, and are not described in detail in this example.
Optionally, the transmission device 806 is used to receive or transmit data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission means 806 includes a network adapter (Network Interface Controller, NIC) that can connect to other network devices and routers via a network cable to communicate with the internet or a local area network. In one example, the transmission device 806 is a Radio Frequency (RF) module for communicating wirelessly with the internet.
The electronic device further includes a display 808 for displaying a video picture of the network power supply device, and a connection bus 810 for connecting the respective module parts in the electronic device.
In other embodiments, the terminal device or the server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the plurality of nodes through a network communication. The nodes may form a peer-to-peer network, and any type of computing device, such as a server, a terminal, etc., may become a node in the blockchain system by joining the peer-to-peer network.
According to an aspect of the present application, there is provided a computer-readable storage medium, from which a processor of an electronic device reads the computer instructions, which the processor executes, so that the electronic device performs a method of connecting devices provided in various alternative implementations of the connection aspect of the devices described above.
Alternatively, in the present embodiment, the above-described computer-readable storage medium may be configured to store a program for executing the method in the embodiments of the present application.
Alternatively, in this embodiment, all or part of the steps in the various methods of the above embodiments may be implemented by a program for instructing the terminal device related hardware, and the program may be stored in a computer readable storage medium, where the storage medium may include a flash disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present application may be embodied essentially or partly in the form of a software product or all or part of the technical solution, which is stored in a storage medium, comprising several instructions for causing one or more electronic devices to perform all or part of the steps of the method described in the various embodiments of the present application.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed application program may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application, which are intended to be comprehended within the scope of the present application.