CN117938653B - Communication interface configuration method, device, equipment and storage medium - Google Patents

Communication interface configuration method, device, equipment and storage medium Download PDF

Info

Publication number
CN117938653B
CN117938653B CN202410304196.7A CN202410304196A CN117938653B CN 117938653 B CN117938653 B CN 117938653B CN 202410304196 A CN202410304196 A CN 202410304196A CN 117938653 B CN117938653 B CN 117938653B
Authority
CN
China
Prior art keywords
message
communication
equipment
data
identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410304196.7A
Other languages
Chinese (zh)
Other versions
CN117938653A (en
Inventor
周立功
王林福
翁叶冬
曹文静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Zhiyuan Electronics Co Ltd
Original Assignee
Guangzhou Zhiyuan 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 Guangzhou Zhiyuan Electronics Co Ltd filed Critical Guangzhou Zhiyuan Electronics Co Ltd
Priority to CN202410304196.7A priority Critical patent/CN117938653B/en
Publication of CN117938653A publication Critical patent/CN117938653A/en
Application granted granted Critical
Publication of CN117938653B publication Critical patent/CN117938653B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The application discloses a communication interface configuration method, a device, equipment and a storage medium, and relates to the technical field of communication. The method comprises the following steps: initializing a communication interface of the upper computer into corresponding first communication equipment, registering the first communication equipment to a first protocol manager, wherein the communication interface comprises a network card, a serial port, a Bluetooth interface and a wifi interface; the terminal equipment initializes the communication interface of the terminal equipment to corresponding second communication equipment, and registers equipment identifiers of the second communication equipment and the terminal equipment to a second protocol manager; the upper computer controls each registered first communication device to send a request message through a first protocol manager; when any second communication device receives the request message, the terminal device controls the second communication device receiving the request message to send a device identifier through a second protocol manager; when any first communication device receives the device identification, the upper computer stores the device identification and the first communication device which receives the device identification in an associated mode through the first protocol manager.

Description

Communication interface configuration method, device, equipment and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method, an apparatus, a device, and a storage medium for configuring a communication interface.
Background
In the terminal equipment type products, the configuration parameters are generally factory parameters when the terminal equipment type products are used for the first time, and the terminal equipment can work in an actual environment after the upper computer is required to carry out a series of configuration on the terminal equipment. When the upper computer configures the terminal equipment, communication connection is established with the terminal, and data required by configuration is transmitted to the terminal equipment based on the communication connection, so that the terminal equipment can normally work after being configured based on the received data.
In the prior art, an upper computer discovers connectable terminal equipment by using discovery protocols such as mDNS, SSDP and the like, establishes communication connection with the discovered terminal equipment based on TCP, and sends configuration data to the terminal equipment based on the TCP connection. However, the above method for discovering and configuring the terminal device is only suitable for network card communication, which results in that the upper computer cannot configure the terminal device through serial ports, bluetooth, WIFI and other communication interfaces, and limits the use scenarios of the terminal device.
Disclosure of Invention
The application provides a communication interface configuration method, a device, equipment and a storage medium, which solve the problem that an upper computer cannot configure terminal equipment through communication interfaces such as serial ports, bluetooth, WIFI and the like in the prior art, and enlarge the use scene of the terminal equipment.
In a first aspect, the present application provides a communication interface configuration method, including:
Initializing a communication interface of the upper computer into corresponding first communication equipment, registering the first communication equipment to a first protocol manager, wherein the communication interface comprises a network card, a serial port, a Bluetooth interface and a wifi interface;
the terminal equipment initializes a communication interface of the terminal equipment to corresponding second communication equipment, and registers equipment identifiers of the second communication equipment and the terminal equipment to a second protocol manager;
The upper computer controls each registered first communication device to send a request message through the first protocol manager;
when any one of the second communication devices receives the request message, the terminal device controls the second communication device which receives the request message to send the device identification through the second protocol manager;
And when any one of the first communication equipment receives the equipment identifier, the upper computer stores the equipment identifier and the first communication equipment which receives the equipment identifier in an associated way through the first protocol manager.
In a second aspect, the present application provides a communication interface configuration apparatus, comprising:
The first registration module is configured to initialize a communication interface of the upper computer to be corresponding first communication equipment, register the first communication equipment to the first protocol manager, and the communication interface comprises a network card, a serial port, a Bluetooth interface and a wifi interface;
The second registration module is configured to initialize a communication interface of the terminal equipment to be corresponding second communication equipment, and register equipment identifiers of the second communication equipment and the terminal equipment to a second protocol manager;
The discovery request module is configured to control the upper computer to send a request message through the first protocol manager by each registered first communication device;
The discovery response module is configured to control the second communication equipment receiving the request message to send the equipment identifier through the second protocol manager when any one of the second communication equipment receives the request message;
And the interface configuration module is configured to store the equipment identifier and the first communication equipment receiving the equipment identifier in an associated manner through the first protocol manager when any one of the first communication equipment receives the equipment identifier.
In a third aspect, the present application provides a communication interface configuration apparatus comprising:
One or more processors;
A memory storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the communication interface configuration method as described in the first aspect.
In a fourth aspect, the present application provides a storage medium containing computer executable instructions which, when executed by a computer processor, are used to perform the communication interface configuration method according to the first aspect.
In the application, an upper computer initializes a communication interface of the upper computer to corresponding first communication equipment, registers the first communication equipment to a first protocol manager, and the communication interface comprises a network card, a serial port, a Bluetooth interface and a wifi interface; the terminal equipment initializes the communication interface of the terminal equipment to corresponding second communication equipment, and registers equipment identifiers of the second communication equipment and the terminal equipment to a second protocol manager; the upper computer controls each registered first communication device to send a request message through a first protocol manager; when any second communication device receives the request message, the terminal device controls the second communication device receiving the request message to send a device identifier through a second protocol manager; when any first communication device receives the device identification, the upper computer stores the device identification and the first communication device which receives the device identification in an associated mode through the first protocol manager. Through the technical means, the communication interfaces such as the network card, the serial port, the Bluetooth and the WIFI of the upper computer and the terminal equipment can be configured as the communication equipment managed by the protocol manager, and the upper computer and the terminal equipment support the communication connection of various communication interfaces, so that the upper computer can configure the terminal equipment by using various communication interfaces at will, the problem that the upper computer cannot configure the terminal equipment through the serial port, the Bluetooth, the WIFI and other communication interfaces in the prior art is solved, and the use scene of the terminal equipment is enlarged.
Drawings
Fig. 1 is a flowchart of a communication interface configuration method provided in an embodiment of the present application;
Fig. 2 is a flowchart of an upper computer configured to initialize a first network card as a first communication device according to an embodiment of the present application;
Fig. 3 is a flowchart of a terminal device configured to initialize a second network card to a second communication device according to an embodiment of the present application;
fig. 4 is a schematic diagram of a field in a preset message format according to an embodiment of the present application;
Fig. 5 is a flowchart of a terminal device processing a first message provided in an embodiment of the present application;
FIG. 6 is a flowchart of a processing a second message by a host according to an embodiment of the present application;
Fig. 7 is a flowchart of configuring a terminal device by an upper computer according to an embodiment of the present application;
fig. 8 is a flowchart of processing transparent data by an upper computer and a terminal device according to an embodiment of the present application;
Fig. 9 is a flowchart of a second protocol manager according to an embodiment of the present application processing a first packet received by a second communication device D;
fig. 10 is a flowchart of a first protocol manager according to an embodiment of the present application processing a second packet received by a first communication device C;
fig. 11 is a schematic structural diagram of a communication interface configuration device according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of a communication interface configuration device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the following detailed description of specific embodiments of the present application is given with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the matters related to the present application are shown in the accompanying drawings. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart depicts operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently, or at the same time. Furthermore, the order of the operations may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figures. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The terms first, second and the like in the description and in the claims, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present application may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type, and are not limited to the number of objects, such as the first object may be one or more. Furthermore, in the description and claims, "and/or" means at least one of the connected objects, and the character "/", generally means that the associated object is an "or" relationship.
In a more common existing implementation manner, the upper computer can discover the terminal equipment through discovery protocols such as mDNS, SSDP and the like, establish communication connection with the terminal equipment based on TCP after discovering the terminal equipment, and send configuration data to the terminal equipment based on the TCP connection so that the terminal equipment can perform configuration based on the received configuration data. The mode of discovering and configuring the terminal equipment is only suitable for network card communication, so that the upper computer cannot configure the terminal equipment through communication interfaces such as serial ports, bluetooth, WIFI and the like, and the use scene of the terminal equipment is limited. The service logic of the TCP connection needs to be realized by additional application software on the terminal equipment and the upper computer, and the complexity of the upper computer for configuring the terminal equipment is increased. When the upper computer discovers the terminal equipment by using the mDNS and SSDP protocols, the upper computer and the terminal equipment are required to be in the same IP sub-network or have network interconnection, if the upper computer and the terminal equipment are directly connected by a network cable and have no DHCP server, the IP address of the client needs to be manually configured to the address of the same IP sub-network with the server, otherwise, the TCP cannot be connected and cannot be established, and the complexity of the upper computer for configuring the terminal equipment is further increased. Such modifications require that the original IP be changed back or the DHCP client be enabled after some of the terminal devices are unacceptable, e.g., the terminal device is a computer, and the IP address is manually modified, otherwise the internet may not be connected any more. When the upper computer discovers the configurable terminal equipment by using the mDNS and SSDP protocols, the discovered terminal equipment cannot be recorded, and if the terminal equipment is to be reconfigured, the process of discovering the equipment and establishing communication connection is to be executed again, so that the configuration efficiency of the terminal equipment is low.
In order to solve the above-mentioned problems, the present embodiment provides a communication interface configuration method, so as to configure communication interfaces such as network cards, serial ports, bluetooth, WIFI and the like of an upper computer and a terminal device as communication devices managed by a protocol manager, and support communication connection of various communication interfaces between the upper computer and the terminal device, so that the upper computer can configure the terminal device by using various communication interfaces at will.
The communication interface configuration method provided in this embodiment may be performed by a communication interface configuration device, where the communication interface configuration device may be implemented by software and/or hardware, and the communication interface configuration device may be configured by two or more physical entities or may be configured by one physical entity. In this embodiment, the communication interface configuration method is implemented by cooperation of the upper computer and the terminal device, so the communication interface configuration device may be the upper computer and the terminal device.
The communication interface configuration device is provided with at least one type of operating system, wherein the operating system comprises, but is not limited to, an android system, a Linux system and a Windows system. The communication interface configuration device may install at least one application program based on the operating system, where the application program may be an application program carried by the operating system, or may be an application program downloaded from a third party device or a server. In this embodiment, the communication interface configuration device has at least an application program that can execute the communication interface configuration method.
For ease of understanding, the present embodiment will be described taking the host computer and the terminal device as an example for executing the main body of the communication interface configuration method.
Fig. 1 is a flowchart of a communication interface configuration method according to an embodiment of the present application. Referring to fig. 1, the communication interface configuration method specifically includes:
S110, initializing a communication interface of the upper computer into corresponding first communication equipment, registering the first communication equipment to a first protocol manager, wherein the communication interface comprises a network card, a serial port, a Bluetooth interface and a wifi interface.
In this embodiment, the first communication device is an abstract data transmission device on the upper computer, and is configured to provide unified data transceiving and device destruction operations, where the first communication device is implemented based on a communication interface of the upper computer. The communication interface of the upper computer comprises a first network card, a first serial port, a first Bluetooth interface and a first wifi interface, and the upper computer respectively initializes and configures the first network card, the first serial port, the first Bluetooth interface and the first wifi interface into corresponding first communication devices and distributes corresponding first identifiers for each first communication device. Each first communication device and the corresponding first identification are registered with the first protocol manager so that the first protocol manager controls each first communication device that is registered to send and receive data. The first protocol manager is a software object of the upper computer, and performs unified management and unified data transceiving on each registered first communication device.
In an embodiment, fig. 2 is a flowchart of an upper computer configured to initialize a first network card as a first communication device according to an embodiment of the present application. As shown in fig. 2, the step of initializing and configuring the first network card by the upper computer as the first communication device specifically includes S1101-S1103:
s1101, the upper computer creates a first UDP socket interface of each first network card, and binds the first UDP socket interface with the corresponding equipment name of the first network card.
S1102, binding a first UDP socket interface with a first multicast address by the upper computer, wherein the first UDP port number is zero.
S1103, the upper computer packages the sending function, the receiving function and the cancellation function of the first UDP socket interface into first communication equipment corresponding to the first network card.
The host computer creates a corresponding first UDP socket interface for each first network card, and each first UDOP socket interface binds the device name of the corresponding first network card through the so_ BINDTODEVICE option, SO that the subsequent first UDP socket interface only uses the corresponding bound first network card to send and receive data. The upper computer binds the first UDP socket interface with the first UDP port number of zero so as to automatically allocate the port number for the first UDP socket interface. The first UDP socket interface is added to the first multicast address so that the subsequent first UDP socket interface communicates with the terminal devices of the same multicast group based on the first multicast address. The upper computer packages a sending function (sendto function), a receiving function (recvfrom function) and a cancellation function (closesocket function) of the first UDP socket interface into a first communication device corresponding to the first network card, so that the sending data, the receiving data and the callback of the cancellation device of the first communication device are realized through the sending function, the receiving function and the cancellation function. It should be noted that, the first multicast address added by each first network card of the host computer is the same, that is, each first network card communicates based on the first multicast address.
Further, when the upper computer configures the first serial port initialization as the first communication device, the upper computer may initialize the parameter of each first serial port, and package the read function, the write function and the logout function of the initialized first serial port as the first communication device corresponding to the first serial port. The host computer may initialize parameters such as a serial port baud rate of the first serial port, and encapsulate the read function, the write function, and the logout function of the first serial port into a first communication device corresponding to the first serial port, so as to implement sending data, receiving data, and callback of the logout device in the first communication device through the read function, the write function, and the logout function.
The first Bluetooth interface and the first wifi interface of the upper computer are specific communication modules, and the specific communication modules can be directly used as corresponding first communication equipment.
S120, the terminal equipment initializes the communication interface of the terminal equipment to corresponding second communication equipment, and registers equipment identifiers of the second communication equipment and the terminal equipment to a second protocol manager.
In this embodiment, the second communication device is an abstract data transmission device on the terminal device, and is configured to provide unified data transceiving and device destruction operations, where the second communication device is implemented based on a communication interface of the terminal device. The communication interface of the terminal device includes a second network card, a second serial port, a second bluetooth interface and a second wifi interface, and the terminal device respectively initializes and configures the second network card, the second serial port, the second bluetooth interface and the second wifi interface to corresponding second communication devices and distributes corresponding second identifiers for each second communication device. Each second communication device and the corresponding second identifier are registered with the second protocol manager, so that the second protocol manager controls each second communication device which is correspondingly registered to send and receive data. The second protocol manager is a software object of the terminal device, and performs unified management and unified data transceiving on each registered second communication device.
In an embodiment, fig. 3 is a flowchart of a terminal device configured to initialize a second network card to a second communication device according to an embodiment of the present application. As shown in fig. 3, the step of configuring the second network card as the second communication device by the terminal device includes S1201-S1203:
s1201, the terminal equipment creates a second UDP socket interface of each second network card, and binds the second UDP socket interface with the equipment name of the corresponding second network card.
S1202, the terminal equipment binds a second UDP socket interface with a second multicast address, wherein the second UDP port number is not zero, and the second multicast address is the same as the first multicast address.
And S1203, the terminal equipment packages the sending function, the receiving function and the cancellation function of the second UDP socket interface into second communication equipment corresponding to the second network card.
The terminal device creates a corresponding second UDP socket interface for each second network card, where each second UDP socket interface binds, through the so_ BINDTODEVICE option, a device name of the corresponding second network card, SO that only the second network card that is bound and used by the subsequent second UDP socket interface receives and transmits data. And the terminal equipment binds the second UDP socket interface with the second UDP port number and joins the second multicast address. The second multicast address is the same as the first multicast address added by the first UDP socket interface of the upper computer, namely the first UDP socket interface and the second UDP socket interface are added by the same multicast address, so that the first UDP socket interface and the second UDP socket interface can perform data interaction based on the same multicast address. The terminal device encapsulates a sending function (sendto function), a receiving function (recvfrom function) and a cancellation function (closesocket function) of the second UDP socket interface into a second communication device corresponding to the second network card, so as to implement sending data, receiving data and callback of the cancellation device of the second communication device through the sending function, the receiving function and the cancellation function. It should be noted that, the second multicast address added by each second network card of the terminal device is the same, that is, each second network card will communicate based on the second multicast address.
According to the embodiment, the first UDP socket interface and the second UDP socket interface are added into the same multicast address, so that when the upper computer and the terminal equipment communicate through the network card, the upper computer and the terminal equipment do not need to be in the same IP subnet or have network interconnectivity, and the complexity of establishing network card communication between the upper computer and the terminal equipment is greatly reduced.
Further, when the terminal device configures the second serial port initialization as the second communication device, initializing parameters of each second serial port, and packaging the initialized read function, write function and logout function of the second serial port as the second communication device corresponding to the second serial port. The terminal device may initialize parameters such as a serial port baud rate of the second serial port, and encapsulate the read function, the write function, and the cancel function of the second serial port into a second communication device corresponding to the second serial port, so as to implement sending data, receiving data, and callback of the cancel device in the second communication device through the read function, the write function, and the cancel function.
Similarly, the second bluetooth interface and the second wifi interface of the terminal device are specific communication modules, and can be directly used as corresponding second communication devices.
S130, the upper computer controls each registered first communication device to send a request message through the first protocol manager.
The first protocol manager is illustratively registered with a discovery device interface for triggering the first protocol manager to generate a request message for discovering the terminal device and controlling the first communication device to send the request message. The upper computer calls a discovery device interface of the first protocol manager once, so that the first protocol manager generates a request message according to a preset message format, and controls each registered first communication device to call a sending function to send the request message.
Fig. 4 is a schematic diagram of fields in a preset message format according to an embodiment of the present application. As shown in fig. 4, the fields of the preset message format include a frame header, an identifier, a message type, a data length, data and a check. The frame header is used for identifying the beginning of the corresponding message; the message types comprise a discovery device request and a discovery device response, and application configuration data, which are respectively the message types of a request message, a response message and configuration data or reply data; when the message type is a discovery device request, the identification field is all 0 or 0XFF, and when the message type is a discovery device response, the identification field stores the device identification of the device terminal generating the message; the data length is the byte length of the data field; when the message type is the application configuration data, the data field stores the configuration data of the upper computer for configuring the terminal equipment or replies the reply data of the upper computer after the terminal equipment is configured. Verification is used to verify that the data is free of transmission errors.
And S140, when any second communication device receives the request message, the terminal device controls the second communication device receiving the request message to send the device identification through the second protocol manager.
In an exemplary embodiment, when the first protocol manager uses the first communication device a corresponding to the first network card to send the request message, the first communication device sends the request message based on the first network address, and because the first network address is the same as the second network address corresponding to the second network card, the second communication device B corresponding to the second network card may receive the request message sent by the first communication device a. When the first protocol manager uses the first communication device C corresponding to the first serial port to send the request message, the second communication device D corresponding to the second serial port connected to the first serial port may receive the request message sent by the first communication device C. When the second protocol manager confirms that any second communication device receives the request message, the second protocol manager can know that the upper computer requests to find the first communication device corresponding to the communication connection of the corresponding terminal device, and then controls the second communication device corresponding to the request message to send the device identifier of the terminal device to the upper computer, so that the upper computer confirms that the first communication device receiving the device identifier can establish communication connection with the terminal device corresponding to the device identifier. For example, when the second protocol manager confirms that the second communication device D receives the request message, the second protocol manager sends the device identifier to the first communication device C correspondingly connected through the second communication device D, and when the first protocol manager receives the device identifier from the first communication device C, the first protocol manager may determine that the first communication device C establishes a communication connection with the terminal device corresponding to the device identifier, and then may send configuration data to the terminal device corresponding to the device identifier through the first communication device C, so as to implement configuration of the terminal device.
It should be noted that, the message sent by the upper computer to the terminal device includes not only the request message, but also the message converted by the configuration data, and even the transparent transmission data, so when any second communication device receives the message, the terminal device can detect the received message first to determine that the received message is the request message, the message converted by the configuration data or the transparent transmission data, so as to make different responses according to the type of the received message.
In this embodiment, fig. 5 is a flowchart of a terminal device processing a first packet according to an embodiment of the present application. As shown in fig. 5, the steps of the terminal device for processing the first message specifically include S1401-S1403:
s1401, when any second communication device receives the first message, the terminal device determines whether the first message is a request message or not based on field information of the first message through the second protocol manager.
The first message is a message received by the second communication device at any time. When the second communication equipment receives the first message, the second protocol manager determines that the first message is a message for requesting message, configuring data conversion or transparent transmission data according to a frame header field, a check field and a message type field of the first message.
In this embodiment, the implementation procedure of the second protocol manager determining the type of the first packet is: the second protocol manager determines whether the format of the first message meets the preset message format according to the frame header field and the check field of the first message; under the condition that the format of the first message meets the preset message format, the second protocol manager determines whether the first message is a request message according to the message type field of the first message, and the message type of the request message is a discovery device request. The second protocol manager may determine that the first message is transparent data when determining, according to the frame header field and the check field of the first message, that the format of the first message does not satisfy the preset message format; when the format of the second message is determined to meet the preset message format according to the frame header field and the check field of the first message, the first message can be determined to be a message for requesting message or for converting configuration data according to the message type stored in the message type field of the first message, if the message type stored in the message type field is a discovery device request, the first message is determined to be a request message, and if the message type stored in the message type field is application configuration data, the first message is determined to be a message for converting configuration data.
It should be noted that, the data length stored in the data length field of the request message is zero, and the data field of the message for configuring data conversion stores configuration data, so that the data length stored in the data length field of the message for configuring data conversion is greater than zero, and the first message may be determined to be the request message or the message for configuring data conversion according to the data length field of the first message.
S1402, under the condition that the first message is a request message, the terminal equipment generates a response message meeting the preset message format based on the equipment identification of the terminal equipment through the second protocol manager, and an identification field of the response message stores the equipment identification of the terminal equipment.
The terminal device will also register its own device identity to the second protocol manager, for example, after registering each second communication device to the second protocol manager. Correspondingly, when the second protocol manager determines that the first message is the request message, a response message for responding to the discovery device can be generated based on the registered device identifier and the preset message format, so that the device identifier is stored in an identifier field of the response message, and the message type of the discovery device response is stored in a message type field of the response message.
If the terminal device provides the service, the terminal device may register the service information and the device identifier together with the second protocol manager, and correspondingly, when the second protocol manager generates the response message, generate a response message meeting the preset message format based on the device identifier and the service information of the terminal device. Wherein, the data field of the response message stores service information, the identification field stores equipment identification, and the message type field stores the message type of the response of the discovery equipment. When the upper computer receives the response message, the device identification and the service information can be stored in an associated mode, so that a user can confirm the service provided by the terminal device corresponding to the device identification by checking the service information.
S1403, the terminal equipment controls the second communication equipment which receives the first message to send a response message through the second protocol manager.
The second protocol manager controls the second communication device that receives the first message to send a response message, so that the first communication device that establishes a communication connection with the second communication device can receive the response message. For example, a communication connection is established between the first communication device C and the second communication device D, after the second communication device D receives the first message from the first communication device C, the second protocol manager generates a response message according to the device identifier of the terminal device when confirming that the first message is the request message, and sends the response message to the first communication device C through the second communication device D.
And S150, when any first communication device receives the device identification, the upper computer stores the device identification and the first communication device which receives the device identification in an associated manner through the first protocol manager.
Illustratively, if the first communication device C receives the device identifier of the terminal device X, and the first communication device a receives the device identifier of the terminal device Y, the first protocol manager stores the first identifier of the first communication device C in association with the device identifier of the terminal device X, and stores the first identifier of the first communication device a in association with the device identifier of the terminal device Y. When the subsequent user wants to configure the terminal device X, the first communication device C may be selected to send configuration data to the terminal device X, and when the subsequent user wants to configure the terminal device Y, the first communication device a may be selected to send configuration data to the terminal device Y. The user does not need to pay attention to which communication interface of the upper computer is connected with which communication interface of which terminal device, only needs to input configuration data and select the first communication device corresponding to the transmission configuration data, so that the configuration complexity of the terminal device is greatly reduced, and the configuration efficiency of the terminal device is improved. The upper computer can inquire the record to determine the terminal equipment correspondingly connected with the first communication equipment when the upper computer configures each time, and discovery operation is not needed when the upper computer configures each time, so that the configuration efficiency can be effectively improved. The communication connection between the first communication device and the second communication device is established in the discovery process, TCP connection is not needed to be realized by means of additional application software, and the complexity of configuring the terminal device by the upper computer is reduced.
In an embodiment, the device identifier of the terminal device is stored in the response message sent by the second communication device, that is, when any first communication device receives the response message, the upper computer may parse the response message through the first protocol manager and extract the device identifier stored in the identifier field of the response message. Similarly, the message sent by the terminal device to the upper computer not only includes the response message, but also includes the reply data and even the transparent transmission data, so that when any first communication device receives the message, the upper computer can detect the received message first to determine that the received message is the response message, the reply data or the transparent transmission data, so as to make different responses according to the type of the received message.
In this embodiment, fig. 6 is a flowchart of processing a second message by the upper computer according to the embodiment of the present application. As shown in fig. 6, the steps of processing the second message by the upper computer specifically include S1501-S1502:
S1501, when any first communication device receives a second message, the upper computer determines whether the second message is a response message according to field information of the second message through first protocol management.
The second message is a message received by the first communication device at any time. When the first communication equipment receives the second message, the first protocol management determines that the second message is a response message, reply data or transparent transmission data according to a frame header field, a check field and a message type field of the second message.
In this embodiment, the implementation procedure of the first protocol manager determining the type of the second message is: the first protocol manager determines whether the format of the second message meets the preset message format according to the frame header field and the check field of the second message; under the condition that the format of the second message meets the preset message format, the first protocol manager determines whether the second message is a response message according to the message type field of the second message, and the message type of the response message is the response of the discovery device. The first protocol manager may determine that the second message is transparent data when determining that the format of the second message is full of the preset message format according to the frame header field and the check field of the second message; when the format of the second message is determined to meet the preset message format according to the frame header field and the check field of the second message, the second message can be determined to be the request message or the configuration data according to the message type stored in the message type field of the second message, if the message type stored in the message type field is the discovery equipment response, the second message is determined to be the response message, and if the message type stored in the message type field is the application configuration data, the second message is determined to be the configuration data.
S1502, under the condition that the second message is a response message, the upper computer extracts the equipment identifier stored in the identifier field of the second message through the first protocol management, and writes the equipment identifier and the first identifier of the first communication equipment receiving the second message into the terminal equipment recorder in an associated mode.
When the first protocol manager determines that the second message is a response message, the first protocol manager analyzes the second message to extract a device identifier stored in an identifier field of the second message, and writes the device identifier and a first identifier of a first communication device receiving the second message into a terminal device recorder in the first protocol manager in an associated manner, so that when the first protocol manager sends configuration data or transparent transmission data to the terminal device, the first protocol manager queries the terminal device recorder to determine a first communication device corresponding to the configuration data or transparent transmission data.
In this embodiment, if the first protocol manager determines that the data length stored in the data length field of the response packet is not equal to zero, it may determine that the data field of the response packet stores service information of the terminal device. At this time, the first terminal device may extract the device identifier and service information stored in the identifier field and the data field of the second message, and write the device identifier, the service information, and the first identifier of the first communication device that receives the second message into the terminal device recorder in an associated manner. The user can check the service information of each terminal device through the terminal device recorder and select the terminal device corresponding to the configuration data to be sent according to the service information, so that the upper computer can select the first communication device corresponding to the terminal device to be connected for communication according to the terminal device recorder to send the configuration data to the terminal device.
It should be noted that, if at least two second communication devices of the same terminal device receive a request packet sent by the upper computer, for example, the second serial port of the terminal device X is connected to the first serial port of the upper computer, and the second multicast address of the second network card of the terminal device X is the same as the first multicast address of the first network card of the upper computer. And the second serial port of the terminal equipment X and the second communication equipment corresponding to the second network card are both used for receiving the request message, and the two second communication equipment also respectively send response messages to the upper computer, so that the first serial port of the upper computer and the first communication equipment corresponding to the first network card both receive the response messages. Because the first communication devices corresponding to the first serial port and the first network card can both send the configuration data to the terminal device X, the first identifier of one of the first communication devices and the device identifier of the terminal device X can be associated and written into the terminal device recorder, so that the data volume of the terminal device recorder is reduced. In this embodiment, if the terminal device recorder detects that the same device identifier is stored in association with a plurality of first identifiers, the latest written first identifier is retained in the plurality of first identifiers and the remaining first identifiers are deleted. For example, the device identifiers of the terminal device X are respectively associated with the first identifiers of the first communication device a, the first communication device C and the first communication device E, and the record corresponding to the first identifier of the first communication device a is generated by the latest writing, so that the terminal device recorder may delete the record corresponding to the first communication device C and the first communication device E and associated with the device identifier of the terminal device X, so that the subsequent upper computer sends the configuration data or the transmission data to the terminal device X through the first communication device a. Further, the life cycle of each record in the terminal equipment recorder is required to be corresponding, the terminal equipment recorder deletes the record when checking the expiration of any record, the situation that the upper computer sends configuration data through the invalid first communication equipment by mistake is avoided, and the accuracy of the configuration of the terminal equipment is ensured.
And in a preset time period after the host computer calls the device interface of the first protocol manager once, a certain first communication device does not receive the device identifier returned by the terminal device, and the first communication device can be confirmed to be not connected to any terminal device. At this time, the upper computer can log off the first communication equipment which does not receive the equipment identifier through the first protocol manager, so as to prevent the communication interface which is not connected to the terminal equipment from being occupied. Further, when the upper computer invokes the discovery device interface of the first protocol manager next time, the released communication interface is configured as the corresponding first communication device again in an initialized mode and registered to the first protocol manager, so that the discovery operation of the terminal device is performed again.
After the host computer stores the first identifier of the first communication device and the device identifier of the terminal device in corresponding communication connection in an associated manner, the user can input configuration data and select the device identifier of the terminal device sent by the configuration data in a corresponding manner, so that the host computer can send the configuration data to the terminal device through the first communication device corresponding to the first identifier stored in the associated manner, and the terminal device can perform application configuration after receiving the configuration data.
In an embodiment, a first protocol manager registers with a first send interface and a first receive callback function and a second protocol manager registers with a second send interface and a second receive callback function. The first sending interface is used for acquiring configuration data input by a user and a selected equipment identifier by the first protocol manager; the second sending interface is used for the second protocol manager to acquire reply data generated by the first application layer of the terminal equipment based on the configuration data; the first receiving callback function is used for transmitting the reply data to a second application layer of the upper computer; the second receive callback function is used to pass the configuration data to the first application layer of the terminal device. It can be understood that the terminal device and the upper computer cooperate to realize the configuration of the terminal device through the first sending interface, the first receiving callback function, the second sending interface and the second receiving callback function.
Fig. 7 is a flowchart of configuring a terminal device by an upper computer according to an embodiment of the present application. As shown in fig. 7, the step of configuring the terminal device by the upper computer specifically includes S210-S240:
S210, the upper computer responds to terminal configuration operation, a first target equipment identifier and configuration data of the terminal configuration operation are transmitted to a first transmitting interface as parameters, a first protocol manager obtains a first identifier stored in an associated mode based on the first target equipment identifier, and the first communication equipment corresponding to the first identifier is controlled to transmit the configuration data.
The terminal configuration operation is an operation of configuring terminal equipment input by a user, the user inputs configuration data and selects a first target equipment identifier of the terminal equipment corresponding to the transmission of the configuration data on the upper computer, then the terminal configuration operation is triggered, and the upper computer transmits the configuration data and the first target equipment identifier of the terminal configuration operation to the first transmitting interface so that the first transmitting interface transmits the configuration data and the first target equipment identifier to the first protocol manager. The first protocol manager queries a terminal device recorder based on the first target device identifier, determines a first identifier stored in association with the first target device identifier, and sends configuration data to the terminal device corresponding to the first target device identifier through the first communication device corresponding to the first identifier. For example, after the first protocol manager obtains the device identifier and the configuration data of the terminal device X from the first transmission interface, the query terminal device recorder determines that the first identifier of the first communication device C is stored in association with the device identifier of the terminal device X, and then the configuration data is transmitted through the first communication device C, and the terminal device X may receive the configuration data from the second communication device D communicatively connected to the first communication device C.
In this embodiment, in order for the terminal device to distinguish three data types, that is, a request message, configuration data, and transparent transmission data, when the first protocol management obtains the configuration data from the first sending interface, the configuration data may be converted into a message that satisfies a preset message format; the terminal equipment can determine that the message is a message for requesting message or configuration data conversion according to the received message type field of the message; after the configuration data is converted into the message meeting the preset message format, the first protocol manager controls the first communication equipment corresponding to the first identifier to send the message corresponding to the configuration data, so that the terminal equipment corresponding to the communication connection of the first communication equipment can receive the message converted by the configuration data.
And S220, when the terminal equipment receives the configuration data, the configuration data and a second identifier corresponding to the second communication equipment are transmitted to a second receiving callback function through a second protocol manager, so that the second receiving callback function transmits the configuration data to the first application layer for processing.
When the second communication device D of the terminal device X receives the configuration data, the second identifier and the configuration data of the second communication device D may be transferred to the second receiving callback function through the second protocol manager, so that the second receiving callback function transfers the configuration data and the second identifier to the first application layer of the terminal device, and the first application layer performs application configuration of the terminal device according to the configuration data and generates reply data for replying success or failure of the configuration to the upper computer.
In this embodiment, when the second communication device receives the third message, the terminal device determines, according to the frame header field and the check field of the third message, whether the format of the third message meets a preset message format; under the condition that the format of the third message meets the preset message format, the terminal equipment determines whether the third message is a message converted by configuration data or not according to the message type field of the third message through the second protocol manager; and under the condition that the third message is the message converted from the configuration data, the terminal equipment extracts the configuration data stored in the data field of the third message through the second protocol manager, and transmits the configuration data and the second identification of the second communication equipment receiving the third message to the second callback receiving function. The third message is a message received by the second communication device at any time, and is identical to the first message in steps S1401-S1403. The second protocol manager can determine that the third message is transparent transmission data when determining that the format of the third message does not meet the preset message format according to the frame header field and the check field of the third message; and determining the third message as a message for requesting message or configuring data conversion according to the message type stored in the message type field of the third message. When the third message is a message converted from the configuration data, the second protocol manager analyzes the third message and acquires the configuration data stored in the data field of the third message, and transmits the configuration data and the second identifier of the second communication device receiving the third message to the second callback receiving function, so that the second callback receiving function transmits the configuration data and the second identifier to the first application layer for processing.
S230, after the terminal equipment processes the configuration data and generates reply data at the first application layer, the reply data and the second identifier are used as parameters to be transferred to the second sending interface, and the second protocol manager controls the corresponding second communication equipment to send the reply data based on the second identifier.
The first application layer generates reply data according to the configuration result after performing application configuration on the terminal device according to the configuration data, and transmits the reply data and the second identifier obtained from the first callback function to the second sending interface, and the second sending interface transmits the reply data and the second identifier to the second protocol manager. After the second protocol manager obtains the reply data and the second identifier from the second sending interface, the reply data is sent through the second communication device corresponding to the second identifier, so that the upper computer receives the reply data through the first communication device in communication connection with the second communication device. For example, if the first application layer obtains the configuration data and the second identifier of the second communication device D in the second receive callback function, after processing the configuration data and generating the reply data, the reply data and the second identifier of the second communication device D are transferred to the second protocol manager through the second sending interface, the second protocol manager sends the reply data through the second communication device D, and the first communication device C communicatively connected to the second communication device D may receive the reply data.
In this embodiment, in order for the host computer to distinguish three message types, that is, a response message, reply data and transparent transmission data, when the second protocol manager obtains configuration data from the second sending interface, the reply data may be converted into a message meeting a preset message format; the upper computer can determine that the message is a response message or a message converted by the response data according to the message type field of the received message; after the reply data is converted into the message meeting the preset message format, the second protocol manager controls the second communication equipment corresponding to the second identifier to send the message corresponding to the reply data.
And S240, when the first communication equipment receives the reply data, the upper computer transmits the reply data to the first callback receiving function through the first protocol manager, so that the first callback receiving function transmits the reply data to the second application layer for processing.
When the first communication device C of the upper computer receives the reply data, the reply data may be transferred to the first receiving callback function through the first protocol manager, so that the first receiving callback function transfers the reply data to the second application layer, and the second application layer confirms that the configuration of the terminal device X is successful or failed according to the reply data, and notifies the user of the result of the configuration success or failure.
In this embodiment, when the upper computer receives the fourth message, the first protocol manager determines, according to the frame header field and the check field of the fourth message, whether the format of the fourth message meets the preset message format; under the condition that the format of the fourth message meets the preset message format, the upper computer determines whether the fourth message is a message replying to data conversion or not according to the message type field of the fourth message through the first protocol manager; and under the condition that the fourth message is the message of the reply data conversion, the upper computer extracts the reply data stored in the data field of the fourth message through the first protocol manager and transmits the reply data to the first callback receiving function. The fourth message is a message received by the first communication device at any time, and is identical to the second message in the step S1501-S1502. The first protocol manager can determine that the fourth message is transparent transmission data when determining that the format of the fourth message does not meet the preset message format according to the frame header field and the check field of the fourth message; and determining the fourth message as a response message or a message for replying to data conversion according to the message type stored in the message type field of the fourth message. When the fourth message is the message of the reply data conversion, the first protocol manager analyzes the fourth message and acquires the reply data stored in the data field of the fourth message, and the reply data is transmitted to the first callback receiving function, so that the first callback receiving function transmits the reply data to the second application layer for processing.
After the upper computer stores the first identifier of the first communication device and the device identifier of the terminal device in corresponding communication connection, the user can input the transparent transmission data and select the device identifier of the terminal device sent by the transparent transmission data, so that the upper computer can send the transparent transmission data to the terminal device through the first communication device corresponding to the first identifier stored in association with the device identifier, and the terminal device processes the received transparent transmission data.
In an embodiment, the first protocol manager registers a third send interface and a third receive callback function, and the second protocol manager registers a fourth send interface and a fourth receive callback function. The third sending interface is used for acquiring transparent transmission data input by a user and a selected equipment identifier by the first protocol manager; the fourth sending interface is used for the second protocol manager to obtain new transparent data generated by the first application layer of the terminal equipment based on the transparent data; the third receiving callback function is used for transmitting the new transparent data to a second application layer of the upper computer; the second receive callback function is used for transferring the transparent data to the first application layer of the terminal device. It can be understood that the terminal device and the upper computer cooperate to realize the processing of the transparent transmission data through the third transmission interface, the third receiving callback function, the fourth transmission interface and the fourth receiving callback function.
Fig. 8 is a flowchart of processing transparent data by an upper computer and a terminal device according to an embodiment of the present application. As shown in fig. 8, the steps of processing the transparent data by the upper computer and the terminal device specifically include S310-S340:
And S310, the upper computer responds to the transparent data transmission operation, and transmits a second target device identifier and transparent data of the transparent data transmission operation as parameters to a third transmission interface, and the first protocol manager acquires a first identifier stored in an associated manner based on the second target device identifier and controls first communication equipment corresponding to the first identifier to transmit the transparent data.
The transparent data sending operation is used for inputting the transparent data to the terminal equipment to process, the user inputs the transparent data on the upper computer and selects the second target equipment identifier of the terminal equipment corresponding to the transparent data to be transmitted, then the transparent data sending operation is triggered, and the upper computer transmits the transparent data and the second target equipment identifier of the transparent data sending operation to the third sending interface, so that the third sending interface transmits the transparent data and the second target equipment identifier to the first protocol manager. The first protocol manager queries a terminal device recorder based on the second target device identifier, determines a first identifier stored in association with the second target device identifier, and sends transparent data to the terminal device corresponding to the first target device identifier through the first communication device corresponding to the first identifier. For example, after the first protocol manager obtains the device identifier and the transparent data of the terminal device Y from the first transmission interface, the query terminal device recorder determines that the first identifier of the first communication device a is stored in association with the device identifier of the terminal device Y, and then the configuration data is transmitted through the first communication device a, and the terminal device Y may receive the configuration data from the second communication device B communicatively connected to the first communication device a.
And S320, when the second communication device receives the transparent transmission data, the terminal device transmits the transparent transmission data and a second identifier corresponding to the second communication device to a fourth receiving callback function through a second protocol manager, so that the fourth receiving callback function transmits the transparent transmission data to the first application layer for processing.
When the second communication device B of the terminal device Y receives the transparent data, the second identifier and the transparent data of the second communication device B may be transferred to the fourth receiving callback function through the second protocol manager, so that the fourth receiving callback function transfers the transparent data and the second identifier to the first application layer of the terminal device, and the first application layer processes the transparent data to generate new transparent data that returns to the upper computer.
In this embodiment, when the terminal device receives the fifth packet, the second protocol manager determines, based on the frame header field and the check field of the fifth packet, whether the fifth packet meets a preset packet format; and under the condition that the fifth message does not meet the preset message format, the upper computer determines that the fifth message is transparent transmission data, and the transparent transmission data and a second identifier of second communication equipment receiving the transparent transmission data are transmitted to a fourth receiving callback function through a second protocol manager. The fifth message is a message received by the second communication device at any time, and is identical to the first message in steps S1401-S1403. And when the second protocol manager determines that the fifth message does not meet the preset message format according to the frame header field and the check field of the fifth message, the second protocol manager can determine that the fifth message is transparent transmission data, and then transmit the transparent transmission data and a second identifier of a second communication device receiving the fifth message to a fourth receiving callback function, so that the fourth receiving callback function transmits the transparent transmission data and the second identifier to the first application layer for processing.
S330, after the terminal device processes the transparent transmission data at the first application layer and generates new transparent transmission data, the new transparent transmission data and the second identifier are transmitted to the fourth transmission interface as parameters, and the second communication device corresponding to the second identifier is controlled by the second protocol manager to transmit the new transparent transmission data.
The first application layer processes the transparent data and generates new transparent data to be returned to the host computer, and then transmits the new transparent data and the second identifier obtained from the third callback function to the fourth sending interface, and the fourth sending interface transmits the new transparent data and the second identifier to the second protocol manager. After the second protocol manager obtains the new transparent data and the second identifier from the fourth sending interface, the second protocol manager sends the new transparent data through the second communication device corresponding to the second identifier, so that the upper computer receives the new transparent data through the first communication device in communication connection with the second communication device. For example, if the first application layer obtains the transparent data and the second identifier of the second communication device B in the fourth receive callback function, after processing the transparent data and generating new transparent data, the first application layer transfers the transparent data and the second identifier of the second communication device B to the second protocol manager through the fourth sending interface, and the second protocol manager sends the new transparent data through the second communication device B, and the first communication device a communicatively connected to the second communication device B may receive the new transparent data.
And S340, when the first communication equipment receives new transparent transmission data, the upper computer transmits the new transparent transmission data to a third receiving callback function through the first protocol manager so that the third receiving callback function transmits the new transparent transmission data to the second application layer for processing.
When the first communication device a of the upper computer receives the new transparent data, the new transparent data may be transferred to the third receiving callback function through the first protocol manager, so that the third receiving callback function transfers the new transparent data to the second application layer, and the second application layer confirms the processing condition of the terminal device Y on the transparent data according to the new transparent data.
In this embodiment, when the upper computer receives the sixth message, the first protocol manager determines, according to the frame header field and the check field of the sixth message, whether the sixth message meets a preset message format; and under the condition that the sixth message does not meet the preset message format, the upper computer determines that the sixth message is new transparent data, and the new transparent data is transmitted to the third receiving callback function through the first protocol manager. The sixth message is a message received by the first communication device at any time, and is identical to the second message in the step S1501-S1502. When the first protocol manager determines that the sixth message does not meet the preset message format according to the frame header field and the check field of the sixth message, the first protocol manager can determine that the sixth message is new transparent data, and then transfer the new transparent data to a third receiving callback function, so that the third receiving callback function transfers the new transparent data to a second application layer for processing.
As can be seen from the foregoing, when the second communication device receives the message, the second protocol manager will respond according to the message being the request message, the message converted by the configuration data or the transparent transmission data, so as to facilitate more visual understanding of the process of the second protocol manager processing the message received by the second communication device, the embodiment is described with reference to the flowchart of the second protocol manager processing the first message received by the second communication device D shown in fig. 9. Referring to fig. 9, after the second communication device D receives the first message, the second protocol manager determines whether the format of the first message meets a preset message format, and if not, determines that the first message is transparent data and transmits the first message to the fourth callback function; if yes, further judging whether the message type stored in the message type field of the first message is a discovery equipment request, if yes, determining that the first message is a request message, generating a response message according to the equipment identification of the terminal equipment and a preset message format, and sending the response message through the second communication equipment D; if not, determining that the first message is the message converted by the configuration data, extracting the configuration data in the first message, and transmitting the second identification and the configuration data of the second communication device D to a second callback function.
Similarly, when the first communication device receives a message, the first protocol manager may take the message as a response message, a message converted by reply data, or new transparent data as a corresponding response, so as to facilitate more visual understanding of the process of the first protocol manager processing the message received by the first communication device, which is described in conjunction with the flowchart of fig. 10 in which the first protocol manager processes the second message received by the first communication device C. Referring to fig. 10, after the first communication device C receives the second message, the first protocol manager determines whether the format of the second message meets a preset message format, and if not, determines that the second message is new transparent data and transmits the second message to the third callback function; if yes, further judging whether the message type stored in the message type field of the second message is a discovery device response, if yes, determining that the second message is a response message, extracting a device identifier in the response message, and storing the device identifier and a first device of the first communication device C in an associated manner; if not, determining the second message as the message of the reply data conversion, extracting the reply data in the second message, and transmitting the reply data to the first callback function.
In summary, according to the communication interface configuration method provided by the embodiment of the application, the communication interface of the communication interface configuration method is initialized to be corresponding to the first communication equipment through the upper computer, the first communication equipment is registered to the first protocol manager, and the communication interface comprises a network card, a serial port, a Bluetooth interface and a wifi interface; the terminal equipment initializes the communication interface of the terminal equipment to corresponding second communication equipment, and registers equipment identifiers of the second communication equipment and the terminal equipment to a second protocol manager; the upper computer controls each registered first communication device to send a request message through a first protocol manager; when any second communication device receives the request message, the terminal device controls the second communication device receiving the request message to send a device identifier through a second protocol manager; when any first communication device receives the device identification, the upper computer stores the device identification and the first communication device which receives the device identification in an associated mode through the first protocol manager. Through the technical means, the communication interfaces such as the network card, the serial port, the Bluetooth and the WIFI of the upper computer and the terminal equipment can be configured as the communication equipment managed by the protocol manager, and the upper computer and the terminal equipment support the communication connection of various communication interfaces, so that the upper computer can configure the terminal equipment by using various communication interfaces at will, the problem that the upper computer cannot configure the terminal equipment through the serial port, the Bluetooth, the WIFI and other communication interfaces in the prior art is solved, and the use scene of the terminal equipment is enlarged.
On the basis of the above embodiments, fig. 11 is a schematic structural diagram of a communication interface configuration device according to an embodiment of the present application. Referring to fig. 11, the communication interface configuration apparatus provided in this embodiment specifically includes: a first registration module 41, a second registration module 42, a discovery request module 43, a discovery response module 44, and an interface configuration module 45.
The first registration module 41 is configured to initialize a communication interface of the host computer to be a corresponding first communication device, register the first communication device to the first protocol manager, and the communication interface comprises a network card, a serial port, a bluetooth interface and a wifi interface;
A second registration module 42 configured to initialize a communication interface of the terminal device to a corresponding second communication device, and register device identifiers of the second communication device and the terminal device to a second protocol manager;
A discovery request module 43 configured to control, by the upper computer, each registered first communication device to send a request message through the first protocol manager;
A discovery response module 44, configured to control, by the terminal device, the second communication device that receives the request message to send the device identifier through the second protocol manager when any second communication device receives the request message;
the interface configuration module 45 is configured to store the device identifier and the first communication device receiving the device identifier in an associated manner through the first protocol manager when any first communication device receives the device identifier.
On the basis of the above embodiment, the first registration module 41 includes: the first interface creation unit is configured to create a first UDP socket interface of each first network card by the upper computer, and bind the first UDP socket interface with the corresponding equipment name of the first network card; the first address binding unit is configured to bind a first UDP socket interface with a first multicast address by the upper computer, wherein the first UDP port number is zero; the first device encapsulation unit is configured to encapsulate the sending function, the receiving function and the cancellation function of the first UDP socket interface into first communication devices corresponding to the first network card by the upper computer.
On the basis of the above embodiment, the second registration module 42 includes: the second interface creation unit is configured to create a second UDP socket interface of each second network card by the terminal equipment, and bind the second UDP socket interface with the equipment name of the corresponding second network card; a second address binding unit configured to bind a second UDP port number and a second multicast address to a second UDP socket interface, where the second UDP port number is not zero, and the second multicast address is the same as the first multicast address; and the second device encapsulation unit is configured to encapsulate the sending function, the receiving function and the cancellation function of the second UDP socket interface into second communication devices corresponding to the second network card by the terminal device.
On the basis of the above embodiment, the first registration module 41 includes: the third device packaging unit is configured to initialize the parameters of each first serial port by the upper computer, and packages the initialized read function, write function and logout function of the first serial port into first communication devices corresponding to the first serial ports; accordingly, the second registration module 42 includes: and the fourth device packaging unit is configured to initialize the parameters of each second serial port by the terminal device, and packages the initialized read function, write function and logout function of the second serial ports into second communication devices corresponding to the second serial ports.
On the basis of the above embodiment, the discovery response module 44 includes: the request message judging unit is configured to determine whether the first message is a request message or not through the second protocol manager based on field information of the first message when the terminal equipment receives the first message from any one of the second communication equipment; the terminal equipment generates a response message meeting a preset message format based on equipment identification of the terminal equipment through the second protocol manager under the condition that the first message is a request message, wherein fields of the preset message format comprise a frame header, an identification, a message type, a data length, data and verification, and the identification fields of the response message store the equipment identification of the terminal equipment; and the response message sending unit is configured to control the second communication equipment receiving the first message to send a response message through the second protocol manager by the terminal equipment.
On the basis of the above embodiment, the request message judging unit includes: the first format judging subunit is configured to determine whether the format of the first message meets a preset message format or not through the second protocol manager according to the frame header field and the check field of the first message; and the second type judging subunit is configured to determine whether the first message is a request message or not according to the message type field of the first message by the second protocol manager when the format of the first message meets the preset message format, and the message type of the request message is a discovery device request.
On the basis of the above embodiment, the second protocol manager registers service information of the terminal device; correspondingly, the response message generating unit comprises: and the response message generation subunit is configured to generate a response message meeting a preset message format by the terminal equipment through the second protocol manager based on the equipment identification and the service information of the terminal equipment, and the service information is stored in a data field of the response message.
On the basis of the above embodiment, the interface configuration module 45 includes: the response message judging unit is configured to determine whether the second message is a response message or not through the first protocol management according to the field information of the second message when any one of the first communication devices receives the second message; the device comprises an identifier storage unit, a terminal device recorder and a communication device recorder, wherein the identifier storage unit is configured to store device identifiers stored in an identifier field of a second message through first protocol management extraction when the second message is a response message, and the device identifiers and the first identifiers of the first communication devices receiving the second message are written into the terminal device recorder in an associated mode.
On the basis of the above embodiment, the response message judgment unit includes: the second format judging subunit is configured to respond to the message judging unit, and the upper computer determines whether the format of the second message meets the preset message format or not through the first protocol manager according to the frame header field and the check field of the second message; the second type judging subunit is configured to determine whether the second message is a response message or not through the first protocol manager according to the message type field of the second message under the condition that the format of the second message meets the preset message format, and the message type of the response message is the response of the discovery device.
On the basis of the embodiment, the data field of the response message stores service information of the terminal equipment; correspondingly, the identification storage unit comprises: the record writing subunit is configured to extract the equipment identifier and the service information respectively stored in the identifier field and the data field of the second message through the first protocol management by the upper computer, and write the equipment identifier, the service information and the first identifier of the first communication equipment receiving the second message into the terminal equipment recorder in an associated manner.
On the basis of the above embodiment, the identifier holding unit further includes: after the association is written into the terminal equipment recorder, if the terminal equipment recorder detects that the same equipment identifier is stored in association with a plurality of first identifiers, the latest written first identifier is reserved in the plurality of first identifiers, and the rest first identifiers are deleted.
On the basis of the above embodiment, the interface configuration module 45 further includes: and the device logout unit is configured to log out the first communication device which does not receive the device identification through the first protocol manager after the device identification is stored in association with the first communication device which receives the device identification through the first protocol manager.
On the basis of the embodiment, the first protocol manager is registered with a first sending interface and a first receiving callback function, and the second protocol manager is registered with a second sending interface and a second receiving callback function;
Correspondingly, the communication interface configuration device further comprises: the configuration data sending module is configured to respond to the terminal configuration operation after the equipment identifier is associated and stored with the first communication equipment which receives the equipment identifier through the first protocol manager, and then the upper computer transmits the first target equipment identifier of the terminal configuration operation and configuration data as parameters to the first sending interface, acquires the first identifier which is associated and stored on the basis of the first target equipment identifier through the first protocol manager, and controls the first communication equipment corresponding to the first identifier to send the configuration data; the configuration data processing module is configured to transmit the configuration data and a second identifier corresponding to the second communication device to a second receiving callback function through the second protocol manager when the terminal device receives the configuration data, so that the second receiving callback function transmits the configuration data and the second identifier to the first application layer for processing; the reply data sending module is configured to send the reply data to the second sending interface by using the reply data and the second identifier as parameters after the terminal equipment processes the configuration data and generates the reply data at the first application layer, and the second protocol manager controls the corresponding second communication equipment to send the reply data based on the second identifier; and the reply data processing module is configured to transmit the reply data to the first receiving callback function through the first protocol manager when the upper computer receives the reply data, so that the first receiving callback function transmits the reply data to the second application layer for processing.
On the basis of the above embodiment, the configuration data transmission module includes: the configuration data conversion unit is configured to convert the configuration data into a message meeting a preset message format through the first protocol manager, the configuration data is stored in a data field of a corresponding message, and the message type of the message corresponding to the configuration data is application configuration data; the configuration data sending unit is configured to control the first communication equipment corresponding to the first identifier to send a message corresponding to the configuration data through the first protocol manager by the upper computer.
On the basis of the above embodiment, the configuration data processing module includes: the third format judging unit is configured to determine whether the format of the third message meets a preset message format according to the frame header field and the check field of the third message when the terminal equipment receives the third message; the third type judging unit is configured to determine whether the third message is a message converted by configuration data or not according to the message type field of the third message through the second protocol manager by the terminal equipment under the condition that the format of the third message meets the preset message format; and the configuration data extraction unit is configured to extract the configuration data stored in the data field of the third message through the second protocol manager and transmit the configuration data and the second identifier of the second communication device receiving the third message to the second callback receiving function when the third message is the configuration data converted message.
On the basis of the above embodiment, the reply data transmitting module includes: the reply data conversion unit is configured to convert the reply data into a message meeting a preset message format through the second protocol manager, the reply data are stored in the data field of the corresponding message, and the message type of the message corresponding to the reply data is application configuration data; and the reply data sending unit is configured to control the second communication equipment corresponding to the second identifier to send a message corresponding to the reply data through the second protocol manager by the terminal equipment.
On the basis of the above embodiment, the reply data processing module includes: the fourth format judging unit is configured to determine whether the format of the fourth message meets a preset message format through the first protocol manager according to the frame header field and the check field of the fourth message when the upper computer receives the fourth message; the fourth type judging unit is configured to determine whether the fourth message is a message for replying to data conversion or not according to the message type field of the fourth message through the first protocol manager when the format of the fourth message meets the preset message format; and the reply data extraction unit is configured to extract the reply data stored in the data field of the fourth message through the first protocol manager and transmit the reply data to the first callback receiving function when the fourth message is the message converted from the reply data.
On the basis of the embodiment, the first protocol manager is registered with a third sending interface and a third receiving callback function, and the second protocol manager is registered with a fourth sending interface and a fourth receiving callback function; correspondingly, the communication interface configuration device comprises: the first transparent data transmission module is configured to respond to transparent data transmission operation after the equipment identifier is stored in association with the first communication equipment receiving the equipment identifier through the first protocol manager, transmit the second target equipment identifier of the transparent data transmission operation and transparent data as parameters to the third transmission interface, acquire the first identifier stored in association based on the second target equipment identifier through the first protocol manager, and control the first communication equipment corresponding to the first identifier to transmit the transparent data; the first transparent transmission data processing module is configured to transmit transparent transmission data and a second identifier corresponding to the second communication device to a fourth receiving callback function through the second protocol manager when the terminal device receives the transparent transmission data, so that the fourth receiving callback function transmits the transparent transmission data to the first application layer for processing; the second transparent transmission data sending module is configured to send the new transparent transmission data and the second identifier to the fourth sending interface as parameters after the terminal equipment finishes processing the transparent transmission data at the first application layer and generates the new transparent transmission data, and the second communication equipment corresponding to the second identifier is controlled by the second protocol manager to send the new transparent transmission data; and the second transparent data processing module is configured to transmit the new transparent data to the third receiving callback function through the first protocol manager when the upper computer receives the new transparent data, so that the third receiving callback function transmits the new transparent data to the second application layer for processing.
On the basis of the above embodiment, the first transparent data processing module includes: the fifth format judging unit is configured to determine whether the fifth message meets a preset message format or not through the second protocol manager based on a frame header field and a check field of the fifth message when the terminal device receives the fifth message; the first transparent transmission data transmission unit is configured to transmit the transparent transmission data and the second identification of the second communication device receiving the transparent transmission data to the fourth receiving callback function through the second protocol manager when the fifth message does not meet the preset message format.
On the basis of the above embodiment, the second transparent data processing module includes: the sixth format judging unit is configured to determine whether the sixth message meets a preset message format or not through the first protocol manager according to a frame header field and a check field of the sixth message when the upper computer receives the sixth message; the second transparent data transmission unit is configured to determine that the sixth message is new transparent data when the sixth message does not meet the preset message format, and transmit the new transparent data to the third receiving callback function through the first protocol manager.
In the above-mentioned, according to the communication interface configuration device provided by the embodiment of the present application, the host computer initializes its own communication interface to the corresponding first communication device, registers the first communication device to the first protocol manager, and the communication interface includes a network card, a serial port, a bluetooth interface and a wifi interface; the terminal equipment initializes the communication interface of the terminal equipment to corresponding second communication equipment, and registers equipment identifiers of the second communication equipment and the terminal equipment to a second protocol manager; the upper computer controls each registered first communication device to send a request message through a first protocol manager; when any second communication device receives the request message, the terminal device controls the second communication device receiving the request message to send a device identifier through a second protocol manager; when any first communication device receives the device identification, the upper computer stores the device identification and the first communication device which receives the device identification in an associated mode through the first protocol manager. Through the technical means, the communication interfaces such as the network card, the serial port, the Bluetooth and the WIFI of the upper computer and the terminal equipment can be configured as the communication equipment managed by the protocol manager, and the upper computer and the terminal equipment support the communication connection of various communication interfaces, so that the upper computer can configure the terminal equipment by using various communication interfaces at will, the problem that the upper computer cannot configure the terminal equipment through the serial port, the Bluetooth, the WIFI and other communication interfaces in the prior art is solved, and the use scene of the terminal equipment is enlarged.
The communication interface configuration device provided by the embodiment of the application can be used for executing the communication interface configuration method provided by the embodiment, and has corresponding functions and beneficial effects.
Fig. 12 is a schematic structural diagram of a communication interface configuration device according to an embodiment of the present application, and referring to fig. 12, the communication interface configuration device includes: processor 51, memory 52, communication device 53, input device 54 and output device 55. The number of processors 51 in the communication interface configuration device may be one or more and the number of memories 52 in the communication interface configuration device may be one or more. The processor 51, memory 52, communication means 53, input means 54 and output means 55 of the communication interface configuration device may be connected by a bus or other means.
The memory 52 is a computer-readable storage medium, and may be used to store a software program, a computer-executable program, and modules, such as program instructions/modules corresponding to the communication interface configuration method of any embodiment of the present application (for example, the first registration module 41, the second registration module 42, the discovery request module 43, the discovery response module 44, and the interface configuration module 45 in the communication interface configuration apparatus). The memory 52 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for functions; the storage data area may store data created according to the use of the device, etc. In addition, memory 52 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, the memory may further include memory remotely located with respect to the processor, the remote memory being connectable to the device through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The communication means 53 are for data transmission.
The processor 51 executes various functional applications of the device and data processing by running software programs, instructions and modules stored in the memory 52, i.e., implements the communication interface configuration method described above.
The input device 54 may be used to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the apparatus. The output means 55 may comprise a display device such as a display screen.
The communication interface configuration device provided by the embodiment can be used for executing the communication interface configuration method provided by the embodiment, and has corresponding functions and beneficial effects.
The embodiments of the present application also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are for performing a communication interface configuration method comprising: initializing a communication interface of the upper computer into corresponding first communication equipment, registering the first communication equipment to a first protocol manager, wherein the communication interface comprises a network card, a serial port, a Bluetooth interface and a wifi interface; the terminal equipment initializes the communication interface of the terminal equipment to corresponding second communication equipment, and registers equipment identifiers of the second communication equipment and the terminal equipment to a second protocol manager; the upper computer controls each registered first communication device to send a request message through a first protocol manager; when any second communication device receives the request message, the terminal device controls the second communication device receiving the request message to send a device identifier through a second protocol manager; when any first communication device receives the device identification, the upper computer stores the device identification and the first communication device which receives the device identification in an associated mode through the first protocol manager.
Storage media-any of various types of memory devices or storage devices. The term "storage medium" is intended to include: mounting media such as CD-ROM, floppy disk or tape devices; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, lanbas (Rambus) RAM, etc.; nonvolatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may also include other types of memory or combinations thereof. In addition, the storage medium may be located in a first computer system in which the program is executed, or may be located in a second, different computer system connected to the first computer system through a network such as the internet. The second computer system may provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations (e.g., in different computer systems connected by a network). The storage medium may store program instructions (e.g., embodied as a computer program) executable by one or more processors.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present application is not limited to the above communication interface configuration method, and may also perform the related operations in the communication interface configuration method provided in any embodiment of the present application.
The communication interface configuration apparatus, the storage medium, and the communication interface configuration device provided in the foregoing embodiments may perform the communication interface configuration method provided in any embodiment of the present application, and technical details not described in detail in the foregoing embodiments may be referred to the communication interface configuration method provided in any embodiment of the present application.
The foregoing description is only of the preferred embodiments of the application and the technical principles employed. The present application is not limited to the specific embodiments described herein, but is capable of numerous modifications, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the application. Therefore, while the application has been described in connection with the above embodiments, the application is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit of the application, the scope of which is set forth in the following claims.

Claims (23)

1. A communication interface configuration method, comprising:
Initializing a communication interface of the upper computer into corresponding first communication equipment, registering the first communication equipment to a first protocol manager, wherein the communication interface comprises a network card, a serial port, a Bluetooth interface and a wifi interface;
the terminal equipment initializes a communication interface of the terminal equipment to corresponding second communication equipment, and registers equipment identifiers of the second communication equipment and the terminal equipment to a second protocol manager;
The upper computer controls each registered first communication device to send a request message through the first protocol manager;
when any one of the second communication devices receives the request message, the terminal device controls the second communication device which receives the request message to send the device identification through the second protocol manager;
And when any one of the first communication equipment receives the equipment identifier, the upper computer stores the equipment identifier and the first communication equipment which receives the equipment identifier in an associated way through the first protocol manager.
2. The communication interface configuration method according to claim 1, wherein the host computer initializes its own communication interface to the corresponding first communication device, comprising:
the method comprises the steps that an upper computer creates a first UDP socket interface of each first network card, and binds the first UDP socket interface with a corresponding equipment name of the first network card;
Binding a first UDP port number and a first multicast address by the upper computer through the first UDP socket interface, wherein the first UDP port number is zero;
and the upper computer packages the sending function, the receiving function and the cancellation function of the first UDP socket interface into first communication equipment corresponding to the first network card.
3. The communication interface configuration method according to claim 2, wherein the terminal device initializes its own communication interface to a corresponding second communication device, comprising:
the terminal equipment creates a second UDP socket interface of each second network card, and binds the second UDP socket interface with the equipment name of the corresponding second network card;
binding a second UDP port number and a second multicast address by the terminal equipment, wherein the second UDP port number is not zero, and the second multicast address is the same as the first multicast address;
And the terminal equipment packages the sending function, the receiving function and the cancellation function of the second UDP socket interface into second communication equipment corresponding to the second network card.
4. The communication interface configuration method according to claim 1, wherein the host computer initializes its own communication interface to the corresponding first communication device, comprising:
the upper computer initializes the parameters of each first serial port, and packages the read function, the write function and the logout function of the initialized first serial port into first communication equipment corresponding to the first serial port;
correspondingly, the terminal device initializes its own communication interface to a corresponding second communication device, including:
the terminal equipment initializes the parameters of each second serial port, and packages the read function, the write function and the logout function of the initialized second serial port into second communication equipment corresponding to the second serial port.
5. The communication interface configuration method according to claim 1, wherein when any one of the second communication devices receives the request message, the terminal device controls, through the second protocol manager, the second communication device that receives the request message to send the device identifier, including:
when the terminal equipment receives a first message from any one of the second communication equipment, determining whether the first message is a request message or not based on field information of the first message through the second protocol manager;
When the first message is the request message, the terminal equipment generates a response message meeting a preset message format based on the equipment identification of the terminal equipment through the second protocol manager, wherein fields of the preset message format comprise a frame header, an identification, a message type, a data length, data and verification, and the identification field of the response message stores the equipment identification of the terminal equipment;
and the terminal equipment controls the second communication equipment which receives the first message to send the response message through the second protocol manager.
6. The method according to claim 5, wherein the determining, by the second protocol manager, whether the first message is a request message based on field information of the first message includes:
the terminal equipment determines whether the format of the first message meets the preset message format or not according to the frame header field and the check field of the first message through the second protocol manager;
And under the condition that the format of the first message meets the preset message format, the terminal equipment determines whether the first message is a request message or not according to a message type field of the first message through the second protocol manager, wherein the message type of the request message is a discovery equipment request.
7. The communication interface configuration method according to claim 5, wherein the second protocol manager registers service information of the terminal device; correspondingly, the terminal equipment generates a response message meeting a preset message format based on the equipment identifier of the terminal equipment through the second protocol manager, and the response message comprises the following components:
and the terminal equipment generates a response message meeting a preset message format based on the equipment identifier of the terminal equipment and the service information through the second protocol manager, and a data field of the response message stores the service information.
8. The method according to claim 1, wherein when any one of the first communication devices receives the device identifier, the host computer stores, by associating the first protocol manager, the device identifier with the first communication device that received the device identifier, including:
When any one of the first communication devices receives a second message, the upper computer determines whether the second message is a response message or not according to field information of the second message through the first protocol management;
and under the condition that the second message is the response message, the upper computer extracts the equipment identifier stored in the identifier field of the second message through the first protocol management, and writes the equipment identifier and the first identifier of the first communication equipment receiving the second message into a terminal equipment recorder in an associated manner.
9. The method for configuring a communication interface according to claim 8, wherein said determining whether the second message is a response message according to field information of the second message by the first protocol management includes:
the upper computer determines whether the format of the second message meets a preset message format or not according to the frame header field and the check field of the second message through the first protocol manager;
And under the condition that the format of the second message meets the preset message format, the upper computer determines whether the second message is a response message or not according to a message type field of the second message through the first protocol manager, wherein the message type of the response message is the response of the discovery equipment.
10. The communication interface configuration method according to claim 8, wherein a data field of the response message stores service information of the terminal device; correspondingly, the upper computer manages and extracts the equipment identifier stored in the identifier field of the second message through the first protocol, and writes the equipment identifier and the first identifier of the first communication equipment receiving the second message into a terminal equipment recorder in an associated manner, wherein the method comprises the following steps:
And the upper computer extracts the equipment identifier and the service information respectively stored in the identifier field and the data field of the second message through the first protocol management, and writes the equipment identifier, the service information and the first identifier of the first communication equipment receiving the second message into a terminal equipment recorder in an associated manner.
11. The communication interface configuration method according to claim 9 or 10, characterized by further comprising, after the association is written to the terminal device recorder:
and if the terminal equipment recorder detects that the same equipment identifier is stored in association with a plurality of first identifiers, reserving the latest written first identifiers in the plurality of first identifiers and deleting the rest first identifiers.
12. The communication interface configuration method according to claim 1, further comprising, after said saving, by said first protocol manager, said device identification in association with a first communication device that received said device identification:
And the upper computer logs off the first communication equipment which does not receive the equipment identification through the first protocol manager.
13. The communication interface configuration method according to claim 1, wherein the first protocol manager registers a first transmission interface and a first reception callback function, and the second protocol manager registers a second transmission interface and a second reception callback function;
Correspondingly, after the device identifier is associated with the first communication device which receives the device identifier by the first protocol manager, the method further comprises:
The upper computer responds to terminal configuration operation, and transmits a first target equipment identifier and configuration data of the terminal configuration operation as parameters to the first transmitting interface, and the first protocol manager acquires a first identifier stored in an associated mode based on the first target equipment identifier and controls first communication equipment corresponding to the first identifier to transmit the configuration data;
When the second communication device receives the configuration data, the terminal device transmits the configuration data and a second identifier of the corresponding second communication device to the second reception callback function through the second protocol manager, so that the second reception callback function transmits the configuration data and the second identifier to the first application layer for processing;
After the terminal equipment finishes processing the configuration data and generates reply data by the first application layer, the reply data and the second identifier are transmitted to the second transmitting interface as parameters, and the corresponding second communication equipment is controlled to transmit the reply data by the second protocol manager based on the second identifier;
When the first communication device receives the reply data, the upper computer transmits the reply data to the first receiving callback function through the first protocol manager, so that the first receiving callback function transmits the reply data to a second application layer for processing.
14. The method for configuring a communication interface according to claim 13, wherein said controlling the first communication device corresponding to the first identifier to transmit the configuration data includes:
The upper computer converts the configuration data into a message meeting a preset message format through the first protocol manager, the configuration data is stored in a data field of a corresponding message, and the message type of the message corresponding to the configuration data is application configuration data;
and the upper computer controls the first communication equipment corresponding to the first identifier to send the message corresponding to the configuration data through the first protocol manager.
15. The communication interface configuration method according to claim 14, wherein the terminal device, when receiving the configuration data by the second communication device, passes the configuration data and a second identification of the corresponding second communication device to the second reception callback function through the second protocol manager, comprising:
when the second communication device receives a third message, the terminal device determines whether the format of the third message meets the preset message format according to a frame header field and a check field of the third message;
under the condition that the format of the third message meets the preset message format, the terminal equipment determines whether the third message is the message converted by the configuration data according to the message type field of the third message through the second protocol manager;
And under the condition that the third message is the message converted by the configuration data, the terminal equipment extracts the configuration data stored in the data field of the third message through the second protocol manager, and transmits the configuration data and a second identifier of a second communication device receiving the third message to the second callback receiving function.
16. The communication interface configuration method according to claim 13, wherein the controlling, by the second protocol manager, the corresponding second communication device to transmit the reply data based on the second identifier includes:
The terminal equipment converts the reply data into a message meeting a preset message format through the second protocol manager, the reply data is stored in a data field of a corresponding message, and the message type of the message corresponding to the reply data is application configuration data;
And the terminal equipment controls the second communication equipment corresponding to the second identifier to send the message corresponding to the reply data through the second protocol manager.
17. The communication interface configuration method according to claim 16, wherein the upper computer, when the first communication device receives the reply data, passes the reply data to the first reception callback function through the first protocol manager, comprising:
when the upper computer receives a fourth message, the first protocol manager determines whether the format of the fourth message meets the preset message format according to a frame header field and a check field of the fourth message;
under the condition that the format of the fourth message meets the preset message format, the upper computer determines whether the fourth message is the message for replying the data conversion according to the message type field of the fourth message through the first protocol manager;
And under the condition that the fourth message is the message of the reply data conversion, the upper computer extracts the reply data stored in the data field of the fourth message through the first protocol manager and transmits the reply data to the first callback receiving function.
18. The communication interface configuration method according to claim 1, wherein the first protocol manager registers a third transmission interface and a third reception callback function, and the second protocol manager registers a fourth transmission interface and a fourth reception callback function;
Correspondingly, after the device identifier is associated with the first communication device which receives the device identifier by the first protocol manager, the method further comprises:
The upper computer responds to the transparent data sending operation, and transmits a second target equipment identifier and transparent data of the transparent data sending operation as parameters to the third sending interface, and the first protocol manager obtains a first identifier stored in an associated mode based on the second target equipment identifier and controls first communication equipment corresponding to the first identifier to send the transparent data;
when the second communication device receives the transparent transmission data, the terminal device transmits the transparent transmission data and a second identifier of the corresponding second communication device to the fourth receiving callback function through the second protocol manager, so that the fourth receiving callback function transmits the transparent transmission data to the first application layer for processing;
after the first application layer processes the transparent transmission data and generates new transparent transmission data, the terminal device transmits the new transparent transmission data and the second identifier as parameters to the fourth transmission interface, and controls the second communication device corresponding to the second identifier to transmit the new transparent transmission data through the second protocol manager;
And when the first communication equipment receives the new transparent transmission data, the upper computer transmits the new transparent transmission data to the third receiving callback function through the first protocol manager so that the third receiving callback function transmits the new transparent transmission data to a second application layer for processing.
19. The communication interface configuration method according to claim 18, wherein the terminal device, when receiving the transparent data by the second communication device, passes the transparent data and a second identifier of the corresponding second communication device to the fourth reception callback function through the second protocol manager, comprising:
when the terminal equipment receives a fifth message, determining whether the fifth message meets a preset message format or not through the second protocol manager based on a frame header field and a check field of the fifth message;
And under the condition that the fifth message does not meet a preset message format, the upper computer determines that the fifth message is the transparent transmission data, and the second protocol manager transmits the transparent transmission data and a second identifier of a second communication device which receives the transparent transmission data to the fourth receiving callback function.
20. The method according to claim 18, wherein the upper computer, when receiving the new transparent data by the first communication device, transfers the new transparent data to the third reception callback function through the first protocol manager, comprising:
When the upper computer receives a sixth message, the first protocol manager determines whether the sixth message meets a preset message format according to a frame header field and a check field of the sixth message;
and under the condition that the sixth message does not meet a preset message format, the upper computer determines that the sixth message is the new transparent data, and the first protocol manager transmits the new transparent data to the third receiving callback function.
21. A communication interface configuration apparatus, comprising:
The first registration module is configured to initialize a communication interface of the upper computer to be corresponding first communication equipment, register the first communication equipment to the first protocol manager, and the communication interface comprises a network card, a serial port, a Bluetooth interface and a wifi interface;
The second registration module is configured to initialize a communication interface of the terminal equipment to be corresponding second communication equipment, and register equipment identifiers of the second communication equipment and the terminal equipment to a second protocol manager;
The discovery request module is configured to control the upper computer to send a request message through the first protocol manager by each registered first communication device;
The discovery response module is configured to control the second communication equipment receiving the request message to send the equipment identifier through the second protocol manager when any one of the second communication equipment receives the request message;
And the interface configuration module is configured to store the equipment identifier and the first communication equipment receiving the equipment identifier in an associated manner through the first protocol manager when any one of the first communication equipment receives the equipment identifier.
22. A communication interface configuration apparatus, comprising:
One or more processors;
A memory storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the communication interface configuration method of any of claims 1-20.
23. A storage medium containing computer executable instructions which, when executed by a computer processor, are for performing the communication interface configuration method of any of claims 1-20.
CN202410304196.7A 2024-03-18 2024-03-18 Communication interface configuration method, device, equipment and storage medium Active CN117938653B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410304196.7A CN117938653B (en) 2024-03-18 2024-03-18 Communication interface configuration method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410304196.7A CN117938653B (en) 2024-03-18 2024-03-18 Communication interface configuration method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN117938653A CN117938653A (en) 2024-04-26
CN117938653B true CN117938653B (en) 2024-06-11

Family

ID=90752203

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410304196.7A Active CN117938653B (en) 2024-03-18 2024-03-18 Communication interface configuration method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117938653B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20000008415A (en) * 1998-07-13 2000-02-07 구자홍 System and method of interfacing between different types of machines
CN109617628A (en) * 2018-12-07 2019-04-12 国网山东省电力公司电力科学研究院 A kind of multiple-in-one acquisition equipment multifunctional detecting device and method
CN110445831A (en) * 2019-06-28 2019-11-12 深圳市紫光同创电子有限公司 A kind of host communicated with FPGA, FPGA interface chip
CN110989551A (en) * 2019-11-22 2020-04-10 天津津航计算技术研究所 Test system based on VxWorks system general interface board
CN112838674A (en) * 2021-01-07 2021-05-25 国网浙江省电力有限公司宁波供电公司 Ground wire monitoring terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8005958B2 (en) * 2003-06-27 2011-08-23 Ixia Virtual interface

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20000008415A (en) * 1998-07-13 2000-02-07 구자홍 System and method of interfacing between different types of machines
CN109617628A (en) * 2018-12-07 2019-04-12 国网山东省电力公司电力科学研究院 A kind of multiple-in-one acquisition equipment multifunctional detecting device and method
CN110445831A (en) * 2019-06-28 2019-11-12 深圳市紫光同创电子有限公司 A kind of host communicated with FPGA, FPGA interface chip
CN110989551A (en) * 2019-11-22 2020-04-10 天津津航计算技术研究所 Test system based on VxWorks system general interface board
CN112838674A (en) * 2021-01-07 2021-05-25 国网浙江省电力有限公司宁波供电公司 Ground wire monitoring terminal

Non-Patent Citations (11)

* Cited by examiner, † Cited by third party
Title
CAN智能节点在电动脱轨器中的应用;李敬民;;铁道机车车辆;20090625(第03期);全文 *
一种UART&SPI接口验证工具的设计与实现;李欣伟;;现代电子技术;20131215(第24期);全文 *
基于CCP协议的PID参数自动标定系统设计;毕栋;周海鹰;王思山;;湖北汽车工业学院学报;20161215(第04期);全文 *
基于DSP和CAN总线的电机监控系统设计;张慧;李智明;;南通纺织职业技术学院学报;20100925(第03期);全文 *
基于LabVIEW与S7-200系列PLC的串口通信研究;王大虎;孙一帆;张且且;;煤矿机电;20131212(第06期);全文 *
基于PCI总线的CAN―ARINC429实时监控卡软件设计与开发;李拥祺;周强;张秀磊;;电子设计工程;20180320(第06期);全文 *
基于SimpliciTI协议的2.4GHz RFID系统分析与设计;王忠勇;卢亮亮;张传宗;;现代电子技术;20110401(第07期);全文 *
基于USB接口的PROFIBUS DP智能从站;罗亮;张贝克;吴重光;;仪表技术与传感器;20070515(第05期);全文 *
基于VxWorks系统的端口初始化软件设计;焦斌;;电子测试;20160715(第14期);全文 *
基于XMC4500的智能USB-CAN接口模块设计;何海波;;计算机测量与控制;20150325(第03期);全文 *
复用电源导线的客车CAN总线技术的应用研究;葛红宇;王中镇;张晓全;;机电产品开发与创新;20110328(第02期);全文 *

Also Published As

Publication number Publication date
CN117938653A (en) 2024-04-26

Similar Documents

Publication Publication Date Title
US11075821B2 (en) Method and apparatus for managing field device based on cloud server
CN113411215B (en) Time-sensitive network centralized user configuration method and system based on OPC UA
US20120317254A1 (en) Network platform in a network device ecosystem
US20120158839A1 (en) Wireless network interface with infrastructure and direct modes
US8386614B2 (en) Network connection manager
US10499311B2 (en) Method and apparatus for implementing network sharing
EP2353258B1 (en) Client - server communications in mobile radio communications device
JP5122587B2 (en) Connection control method, connection control server device, connection control client device, connection control system, and program
CN111464419A (en) Data transmission control method based on bus network communication
CN105554042A (en) Method and system for UDP tele-transmission log
CN106850554B (en) Method and device for dual-system directional connection
CN115361704A (en) C2D communication system and I/O data communication method based on base station MAC sublayer direct transmission
CN117938653B (en) Communication interface configuration method, device, equipment and storage medium
CN110062016B (en) Method and device for trusted service management
CN110430478B (en) Networking communication method, device, terminal equipment and storage medium
CN110661850B (en) Edge calculation method, system, computer equipment and storage medium
CN101656722B (en) Method for generating dynamic host configuration protocol (DHCP) snooping binding information, and device thereof
CN107995184B (en) Connector and communication method using same
CN114731302B (en) Information transmission method and related equipment
CN103746887A (en) Method for activating locomotive access network
KR101651317B1 (en) Method and system for processing a plurality of radiofrequency communication streams by way of an integrated circuit card
CN102255872A (en) Method and device for accessing non-remote object
CN111314477A (en) P2P communication method, system, home gateway, electronic device and storage medium
KR20200054838A (en) Method for converting and interworking modbus protocol, and apparatuses performming the same
CN110190985A (en) The method that management equipment is managed remote storage device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant