CN109617825B - Message processing device, method and communication system - Google Patents

Message processing device, method and communication system Download PDF

Info

Publication number
CN109617825B
CN109617825B CN201811449983.1A CN201811449983A CN109617825B CN 109617825 B CN109617825 B CN 109617825B CN 201811449983 A CN201811449983 A CN 201811449983A CN 109617825 B CN109617825 B CN 109617825B
Authority
CN
China
Prior art keywords
message
buffer
report message
report
unit
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
CN201811449983.1A
Other languages
Chinese (zh)
Other versions
CN109617825A (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.)
Comba Network Systems Co Ltd
Original Assignee
Comba Network Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Comba Network Systems Co Ltd filed Critical Comba Network Systems Co Ltd
Priority to CN201811449983.1A priority Critical patent/CN109617825B/en
Publication of CN109617825A publication Critical patent/CN109617825A/en
Application granted granted Critical
Publication of CN109617825B publication Critical patent/CN109617825B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application relates to a message processing device, a message processing method and a communication system, wherein the message processing device comprises a buffer pool, a message receiving unit, a query response unit and a report message processing unit; the buffer pool comprises a plurality of buffer areas; the message receiving unit is used for caching the report message transmitted by the slave equipment to a buffer area; the inquiry response unit is used for blocking the operation of the message receiving unit according to an inquiry command sent by the master equipment and waiting for receiving the data transmitted by the slave equipment; the data comprises a response message and a reporting message; the data processing device is also used for processing the response message when detecting that the data is the response message; when the data is detected to be a report message, caching the report message into a buffer area; and the report message processing unit is used for reading the report message from the buffer area and processing the read report message. According to the embodiment of the application, high-reliability communication can be realized in the communication interface with low reliability, the cost of a hardware system is greatly reduced, and the reliability of communication is improved.

Description

