CN117873942A - Communication method based on HMI device, HMI device and storage medium - Google Patents

Communication method based on HMI device, HMI device and storage medium Download PDF

Info

Publication number
CN117873942A
CN117873942A CN202311865532.7A CN202311865532A CN117873942A CN 117873942 A CN117873942 A CN 117873942A CN 202311865532 A CN202311865532 A CN 202311865532A CN 117873942 A CN117873942 A CN 117873942A
Authority
CN
China
Prior art keywords
protocol
interface
target
communication
calling
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
CN202311865532.7A
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.)
Shenzhen Xhorse Electronics Co Ltd
Original Assignee
Shenzhen Xhorse Electronics 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 Shenzhen Xhorse Electronics Co Ltd filed Critical Shenzhen Xhorse Electronics Co Ltd
Priority to CN202311865532.7A priority Critical patent/CN117873942A/en
Publication of CN117873942A publication Critical patent/CN117873942A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Communication Control (AREA)

Abstract

The application relates to a communication method based on an HMI device, the HMI device and a storage medium. The method comprises the following steps: calling a protocol address information acquisition interface to acquire a target operation address under a target communication protocol selected from the upper computer; calling a parameter acquisition interface to acquire the current operation parameters of the target communication protocol; calling a parameter setting interface to modify the current operation parameter into a target operation parameter required by an instruction data frame corresponding to target operation; and calling a protocol sending data packaging interface, generating the instruction data frame based on the target operation address and the target operation parameter, and sending the instruction data frame to external equipment, wherein the instruction data frame is used for indicating the external equipment to execute the target operation. By adopting the method, the code execution efficiency can be improved, the compatibility of the application code is improved, and the maintainability of the code is greatly improved.

Description

