CN102279832A - Method and device for determining connection state between serial port and sensing equipment - Google Patents

Method and device for determining connection state between serial port and sensing equipment Download PDF

Info

Publication number
CN102279832A
CN102279832A CN2011102532841A CN201110253284A CN102279832A CN 102279832 A CN102279832 A CN 102279832A CN 2011102532841 A CN2011102532841 A CN 2011102532841A CN 201110253284 A CN201110253284 A CN 201110253284A CN 102279832 A CN102279832 A CN 102279832A
Authority
CN
China
Prior art keywords
sensing equipment
serial ports
event
storer
adapter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2011102532841A
Other languages
Chinese (zh)
Inventor
王晓芹
王蒴
刘耀
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CVIC Software Engineering Co Ltd
Original Assignee
CVIC Software Engineering 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 CVIC Software Engineering Co Ltd filed Critical CVIC Software Engineering Co Ltd
Priority to CN2011102532841A priority Critical patent/CN102279832A/en
Publication of CN102279832A publication Critical patent/CN102279832A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a method and a device for determining a connection state between a serial port and sensing equipment. The method comprises the following steps of: establishing connection with an adapter according to the address information of the adapter, and arranging an event flow memory; monitoring whether the event flow memory receives an event which is sent by the adapter; and when the event flow memory receives the event which is sent by the adapter, determining that the adapter receives byte data which is sent by the sensing equipment, wherein in the connection state between the serial port and the sensing equipment, the sensing equipment is normally connected with the serial port and can send data through the serial port. The embodiment of the invention provides the method and the device for determining the connection state of the serial port and the sensing equipment. By the method and the device, the connection state between the sensing equipment and the serial port can be effectively determined, and equipment failure can be timely found and maintained.

Description

