CN109889593B - Distributed master-slave machine communication method and device for mobile security shelter - Google Patents

Distributed master-slave machine communication method and device for mobile security shelter Download PDF

Info

Publication number
CN109889593B
CN109889593B CN201910140560.XA CN201910140560A CN109889593B CN 109889593 B CN109889593 B CN 109889593B CN 201910140560 A CN201910140560 A CN 201910140560A CN 109889593 B CN109889593 B CN 109889593B
Authority
CN
China
Prior art keywords
shelter
slave
data
slave machine
machine
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.)
Active
Application number
CN201910140560.XA
Other languages
Chinese (zh)
Other versions
CN109889593A (en
Inventor
杜茂华
王伟力
王哲
张涛涛
申森
方登建
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Naval University of Engineering PLA
Original Assignee
Naval University of Engineering PLA
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Naval University of Engineering PLA filed Critical Naval University of Engineering PLA
Priority to CN201910140560.XA priority Critical patent/CN109889593B/en
Publication of CN109889593A publication Critical patent/CN109889593A/en
Application granted granted Critical
Publication of CN109889593B publication Critical patent/CN109889593B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the invention relates to the technical field of communication, in particular to a distributed master-slave communication method and a distributed master-slave communication device for a mobile mobility assurance shelter.

Description

Distributed master-slave machine communication method and device for mobile security shelter
Technical Field
The embodiment of the invention relates to the technical field of communication, in particular to a distributed master-slave machine communication method and device for a mobile security shelter.
Background
The shelter is a convenient and movable whole formed by organically combining various firm materials, and is mainly applied to the military field. Generally, the shelter is equipped with a vehicle, has high maneuvering performance, is widely applied to military maneuvering command systems, communication, medical treatment, logistics and the like, and is one of important equipment of maneuvering troops. Therefore, reliable transmission of the shelter data is important, but the prior art has difficulty in ensuring reliable transmission of the shelter data.
Disclosure of Invention
In view of the above, the present invention provides a method and an apparatus for distributed master-slave communication of a mobile security shelter.
The embodiment of the invention provides a distributed master-slave machine communication method of a mobile maneuvering guarantee shelter, which is applied to a shelter master machine in communication connection with a plurality of shelter slave machines, and comprises the following steps:
sending inquiry information to a set shelter slave in the plurality of shelter slaves;
judging whether the data of the shelter slave machine returned by the set shelter slave machine based on the inquiry information is received within a preset time length, if the data of the shelter slave machine is received within the preset time length, caching the data of the shelter slave machine, and sending the inquiry information to another shelter slave machine in the plurality of shelter slave machines;
after the inquiry information of each of the plurality of shelter slaves is sent, whether the number of the cached shelter slave data is the same as the preset number or not is judged, if the number of the cached shelter slave data is the same as the preset number, shelter master data is collected, and the shelter master data and the cached shelter slave data are sent.
Optionally, the method further comprises:
deleting the collected shelter host data and the cached shelter slave data;
and re-executing the steps of sequentially sending the inquiry information to each of the plurality of shelter slaves and judging whether the number of buffered shelter slave data is the same as the preset number.
Optionally, the method further comprises:
if the number of the cached cabin slave machine data is different from the preset number, deleting the cached cabin slave machine data, and sending the inquiry information to the set cabin slave machine again;
judging whether the data of the shelter slave machine returned by the set shelter slave machine based on the inquiry information is received within the preset time length, if the data of the shelter slave machine is received within the preset time length, caching the data of the shelter slave machine, and sending the inquiry information to another shelter slave machine in the plurality of shelter slave machines;
after the inquiry information of each of the plurality of shelter slaves is sent, whether the number of the cached shelter slave data is the same as the preset number or not is judged, if the number of the cached shelter slave data is the same as the preset number, shelter master data is collected, and the shelter master data and the cached shelter slave data are sent.
Optionally, the method further comprises:
if the number of the cached shelter slave machine data is different from the preset number, deleting the cached shelter slave machine data, and sending inquiry information to any shelter slave machine except the set shelter slave machine in the plurality of shelter slave machines;
judging whether the data of the shelter slave machine returned by any one shelter slave machine based on the inquiry information is received within the preset time length, if the data of the shelter slave machine returned by any one shelter slave machine is received within the preset time length, caching the data of the shelter slave machine returned by any one shelter slave machine, and sending the inquiry information to another shelter slave machine in the plurality of shelter slave machines;
after the inquiry information of each of the plurality of shelter slaves is sent, whether the number of the cached shelter slave data is the same as the preset number or not is judged, if the number of the cached shelter slave data is the same as the preset number, shelter master data is collected, and the shelter master data and the cached shelter slave data are sent.
Optionally, the method further comprises:
and if the number of the cached cabin slave machine data is different from the preset number, deleting the cached cabin slave machine data, generating early warning information and sending the early warning information.
Optionally, the method further comprises:
if the data of the shelter slave machines are not received within the preset time length, the set shelter slave machines are identified, and the inquiry information is sent to another shelter slave machine in the shelter slave machines.
Optionally, the step of sending inquiry information to a set shelter slave of the plurality of shelter slaves comprises:
acquiring a preset number of each of the plurality of shelter slave machines;
sequencing the obtained plurality of preset numbers to obtain a preset number sequence;
taking the shelter slave machine corresponding to the preset number at the top of the preset number sequence as a set shelter slave machine;
and generating inquiry information according to a preset number of the set shelter slave machine and a set data format, and sending the inquiry information to the set shelter slave machine.
The embodiment of the invention also provides a distributed master-slave machine communication method of the mobile security shelter, which is applied to a set shelter slave machine in communication connection with a shelter host machine, and comprises the following steps:
detecting whether an interrupt signal exists in real time, if so, judging that the receiving of inquiry information sent by the shelter host is finished, and caching the received inquiry information;
analyzing and obtaining a preset number and a set data format which are included in the cached inquiry information;
and judging whether the analyzed preset number is the same as the instant number of the set shelter slave machine, if so, judging whether the analyzed set data format is the same as the instant number of the set shelter slave machine, and if so, returning the instant number and the collected shelter slave machine data to the shelter master machine.
The embodiment of the invention also provides a distributed master-slave machine communication device for the mobile security shelter, which is applied to a shelter master machine in communication connection with a plurality of shelter slave machines, and comprises the following components:
the query information sending module is used for sending query information to a set shelter slave machine in the shelter slave machines;
the query result judging module is used for judging whether the data of the shelter slave machine returned by the set shelter slave machine based on the query information is received within a preset time length, caching the data of the shelter slave machine if the data of the shelter slave machine is received within the preset time length, and sending the query information to another shelter slave machine in the plurality of shelter slave machines;
the communication data processing module is used for judging whether the number of the cached cabin slave machine data is the same as the preset number or not after the inquiry information of each of the plurality of cabin slave machines is sent, and acquiring the cabin master machine data and sending the cabin master machine data and the cached cabin slave machine data if the number of the cached cabin slave machine data is the same as the preset number.
The embodiment of the invention also provides a distributed master-slave machine communication device for the mobile security shelter, which is applied to a set shelter slave machine in communication connection with a shelter host machine, and comprises the following components:
the query information receiving module is used for detecting whether an interrupt signal exists in real time, judging that the receiving of the query information sent by the shelter host is finished if the interrupt signal exists, and caching the received query information;
the query information analysis module is used for analyzing and obtaining preset numbers and set data formats included in the cached query information;
and the shelter slave data returning module is used for judging whether the analyzed preset number is the same as the instant number of the set shelter slave or not, judging whether the analyzed set data format is the same as the instant data format of the set shelter slave if the analyzed preset number is the same as the instant number, and returning the instant number and the collected shelter slave data to the shelter master if the analyzed set data format is the same as the instant data format.
The embodiment of the invention also provides a shelter host, which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor realizes the distributed master-slave machine communication method of the mobile security shelter when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, which comprises a computer program, and the computer program controls the cabin slave machine where the readable storage medium is located to execute the distributed master-slave machine communication method of the mobile security cabin when running.
Advantageous effects
The distributed master-slave communication method and device for the mobile security shelter provided by the embodiment of the invention can judge whether reliable data communication exists between the shelter master machine and the shelter slave machines or not based on the data of the shelter slave machines received within the preset time length, then judge whether the number of the shelter slave machines with reliable data communication is the same as the preset number or not, and send the collected shelter master machine data and the cached shelter slave machine data when the number of the shelter slave machines with reliable data communication is judged to be the same as the preset number, so that the reliable transmission of the shelter data is ensured.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a block diagram of a shelter host according to an embodiment of the present invention.
Fig. 2 is a block diagram of a mobile security shelter system according to an embodiment of the present invention.
Fig. 3 is a flowchart of a distributed master-slave communication method for a mobile security shelter according to an embodiment of the present invention.
Fig. 4 is a block diagram of a distributed master-slave communication device of a mobile security shelter according to an embodiment of the present invention.
Icon:
10-a shelter host machine; 11-a memory; 12-a processor; 13-a network module; 14-a first Beidou serial port; 15-a first temperature and humidity sensor; 16-a serial port of a first radio station; 17-a first communication serial port; 18-a first transceiving buffer space;
20-a distributed master-slave computer communication device of the mobile security shelter; 21-inquiry information sending module; 22-inquiry result judging module; 23-a communication data processing module; 24-a query message receiving module; 25-query information analysis module; 26-a shelter slave data return module;
30-shelter slave; 31-a second Beidou serial port; 32-a second temperature and humidity sensor; 33-serial port of second station; 34-a second communication serial port; 35-second transceiving buffer space.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The inventor finds that reliable transmission of shelter data is difficult to guarantee due to influences of factors such as geography, environment, temperature and humidity when the military shelter is actually applied.
The above prior art solutions have shortcomings which are the results of practical and careful study of the inventor, and therefore, the discovery process of the above problems and the solutions proposed by the following embodiments of the present invention to the above problems should be the contribution of the inventor to the present invention in the course of the present invention.
Based on the research, the embodiment of the invention provides a distributed master-slave communication method and device for a mobile security shelter, which can ensure reliable transmission of shelter data.
In this embodiment, a mobile vehicle security shelter is understood to be a vehicle-equipped shelter that provides security for military vehicle command systems, communications, medical and logistics.
Fig. 1 is a block diagram of a shelter host 10 according to an embodiment of the present invention. The shelter host 10 in the embodiment of the present invention has functions of data storage, transmission and processing, and as shown in fig. 1, the shelter host 10 includes: memory 11, processor 12, network module 13 and distributed master-slave communication device 20 of the mobile mobility assurance shelter.
The memory 11, the processor 12 and the network module 13 are electrically connected directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The memory 11 stores a distributed master-slave machine communication device 20 of the mobile mobility assurance shelter, the distributed master-slave machine communication device 20 of the mobile mobility assurance shelter comprises at least one software function module which can be stored in the memory 11 in the form of software or firmware (firmware), and the processor 12 executes various function applications and data processing by running the software programs and modules stored in the memory 11, such as the distributed master-slave machine communication device 20 of the mobile mobility assurance shelter in the embodiment of the present invention, so as to implement the distributed master-slave machine communication method of the mobile mobility assurance shelter in the embodiment of the present invention.
The Memory 11 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 11 is used for storing a program, and the processor 12 executes the program after receiving an execution instruction.
The processor 12 may be an integrated circuit chip having data processing capabilities. The Processor 12 may be a general-purpose Processor including a Central Processing Unit (CPU), a Network Processor (NP), and the like. The various methods, steps and logic blocks disclosed in embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The network module 13 is used for establishing communication connection between the shelter host 10 and other communication terminal devices through a network, and realizing the transceiving operation of network signals and data. The network signal may include a wireless signal or a wired signal.
It will be appreciated that the configuration shown in figure 1 is merely illustrative and that the shelter master 10 may also include more or fewer components than shown in figure 1 or have a different configuration than shown in figure 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
An embodiment of the present invention also provides a computer-readable storage medium, which includes a computer program. When the computer program runs, the shelter host machine 10 where the readable storage medium is located is controlled to execute a distributed master-slave machine communication method of the following mobile security shelter.
Fig. 2 shows a block diagram of a mobile mobility security shelter system according to an embodiment of the present invention, and as can be seen from the figure, the mobile mobility security shelter system includes a shelter master 10 and a plurality of shelter slaves 30, and the shelter master 10 is in communication with each shelter slave 30. It can be understood that the types and internal configurations of the shelter master machine 10 and the plurality of shelter slaves 30 are the same, and the shelter master machine 10 is different from the plurality of shelter slaves 30 in the communication protocol, in other words, any one shelter slave 30 in the mobile motor security shelter system shown in fig. 2 can also be used as a shelter master machine in some cases, for example, the total number of the shelters shown in fig. 2 is eight, that is, any one of the eight shelters can be used as a shelter master machine, and which shelter is selected as the shelter master machine can be set according to the actual situation.
It is understood that the structure shown in fig. 1 may also be used as the structure of the shelter slave 30, and therefore, the structure of the shelter slave 30 will not be further described herein.
Referring to fig. 2, the shelter master machine 10 polls each shelter slave machine 30 and executes corresponding operation according to the inquiry result, so that reliable data transmission between the shelter master machine 10 and each shelter slave machine 30 can be ensured, and a polling mode can give feedback in time when an abnormal condition occurs, so that a user can conveniently and timely troubleshoot problems. It can be understood that the mode in which the main shelter unit 10 queries each of the plurality of shelter slaves 30 in turn may also be understood as master-slave multi-machine communication, specifically, the information sent by the main shelter unit 10 may be transmitted to each of the plurality of shelter slaves 30, the information of each of the plurality of shelter slaves 30 may only be sent to the main shelter unit 10, the main shelter unit 10 receives the sent data in an inquiry mode, the shelter slaves 30 receives the sent data in a radio interruption mode, and meanwhile, the main shelter unit 10 and the shelter slaves 30 are both configured with watchdog timers, so that the main shelter unit 10 and the shelter slaves 30 can be prevented from being in a dead cycle when waiting for receiving or sending information/data.
It can be understood that the types and the internal structures of the shelter host 10 and the shelter slave 30 are the same, so that the shelter host 10 and the shelter slave 30 both comprise a big dipper serial port, a temperature and humidity sensor, a radio serial port, a communication serial port and a transceiving cache space, for convenience of description, please continue to refer to fig. 2, the shelter host 10 comprises a first big dipper serial port 14, a first temperature and humidity sensor 15, a first radio serial port 16, a first communication serial port 17 and a first transceiving cache space 18, and the shelter slave 30 comprises a second big dipper serial port 31, a second temperature and humidity sensor 32, a second radio serial port 33, a second communication serial port 34 and a second transceiving cache space 35.
When the distributed master-slave communication method provided by the embodiment of the present invention is executed, the first beidou serial port 14, the first temperature and humidity sensor 15, the first radio station serial port 16, the first communication serial port 17, the first transceiving cache space 18, the second beidou serial port 31, the second temperature and humidity sensor 32, the second radio station serial port 33, the second communication serial port 34, and the second transceiving cache space 35 need to be initialized, for example, data cached in the first transceiving cache space 18 and the second transceiving cache space 35 are emptied, and corresponding values are written into control word registers corresponding to each serial port so that the corresponding serial port can normally operate, where the corresponding values may be determined according to an actual use environment, and specific examples are not listed here.
After the initialization is completed, the main shelter unit 10 and the sub shelter units 30 start their respective watchdog timers, and the user can configure the number and the number of the sub shelter units 30 through the main shelter unit 10, for example, as shown in fig. 2, the number of the sub shelter units 30 may be seven, and the number of the sub shelter units 30 may be: sub1、sub2、sub3、sub4、sub5、sub6And sub7. In other words, the preset number is seven, and the preset number is: sub1、sub2、sub3、sub4、sub5、sub6And sub7
Optionally, the shelter master 10 and the shelter slave 30 communicate with each other through the first communication serial port 17 and the second communication serial port 34, wherein the first communication serial port 17 and the second communication serial port 34 may also be understood as upper computer serial ports.
Fig. 3 is a flowchart illustrating a distributed master-slave communication method for a mobile mobility assurance shelter according to an embodiment of the present invention. The method steps defined by the process related to the method are applied to the shelter host machine 10 and can be implemented by the processor 12. The specific process shown in FIG. 3 will be described in detail below:
in step S21, the inquiry information is transmitted to a set shelter slave among the plurality of shelter slaves.
After the initialization of the cabin master 10 and the cabin slaves 30 has been completed, an inquiry message is sent to a set cabin slave of the plurality of cabin slaves 30.
Specifically, the main shelter unit 10 first obtains the preset number (sub) of each of the shelter slaves 301~sub7) Then, the preset numbers are sorted to obtain a preset number sequence, in this embodiment, the sorting order is from large to small, and therefore, the preset number sequence is { sub }7,sub6,sub5,sub4,sub3,sub2And sub1}. Further, the shelter host 10 will locate at the preset number sub at the head of the preset number sequence7The corresponding shelter slave 30 is used as a set shelter slave according to a preset number sub7And generating inquiry information according to the set data format and transmitting the inquiry information to the set shelter slave.
Further, the set-up shelter slave is capable of returning the collected shelter slave data based on the inquiry information.
Specifically, the cabin slave data include temperature and humidity data and positioning data, wherein the temperature and humidity data are collected through the second temperature and humidity sensor 32, and the positioning data are collected through the second Beidou serial port 31.
Further, the set shelter slave machine detects whether an interrupt signal exists in real time, if the interrupt signal exists, the reception of the inquiry information is judged to be completed, after the inquiry information is received, the set shelter slave machine caches the inquiry information into the second transceiving cache space 35, and the preset number sub included in the inquiry information is analyzed and obtained7And setting a data format, wherein the set shelter slave machine reads the number of the set shelter slave machine from an encoder connected to the general I/O interface and acquires the existing data format. Optionally, the receiving of the interrupt signal may be implemented by the serial port 33 of the second station。
Further, the set shelter slave machine may determine whether the analyzed preset number is the same as the existing number, may also determine whether the analyzed set data format is the same as the existing data format, and may return the existing number, the collected temperature and humidity data, and the positioning data to the shelter master machine 10 only if the analyzed preset number is the same as the existing number and the analyzed set data format is the same as the existing data format, or may set the shelter slave machine to empty the buffer of the second transceiving buffer space 35, in other words, may delete the received inquiry information.
Optionally, after the set shelter slave machine returns the temperature and humidity data and the positioning data which are already numbered and collected to the shelter master machine 10, the data (the temperature and humidity data and the positioning data which are subsequently collected) to be sent next time can be obtained, at this time, the set shelter writes a value to the watchdog timer from a chance to realize the reset of the watchdog timer, and the dead cycle caused by the fact that the set shelter slave machine always waits for an interrupt signal is avoided.
It will be appreciated that the set-up shelter slave, after deleting the received interrogation message, will also write a value to the watchdog timer to effect a reset of the watchdog timer.
Step S22, determining whether the shelter slave data is received within a preset time period.
After the main shelter unit 10 sends the inquiry information to the set shelter slave, it waits to determine whether the data of the shelter slave returned from the set shelter slave is received within the preset waiting time, and if the data of the shelter slave returned from the set shelter slave is received within the preset waiting time, the process goes to step S23, otherwise, the process goes to step S24.
Step S23, the data of the shelter slave is buffered, and the inquiry information is sent to another shelter slave in the plurality of shelter slaves.
If the shelter master 10 receives the shelter slave data returned by the set shelter slave within the preset time period, which indicates that the shelter master 10 successfully inquires the set shelter slave, the shelter master 10 caches the shelter slave data returned by the set shelter slave into the first transceiving cache space 18.
Further, the shelter master 10 sends the inquiry information to the other shelter slave 30 according to a set sequence, and it is understood that the inquiry information includes the preset number of the other shelter slave 30. For example, the shelter master 10 is numbered as sub6The nacelle in question sends an inquiry message from the machine 30 and performs a similar decision as described above.
Step S24 is executed to identify the set shelter slave, send inquiry information to another shelter slave among the plurality of shelter slaves, and make a determination similar to step S22.
It is understood that if the shelter master 10 does not receive the shelter slave data returned by the set shelter slave within the preset time period, indicating that the query of the set shelter slave fails, the set shelter slave may be identified and then be assigned the preset number sub6The shelter of (1) transmits the inquiry information from the machine 30 and makes a judgment similar to step S22.
The set-up shelter slaves after identification can be used as the basis for the change of the polling sequence afterwards.
Step S25, determine whether the number of buffered cabin slave data is the same as a preset number.
The number of buffered cabin slave data may also be understood as the number of successful polling, and further, the cabin master 10 determines whether the number of successful polling is the same as the preset number, if so, the process goes to step S26, otherwise, the process goes to step S27.
And step S26, collecting the shelter master data, sending the shelter master data and the cached shelter slave data, and deleting the shelter master data and the cached shelter slave data after the sending is finished.
It can be understood that if the number of successful polling is also seven, which indicates that the shelter host 10 completes the inquiry of seven shelter slaves 30, at this time, the shelter host 10 may obtain shelter host data (positioning data and temperature and humidity data) respectively collected by the first beidou serial port 14 and the first temperature and humidity sensor 15, and then send the shelter host data and the shelter slave data cached in the first transceiving cache space 18 to the control center for monitoring by the staff. Therefore, the data of the square cabin sent to the control center can be guaranteed to be the data of the whole motorcade (eight square cabins), and the reliability and the integrity of the data transmission of the square cabin are guaranteed.
After the shelter master 10 sends the shelter master data and the cached shelter slave data to the control center, the collected shelter master data and the cached shelter slave data are deleted (data cleared) to execute next polling.
In step S27, the cached shelter slave data is deleted, the inquiry information is retransmitted to the set shelter slave, and a similar judgment is made as in steps S21 to S25.
If the number of successful polling is not seven, it indicates that the shelter master machine 10 has not completed the inquiry to all the shelter slave machines 30, at this time, the shelter slave machine 10 will empty the shelter slave machine data cached in the first transceiving cache space 18, re-send inquiry information to the set shelter slave machine and execute the judgment similar to the step S21 to the step S25, and optionally, may also initialize the first beidou serial port 14, the first temperature and humidity sensor 15, the first radio serial port 16, and the first communication serial port 17.
Alternatively, if the number of successful polling is not the same as the preset number, the shelter master 10 may reorder or shuffle the plurality of shelter slaves 30, for example, send inquiry information to any shelter slave 30 of the plurality of shelter slaves except the set shelter slave and execute the judgment similar to the step S21 to the step S25, and for example, after the shelter master 10 completes initialization, may send a judgment result to the preset number sub5The shelter slave 30 sends inquiry information, wherein the inquiry information carries a preset number sub5
Alternatively, reordering of the plurality of shelter slaves 30 may be performed in dependence on the identified shelter slave, e.g., for the sequence of shelter slaves sub7,sub6,sub5,sub4,sub3,sub2And sub1If a certain polling is executed, sub is not received within a preset time length5And sub3Returned shelter slave data, may be for sub5And sub3Marking is performed when the next round is executedWhen polling, the polling sequence may be sub5,sub3,sub7,sub6,sub4,sub2And sub1In other words, the cabin slave machines which do not succeed in the polling are polled preferentially at the next polling.
Optionally, if the number of successful polling is different from the preset number, the shelter host 10 may further generate and send the warning information to the control center.
In this way, when the number of successful polling is different from the number of preset shelter slaves, the shelter master 10 can perform the three functions, for example, when sending query information to the preset shelter slaves again, the pre-warning information can be generated in parallel and then sent to the control center, and the pre-warning information is sent to the preset number sub5When the shelter slave 30 sends the inquiry information, the early warning information can be generated in parallel and then sent to the control center, so that the control center can be ensured to acquire the early warning information of the failure of the shelter master 10 inquiring the shelter slave 30 at the first time. In addition, the inquiry information is sent to the set cabin slave again or the preset number is sub5The sending of the inquiry information by the shelter slave machine 30 can effectively eliminate inquiry failure caused by accidental factors, thus ensuring real-time and reliable communication between the shelter master machine 10 and the shelter slave machine 30 and further ensuring reliable transmission of shelter data.
Where contingent factors may be due to a particular geographic location, for example, the shelter master 10 in the sequence sub7,sub6,sub5,sub4,sub3,sub2And sub1Poll a number of shelter slaves 30, when polled to shelter slave sub3Time, shelter slave sub3The main shelter computer 10 clears the buffered data of the main shelter computer after the polling is finished, and continues to use the sequence sub7,sub6,sub5,sub4,sub3,sub2And sub1Next polling of the plurality of shelter slaves 30, the next polling being performedAt the time, assume a shelter slave sub3When the square cabin runs out of the cave, the square cabin host 10 can receive inquiry information sent by the square cabin host 10, and at the moment, the square cabin host 10 can send the collected square cabin host data and square cabin slave data.
Alternatively, the cabin master 10 completes polling every 2.1s, and the polling of the cabin slaves 30 by the cabin master 10 is always cyclic, in other words, the polling is always continuous whether the cabin master 10 transmits the collected cabin master data and the buffered cabin slave data.
In other words, when some of the shelter slaves 30 are located at a specific geographical position, the shelter master 10 may not be able to complete polling with these shelter slaves 30, and the above method can eliminate the influence of the specific geographical position and ensure the transmission reliability of the shelter master data and the shelter slave data.
Optionally, after the shelter master 10 sends the shelter master data and the buffered shelter slave data, a value is written to a watchdog timer arranged inside the shelter master 10 to reset the watchdog timer, so as to avoid a dead cycle that the shelter master 10 is in waiting.
It can be understood that the shelter master machine 10 resets the watchdog timer once after the judgment of the number of buffered shelter slave machine data and the preset number is completed and the operation corresponding to the judgment result is completed. For example, if the preset time period for the main shelter unit 10 to wait for each of the cabin slaves 30 to return the data of the cabin slaves is 0.3s, the time required by the main shelter unit 10 after completing one polling is 2.1s, and if the operation time period corresponding to the judgment of the number of buffered data of the cabin slaves and the preset number and the execution completion judgment result is 0s, the main shelter unit 10 writes a value (feeds a dog) to the watchdog timer every 2.1s to reset the watchdog timer.
On the basis, as shown in fig. 4, an embodiment of the present invention provides a distributed master-slave machine communication device 20 of a mobile security shelter, where the distributed master-slave machine communication device 20 of the mobile security shelter includes: an inquiry information sending module 21, an inquiry result judging module 22, a communication data processing module 23, an inquiry information receiving module 24, an inquiry information analyzing module 25 and a shelter slave data returning module 26.
And an inquiry information sending module 21, configured to send inquiry information to a set shelter slave among the plurality of shelter slaves.
Since the principle of implementation of the inquiry information sending module 21 is similar to that of step S21 in fig. 2, no further description is provided here.
And the inquiry result judging module 22 is configured to judge whether the data of the shelter slave machine returned by the set shelter slave machine based on the inquiry information is received within a preset time period, and if the data of the shelter slave machine is received within the preset time period, cache the data of the shelter slave machine and send the inquiry information to another shelter slave machine of the plurality of shelter slave machines.
Since the query result judging module 22 is similar to the implementation principle of the steps S22, S23 and S24 in fig. 2, it will not be further described here.
The communication data processing module 23 is configured to, after the transmission of the inquiry information for each of the plurality of shelter slave machines is completed, determine whether the number of the cached shelter slave machine data is the same as a preset number, acquire shelter master machine data if the number of the cached shelter slave machine data is the same as the preset number, and transmit the shelter master machine data and the cached shelter slave machine data.
Since the communication data processing module 23 is similar to the implementation principle of step S25, step S26 and step S27 in fig. 2, it will not be further described here.
And the inquiry information receiving module 24 is configured to detect whether an interrupt signal exists in real time, determine that the reception of the inquiry information sent by the shelter host is completed if the interrupt signal exists, and cache the received inquiry information.
Since the principle of implementation of the query information receiving module 24 is similar to that of step S21 in fig. 2, no further description is provided here.
And the query information analyzing module 25 is configured to analyze and obtain a preset number and a set data format included in the cached query information.
Since the principle of implementation of the query information parsing module 25 is similar to that of step S21 in fig. 2, no further description is provided here.
And a shelter slave data returning module 26, configured to determine whether the analyzed preset number is the same as an existing number of the set shelter slave, determine whether the analyzed set data format is the same as an existing data format of the set shelter slave if the analyzed preset number is the same as the existing number, and return the existing number and the collected shelter slave data to the shelter master if the analyzed set data format is the same as the existing data format.
Since the realization principle of the cockpit slave data return module 26 is similar to that of step S21 in fig. 2, no further explanation is given here.
In summary, the distributed master-slave communication method and device for the mobile security shelter provided by the embodiments of the present invention can realize reliable transmission of the data of the master machine of the shelter and the data of the slave machines of the shelter.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus and method embodiments described above are illustrative only, as the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a shelter host 10, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (7)