Communication method based on HMI device, HMI device and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a communication method based on an HMI device, and a storage medium.
Background
HMI (Human Machine Interface ) devices need to communicate with external devices of many different protocols. The conventional software structure integrates all application functions into one application, so that application codes are very bulky and are extremely difficult to maintain, and the code execution efficiency is reduced, thereby affecting the interface display of the HMI device.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an HMI device-based communication method, an HMI device, and a storage medium capable of improving code execution efficiency.
A communication method based on an HMI device, applied to the HMI device, the method comprising:
calling a protocol address information acquisition interface to acquire a target operation address under a target communication protocol selected from the upper computer;
calling a parameter acquisition interface to acquire the current operation parameters of the target communication protocol;
calling a parameter setting interface to modify the current operation parameter into a target operation parameter required by an instruction data frame corresponding to target operation;
and calling a protocol sending data packaging interface, generating the instruction data frame based on the target operation address and the target operation parameter, and sending the instruction data frame to external equipment, wherein the instruction data frame is used for indicating the external equipment to execute the target operation.
An HMI device for performing the steps of various HMI device-based communication method embodiments.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the respective HMI device based communication method embodiments.
According to the communication method based on the HMI equipment, the HMI equipment and the storage medium, one HMI equipment is usually required to be simultaneously adaptive to hundreds of communication protocols, the processing modes of each communication protocol are different, and a large number of codes are required to be deployed if the hundreds of communication protocols are required to be adaptive; according to the method and the device, the common part of hundreds of communication protocols is extracted, namely, the communication processes of the hundreds of communication protocols can be realized by sequentially calling a protocol address information acquisition interface, a parameter setting interface and a protocol sending data packaging interface to execute corresponding interface operation, the same calling interface is provided for different external equipment communication protocols, the processing logic and the code quantity of application codes can be greatly reduced, the code execution efficiency is improved, and the interface display speed of the HMI equipment is accelerated.
Drawings
FIG. 1 is an application environment diagram of an HMI device-based communication method in one embodiment;
FIG. 2 is a flow diagram of a communication method based on an HMI device in one embodiment;
FIG. 3 is a flow chart of a communication method based on an HMI device in another embodiment;
FIG. 4 is an internal block diagram of an HMI device in one embodiment.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without undue burden, are within the scope of the present application.
It should be noted that all directional indicators (such as up, down, left, right, front, and rear … …) in the embodiments of the present application are merely used to explain the relative positional relationship, movement conditions, etc. between the components in a specific posture (as shown in the drawings), if the specific posture is changed, the directional indicators correspondingly change, and the connection may be a direct connection or an indirect connection.
It is to be understood that in the following embodiments, "connected" is understood to mean "electrically connected", "communicatively connected", etc., if the connected circuits, modules, units, etc., have electrical or data transfer between them.
The communication method based on the HMI device can be applied to the application environment shown in figure 1. FIG. 1 is an application environment diagram of an HMI device-based communication method in one embodiment. Fig. 1 includes a host computer 110, an HMI device 120, and an external device 130 connected to each other. And the host computer 110 is wired to the HMI device 120, and the HMI device 120 is wired to the external device 130. The host computer 110 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. And the upper computer 110 stores dynamic libraries corresponding to hundreds of communication protocols. One communication protocol corresponds to one dynamic library and one communication protocol corresponds to several operation addresses. The external device 130 may be a PLC (Programmable Logic Controller ) or the like. The method in each embodiment of the present application will be described by taking an application to an HMI device as an example.
In one embodiment, as shown in fig. 2, the communication method based on the HMI device in one embodiment is applied to the HMI device, and includes the following steps:
step 202, calling a protocol address information acquisition interface to acquire a target operation address under a target communication protocol selected from the upper computer.
The protocol address information acquisition interface refers to a getdeviceinfo interface. The target communication protocol refers to a communication protocol supported by an external device connected to the HMI device. And a plurality of operation addresses are corresponding to the communication protocol. The operation address is an operation address of the external device. The target operation address is the operation address to be operated selected by the user.
Specifically, after knowing the target communication protocol adopted by the external device, the HMI device may acquire a protocol file corresponding to the target communication protocol from the upper computer, load the protocol file, and call an interface. The protocol address information acquisition interface, the parameter setting interface and the protocol sending data packaging interface are all interfaces supported by the protocol file. The upper computer can display the operation address under the target communication protocol, and the user selects the operation address under the target communication protocol to obtain the target operation address.
Step 204, a parameter acquisition interface is invoked to acquire the current operating parameters of the target communication protocol.
The parameter acquisition interface is a getCommParam interface. For example, the current operating parameter may be a write parameter, a read parameter, or a wait parameter, etc. The write parameters include a single write parameter, a block write parameter, a full write parameter, and the like. The current operating parameter of the target communication protocol is indicative of the current state of the target communication protocol.
Specifically, the HMI device invokes a parameter acquisition interface to acquire a current operating parameter of the target communication protocol from a protocol file corresponding to the target communication protocol.
Step 206, calling a parameter setting interface to modify the current operation parameter into the target operation parameter required by the instruction data frame corresponding to the target operation.
The parameter setting interface refers to a setCommParam interface. The target operation refers to an operation that ultimately instructs the external device to perform. The target operation parameter is the operation parameter corresponding to the target operation and accords with the parameter of the instruction data frame format. The instruction data frame is a data frame to be transmitted to the external device for indicating completion of the target operation.
Specifically, the HMI device invokes a parameter set interface to modify the current operating parameter to a target operating parameter required for the command data frame corresponding to the target operation. For example, the current operating parameter is a read parameter, and the HMI device modifies the read parameter to a write operation parameter corresponding to the write operation. The parameter acquisition interface is called to acquire the current operation parameters of the target communication protocol and then modify the parameters, so that a user can acquire the current state of the protocol, modify the parameters based on the current state, and improve the accuracy of controlling the external equipment by the HMI equipment.
Step 208, calling a protocol sending data packaging interface, generating an instruction data frame based on the target operation address and the target operation parameter, and sending the instruction data frame to the external device, wherein the instruction data frame is used for indicating the external device to execute the target operation.
The protocol sending data package interface refers to a DeviceDataOutput interface.
Specifically, the HMI device invokes a protocol send data packaging interface, packages the target operation address and the target operation parameter according to an outgoing data structure adapted by a plurality of external devices to generate an instruction data frame, and sends the instruction data frame to the external devices. And when the external equipment receives the instruction data frame, analyzing the instruction data frame and executing the target operation. For example, if the target operation is writing the content X at the address a, the target operation parameter includes the write parameter, the written content X, the target operation address is the address a, and the instruction data frame includes the write parameter, the written content and the address a. When the external device receives the instruction data frame, the instruction data frame is parsed, and the operation of writing the content X at the address A is executed.
In this embodiment, an HMI device is usually required to adapt to hundreds of communication protocols at the same time, and the processing manner of each communication protocol is different, and if the HMI device is required to adapt to the hundreds of communication protocols, a large amount of code needs to be deployed. According to the method and the device, common parts of hundreds of communication protocols are extracted, namely communication processes of the hundreds of communication protocols can be realized by sequentially calling a protocol address information acquisition interface, a parameter setting interface and a protocol sending data packaging interface to execute corresponding interface operations, the same calling interfaces are provided for different external equipment communication protocols, processing logic and code quantity of application codes can be greatly reduced, code execution efficiency is improved, interface display speed of HMI equipment is accelerated, and application code compatibility is improved.
In one embodiment, a dynamic library of each of the plurality of communication protocols is stored in the host computer; storing corresponding protocol files in a dynamic library of each communication protocol;
the communication method based on the HMI device further comprises the following steps:
acquiring a target protocol file of a target communication protocol from an upper computer;
and loading the target protocol file and calling the interface.
Wherein one communication protocol corresponds to one dynamic library (Dynamic Link Library, DLL), and the dynamic libraries of each communication protocol are stored in the host computer. The protocol file of each communication protocol is stored in the dynamic library of the communication protocol. The protocol file contains protocol contents of the communication protocol, external APIs (Application Programming Interface ), and the like.
Specifically, the HMI device obtains a protocol file of the target communication protocol from the upper computer, loads the protocol file, and then invokes an interface. The protocol address information acquisition interface, the parameter setting interface and the protocol sending data packaging interface are all interfaces supported by the protocol file.
Optionally, the upper computer is used for acquiring and storing the newly added protocol data. When new demands appear, the developer can respond to the demands in time and store the protocol data in the upper computer, so that the cost of the post-development protocol and service clients is reduced.
Optionally, the dynamic library of each communication protocol is an encrypted state. By encrypting the dynamic library of the communication protocol, the theft of the protocol file can be prevented.
In the embodiment, the codes related to the protocol (namely the dynamic library of the communication protocol) are stored in the upper computer, so that the independence of each communication protocol is ensured, the safety of the communication protocol is improved, and the maintainability of the codes is greatly improved; and when the HMI application runs, only the target protocol file of the communication protocol which is currently needed is loaded, so that the processing logic and the code quantity of the application code can be greatly reduced, the code execution efficiency is improved, and the interface display speed of the HMI equipment is accelerated.
In one embodiment, the HMI device-based communication method further comprises: calling an initialization interface to initialize protocol parameters of a target communication protocol;
the calling protocol sending data packaging interface generates an instruction data frame based on the target operation address and the target operation parameter, and the calling protocol sending data packaging interface comprises the following steps:
and calling a protocol sending data packaging interface to generate an instruction data frame based on the protocol parameters, the target operation address and the target operation parameters of the target communication protocol.
Specifically, the HMI device invokes an initialization interface to initialize protocol parameters of a target communication protocol in a protocol file, and packages the protocol parameters, a target operation address, and the target operation parameters to generate an instruction data frame.
In this embodiment, the instruction data frame is generated based on the protocol parameters, the target operation address and the target operation parameters of the target communication protocol, that is, hundreds of communication protocols can be adapted in a simple communication manner, and normal communication with the external device can be ensured.
In one embodiment, generating an instruction data frame based on protocol parameters, a target operation address, and target operation parameters of a target communication protocol includes:
according to the output data structure body adapted by the multiple communication protocols, an instruction data frame is generated based on the protocol parameters, the target operation address and the target operation parameters of the target communication protocol.
The incoming data structure includes a protocol name, a target operation address, a target operation parameter, a data frame structure, and the like of the target communication protocol. The outgoing parameter data structure includes the content in the incoming parameter data structure, the waiting for response flag bit, the current communication state of the external device, and the like.
Specifically, the protocol parameters include a protocol name of the target communication protocol, and the like. The HMI device generates an instruction data frame based on protocol parameters, a target operating address, and target operating parameters of the target communication protocol according to an outgoing data structure adapted to the plurality of communication protocols.
In this embodiment, a protocol sending data packaging interface is called, and an instruction data frame is generated based on protocol parameters, a target operation address and a target operation parameter according to an outgoing data structure body adapted by multiple communication protocols, where the outgoing data structure body can be adapted to hundreds of communication protocols, so that the code processing amount of an application code is greatly reduced, and the code execution efficiency is improved.
In one embodiment, after invoking the initialization interface to initialize the protocol parameters of the target communication protocol, the HMI-device based communication method further comprises: and calling a protocol starting interface, and establishing communication connection with external equipment based on protocol parameters of a target communication protocol.
Specifically, the initialization interface refers to the DeviceInit interface.
In this embodiment, since some communication protocols need to handshake to establish communication connection with external devices, after initialization, a protocol start interface is called, and communication connection is established with external devices based on protocol parameters of a target communication protocol, so that the communication protocols can be adapted.
In one embodiment, the HMI device-based communication method further comprises: and calling a protocol receiving data analysis interface, receiving a response data packet responded by the external equipment to the instruction data frame, and analyzing the response data packet.
Specifically, after the HMI device sends the instruction data frame, the external device receives the instruction data frame and executes the target operation, generates a response data packet based on the operation result or the error code, sends the response data packet to the HMI device, and analyzes the response data packet to obtain data such as the operation result of the external device.
In this embodiment, the calling protocol receives the data analysis interface, receives the response data packet responded by the external device to the instruction data frame, and analyzes the response data packet, so as to complete the communication process with the external device, and has strong versatility.
In one embodiment, the HMI device-based communication method includes: and calling a protocol stopping interface, sending a protocol stopping instruction to the external equipment and releasing a cache communicated with the external equipment, wherein the protocol stopping instruction is used for indicating the external equipment to no longer respond to the data instruction sent by the HMI equipment.
The protocol stop interface is a DeviceStop interface, and is used for disconnecting communication connection with external equipment.
Specifically, the HMI device invokes a protocol stop interface, stops communication with the external device and releases the cache of communication with the external device, sending a protocol stop instruction to the external device. The external device receives the protocol stopping instruction, does not respond to the data instruction sent by the HMI device any more, and waits for the next communication connection.
In this embodiment, by calling the protocol stopping interface, a protocol stopping instruction is sent to the external device, and the buffer memory in communication with the external device is released, so that the external device is instructed not to respond to the data instruction sent by the HMI device.
In one embodiment, the HMI device-based communication method further comprises: and when the communication with the external equipment is overtime, calling a communication overtime interface to disconnect the communication connection with the external equipment.
The communication timeout interface refers to a DeviceTimeout interface. And the communication timeout interface is callable in each communication protocol.
In this embodiment, there may be a timeout condition in the process of communicating with the external device, and the communication timeout interface is invoked to disconnect the communication connection with the external device, which is applicable to hundreds of communication protocols, and ensures communication efficiency.
In one embodiment, a software structure adapting to hundreds of communication protocols is provided, the same calling interface is provided for the outside of different protocols of external equipment, the problem of adapting to different protocols is solved, and the software structure can flexibly supplement and timely respond to new protocols with new requirements and reduce the software development cost.
The software structure in this embodiment is composed of a dynamic library of communication protocols, a dynamic library entry and exit definition of communication protocols, and a dynamic library logic of application call communication protocols.
1. Dynamic library structure of communication protocol
The dynamic library only processes the corresponding protocol related logic, exposes the appointed API, and transmits parameters by application, and outputs data by the protocol library, each protocol has a protocol library, and the structure is approximately as follows: an initialization interface (DeviceInit), a protocol start interface (DeviceStart), a protocol stop interface (DeviceStop), a protocol address information acquisition interface (getdeviceinfo), a parameter acquisition interface (getcommpam), a parameter setting interface (setcommpam), a protocol transmission data packet interface (DeviceDataOutput), a protocol reception data parsing interface (DeviceDataInput), a communication timeout interface (DeviceTimeout), and the like.
2. Dynamic library entry and exit definitions for communication protocols
For all external APIs in 1, as long as the application needs to obtain the outgoing data through the incoming parameter data, the APIs correspond to one incoming parameter data structure body and one outgoing parameter data structure body. By uniformly defining the address information and the communication information of the external equipment connected with the HMI, an input parameter data structure body applicable to all the external equipment can be obtained, and the function definition of different external APIs is defined, and the output parameters of the corresponding APIs are also defined to be applicable to all the external equipment, so that the communication of all the external equipment is adapted.
3. Dynamic library logic for application invocation communication protocol
Because the communication flow of each external device is different, when the application loads the dynamic library, the dynamic library logic needs to be executed according to a specific protocol API call sequence, and the normal logic is as follows: deviceInit (initialization interface) - - > DeviceStart (protocol start interface) - > GetDeiveinfo (protocol address information acquisition interface) - > DeviceDataOutput (protocol send data packet interface) - > DeviceDataInput (protocol receive data parsing interface) - > DeviceStop (protocol stop interface). Timeout judgment is added to each interface needing communication, and when the timeout condition is met, deviceTimeout interface is called. A specific interaction flow is shown in fig. 3, which is a flow chart of a communication method based on an HMI device in another embodiment.
The HMI equipment acquires a target protocol file of a target communication protocol from the upper computer, and loads the target protocol file for interface call.
And calling an initialization interface, initializing a target communication protocol based on the target protocol file, and initializing protocol parameters of the target communication protocol. It is understood that protocol parameters may be invoked by any interface.
And calling a protocol starting interface, and establishing communication connection with external equipment based on protocol parameters of a target communication protocol. Some data, such as data required for handshaking, is sent to the external device during the call, and whether the communication is successful (i.e., the communication connection is established) is determined.
After communication connection is established with the external equipment, a protocol address information acquisition interface is called, and a target operation address selected by a user under the target communication protocol is acquired from the upper computer.
And calling a parameter acquisition interface to acquire the current operation parameters of the target communication protocol. The current operating parameter is, for example, a read parameter, a write parameter, or a wait parameter, etc. The read parameters include parameters such as single read, block read, full read, etc. The write parameters in turn include parameters of the single write, block write, full write, etc. types.
And calling a parameter setting interface to modify the current operation parameter into a target operation parameter required by an instruction data frame corresponding to the target operation. For example from read parameters to write parameters.
And calling a protocol sending data packaging interface, wherein the input parameter data structure body comprises a protocol name, a protocol address, a current operation parameter, a data frame format and the like, the output parameter data structure body comprises a packaged data frame to be sent, a waiting response flag bit, a current communication state of external equipment and the like, the content in the output parameter data structure body is obtained, the content in the output parameter data structure body is packaged into an instruction data frame, and the instruction data frame is sent to the external equipment. And judges whether the communication is successful.
And calling a protocol receiving data analysis interface, receiving a response data packet responded by the external equipment to the instruction data frame when the communication is successful, and analyzing the response data packet. The input data structure of the protocol received data analysis interface includes a command data frame, an error code, etc. which are received from an external device, and the output data structure includes read data, an operation result state, etc.
And calling a protocol stopping interface, sending a protocol stopping instruction to the external equipment and releasing a cache communicated with the external equipment, wherein the protocol stopping instruction is used for indicating the external equipment to no longer respond to the data instruction sent by the HMI equipment.
And when the communication with the external equipment is overtime and is not communicated or fails, calling a communication overtime interface to disconnect the communication connection with the external equipment.
In this embodiment, since one HMI device needs to adapt to hundreds of communication protocols at the same time and the processing modes of each communication protocol are different, by extracting the common part of different protocols, only the processing logic and the code amount of the application code need to be executed according to the above procedure, so that the code execution efficiency is improved, the compatibility of the application code is improved, and the speed of interface display of the HMI device is accelerated. In addition, the dynamic library of each communication protocol in the hundreds of communication protocols is stored in the upper computer, so that when a new demand appears on the communication protocols, the new demand can be responded in time, the new demand is stored in the corresponding dynamic library, the independence of each protocol is ensured, the safety of the protocol is improved, the maintainability of codes is greatly improved, and the cost of post-development protocols and service clients is reduced. The method adopts a mode of storing the dynamic library of each communication protocol in an upper computer, and can encrypt the protocol code so file subsequently to prevent the protocol code so file from being plagiarized. In addition, the code (dynamic library) related to the protocol is placed in the upper computer, and only the currently needed protocol dynamic library is loaded when the HMI application runs, so that the processing logic and the code quantity of the application code can be reduced to a great extent, the code execution efficiency is improved, and the interface display speed of the HMI equipment is accelerated.
In one embodiment, a communication method based on an HMI device is applied to the HMI device, and the method includes:
step (a 1), obtaining a target protocol file of a target communication protocol from an upper computer; a dynamic library of each communication protocol in the plurality of communication protocols is stored in the upper computer; the corresponding protocol file is stored in the dynamic library of each communication protocol.
And (a 2) loading the target protocol file and calling the interface.
And (a 3) calling an initialization interface to initialize protocol parameters of the target communication protocol.
And (a 4) calling a protocol starting interface, and establishing communication connection with external equipment based on protocol parameters.
And (a 5) calling a protocol address information acquisition interface to acquire a target operation address under the target communication protocol selected from the upper computer.
And (a 6) calling a parameter acquisition interface to acquire the current operation parameters of the target communication protocol.
And (a 7) calling a parameter setting interface to modify the current operation parameter into a target operation parameter required by an instruction data frame corresponding to the target operation.
And (a 8) calling a protocol sending data packaging interface, generating an instruction data frame based on the protocol parameters, the target operation address and the target operation parameters according to the output data structure body adapted by the various communication protocols, and sending the instruction data frame to the external equipment, wherein the instruction data frame is used for indicating the external equipment to execute the target operation.
And (a 9) calling a protocol receiving data analysis interface, receiving a response data packet responded by the external equipment to the instruction data frame, and analyzing the response data packet.
And (a 10) calling a protocol stopping interface, sending a protocol stopping instruction to the external device and releasing a cache communicated with the external device, wherein the protocol stopping instruction is used for indicating the external device to no longer respond to the data instruction sent by the HMI device.
And (a 11) when the communication with the external equipment is overtime, calling a communication overtime interface to disconnect the communication with the external equipment.
In this embodiment, an HMI device is usually required to adapt to hundreds of communication protocols at the same time, and the processing manner of each communication protocol is different, and if the HMI device is required to adapt to the hundreds of communication protocols, a large amount of code needs to be deployed. According to the method and the device, the common part of hundreds of communication protocols is extracted, namely, the communication processes of the hundreds of communication protocols can be realized by sequentially calling a protocol address information acquisition interface, a parameter setting interface and a protocol sending data packaging interface to execute corresponding interface operation, the same calling interface is provided for different external equipment communication protocols, the processing logic and the code quantity of application codes can be greatly reduced, the code execution efficiency is improved, and the interface display speed of the HMI equipment is accelerated.
It should be understood that, although the steps in the flowcharts of fig. 2 and 3 described above are sequentially shown as indicated by arrows, and the steps in steps (a 1) to (a 11) are sequentially shown as indicated by numerals, these steps are not necessarily sequentially performed in the order indicated by the arrows or numerals. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps in fig. 2 and 3 may include a plurality of steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the execution of the steps or stages is not necessarily sequential, but may be performed in rotation or alternatively with at least a portion of the steps or stages in other steps or steps.
In one embodiment, an HMI device is provided, which may be a terminal device, the internal structure of which may be as shown in FIG. 4. The HMI device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the HMI device is configured to provide computing and control capabilities. The memory of the HMI device includes a non-volatile storage medium, internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the HMI device is configured to perform wired or wireless communication with an external terminal, where the wireless mode may be implemented through WIFI, an operator network, NFC (near field communication), or other technologies. The computer program, when executed by a processor, implements a communication method based on an HMI device. The display screen of the HMI equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the HMI equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the HMI equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of a portion of the architecture associated with the present application and is not limiting of the HMI device to which the present application is applied, and that a particular HMI device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, an HMI device is provided for implementing the steps of the method embodiments described above.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the HMI device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the HMI device performs the steps in the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods in accordance with the embodiments may be accomplished by way of a computer program stored in a non-transitory computer readable storage medium, which when executed may comprise the steps of the above described embodiments of the methods. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (10)

