CN106817438A - A kind of device management method and device based on controller local area network - Google Patents

A kind of device management method and device based on controller local area network Download PDF

Info

Publication number
CN106817438A
CN106817438A CN201710072259.0A CN201710072259A CN106817438A CN 106817438 A CN106817438 A CN 106817438A CN 201710072259 A CN201710072259 A CN 201710072259A CN 106817438 A CN106817438 A CN 106817438A
Authority
CN
China
Prior art keywords
dhcp
messages
area network
local area
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710072259.0A
Other languages
Chinese (zh)
Inventor
吴卫
黄小华
顾蒙
马延文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
VANE TECHNOLOGY Co Ltd
Original Assignee
VANE TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by VANE TECHNOLOGY Co Ltd filed Critical VANE TECHNOLOGY Co Ltd
Priority to CN201710072259.0A priority Critical patent/CN106817438A/en
Publication of CN106817438A publication Critical patent/CN106817438A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5038Address allocation for local use, e.g. in LAN or USB networks, or in a controller area network [CAN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/627Controller area network [CAN] identifiers

Abstract

The application provides device management method and device based on controller local area network, and methods described includes:After receiving the DHCP Discover messages of device node broadcast of controller local area network, an available ID is distributed according to the random number, and broadcast DHCP Offer messages;A distributed ID is carried in the DHCP Offer messages;After receiving the DHCP Request messages of device node broadcast of controller local area network, judge whether the 2nd ID in the message is consistent with the ID for being distributed before;In the case that an ID that the 2nd ID in DHCP Request messages was distributed with before is consistent, the 2nd ID is defined as the 3rd ID, and broadcast DHCP Ack messages;Wherein, the 3rd ID determined by being carried in the DHCP Ack messages.Using the embodiment of the present application, it is possible to achieve automatically distribute the ID of access device, so as to improve the efficiency of distribution ID, reduce the cost of distribution ID.

Description

A kind of device management method and device based on controller local area network
Technical field
The application is related to communication technical field, more particularly to a kind of device management method based on controller local area network and Device.
Background technology
With continuing to develop for technology, for example various sensors of equipment of terminal are more and more, even future device Quantity may be considerably beyond the quantity of the mankind.In order to tackle so many equipment connection communication, technology of Internet of things arises at the historic moment.
In Internet of Things based on CAN (controller local area network) mode connection communication, for the ease of the equipment that management is accessed, CAN master controllers need to distribute ID to the equipment for accessing.
In the prior art, it is in itself a simple general protocol framework due to CAN, the function of ID is not distributed, So what the work of distribution ID was generally manually carried out.However, manual allocation ID is often less efficient, and cost of labor It is higher.
The content of the invention
The application provides device management method and device based on controller local area network, is used to solve people in the prior art Work point is with ID less efficient, relatively costly problem.
According to a kind of device management method based on controller local area network that the embodiment of the present application is provided, methods described bag Include:
The device node broadcast DHCP Discover messages of controller local area network;Wherein, the DHCP Discover A random number is carried in message, the random number is used as temporary mark and sends device address, the association of controller local area network View has pre-defined DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages;
The master controller of controller local area network distributes one after receiving DHCP Discover messages according to the random number An individual available ID, and broadcast DHCP Offer messages;A distributed ID is carried in the DHCP Offer messages;
The device node of controller local area network receives the DHCP that the master controller of controller local area network is returned After Offer messages, the ID in the message is defined as the 2nd ID, and broadcast DHCP Request messages;Wherein, it is described DHCP Request messages carry the 2nd ID;
The master controller of controller local area network receives the 2nd ID judged in the message after DHCP Request messages It is whether consistent with the ID for being distributed before;
Twoth ID of the master controller of controller local area network in DHCP Request messages distributed with before the In the case that one ID is consistent, the 2nd ID is defined as the 3rd ID, and broadcast DHCP Ack messages;Wherein, the DHCP 3rd ID determined by being carried in Ack messages;
The device node of controller local area network receives the DHCP Ack that the master controller of controller local area network is returned After message, judge whether the 3rd ID in the message is consistent with the 2nd ID;
Feelings threeth ID of the device node of controller local area network in DHCP Ack messages consistent with the 2nd ID Under condition, final ID is defined as by described 3rd No. ID.
Optionally, the data field in the message defines type of message, and the type of message takes 1 byte;
1 represents Discover,
2 represent Offer,
3 represent Request,
4 represent Ack,
5 represent NAck.
Optionally, the ID of the distribution is located between 4 to 240.
According to a kind of device management method based on controller local area network that the embodiment of the present application is provided, methods described should Used in the device node of the controller local area network, methods described includes:
Broadcast DHCP Discover messages;Wherein, a random number is carried in the DHCP Discover messages, it is described Random number be used as temporary mark send device address, controller local area network's agreement pre-defined DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages;
After the DHCP Offer messages that the master controller for receiving controller local area network is returned, by the in the message One ID is defined as the 2nd ID, and broadcasts DHCP Request messages;Wherein, the DHCP Request messages carry described second ID;
After the DHCP Ack messages that the master controller for receiving controller local area network is returned, the in the message is judged Whether three ID are consistent with the 2nd ID;
In the case that the 3rd ID in DHCP Ack messages is consistent with the 2nd ID, described 3rd No. ID is defined as Final ID.
Optionally, in the case that the 3rd ID in DHCP Ack messages is consistent with the 2nd ID, by the 3rd ID Number it is defined as after final ID, methods described also includes:
The final ID is preserved in memory;
Correspondingly,
Before the broadcast DHCP Discover messages, methods described also includes:
Judge whether the ID for preserving is effective;
In the case where the ID for preserving is invalid, the broadcast DHCP Discover messages are performed;
In the case of the ID for preserving is effective, the already present ID is defined as the 2nd ID, performs the broadcast DHCP Request messages.
Optionally, the data field in the message defines type of message, and the type of message takes 1 byte;
1 represents Discover,
2 represent Offer,
3 represent Request,
4 represent Ack,
5 represent NAck.
According to a kind of device management method based on controller local area network that the embodiment of the present application is provided, methods described should Used in the master controller of the controller local area network, methods described includes:
After receiving the DHCP Discover messages of device node broadcast of controller local area network, according to described random Number one available ID of distribution, and broadcast DHCP Offer messages;Carry what is distributed in the DHCP Offer messages First ID;
After receiving the DHCP Request messages of device node broadcast of controller local area network, in judging the message Whether the 2nd ID is consistent with the ID for being distributed before;
In the case that an ID that the 2nd ID in DHCP Request messages was distributed with before is consistent, by described Two ID are defined as the 3rd ID, and broadcast DHCP Ack messages;Wherein, the 3rd determined by being carried in the DHCP Ack messages ID。
Optionally, the data field in the message defines type of message, and the type of message takes 1 byte;
1 represents Discover,
2 represent Offer,
3 represent Request,
4 represent Ack,
5 represent NAck.
Optionally, the ID of the distribution is located between 4 to 240.
According to a kind of equipment management device based on controller local area network that the embodiment of the present application is provided, described device should Used in the device node of the controller local area network, described device includes:
First radio unit, for broadcasting DHCP Discover messages;Wherein, taken in the DHCP Discover messages One random number of band, the random number is used as temporary mark and sends device address, and controller local area network's agreement is fixed in advance Justice DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages;
Second radio unit, for the DHCP Offer messages returned in the master controller for receiving controller local area network Afterwards, the ID in the message is defined as the 2nd ID, and broadcasts DHCP Request messages;Wherein, the DHCP Request messages carry the 2nd ID;
Judging unit, for after the DHCP Ack messages of master controller return for receiving controller local area network, sentencing Whether the 3rd ID in the disconnected message is consistent with the 2nd ID;
Determining unit, for the 3rd ID in DHCP Ack messages it is consistent with the 2nd ID in the case of, will be described 3rd No. ID is defined as final ID.
Optionally, after the determining unit, described device also includes:
Storing sub-units, for the final ID to be preserved in memory;
Correspondingly,
Before first radio unit, described device also includes:
Whether judgment sub-unit, the ID for judging to preserve is effective;
First radio unit, is additionally operable to, in the case where the ID for preserving is invalid, broadcast DHCP Discover messages;
Second radio unit, is additionally operable in the case of the ID for preserving is effective, and the ID in the message is determined It is the 2nd ID, and broadcasts DHCP Request messages.
According to a kind of equipment management device based on controller local area network that the embodiment of the present application is provided, described device should With on the master controller of the controller local area network, described device includes:
Allocation unit, after the DHCP Discover messages that the device node for receiving controller local area network is broadcasted, An available ID is distributed according to the random number;
3rd radio unit, for broadcasting DHCP Offer messages;Carry what is distributed in the DHCP Offer messages First ID;
Judging unit, after the DHCP Request messages that the device node for receiving controller local area network is broadcasted, Judge whether the 2nd ID in the message is consistent with the ID for being distributed before;
4th radio unit, the consistent feelings of an ID that the 2nd ID in DHCP Request messages was distributed with before Under condition, the 2nd ID is defined as the 3rd ID, and broadcast DHCP Ack messages;Wherein, carried in the DHCP Ack messages Identified 3rd ID.
Optionally, the ID of the distribution is located between 4 to 240.
The embodiment of the present application, has used for reference DHCP and has entered network packet, and DHCP has been pre-defined in controller local area network's agreement Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages.In this way, controller local area network Device node can realize that DHCP message is interacted with master controller, i.e., it is similar to enter network packet with DHCP, and device node can be with Broadcast carries the DHCP Discover messages of random number;Master controller can distribute one available the according to the random number One ID, and gone out by DHCP Offer message broadcastings;Device node is received an ID after DHCP Offer messages After as the 2nd ID, gone out by DHCP Request message broadcastings;Master controller is consistent with an ID in the 2nd ID In the case of, the 2nd ID is gone out as the 3rd ID and by DHCP Ack message broadcastings;End-use device node is judging State the 3rd ID it is consistent with the 2nd ID in the case of, the 3rd ID is defined as final ID.So, controller local is realized Network automatically to the equipment distribution ID for accessing can realize the efficiency for improving distribution ID, and due to without manual allocation ID, correspondingly also reduces operation cost.
Brief description of the drawings
Fig. 1 is the flow chart of the device management method based on controller local area network that the embodiment of the application one is provided;
Fig. 2 is the DHCP Discover message format schematic diagrames that the embodiment of the application one is provided;
Fig. 3 is the DHCP Offer message format schematic diagrames that the embodiment of the application one is provided;
Fig. 4 is the DHCP Request message format schematic diagrames that the embodiment of the application one is provided;
Fig. 5 is the DHCP Ack message format schematic diagrames that the embodiment of the application one is provided;
Fig. 6 is the DHCP NAck message format schematic diagrames that the embodiment of the application one is provided;
Fig. 7 is the flow chart of the device management method based on controller local area network that the embodiment of the application one is provided;
Fig. 8 is the flow chart of the device management method based on controller local area network that the embodiment of the application one is provided;
Fig. 9 is a kind of hardware knot of equipment where the equipment management device based on controller local area network that the application is provided Composition;
Figure 10 is that the module of the equipment management device based on controller local area network that the embodiment of the application one is provided is illustrated Figure;
Figure 11 is that the module of the equipment management device based on controller local area network that the embodiment of the application one is provided is illustrated Figure.
Specific embodiment
Here exemplary embodiment will be illustrated in detail, its example is illustrated in the accompanying drawings.Following description is related to During accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous key element.Following exemplary embodiment Described in implementation method do not represent all implementation methods consistent with the application.Conversely, they be only with it is such as appended The example of the consistent apparatus and method of some aspects described in detail in claims, the application.
It is the purpose only merely for description specific embodiment in term used in this application, and is not intended to be limiting the application. " one kind ", " described " and " being somebody's turn to do " of singulative used in the application and appended claims is also intended to include majority Form, unless context clearly shows that other implications.It is also understood that term "and/or" used herein refers to and wraps May be combined containing one or more associated any or all of project listed.
It will be appreciated that though various information, but this may be described using term first, second, third, etc. in the application A little information should not necessarily be limited by these terms.These terms are only used for being distinguished from each other open same type of information.For example, not departing from In the case of the application scope, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as One information.Depending on linguistic context, word as used in this " if " can be construed to " ... when " or " when ... When " or " in response to determining ".
In correlation technique, controller local area network is CAN, is a kind of traditional wired connection mode, for realizing Simple physical connection between each equipment., it is necessary to the equipment to accessing distributes ID during based on CAN mode connection communications.ID with It is one-to-one relation between equipment.Corresponding equipment can quickly be found by ID, what so convenient management was accessed sets It is standby.However, do not distribute the function of ID in itself due to CAN, so what the work of distribution ID was generally manually carried out.So And, manual allocation ID is often less efficient, particularly in the case where complete set of equipments is accessed, mistake easily occurs, and manually Operation cost is also higher caused by cost.
In order to solve the above problems, Fig. 1 is referred to, for one kind that the embodiment of the application one is provided is based on controller LAN The flow chart of the device management method of network, the embodiment is entered this both sides from the master controller and device node of controller local area network Row description, comprises the following steps:
Step 110:The device node broadcast DHCP Discover messages of controller local area network;Wherein, the DHCP A random number is carried in Discover messages, the random number is used as temporary mark and sends device address, the control general ability Domain procotol has pre-defined DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck Message.
In the present embodiment, in controller local area network agreement CAN, with an Extended ID for 29bit (position).
Controller local area network's agreement has pre-defined DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages.That is, DHCP Discover, DHCP have been redefined in the Extended ID Offer, DHCP Request, DHCP Ack and DHCP NAck messages this five kinds of type of messages.
Five kinds of DHCP messages of the definition are discussed in detail as follows:
As shown in Fig. 2 a kind of DHCP Discover message format schematic diagrames provided for the embodiment of the present application.In Fig. 2, Using the 29bit information of former Extended ID, DHCP Discover are broadcasted, wherein,
0-4bit is used to represent the framing sequence of message;It is 1111 in this example;
5bit is used to represent the last frame of message;It is 0 in this example;
6-13bit is used to represent the source address of message;It is 11111111 in this example;
14-21bit is used to represent the destination address of message;It is 00000001 in this example;
22bit is used to represent that message is request message or response message that 1 to represent request message, and 0 represents response report Text;For 1, i.e. DHCP Discover messages are request message in this example;
23-26bit is used to represent that message retains;It is 0101 in this example;
27-28bit is used to represent priority;It is 00 in this example;
Data (data field), with 3byte (byte), for representing type of message and random number.Wherein, the random number 2 bytes are occupied, so type of message occupies 1 byte;For 0x01+0x0004, i.e. type of message are 1 in this example, at random Number is 4.
It should be noted that because the type of message has only taken up 1 byte, so during data area definition type of message, Discover is represented by 1,2 represent Offer, and 3 represent Request, and 4 represent Ack, and 5 represent NAck.
It should be noted that the random number is 2 bytes, as a temporary mark, corresponding to device address, and it is used for Application ID.
As shown in figure 3, a kind of DHCP Offer message format schematic diagrames provided for the embodiment of the present application.In Fig. 3, utilize The 29bit information of former Extended ID, in the DHCP Offer,
0-4bit is used to represent the framing sequence of message;It is 1111 in this example;
5bit is used to represent the last frame of message;It is 0 in this example;
6-13bit is used to represent the source address of message;It is 00000001 in this example;
14-21bit is used to represent the destination address of message;It is 11111111 in this example;
22bit is used to represent that message is request message or response message that 1 to represent request message, and 0 represents response report Text;For 0, i.e. DHCP Offer messages are response message in this example;
23-26bit is used to represent that message retains;It is 0101 in this example;
27-28bit is used to represent priority;It is 00 in this example;
Data (data field), with 4byte (byte), for representing type of message, random number and an ID.Wherein, institute State type of message and occupy 1 byte, the random number occupies 2 bytes, and an ID occupies 1 byte.It is in this example 0x02+0x0004+0x05, i.e. type of message are 2, and random number is 4, and an ID is 5.
It should be noted that because the type of message has only taken up 1 byte, so during data area definition type of message, Discover is represented by 1,2 represent Offer, and 3 represent Request, and 4 represent Ack, and 5 represent NAck.
It should be noted that the random number is 2 bytes, random number and DHCP in DHCP Offer messages Random number in Discover messages is same.
As shown in figure 4, a kind of DHCP Request message format schematic diagrames provided for the embodiment of the present application.In Fig. 4, profit With the 29bit information of former Extended ID, DHCP Request are broadcasted, wherein,
0-4bit is used to represent the framing sequence of message;It is 1111 in this example;
5bit is used to represent the last frame of message;It is 0 in this example;
6-13bit is used to represent the source address of message;It is 11111111 in this example;
14-21bit is used to represent the destination address of message;It is 00000001 in this example;
22bit is used to represent that message is request message or response message that 1 to represent request message, and 0 represents response report Text;For 1, i.e. DHCP Request messages are request message in this example;
23-26bit is used to represent that message retains;It is 0101 in this example;
27-28bit is used to represent priority;It is 00 in this example;
Data (data field), with 2byte (byte), for representing type of message and the 2nd ID.Wherein, the message class Type occupies 1 byte, and the 2nd ID occupies 1 byte.For 0x03+0x05, i.e. type of message are 3, the 2nd ID in this example It is 5.
It should be noted that because the type of message has only taken up 1 byte, so during data area definition type of message, Discover is represented by 1,2 represent Offer, and 3 represent Request, and 4 represent Ack, and 5 represent NAck.
As shown in figure 5, a kind of DHCP Ack message format schematic diagrames provided for the embodiment of the present application.In Fig. 5, using original The 29bit information of Extended ID, in the DHCP Ack,
0-4bit is used to represent the framing sequence of message;It is 1111 in this example;
5bit is used to represent the last frame of message;It is 0 in this example;
6-13bit is used to represent the source address of message;It is 00000001 in this example;
14-21bit is used to represent the destination address of message;It is 11111111 in this example;
22bit is used to represent that message is request message or response message that 1 to represent request message, and 0 represents response report Text;For 0, i.e. DHCP Ack messages are response message in this example;
23-26bit is used to represent that message retains;It is 0101 in this example;
27-28bit is used to represent priority;It is 00 in this example;
Data (data field), with 2byte (byte), for representing type of message and the 3rd ID.Wherein, the message class Type occupies 1 byte, and the 3rd ID occupies 1 byte.For 0x04+0x05, i.e. type of message are 4, the 3rd ID in this example It is 5.
It should be noted that because the type of message has only taken up 1 byte, so during data area definition type of message, Discover is represented by 1,2 represent Offer, and 3 represent Request, and 4 represent Ack, and 5 represent NAck.
As shown in fig. 6, a kind of DHCP NAck message format schematic diagrames provided for the embodiment of the present application.In Fig. 6, utilize The 29bit information of former Extended ID, in the DHCP NAck,
0-4bit is used to represent the framing sequence of message;It is 1111 in this example;
5bit is used to represent the last frame of message;It is 0 in this example;
6-13bit is used to represent the source address of message;It is 00000001 in this example;
14-21bit is used to represent the destination address of message;It is 11111111 in this example;
22bit is used to represent that message is request message or response message that 1 to represent request message, and 0 represents response report Text;For 0, i.e. DHCP NAck messages are response message in this example;
23-26bit is used to represent that message retains;It is 0101 in this example;
27-28bit is used to represent priority;It is 00 in this example;
Data (data field), with 2byte (byte), for representing type of message and the 4th ID.Wherein, the message class Type occupies 1 byte, and the source address occupies 1 byte.For 0x05+0x00, i.e. type of message are 5, the 4th ID in this example It is 0.
It should be noted that because the type of message has only taken up 1 byte, so during data area definition type of message, Discover is represented by 1,2 represent Offer, and 3 represent Request, and 4 represent Ack, and 5 represent NAck.4th ID enters later Row explanation.
Because above-mentioned CAN protocol has pre-defined DHCP message, so the device node of controller local area network can be wide DHCP Discover messages are broadcast, and a random number is carried in the message.The random number is used as temporary mark and sends equipment Address.It is noted that the device address has uniqueness, i.e., each equipment has a unique device address.
Step 120:The master controller of controller local area network is received after DHCP Discover messages according to described random Number one available ID of distribution, and broadcast DHCP Offer messages;Carry what is distributed in the DHCP Offer messages First ID.
In the present embodiment, the master controller of controller local area network receives the DHCP Discover of device node broadcast After message, an available ID (ID) can be distributed according to random number.
In actual applications, ID is 1 byte, and its maximum magnitude is 0-255;Because the ID for defining specific function is occupied Numbering (for example, the ID that can carry of DHCP NAck messages is 0), so ID that device node uses can be left for between 4-240.
For example, after master controller receives the DHCP Discover messages shown in Fig. 2, can distribute one it is 5 (available ID), and DHCP Offer messages as shown in Figure 3 are broadcasted, is carried in the data field of the DHCP Offer messages and distributed ID be 5.
Step 130:What the master controller that the device node of controller local area network receives controller local area network was returned After DHCP Offer messages, the ID in the message is defined as the 2nd ID, and broadcast DHCP Request messages;Wherein, The DHCP Request messages carry the 2nd ID.
In the present embodiment, the device node of controller local area network receives the DHCP Offer messages of master controller transmission Afterwards, the ID in data field in the DHCP Offer messages can be defined as the 2nd ID, and is reported by DHCP Request Text is broadcasted.
For example, after device node receives the DHCP Offer messages shown in Fig. 3, an ID (5) can be defined as into Two ID, and the DHCP Request messages shown in BROADCASTING GRAPH 4, the 2nd ID is 5 in the data field of the DHCP Request messages.
If it is noted that the device node of controller local area network is not received by the DHCP Offer reports for returning Wen Hou, can repeat step 110 step.
Step 140:The master controller of controller local area network is received in judge after DHCP Request messages the message The 2nd ID it is whether consistent with the ID for being distributed before.
In the present embodiment, the master controller of controller local area network receives the DHCP Request reports of device node broadcast , it is necessary to judge whether the 2nd ID in the DHCP Request messages is consistent with the ID for being distributed before after text.
If inconsistent, illustrate that the device node for broadcasting the DHCP Request messages is illegal, then master controller can be with Broadcast DHCP NAck messages, the 4th ID is carried in the DHCP NAck messages.As shown in fig. 6, number in DHCP NAck messages The 4th ID is carried according to area, and the 4th ID is not an effective ID, i.e., be not located between 4-240.Such as this example In the 4th ID be 0.
Corresponding, device node parses the message and obtains Data's (data field) after the DHCP message is received In the case that type of message is NAck, can need to re-execute step 110.For example, receiving the DHCP message shown in Fig. 6 Afterwards, the type of message that parsing DHCP message obtains Data (data field) is 5, during due to data area definition type of message, 5 is represented NAck, it is possible to the DHCP message is determined for DHCP NAck messages, so as to re-execute step 110.
If consistent, illustrate that the device node for broadcasting the DHCP Request messages is legal, then perform step 150.
Step 150:Twoth ID of the master controller of controller local area network in DHCP Request messages institutes with before In the case that first ID of distribution is consistent, the 2nd ID is defined as the 3rd ID, and broadcast DHCP Ack messages;Wherein, institute State the 3rd ID determined by carrying in DHCP Ack messages.
In the present embodiment, the consistent situation of an ID that the 2nd ID in DHCP Request messages was distributed with before Under, the 2nd ID can be defined as the 3rd ID by the master controller of controller local area network, and will by DHCP Ack messages 3rd ID is broadcasted.
By taking the DHCP message shown in Fig. 3 and Fig. 4 as an example, due in the DHCP Request message datas area shown in Fig. 4 2nd ID (being 5), is consistent with the ID (being 5) in an ID i.e. Fig. 3 data fields distributed before, so main control 2nd ID can be defined as the 3rd ID by device, broadcast DHCP Ack messages as shown in Figure 5, the number of the DHCP Ack messages According to carrying the 3rd ID (for 5) in area.
Step 160:What the master controller that the device node of controller local area network receives controller local area network was returned After DHCP Ack messages, judge whether the 3rd ID in the message is consistent with the 2nd ID.
In the present embodiment, the device node of controller local area network receives the DHCP Ack messages of master controller return Afterwards, it is necessary to judge whether the 3rd ID in the DHCP Ack messages is consistent with identified 2nd ID.
If consistent, step 170 is performed.
If it is inconsistent, repeating step 110.
Step 170:The device node of controller local area network the 3rd ID in DHCP Ack messages and the 2nd ID In the case of consistent, final ID is defined as by described 3rd No. ID.
In the present embodiment, in the case that the 3rd ID in DHCP Ack messages is consistent with the 2nd ID, general ability is controlled The device node of domain network may finally be defined as final ID by described 3rd No. ID.
By the embodiment of the present application, DHCP is used for reference and has entered network packet, pre-defined in controller local area network's agreement DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages.In this way, controller local The device node of network can realize that DHCP message is interacted with master controller, i.e., it is similar to enter network packet with DHCP, device node The DHCP Discover messages for carrying random number can be broadcasted;Master controller can distribute one and can use according to the random number An ID, and gone out by DHCP Offer message broadcastings;Device node is received described after DHCP Offer messages After one ID is as the 2nd ID, gone out by DHCP Request message broadcastings;Master controller is in a 2nd ID and ID mono- In the case of cause, the 2nd ID is gone out as the 3rd ID and by DHCP Ack message broadcastings;End-use device node is being sentenced In the case that the 3rd ID that breaks is consistent with the 2nd ID, the 3rd ID is defined as final ID.So, controller is realized LAN automatically to the equipment distribution ID for accessing can realize the efficiency for improving distribution ID, and due to without artificial Distribution ID, correspondingly also reduces operation cost.
The application based on the embodiment of the method for the device node of controller local area network is introduced below in conjunction with Fig. 7, should Embodiment can be with corresponding diagram 1:
Step 210:Broadcast DHCP Discover messages;Wherein, in the DHCP Discover messages carry one with Machine number, the random number is used as temporary mark and sends device address, and controller local area network's agreement has pre-defined DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages.
Optionally, the data field in the message defines type of message, and the type of message takes 1 byte;
1 represents Discover,
2 represent Offer,
3 represent Request,
4 represent Ack,
5 represent NAck.
Step 220:After the DHCP Offer messages that the master controller for receiving controller local area network is returned, this is reported An ID in text is defined as the 2nd ID, and broadcasts DHCP Request messages;Wherein, the DHCP Request messages are carried 2nd ID.
Step 230:After the DHCP Ack messages that the master controller for receiving controller local area network is returned, the report is judged Whether the 3rd ID in text is consistent with the 2nd ID.
Step 240:In the case that the 3rd ID in DHCP Ack messages is consistent with the 2nd ID, by the 3rd ID Number it is defined as final ID.
In actual application, such as so miniature equipment of sensor is low-power consumption, will not always go up electricity.Setting For the equipment that new access when re-powering, can be regarded as, however, the equipment has obtained ID in fact, so will result in Repeatedly apply for ID, not only occupying multiple can use ID, and extra pressure is caused to server.
In order to solve the above problems, on the basis of above-mentioned Fig. 7, in another embodiment of the application, in the step After 240, methods described can also include:
The final ID is preserved in memory;
Correspondingly,
Before the step 210, methods described also includes:
Judge whether the ID for preserving is effective;
In the case where the ID for preserving is invalid, the step 210 is performed, that is, broadcast DHCP Discover messages;
In the case of the ID for preserving is effective, the ID preserved in the memory is defined as the 2nd ID, performed described wide Broadcast DHCP Request messages.
In the present embodiment, the memory can include such as Flash (Flash EEPROM Memory, flash memory).
After device power, by inquiring about the ID preserved in memory;In the case where ID is inquired, the memory is judged Whether the ID of middle preservation is effective.
Because the ID for distributing is located between 4-240, that is to say, that effective ID must be located between 4-240, otherwise ID outside 4-240 is invalid.
By the present embodiment, the equipment for once getting ID, can be saved in the ID in memory by the equipment, from And after the equipment is re-powered, the ID for preserving in memory can be obtained, and in the case of the ID is effective, directly should After ID is defined as the 2nd ID, DHCP Request messages are broadcasted.So, it is to avoid re-powering equipment every time will repeat to apply ID。
The application based on the embodiment of the method for the master controller of controller local area network is introduced below in conjunction with Fig. 8, should Embodiment can be with corresponding diagram 1:
Step 310:After receiving the DHCP Discover messages of device node broadcast of controller local area network, according to The random number distributes an available ID, and broadcasts DHCP Offer messages;Carried in the DHCP Offer messages The ID for being distributed.
Optionally, the ID of the distribution is located between 4 to 240.
Step 320:After receiving the DHCP Request messages of device node broadcast of controller local area network, judging should Whether the 2nd ID in message is consistent with the ID for being distributed before.
Step 330:In the case that an ID that the 2nd ID in DHCP Request messages was distributed with before is consistent, 2nd ID is defined as the 3rd ID, and broadcasts DHCP Ack messages;Wherein, carried in the DHCP Ack messages and determined The 3rd ID.
Optionally, the data field in the message defines type of message, and the type of message takes 1 byte;
1 represents Discover,
2 represent Offer,
3 represent Request,
4 represent Ack,
5 represent NAck.
With the equipment control based on controller local area network of the foregoing device node based on controller local area network Embodiment of the method is corresponding, present invention also provides the embodiment of the equipment management device based on controller local area network.
The embodiment that the application is based on the equipment management device of controller local area network can be applied in controller LAN On the device node of network.Device embodiment can be realized by software, it is also possible to by way of hardware or software and hardware combining Realize.As a example by implemented in software, used as the device on a logical meaning, being will be non-volatile by the processor of equipment where it Property memory in corresponding computer program instructions read and run in internal memory what is formed.From for hardware view, such as Fig. 9 institutes Show, be a kind of hardware structure diagram of the equipment management device place equipment that the application is based on controller local area network, except Fig. 9 institutes Outside the processor, network interface, internal memory and the nonvolatile memory that show, equipment in embodiment where device generally according to This is based on the actual functional capability of the equipment control of controller local area network, can also include other hardware, and this is repeated no more.
It is the module of the equipment management device based on controller local area network that the embodiment of the application one is provided referring to Figure 10 Figure, the embodiment is described from the device node side of controller local area network, and described device includes:First radio unit 410, Second radio unit 420, judging unit 430 and determining unit 440.
Wherein, the first radio unit 410, for broadcasting DHCP Discover messages;Wherein, the DHCP Discover A random number is carried in message, the random number is used as temporary mark and sends device address, the association of controller local area network View has pre-defined DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages;
Second radio unit 420, for the DHCP Offer returned in the master controller for receiving controller local area network After message, the ID in the message is defined as the 2nd ID, and broadcast DHCP Request messages;Wherein, the DHCP Request messages carry the 2nd ID;
Judging unit 430, for receive controller local area network master controller return DHCP Ack messages after, Judge whether the 3rd ID in the message is consistent with the 2nd ID;
Determining unit 440, for the 3rd ID in DHCP Ack messages it is consistent with the 2nd ID in the case of, by institute State the 3rd No. ID and be defined as final ID.
In an optional implementation:
After the determining unit 440, described device also includes:
Storing sub-units, for the final ID to be preserved in memory;
Correspondingly,
Before first radio unit 410, described device also includes:
Whether judgment sub-unit, the ID for judging to preserve is effective;
First radio unit 410, is additionally operable in the case where the ID for preserving is invalid, broadcast DHCP Discover reports Text;
Second radio unit 420, is additionally operable in the case of the ID for preserving is effective, and the ID in the message is true It is set to the 2nd ID, and broadcasts DHCP Request messages.
In an optional implementation:
Data field in the message defines type of message, and the type of message takes 1 byte;
1 represents Discover,
2 represent Offer,
3 represent Request,
4 represent Ack,
5 represent NAck.
Similar, the setting based on controller local area network with the foregoing master controller based on controller local area network Standby management method embodiment is corresponding, present invention also provides a kind of reality of the equipment management device based on controller local area network Apply example.
It is the module of the equipment management device based on controller local area network that the embodiment of the application one is provided referring to Figure 11 Figure, the embodiment is described from the master controller side of controller local area network, and described device includes:Allocation unit the 510, the 3rd Radio unit 520, the radio unit 540 of judging unit 530 and the 4th.
Wherein, allocation unit 510, the DHCP that the device node for receiving controller local area network is broadcasted After Discover messages, an available ID is distributed according to the random number;
3rd radio unit 520, for broadcasting DHCP Offer messages;Carried in the DHCP Offer messages and distributed An ID;
Judging unit 530, the DHCP Request messages that the device node for receiving controller local area network is broadcasted Afterwards, judge whether the 2nd ID in the message is consistent with the ID for being distributed before;
4th radio unit 540, the ID that the 2nd ID in DHCP Request messages was distributed with before is consistent In the case of, the 2nd ID is defined as the 3rd ID, and broadcast DHCP Ack messages;Wherein, in the DHCP Ack messages 3rd ID determined by carrying.
In an optional implementation:
The ID of the distribution is located between 4 to 240.
In an optional implementation:
Data field in the message defines type of message, and the type of message takes 1 byte;
1 represents Discover,
2 represent Offer,
3 represent Request,
4 represent Ack,
5 represent NAck.
In sum, by applying for the present embodiment, used for reference DHCP and entered network packet, it is pre- in controller local area network's agreement First define DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages.In this way, control The device node of device LAN processed can realize that DHCP message is interacted with master controller, i.e., it is similar to enter network packet with DHCP, Device node can broadcast the DHCP Discover messages for carrying random number;Master controller can be distributed according to the random number One available ID, and gone out by DHCP Offer message broadcastings;After device node receives DHCP Offer messages Using an ID as after the 2nd ID, gone out by DHCP Request message broadcastings;Master controller the 2nd ID with In the case that first ID is consistent, the 2nd ID is gone out as the 3rd ID and by DHCP Ack message broadcastings;End-use device 3rd ID is defined as final ID by node in the case where judging that the 3rd ID is consistent with the 2nd ID.So, realize Controller local area network can be automatically to accessing equipment distribute ID, realize the efficiency for improving distribution ID, and due to Without manual allocation ID, operation cost is correspondingly also reduced.
The function of unit and the implementation process of effect correspond to step in specifically referring to the above method in said apparatus Implementation process, will not be repeated here.
For device embodiment, because it corresponds essentially to embodiment of the method, so related part is referring to method reality Apply the part explanation of example.Device embodiment described above is only schematical, wherein described as separating component The unit of explanation can be or may not be physically separate, and the part shown as unit can be or can also It is not physical location, you can with positioned at a place, or can also be distributed on multiple NEs.Can be according to reality Selection some or all of module therein is needed to realize the purpose of application scheme.Those of ordinary skill in the art are not paying In the case of going out creative work, you can to understand and implement.
Those skilled in the art will readily occur to its of the application after considering specification and putting into practice invention disclosed herein Its embodiment.The application is intended to any modification, purposes or the adaptations of the application, these modifications, purposes or Person's adaptations follow the general principle of the application and including the undocumented common knowledge in the art of the application Or conventional techniques.Description and embodiments are considered only as exemplary, and the true scope of the application and spirit are by following Claim is pointed out.
It should be appreciated that the application is not limited to the precision architecture for being described above and being shown in the drawings, and And can without departing from the scope carry out various modifications and changes.Scope of the present application is only limited by appended claim.

Claims (10)

1. a kind of device management method based on controller local area network, it is characterised in that methods described includes:
The device node broadcast DHCP Discover messages of controller local area network;Wherein, the DHCP Discover messages One random number of middle carrying, the random number is used as temporary mark and sends device address, and controller local area network's agreement is pre- First define DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages;
The master controller of controller local area network receive distribute one according to the random number after DHCP Discover messages can First ID, and broadcast DHCP Offer messages;A distributed ID is carried in the DHCP Offer messages;
The DHCP Offer reports that the master controller that the device node of controller local area network receives controller local area network is returned Wen Hou, is defined as the 2nd ID, and broadcast DHCP by the ID in the message
Request messages;Wherein, the DHCP Request messages carry the 2nd ID;
The master controller of controller local area network receives the 2nd ID judged in the message after DHCP Request messages therewith Whether preceding a distributed ID is consistent;
The ID that twoth ID of the master controller of controller local area network in DHCP Request messages was distributed with before In the case of consistent, the 2nd ID is defined as the 3rd ID, and broadcast DHCP Ack messages;Wherein, the DHCP Ack reports 3rd ID determined by being carried in text;
The device node of controller local area network receives the DHCP Ack messages that the master controller of controller local area network is returned Afterwards, judge whether the 3rd ID in the message is consistent with the 2nd ID;
In the case that the 3rd ID of the device node of controller local area network in DHCP Ack messages is consistent with the 2nd ID, It is defined as final ID by described 3rd No. ID.
2. a kind of device management method based on controller local area network, it is characterised in that methods described is applied in the control The device node of device LAN, methods described includes:
Broadcast DHCP Discover messages;Wherein, a random number is carried in the DHCP Discover messages, it is described random Number is used as temporary mark and sends device address, and controller local area network's agreement has pre-defined DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages;
After the DHCP Offer messages that the master controller for receiving controller local area network is returned, by the ID in the message It is defined as the 2nd ID, and broadcasts DHCP Request messages;Wherein, the DHCP Request messages carry the 2nd ID;
After the DHCP Ack messages that the master controller for receiving controller local area network is returned, the 3rd ID in the message is judged It is whether consistent with the 2nd ID;
In the case that the 3rd ID in DHCP Ack messages is consistent with the 2nd ID, described 3rd No. ID is defined as final ID.
3. a kind of device management method based on controller local area network, it is characterised in that methods described is applied in the control The master controller of device LAN, methods described includes:
After receiving the DHCP Discover messages of device node broadcast of controller local area network, according to the random number point With an available ID, and broadcast DHCP Offer messages;Distributed first is carried in the DHCP Offer messages ID;
After receiving the DHCP Request messages of device node broadcast of controller local area network, second in the message is judged Whether ID is consistent with the ID for being distributed before;
In the case that an ID that the 2nd ID in DHCP Request messages was distributed with before is consistent, by the 2nd ID It is defined as the 3rd ID, and broadcasts DHCP Ack messages;Wherein, the 3rd ID determined by being carried in the DHCP Ack messages.
4. method according to claim 2, it is characterised in that the 3rd ID and the 2nd ID in DHCP Ack messages In the case of consistent, described 3rd No. ID is defined as after final ID, methods described also includes:
The final ID is preserved in memory;
Correspondingly,
Before the broadcast DHCP Discover messages, methods described also includes:
Judge whether the ID for preserving is effective;
In the case where the ID for preserving is invalid, the broadcast DHCP Discover messages are performed;
In the case of the ID for preserving is effective, the ID of the preservation is defined as the 2nd ID, performs the broadcast DHCP Request messages.
5. the method according to any one of claim 1-3, it is characterised in that the data field in the message defines report Literary type, the type of message takes 1 byte;
1 represents Discover,
2 represent Offer,
3 represent Request,
4 represent Ack,
5 represent NAck.
6. the method according to claim 1 or 3, it is characterised in that the ID of the distribution is located between 4 to 240.
7. a kind of equipment management device based on controller local area network, it is characterised in that described device is applied in the control The device node of device LAN, described device includes:
First radio unit, for broadcasting DHCP Discover messages;Wherein, one is carried in the DHCP Discover messages Individual random number, the random number is used as temporary mark and sends device address, and controller local area network's agreement is pre-defined DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack and DHCP NAck messages;
Second radio unit, for receive controller local area network master controller return DHCP Offer messages after, An ID in the message is defined as the 2nd ID, and broadcasts DHCP Reques t messages;Wherein, the DHCP Request Message carries the 2nd ID;
Judging unit, for after the DHCP Ack messages of master controller return for receiving controller local area network, judging should Whether the 3rd ID in message is consistent with the 2nd ID;
Determining unit, for the 3rd ID in DHCP Ack messages it is consistent with the 2nd ID in the case of, by the described 3rd No. ID is defined as final ID.
8. a kind of equipment management device based on controller local area network, it is characterised in that described device is applied in the control On the master controller of device LAN, described device includes:
Allocation unit, after the DHCP Discover messages that the device node for receiving controller local area network is broadcasted, according to The random number distributes an available ID;
3rd radio unit, for broadcasting DHCP Offer messages;Distributed first is carried in the DHCP Offer messages ID;
Judging unit, after the DHCP Request messages that the device node for receiving controller local area network is broadcasted, judges Whether the 2nd ID in the message is consistent with the ID for being distributed before;
4th radio unit, the consistent situation of an ID that the 2nd ID in DHCP Request messages was distributed with before Under, the 2nd ID is defined as the 3rd ID, and broadcast DHCP Ack messages;Wherein, institute is carried in the DHCP Ack messages The 3rd ID for determining.
9. device according to claim 7, it is characterised in that after the determining unit, described device also includes:
Storing sub-units, for the final ID to be preserved in memory;
Correspondingly,
Before first radio unit, described device also includes:
Whether judgment sub-unit, the ID for judging to preserve is effective;
First radio unit, is additionally operable to, in the case where the ID for preserving is invalid, broadcast DHCP Discover messages;
Second radio unit, is additionally operable in the case of the ID for preserving is effective, and the ID in the message is defined as into the Two ID, and broadcast DHCP Request messages.
10. device according to claim 8, it is characterised in that the ID of the distribution is located between 4 to 240.
CN201710072259.0A 2017-02-09 2017-02-09 A kind of device management method and device based on controller local area network Pending CN106817438A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710072259.0A CN106817438A (en) 2017-02-09 2017-02-09 A kind of device management method and device based on controller local area network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710072259.0A CN106817438A (en) 2017-02-09 2017-02-09 A kind of device management method and device based on controller local area network

Publications (1)

Publication Number Publication Date
CN106817438A true CN106817438A (en) 2017-06-09

Family

ID=59113056

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710072259.0A Pending CN106817438A (en) 2017-02-09 2017-02-09 A kind of device management method and device based on controller local area network

Country Status (1)

Country Link
CN (1) CN106817438A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107071909A (en) * 2017-02-09 2017-08-18 浙江风向标科技有限公司 The system of selection of ZigBee channels and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101582824A (en) * 2008-05-13 2009-11-18 施耐德电器工业公司 Node number automatic distribution method for controlling secondary node equipment of local area network bus
CN102244690A (en) * 2011-07-26 2011-11-16 福建星网锐捷网络有限公司 Address allocation method and system of dynamic host configuration protocol (DHCP) as well as client side and servers of same
CN102546340A (en) * 2012-02-16 2012-07-04 山东师范大学 Method of networking small CAN (controller area network) bus network
CN102862487A (en) * 2011-07-05 2013-01-09 北汽福田汽车股份有限公司 Battery control system of car
CN103581356A (en) * 2012-08-10 2014-02-12 海尔集团公司 MAC address distribution method
CN106060187A (en) * 2016-05-26 2016-10-26 杭州华三通信技术有限公司 Address allocation methods and devices

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101582824A (en) * 2008-05-13 2009-11-18 施耐德电器工业公司 Node number automatic distribution method for controlling secondary node equipment of local area network bus
CN102862487A (en) * 2011-07-05 2013-01-09 北汽福田汽车股份有限公司 Battery control system of car
CN102244690A (en) * 2011-07-26 2011-11-16 福建星网锐捷网络有限公司 Address allocation method and system of dynamic host configuration protocol (DHCP) as well as client side and servers of same
CN102546340A (en) * 2012-02-16 2012-07-04 山东师范大学 Method of networking small CAN (controller area network) bus network
CN103581356A (en) * 2012-08-10 2014-02-12 海尔集团公司 MAC address distribution method
CN106060187A (en) * 2016-05-26 2016-10-26 杭州华三通信技术有限公司 Address allocation methods and devices

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107071909A (en) * 2017-02-09 2017-08-18 浙江风向标科技有限公司 The system of selection of ZigBee channels and device

Similar Documents

Publication Publication Date Title
CN104378455B (en) IP address distribution method and device
CN105553977B (en) Processing, sending method and the device of request message
CN110460684B (en) Broadcast domain isolation method and device for VXLAN (virtual extensible local area network) in same network segment
CN103647853A (en) Method for sending ARP message in VxLAN, VTEP and VxLAN controller
CN103281203B (en) A kind of dhcp address allocation management method based on ecos systems
CN100471162C (en) Method for releasing and processing virtual circuit information and supplier edge device
CN103095546A (en) Method, device and data center network for processing messages
CN105959644B (en) A kind of configuration method and device of video monitoring equipment
JP2019521619A (en) Packet forwarding
CN107333095A (en) The processing system of media resource
CN106209636A (en) From the multicast data packet forwarding method and apparatus of VLAN to VXLAN
CN113132202A (en) Message transmission method and related equipment
CN106209648A (en) Multicast data packet forwarding method and apparatus across virtual expansible LAN
CN106572447A (en) Resource control method and device
EP3745284A1 (en) Model parameter fusion method and apparatus
CN105827496B (en) Manage the method and device of PE equipment
CN106817438A (en) A kind of device management method and device based on controller local area network
CN106161115A (en) A kind of device management method being applied to VXLAN and device
CN105791304A (en) Message processing method and message processing device
CN106302845A (en) The Domain Name System addresses collocation method of data channel product and device
CN106161249B (en) The processing method and processing device of PPPoE message
CN107896188A (en) Data forwarding method and device
WO2017054695A1 (en) Method, apparatus and system for deploying virtual machine with backup virtual network interface card based on kvm
CN109086115B (en) Android animation execution method, device, terminal and readable medium
CN103873302B (en) The distribution method and device of a kind of virtual trough position

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170609