1. A distributed master-slave machine communication method of a mobile security shelter is applied to a shelter master machine in communication connection with a plurality of shelter slave machines, and comprises the following steps:
acquiring a preset number of each of the plurality of shelter slave machines;
sequencing the obtained plurality of preset numbers to obtain a preset number sequence;
taking the shelter slave machine corresponding to the preset number at the top of the preset number sequence as a set shelter slave machine;
generating inquiry information according to a preset number of the set shelter slave machine and a set data format, and sending the inquiry information to the set shelter slave machine;
judging whether shelter slave machine data returned after the preset number is judged to be the same as the existing number and the set data format is judged to be the same as the existing data format based on the inquiry information by the set shelter slave machine within a preset time length or not, if the shelter slave machine data is received within the preset time length, caching the shelter slave machine data, and sending the inquiry information to another shelter slave machine in the shelter slave machines;
after the inquiry information of each of the plurality of shelter slave machines is sent, judging whether the number of the cached shelter slave machine data is the same as the preset number or not, if the number of the cached shelter slave machine data is the same as the preset number, collecting shelter master machine data, and sending the shelter master machine data and the cached shelter slave machine data to a control center; and the number of the buffered cabin slave data is the number of the cabin slaves which are successfully polled.
2. The distributed master-slave communication method of claim 1, further comprising:
deleting the collected shelter host data and the cached shelter slave data;
and re-executing the steps of sequentially sending the inquiry information to each of the plurality of shelter slaves and judging whether the number of buffered shelter slave data is the same as the preset number.
3. The distributed master-slave communication method of claim 1, further comprising:
if the number of the cached cabin slave machine data is different from the preset number, deleting the cached cabin slave machine data, and sending the inquiry information to the set cabin slave machine again;
judging whether the data of the shelter slave machine returned by the set shelter slave machine based on the inquiry information is received within the preset time length, if the data of the shelter slave machine is received within the preset time length, caching the data of the shelter slave machine, and sending the inquiry information to another shelter slave machine in the plurality of shelter slave machines;
after the inquiry information of each of the plurality of shelter slaves is sent, whether the number of the cached shelter slave data is the same as the preset number or not is judged, if the number of the cached shelter slave data is the same as the preset number, shelter master data is collected, and the shelter master data and the cached shelter slave data are sent.
4. The distributed master-slave communication method of claim 1, further comprising:
if the number of the cached shelter slave machine data is different from the preset number, deleting the cached shelter slave machine data, and sending inquiry information to any shelter slave machine except the set shelter slave machine in the plurality of shelter slave machines;
judging whether the data of the shelter slave machine returned by any one shelter slave machine based on the inquiry information is received within the preset time length, if the data of the shelter slave machine returned by any one shelter slave machine is received within the preset time length, caching the data of the shelter slave machine returned by any one shelter slave machine, and sending the inquiry information to another shelter slave machine in the plurality of shelter slave machines;
after the inquiry information of each of the plurality of shelter slaves is sent, whether the number of the cached shelter slave data is the same as the preset number or not is judged, if the number of the cached shelter slave data is the same as the preset number, shelter master data is collected, and the shelter master data and the cached shelter slave data are sent.
5. The distributed master-slave communication method of claim 1, further comprising:
and if the number of the cached cabin slave machine data is different from the preset number, deleting the cached cabin slave machine data, generating early warning information and sending the early warning information.
6. The distributed master-slave communication method of claim 1, further comprising:
if the data of the shelter slave machines are not received within the preset time length, the set shelter slave machines are identified, and the inquiry information is sent to another shelter slave machine in the shelter slave machines.
7. A distributed master-slave communication device for a mobile mobility assurance shelter, applied to a shelter master in communication connection with a plurality of shelter slaves, comprising:
the query information sending module is used for acquiring the preset number of each of the plurality of shelter slave machines; sequencing the obtained plurality of preset numbers to obtain a preset number sequence; taking the shelter slave machine corresponding to the preset number at the top of the preset number sequence as a set shelter slave machine; generating inquiry information according to a preset number of the set shelter slave machine and a set data format, and sending the inquiry information to the set shelter slave machine;
an inquiry result judging module, configured to judge whether the shelter slave data returned by the set shelter slave machine after judging, based on the inquiry information, that the preset number is the same as an existing number and the set data format is the same as an existing data format is received within a preset time period, and if the shelter slave machine data is received within the preset time period, cache the shelter slave machine data and send the inquiry information to another shelter slave machine of the multiple shelter slave machines;
the communication data processing module is used for judging whether the number of the cached cabin slave machine data is the same as the preset number or not after the inquiry information of each cabin slave machine in the plurality of cabin slave machines is sent, acquiring cabin host machine data if the number of the cached cabin slave machine data is the same as the preset number, and sending the cabin host machine data and the cached cabin slave machine data to a control center; and the number of the buffered cabin slave data is the number of the cabin slaves which are successfully polled.
CN201910140560.XA 2019-02-27 2019-02-27 Distributed master-slave machine communication method and device for mobile security shelter Active CN109889593B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910140560.XA CN109889593B (en) 2019-02-27 2019-02-27 Distributed master-slave machine communication method and device for mobile security shelter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910140560.XA CN109889593B (en) 2019-02-27 2019-02-27 Distributed master-slave machine communication method and device for mobile security shelter