1. A communication method based on an HMI device, characterized by being applied to an HMI device, the method comprising:
calling a protocol address information acquisition interface to acquire a target operation address under a target communication protocol selected from the upper computer;
calling a parameter acquisition interface to acquire the current operation parameters of the target communication protocol;
calling a parameter setting interface to modify the current operation parameter into a target operation parameter required by an instruction data frame corresponding to target operation;
and calling a protocol sending data packaging interface, generating the instruction data frame based on the target operation address and the target operation parameter, and sending the instruction data frame to external equipment, wherein the instruction data frame is used for indicating the external equipment to execute the target operation.
2. The method of claim 1, wherein a dynamic library of each of a plurality of communication protocols is stored in the host computer; storing corresponding protocol files in the dynamic library of each communication protocol;
the method further comprises the steps of:
acquiring a target protocol file of the target communication protocol from the upper computer;
and loading the target protocol file and calling an interface.
3. The method according to claim 1, wherein the method further comprises:
calling an initialization interface to initialize protocol parameters of the target communication protocol;
the calling protocol sending data packaging interface generates the instruction data frame based on the target operation address and the target operation parameter, and the calling protocol sending data packaging interface comprises the following steps:
and calling a protocol sending data packaging interface, and generating the instruction data frame based on the protocol parameters, the target operation address and the target operation parameters of the target communication protocol.
4. A method according to claim 3, wherein said generating said instruction data frame based on protocol parameters of said target communication protocol, said target operation address and said target operation parameters comprises:
and generating the instruction data frame according to an output data structure body adapted by a plurality of communication protocols based on the protocol parameters of the target communication protocol, the target operation address and the target operation parameters.
5. A method according to claim 3, wherein after said invoking an initialization interface initializes protocol parameters of said target communication protocol, the method further comprises:
and calling a protocol starting interface, and establishing communication connection with the external equipment based on the protocol parameters of the target communication protocol.
6. The method according to any one of claims 1 to 5, further comprising:
and calling a protocol receiving data analysis interface, receiving a response data packet responded by the external equipment to the instruction data frame, and analyzing the response data packet.
7. The method according to any one of claims 1 to 5, further comprising:
and calling a protocol stopping interface, sending a protocol stopping instruction to the external equipment and releasing a cache communicated with the external equipment, wherein the protocol stopping instruction is used for indicating the external equipment to no longer respond to the data instruction sent by the HMI equipment.
8. The method according to any one of claims 1 to 5, further comprising:
and when the communication with the external equipment is overtime, calling a communication overtime interface, and disconnecting the communication connection with the external equipment.
9. An HMI device for performing the steps of the method of any one of claims 1 to 8.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 8.
CN202311865532.7A 2023-12-29 2023-12-29 Communication method based on HMI device, HMI device and storage medium Pending CN117873942A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311865532.7A CN117873942A (en) 2023-12-29 2023-12-29 Communication method based on HMI device, HMI device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311865532.7A CN117873942A (en) 2023-12-29 2023-12-29 Communication method based on HMI device, HMI device and storage medium