A kind of method and device of judging sensing equipment serial ports connection status
Technical field
The application relates to the Internet of Things field, particularly a kind of method and device of judging sensing equipment serial ports connection status.
Background technology
In Internet of Things is used, mainly be to obtain data by front end physical sensing equipment; And how to allow upper layer application in time learn the state of awareness apparatus, so that in time find and maintenance when breaking down, it is vital reducing loss.
The data acquisition facility state existing, that reception and parsing sensing equipment were gathered during Internet of Things was used, the work that is uploaded to operation system then can adopt the Internet of Things Application Middleware to finish.It sets up a corresponding adapter for each sensing equipment, is responsible for and being connected of physical sensing equipment, and reception and resolution data.Sensing equipment for connecting serial ports generally all has heartbeat packet, and even without reading label information, the time of fixed interval also can send the heartbeat packet that shows the equipment operate as normal.
Traditional equipment state has not two kinds of the successful connections of serial ports successful connection and serial ports, adapter is as long as can connect serial ports, just think successful connection, and can't judge can whether sensing equipment also normally be connected with serial ports, whether sensing equipment has been opened or normally send data.Serial ports on the machine is fixed, only otherwise occupied, no matter when adapter can both connect, but serial ports is then exactly so with being connected of sensing equipment, thisly only judges that according to the connection status of adapter and serial ports the mode of sensing equipment state is incomplete.
Summary of the invention
For solving the problems of the technologies described above, the embodiment of the present application provides a kind of method and device of judging sensing equipment serial ports connection status, can effectively judge the connection status between sensing equipment and the serial ports.
Technical scheme is as follows:
A kind of method of judging sensing equipment serial ports connection status comprises:
Connect and a flow of event storer is set according to the address information of adapter and described adapter;
Monitor described flow of event storer and whether receive the incident that described adapter sends;
When described flow of event storer receives the incident of described adapter transmission, judge that described adapter receives the byte data that described sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, and can send data by serial ports.
Above-mentioned method, preferred, also comprise:
Listen to after described flow of event storer receives the incident that described adapter sends, continue described flow of event storer is monitored;
When new incident that described flow of event storer in the Preset Time section does not receive that described adapter sends, judge that described adapter does not receive the byte data that sensing equipment sends again; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, but does not send data by serial ports.
Above-mentioned method, preferred, also comprise:
When not hearing described flow of event storer and receive the incident that described adapter sends, judge that described adapter does not receive the byte data that sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is not connected with serial ports.
A kind of device of judging sensing equipment serial ports connection status comprises:
Linkage unit is used for connecting according to the address information and the described adapter of adapter;
Storer is preset the unit, is used for a default flow of event storer;
Audiomonitor is used to monitor described flow of event storer and whether receives the incident that described adapter sends;
First identifying unit is used for when described flow of event storer receives the incident of described adapter transmission, judges that described adapter receives the byte data that described sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, and can send data by serial ports.
Above-mentioned device, preferred, also comprise:
Second identifying unit;
Audiomonitor listens to after described flow of event storer receives the incident that described adapter sends, and continues described flow of event storer is monitored;
Described second identifying unit is used for judging that described adapter does not receive the byte data that sensing equipment sends again when the new incident that described flow of event in the Preset Time section does not receive that described adapter sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, but does not send data by serial ports.
Above-mentioned device, preferred, also comprise:
The 3rd identifying unit is used for judging that described adapter does not receive the byte data that sensing equipment sends when described audiomonitor does not hear described flow of event storer and receives the incident that described adapter sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is not connected with serial ports.
The technical scheme that is provided by above the embodiment of the present application as seen, the method and the device of judgement sensing equipment serial ports connection status provided by the invention, judge the sensing equipment state that connects serial ports based on the event-driven technology, mainly according to whether successful connection and have no datat to send the state of judging sensing equipment of serial ports; Adapter is when collecting the byte data that sensing equipment sends by serial ports, and the incident that can send is to the event-driven engine, and the event-driven engine deposits incident in the flow of event storer that is pre-created; Incident in the described flow of event storer is monitored, when described flow of event storer receives the incident of described adapter transmission, judged that described adapter receives the byte data that described sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, and can send data by serial ports.
The method and the device of the judgement sensing equipment serial ports connection status that the embodiment of the present application provides, whether normally send the state that data are judged sensing equipment by sensing equipment, remedied classic method and judged the defective of sensing equipment state by judging the serial ports connection status; Adopt the event-driven technology, the real-time duty of obtaining sensing equipment can in time be monitored out equipment failure and be notified upper layer application, and the loss that fault is caused drops to minimum.
Description of drawings
In order to be illustrated more clearly in the embodiment of the present application or technical scheme of the prior art, to do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below, apparently, the accompanying drawing that describes below only is some embodiment that put down in writing among the application, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
A kind of process flow diagram of judging sensing equipment serial ports connection status that Fig. 1 provides for the embodiment of the present application one;
Fig. 2 provide for the embodiment of the present application one another judge the process flow diagram of sensing equipment serial ports connection status;
Fig. 3 provide for the embodiment of the present application one another judge the process flow diagram of sensing equipment serial ports connection status;
A kind of structural representation of judging sensing equipment serial ports connection status that Fig. 4 provides for the embodiment of the present application two;
The another kind that Fig. 5 provides for the embodiment of the present application two is judged the structural representation of sensing equipment serial ports connection status.
Embodiment
In order to make those skilled in the art person understand the application's scheme better.Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment only is the application's part embodiment, rather than whole embodiment.Based on the embodiment among the application, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all should belong to the scope of the application's protection.
Embodiment one
The embodiment of the present application provides a kind of method flow diagram of judging sensing equipment serial ports connection status comprises as shown in Figure 1:
Step S101: connect and be provided with the flow of event storer according to the address information of adapter and described adapter;
Step S102: monitor described flow of event storer and whether receive the incident that described adapter sends;
Step S103: when described flow of event storer receives the incident of described adapter transmission, judge that described adapter receives the byte data that described sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, and can send data by serial ports.
The decision method that the embodiment of the present application provides adopts the event-driven technology to judge the state of the sensing equipment that connects serial ports, mainly according to whether successful connection and have no datat to send the state of judging sensing equipment of serial ports; In the embodiment of the present application the connection status of sensing equipment is revised as three kinds by traditional two kinds: connect the serial ports success but do not have data to arrive; Connecting serial ports successfully and by data arrives; The serial ports successful connection.Adapter receives the byte data that sensing equipment transmits, and the state of equipment just is normal the connection and the transmission data, because as long as the equipment operate as normal even without reading label data, also has the heartbeat packet data and sends.
Do not receive new byte data again if crossed certain time interval (greater than the time interval that sends heartbeat packet), the state of equipment shows the normal connection in position but does not send data, illustrates and breaks down sensing equipment and being connected of serial ports; Below be described in detail at above various states; The embodiment of the present application provides a kind of other method process flow diagram of judging sensing equipment serial ports connection status comprises as shown in Figure 2:
Step S201: connect and a flow of event storer is set according to the address information of adapter and described adapter;
The similar tables of data of flow of event storer, exist in the internal memory, can set the storage incident of incident or the length of storage incident for the flow of event storer, the flow of event storer in the embodiment of the present application can be 1 storer for length, only keeps a up-to-date incident;
Step S202: monitor described flow of event storer and whether receive the incident that described adapter sends; When receiving, execution in step S203; Otherwise execution in step S204;
Step S203: judge that described adapter receives the byte data that described sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, and can send data by serial ports; Redirect execution in step S205;
Step S204: judge that described adapter does not receive the byte data that sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is not connected with serial ports;
Step S205: judge whether the flow of event storer receives the new incident that described adapter sends in the Preset Time section; If not, execution in step S206;
Step S206: judge that described adapter does not receive the byte data that sensing equipment sends again; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, but does not send data by serial ports.
For above-mentioned decision method more clearly is described, the embodiment of the present application provides another detailed decision method process flow diagram, from the principle angle of judging the decision method that the embodiment of the present application provides is described, and as shown in Figure 3, comprising:
Step S301: sensing equipment sends data by byte;
Sensing equipment sends the data that read by byte;
Step S302: serial port adapter receives each byte and promptly sends an incident;
Adapter all can send an incident after receiving each byte of sensing equipment transmission in the event-driven engine;
Step S303: event engine reception incident deposits the flow of event storer in:
Step S304: the monitoring of storer takes a decision as to whether first incident of arrival; If, execution in step S305; Otherwise, return execution in step S302;
For storer is provided with a monitoring, monitor the incident that arrives, if first arrival, the sensing equipment status modifier is the normal connection of serial ports and sends data;
Step S305: show that the sensing equipment state is: normally connect and send data;
Step S306: event engine pattern match: do not listen to new events in the specific excessively time memory again and arrive;
If state is normal to be connected and data send normally, then the pattern match of event engine is monitored, mate the specific time and do not have new incident to arrive in the flow of event storer, state is shown as the serial ports connection normally but do not send data;
Step S307: show that the sensing equipment state is: normally connect but do not send data, and empty storer, return execution in step S302;
Empty the flow of event storer, and restart to monitor the flow of event storer and whether have new events to reach, prepare status modifier next time.
For aforesaid method embodiment, for simple description, so it all is expressed as a series of combination of actions, but those skilled in the art should know, the present invention is not subjected to the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in the instructions all belongs to preferred embodiment, and related action and module might not be that the present invention is necessary.
Embodiment two
At above method embodiment, the embodiment of the present application also provides a kind of device of judging sensing equipment serial ports connection status, the event-driven engine that promptly above is mentioned to, and its structural representation such as the embodiment of the present application are shown in Figure 4, comprising:
Linkage unit 401, storer default unit 402, audiomonitor 403 and first identifying unit 404;
Wherein:
Linkage unit 401 is used for connecting according to the address information and the described adapter of adapter;
Storer is preset unit 402, is used for a default flow of event storer;
Audiomonitor 403 is used to monitor described flow of event storer and whether receives the incident that described adapter sends;
First identifying unit 404 is used for when described flow of event storer receives the incident of described adapter transmission, judges that described adapter receives the byte data that described sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, and can send data by serial ports.
A kind of device of judging sensing equipment serial ports connection status that the embodiment of the present application provides, one detailed structure synoptic diagram such as the embodiment of the present application are shown in Figure 5, also comprise:
Second identifying unit 405;
403 of audiomonitors continue described flow of event storer is monitored after hearing that described flow of event storer receives the incident of described adapter transmission;
Described second identifying unit 405 is used for judging that described adapter does not receive the byte data that sensing equipment sends again when the new incident that described flow of event in the Preset Time section does not receive that described adapter sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, but does not send data by serial ports.
The 3rd identifying unit 406;
Described the 3rd identifying unit 406 is used for judging that described adapter does not receive the byte data that sensing equipment sends when described audiomonitor does not hear described flow of event storer and receives the incident that described adapter sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is not connected with serial ports.
For system embodiment, because it is substantially corresponding to method embodiment, so description is fairly simple, relevant part gets final product referring to the part explanation of method embodiment.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and identical similar part is mutually referring to getting final product between each embodiment, and each embodiment stresses all is difference with other embodiment.The above only is the application's a embodiment; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the application's principle; can also make some improvements and modifications, these improvements and modifications also should be considered as the application's protection domain.