Message processing device, method and communication system
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a message processing apparatus, a message processing method, and a communication system.
Background
With the development of the communication technology field, communication can be performed between communication devices in a master-slave mode. At present, a hardware interface (such as a serial interface) based on low reliability usually has data initiated by a master device, a slave device responds to the data, the slave device cannot actively send a message, and the master device cannot process a burst message of the slave device; for a high-reliability hardware interface (such as an ethernet interface), although asynchronous message processing can be realized, the hardware cost is high, and the system design difficulty is high.
In the implementation process, the inventor finds that at least the following problems exist in the conventional technology: in communication between communication devices, it is difficult to achieve both hardware cost of the system and reliability of communication.
Disclosure of Invention
In view of the above, it is necessary to provide a message processing apparatus, a message processing method, and a communication system, which are directed to the problem that it is difficult for a conventional communication device to achieve both of the hardware cost of the system and the reliability of communication.
In order to achieve the above object, an embodiment of the present invention provides a message processing apparatus, including a buffer pool, a message receiving unit, an inquiry response unit, and a report message processing unit; the buffer pool comprises a plurality of buffer areas;
the message receiving unit is used for caching the report message transmitted by the slave equipment to a buffer area;
the inquiry response unit is used for blocking the operation of the message receiving unit according to an inquiry command sent by the master equipment and waiting for receiving the data transmitted by the slave equipment; the data comprises a response message and a reporting message; the data processing device is also used for processing the response message when detecting that the data is the response message; when the data is detected to be a report message, caching the report message into a buffer area;
and the report message processing unit is used for reading the report message from the buffer area and processing the read report message.
In one embodiment, the message receiving unit is further configured to apply for a buffer area with an idle status from the buffer pool according to the report message, and buffer the report message to the buffer area; and when the buffer of the report message is finished, changing the state of the buffer into a ready state.
In one embodiment, the query response unit is further configured to, when it is detected that the data is a report message, buffer the report message to a buffer area whose state is idle, and change the state of the buffer area to a ready state when the buffer of the report message is completed.
In one embodiment, the report message processing unit is further configured to read a report message from a buffer in a ready state, and process the read report message.
In one embodiment, the message receiving unit is further configured to acquire a receive lock before buffering a report message transmitted from the device in the buffer; the receiving lock is used for representing the authority of receiving the message; after the report message transmitted by the slave equipment is cached in the buffer area, releasing the receiving lock;
the inquiry response unit is also used for acquiring a receiving lock before the blocking message receiving unit operates; after detecting that the data is a response message, the receive lock is released.
In one embodiment, the message receiving unit is further configured to release the receiving lock if the report message is not received within a preset time after the receiving lock is acquired.
In one embodiment, the message receiving unit is further configured to acquire a buffer lock before buffering a report message transmitted from the device in the buffer; the buffer lock is used for representing the authority of caching the message into the buffer; after the report message transmitted by the slave equipment is cached to the buffer area, releasing the buffer area lock;
the query response unit is also used for acquiring a buffer lock before the report message is cached to the buffer; and releasing the buffer lock after the report message is cached in the buffer.
In one embodiment, the message receiving unit is further configured to change a state of the buffer area to a busy state when the report message is cached in the buffer area;
and the inquiry response unit is also used for buffering the received data to a buffer area with busy state after waiting for receiving the data transmitted from the equipment.
In one embodiment, the query response unit is further configured to acquire a buffer lock before buffering the received data in a buffer with a busy status; after buffering the received data to a buffer that is busy, the buffer lock is released.
In one embodiment, the report message processing unit is further configured to empty the buffer and change the state of the buffer into an idle state after the read report message is processed.
In one embodiment, the report message processing unit is further configured to acquire a buffer lock before the buffer is emptied; after changing the state of the buffer to an idle state, the buffer lock is released.
In one embodiment, the query response unit is further configured to feed back a query failure message to the master device when the response message is not detected within a preset time.
On the other hand, an embodiment of the present invention further provides a message processing method, including the following steps:
caching a report message transmitted from the equipment to a buffer area by using a message receiving unit;
using the query response unit to block the operation of the message receiving unit according to the query command sent by the master device and wait for receiving the data transmitted by the slave device; the data comprises a response message and a reporting message; processing the response message when detecting that the data is the response message; when the data is detected to be a report message, caching the report message into a buffer area;
and reading the report message from the buffer area by using a report message processing unit, and processing the read report message.
On the other hand, the embodiment of the invention also provides a communication system, which comprises a master device and a slave device connected with the master device;
the master device is used for executing the steps of the message processing method.
In one embodiment, the master device connects to the slave device through a serial interface.
In another aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the steps of the message processing method.
One of the above technical solutions has the following advantages and beneficial effects:
when the slave equipment generates the report message, the slave equipment can actively transmit the report message to the master equipment by operating the message receiving unit and the report message processing unit, and then the master equipment can process the report message in time; specifically, the message receiving unit may buffer the report message transmitted by the slave device to the buffer, and the report message processing unit reads and processes the report message in the buffer, so that the master device may process the report message actively reported by the slave device in time. When the master device needs to inquire the slave device, the master device can actively acquire the response message of the slave device by operating the inquiry response unit; specifically, the query response unit may block the message receiving unit from operating according to the query command, and wait to receive data transmitted from the device; processing the response message when detecting that the data is the response message; when the data is detected to be the report message, the report message is cached to the buffer area, and then the report message in the buffer area can be read and processed through the report message processing unit, so that the report message of the slave equipment can be received in time in the process that the master equipment acquires the response message, the report message is prevented from being lost, and the communication reliability is improved; in addition, the message processing device can be realized in a communication interface with low reliability, and the cost of a hardware system is greatly reduced.
Drawings
FIG. 1 is a diagram showing a structure of a message processing apparatus according to an embodiment;
FIG. 2 is a block diagram illustrating the operation of a message receiving unit in one embodiment;
FIG. 3 is a block diagram that illustrates the operation of the query response unit in one embodiment;
fig. 4 is a block diagram of a workflow of a report message processing unit in an embodiment;
FIG. 5 is a flow diagram that illustrates a method for message processing in one embodiment;
fig. 6 is a first block diagram of a communication system in one embodiment;
fig. 7 is a second structural diagram of a communication system in one embodiment.
Detailed Description
To facilitate an understanding of the present application, the present application will now be described more fully with reference to the accompanying drawings. Preferred embodiments of the present application are shown in the drawings. This application may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
In one embodiment, as shown in fig. 1, a message processing apparatus is provided, which includes a buffer pool 110, a message receiving unit 120, a query response unit 130, and a report message processing unit 140; the buffer pool 110 includes a plurality of buffers.
The message receiving unit 120 is configured to buffer the report message transmitted from the device into a buffer.
A query response unit 130, configured to block the message receiving unit from operating according to a query command sent by the master device, and wait for receiving data transmitted by the slave device; the data comprises a response message and a reporting message; the data processing device is also used for processing the response message when detecting that the data is the response message; and when the data is detected to be the report message, caching the report message into a buffer area.
And a report message processing unit 140, configured to read a report message from the buffer, and process the read report message.
The buffer pool 110 refers to a buffer for buffering data, and the buffer can be used for classifying and buffering report messages. The buffer pool 110 may include a plurality of buffers, which may be used to buffer the report messages. The reporting message refers to a reporting message which is actively sent to the master device by the slave device; for example, when the slave device generates an exception, a report message indicating that the exception is generated may be generated. The master device may be a communication device; the slave device may be a communication device. The message receiving unit 120 may be configured to receive a report message; in one example, at system initialization, the message receiving unit may be started, and the report message may be received in real time by the message receiving unit 120. The report message processing unit 140 can be used to process the report message. The query response unit 130 is configured to receive data (including a response message and a report message), process the received response message, and buffer the received report message; in one example, when the master device needs to actively query the slave device, the query response unit 130 may be started, and the query response process is processed by the query response unit 130. The query command refers to a query instruction; in one example, the master device may send the generated query command to the slave device, and the slave device feeds back a response message to the master device according to the query command.
Specifically, when the slave device generates a report message and needs to report the report message to the master device, the report message transmitted by the slave device may be cached in the buffer by starting the message receiving unit 120, so that the slave device actively transmits the report message to the master device; by starting the report message processing unit 140, reading and processing the report message in the buffer, the urgent report message of the slave device can be processed in time. When the master device needs to query the slave device, the query response unit 130 is started, and the message receiving unit is blocked from operating according to the query command sent by the master device and waits for receiving the data transmitted by the slave device; after receiving data transmitted by the slave equipment, judging the type of the data, and processing the response message when detecting that the data is the response message, so as to realize that the master equipment actively acquires the response message of the slave equipment; when the data is detected to be the report message, the report message is cached in the buffer area, and then the report message in the buffer area can be read and processed through the report message processing unit 140, so that the report message of the slave device can be received in time in the process that the master device acquires the response message, the loss of the report message is prevented, and the communication reliability is improved.
Further, when the system is initialized, the message receiving unit 120 and the report message processing unit 140 may be started, and the message receiving unit 120 detects whether the report message of the slave device is received, and if the report message is received, the report message is cached in the buffer; if the report message is not received, whether the report message is received or not is continuously detected. The report message processing unit 140 may traverse each buffer in the buffer pool, read the report message from the buffer, and process the read report message, so as to implement timely processing of the report message of the slave device. In the system operation process, if the master device actively sends a query command to the slave device, the query response unit 130 can be started, and the message receiving unit is blocked by the query response unit 130, so that the message receiving unit is temporarily stopped from operating and cannot be scheduled; after sending the query command to the slave device, the master device enters a waiting stage and waits for receiving the data transmitted by the slave device. In the waiting phase, the query response unit 130 may detect whether the received data is a response message in real time, and if the data is detected to be the response message, directly process the response message; if the detected data is a report message, the report message is cached in the buffer area, and then the report message can be read and processed by the report message processing unit 140, so as to realize the high-reliability communication of the system.
It should be noted that the message receiving unit 120, the query responding unit 130, and the report message processing unit 140 may be configured on the master device.
It should be noted that, at a time node, only the message receiving unit 120 or the query responding unit 130 operates, that is, the message receiving unit 120 or the query responding unit 130 cannot operate simultaneously.
Based on the embodiment, when the slave device generates the report message, the slave device can actively transmit the report message to the master device by operating the message receiving unit and the report message processing unit, and then the master device can process the report message in time; when the master device needs to inquire the slave device, the master device can receive the data transmitted by the slave device by operating the inquiry response unit, so that the master device can actively acquire the response message of the slave device and buffer the received reported message in time; the real-time communication of the master device and the slave device can be realized in a communication interface with low reliability, the cost of a hardware system is greatly reduced, the real-time processing of the report message and the response message is realized, the conflict caused by the processing of the response message and the report message is prevented, the loss of the report message is prevented, and the reliability of the communication is improved.
In an embodiment, as shown in fig. 1, the message receiving unit 120 is further configured to apply for a buffer with an idle status from the buffer pool according to the report message, and buffer the report message to the buffer; and when the buffer of the report message is finished, changing the state of the buffer into a ready state.
The buffer area is in an idle state and can be used for indicating that the report message is not cached in the buffer area at the current moment; the state of the buffer is ready state, which can indicate that the buffer has the report message buffered at the current time.
Specifically, when receiving the report message, the message receiving unit 120 may apply for a buffer with an idle status from the buffer pool 110 according to the received report message, and buffer the received report message into the buffer. After the report message is buffered, the state of the buffer can be changed to a ready state, so that the report message processing unit 140 can read the report message. By setting the buffer state in the buffer area, the message receiving unit can buffer the report message in a classified manner, so that the conflict of processing is prevented from being eliminated.
In an embodiment, as shown in fig. 1, the query response unit 130 is further configured to buffer the report message into a buffer with a free state when detecting that the data is the report message, and change the state of the buffer into a ready state when the buffer of the report message is finished.
Specifically, when detecting that the data transmitted from the device is the report message, the query response unit 130 may apply for a buffer with a free status from the buffer pool, and buffer the report message into the buffer. After the report message is buffered, the state of the buffer can be changed to a ready state, so that the report message processing unit 140 can read the report message. By acquiring the report message in time in the process of query response, the report message can be prevented from being lost; by setting the buffer state in the buffer area, the query response unit can buffer the report message in a classified mode, and the conflict of processing is prevented from being eliminated.
In an embodiment, as shown in fig. 1, the report message processing unit 140 is further configured to read a report message from a buffer with a ready status, and process the read report message.
Specifically, the report message processing unit 140 may query the status of each buffer area in the buffer pool 110, and if the status of the buffer area is the ready status, read the report message from the buffer area in the ready status, and process the read report message, so as to implement timely processing of the report message.
In an embodiment, as shown in fig. 1, the message receiving unit 120 is further configured to obtain a receiving lock before buffering the report message transmitted from the device in the buffer; the receiving lock is used for representing the authority of receiving the message; and releasing the receiving lock after buffering the report message transmitted from the equipment to the buffer.
The query response unit 130 is further configured to acquire a receiving lock before the blocking message receiving unit operates; after detecting that the data is a response message, the receive lock is released.
The receiving lock can be used for indicating the authority of receiving the report message and can also be used for indicating the authority of receiving the response message. The authority for receiving the reported message can be obtained by obtaining the receiving lock; by releasing the receiving lock, the authority for receiving the reported message can be released, so that other units (such as a message receiving unit) can acquire the receiving lock.
Specifically, when the slave device generates a report message and needs to report the report message to the master device, the receiving lock may be acquired by starting the message receiving unit 120; according to the obtained receiving lock, the reporting message transmitted by the slave equipment can be cached in the buffer area, and after the buffering of the reporting message is finished, the receiving lock can be released, so that the message receiving process of the current round is completed. The slave device actively transmits the report message to the master device. When the master device needs to query the slave device, the receiving lock can be acquired by starting the query response unit 130; after the receiving lock is obtained, the operation of the message receiving unit 120 can be further blocked according to the query command sent by the master device, and the receiving of the data transmitted by the slave device is waited; when the data is detected to be the response message, the receiving lock can be released, the response message is processed, and the master device actively acquires the response message of the slave device; by setting the receiving lock, the conflict of message transmission can be prevented, and the communication reliability is improved.
Further, before the message receiving unit 120 receives the report message, the receiving lock may be acquired; after the buffer of the reported message is finished and the state of the buffer area is changed into the ready state, the receiving lock can be released, and the message receiving of the current round is completed.
In one example, the master device is connected with the slave device through the serial interface, and by setting a mechanism of a receiving lock, the message is not lost when the master device and the slave device communicate on the serial interface, so that the communication reliability is improved.
In an embodiment, as shown in fig. 1, the message receiving unit 120 is further configured to release the receiving lock if the report message is not received within a preset time after the receiving lock is acquired.
Specifically, after the message receiving unit 120 obtains the receiving lock, if the report message is not received within the preset time, that is, if the message reception is overtime, it indicates that the report message is not received in the current round, the receiving lock is released, and the message reception in the current round is ended, so that the message receiving unit 120 is prevented from occupying the receiving lock when the slave device does not generate the report message for a long time or the message reception is abnormal, and the reliability of communication is improved.
In an embodiment, as shown in fig. 1, the message receiving unit 120 is further configured to obtain a buffer lock before buffering the report message transmitted from the device into the buffer; the buffer lock is used for representing the authority of caching the message into the buffer; and releasing the buffer lock after buffering the report message transmitted from the equipment to the buffer.
The query response unit 130 is further configured to obtain a buffer lock before the report message is cached in the buffer; and releasing the buffer lock after the report message is cached in the buffer.
Wherein the buffer lock is operable to indicate the authority of the buffer; the buffer zone authority comprises read, write, erase and other authorities, wherein the read authority can be used for reading the message of the buffer zone; write permissions may be used to cache messages to a buffer; the erase authority may be used to empty the buffer.
Specifically, when the slave device generates a report message and needs to report the report message to the master device, the buffer lock may be acquired by starting the message receiving unit 120; according to the acquired buffer lock, the report message transmitted from the equipment can be cached to the buffer; after the report message is cached in the buffer area, the buffer area lock is released, the message caching of the current round is realized, the data conflict in the data caching process is prevented, and the message synchronization and the mutual exclusion are realized in the process that the slave device actively transmits the report message to the master device. When the master device needs to inquire the slave device, if the data is detected to be the report message, the buffer lock can be acquired, the report message can be cached in the buffer, and after the buffer caching is finished, the buffer lock can be released, so that the current round of report message caching is completed. And the master device receives the reported message of the slave device in time in the process of acquiring the response message, so that data conflict in the process of message caching is prevented, and the communication reliability is improved.
In an embodiment, as shown in fig. 1, the message receiving unit 120 is further configured to change the state of the buffer to a busy state when the message buffer is reported to the buffer.
The query response unit 130 is further configured to buffer the received data into a buffer with a busy status after waiting for receiving the data transmitted from the device.
The buffer status is busy status, which can indicate that the buffer is buffering the report message at the current moment, and the report message is not buffered completely.
Specifically, when receiving the report message, the message receiving unit 120 may apply for a buffer with an idle status from the buffer pool 110 according to the received report message, and buffer the received report message into the buffer. When the reporting message starts to be cached, the state of the buffer area can be changed into a busy state, and the busy state of the buffer area is set so as to indicate that the reporting message is in the caching process. The query response unit 130 blocks the operation of the message receiving unit, and waits for receiving data transmitted from the device, and if a buffer with a busy state exists in the current buffer pool, it indicates that the buffer with the busy state is caching a report message, that is, the data received by the query response unit 130 is a report message at this time, and further buffers the received data (i.e., the report message) to the buffer with the busy state, so as to prevent the report message from being lost in the query response process.
In one embodiment, as shown in fig. 1, the query response unit 130 is further configured to obtain a buffer lock before buffering the received data into a buffer with a busy status; after buffering the received data to a buffer that is busy, the buffer lock is released.
Specifically, when the query response unit 130 blocks the operation of the message receiving unit and waits for receiving data transmitted from the device, if a buffer with a busy state exists in the current buffer pool 110, it indicates that the buffer with the busy state is caching a report message, and then obtains a buffer lock, and further caches the received data (i.e., the report message) to the buffer with the busy state based on the obtained buffer lock; after the data is cached, the buffer lock is released, so that the reported message is timely received in the query response process, and the reported message is prevented from being lost in the query response process.
In an embodiment, as shown in fig. 1, the report message processing unit 140 is further configured to empty the buffer and change the state of the buffer into an idle state after the read report message is processed.
Specifically, after reading the report message from the buffer and processing the report message, the report message processing unit 140 clears the buffer, and changes the state of the buffer into an idle state, so as to reinitialize the buffer corresponding to the report message after processing the report message, so as to be used in subsequent message buffers, thereby improving the utilization rate of the buffers. In other embodiments, the report message processing unit 140 may empty the buffer after reading the report message in the buffer and change the state of the buffer into an idle state between processing the report message.
It should be noted that, in an example, the report message processing unit 140 may obtain the buffer lock before reading the report message from the buffer, and further may read the report message from the buffer according to the read permission of the buffer lock. After reading the reporting message from the buffer, the buffer lock is released. In another example, the report message processing unit 140 can also directly read the report message from the buffer without first acquiring the buffer lock.
In an embodiment, as shown in fig. 1, the report message processing unit 140 is further configured to obtain a buffer lock before the buffer is emptied; after changing the state of the buffer to an idle state, the buffer lock is released.
Specifically, the report message processing unit 140 may obtain a buffer lock after reading the report message from the buffer and processing the report message; clearing the buffer area based on the acquired buffer area lock, and changing the state of the buffer area into an idle state; after the state of the buffer area is changed into an idle state, releasing the buffer area lock, and after the reported message is processed, re-initializing the buffer area corresponding to the reported message; by setting the buffer lock, the reliability of communication is improved.
In one embodiment, as shown in fig. 1, the query response unit 130 is further configured to feed back a query failure message to the master device when the response message is not detected within a preset time.
Wherein the query failure message may be used to indicate a query result response timeout.
Specifically, when the master device needs to query the slave device, the query response unit 130 may be started, and wait for the master device to send a query command; if the main equipment is not detected to send the query command within the preset time, the query response is considered to be overtime, a query failure message is fed back to the main equipment, and the query response process of the round is received.
The embodiment can be realized in a communication interface with low reliability, greatly reduces the cost of a hardware system, avoids the conflict easily caused by processing the report message and the response message in the communication process, and improves the reliability of communication.
In one embodiment, as shown in fig. 2, it is a work flow diagram of a message receiving unit, and the specific work process of the message receiving unit is as follows:
when the slave equipment generates a report message and needs to report the report message to the master equipment, a receiving lock can be obtained by starting the message receiving unit; judging whether a report message is received within a preset time, if the report message is not received, indicating that the message is received overtime, releasing a receiving lock, and finishing the message receiving of the current round; if the report message is received, applying for a buffer area with an idle state from the buffer pool, acquiring a buffer area lock, and caching the received report message into the buffer area based on the acquired buffer area lock; when the report message is cached, changing the state of the buffer area into a busy state to indicate that the buffer area is receiving the report message; after the report message is received, the state of the buffer area is changed into a ready state, which indicates that the report message of the buffer area is completely buffered and can be used by the report message processing unit.
As shown in fig. 3, it is a work flow diagram of the query response unit, and the specific work process of the query response unit is as follows:
when the master equipment needs to inquire the slave equipment, the receiving lock can be obtained by starting the inquiry response unit; according to the query command sent by the master device, the message receiving unit is blocked from running and waits for receiving the data transmitted by the slave device; when waiting to receive data transmitted by slave equipment, detecting whether a buffer area with busy state exists in a buffer pool, if so, acquiring a buffer area lock, continuing to cache the received data in the buffer area with busy state, and releasing the buffer area lock after the data caching is finished; when receiving data transmitted from the equipment, judging whether the detected data is a response message; if the data is detected to be the response message, releasing the receiving lock, and processing the response message to realize that the master device actively acquires the response message of the slave device; if the data is detected to be the report message, obtaining a buffer lock, applying for a buffer with a free state from the buffer pool, and caching the report message to the buffer with the free state; after the buffer of the report message is finished, the buffer lock is released, so that the report message of the slave equipment is received in time in the process of acquiring the response message by the master equipment, the report message is prevented from being lost, and the communication reliability is improved.
As shown in fig. 4, which is a working flow diagram of the report message processing unit, the specific working process of the report message processing unit is as follows:
buffering the report message into a buffer pool, and after the buffer of the report message is finished, changing the state of the buffer area into a ready state; the report message processing unit can judge whether a buffer zone with busy state exists in the buffer pool by traversing each buffer zone in the buffer pool, if so, the report message of the buffer zone is read, and the report message is reported; after the processing of the report message is finished, the buffer lock can be acquired, the buffer corresponding to the report message is emptied, and the state of the buffer is changed into an idle state, i.e. the buffer is reinitialized for subsequent message reception to continue using the buffer.
It should be noted that, when the message receiving unit applies for a buffer with a free status from the buffer pool, it may record an ID (identification code) of the buffer, and may be used to subsequently determine whether there is a report message that is not received at the current time by recording the ID of the buffer, and may also be used to determine whether there is a buffer with a busy status in traversing the buffer.
Based on the embodiment, a high-reliability double-end communication mechanism can be realized in a low-reliability communication interface, so that the master device on the bus can actively receive the response message and can also receive the burst report data of the slave device at any time.
In one embodiment, as shown in FIG. 5, a message processing method is provided. The method comprises the following steps:
step S510, the message receiving unit is used to buffer the report message transmitted from the device into the buffer.
Step S520, the query response unit is used for blocking the operation of the message receiving unit according to the query command sent by the master device and waiting for receiving the data transmitted by the slave device; the data comprises a response message and a reporting message; processing the response message when detecting that the data is the response message; and when the data is detected to be the report message, caching the report message into a buffer area.
Step S530, the report message processing unit is used to read the report message from the buffer area and process the read report message.
The specific content processes of step S510, step S520, and step S530 may refer to the content described above for the message processing apparatus, and are not described herein again.
Specifically, when the slave device generates the report message, the slave device can actively transmit the report message to the master device by operating the message receiving unit and the report message processing unit, and the master device can process the report message in time; when the master device needs to inquire the slave device, the master device can actively acquire the response message of the slave device by operating the inquiry response unit, and the report message of the slave device is timely received in the process of acquiring the response message by the master device, so that the loss of the report message is prevented, and the communication reliability is improved; in addition, the message processing device can be realized in a communication interface with low reliability, and the cost of a hardware system is greatly reduced.
It should be understood that, although the steps in the flowchart of fig. 5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 6, a communication system is provided. The system includes a master device 610 and a slave device 620 connected to the master device 610.
The master device 610 may be configured to perform the following steps:
caching a report message transmitted from the equipment to a buffer area by using a message receiving unit;
using the query response unit to block the operation of the message receiving unit according to the query command sent by the master device and wait for receiving the data transmitted by the slave device; the data comprises a response message and a reporting message; processing the response message when detecting that the data is the response message; when the data is detected to be a report message, caching the report message into a buffer area;
and reading the report message from the buffer area by using a report message processing unit, and processing the read report message.
Based on the embodiment, high-reliability communication can be realized in the communication interface with low reliability, the cost of a hardware system is greatly reduced, and an effective and reliable communication mechanism is provided for the communication system of a low-cost product. Therefore, the master device on the bus can actively receive the response message and can also receive the burst reported data of the slave device at any time.
In one embodiment, as shown in fig. 7, a communication system is provided, comprising a master device 710 and a slave device 720 connected to the master device 710; wherein the master device 710 is connected to the slave device 720 through a serial interface.
The master device 710 may be used to perform the following steps:
caching a report message transmitted from the equipment to a buffer area by using a message receiving unit;
using the query response unit to block the operation of the message receiving unit according to the query command sent by the master device and wait for receiving the data transmitted by the slave device; the data comprises a response message and a reporting message; processing the response message when detecting that the data is the response message; when the data is detected to be a report message, caching the report message into a buffer area;
and reading the report message from the buffer area by using a report message processing unit, and processing the read report message.
Based on the embodiment, high-reliability communication can be realized in the serial interface with low reliability, the cost of a hardware system is greatly reduced, and an effective and reliable communication mechanism is provided for a communication system of a low-cost product. Therefore, the master device on the bus can actively receive the response message and can also receive the burst reported data of the slave device at any time.
For the specific definition of the communication system, reference may be made to the above definition of the message processing apparatus, which is not described herein again.
It should be noted that the master device may operate the message processing apparatus, for example, the master device may configure the message processing apparatus, and implement high-reliability communication by processing the message receiving unit, the query response unit, and the report message processing unit through a thread.
It should be noted that, when a plurality of slave devices are connected to the corresponding master device for communication, a specific communication process is similar to that when the master device is connected to one slave device for communication, and details are not described herein again.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
caching a report message transmitted from the equipment to a buffer area by using a message receiving unit;
using the query response unit to block the operation of the message receiving unit according to the query command sent by the master device and wait for receiving the data transmitted by the slave device; the data comprises a response message and a reporting message; processing the response message when detecting that the data is the response message; when the data is detected to be a report message, caching the report message into a buffer area;
and reading the report message from the buffer area by using a report message processing unit, and processing the read report message.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the division methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (16)

