CN103795720A - Software framework implementing method supporting multi-interface protocol processing - Google Patents

Software framework implementing method supporting multi-interface protocol processing Download PDF

Info

Publication number
CN103795720A
CN103795720A CN201410035680.0A CN201410035680A CN103795720A CN 103795720 A CN103795720 A CN 103795720A CN 201410035680 A CN201410035680 A CN 201410035680A CN 103795720 A CN103795720 A CN 103795720A
Authority
CN
China
Prior art keywords
message
processing
data
implementation method
port
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
CN201410035680.0A
Other languages
Chinese (zh)
Inventor
郑燕红
张进
张庆义
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Simulation Center
Original Assignee
Beijing Simulation Center
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 Beijing Simulation Center filed Critical Beijing Simulation Center
Priority to CN201410035680.0A priority Critical patent/CN103795720A/en
Publication of CN103795720A publication Critical patent/CN103795720A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention relates to a software framework implementing method supporting multi-interface protocol processing. The software framework implementing method supporting multi-interface protocol processing comprises the following steps that (1) port object classes are built for various communication ports, a message queue is generated, and message daemon threads are started; (2) monitoring is carried out on all the started message daemon threads, and processing of the message queue and data/protocol dictionary analysis are carried out; (3) the types of the ports are set, and message building and message sending are carried out. The software framework implementing method supporting multi-interface protocol processing has the advantages that the multi-interface design is simpler, the program structure is clearer, function calling is more convenient, code implementation is more efficient, and the software framework implementing method has good extendibility.

Description

