CN117938944A - Communication method and device for realizing dynamic connection of electronic devices - Google Patents
Communication method and device for realizing dynamic connection of electronic devices Download PDFInfo
- Publication number
- CN117938944A CN117938944A CN202211266180.9A CN202211266180A CN117938944A CN 117938944 A CN117938944 A CN 117938944A CN 202211266180 A CN202211266180 A CN 202211266180A CN 117938944 A CN117938944 A CN 117938944A
- Authority
- CN
- China
- Prior art keywords
- electronic device
- functional electronic
- functional
- main control
- identifier
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 238000004891 communication Methods 0.000 title claims abstract description 21
- 238000012544 monitoring process Methods 0.000 claims abstract description 24
- 238000012423 maintenance Methods 0.000 claims abstract description 20
- 230000003993 interaction Effects 0.000 claims abstract description 13
- 238000012545 processing Methods 0.000 claims description 12
- 230000000977 initiatory effect Effects 0.000 claims description 6
- 238000004458 analytical method Methods 0.000 claims description 4
- 238000001514 detection method Methods 0.000 claims description 4
- 238000012163 sequencing technique Methods 0.000 claims description 2
- 230000000875 corresponding effect Effects 0.000 description 105
- 230000006870 function Effects 0.000 description 82
- 238000010586 diagram Methods 0.000 description 16
- 230000005540 biological transmission Effects 0.000 description 8
- 230000008569 process Effects 0.000 description 8
- 230000009471 action Effects 0.000 description 4
- 230000008859 change Effects 0.000 description 3
- 238000013507 mapping Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 239000013307 optical fiber Substances 0.000 description 2
- 238000004806 packaging method and process Methods 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 230000001960 triggered effect Effects 0.000 description 2
- 208000033748 Device issues Diseases 0.000 description 1
- 241000282414 Homo sapiens Species 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 210000004556 brain Anatomy 0.000 description 1
- 239000011449 brick Substances 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000001276 controlling effect Effects 0.000 description 1
- 230000002596 correlated effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/10—Active monitoring, e.g. heartbeat, ping or trace-route
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Health & Medical Sciences (AREA)
- Cardiology (AREA)
- General Health & Medical Sciences (AREA)
- Small-Scale Networks (AREA)
Abstract
The application provides a communication method and a device for realizing dynamic connection of electronic devices, wherein the method is at least applied to a main control electronic device capable of being connected with a functional electronic device, and comprises the following steps: the main control electronic device executes on-line monitoring logic, connection of the current functional electronic device is detected and obtained, the current functional electronic device is maintained to be the on-line electronic device connected with the main control electronic device, position coding is carried out on the device identifier obtained in maintenance of the on-line electronic device, position numbers of the functional electronic device are obtained, interaction between the main control electronic device and the functional electronic device is initiated according to the position numbers, the problem that the electronic devices are difficult to locate in interconnection is solved, and the connection mode between the electronic devices is optimized.
Description
Technical Field
The application relates to the technical field of intelligent machine control, in particular to a communication method and device for realizing dynamic connection of electronic devices.
Background
With the advent and continuous development of various DIY intelligent machines, and intelligent machine suites, more and more DIY intelligent machines, such as DIY unmanned aerial vehicles, DIY dollies, intelligent robots, etc., are built by users based on various modular intelligent machine hardware, and more functions are given to the built intelligent machines through richer intelligent machine hardware.
In other words, various electronic devices, such as functional electronic devices in the form of electronic bricks, are available as a part of the hardware on the machine, and after being connected to the intelligent machine, the electronic devices can provide corresponding functions for the intelligent machine.
However, under the continuous evolution of freely building intelligent machines, electronic devices which can be freely connected with each other as intelligent machine hardware are more and more various and more in number, the connection relation between the electronic devices is more complex and dynamically changed, and for the electronic devices which can be dynamically changed at any time, how to communicate with each other so as to sense the current online electronic devices for the built intelligent machines at any time becomes a problem to be solved in the building of intelligent machine hardware.
Disclosure of Invention
The application aims at solving the technical problem that how to communicate electronic devices which have complex connection relation and can dynamically change at any time so that an intelligent machine can accurately sense the current on-line electronic devices.
According to an aspect of the embodiments of the present application, a communication method for implementing dynamic connection of electronic devices is disclosed, where the method is at least applied to a master electronic device capable of connecting to a functional electronic device, and the method includes:
The main control electronic device executes on-line monitoring logic to detect and obtain the connection of the current functional electronic device;
maintaining that the currently connected functional electronic device is an online electronic device connected with the main control electronic device;
Performing position coding on the device identifier obtained in the online electronic device maintenance to obtain the position number of the functional electronic device;
and initiating interaction between the main control electronic device and the functional electronic device according to the position number.
According to an aspect of the embodiments of the present application, it is disclosed that the main control electronic device executes on-line monitoring logic to detect a connection to a current functional electronic device, including:
The main control electronic device sends heartbeat packets to the functional electronic devices connected with the main control electronic device, and the heartbeat packets are transmitted according to the connection sequence among the functional electronic devices, so that the functional electronic devices connected in series receive the heartbeat packets;
The functional electronic device sends a feedback data packet of the received heartbeat packet to the main control electronic device;
And the main control electronic device detects and obtains the currently connected functional electronic device according to the device identifier carried by the feedback data packet.
According to an aspect of an embodiment of the present application, it is disclosed that the master electronic device sends a heartbeat packet to the functional electronic device connected thereto, comprising:
The main control electronic device sends heartbeat packets at regular time intervals according to the set time intervals, the heartbeat packets sent by the main control electronic device at regular time are received by the connected functional electronic device, and the heartbeat packets are used for initiating the functional electronic device to reply feedback data packets to the main control electronic device;
the functional electronic devices forward the heartbeat packet which is adapted to the next functional electronic device downwards according to the heartbeat packet received by the functional electronic devices, the heartbeat packets received by each functional electronic device in the functional electronic devices which are connected in series all carry corresponding physical sequence identifiers, and the physical sequence identifiers are used for indicating the connection positions of the corresponding functional electronic devices relative to the functional electronic devices which are connected in series.
According to an aspect of the embodiment of the present application, there is disclosed a method for forwarding a heartbeat packet adapted to a next functional electronic device downward by the functional electronic device according to a heartbeat packet received by the functional electronic device, including:
The functional electronic device directly connected with the main control electronic device analyzes the received heartbeat packet to obtain a physical sequence identifier carried by the heartbeat packet;
performing packet processing on the physical sequence identifier to obtain a heartbeat packet for forwarding downwards;
forwarding the heartbeat packet to the next functional electronic device.
According to an aspect of the embodiment of the present application, there is disclosed a method for forwarding a heartbeat packet adapted to a next functional electronic device downward by the functional electronic device according to a heartbeat packet received by the functional electronic device, including:
the functional electronic device analyzes the received heartbeat packet to obtain a physical sequence identifier of the last functional electronic device, and the heartbeat packet is forwarded by the last functional electronic device currently connected in series by the functional electronic device;
Updating the physical sequence identifier obtained by analysis to obtain a physical sequence identifier corresponding to the current functional electronic device;
the heartbeat packet for forwarding downwards is obtained for the physical sequence identification packet of the current functional electronic device and forwarded to the next functional electronic device.
According to an aspect of an embodiment of the present application, there is disclosed a method for a functional electronic device to send a feedback data packet of a received heartbeat packet to a master electronic device, including:
The method comprises the steps that a functional electronic device obtains a physical sequence identifier for downward forwarding, wherein the physical sequence identifier for downward forwarding is carried by a heartbeat packet for downward forwarding by the functional electronic device;
generating a feedback data packet according to the physical sequence identifier for forwarding downwards and the type identifier of the feedback data packet;
And uploading the feedback data packet to the main control electronic device.
According to an aspect of an embodiment of the present application, there is disclosed an on-line electronic device for maintaining a connection of the currently connected functional electronic device to the main control electronic device, including:
Searching preconfigured function description information according to the type identifier of the currently connected functional electronic device, wherein the function description information is at least used for indicating the function of the functional electronic device and a protocol format corresponding to the function;
And maintaining the functional electronic device as an online electronic device of the main control electronic device by loading the searched function description information to an online electronic device information set of the main control electronic device.
According to an aspect of the embodiment of the present application, it is disclosed that the device identifier includes a type identifier and a physical sequence identifier, and the performing location encoding on the device identifier obtained in the online electronic device maintenance to obtain a location number of the functional electronic device includes:
The main control electronic device uploads a feedback data packet carried by the online electronic device to obtain a type identifier and a physical sequence identifier carried by the feedback data packet, and the obtained type identifier and physical sequence identifier correspond to the same functional electronic device;
positioning the connection position of the functional electronic device corresponding to the type identifier according to the physical sequence identifier, wherein the connection position is used for indicating the front and rear positions of the functional electronic device corresponding to the type identifier and the physical sequence identifier relative to other functional electronic devices corresponding to the type identifier;
and for the functional electronic device, associating the type information mapped by the type identifier with the connection position to obtain a position number, wherein the position number is used for marking the connection sequence of the functional electronic device under the type of the electronic device.
According to an aspect of the embodiment of the present application, there is disclosed a connection location of a functional electronic device corresponding to a positioning type identifier according to the physical sequence identifier, including:
Sequencing the functional electronic devices according to the numerical value indicated by the physical sequence identification aiming at the functional electronic devices corresponding to the same port identification;
And obtaining connection positions of the functional electronic devices corresponding to the same type identifier under the ports from the sequenced functional electronic devices, wherein the connection positions indicate the ports of the functional electronic devices and the connection sequence of the functional electronic devices with the same type identifier under the ports relative to other functional electronic devices.
According to an aspect of an embodiment of the present application, a communication device for implementing dynamic connection of electronic devices is disclosed, where the device includes:
And a detection module: the main control electronic device is used for executing on-line monitoring logic, and detecting to obtain the connection of the current functional electronic device;
And a maintenance module: the device identification module is used for carrying out position coding on the device identification obtained in the online electronic device maintenance to obtain the position number of the functional electronic device;
And an interaction module: and the interaction between the main control electronic device and the functional electronic device is initiated according to the position number.
In the embodiment of the application, for a given master control electronic device, the master control electronic device is connected with a functional electronic device to realize the free construction of intelligent machine hardware, and is oriented to the functional electronic device dynamically connected on the master control electronic device, the master control electronic device firstly executes on-line monitoring logic to detect and obtain the connection of the current functional electronic device, the current connected functional electronic device is maintained to be the on-line electronic device connected with the master control electronic device, and the device identifier obtained in the maintenance of the on-line electronic device is subjected to the position coding to obtain the position number of the functional electronic device.
According to the position number, interaction between the main control electronic device and the functional electronic device is initiated, the on-line state of the functional electronic device is maintained, the position of the functional electronic device is numbered, quick and effective interaction between the main control electronic device and the functional electronic device is realized through the position number, the problem that the electronic devices are difficult to locate in interconnection is solved, and the connection mode between the electronic devices is optimized.
Other features and advantages of the application will be apparent from the following detailed description, or may be learned by the practice of the application.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
The above and other objects, features and advantages of the present application will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.
FIG. 1 is a schematic diagram of an architecture to which embodiments of the present application are applied.
Fig. 2 shows a flow chart of a communication method for implementing dynamic connection of electronic devices according to an embodiment of the application.
Fig. 3 shows a flow chart of the master electronic device performing on-line monitoring logic to detect a connection to a currently functional electronic device according to another embodiment of the present application.
Fig. 4 shows a flow chart of the master electronic device of the corresponding embodiment of fig. 3 sending a heartbeat packet to the functional electronic device connected thereto.
Fig. 5 shows a flow chart of the functional electronic device according to the corresponding embodiment of fig. 4 forwarding down the heartbeat packet adapted to the next functional electronic device according to the heartbeat packet received by the functional electronic device.
Fig. 6 shows a flow chart of a functional electronic device forwarding down a heartbeat packet adapted to a next functional electronic device according to a heartbeat packet received by the functional electronic device itself, according to another embodiment of the present application.
Fig. 7 shows a flow chart of the functional electronic device according to the corresponding embodiment of fig. 3 sending feedback data packets of the received heartbeat packet to the master electronic device.
Fig. 8 shows a flow chart of maintaining online electronic devices of a currently connected functional electronic device as a master electronic device connection according to another embodiment of the present application.
Fig. 9 shows a flow chart of location encoding of device identifications obtained in online electronic device maintenance to obtain location numbers of functional electronic devices according to another embodiment of the present application.
Fig. 10 is a flowchart illustrating determining a front-back position of a corresponding functional electronic device relative to other functional electronic devices to obtain a connection position of the corresponding functional electronic device according to an embodiment of the present application.
Fig. 11 is a flowchart showing a process of obtaining a position number of a functional electronic device by performing position coding on a device identifier obtained in online electronic device maintenance according to an embodiment of the present application.
Fig. 12 is a schematic diagram showing a manner of implementing dynamic connection of electronic modules by a communication method between electronic modules by constructing a DIY intelligent machine dolly based on the electronic modules belonging to the electronic devices according to the embodiment of the present application.
Fig. 13 shows a schematic diagram of a master electronic module according to an embodiment of the present application sending heartbeat packets to a functional electronic module connected thereto and listening for feedback packets at the same time intervals.
Fig. 14 is a schematic diagram showing a functional electronic module according to an embodiment of the present application receiving a heartbeat packet, generating a feedback data packet by using the heartbeat packet, and uploading the feedback data packet to a main control electronic module.
Fig. 15 shows a schematic diagram of the position numbering of the functional electronic module connected to the main control electronic module by the main control electronic module when the electronic module has an expansion function according to an embodiment of the present application, so as to obtain two different manners of position numbering.
FIG. 16 is a schematic diagram of a functional electronic queue incorporating a plurality of functional electronic modules connected in parallel with one another into a series, in accordance with one embodiment of the present application.
Fig. 17 is a schematic diagram of a communication device for implementing dynamic connection of electronic devices according to an embodiment of the present application.
Fig. 18 shows a hardware configuration diagram of an electronic device dynamic connection apparatus according to an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more example embodiments. In the following description, numerous specific details are provided to give a thorough understanding of example embodiments of the application. One skilled in the relevant art will recognize, however, that the application may be practiced without one or more of the specific details, or with other methods, components, steps, etc. In other instances, well-known structures, methods, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware electronics or integrated circuits or in different networks and/or processor means and/or microcontroller means.
Referring to fig. 1, fig. 1 is a schematic diagram of an architecture according to an embodiment of the present application. The architecture is configured on intelligent devices such as DIY-capable intelligent machines, intelligent machine kits and the like, so that rich functions, even more newly added functions are realized through the architecture.
The architecture at least comprises a main control electronic device 11 and a plurality of functional electronic devices 12, wherein the functional electronic devices 12 can be dynamically connected with the main control electronic device 11, and the functional electronic devices connected with the main control electronic device 11 are connected with other functional electronic devices.
The functional electronic device 12 is selected according to the functions required to be configured by the intelligent machine and is dynamically connected to the main control electronic device 11 at any time. It should be noted that the connection of a functional electronic device 12 to the main control electronic device 11 includes the direct connection of the functional electronic device 12 to the main control electronic device 11, and also includes the indirect connection to the main control electronic device 11 through other functional electronic devices 12, which is not limited herein.
For the function configuration above the main control electronic device 11, the connection with other functional electronic devices 12 is realized only through the port configured by the main control electronic device 11 or the port configured by the connected functional electronic device 12, so that the communication and positioning of the main control electronic device 11 and the functional electronic device 12 can be realized by operating the method of the application, and the corresponding function is triggered.
It should be understood that the number of functional electronic devices 12 in fig. 1 is merely illustrative. There may be any number of functional electronic devices 12, of which the types may be varied, and some of the functional electronic devices 12 may of course correspond to the same type, as desired for implementation. The functional electronics 12 will be connected at any number of either ports or only ports of the master electronics.
Some of the technical solutions of the embodiments of the present application may be implemented based on the architecture shown in fig. 1 or a modified architecture thereof.
Referring to fig. 2, fig. 2 is a flow chart illustrating a communication method for implementing dynamic connection of electronic devices according to an embodiment of the present application. The embodiment of the application provides a communication method for realizing dynamic connection between electronic devices, which is at least applied to a main control electronic device capable of being connected with a functional electronic device, is further used for sensing the functional electronic device dynamically connected with the main control electronic device, and realizes communication between the main control electronic device and the functional electronic device.
Firstly, the electronic device comprises a main control electronic device and a functional electronic device, and the method is operated on the electronic devices such as the main control device, the functional electronic device and the like, on one hand, the functional electronic device which can be dynamically connected to the main control electronic device at any moment is perceived, and on the other hand, the interaction between the electronic device and the main control electronic device is realized for the functional electronic device which is dynamically connected to the main control electronic device at any moment.
In short, a plurality of functional electronic devices are dynamically connected, one functional electronic device is distributed at different positions in the functional electronic devices connected in series, and information transmission between the functional electronic devices and the main control electronic device is realized through mutual matching among the functional electronic devices, so that the functions of the functional electronic devices are triggered.
It should be understood that the electronic device refers to a modularized hardware functional unit, which can be used, combined or replaced with other components, and is a program unit having a function of independently executing some kind of function; the master control electronic device of the electronic device has similar functions as the CPU of the brain and computer of human beings, is the center for commanding and controlling other functional electronic devices, and can also communicate with other functional electronic devices; the functional electronic device of the electronic device is hardware corresponding to a specific device function, and for the intelligent machine where the specific device function is implemented, the corresponding functional electronic device operation initiated under the control of the main control electronic device is implemented. The functional electronic devices can be used to implement specific functions, and the functional electronic devices are integrated so as to meet all functions of the whole intelligent machine.
As shown in fig. 2, in an embodiment of the present application, a communication method for implementing dynamic connection of electronic devices includes:
Step S210, the main control electronic device executes on-line monitoring logic, and the connection of the current functional electronic device is obtained through detection;
step S220, maintaining the currently connected functional electronic device as an online electronic device connected with the main control electronic device;
Step S230, carrying out position coding on the device identifier obtained in the maintenance of the online electronic device to obtain the position number of the functional electronic device;
step S240, initiating interaction between the main control electronic device and the functional electronic device according to the position number.
These steps are described in detail below.
In step 210, on-line monitoring logic is used to detect for the master electronics the currently connected functional electronics. It should be appreciated that the functional electronics are connected directly or indirectly to the main control electronics in a pluggable manner. For the main control electronic device, the connected functional electronic device is newly added or removed at any time, so that the main control electronic device needs to sense the currently connected functional electronic device through the execution of the on-line monitoring logic so as to ensure that the main control electronic device faces to the connected functional electronic device.
In order to acquire the online state of the functional electronic device, the main control electronic device monitors the connected functional electronic device online, namely judges and identifies which functional electronic devices are connected currently. For the master electronic device, the connected functional electronic device is in a triggerable functional state. For the intelligent machine and the intelligent machine suite where the master control electronics are located, which functional electronics are currently connected, the functions that the master control electronics are currently able to control to implement are mapped.
Under the action of the on-line electronic monitoring logic, the main control electronic device accurately senses the access and the removal of the functional electronic device, so that the timely response and the control of the currently accessed functional electronic device are ensured, the invalid control of the removed functional electronic device is avoided, and the reliability of the dynamically connected functional electronic device is enhanced.
For the master electronics, the different functional electronics connected will build different smart machine morphologies, as well as functions. The functional electronic device is connected and removed, the form of the intelligent machine is changed, the functional change of the intelligent machine is also caused, and the main control electronic device can dynamically adapt to the connection and removal of the functional electronic device through the execution of the on-line monitoring logic, so that the operation robustness of the intelligent machine is enhanced.
For example, the online monitoring logic may reach the determination of the currently connected functional electronic device via a heartbeat packet. Specifically, in the execution of the on-line monitoring logic, the main control electronic device obtains a feedback data packet returned by each functional electronic device through the sending of the heartbeat packet, and then obtains the currently connected functional electronic device through the feedback data packet returned by each functional electronic device.
Illustratively, a plurality of functional electronic devices are connected to a port of a master electronic device, which sends heartbeat packets to the port to trigger feedback from the functional electronic devices. Correspondingly, if the port is connected with the functional electronic device, the connected functional electronic device receives the heartbeat packet and returns a feedback data packet to the main control electronic device based on the received heartbeat packet, the heartbeat packet on the functional electronic device is continuously transmitted to the next functional electronic device, if the next functional electronic device receives the heartbeat packet, the corresponding feedback data packet is returned to the main control electronic device, and the main control electronic device realizes on-line monitoring of the connected functional electronic device through the received feedback data packet.
In other words, the transfer of the heartbeat packet is performed on the interconnected functional electronic devices. The functional electronic devices directly connected to the main control electronic device are often connected in series with a group of functional electronic devices, each functional electronic device is to be a node for receiving the heartbeat packet, and the received heartbeat packet is sent by the previous node, so that the main control electronic device is taken as a sending end to initiate the transmission of the heartbeat packet, each functional electronic device sequentially connected to the main control electronic device is taken as a one-hop node, and the heartbeat packet is transmitted to the next-hop node.
In response, after receiving the heartbeat packet, any functional electronic device returns a feedback data packet to the main control electronic device based on the heartbeat packet, wherein a return path of the feedback data packet is consistent with a sending path of the heartbeat packet.
It should also be added that the functional electronic devices performed by the master electronic device are dynamically connected, and the functional electronic devices may be in a serial relationship and/or a parallel relationship with respect to the master electronic device; in addition, the functional electronic devices can be in a serial connection and/or a parallel connection to meet various requirements, and then the on-line monitoring logic executed by the main control electronic device senses the functional electronic devices facing the serial connection and/or the parallel connection.
Referring to fig. 3, fig. 3 is a flowchart illustrating a method for detecting a connection of a current functional electronic device by a master electronic device executing on-line monitoring logic according to an embodiment of the present application. In this embodiment, the main control electronic device executes the online monitoring logic, and the step S210 of detecting the connection of the current functional electronic device includes:
Step S211: the main control electronic device sends heartbeat packages to the functional electronic devices connected with the main control electronic device, and the heartbeat packages are transmitted according to the connection sequence among the functional electronic devices, so that the functional electronic devices connected in series receive the heartbeat packages;
Step S212: the functional electronic device sends a feedback data packet of the received heartbeat packet to the main control electronic device;
step S213: and the main control electronic device detects according to the device identifier carried by the feedback data packet to obtain the currently connected functional electronic device.
These three steps are described in detail below.
In step S211, as indicated previously, the master electronics send heartbeat packets to the functional electronics connected thereto, including the master electronics sending heartbeat packets to the functional electronics directly connected thereto, and the master electronics sending heartbeat packets to the functional electronics connected thereto. Specifically, in order to realize the function of the functional electronic device under the control of the main control electronic device, the main control electronic device is at least connected with one functional electronic device, and the main control electronic device sends a heartbeat packet to the functional electronic device so as to trigger the functional electronic device to generate a feedback data packet. It should be understood that the manner in which the main control electronic device sends the heartbeat packet to the functional electronic device may be set by a user, and after the functional electronic device receives the heartbeat packet sent by the main control electronic device by a user, the functional electronic device generates a feedback data packet according to information carried by the heartbeat packet, and continuously transmits the heartbeat packet to the next functional electronic device connected with the feedback data packet, so that all the functional electronic devices connected with the main control electronic device can receive the heartbeat packet.
Exemplary ways of sending heartbeat packets include: (1) Automatically sending according to the same time interval set by the main control electronic device; (2) Setting a triggering event by a user, wherein the triggering event occurs, and the heartbeat package is automatically sent; (3) And the main control electronic device sends the heartbeat package according to the control of the user.
In one embodiment, in order to update the online of the functional electronic device at regular intervals, the main control electronic device sends heartbeat packets to the functional electronic device at equal intervals according to the setting, so as to acquire online information of the functional electronic device for the main control electronic device, namely a feedback data packet replied by the online functional electronic device, so that the functional electronic device currently online can be timely and accurately confirmed through information carried in the feedback data packet.
With the heartbeat packet sent by the master control electronic device, the sent heartbeat packet is transmitted on each connected functional electronic device according to the connection sequence between the functional electronic devices, and then each functional electronic device receives the heartbeat packet sent by the master control electronic device or the last connected functional electronic device.
Referring to fig. 4, fig. 4 is a flowchart showing a master electronic device sending a heartbeat packet to a functional electronic device connected thereto according to the corresponding embodiment of fig. 3.
Step S211 of the master electronic device sending a heartbeat packet to the functional electronic device connected thereto, includes:
Step S2111, the main control electronic device sends heartbeat packets at regular time intervals, the heartbeat packets sent by the main control electronic device at regular time are received by the connected functional electronic device, and the heartbeat packets are used for initiating the functional electronic device to reply feedback data packets to the main control electronic device;
In step S2112, the functional electronic device forwards the heartbeat packet adapted to the next functional electronic device downward according to the heartbeat packet received by itself.
These two steps are described in detail below.
In step S2111, a time interval for transmitting the heartbeat packet is preset, and the size of the time interval is related to the accuracy degree to which the main control electronic device perceives the connected functional electronic device. The main control electronic device sends heartbeat packets to the functional electronic devices connected with the main control electronic device at regular time according to the preset time interval.
Under the timing sending of the heartbeat packet executed by the main control electronic device, the functional electronic device directly or indirectly connected with the main control electronic device receives the heartbeat packet sent by the previous electronic device, and further initiates the feedback data packet reply to the main control electronic device.
In step S2112, for the functional electronic device that receives the heartbeat packet, the physical sequence identifier carried by the received heartbeat packet corresponds to the electronic device that sends the heartbeat packet, such as the master electronic device directly connected to the functional electronic device, or the last functional electronic device connected to the functional electronic device.
It should be understood that, for the implementation of the present application, by receiving the feedback packet, the master electronic device is able to determine, via the functional electronic device that replies to the feedback packet, the functional electronic device that is currently on-line, and is able to determine, via the physical sequence identifier carried by the feedback packet, the connection location of the functional electronic device with respect to the other functional electronic devices.
For the transmission of the heartbeat package in each functional electronic device, after the functional electronic device receives the heartbeat package, the heartbeat package adapted to the next functional electronic device needs to be obtained according to the received heartbeat package so as to continuously forward the heartbeat package downwards. It should be noted that, the heartbeat packet adapted to the next functional electronic device refers to a heartbeat packet that carries at least a physical sequence identifier corresponding to the functional electronic device in which it is currently located. In other words, the information carried by the heartbeat packet indicates, on the one hand, the functional electronics of the currently forwarded heartbeat packet and, on the other hand, also the physical sequence identity.
For the next functional electronic device, the adapted heartbeat packet can reliably and accurately obtain the physical sequence identifier for marking the connection sequence of the heartbeat packet through the flow of the heartbeat packet by carrying the physical sequence identifier for indicating the connection sequence of the last functional electronic device, so that the positioning of the heartbeat packet is achieved with high reliability.
For the functional electronic devices connected in series, one functional electronic device forwards the heartbeat packet downwards to the next connected functional electronic device, so that the front-back connection relation of the functional electronic device relative to the next functional electronic device is confirmed. And for the next functional electronic device, the physical sequence identifier carried in the received heartbeat packet will uniquely identify the last functional electronic device in connection relation. For example, for interconnected functional electronic devices, the corresponding physical sequence identifier indicates the connection location of the interconnected functional electronic devices in a back-and-forth connection relationship with respect to the other connected functional electronic devices.
Further, for the heartbeat packet, it carries at least a physical sequence identifier. And the feedback data packet at least carries a device identifier corresponding to the functional electronic device, and the functional electronic device is a functional electronic device which returns the feedback data packet to the main control equipment. The device identifier comprises a physical sequence identifier, a port identifier and a type identifier corresponding to the functional electronic device. The device identifier corresponds to the functional electronic device that returned the feedback packet in which it is located, the device identifier being used to indicate its type for the corresponding functional electronic device, the port to which it is connected, and the connection location relative to the other functional electronic devices.
The device identifier at least comprises a physical sequence identifier and a type identifier, and the physical sequence identifier is used for indicating the connection position of the corresponding functional electronic device relative to other functional electronic devices connected in series.
The type identifier refers to a representation mode of type information of a certain type of functional electronic device, and different type identifiers respectively correspond to type information of different types of functional electronic devices in the data set. In the preconfigured data set, each type identifier has a unique mapping relation with the corresponding type information. And the main control electronic device acquires the type information of the electronic device from the data set according to the corresponding relation between the type identifier and the type information in the data set. The type information refers to information describing the primary classification and the secondary classification of the functional electronic device in detail.
The data set takes the type identifier as an index, records and records the function description information and the data form of the functional electronic device, including but not limited to the function description information of the functional electronic device.
The function description information and the type identifier have a unique mapping relation, the function description information comprises type information which is preconfigured for corresponding functional electronic devices and is used for describing functions, names and type information of the functional electronic devices, and the function description information can be used for indicating the functions of the functional electronic devices and protocol forms corresponding to the functions.
When the electronic device is configured with the port expansion function, the port identification is added to the device identification, and the process is completed by the electronic device configured with the port expansion function. When the feedback data packet passes through or reaches each electronic device configured with the port expansion function, the port identification of the port through which the feedback data packet passes is added into the device identification. The port identification is used to indicate the port of the serial functional electronic connection in which the functional electronic device is located.
When the main control electronic device sends the heartbeat package to the functional electronic device connected with the main control electronic device, the functional electronic device receives the heartbeat package, analyzes the heartbeat package, removes the package head identifier and the package tail identifier to obtain the physical sequence identifier in the heartbeat package, and the physical sequence identifier is endowed to the functional electronic device directly connected with the main control electronic device, so that the main control electronic device corresponds to the functional electronic device. In this embodiment, after the functional electronic device directly connected with the main control electronic device receives the heartbeat packet, on one hand, a feedback data packet corresponding to the functional electronic device is generated according to a physical sequence identifier extracted from the heartbeat packet, and on the other hand, information carried in the heartbeat packet, such as the physical sequence identifier, is encapsulated to obtain a heartbeat packet adapted to the next functional electronic device, and then the heartbeat packet is forwarded to the next functional electronic device connected in series with the functional electronic device, so that each functional electronic device can receive the heartbeat packet until the last functional electronic device.
The heartbeat package can enable the functional electronic device to generate a feedback data package, and the physical sequence identifier is configured for the functional electronic device, wherein the physical sequence identifier is uniquely corresponding to the functional electronic device, so that the heartbeat package comprises but is not limited to a character segment which can enable the functional electronic device to generate the feedback data package and a character segment representing the physical sequence identifier, and the main control electronic device encapsulates information carried by the heartbeat package, a packet header identifier and a packet tail identifier, so as to obtain the heartbeat package for forwarding downwards.
Referring to fig. 5, fig. 5 is a flowchart showing the functional electronic device according to the corresponding embodiment of fig. 4 forwarding down the heartbeat packet adapted to the next functional electronic device according to the heartbeat packet received by the functional electronic device.
The step S2112 of the functional electronic device forwarding down the heartbeat packet adapted to the next functional electronic device according to the heartbeat packet received by the functional electronic device includes:
Step S301, a functional electronic device directly connected with a main control electronic device analyzes a received heartbeat packet to obtain a physical sequence identifier carried by the heartbeat packet;
Step S302, performing packet processing on the physical sequence identifier to obtain a heartbeat packet for forwarding downwards;
step S303, forwarding the heartbeat packet to the next functional electronic device.
These 3 steps are described in detail below.
In step S301, the functional electronic device is connected to the port of the main control electronic device, and the functional electronic device is directly connected to the main control electronic device. In this embodiment, the functional electronic device directly connected with the main control electronic device receives the heartbeat packet from the main control electronic device, analyzes the heartbeat packet to obtain a physical sequence identifier carried by the heartbeat packet, and directly uses the physical sequence identifier as a physical sequence identifier corresponding to the physical sequence identifier; under the condition that the functional electronic device is indirectly connected with the main control electronic device, when a heartbeat packet from the functional electronic device which is directly connected with the main control electronic device is received, the heartbeat packet is analyzed to obtain a physical sequence identifier carried by the heartbeat packet, and the physical sequence identifier is updated to obtain a physical sequence identifier corresponding to the functional electronic device, wherein the physical sequence identifier is used for indicating the connection position of the corresponding functional electronic device relative to the functional electronic device which is connected in series.
Illustratively, each of the functional electronic devices in the same series has a corresponding physical sequence identification. And the main control electronic device orders the functional electronic devices according to the numerical value indicated by the physical sequence identification to obtain the overall arrangement sequence of the functional electronic devices connected in series.
Illustratively, the analysis of the heartbeat package is an execution process that the functional electronic device removes the header identifier and the tail identifier of the received heartbeat package to obtain the physical sequence identifier.
In step S302, the functional electronic device directly connected to the main control electronic device obtains the physical sequence identifier through the execution of step S301, and encapsulates the physical sequence identifier with a packet header identifier and a packet tail identifier to obtain a heartbeat packet for forwarding downwards.
In this embodiment, the initial physical sequence identifier of the heartbeat packet sent by the master electronic device is not used by the functional electronic device, so that the physical sequence identifier sent by the heartbeat packet of the master electronic device is directly used by the connected functional electronic device. Therefore, the functional electronic device receives the initial physical sequence identification of the heartbeat packet sent by the main control electronic device, and the heartbeat packet is directly used without updating. And encapsulates this physical sequence identifier into a heartbeat packet for forwarding to the next functional electronic device. Further, the update to the physical order is to ensure that each functional electronic device has a unique corresponding physical order identifier. So as to achieve the aim of sorting according to the numerical value indicated by the physical sequence identifier.
In step S303, the functional electronic device encapsulates the used physical sequence identifier with the header identifier and the footer identifier, and forwards the encapsulated physical sequence identifier to the next functional electronic device directly connected to the header identifier and the footer identifier.
With continued reference to fig. 6, fig. 6 shows a flowchart of a functional electronic device forwarding down a heartbeat packet adapted to a next functional electronic device according to another embodiment of the present application based on a heartbeat packet received by the functional electronic device itself. In this embodiment, the step S2112 of the functional electronic device forwarding the heartbeat packet adapted to the next functional electronic device downward according to the heartbeat packet received by the functional electronic device includes:
step S401, the functional electronic device analyzes the received heartbeat packet to obtain the physical sequence identifier of the last functional electronic device;
step S402, updating the physical sequence identifier obtained by analysis to obtain a physical sequence identifier corresponding to the current functional electronic device;
step S403, the heartbeat packet for forwarding downward is obtained for the physical sequence identification packet of the current functional electronic device, and forwarded to the next functional electronic device.
These 3 steps are described in detail below.
In step S401, under the indirect connection between the functional electronic device and the main control electronic device, the functional electronic device receives the heartbeat packet from the previous functional electronic device, and removes the packet header identifier and the packet tail identifier to obtain a physical sequence identifier corresponding to the previous functional electronic device, where the physical sequence identifier is already used, i.e. has been assigned to the previous functional electronic device, and is not available for the current functional electronic device.
In this embodiment, in order to facilitate the master control electronic device to order the corresponding functional electronic devices according to the physical sequence identifier, it is necessary to ensure that the physical sequence identifier is only used once in the same functional electronic device connected in series, so when the physical sequence identifier obtained by the functional electronic device is the physical sequence identifier of the last functional electronic device, the physical sequence identifier needs to be updated to obtain the physical sequence identifier corresponding to the functional electronic device.
In step S402, the functional electronic device changes the content of the character segment as the physical sequence identifier for the obtained physical sequence identifier of the last functional electronic device, for example, please refer to fig. 14, after receiving the heartbeat packet from the last functional electronic device directly connected with the former functional electronic device, parse the heartbeat packet to obtain the physical sequence identifier corresponding to the last functional electronic device, update the physical sequence identifier (for example, add 1 to the dev_id field) to obtain the physical sequence identifier uniquely corresponding to itself, make the physical sequence identifier be different from the used physical sequence identifier, and according to the sequence relationship between the newly generated physical sequence identifier and the used physical sequence identifier, generate the physical sequence identifier corresponding to the current functional electronic device through the update.
In step S403, the physical sequence identifier corresponding to the current functional electronic device is encapsulated with the header identifier and the footer identifier, so as to obtain a heartbeat packet for forwarding to the next functional electronic device directly connected to the functional electronic device.
The step of forwarding the heartbeat packet adapted to the next functional electronic device downwards for the above-mentioned functional electronic devices according to the heartbeat packet received by the functional electronic devices, through the change of the physical sequence identifier, the effect of determining the connection position of the functional electronic devices in the serial functional electronic devices through the physical sequence identifier corresponding to each functional electronic device is achieved.
Further, it is definable whether the physical sequence identifier is updated before use or after use after the functional electronic device receives it.
In this embodiment, the physical sequence identifier corresponding to the previous functional electronic device is accepted by the functional electronic device, so that the physical sequence identifier corresponding to the present functional electronic device needs to be updated, and the heartbeat packet generated according to the physical sequence identifier is used for downward rotation. This is the case, i.e. the physical sequence identity described above is updated before use after the functional electronic device receives it.
In another case, the physical sequence identifier received by the functional electronic device is the physical sequence identifier corresponding to the functional electronic device, after generating the feedback data packet according to the physical sequence identifier, the functional electronic device updates the physical sequence identifier to obtain the physical sequence identifier corresponding to the next functional electronic device, and generates the heartbeat packet for forwarding downwards according to the physical sequence identifier.
Referring to fig. 7, fig. 7 is a flowchart showing the functional electronic device according to the corresponding embodiment of fig. 3 sending a feedback packet of the received heartbeat packet to the main control electronic device.
Step S212 of the functional electronic device sending a feedback data packet of the received heartbeat packet to the main control electronic device, includes:
Step S2121, the functional electronic device obtains a physical sequence identifier for forwarding downwards, where the physical sequence identifier for forwarding downwards is carried by a heartbeat packet for forwarding downwards by the functional electronic device;
step S2122, generating a feedback data packet according to the physical sequence identifier for forwarding downwards and the type identifier of the feedback data packet;
Step S2123, upload the feedback packet to the main control electronics.
These 3 steps are described in detail below.
In step S2121, the functional electronic device obtains the physical sequence identifier corresponding to the functional electronic device, that is, the physical sequence identifier used by the functional electronic device for forwarding downwards, and when the next functional electronic device uses the physical sequence identifier, the next functional electronic device also needs to update to obtain the corresponding physical sequence identifier.
In this embodiment, the functional electronic device directly connected to the main control electronic device, and the physical sequence identifier included in the received heartbeat packet corresponds to the physical sequence identifier of the functional electronic device; for the functional electronic device indirectly connected with the main control electronic device, the indirect connection means that other functional electronic devices are also connected between the functional electronic device and the main control electronic device, and when the functional electronic device indirectly connected with the main control electronic device receives a heartbeat packet transmitted from the functional electronic device connected with the main control electronic device, the physical sequence identifier acquired by analyzing the heartbeat packet needs to be updated, so that the physical sequence identifier which corresponds to the functional electronic device and can be used for forwarding downwards can be obtained.
In step S2122, the functional electronic device encapsulates the obtained physical sequence identifier for forwarding downward and the type identifier corresponding to the physical sequence identifier, and then encapsulates the physical sequence identifier and the type identifier to generate a feedback data packet. Each type of functional electronic device has a corresponding type identifier, and the type identifier, the physical sequence identifier, the packet header identifier and the packet tail identifier are added to encapsulate the type identifier and the physical sequence identifier when forming the feedback data packet, so as to obtain the feedback data packet for uploading to the main control electronic device.
After the functional electronic device generates the feedback data packet, the functional electronic device sends the generated feedback data packet to the last functional electronic device connected thereto, and so on, until reaching the master electronic device, the last functional electronic device continues to transmit the feedback data packet to the last functional electronic device connected thereto.
In the process of transmitting the feedback data packet to the main control electronic device, if the feedback data packet passes through the functional electronic device with the port expanding function, unpacking the feedback data packet, and adding a port identifier corresponding to the port through which the feedback data packet passes.
According to an embodiment of the application, when the feedback data packet passes through the functional electronic device with the port expansion function in the transmission process, the functional electronic device with the port expansion function also analyzes the feedback user data packet, adds the port identifier into the existing device identifier, encapsulates the new device identifier, and continues to transmit the last functional electronic device connected with the new device identifier upwards until reaching the main control electronic device.
And the main control electronic device monitors and receives the feedback data packet, removes the packet head identifier and the packet tail identifier of the feedback data packet for the received feedback data packet, and obtains the device identifier carried by the feedback data packet. Further, in the interconnected electronic devices, when one or several electronic devices, for example, the main control electronic device and/or the functional electronic device, are provided with the port expansion function, the main control electronic device needs to complete positioning of the functional electronic device connected with the main control electronic device according to the physical sequence identifier and the port identifier in the device identifier. When the interconnected electronic devices do not have the port expanding function, the connection position of the functional electronic devices connected with the main control electronic device is obtained only according to the physical sequence identification, and the position number of each functional electronic device is obtained according to the type information mapped by the type identification and the connection position. Therefore, when the functional electronic device is controlled, the main control electronic device is directly positioned according to the position number, the functional electronic device is more conveniently controlled, and the positioning error of the functional electronic device is greatly reduced.
In step S220, the main control electronic device performs on-line monitoring on the functional electronic device according to the feedback data packet of the functional electronic device through the execution of step S210. When the online monitoring logic detects that one functional electronic device is connected, firstly, searching whether corresponding functional description information exists in a data set according to the type identifier, if so, loading all the functional description information and protocol formats of the functional electronic device, maintaining the functional description information and the protocol formats in an online electronic device list, if not, loading relevant information of the functional electronic device into the data set, sending a heartbeat packet, receiving a feedback data packet, repeating the step of acquiring the information of the feedback data packet, obtaining the functional description information of the functional electronic device, and updating the functional description information into the online functional electronic device list.
The on-line electronic device list refers to an information set composed of function description information of the functional electronic devices connected to the main control electronic device. With the sending of the heartbeat and the updating of the feedback data packet, the online electronic device list is continuously dynamically changed, such as updating the working state of the electronic device.
The presence of the online electronic device list is convenient for the processing of the main control electronic device, and various functional electronic devices respond to feedback information generated by the control of the main control electronic device, for example, one functional electronic device is a temperature sensing electronic device, the functional electronic device needs to upload temperature information to the main control electronic device, the main control electronic device can acquire a protocol format according to the information of the functional electronic device in the online electronic device list, and the temperature data is analyzed according to the protocol format and stored in the cache.
Referring to fig. 8, fig. 8 shows a flow chart of maintaining online electronic devices with currently connected functional electronic devices as master electronic device connections according to one embodiment of the application. A step S220 of maintaining the currently connected functional electronic device as an online electronic device connected to the main control electronic device, includes:
Step S221, searching for pre-configured function description information according to the type identifier of the currently connected functional electronic device, wherein the function description information is at least used for indicating the function of the functional electronic device and the protocol format corresponding to the function;
In step S222, the functional electronic device is maintained as the on-line electronic device of the main control electronic device by loading the searched function description information into the on-line electronic device list of the main control electronic device.
The following describes the two steps in detail.
In step S221, the type identifier of the functional electronic device is acquired, and the type information corresponding to the type identifier is searched in the data set of the main control electronic device according to the correspondence between the type identifier and the type information.
The pre-configuration process is to store the function description information of the functional electronic device into the main control electronic device in advance.
In step S222, by loading the function description information corresponding to the functional electronic devices in the dataset into the online electronic device list, all the function description information of the functional electronic devices connected with the main control electronic device can be directly queried according to the online electronic device list, that is, the online electronic device that maintains the functional electronic device as the main control electronic device is completed.
In step S230, when the main control electronic device or the functional electronic device connected with the main control electronic device has a port expanding function, the main control electronic device determines a connection position of the functional electronic device connected with the main control electronic device according to the physical sequence identifier and the port identifier in the device identifier; when the main control electronic device and the functional electronic devices connected with the main control electronic device do not have a port expanding function, the corresponding functional electronic devices are ordered according to the numerical values indicated by the physical sequence identifiers, so that the connection positions of the functional electronic devices are determined, and the position numbers of the functional electronic devices are obtained according to the type information mapped by the type identifiers and the connection positions.
The position numbering of the functional electronic device includes the following two forms,
Firstly, sorting the functional electronic devices according to the numerical value indicated by the physical sequence identifier, acquiring type information mapped by the type identifier of each functional electronic device according to the type identifier, and numbering the functional electronic devices one by one according to the connection sequence according to the connection positions of all the functional electronic devices.
And secondly, screening the functional electronic devices with the same type identification according to the type identification of the functional electronic devices, obtaining the connection position of each functional electronic device relative to all other similar functional electronic devices according to the physical sequence identification of the functional electronic devices with the same type identification, and obtaining the position numbers of the functional electronic devices under the same type according to the type information corresponding to the type identification and the connection positions.
Referring to fig. 9, fig. 9 is a flow chart illustrating the process of encoding the location of a device identifier obtained during online electronic device maintenance to obtain a location number of a functional electronic device according to one embodiment of the present application. The embodiment of the application realizes that the main control electronic device numbers the position of the connected functional electronic device according to the device identification.
The step S230 of performing location encoding on the device identifier obtained in the online electronic device maintenance to obtain a location number of the functional electronic device includes:
step S231, uploading a feedback data packet by the main control electronic device through the online electronic device, and acquiring a type identifier and a physical sequence identifier carried by the feedback data packet, wherein the acquired type identifier and physical sequence identifier correspond to the same functional electronic device;
Step S232, positioning the connection position of the functional electronic device corresponding to the type identifier according to the physical sequence identifier, wherein the connection position is used for indicating the front and rear positions of the type identifier and other functional electronic devices corresponding to the functional electronic device corresponding to the physical sequence identifier relative to the type identifier;
step S233, for the functional electronic device, the type information mapped by the type identifier is correlated with the connection position to obtain a position number, and the position number is used for indicating the connection sequence of the functional electronic device under the type of the electronic device.
These three steps are described in detail below.
In step S231, the main control electronic device obtains the device identifier of the functional electronic device by removing the header identifier and the footer identifier from the feedback data packet, where the device identifier at least includes a type identifier and a physical sequence identifier corresponding to the same functional electronic device, and the main control electronic device determines the connection position and type information of the functional electronic device connected with the main control electronic device according to the physical sequence identifier and the type identifier of the functional electronic device.
In step S232, the main control electronic device determines, according to the obtained physical sequence identifier of the functional electronic device, a connection position of the corresponding functional electronic device in the other functional electronic devices.
Illustratively, the master electronic device reads a physical sequence identity, the physical sequence identity of each functional electronic device being unique, the master electronic device ordering the functional electronic devices according to the magnitude of the value indicated by the physical sequence identity,
In another embodiment of the present application, if a specific electronic device of the functional electronic devices has a port expanding function, a group of functional electronic devices connected in series with each other is connected to a port of the specific functional electronic device, and before positioning connection positions between each other in the functional electronic devices corresponding to the same type of identification according to the physical sequence identification, the step S232 of performing position coding of the functional electronic device corresponding to the same type under the port using the device identification obtained in the on-line electronic device maintenance, and therefore positioning the connection position of the functional electronic device corresponding to the type identification according to the physical sequence identification should further include:
According to the port identification carried by the feedback data packet, determining the functional electronic devices corresponding to the same port identification;
And for the functional electronic devices with the same port identifiers, obtaining the connection positions of the corresponding functional electronic devices in the functional electronic devices with the same port identifiers connected in series according to the type identifiers and the physical sequence identifiers carried by the feedback data packet.
Referring to fig. 10, fig. 10 is a flowchart illustrating a determination of a front-back position of a corresponding functional electronic device relative to other functional electronic devices to obtain a connection position of the corresponding functional electronic device according to an embodiment of the present application. The embodiment of the application realizes that the main control electronic device obtains the connection position of the functional electronic device through the type identifier, the physical sequence identifier and the port identifier.
Step S232 of identifying the connection location of the functional electronic device corresponding to the location type identifier according to the physical sequence identifier includes:
Step S2321, sorting the functional electronic devices according to the numerical value indicated by the physical sequence identifier, facing a plurality of functional electronic devices corresponding to the same port identifier;
Step S2322, from the ordered functional electronic devices, obtaining connection positions of the functional electronic devices corresponding to the same type identifier under the ports, wherein the connection positions indicate the ports of the functional electronic devices and connection sequences of the functional electronic devices with the same type identifier under the ports.
These two steps are described in detail below.
In step S2321, the master control electronic device screens out the functional electronic devices with the same port identifier according to the different port identifiers, and sorts the functional electronic devices with the same port identifier according to the numerical values represented by the physical sequence identifiers of the functional electronic devices, so as to obtain the arrangement sequence of the functional electronic devices.
In this embodiment, a specific electronic device in the functional electronic devices has a port expansion function, in other words, the specific electronic device is configured with a plurality of ports, and a group of functional electronic devices can be connected in series and pluggable on each port, so that the functional electronic devices of each group are connected in parallel under the action of the specific electronic device. For each port, connecting a plurality of functional electronic devices in series, when the main control electronic device sends a heartbeat packet to the functional electronic device, and when the main control electronic device passes through the specific electronic device with the port expansion function, the specific electronic device copies the heartbeat packet and simultaneously sends the heartbeat packet to each port; and when the specific electronic device with the port expanding function passes through the specific electronic device, the specific electronic device removes a packet head identifier and a packet tail identifier of the feedback data packet, adds a port identifier into a device identifier carried by the feedback data packet to form a new device identifier, and the port identifier is used for indicating the port position connected with the functional electronic device corresponding to the feedback data packet.
In step S2322, the main control electronic device obtains connection positions of the functional electronic devices under the same port identification according to the ordering of the functional electronic devices under the same port identification, wherein the connection positions indicate the port where the functional electronic device is located and the connection sequence of the functional electronic devices under the port relative to other functional electronic devices
In step S233, the type identifier obtains the type information of the corresponding functional electronic device in the master device according to the correspondence relationship with the type information. And obtaining the position number of the functional electronic device according to the type information of the functional electronic device and the connection positions in other functional electronic devices.
Referring to fig. 11, fig. 11 is a flowchart illustrating a method for obtaining a position number of a functional electronic device by performing position coding on a device identifier obtained in online electronic device maintenance according to another embodiment of the present application. The embodiment of the application realizes that the main control electronic device numbers the position of the connected functional electronic device according to the device identification.
The step S230 of obtaining the position number of the functional electronic device by performing the position coding on the device identifier obtained in the online electronic device maintenance, includes:
step S501: according to the ports indicated by the connection positions, all functional electronic devices under adjacent ports are connected end to end;
Step S502: in the queue obtained by end-to-end connection, according to the sequence identifiers corresponding to the functional electronic devices in the queue, updating the connection positions of the corresponding functional electronic devices in the functional electronic devices with the same type identifier, wherein the connection positions belong to the type;
step S503: and correlating the updated connection position with the type information of the type identification mapping to obtain a position number.
These three steps are described in detail below.
In step S501, in order to describe the embodiment in detail, the case that the functional electronic devices are connected in series under the same port is defined as a functional electronic device string, the case that the functional electronic device strings are connected end to end is defined as a functional electronic device queue, and according to the port identifications, the functional electronic device strings with adjacent port identifications are connected end to obtain the functional electronic device queue.
The specific electronic device with the port expanding function and the main control electronic device are provided with the function of integrating the parallel functional electronic device strings connected with the specific electronic device into a functional electronic device queue, the function can be understood as integrating a plurality of parallel functional electronic device strings into a serial functional electronic device, and it is understood that the specific electronic device with the port expanding function can select whether to connect the parallel functional electronic device strings with the specific electronic device end to end so as to obtain the functional electronic device queue. Meanwhile, if a plurality of electronic devices with the port expansion function exist, the electronic devices with the port expansion function can repeat the steps, and the electronic device queues in the parallel connection mode are converted into the electronic device queues in the parallel connection mode.
In step S502, the master electronic device obtains the mutual positions of the functional electronic devices having the same type identifier according to the type identifier corresponding to each of the functional electronic devices in the functional electronic device queue and the physical sequence identifier.
In step S503, the functional electronic devices with the same type identifier are screened according to the obtained mutual positions of the functional electronic devices with the same type identifier and the type information corresponding to the type identifier, the connection position of each functional electronic device relative to all other similar functional electronic devices is obtained according to the physical sequence identifier of the functional electronic devices with the same type identifier, and the position numbers of the functional electronic devices under the same type are obtained according to the type information of the functional electronic devices and the connection positions.
In step S240, when the main control electronic device issues an instruction to the functional electronic device, the functional electronic device is positioned by the position number, so as to ensure that the instruction of the main control electronic device accurately reaches the functional electronic device.
Before an instruction and a position number are sent to a functional electronic device, the main control electronic device converts address information contained in the position number into a device identification form according to a data set, namely before the instruction data is forwarded downwards, the position number in the instruction data is converted into a physical sequence identification and a type identification corresponding to the physical sequence identification according to the data set, if the position number indicates the position of a port connected with the corresponding functional electronic device, the position number is converted into the port identification, then the instruction data is packaged together with a packet header identifier and a packet tail identifier, so that an instruction data packet for issuing the instruction to the functional electronic device is obtained, and the instruction data packet comprises, but is not limited to, the device identification and the instruction information based on the functions of the instruction data packet.
The following describes how to implement dynamic connection of electronic devices by a communication method between electronic devices, taking the structure obtained by building a DIY intelligent machine trolley by an electronic module belonging to the electronic devices as an example.
Referring also to fig. 12, fig. 12 is a schematic diagram showing a method for implementing dynamic connection of electronic modules by a communication method between electronic modules according to an embodiment of the present disclosure, wherein the method is based on the electronic modules belonging to the electronic devices. As can be seen from fig. 12, the electronic modules used to construct the DIY smart machine cart and the connection relationship between the electronic modules.
Firstly, it can be clear that in the embodiment, the structure for constructing the connection of the electronic modules of the DIY intelligent machine trolley comprises a main control electronic module and functional electronic modules, wherein two ports are arranged on the main control electronic module, one port is connected with a group of functional electronic modules in series through a uart serial port, the other port is connected with a function expansion board through the uart serial port, the function expansion board is provided with M ports, so that the main control electronic module is connected with the M groups of functional electronic modules in parallel under the action of the function expansion board, the function expansion board is used as a specific electronic module, and a plurality of functional electronic modules are connected in series under each port.
The functional electronic module is controlled by the main control electronic module through the physical topology between the main control electronic module and the functional electronic module shown in fig. 12, and the functional electronic module responds to the control of the main control electronic module to realize the equipped functions.
Still referring to fig. 13, fig. 13 is a schematic diagram showing that a main control electronic module sends heartbeat packets to a functional electronic module connected with the main control electronic module and listens for feedback data packets at the same time interval according to an embodiment of the disclosure. In the embodiment of the disclosure, it can be seen that the main control electronic module sends a heartbeat packet and receives a feedback data packet.
The main control electronic module sends a heartbeat packet containing an initial physical sequence identifier (dev_id=0), and then monitors whether the heartbeat packet is replied. If the heartbeat packet is replied, a feedback data packet is received.
If the feedback data packet is monitored, the flow is to the main control electronic module for processing,
If the feedback data packet is not monitored, continuing monitoring.
The main control electronic module monitors whether the time interval between the current time and the time point of sending the heartbeat packet reaches 500ms or not, if so, the main control electronic module resends the heartbeat packet, and if not, the main control electronic module continues to monitor whether the heartbeat packet is replied or not
With continued reference to fig. 14, fig. 14 is a schematic diagram illustrating a functional electronic module receiving a heartbeat packet, generating a feedback data packet by using the heartbeat packet, and uploading the feedback data packet to a main control electronic module according to an embodiment of the disclosure. In the embodiment of the disclosure, it can be seen that the functional electronic module receives the heartbeat packet, acquires the physical sequence identifier, generates the feedback data packet, uploads the feedback data packet, and continues the process of transmitting the heartbeat packet downwards.
The functional electronic module monitors whether a heartbeat packet from the main control electronic module or the functional electronic module is received in real time;
Firstly, a functional electronic module directly connected with a main control electronic module receives a heartbeat packet containing an initial physical sequence identifier, the functional electronic module analyzes the heartbeat packet to obtain the initial physical sequence identifier, the unused initial physical sequence identifier is used as a physical sequence identifier uniquely corresponding to the functional electronic module, the used heartbeat packet is packaged to obtain a heartbeat packet for downward continuous transmission, and the heartbeat packet obtained by packaging the physical sequence identifier corresponding to the functional electronic module is the heartbeat packet for downward transmission.
And secondly, after receiving a heartbeat packet from a previous functional electronic module directly connected with the functional electronic module, the functional electronic module indirectly connected with the main control electronic module analyzes the heartbeat packet to obtain a physical sequence identifier corresponding to the previous functional electronic module, updates the physical sequence identifier (namely, the dev_id field is added with 1) to obtain a unique physical sequence identifier corresponding to the functional electronic module, and obtains the arrangement sequence of the functional electronic modules connected in series by the size of the numerical value contained in the physical sequence identifier.
The functional electronic module encapsulates the obtained device identifier which is formed by the physical sequence identifier uniquely corresponding to the device identifier and the type identifier carried by the device identifier, and a feedback data packet for uploading to the main control electronic module is obtained, and is uploaded to the main control electronic module according to a path downloaded by the heartbeat packet.
After generating a feedback data packet, uploading the feedback data packet to a path of a main control electronic module and the specific functional electronic module with the port expanding function, adding a port identifier into a device identifier obtained after unpacking the feedback data packet according to the port through which the feedback data packet passes by the specific functional electronic module, packaging to obtain an updated feedback data packet, and uploading the updated feedback data packet to the main control electronic module.
The main control electronic module receives and analyzes the feedback data packet from the functional electronic modules to obtain device identifiers of the functional electronic modules, searches the preset function description information of the currently connected functional electronic modules according to the type identifiers in the device identifiers, and maintains the functional electronic modules as the on-line electronic modules of the main control electronic module by loading the searched function description information into the on-line electronic module information set of the main control electronic module. The on-line electronic module information set is a set of function description information of the functional electronic module connected with the current main control electronic module.
Before forming the online electronic module list, the main control electronic module records the function description information of the electronic module at least in the data set. If the function description information of the connection functional electronic module is not recorded in the data set in practical application, the main control electronic module can generate a complete online electronic module list only after the function description information of the required functional electronic module is loaded into the data set, otherwise, the online electronic module list can not display the function description information of a certain type of electronic module.
The main control electronic module carries out different position numbering modes according to whether the connected functional electronic module exists or not and the functional electronic sub-device with the port expansion function.
When a specific electronic module with a port expansion function exists in the functional electronic modules connected with the main control electronic module in series. Referring to fig. 15, fig. 15 shows a schematic diagram of the main control electronic module numbering the positions of the functional electronic modules connected with the main control electronic module when the electronic modules have the expansion function, so as to obtain two different manners of numbering the positions. Referring to the fonts in the middle of the modules in fig. 15, the functional electronic modules are directly ordered according to the physical sequence identification, are not classified and are numbered.
The first is: the method comprises the steps that firstly, a main control electronic module screens physical sequence identifiers according to port identifiers in device identifiers, the physical sequence identifiers with the same port identifier are ordered according to the numerical value indicated by a functional physical sequence identifier, the arrangement sequence of functional electronic modules corresponding to the physical sequence identifiers is obtained, and the connection positions of the functional electronic modules in functional electronic modules connected in series are obtained through the arrangement sequence. Secondly, the main control electronic module obtains corresponding type information in the data set according to the type identification of the functional electronic module; and finally, correlating the connection position of each functional electronic module with the type information corresponding to the type identifier of the functional electronic module to obtain the position number of each functional electronic module. In fig. 14, the "module A1-1 (type a electronic module is the 1st electronic module under the first port), the module B1-2 (type B electronic module is the 2 nd electronic module under the first port), and the module F m-n (type F electronic module is the n-th electronic module under the m-th port)" are specifically described.
Please refer to the font beside the module in fig. 15, which is to screen out the functional electronic modules with the same type of identification, and then sort according to the physical sequence identification to obtain the numbers of the functional electronic modules under the type.
The second is: the method comprises the steps that firstly, a main control electronic module screens physical sequence identifiers according to port identifiers in device identifiers, the physical sequence identifiers with the same port identifier are ordered according to the numerical value indicated by a functional physical sequence identifier, the arrangement sequence of the functional electronic modules corresponding to the physical sequence identifiers is obtained, and the connection positions in the functional electronic modules of the same type of the functional electronic modules are obtained through the arrangement sequence and the type identifiers. And finally, correlating the connection position of each functional electronic module in the same type of functional electronic module with the type information corresponding to the type identifier of the functional electronic module to obtain the position number of each functional electronic module in the same type. In FIG. 13, "1-1A (first class A electronic module under the first port), 1-1B (class 1B electronic module under the first port), and m-n B (n class B electronic module under the mth port)".
The above is two position numbering processes when the functional electronic modules connected with the main control electronic module in series are provided with the electronic modules with the port expanding function, when the functional electronic modules connected with the main control electronic module in series are not provided with the electronic modules with the port expanding function, the position numbering of the functional electronic modules is carried out without considering the port identification,
First kind: firstly, the main control electronic module obtains the arrangement sequence of the functional electronic modules connected with each other in series according to the numerical value indicated by the physical sequence identification in the device identification, the connection positions of the functional electronic modules in the functional electronic modules connected with each other in series are obtained through the arrangement sequence, secondly, the main control electronic module obtains the type information according to the corresponding relation between the type identification of the functional electronic modules and the type identification and the type information in the data set, and finally, the connection position of each functional electronic module in the functional electronic modules connected with each other in series is associated with the type information corresponding to the type identification of the functional electronic module, so that the position number of each functional electronic module is obtained. Such as "module A-1 (type A electronic module is located at 1 st of electronic modules connected in series with each other), module B-2 (type B electronic module is located at 2 nd of electronic modules connected in series with each other), module F-n (type F electronic module is located at n th of electronic modules connected in series with each other)",
Second kind: the method comprises the steps that firstly, a main control electronic module orders according to the physical sequence identification in a device identification and the numerical value indicated by a functional physical sequence identification, the arrangement sequence of functional electronic modules corresponding to the physical sequence identification is obtained, the connection positions in the functional electronic modules of the same type of the functional electronic modules are obtained through the arrangement sequence and the type identification, the main control electronic module obtains type information corresponding to the type identification according to the corresponding relation between the type identification of the functional electronic modules and the type identification and the type information in the data set, and finally, the connection position of each functional electronic module in the functional electronic modules of the same type is associated with the type information corresponding to the type identification of the functional electronic module, so that the position number of each functional electronic module in the same type is obtained. Such as "1-A (first class A electronics module), 3-A (3 rd class A electronics module), n-B (nth class B electronics module)", etc "
Referring to fig. 16, fig. 16 is a schematic diagram illustrating a combination of several functional electronic modules connected in parallel into a functional electronic queue connected in series according to an embodiment of the application. According to the embodiment of the disclosure, the ports are numbered from 0 to M, then all the modules under the port with the larger number value are connected to the back of the last module of the port number with the last number according to the order of the numbers, for example, the port 1 is connected to the back of the port 0 module, the port 2 is connected to the back of the port 1, and so on.
And then positioned according to the Nth X module. The advantages in this mode are: when the number of the same type of modules is small, the connection sequence of the modules has small influence on programming, like the modules are only one, no matter where the modules are connected, the number of the programming is always unchanged (the first X module of the system), and the problem that the user needs to modify the revision number in batches when programming again after changing the positions of the modules is solved to a great extent.
When the main control device gives an instruction to the functional electronic module, firstly, the position number of the functional electronic module receiving the instruction is obtained, before the actual transmission of the instruction, the connection position and type information of the functional electronic module in the position number are converted into corresponding physical sequence identifiers and type identifiers which are used as appointed address information, then the appointed address information is packaged together with the instruction to be transmitted in the form of a non-data packet, when the data packet passes through the functional electronic module, the electronic module analyzes the data packet, whether the address information is matched with the electronic module or not is checked, if the data packet is matched with the functional electronic module, the corresponding instruction is executed, and if the data packet is not matched with the functional electronic module, the data packet is repackaged to the next connected functional electronic module to be transmitted.
Referring to fig. 17, fig. 17 is a schematic diagram of a communication device for implementing dynamic connection of electronic devices according to an embodiment of the application. The communication device for realizing the dynamic connection of the electronic device in the embodiment of the application mainly comprises the following modules:
the detection module 610: the main control electronic device is used for executing on-line monitoring logic, and detecting to obtain the connection of the current functional electronic device;
Maintenance module 620: the device identification module is used for carrying out position coding on the device identification obtained in the online electronic device maintenance to obtain the position number of the functional electronic device;
Interaction module 630: and the interaction between the main control electronic device and the functional electronic device is initiated according to the position number.
The information transmission method in the laser system according to the embodiment of the present application may be implemented by the electronic device dynamic connection apparatus shown in fig. 18. An electronic device dynamic connection apparatus according to an embodiment of the present application is described below with reference to fig. 18. The electronic device dynamic connection device shown in fig. 18 is only an example, and should not be construed as limiting the functionality and scope of use of the embodiments of the present application.
As shown in fig. 18, the electronic device dynamic connection apparatus is in the form of a general purpose computing device. The components of the master electronics 11 or the functional electronics 12 may include, but are not limited to: the at least one processing unit 810, the at least one memory unit 820, and a bus 830 connecting the various system components, including the memory unit 820 and the processing unit 810.
Wherein the storage unit stores program code that is executable by the processing unit 810 such that the processing unit 810 performs steps according to various exemplary embodiments of the present invention described in the description of the exemplary methods described above in this specification. For example, the processing unit 810 may perform the various steps as shown in fig. 2.
The storage unit 820 may include readable media in the form of volatile storage units, such as Random Access Memory (RAM) 8201 and/or cache memory 8202, and may further include Read Only Memory (ROM) 8203.
Storage unit 820 may also include a program/utility 8204 having a set (at least one) of program electronics 8205, such program electronics 8205 including, but not limited to: an operating system, one or more application programs, other program electronics, and program data, each or some combination of which may include an implementation of a network environment.
Bus 830 may be one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device dynamic connection apparatus may also communicate with one or more external devices 700 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device dynamic connection apparatus, and/or with any device (e.g., router, modem, etc.) that enables the electronic device dynamic connection apparatus to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 850. And, the host electronics 11 may also communicate with one or more networks, such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet, through network adapter 860. As shown, network adapter 860 communicates with other electronic devices of functional electronic device 12 via bus 830. It should be appreciated that although not shown, other hardware and/or software electronics may be used in conjunction with the electronics dynamic connection apparatus, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, a terminal device, or a network device, etc.) to perform the method according to the embodiments of the present application.
In an exemplary embodiment of the application, a computer program medium is also provided, on which computer readable instructions are stored which, when executed by a processor of a computer, cause the computer to perform the method described in the method embodiments section above.
According to an embodiment of the present application, there is also provided a program product for implementing the method in the above method embodiment, which may employ a portable compact disc read only memory (CD-ROM) and comprise program code and may be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
It should be noted that although in the above detailed description several electronics or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more electronic devices or units described above may be embodied in one electronic device or unit, in accordance with embodiments of the present application. Conversely, the features and functions of one electronic device or unit described above may be further divided into ones that are embodied by a plurality of electronic devices or units.
Furthermore, although the steps of the methods of the present application are depicted in the accompanying drawings in a particular order, this is not required to or suggested that the steps must be performed in this particular order or that all of the steps shown be performed in order to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform, etc.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, a mobile terminal, or a network device, etc.) to perform the method according to the embodiments of the present application.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
Claims (10)
1. A communication method for implementing dynamic connection of electronic devices, wherein the method is at least applied to a master electronic device connectable to a functional electronic device, the method comprising:
The main control electronic device executes on-line monitoring logic to detect and obtain the connection of the current functional electronic device;
maintaining that the currently connected functional electronic device is an online electronic device connected with the main control electronic device;
Performing position coding on the device identifier obtained in the online electronic device maintenance to obtain the position number of the functional electronic device;
and initiating interaction between the main control electronic device and the functional electronic device according to the position number.
2. The method of claim 1, wherein the master electronic device performs on-line monitoring logic to detect a connection to a current functional electronic device, comprising:
The main control electronic device sends heartbeat packets to the functional electronic devices connected with the main control electronic device, and the heartbeat packets are transmitted according to the connection sequence among the functional electronic devices, so that the functional electronic devices connected in series receive the heartbeat packets;
The functional electronic device sends a feedback data packet of the received heartbeat packet to the main control electronic device;
And the main control electronic device detects and obtains the currently connected functional electronic device according to the device identifier carried by the feedback data packet.
3. The method of claim 2, wherein the master electronics send heartbeat packets to the functional electronics connected thereto, comprising:
The main control electronic device sends heartbeat packets at regular time intervals according to the set time intervals, the heartbeat packets sent by the main control electronic device at regular time are received by the connected functional electronic device, and the heartbeat packets are used for initiating the functional electronic device to reply feedback data packets to the main control electronic device;
the functional electronic devices forward the heartbeat packet which is adapted to the next functional electronic device downwards according to the heartbeat packet received by the functional electronic devices, the heartbeat packets received by each functional electronic device in the functional electronic devices which are connected in series all carry corresponding physical sequence identifiers, and the physical sequence identifiers are used for indicating the connection positions of the corresponding functional electronic devices relative to the functional electronic devices which are connected in series.
4. A method according to claim 3, wherein the functional electronic device forwards down a heartbeat packet adapted to a next functional electronic device based on a heartbeat packet received by itself, comprising:
The functional electronic device directly connected with the main control electronic device analyzes the received heartbeat packet to obtain a physical sequence identifier carried by the heartbeat packet;
performing packet processing on the physical sequence identifier to obtain a heartbeat packet for forwarding downwards;
forwarding the heartbeat packet to the next functional electronic device.
5. The method according to claim 4, wherein the functional electronic device forwards down a heartbeat packet adapted to a next functional electronic device based on a heartbeat packet received by the functional electronic device itself, comprising:
the functional electronic device analyzes the received heartbeat packet to obtain a physical sequence identifier of the last functional electronic device, and the heartbeat packet is forwarded by the last functional electronic device currently connected in series by the functional electronic device;
Updating the physical sequence identifier obtained by analysis to obtain a physical sequence identifier corresponding to the current functional electronic device;
the heartbeat packet for forwarding downwards is obtained for the physical sequence identification packet of the current functional electronic device and forwarded to the next functional electronic device.
6. The method of claim 2, wherein the functional electronics send feedback packets of the received heartbeat packets to the master electronics, comprising:
The method comprises the steps that a functional electronic device obtains a physical sequence identifier for downward forwarding, wherein the physical sequence identifier for downward forwarding is carried by a heartbeat packet for downward forwarding by the functional electronic device;
generating a feedback data packet according to the physical sequence identifier for forwarding downwards and the type identifier of the feedback data packet;
And uploading the feedback data packet to the main control electronic device.
7. The method of claim 1, wherein the maintaining the currently connected functional electronic device is an on-line electronic device connected to the master electronic device, comprising:
Searching preconfigured function description information according to the type identifier of the currently connected functional electronic device, wherein the function description information is at least used for indicating the function of the functional electronic device and a protocol format corresponding to the function;
And maintaining the functional electronic device as an online electronic device of the main control electronic device by loading the searched function description information to an online electronic device information set of the main control electronic device.
8. The method according to claim 1, wherein the device identifier includes a type identifier and a physical sequence identifier, the encoding the location of the device identifier obtained in the online electronic device maintenance to obtain the location number of the functional electronic device includes:
The main control electronic device uploads a feedback data packet carried by the online electronic device to obtain a type identifier and a physical sequence identifier carried by the feedback data packet, and the obtained type identifier and physical sequence identifier correspond to the same functional electronic device;
positioning the connection position of the functional electronic device corresponding to the type identifier according to the physical sequence identifier, wherein the connection position is used for indicating the front and rear positions of the functional electronic device corresponding to the type identifier and the physical sequence identifier relative to other functional electronic devices corresponding to the type identifier;
and for the functional electronic device, associating the type information mapped by the type identifier with the connection position to obtain a position number, wherein the position number is used for marking the connection sequence of the functional electronic device under the type of the electronic device.
9. The method of claim 8, wherein identifying the connection location of the functional electronic device corresponding to the location type identifier according to the physical sequence identifier comprises:
Sequencing the functional electronic devices according to the numerical value indicated by the physical sequence identification aiming at the functional electronic devices corresponding to the same port identification;
And obtaining connection positions of the functional electronic devices corresponding to the same type identifier under the ports from the sequenced functional electronic devices, wherein the connection positions indicate the ports of the functional electronic devices and the connection sequence of the functional electronic devices with the same type identifier under the ports relative to other functional electronic devices.
10. A communication device for implementing dynamic connection of electronic devices, the device comprising:
And a detection module: the main control electronic device is used for executing on-line monitoring logic, and detecting to obtain the connection of the current functional electronic device;
And a maintenance module: the device identification module is used for carrying out position coding on the device identification obtained in the online electronic device maintenance to obtain the position number of the functional electronic device;
And an interaction module: and the interaction between the main control electronic device and the functional electronic device is initiated according to the position number.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211266180.9A CN117938944A (en) | 2022-10-17 | 2022-10-17 | Communication method and device for realizing dynamic connection of electronic devices |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211266180.9A CN117938944A (en) | 2022-10-17 | 2022-10-17 | Communication method and device for realizing dynamic connection of electronic devices |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117938944A true CN117938944A (en) | 2024-04-26 |
Family
ID=90757935
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211266180.9A Pending CN117938944A (en) | 2022-10-17 | 2022-10-17 | Communication method and device for realizing dynamic connection of electronic devices |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117938944A (en) |
-
2022
- 2022-10-17 CN CN202211266180.9A patent/CN117938944A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108153670A (en) | A kind of interface test method, device and electronic equipment | |
CN111683066B (en) | Heterogeneous system integration method, heterogeneous system integration device, computer equipment and storage medium | |
CN111666129B (en) | Container mirror image processing method, electronic device, storage medium and system | |
CN109857452B (en) | Configuration method and device of rocket test launch control system based on XML | |
CN109672722B (en) | Data deployment method and device, computer storage medium and electronic equipment | |
US10599476B2 (en) | Device and method for acquiring values of counters associated with a computational task | |
CN115134236A (en) | Intelligent network card management method, device, equipment and readable medium | |
CN109460268A (en) | Application parameter configuration method, device and system | |
US11586182B2 (en) | System and device to automatically identify data tags within a data stream | |
US20180336171A1 (en) | System and method for constructing extensible event log with javascript object notation (json) encoded payload data | |
JP2016091070A (en) | Information processing system, classifying method, and program therefor | |
CN114328130B (en) | Server monitoring method, system, equipment and computer readable storage medium | |
CN117938944A (en) | Communication method and device for realizing dynamic connection of electronic devices | |
CN102754074B (en) | Rule-based assignment of control of peripherals of a computing device | |
WO2023151397A1 (en) | Application program deployment method and apparatus, device, and medium | |
WO2020219485A1 (en) | Operating method of self-service terminal and self-service terminal | |
CN116991929A (en) | Micro-service system based on big hospital data | |
CN108763127B (en) | Method for realizing Modbus adapter capable of realizing interconversion of source data and target data | |
CN116738745A (en) | Communication method, device, equipment and medium of electromagnetic transient simulation system | |
CN114095523B (en) | Communication data processing method, device and system in comprehensive scheduling system | |
CN111708582A (en) | Online configuration method and device and electronic equipment | |
CN107609008A (en) | A kind of data importing device and method from relevant database to Kafka based on Apache Sqoop | |
CN116361261B (en) | Distributed log acquisition processing method and system | |
CN114721529B (en) | Software compatibility control method and system based on artificial intelligence and cloud platform | |
CN109324951A (en) | The acquisition methods and device of hard disk information in server |
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 |