1. A message processing device is characterized by comprising a buffer pool, a message receiving unit, a query response unit and a report message processing unit; the buffer pool comprises a plurality of buffer areas;
the message receiving unit is used for caching the report message transmitted by the slave equipment to the buffer area;
the query response unit is used for blocking the operation of the message receiving unit according to a query command sent by the master device and waiting for receiving the data transmitted by the slave device; the data comprises a response message and the report message; the data processing device is further used for processing the response message when the data is detected to be the response message; when the data is detected to be the report message, caching the report message to the buffer area;
and the report message processing unit is used for reading the report message from the buffer area and processing the read report message.
2. The message processing apparatus according to claim 1,
the message receiving unit is further configured to apply for a buffer area with an idle state from the buffer pool according to the report message, and cache the report message to the buffer area; and when the buffer of the report message is finished, changing the state of the buffer area into a ready state.
3. The message processing apparatus according to claim 1,
the query response unit is further configured to, when it is detected that the data is the report message, buffer the report message to a buffer area whose state is idle, and, when the buffer of the report message is completed, change the state of the buffer area to a ready state.
4. The message processing apparatus according to claim 1,
the report message processing unit is further configured to read the report message from the buffer in the ready state, and process the read report message.
5. The message processing apparatus according to claim 1,
the message receiving unit is further configured to obtain a receiving lock before caching the report message transmitted by the slave device in the buffer; the receiving lock is used for representing the authority of receiving the message; after the report message transmitted by the slave equipment is cached to the buffer area, releasing the receiving lock;
the query response unit is further configured to acquire the receiving lock before blocking the message receiving unit from running; releasing the receive lock after detecting the data as the response message.
6. The message processing apparatus according to claim 5,
the message receiving unit is further configured to release the receiving lock if the report message is not received within a preset time after the receiving lock is acquired.
7. The message processing apparatus according to claim 1,
the message receiving unit is further configured to obtain a buffer lock before caching the report message transmitted by the slave device in the buffer; the buffer lock is used for representing the authority of the buffer; after the report message transmitted by the slave equipment is cached to the buffer area, releasing the buffer area lock;
the query response unit is further configured to acquire the buffer lock before caching the report message in the buffer; and releasing the buffer lock after the report message is cached to the buffer.
8. The message processing apparatus according to claim 7,
the message receiving unit is further configured to change the state of the buffer area to a busy state when the report message is cached in the buffer area;
the inquiry response unit is further used for buffering the received data to a buffer area with a busy state after waiting for receiving the data transmitted by the slave equipment.
9. The message processing apparatus according to claim 8,
the query response unit is further configured to obtain the buffer lock before caching the received data in a buffer with a busy state; releasing the buffer lock after buffering the received data to a buffer with a busy state.
10. The message processing apparatus according to claim 1,
the report message processing unit is further configured to empty the buffer area and change the state of the buffer area into an idle state after the read report message is processed.
11. The message processing apparatus according to claim 10,
the report message processing unit is further configured to acquire a buffer lock before the buffer is emptied; releasing the buffer lock after changing the state of the buffer to an idle state.
12. The message processing apparatus according to claim 1,
the query response unit is further configured to feed back a query failure message to the master device when the response message is not detected within a preset time.
13. A message processing method is applied to a main device, and is characterized in that the main device comprises a buffer pool, a message receiving unit, an inquiry response unit and a reported message processing unit, wherein the buffer pool comprises a plurality of buffer areas; the method comprises the following steps:
caching a report message transmitted from the equipment to the buffer area by using a message receiving unit;
using a query response unit to block the operation of the message receiving unit according to a query command sent by the master device and wait for receiving the data transmitted by the slave device; the data comprises a response message and the report message; processing the response message when the data is detected to be the response message; when the data is detected to be the report message, caching the report message to the buffer area;
and reading the report message from the buffer area by using a report message processing unit, and processing the read report message.
14. A communication system comprising a master device and a slave device connected to the master device;
the master device is adapted to perform the steps of the message processing method as claimed in claim 13.
15. The communication system of claim 14, wherein the master device is connected to the slave device via a serial interface.
16. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the message processing method of claim 13.
CN201811449983.1A 2018-11-30 2018-11-30 Message processing device, method and communication system Active CN109617825B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811449983.1A CN109617825B (en) 2018-11-30 2018-11-30 Message processing device, method and communication system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811449983.1A CN109617825B (en) 2018-11-30 2018-11-30 Message processing device, method and communication system