Claims (6)

1. a method of judging sensing equipment serial ports connection status is characterized in that, comprising:
Connect and a flow of event storer is set according to the address information of adapter and described adapter;
Monitor described flow of event storer and whether receive the incident that described adapter sends;
When described flow of event storer receives the incident of described adapter transmission, judge that described adapter receives the byte data that described sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, and can send data by serial ports.
2. method according to claim 1 is characterized in that, also comprises:
Listen to after described flow of event storer receives the incident that described adapter sends, continue described flow of event storer is monitored;
When new incident that described flow of event storer in the Preset Time section does not receive that described adapter sends, judge that described adapter does not receive the byte data that sensing equipment sends again; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, but does not send data by serial ports.
3. method according to claim 1 is characterized in that, also comprises:
When not hearing described flow of event storer and receive the incident that described adapter sends, judge that described adapter does not receive the byte data that sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is not connected with serial ports.
4. a device of judging sensing equipment serial ports connection status is characterized in that, comprising:
Linkage unit is used for connecting according to the address information and the described adapter of adapter;
Storer is preset the unit, is used for a default flow of event storer;
Audiomonitor is used to monitor described flow of event storer and whether receives the incident that described adapter sends;
First identifying unit is used for when described flow of event storer receives the incident of described adapter transmission, judges that described adapter receives the byte data that described sensing equipment sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, and can send data by serial ports.
5. device according to claim 4 is characterized in that, also comprises:
Second identifying unit;
Audiomonitor listens to after described flow of event storer receives the incident that described adapter sends, and continues described flow of event storer is monitored;
Described second identifying unit is used for judging that described adapter does not receive the byte data that sensing equipment sends again when the new incident that described flow of event in the Preset Time section does not receive that described adapter sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is connected with serial ports, but does not send data by serial ports.
6. device according to claim 4 is characterized in that, also comprises:
The 3rd identifying unit is used for judging that described adapter does not receive the byte data that sensing equipment sends when described audiomonitor does not hear described flow of event storer and receives the incident that described adapter sends; Described sensing equipment with the connection status of serial ports is: described sensing equipment normally is not connected with serial ports.
CN2011102532841A 2011-08-30 2011-08-30 Method and device for determining connection state between serial port and sensing equipment Pending CN102279832A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011102532841A CN102279832A (en) 2011-08-30 2011-08-30 Method and device for determining connection state between serial port and sensing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011102532841A CN102279832A (en) 2011-08-30 2011-08-30 Method and device for determining connection state between serial port and sensing equipment