Publications (2)

Publication Number Publication Date
CN109889593A CN109889593A (en) 2019-06-14
CN109889593B true CN109889593B (en) 2021-11-12

Family

ID=66929255

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910140560.XA Active CN109889593B (en) 2019-02-27 2019-02-27 Distributed master-slave machine communication method and device for mobile security shelter

Country Status (1)

Country Link
CN (1) CN109889593B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111885028A (en) * 2020-07-10 2020-11-03 深圳市信锐网科技术有限公司 Data transmission device, data processing method, master, slave, and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101222377A (en) * 2007-11-23 2008-07-16 深圳国人通信有限公司 Method and device for processing slave machine parameter in distributed master-salve machine communication
CN102546332A (en) * 2010-12-14 2012-07-04 黄越杰 Networking communication method for upper computers and lower computers
CN105446928A (en) * 2015-11-18 2016-03-30 深圳云联讯数据科技有限公司 Address automatically allocated serial bus communication method and system
CN106681953A (en) * 2016-12-09 2017-05-17 杰发科技(合肥)有限公司 Slave computer connected with host computer through I2C bus and communication method of slave computer
CN108563518A (en) * 2018-04-08 2018-09-21 广州视源电子科技股份有限公司 Slave communication means, device, terminal device and storage medium
CN108712244A (en) * 2018-04-26 2018-10-26 烽火通信科技股份有限公司 One-to-many half-duplex operation method and system

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002353978A (en) * 2001-05-25 2002-12-06 Pioneer Electronic Corp Wireless communication terminal having main station or subordinate station function
US8964586B2 (en) * 2011-08-05 2015-02-24 Texas Instruments Incorporated Enhanced QOS support using Bluetooth low energy
TWI551099B (en) * 2013-01-22 2016-09-21 新唐科技股份有限公司 Communication system, master device and communication method thereof
CN107040563B (en) * 2016-02-04 2021-01-19 阿里巴巴集团控股有限公司 Asynchronous service processing method and server
CN106777371B (en) * 2017-01-23 2019-12-06 北京齐尔布莱特科技有限公司 Log collection system and method
EP3376793A1 (en) * 2017-03-17 2018-09-19 Televic Healthcare NV Master node with quality of service capabilities for use in a network including a bluetooth low energy link and network comprising same
CN107911273A (en) * 2017-12-18 2018-04-13 合肥华凌股份有限公司 Communication system, communication means and the household electrical appliance of household electrical appliance

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101222377A (en) * 2007-11-23 2008-07-16 深圳国人通信有限公司 Method and device for processing slave machine parameter in distributed master-salve machine communication
CN102546332A (en) * 2010-12-14 2012-07-04 黄越杰 Networking communication method for upper computers and lower computers
CN105446928A (en) * 2015-11-18 2016-03-30 深圳云联讯数据科技有限公司 Address automatically allocated serial bus communication method and system
CN106681953A (en) * 2016-12-09 2017-05-17 杰发科技(合肥)有限公司 Slave computer connected with host computer through I2C bus and communication method of slave computer
CN108563518A (en) * 2018-04-08 2018-09-21 广州视源电子科技股份有限公司 Slave communication means, device, terminal device and storage medium
CN108712244A (en) * 2018-04-26 2018-10-26 烽火通信科技股份有限公司 One-to-many half-duplex operation method and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
An Adaptive Traffic-Aware Polling and Scheduling Algorithm for Bluetooth Piconets;Ching-Fang Hsu等;《IEEE Transactions on Vehicular Technology》;20091215;第59卷(第3期);全文 *
基于低压电力线载波的轮询通信改进;秦坤,袁嫣红等;《成组技术与生产现代化 信息化技术》;20180821;第35卷(第1期);全文 *