Publications (2)

Publication Number Publication Date
CN109617825A CN109617825A (en) 2019-04-12
CN109617825B true CN109617825B (en) 2022-03-25

Family

ID=66006487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811449983.1A Active CN109617825B (en) 2018-11-30 2018-11-30 Message processing device, method and communication system

Country Status (1)

Country Link
CN (1) CN109617825B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111158921B (en) * 2019-12-16 2023-08-18 上海卫星工程研究所 Distributed telemetry acquisition method and system based on multitasking mechanism
CN112102520B (en) * 2020-08-14 2023-09-05 陕西千山航空电子有限责任公司 Method for reporting state information of aviation equipment
CN112235204B (en) * 2020-10-13 2023-04-07 中移(杭州)信息技术有限公司 Data reporting method, system, electronic equipment and storage medium
CN112615700B (en) * 2020-12-03 2022-06-28 瀚云科技有限公司 Data sending method, gateway, system, electronic equipment and readable storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1477604A (en) * 2002-08-23 2004-02-25 海湾安全技术股份有限公司 Alarm information transmission method and two-wire system communication bus equipment
CN1527561A (en) * 2003-09-22 2004-09-08 中兴通讯股份有限公司 RS-485 multipoint communication method
CN101102281A (en) * 2007-08-16 2008-01-09 中兴通讯股份有限公司 Data processing method for reporting a large number of data in mobile communication system
CN101729284A (en) * 2008-10-29 2010-06-09 中兴通讯股份有限公司 Equipment end initiative based method for realizing link polling in management system
CN104317765A (en) * 2014-10-20 2015-01-28 成都广达电子股份有限公司 Serial communication based one-to-many communication system and implementation method
CN104917696A (en) * 2015-06-08 2015-09-16 北京云迹科技有限公司 Periodic and non-periodic mixed communication method and system used for low-speed serial bus
CN105099562A (en) * 2015-07-15 2015-11-25 武汉虹信通信技术有限责任公司 Method and system for master device to automatically number slave devices
CN105912479A (en) * 2016-04-07 2016-08-31 武汉数字派特科技有限公司 Concurrent data caching method and structure
CN106293673A (en) * 2015-06-08 2017-01-04 中兴通讯股份有限公司 Operational order processing method and processing device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1477604A (en) * 2002-08-23 2004-02-25 海湾安全技术股份有限公司 Alarm information transmission method and two-wire system communication bus equipment
CN1527561A (en) * 2003-09-22 2004-09-08 中兴通讯股份有限公司 RS-485 multipoint communication method
CN101102281A (en) * 2007-08-16 2008-01-09 中兴通讯股份有限公司 Data processing method for reporting a large number of data in mobile communication system
CN101729284A (en) * 2008-10-29 2010-06-09 中兴通讯股份有限公司 Equipment end initiative based method for realizing link polling in management system
CN104317765A (en) * 2014-10-20 2015-01-28 成都广达电子股份有限公司 Serial communication based one-to-many communication system and implementation method
CN104917696A (en) * 2015-06-08 2015-09-16 北京云迹科技有限公司 Periodic and non-periodic mixed communication method and system used for low-speed serial bus
CN106293673A (en) * 2015-06-08 2017-01-04 中兴通讯股份有限公司 Operational order processing method and processing device
CN105099562A (en) * 2015-07-15 2015-11-25 武汉虹信通信技术有限责任公司 Method and system for master device to automatically number slave devices
CN105912479A (en) * 2016-04-07 2016-08-31 武汉数字派特科技有限公司 Concurrent data caching method and structure