Publications (1)

Publication Number Publication Date
CN102279832A true CN102279832A (en) 2011-12-14

Family

ID=45105289

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011102532841A Pending CN102279832A (en) 2011-08-30 2011-08-30 Method and device for determining connection state between serial port and sensing equipment

Country Status (1)

Country Link
CN (1) CN102279832A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102594871A (en) * 2011-12-31 2012-07-18 山东中创软件工程股份有限公司 Data packaging method and system, adapter and Internet of things middleware
CN109199383A (en) * 2017-07-06 2019-01-15 新华网股份有限公司 Data processing method, system and skin sensing equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1833243A (en) * 2003-08-06 2006-09-13 水星传感器公司 Universal sensor adapter
TW201022949A (en) * 2008-12-10 2010-06-16 Ind Tech Res Inst System and method for detecting remote serial port apparatus
CN102096620A (en) * 2009-12-11 2011-06-15 华为技术有限公司 Method and device for detecting connection state of serial port, and communication system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1833243A (en) * 2003-08-06 2006-09-13 水星传感器公司 Universal sensor adapter
TW201022949A (en) * 2008-12-10 2010-06-16 Ind Tech Res Inst System and method for detecting remote serial port apparatus
CN102096620A (en) * 2009-12-11 2011-06-15 华为技术有限公司 Method and device for detecting connection state of serial port, and communication system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102594871A (en) * 2011-12-31 2012-07-18 山东中创软件工程股份有限公司 Data packaging method and system, adapter and Internet of things middleware
CN102594871B (en) * 2011-12-31 2016-03-02 山东中创软件工程股份有限公司 A kind of data encapsulation method, system, adapter and Internet of things middleware
CN109199383A (en) * 2017-07-06 2019-01-15 新华网股份有限公司 Data processing method, system and skin sensing equipment