A kind of software frame implementation method of supporting the processing of many interface protocols
Technical field
The present invention relates to a kind of communication interface standard implementation method, particularly relate to a kind of software frame implementation method of supporting the processing of many interface protocols.
Background technology
Along with large-scale application and the development of network, communication and computer system, various means of communications and transmission mode constantly increase, wherein serial communication because protocol transparent, equipment investment are few, the plurality of advantages such as simple of programming is widely used, and accounts for critical role at data acquisition, supervision, communication and control field; Network communication develops on an unprecedented scale especially, extensive use, and ICP/IP protocol becomes internet communication de facto standards, and the equipment of following ICP/IP protocol can facilitate instant accessing Internet to communicate; In a large-scale application system, often use multiple communication modes to carry out data communication and control, as serial communication, parallel port communication, network communication etc., different communication apparatus uses different interface protocols, designer need to carry out different Interface design for different communication modes, although interface difference, but the processing method to information is roughly the same, the interactive relation of how supporting, controlling well between agreement is also supported expansion etc. easily, has increased difficulty to system.
Summary of the invention
Provide a kind of software frame implementation method of communicating by letter with TCP/IP network interface based on RS422 serial ports herein, the method is communicated by letter RS422 serial ports to be designed for uniformity with TCP/IP network interface, comprise Cushioning Design, interrupt handling process, message queue processed, abnormal information processing etc., set up port initialization, daemon thread receives, information sends three entrance functions, designer only need to call simple three interface functions, just can complete reception and transmission to communication interface data, and need not be concerned about processing method and the implementation method that it is concrete, information data is separated with equipment interface, reduce technical difficulty, improve operating efficiency.This framework is with good expansibility, and has increased K jaws equipment entrance, is carrying out interface checking.
Object of the present invention is achieved through the following technical solutions:
A software frame implementation method of supporting the processing of many interface protocols, this implementation method comprises the steps:
1) various communication port are set up to port object (po) class, generating messages queue, and initiation message daemon thread;
2) the message daemon thread of all startups is monitored, and carried out message queue processing and the parsing of data/agreement dictionary;
3) port type is set, and carries out message foundation and message transmission.
The port object (po) class of setting up in described step 1 comprises and sets up serial ports or network interface class, the line parameter setting of going forward side by side.
Generating messages queue in described step 1 is to set up different lists according to different port types.
Initiation message daemon thread in described step 1 refers to according to port number and starts corresponding message daemon thread.
Message queue processing in described step 2 is to list by different port types the message of receiving in different message queue, and adopts stacking-type buffering area, and a read pointer and a write pointer are set, and reading and writing of data carried out in buffering area.
It is to set up on the basis of data/agreement dictionary according to User Agreement that data/agreement dictionary in described step 2 is resolved, and information header is analyzed, and correctly resolves the processing of partial data complete paired data.
The invention has the advantages that:
The present invention designs on the basis of the serial ports that provides at VC and network interface API, the present invention has adopted the software frame that a kind of RS422 of support serial ports is communicated by letter with TCP/IP network interface unlike the prior art, and form C++ dynamic link library, designer only need to call the several functions in header file, and complete the setting to key parameter, just can easily realize the communication to RS422 serial ports and TCP/IP network interface.Its advantage is simpler to the design of many interfaces, and program structure is more clear, and function call is more convenient, and code is realized more efficient, and this framework is with good expansibility simultaneously.
Accompanying drawing explanation
Fig. 1: software frame implementation method flow chart of the present invention.
Embodiment
Figure 1 shows that software frame composition schematic diagram of the present invention, a kind of software frame implementation method of supporting the processing of many interface protocols, its software frame is realized by CreatePort module 1, ReceiveData module 2, SendData module 3.This implementation method comprises the steps:
1) CreatePort module 1 is set up port object (po) class to various communication port, generating messages queue, and initiation message daemon thread;
2) ReceiveData module 2 is monitored the message daemon thread of all startups, and carries out message queue processing and the parsing of data/agreement dictionary;
3) SendData module 3 arranges port type, and carries out message foundation and message transmission.
Below each step is introduced in detail.
CreatePort module 1 comprises sets up port object (po) class, generating messages queue, three steps of initiation message daemon thread, wherein setting up port object (po) class is to set up different port object class according to different port, if serial ports, set up universal serial port class CreateSerialPort (), and this serial ports is carried out to parameter setting, comprise port type, port numbers, baud rate, parity check, data bit number, data position of rest, the parameters such as buffer size, if network interface, set up network interface class CreateSockPort (), and this network interface is carried out to parameter setting, comprise transport-type (TCP, UDP, MCP), port numbers, the parameters such as IP address, generating messages queue is to set up different lists according to different port types, and the list of serial ports class is unified is m_SerialPortList, and the list of network interface class is unified is m_SockPortList, initiation message daemon thread is not carry out port classification, has how many ports just to start the message daemon thread of how many.Wherein, header file .h is as follows with the simplified code of realizing file .cpp:
CSocketPort* m_pSocketPort; // network interface class object pointer
CSerialPort* m_pSerialPort; // serial ports class object pointer
CSocketCallback m_SocketCallBack; // network interface class daemon thread
CSerialCallback m_SerialCallBack; // serial ports class daemon thread
M_pSocketPort=CreateSockPort (); // initialization network interface class parameter
M_pSerialPort=CreateSerialPort (); // initialization serial ports class parameter
ReceiveData module 2 comprises daemon thread monitoring, message queue processing, three steps of data/agreement dictionary parsing, and wherein daemon thread monitoring is that the message daemon thread of all startups is monitored, and triggers the request of reception while having message; Message queue processing is to list by different port types the message of receiving in different message queue, and adopts stacking-type buffering area, and a read pointer and a write pointer are set, and reading and writing of data carried out in buffering area; It is to set up on the basis of data/agreement dictionary according to User Agreement that data/agreement dictionary is resolved, and information header is analyzed, and correctly resolves the processing of partial data complete paired data.Wherein, the simplified code of file .cpp is as follows:
Case TCPTIMER: // network data obtained
m_pSocketPort->tick();
break;
Case SERIALTIMER: // serial data obtained
m_pSerialPort->m_pSerialPort.ReceiveChar();
break;
SendData module 3 is to comprise that port type setting, message are set up, message sends three steps, and wherein port type setting is, according to different ports, different type codes is set; It is to form correct message according to user data/agreement dictionary that message is set up; It is according to different ports that message sends, and sends message in time to serial ports and the network port.Wherein, the simplified code of file .cpp is as follows:
Case TCPTIMER: // data sent to network
m_pSocketPort->SendMsg(SendBuff,Temp.m_length);
break;
Case SERIALTIMER: // data sent to serial ports
m_pSerialPort->SendMsg("HelloP",strlen("HelloP"));
break;
The enforcement of this method, can make designer concentrate one's energy to pay close attention to problem or the interested research direction of system itself, reducing designer's energy in underlying basis problem drops into, greatly shorten the design cycle, improve design efficiency, there is good versatility, can effectively avoid the duplication of labour, improve the correctness of analogue system, reduce human resources, increase economic efficiency.
Should be appreciated that the above detailed description of technical scheme of the present invention being carried out by preferred embodiment is illustrative and not restrictive.Those of ordinary skill in the art modifies reading the technical scheme that can record each embodiment on the basis of specification of the present invention, or part technical characterictic is wherein equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution depart from the spirit and scope of various embodiments of the present invention technical scheme.

Claims (6)

1. a software frame implementation method of supporting the processing of many interface protocols, is characterized in that, this implementation method comprises the steps:
1) various communication port are set up to port object (po) class, generating messages queue, and initiation message daemon thread;
2) the message daemon thread of all startups is monitored, and carried out message queue processing and the parsing of data/agreement dictionary;
3) port type is set, and carries out message foundation and message transmission.
2. a kind of software frame implementation method of supporting the processing of many interface protocols according to claim 1, is characterized in that, the port object (po) class of setting up in described step 1 comprises and sets up serial ports or network interface class, the line parameter setting of going forward side by side.
3. a kind of software frame implementation method of supporting the processing of many interface protocols according to claim 1 and 2, is characterized in that, the generating messages queue in described step 1 is to set up different lists according to different port types.
4. a kind of software frame implementation method of supporting the processing of many interface protocols according to claim 3, is characterized in that, the initiation message daemon thread in described step 1 refers to according to port number and starts corresponding message daemon thread.
5. a kind of software frame implementation method of supporting the processing of many interface protocols according to claim 1, it is characterized in that, message queue processing in described step 2 is to list by different port types the message of receiving in different message queue, and adopt stacking-type buffering area, a read pointer and a write pointer are set, reading and writing of data carried out in buffering area.
6. a kind of software frame implementation method of supporting the processing of many interface protocols according to claim 1, it is characterized in that, it is to set up on the basis of data/agreement dictionary according to User Agreement that data/agreement dictionary in described step 2 is resolved, information header is analyzed, correctly resolved the processing of partial data complete paired data.
CN201410035680.0A 2014-01-24 2014-01-24 Software framework implementing method supporting multi-interface protocol processing Pending CN103795720A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410035680.0A CN103795720A (en) 2014-01-24 2014-01-24 Software framework implementing method supporting multi-interface protocol processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410035680.0A CN103795720A (en) 2014-01-24 2014-01-24 Software framework implementing method supporting multi-interface protocol processing