Also Published As

Publication number Publication date
CN109617825A (en) 2019-04-12

Similar Documents

Publication Publication Date Title
CN109617825B (en) Message processing device, method and communication system
JP5472276B2 (en) Vehicle communication control device
CN105610984B (en) A kind of method of remote control vehicle
CN103036754B (en) A kind of multi-gang air-conditioner communication system and communication means
JP5222002B2 (en) In-vehicle relay connection unit
CN109240840B (en) Disaster recovery method and device for cluster system and machine readable medium
CN109361525B (en) Method, device, control terminal and medium for restarting distributed deployment of multiple services
US20200285458A1 (en) Program update system, control system, mobile body, program update method, recording medium
US20210004304A1 (en) Method of controlling communication over a local interconnect network bus
CN112918386A (en) Control method and device for automobile glove box lock
WO2022017052A1 (en) Method and apparatus for shared device instruction control and device
RU2537811C2 (en) Subscriber node of communication system having functionally separate transmission event memory
WO2021258696A1 (en) Communication data processing method and apparatus, computer device and storage medium
CN109450757B (en) Method for starting CANopen master station and overall management device thereof
CN109245979B (en) CANopen master-slave station reliability control method and overall management device thereof
CN111225007B (en) Database connection method, device and system
US20190250593A1 (en) Slave device, control system, communication method for response data and storage medium
CN112261512B (en) Master station remote control method, device, storage medium and equipment of unbalanced polling protocol
CN112231601B (en) Link management method, device, equipment and computer storage medium
CN110727248B (en) Method and industrial facility system for changing configuration
JP2792866B2 (en) Buffer pool pre-expansion device
CN108600044B (en) Interface state acquisition method, device and equipment
CN113452726A (en) Data transmission method, terminal and computer readable storage medium
CN111327499A (en) Method and device for sending message and automobile
WO2023223546A1 (en) Vehicle-mounted communication device

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200115

Address after: 510663 Shenzhou Road, Guangzhou Science City, Guangzhou economic and Technological Development Zone, Guangdong, 10

Applicant after: Jingxin Communication System (China) Co., Ltd.

Address before: 510663 Shenzhou Road 10, Guangzhou Science City, Guangzhou economic and Technological Development Zone, Guangzhou, Guangdong

Applicant before: Jingxin Communication System (China) Co., Ltd.

Applicant before: Jingxin Communication System (Guangzhou) Co., Ltd.

Applicant before: Jingxin Communication Technology (Guangzhou) Co., Ltd.

Applicant before: TIANJIN COMBA TELECOM SYSTEMS CO., LTD.

CB02 Change of applicant information
CB02 Change of applicant information

Address after: 510663 Shenzhou Road, Guangzhou Science City, Guangzhou economic and Technological Development Zone, Guangdong, 10

Applicant after: Jingxin Network System Co.,Ltd.

Address before: 510663 Shenzhou Road, Guangzhou Science City, Guangzhou economic and Technological Development Zone, Guangdong, 10

Applicant before: Comba Telecom System (China) Ltd.

GR01 Patent grant
GR01 Patent grant