Similar Documents

Publication Publication Date Title
CN105306272B (en) Information system fault scenes formation gathering method and system
CN105045533B (en) Magnetic disk heartbeat receiving/transmission method suitable for dual control high availability storage system
CN103684835B (en) Link fault reporting method and processing method, and transmission node and primary node
CN102064962B (en) Method for implementing input and output assemblies of ATS (Automatic Train Supervision) system based on named pipeline communication
CN107766213A (en) A kind of method and system for realizing NVME hard disk lightings
CN104980293B (en) A kind of OAM message is quickly sent and the method and device of detection processing
CN104076808B (en) The fault diagnosis system and method for industrial control equipment
CN106354685A (en) Implementation method of PSU and ME communication I2C bus hang recovery
CN102970167A (en) Method for detecting faults of network nodes in cluster system, network node and system
CN107729190A (en) A kind of I/O path failure metastasis treating method and system
CN100385255C (en) Double collecting machine system and it double collecting method for double machine hot back-up
CN102768561B (en) Design method for twinbridge piece mainboard redundancy
CN105306352A (en) Industrial field bus protocol gateway device
CN104516839B (en) A kind of built-in applied system
CN102255768A (en) Method and equipment for detecting port
CN102279832A (en) Method and device for determining connection state between serial port and sensing equipment
CN108899997A (en) A kind of distribution network failure monitoring system and its control method based on Internet of Things
CN101686119A (en) Method, device and system of communication between single boards
CN101964731B (en) Method and device for monitoring data link
CN106452696A (en) Control system of server cluster
CN101764698B (en) Automatic recovering method for power equipment
CN103840956A (en) Backup method for gateway device of Internet of Things
CN106446311A (en) CPU alarm circuit and alarm method
CN102801542A (en) Communication-gateway-based communication redundancy fault-tolerant system
CN206117845U (en) Spare signal automatic switch -over circuit of video

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20111214