Also Published As

Publication number Publication date
CN109889593A (en) 2019-06-14

Similar Documents

Publication Publication Date Title
CN108833237B (en) Intelligent home gateway and control method thereof
CN108512870B (en) Method for accessing Internet of things platform, Internet of things platform and Internet of things equipment
EP1752908A2 (en) Portable RFID reader having a location determination system
CN106852188B (en) Data interaction method based on universal serial bus and universal serial bus equipment
CN105306414A (en) Port vulnerability detection method, device and system
CN112737856B (en) Link tracking method and device, storage medium and electronic device
CN109889593B (en) Distributed master-slave machine communication method and device for mobile security shelter
CN105513150A (en) Attendance registration method and device
CN112199671A (en) Artificial intelligence-based malicious data analysis method and device and electronic device
CN111625419A (en) Log acquisition method, system, equipment and computer readable storage medium
CN109522897A (en) Customs inspection system, method, apparatus, equipment and readable storage medium storing program for executing
CN102413247A (en) Method and device for recovering crash site of terminal
CN109270885B (en) Data communication method, device and equipment for monitoring PLC system and storage medium
CN109450757B (en) Method for starting CANopen master station and overall management device thereof
CN115599617B (en) Bus detection method and device, server and electronic equipment
CN109245979B (en) CANopen master-slave station reliability control method and overall management device thereof
EP3104338B1 (en) On-board device for a vehicle
CN110687910A (en) Equipment control method and device, storage medium and lower computer
CN107171915B (en) Communication protocol changing method and device
CN111161732B (en) Voice acquisition method and device, electronic equipment and storage medium
CN111158551A (en) Voice acquisition method and device, electronic equipment and storage medium
JP6845127B2 (en) External monitoring system and monitoring terminal
CN107402865A (en) client data monitoring method and device
CN109522219A (en) A kind of method, commissioning device and the storage medium of debugging operations system
CN115903610A (en) Intelligent edge control terminal

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
GR01 Patent grant
GR01 Patent grant