The content of the invention
Cross-platform data communication means based on QT and system that the present invention is provided, can be by by Ethernet bottom
Data-transformation facility and upper level applications separate independent design, and then make it independent of operating system and hardware environment, reach
The effect of network condition is intactly managed to unified, and then avoids a variety of conflicts of repeated work and network, with fine kobold
Activity, autgmentability and lower coupling.
In a first aspect, the present invention provides a kind of cross-platform data communication means based on QT, including:
Receive the communication data or file transfer data of host computer or slave computer;
Classification processing, priority processing or subpackage is carried out to the communication data or file transfer data to handle and form number
According to bag transmit queue so that communication data or file transfer data can the host computer with different operating system and slave computer it
Between be transmitted;
Queue is sent the packet within to be issued to slave computer or be uploaded to host computer.
Alternatively, it is described that classification processing, priority processing or subpackage are carried out to the communication data or file transmission information
Handling and forming packet transmit queue includes:
Classification processing or subpackage processing are carried out to the communication data or file transfer data;
Call for supporting the correlation function in file, internal memory, order or the network operation dynamic base of transmission/reception and beating
Path;
Call for telnet, acquisition/network address or designated state are provided network communication dynamic base in correlation
Communication data or file transfer data after categorized processing or subpackage processing is simultaneously according to priority put into packet transmission by function
In queue in corresponding queue;
According to priority each queue in algorithm queries packet transmit queue, the data of each queue are sent to purpose
Address.
Alternatively, it is described send the packet within queue and be issued to slave computer or be uploaded to host computer include:
Obtain the specified network communication interface sent of each queue in packet transmit queue;
Each queue is issued to by slave computer according to network communication interface or host computer is uploaded to.
Alternatively, it is described the communication data or file transfer data are carried out classification processing, priority processing or point
Bag is handled and formed after packet transmit queue, and methods described also includes:
Obtain temporal information and temporal information is added into packet transmit queue.
Alternatively, it is described to obtain temporal information and include temporal information addition packet transmit queue:
The communication data and file transfer data are packed into the first packet and sent to history station, by history station
Temporal information is added into the first packet and the second packet is formed, then synchronous second packet of the whole network;
Second packet is added in packet transmit queue.
Alternatively, sending the packet within after queue is uploaded to host computer, methods described also includes:
Dissection process is carried out according to packet transmit queue and corresponding communication data or file transfer data is obtained;
Correspondence message is generated according to corresponding communication data or file transfer data and upper application software is notified.
Alternatively, sending the packet within after queue is uploaded to host computer, methods described also includes:
Receiving network data simultaneously draws data type;
Destination address is sent data to according to data type.
Second aspect, the present invention provides a kind of cross-platform data communication system based on QT, including:
Receiving module, communication data or file transfer data for obtaining host computer or slave computer;
Data communication component, for carrying out classification processing, priority processing to the communication data or file transfer data
Or subpackage handles and forms packet transmit queue, so that communication data or file transfer data can be with different operating systems
Host computer and slave computer between be transmitted;
Network communication components, are issued to slave computer or are uploaded to host computer for sending the packet within queue.
Alternatively, the data communication component includes:
Network operation dynamic base, for supporting file, internal memory, order or transmission/reception;
First call unit, for calling the correlation function in network operation dynamic base and getting through path;
Network communication dynamic base, for providing telnet, acquisition/network address or designated state;
Second call unit, for calling the correlation function in network communication dynamic base and transmitting communication data or file
Data are according to priority put into packet transmit queue in corresponding queue;
Transmitting element, for each queue according to priority algorithm queries packet transmit queue, by each queue
Data are sent to destination address.
Alternatively, the network communication components include:
Acquiring unit, for obtaining the network communication interface sent specified by each queue in packet transmit queue;
Transmission unit, for each queue to be issued into slave computer according to network communication interface or host computer is uploaded to.
Alternatively, the system also includes:
Packet sending module, it is concurrent for the communication data and file transfer data to be packed into the first packet
Deliver to history station;
Synchronization module, for receiving the second packet and synchronous second packet;
Processing module, for the second packet to be added in packet transmit queue.
Alternatively, the system also includes:
Dissection process module, for according to packet transmit queue carry out dissection process and obtain corresponding communication data or
File transfer data;
Notification module, for generating correspondence message according to corresponding communication data or file transfer data and notifying upper strata should
Use software.
Cross-platform data communication means and system provided in an embodiment of the present invention based on QT are mainly upper by receiving
Machine communication data or file transfer data, and by communication data or file transfer data carry out classification processing, priority processing or
Subpackage handles and forms packet transmit queue, makes it independent of the operating system and hardware loop between slave computer and host computer
Border, is also issued to slave computer by communication data or file transfer data and performs respective operations by slave computer, therefore, realizes under
The work such as configuration synchronization, Process flowchart, the file maintenance of position machine.Or, receive the communication data or file transmission number of slave computer
According to being uploaded to after above-mentioned processing in the receiving queue of host computer and the work of real-time condition monitoring realized to slave computer.
Method described in the embodiment of the present invention is mainly used should by the data-transformation facility of Ethernet bottom and upper strata
Independent design is separated with program, and then makes it independent of operating system and hardware environment, reaches that unification intactly manages network
The effect of situation, and then a variety of conflicts of repeated work and network are avoided, with flexibility well, autgmentability and lower coupling
Property.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only
Only it is a part of embodiment of the invention, rather than whole embodiments.Based on the embodiment in the present invention, ordinary skill
The every other embodiment that personnel are obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
The embodiment of the present invention provides a kind of cross-platform data communication means based on QT, as shown in figure 1, methods described bag
Include:
S1, the communication data or file transfer data for receiving host computer or slave computer;
S2, classification processing, priority processing or subpackage processing and shape are carried out to the communication data or file transfer data
Into packet transmit queue, so that communication data or file transfer data can be in the host computers with different operating system and bottom
It is transmitted between machine;
S3, send the packet within queue and be issued to slave computer or be uploaded to host computer.
The embodiment of the present invention provides the cross-platform data communication means based on QT, wherein, QT:Cross-platform C++ graphical users
Interface application;
It is cross-platform:Independent of operating system and hardware environment, the application developed under an operating system is put into another
Still can normally it be run under operating system environment;
History station:It is long-term to retain the server of historical data, and have the function of directly sending manipulation order concurrently;
Host computer:Refer to directly send the computer of manipulation order;
Slave computer:Direct control device obtains the computer of status of equipment.
The present embodiment methods described is mainly by receiving host computer communication data or file transfer data, and by the number that communicates
According to or file transfer data carry out classification processing, priority processing or subpackage and handle and form packet transmit queue, make it not
Dependent on the operating system and hardware environment between slave computer and host computer, also communication data or file transfer data are issued to
Slave computer simultaneously performs respective operations by slave computer, therefore, realizes to configuration synchronization, Process flowchart, file maintenance of slave computer etc.
Work.
Or, the communication data or file transfer data of slave computer are received, and communication data or file transfer data are entered
Row classification processing, priority processing or subpackage handle and form packet transmit queue, so that communication data or file transmission number
Split, be then uploaded in the receiving queue of host computer according to according to data format, priority and data transfer load, and
After host computer alignment processing, upper application software is notified with message mode;Wherein, the communication data or file transfer data
For all communication datas and file transfer data needed for upper application software, and then real-time condition monitoring is realized to slave computer
Work.
Method described in the present embodiment is mainly used the data-transformation facility of Ethernet bottom and upper layer application journey
Sequence separates independent design, and then makes it independent of operating system and hardware environment, reaches that unification intactly manages network condition
Effect, and then a variety of conflicts of repeated work and network are avoided, with flexibility well, autgmentability and lower coupling.
Alternatively, as in Figure 2-4, it is described classification processing is carried out to the communication data or file transmission information, it is preferential
Level processing or subpackage, which handle and form packet transmit queue, to be included:
Classification processing or subpackage processing are carried out to the communication data or file transfer data;
Call for supporting the correlation function in file, internal memory, order or the network operation dynamic base of transmission/reception and beating
Path;
Call for telnet, acquisition/network address or designated state are provided network communication dynamic base in correlation
Communication data or file transfer data after categorized processing or subpackage processing is simultaneously according to priority put into packet transmission by function
In queue in corresponding queue;
According to priority each queue in algorithm queries packet transmit queue, the data of each queue are sent to purpose
Address.
Specifically, host computer described in the present embodiment classification processing is carried out to the communication data or file transmission information, it is excellent
The processing of first level or subpackage handles and formed in packet transmit queue first when having communication data or file to transmit in application program
When information is sent to destination address, then communication data or file transmission information are carried out at classification according to type, the size of data
Reason or subpackage processing;For example, when the data volume of the file transmission information is more than a setting value, then by the file transmission information
It is divided at least two less packets, and then improves the efficiency of the cross-platform data communication.Then the network is called
Operate the correlation function in dynamic base and get through path;Call correlation function in the network communication dynamic base and will be categorized
Communication data or file transfer data after processing or subpackage processing are according to priority put into corresponding team in packet transmit queue
In row;Finally each queue according to priority in algorithm queries packet transmit queue, the data of each queue are sent to mesh
Address.Wherein, the packet transmit queue is according to priority followed successively by from high to low:Instant transmit queue, order sends team
Arrange, fast memory queue, middling speed memory queue, at a slow speed memory queue and document queue, wherein, it may include in each queue multiple
Packet or file, and then make on the efficiency basis for improve data communication there is provided one kind in stand-alone application interprogram communication
With and the data communications method that uses of different machines inter-application communication.
Wherein, the subpackage processing includes:
Whether the size of packet is judged more than a setting value, if it is, performing next step;If it is not, then carrying out excellent
First level processing;
The network load of Ethernet is detected, judges whether the network load of the Ethernet exceedes threshold value, if it is, performing
Next step;If it is not, then carrying out priority processing;
Subpackage quantity is determined according to the network load of the size Ethernet of packet, and presses the subpackage quantity by packet
Carry out subpackage.And then the effective load monitoring realized to Ethernet, it is ensured that the data communication efficiency.Wherein, the present embodiment
Described in method Ethernet network load not more than 20%, it is preferred that the network load of the Ethernet is less than
10%.
Communication data described in the present embodiment includes state data packets, real time data table packet, historical data number between station
According to bag, order bag, request bag etc. network transmission in need packet;File transmission information includes configuration file, configuration text
Part, Log files etc. network transmission in need and synchronization file data.The data communications method by above-mentioned internal storage data,
The multiple types of data such as real time data, order data, operational order, file data, status data, response data bag is by above-mentioned
Classification processing, the packet transmit queue that is formed after priority processing or subpackage processing, Windows operating system or in
Transmitted between the host computer and slave computer of mark kylin operating system or between host computer and host computer by the above method,
Avoid Windows operating system or get the bid kylin operating system host computer and slave computer between or host computer with it is upper
The incompatibility of data between the machine of position, the problem of can not transmit mutually, and then improve the data communications method flexibility,
Autgmentability and lower coupling.
In summary, method described in the present embodiment first by communication data or file transfer data carry out classification processing or
Corresponding packet is formed after subpackage processing, then by carrying out priority processing formation packet transmit queue to packet,
And then the two priority classes to packet transmit queue are realized according to the priority algorithm, so that different priority data bags
Principle is first sent according to high priority to be handled, it is ensured that significant data is preferentially sent, and then improve treatment effeciency during transmission.
Alternatively, it is described send the packet within queue and be issued to slave computer or be uploaded to host computer include:
Obtain the specified network communication interface sent of each queue in packet transmit queue;
Each queue is issued to by slave computer according to network communication interface or host computer is uploaded to.
Specifically, the present embodiment methods described by each queue according to network communication interface when being issued to slave computer, institute
State the packet that slave computer sent the packet within queue and receive reception data queue, and the data in data queue will be received
Bag correspondence carries out dissection process, extracts corresponding order and performs, for example, methods described can pass through Process flowchart order Bao Fang
Formula, the process to slave computer carries out the startup of band parameter, start by set date, the manipulation such as timing stops, monitoring;Or, methods described is also
Other slave computers can be carried out to start online, start by set date is online, and timing stopping is online etc. by website control command packet mode
Manipulation;Also or, methods described can also realize communication between points, including one-to-one or one-to-many point-to- point communication,
The communication between points includes TCP transmission mode and disconnected UDP transmission means.TCP modes are used for long data block
Duplication and synchronization, UDP be used for low volume data transmission.For example, periodic data UDP transmission means, the data of event
Use TCP transmission mode.
Or, when it is described send the packet within queue and be issued to slave computer when, the host computer can not be directly issued to down
During the machine of position, then slave computer is forwarded to by remote controllers, wherein, the host computer is sent to remote controllers, then by remote
Corresponding data transmit queue is issued to correspondence slave computer by range controller.
Meanwhile, it is used in the present embodiment under different operating system platform (Windows or acceptance of the bid kylin), host computer is with
Network service when each application program is with transmission data between position machine or host computer and host computer or slave computer and slave computer connects
Mouthful, including:Process between notification interface, different computers is sent on same computer between process and notifies transmission interface, file
Transmission interface, internal memory synchronized transmission interface, transmission peration data interface;For example, being sent when to the specified process in specified machine
Notify, send and notify that pack arrangement is as shown in Figure 3.
The interface of other applications is supplied in the present embodiment methods described to be included:Message, internal memory and dynamic base, due to
The present embodiment methods described is operated under different operating system (Windows or acceptance of the bid kylin), but two kinds of different operation systems
Unite different to the definition of message, so the present embodiment uses QT local Socket technologies encapsulation messages mechanism, realize between process
Message communicating, its external interface form use class Windows message mode.
Alternatively, it is described the communication data or file transfer data are carried out classification processing, priority processing or point
Bag is handled and formed after packet transmit queue, and methods described also includes:
Obtain temporal information and temporal information is added into packet transmit queue.
Specifically, the present embodiment methods described is by the way that temporal information is added in packet transmit queue to reach number during school
According to function, wherein, mainly the whole network is sent to by the history station cycle, other passive receiving time information data simultaneously change itself
Clock be consistent with history station.
Alternatively, it is described to obtain temporal information and include temporal information addition packet transmit queue:
The communication data and file transfer data are packed into the first packet and sent to history station, by history station
Temporal information is added into the first packet and the second packet is formed, then synchronous second packet of the whole network;
Second packet is added in packet transmit queue.
Specifically, temporal information is mainly added packet transmit queue by the present embodiment methods described so that the number
When can realize school according to bag transmit queue, for example, as shown in figure 4, after the slave computer is operated by performing one, being formed corresponding
Processing data is operated, the data are packed into the first packet of no temporal information, and pass through packet sending module
First packet is sent to main history station, and/or from history station, when then being added via main history station in the first packet
Between information and form the second packet with temporal information, and will from history station and slave computer synchronous second packet simultaneously,
It is last that the second packet is added in packet transmit queue by slave computer and host computer is uploaded to, and then behaviour is realized to host computer
Feed back.
Wherein, methods described also can recognize that type of data packet, and be put packet to input interface according to Packet type determination
Queue or output interface queue, also, the packet includes analog data bag, digital quantity operation queue;Analog quantity bag class
Type is one kind, and digital quantity operation queue includes picture digital quantity and operates Packet type and non-picture digital quantity operation Packet type, non-picture
Face digital quantity operation Packet type is manually to put several digital quantity points.Screen operation bag needs DO clearings to handle, and non-screen operation bag can not
Reset.Also, above two packet is as the PC write-ins where operator, but the time tag with temporal information is gone through by master
Write during the packing data of history station,
Alternatively, sending the packet within after queue is uploaded to host computer, methods described also includes:
Dissection process is carried out according to packet transmit queue and corresponding communication data or file transfer data is obtained;
Correspondence message is generated according to corresponding communication data or file transfer data and upper application software is notified.
Alternatively, sending the packet within after queue is uploaded to host computer, methods described also includes:
Receiving network data simultaneously draws data type;
Destination address is sent data to according to data type.
Specifically, method described in the present embodiment is after packet transmit queue is uploaded to host computer or remote control
Also include receiving network data after device transmission packet transmit queue to host computer and judge the type of the network data, such as
Fruit is AO, the data such as DO, then network data is put into interface input queue;If order, notifies destination application at once;
If the internal storage data to application program, then reception memory queue is placed data into, and notify upper level applications at once
Reception processing.
The embodiment of the present invention also provides a kind of cross-platform data communication system based on QT, as shown in figure 5, the system bag
Include:
Receiving module, communication data or file transfer data for obtaining host computer or slave computer;
Data communication component, for carrying out classification processing, priority processing to the communication data or file transfer data
Or subpackage handles and forms packet transmit queue, so that communication data or file transfer data can be with different operating systems
Host computer and slave computer between be transmitted;
Network communication components, are issued to slave computer or are uploaded to host computer for sending the packet within queue.
Cross-platform data communication system provided in an embodiment of the present invention based on QT is mainly received by receiving module
Position machine communication data or file transfer data, and communication data or file transfer data are subjected to classification by data communication component
Reason, priority processing or subpackage handle and form packet transmit queue, make it independent of between slave computer and host computer
Operating system and hardware environment, finally by network communication components by communication data or file transfer data be issued to slave computer and by
Slave computer performs respective operations, therefore, realizes to work such as configuration synchronization, Process flowchart, the file maintenances of slave computer.
Or, the communication data or file transfer data of slave computer are received, and communication data or file transfer data are entered
Row classification processing, priority processing or subpackage handle and form packet transmit queue, so that communication data or file transmission number
Split, be then uploaded in the receiving queue of host computer according to according to data format, priority and data transfer load, and
After host computer alignment processing, upper application software is notified with message mode;Wherein, the communication data or file transfer data
For all communication datas and file transfer data needed for upper application software, and then real-time condition monitoring is realized to slave computer
Work.
System described in the present embodiment is mainly used the data-transformation facility of Ethernet bottom and upper layer application journey
Sequence separates independent design, and then makes it independent of operating system and hardware environment, reaches that unification intactly manages network condition
Effect, and then a variety of conflicts of repeated work and network are avoided, with flexibility well, autgmentability and lower coupling.
Alternatively, as shown in fig. 6, the data communication component includes:
Network operation dynamic base, for supporting file, internal memory, order or transmission/reception;
First call unit, for calling the correlation function in network operation dynamic base and getting through path;
Network communication dynamic base, for providing telnet, acquisition/network address or designated state;
Second call unit, for calling the correlation function in network communication dynamic base and transmitting communication data or file
Data are according to priority put into packet transmit queue in corresponding queue;
Transmitting element, for each queue according to priority algorithm queries packet transmit queue, by each queue
Data are sent to destination address.
Alternatively, the network communication components include:
Acquiring unit, for obtaining the network communication interface sent specified by each queue in packet transmit queue;
Transmission unit, for each queue to be issued into slave computer according to network communication interface or host computer is uploaded to.
Alternatively, the system also includes:
Packet sending module, it is concurrent for the communication data and file transfer data to be packed into the first packet
Deliver to history station;
Synchronization module, for receiving the second packet and synchronous second packet;
Processing module, for the second packet to be added in packet transmit queue.
Alternatively, the system also includes:
Dissection process module, for according to packet transmit queue carry out dissection process and obtain corresponding communication data or
File transfer data;
Notification module, for generating correspondence message according to corresponding communication data or file transfer data and notifying upper strata should
Use software.
The system of the present embodiment, can be used for the technical scheme for performing above method embodiment, its realization principle and technology
Effect is similar, and here is omitted.
One of ordinary skill in the art will appreciate that realize all or part of flow in above-described embodiment method, being can be with
The hardware of correlation is instructed to complete by computer program, described program can be stored in a computer read/write memory medium
In, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, described storage medium can be magnetic
Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access
Memory, RAM) etc..
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any
Those familiar with the art the invention discloses technical scope in, the change or replacement that can be readily occurred in, all should
It is included within the scope of the present invention.Therefore, protection scope of the present invention should be defined by scope of the claims.