Publications (1)

Publication Number Publication Date
CN103795720A true CN103795720A (en) 2014-05-14

Family

ID=50671006

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410035680.0A Pending CN103795720A (en) 2014-01-24 2014-01-24 Software framework implementing method supporting multi-interface protocol processing

Country Status (1)

Country Link
CN (1) CN103795720A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110928608A (en) * 2019-12-30 2020-03-27 上海御渡半导体科技有限公司 Extensible communication framework supporting multiple communication protocols and communication method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090086732A1 (en) * 1997-10-14 2009-04-02 Boucher Laurence B Obtaining a destination address so that a network interface device can write network data without headers directly into host memory
CN101799751A (en) * 2009-12-02 2010-08-11 山东浪潮齐鲁软件产业股份有限公司 Method for building monitoring agent software of host machine
CN102710025A (en) * 2012-06-14 2012-10-03 深圳市华力特电气股份有限公司 Power system communication device and method
CN103139157A (en) * 2011-11-28 2013-06-05 北京南车时代信息技术有限公司 Network communication method based on socket, device and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090086732A1 (en) * 1997-10-14 2009-04-02 Boucher Laurence B Obtaining a destination address so that a network interface device can write network data without headers directly into host memory
CN101799751A (en) * 2009-12-02 2010-08-11 山东浪潮齐鲁软件产业股份有限公司 Method for building monitoring agent software of host machine
CN103139157A (en) * 2011-11-28 2013-06-05 北京南车时代信息技术有限公司 Network communication method based on socket, device and system
CN102710025A (en) * 2012-06-14 2012-10-03 深圳市华力特电气股份有限公司 Power system communication device and method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
杨恒飞等: "《交换机/路由器的管理与配置》", 31 October 2012 *
赵玮: "基于Socket的消息队列中间件的研究与实现", 《中国优秀博硕士学位论文全文数据库》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110928608A (en) * 2019-12-30 2020-03-27 上海御渡半导体科技有限公司 Extensible communication framework supporting multiple communication protocols and communication method
CN110928608B (en) * 2019-12-30 2024-03-22 上海御渡半导体科技有限公司 Extensible communication framework supporting multiple communication protocols and communication method

Similar Documents

Publication Publication Date Title
CN107147657B (en) Coding and decoding method and communication equipment suitable for multi-machine reliable communication
CN102413150B (en) Server and virtual desktop control method and virtual desktop control system
CN111656336B (en) PCIE sending and receiving method, device, equipment and system
CN103825696A (en) Device for realizing high-speed real-time communication by optical fibers based on FPGA (Field Programmable Gate Array)
CN101964763A (en) Message handling method
CN102932327A (en) Method and system for communicating zero-terminal equipment and desktop virtual machine
CN108304335A (en) A method of the indefinite long message of serial ports is received by DMA
CN103780674B (en) A kind of virtual machine communication method and device based on hardware simulation
CN114124916A (en) Data transmission method and device, electronic equipment and storage medium
CN104580187A (en) Method for achieving interaction of external devices of different MODULEBUS protocols and server
CN113676386B (en) FC-AE-1553 bus protocol message communication system
CN103795720A (en) Software framework implementing method supporting multi-interface protocol processing
CN104113510A (en) Virtual desktop system and message data transmitting method thereof
CN103248679A (en) Network message passing method
CN103916413A (en) Control method and device for heterogeneous minicomputers, and cloud computing system
CN108289165B (en) Method and device for realizing camera control based on mobile phone and terminal equipment
CN113094762B (en) Data processing method and device and signature verification server
CN110266705B (en) Control method and system
CN113612668A (en) Communication method for bridging three protocols
CN113138732A (en) Multi-display controller system, access control system, and display controller
CN107896234B (en) Method for transmitting message in Modbus communication network, Modbus communication network system and Modbus communication network equipment
CN104796228B (en) A kind of method, apparatus and system of information transmission
CN113595842B (en) FC-AE-1553 protocol message communication processing system
CN105323160B (en) Message receiving and sending method and device, channel unit and communication equipment
CN203135914U (en) Gateway device based on Web

Legal Events

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

Application publication date: 20140514

RJ01 Rejection of invention patent application after publication