Publications (1)

Publication Number Publication Date
CN117873942A true CN117873942A (en) 2024-04-12

Family

ID=90596272

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311865532.7A Pending CN117873942A (en) 2023-12-29 2023-12-29 Communication method based on HMI device, HMI device and storage medium

Country Status (1)

Country Link
CN (1) CN117873942A (en)

Similar Documents

Publication Publication Date Title
US20240095043A1 (en) Execution of sub-application processes within application program
US11829787B2 (en) Multi-process model for cross-platform applications
US8738815B2 (en) System and method for virtualizing the peripherals in a terminal device to enable remote management via removable portable media with processing capability
CN108563517B (en) Calling method and device of system interface
USRE44442E1 (en) Information processing apparatus and information processing method
US7155550B2 (en) Program-executing apparatus and portable information processing apparatus
EP0978976B1 (en) A method and system for an application dispatcher for server application
CN105162673A (en) Data transmission interface and method
EP4310667A1 (en) Ai application deployment method, and related platform, cluster, medium and program product
CN113076144A (en) Power amplifier adaptation method, terminal device, storage medium and computer program product
CN112688915A (en) Cross-protocol communication method, device and server
EP3797356B1 (en) Code base sharing between standalone and web-based versions of an application due to the implementing of an emulated network communication channel
CN108415785A (en) Self-aided terminal SP implementation methods, terminal device and readable storage medium storing program for executing
CN112506676B (en) Inter-process data transmission method, computer device and storage medium
US7080387B2 (en) System and method for mediating communication between software applications
CN103003033A (en) Robot system control method and a device therefor
CN110795156B (en) Mobile memory loading method, thin client, storage medium and device
CN106095886B (en) Data processing method and device
CN117873942A (en) Communication method based on HMI device, HMI device and storage medium
US20190095359A1 (en) Peripheral device controlling device, operation method thereof, and operation method of peripheral device controlling device driver
US7886304B1 (en) Method and system implementing efficient remote procedure call and emulation system therefor
CN110609680A (en) Parameter transmission method and device based on Spring interceptor, storage medium and equipment
US10002007B2 (en) Operating system (OS) independent device drivers
CN110018909A (en) System and method for using the hardware controls of kernel proxy
CN114564241A (en) Hardware device access method and device, computer device and storage medium

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