Equipment testing system, method, computer equipment and storage medium
Through the combination of the serial port server and the wireless communication module, the driver and protocol of the serial port device are automatically identified and adapted to the serial port device, which solves the problems of complex operation and poor compatibility in traditional tests, and realizes efficient device testing.
Patent Information
- Application Number
- CN202510696718.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-05-28
AI Technical Summary
In testing of traditional serial port equipment, driver and configuration protocol conversion tools need to be frequently installed, which are complex in operation and poor compatibility, resulting in inefficient testing.
The serial port server is used to connect the serial port equipment and the general server with the wireless communication module. Through the built-in processing module, it automatically recognizes and adapts the target analog driver and protocol characteristics to realize wireless communication and data conversion, avoid manually installing the driver and automatically converting the protocol.
It improves the convenience and efficiency of equipment testing, reduces cumbersome wiring and line winding problems, and ensures the compatibility and stability of different serial port equipment.
Smart Images

Figure CN120216273B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of device testing technology, and in particular to a device testing system, method, computer device, and storage medium. Background Art
[0002] Amidst the ongoing advancement of information technology, general-purpose servers play a core role in data processing and computing across various industries. With the rapid development of emerging technologies such as the Internet of Things and Industry 4.0, an increasing number of devices are connecting to general-purpose servers via serial communication for data exchange and control. In the early days, serial communication primarily relied on serial cables, which met the needs of limited device connection scenarios. However, as the industry expanded, a large number of serial devices needed to be connected to general-purpose servers for testing and data transmission, and the drawbacks of traditional serial cable connections became increasingly apparent. At the same time, wireless communication technology has rapidly advanced, with technologies such as Wi-Fi and Bluetooth widely used in consumer electronics. 5G / 4G technologies have demonstrated significant advantages in mobile data transmission, providing technical support for the wireless transformation of serial communication.
[0003] However, serial devices of different brands and models often require the installation of their own drivers to enable proper communication between laptops and general-purpose servers. Furthermore, the network protocols compatible with laptops and general-purpose servers can differ significantly. The related art requires frequent installation of corresponding drivers and the configuration of multiple protocol conversion tools when using different types of serial devices, resulting in complex operations and poor compatibility. Summary of the Invention
[0004] The present application provides a device testing system, method, computer device and storage medium to at least solve the technical problems in the related art of frequently installing the corresponding drivers of the serial port devices and additionally configuring multiple protocol conversion tools when using different types of serial port devices, resulting in complex operation and poor compatibility.
[0005] This application provides a device testing system, comprising:
[0006] Serial port devices;
[0007] General purpose server;
[0008] Serial device server, which communicates with serial device and general server respectively;
[0009] A first communication module and a second communication module, the first communication module is communicatively connected to the serial port server, and the second communication module is communicatively connected to the controller and the first communication module respectively;
[0010] The serial port server has a built-in processing module. In response to the processing module obtaining the test instructions and control data sent by the controller, the processing module determines the target simulation driver and target protocol characteristics of the serial port device, and performs protocol conversion on the test instructions according to the target protocol characteristics. The target simulation driver is used to perform data conversion processing on the control data to obtain target control data that can be recognized by the general server. The serial port device receives and executes the converted test instructions to generate response data. In response to the general server obtaining the target control data and response data, the general server is guided to generate a test log based on the target control data.
[0011] This application also provides a device testing method, including:
[0012] In response to the serial port server receiving the test instruction and control data sent by the controller, the serial port server obtains the serial port device feature information and the serial port device feature information set; the serial port server searches for target serial port device feature information that matches the serial port device feature information from the serial port device feature information set, determines the target serial port device type based on the target serial port device information; obtains the target driver type and target protocol features corresponding to the target serial port device type;
[0013] The serial device server transmits the test command to the built-in processing module of the serial device server;
[0014] In response to the processing module receiving the test instruction, the processing module obtains the target driver type and the target protocol characteristics, and selects a target simulation driver matching the target driver type from the simulation driver library based on the target driver type;
[0015] The processing module performs protocol conversion on the test instruction to obtain a conversion test instruction, the conversion test instruction meets the requirements of the target protocol characteristics, and transmits the conversion test instruction to the serial port device;
[0016] In response to the serial port server receiving the control data, the target analog driver is used to perform data conversion processing on the control data to obtain target control data that can be recognized by the general server;
[0017] In response to the serial port device receiving the conversion test instruction, the serial port device executes the conversion test instruction, obtains response data, and transmits the response data to the serial port server;
[0018] In response to the universal server receiving the response data and the target control data, the universal server is directed to print the response data based on the target control data to generate a test log.
[0019] The present application also provides a computer device, including: a memory for storing a computer program; and a processor for implementing the steps of the device testing system in the following embodiments when executing the computer program.
[0020] In response to the serial port server receiving the test instruction and control data sent by the controller, the serial port server obtains the serial port device feature information and the serial port device feature information set; the serial port server searches for target serial port device feature information that matches the serial port device feature information from the serial port device feature information set, determines the target serial port device type based on the target serial port device information; obtains the target driver type and target protocol features corresponding to the target serial port device type;
[0021] The serial device server transmits the test command to the built-in processing module of the serial device server;
[0022] In response to the processing module receiving the test instruction, the processing module obtains the target driver type and the target protocol characteristics, and selects a target simulation driver matching the target driver type from the simulation driver library based on the target driver type;
[0023] The processing module performs protocol conversion on the test instruction to obtain a conversion test instruction, the conversion test instruction meets the requirements of the target protocol characteristics, and transmits the conversion test instruction to the serial port device;
[0024] In response to the serial port server receiving the control data, the target analog driver is used to perform data conversion processing on the control data to obtain target control data that can be recognized by the general server;
[0025] In response to the serial port device receiving the conversion test instruction, the serial port device executes the conversion test instruction, obtains response data, and transmits the response data to the serial port server;
[0026] In response to the universal server receiving the response data and the target control data, the universal server is directed to print the response data based on the target control data to generate a test log.
[0027] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the device testing system in any of the following embodiments are implemented.
[0028] In response to the serial port server receiving the test instruction and control data sent by the controller, the serial port server obtains the serial port device feature information and the serial port device feature information set; the serial port server searches for target serial port device feature information that matches the serial port device feature information from the serial port device feature information set, determines the target serial port device type based on the target serial port device information; obtains the target driver type and target protocol features corresponding to the target serial port device type;
[0029] The serial device server transmits the test command to the built-in processing module of the serial device server;
[0030] In response to the processing module receiving the test instruction, the processing module obtains the target driver type and the target protocol characteristics, and selects a target simulation driver matching the target driver type from the simulation driver library based on the target driver type;
[0031] The processing module performs protocol conversion on the test instruction to obtain a conversion test instruction, the conversion test instruction meets the requirements of the target protocol characteristics, and transmits the conversion test instruction to the serial port device;
[0032] In response to the serial port server receiving the control data, the target analog driver is used to perform data conversion processing on the control data to obtain target control data that can be recognized by the general server;
[0033] In response to the serial port device receiving the conversion test instruction, the serial port device executes the conversion test instruction, obtains response data, and transmits the response data to the serial port server;
[0034] In response to the universal server receiving the response data and the target control data, the universal server is directed to print the response data based on the target control data to generate a test log.
[0035] The device testing system provided by the present application includes: a serial port device, a general server, a serial port server, a first communication module, and a second communication module. The serial port server is respectively connected to the serial port device and the general server; the first communication module is connected to the serial port server, and the second communication module is respectively connected to the controller and the first communication module; the serial port server has a built-in processing module. In response to the processing module obtaining the test instructions and control data sent by the controller, the processing module determines the target simulation driver and target protocol characteristics of the serial port device, performs protocol conversion on the test instructions according to the target protocol characteristics, uses the target simulation driver to perform data conversion processing on the control data, and obtains target control data that can be recognized by the general server. The serial port device receives and executes the converted test instructions to generate response data. In response to the general server obtaining the target control data and response data, the general server is instructed to generate a test log based on the target control data.
[0036] In this way, wireless communication connection is achieved between the controller and the serial port server through the first communication module and the second communication module, avoiding the installation of a large number of serial port cables and the problem of line entanglement. The target simulation driver of the serial port device is determined by the processing module of the serial port server, and there is no need to install the corresponding driver of the serial port device on the controller side. The test instructions of the controller are converted according to the target protocol characteristics, and the converted test instructions are sent to the serial port device to achieve protocol adaptation between the controller and the serial port device. The control data is converted and processed using the target simulation driver to obtain target control data that can be recognized by the general server, so that the target control data is adapted to the general server. The serial port device receives and executes the conversion test instruction to generate response data. The general server obtains the target control data and response data, and guides the general server to generate a test log based on the target control data, which can achieve the technical effect of improving the efficiency and convenience of equipment testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0038] Figure 1 A schematic diagram of the structure of a device testing system provided in an embodiment of the present application;
[0039] Figure 2 A schematic diagram of the structure of the processing module provided in an embodiment of the present application;
[0040] Figure 3 A schematic diagram of the structure of the driving service platform provided in an embodiment of the present application;
[0041] Figure 4 A schematic diagram of a flow chart of a device testing method provided in an embodiment of the present application;
[0042] Figure 5 A structural block diagram of the device testing apparatus provided in an embodiment of the present application;
[0043] Figure 6 This is a diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0045] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0046] During device testing, connecting a laptop to a serial server using a serial cable is an extremely cumbersome task. This is especially true in large test sites, where numerous test devices need to be connected. The intertwining of numerous serial cables not only increases wiring time and costs, but also easily leads to problems such as tangling and damage, severely impacting test efficiency. Furthermore, serial cables have a limited transmission distance. Typically, RS232 serial cables have an effective transmission distance of only about 15 meters. While RS485 serial cables can reach up to a kilometer, long-distance transmission in complex industrial environments still faces issues such as signal attenuation and interference, significantly limiting the deployment of test equipment.
[0047] Serial devices of different brands and models often need to install their own corresponding drivers in order to achieve normal communication between laptops and general servers. This process is complicated and requires testers to have certain professional knowledge. For some older devices, there may be problems such as difficulty in obtaining drivers and incompatibility with new operating systems. For example, in the field of industrial automation, the drivers of some early-produced serial sensors only support Windows XP systems and cannot be installed and used under the current mainstream Windows 10 or even higher versions. This makes it difficult for these devices to connect to general servers for testing and data transmission. In addition, when testing multiple different types of serial devices, frequent installation and uninstallation of drivers is not only time-consuming and labor-intensive, but also easily causes system conflicts, further reducing the stability and reliability of the testing work.
[0048] Common communication protocols for serial devices, such as RS232 and RS485, differ significantly from network protocols like TCP / IP, commonly used in laptops and general-purpose servers. Protocol conversion is required during data transmission, but existing protocol conversion devices or software often have limited functionality, supporting only a few specific protocols and failing to meet the increasingly diverse access needs of serial devices. This often requires the configuration of multiple protocol conversion tools when testing serial devices with different protocols, increasing testing cost and complexity and becoming a major obstacle to efficient data transmission during device testing.
[0049] As can be seen, in the device testing phase, the traditional method relies on connecting the laptop to the serial cable, which is not only cumbersome to wire but also requires the installation of corresponding drivers, making the operation complicated and compatibility poor. This application further aims to use wireless technology to completely replace the serial cable connection, realizing convenient communication between the test equipment and the general server. At the same time, through innovative design, it can achieve automatic adaptation or protocol conversion of various drivers, avoiding the cumbersome driver installation process, and significantly improving the efficiency and convenience of server serial communication.
[0050] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0051] like Figure 1 As shown, an embodiment of the present application provides a device testing system, which specifically includes: a serial port device, a general server, a serial port server, a first communication module, a second communication module and a controller (laptop computer).
[0052] Serial port devices are devices that are connected to the serial communication interface on computers or other electronic devices, receive / return data through the serial port, and simulate actual industrial equipment.
[0053] A general-purpose server is used to provide various services or resources for other devices or programs to access and use, run test service programs, monitor data forwarded by the serial port server, and process and record test results.
[0054] The controller can be a laptop computer. The controller sends test instructions to the serial port server for monitoring the response of the general server and data analysis.
[0055] Serial device server, which communicates with serial devices and general servers respectively, is used to access serial devices, obtain serial device feature information, perform data conversion, and realize the communication bridge between serial devices and the network.
[0056] The first communication module communicates with the serial port server, while the second communication module communicates with the controller and the first communication module, respectively. Both modules utilize wireless direct connection technology. When the serial port server and controller are in close proximity, the first communication module corresponding to the serial port server and the second communication module corresponding to the controller will mutually identify the device type and supported communication protocols, quickly establishing a connection and enabling wireless data transmission between the serial port server and the controller, thus eliminating the need for serial cable connections. For example, when testing industrial automation equipment, a technician can enter the test area with a laptop loaded with test software. The laptop and serial port server are instantly connected via the wireless direct connection module, allowing them to begin testing communications without the need for manual serial cable connections.
[0057] The first communication module and the second communication module can specifically build a wireless connection channel based on Wi-Fi Direct or Bluetooth Mesh technology. Their operating frequency bands are 2.4GHz and 5GHz dual bands, supporting IEEE802.11n / ac protocols. The maximum transmission rate can reach 150Mbps in the 2.4GHz band and 433Mbps in the 5GHz band.
[0058] The first communication module also includes a first gain antenna, and the second communication module also includes a second gain antenna. The first gain antenna and the second gain antenna can be high-gain antennas. The first gain antenna and the second gain antenna are configured to enhance the wireless signal transmission distance and stability.
[0059] The first communication module also includes a first identification unit and a first storage unit, and the second communication module also includes a second identification unit and a second storage unit. The first identification unit is communicatively connected to the first storage unit, and the second identification unit is communicatively connected to the second storage unit. The first identification unit and the second identification unit perform connection identification based on the information stored in the first storage unit and the information stored in the second storage unit, respectively, to establish a wireless communication connection between the first communication module and the second communication module.
[0060] Among them, the first storage unit stores the serial port device feature information set and the first communication module identification information, the serial port device feature information set includes the serial port device manufacturer information, the serial port device model information, the serial port device feature code information, and the communication protocol feature information corresponding to the serial port device; the first communication module identification information includes the first communication module broadcast information and the first communication module Bluetooth address; the second storage unit stores the second communication module identification information, and the second communication module identification information includes the second communication module broadcast information and the second communication module Bluetooth address.
[0061] Here, the serial device signature generally refers to a unique identifier used to identify a specific serial device. These signatures may include information such as the device's PID (Product ID), VID (Vendor ID), and device path.
[0062] During the initial connection between the controller and the serial port server, the first identification unit on the serial port server retrieves the first communication module identification information from the first storage unit, and the second identification unit on the controller retrieves the second communication module identification information from the second storage unit. A wireless communication connection is established between the serial port server and the controller using the first and second communication module identification information. When a serial port device is connected, the serial port server can retrieve the serial port device feature information of the connected serial port device and simultaneously search the set of serial port device feature information stored in the first storage unit for a serial port device type that matches the serial port device feature information, using this as the target serial port device type for the connected serial port device.
[0063] The first storage unit and the second storage unit can be information databases, specifically SQLite databases. In one embodiment, for a serial port sensor device, the storage format can be [specific ID value] for its manufacturer ID, [specific model] for its device model, [specific feature code] for its feature code, and RS-485 for its communication protocol. A hash table or tree data structure can be used to store the serial port device feature information set to improve query efficiency.
[0064] For example, a tree data structure may be established to store the serial port device feature information set, with nodes representing various serial port device types and child nodes representing the manufacturer ID, device model, and device feature code corresponding to the serial port device.
[0065] In one embodiment, the first communication module further includes a first wireless connection circuit, and the second communication module includes a second wireless connection circuit; the printed circuit boards corresponding to the first wireless connection circuit and the second wireless connection circuit include, from top to bottom, a radio frequency signal layer, a ground layer, a power supply layer, and a digital signal layer;
[0066] RF routing is set on the RF signal layer, RF ground area and digital ground area are set on both sides of the ground layer, the digital ground area and the RF ground area are connected at a single point, digital power supply and RF power supply are set on both sides of the power layer, the digital power supply and the RF power supply are isolated by slots, and digital routing and filtering circuits are set on the digital signal.
[0067] Independent wireless connection circuits are designed for the communication modules on the serial port server and controller sides, respectively. A four-layer printed circuit board design separates the power and ground planes to reduce signal interference. The RF power supply and digital power supply are physically isolated, and the RF circuit is located close to the antenna interface to reduce signal transmission loss. A filter circuit can also be included in the wireless connection module circuit to filter the power input, remove clutter interference, and ensure stable chip operation. A high-gain antenna is also used to enhance wireless signal transmission distance and stability. Ensure good electrical isolation and compatibility between the communication module and the serial port server and other laptop hardware modules to prevent signal interference.
[0068] In one embodiment, a supercapacitor (e.g., 5V / 1F) can be built into the second communication module to support resuming transmission after a short power outage. A common-mode choke can be connected in series with the UART line on the serial port server to suppress high-frequency noise. Time division multiplexing (TDM) or CSMA / CA protocols (e.g., Wi-Fi) can also be used to prevent data collisions and conflicts caused by multiple devices connecting simultaneously.
[0069] The serial port server has a built-in processing module. In response to the processing module obtaining the test instructions and control data sent by the controller, the processing module determines the target simulation driver and target protocol characteristics of the serial port device, and performs protocol conversion on the test instructions according to the target protocol characteristics. The target simulation driver is used to perform data conversion processing on the control data to obtain target control data that can be recognized by the general server. The serial port device receives and executes the converted test instructions to generate response data. In response to the general server obtaining the target control data and response data, the general server is guided to generate a test log based on the target control data.
[0070] like Figure 2 As shown, the processing module includes a simulated driver library and a protocol library. The simulated driver library includes simulated drivers for serial port devices and covers the vast majority of serial port device drivers on the market. The protocol conversion module includes a protocol library; this library includes the protocol features of the serial port protocol corresponding to the serial port device, the protocol features of the communication protocol corresponding to the controller, and the protocol conversion solution between the serial port protocol and the communication protocol.
[0071] In this application, you can obtain driver information for various serial devices through various channels, such as the manufacturer's official website, technical manuals, and open source communities. This driver information is organized and analyzed to extract key device identification information, data transmission interface functions, and interrupt handling mechanisms. For example, for a serial device commonly used in industrial automation, the device's identification ID is [specific ID value], the data read function is ReadData([parameter list]), and the interrupt handling function is InterruptHandler().
[0072] Build a corresponding set of simulated driver functions based on different device types. Programming can be done in C, utilizing object-oriented programming principles to encapsulate the driver logic. Create a driver class [ClassName] that includes the initialization function InitDriver(), which initializes the simulated driver and sets device parameters and data buffers; the data read and write functions ReadData() and WriteData(), which simulate device data read and write operations, respectively; and the error handling function ErrorHandler(), which handles errors during data transmission. By simulating real device responses, a unified interface is provided to upper-layer applications in the test environment, ensuring stable and easy-to-use simulated driver functions for different serial port devices. Device parameters may include: communication protocol parameters, which define the protocol types and formats supported by the device; device identification parameters, which uniquely identify the device's manufacturer and model; timing control parameters, which set timing behaviors such as response delay and timeout; and function limitation parameters, which simulate the device's physical limitations (such as maximum input voltage and sampling rate).
[0073] The data buffer can include a receive buffer, a send buffer, and a protocol parsing buffer. The receive buffer stores raw data (e.g., TCP / IP packets) received from a laptop or server, such as a ring buffer. The size is typically 1KB to 4KB (depending on the protocol frame length). The send buffer stores converted data (e.g., RS-485 frames) to be sent to the serial device, such as a FIFO queue, with dynamic expansion (e.g., initially 512B, then expanded as needed). The protocol parsing buffer temporarily stores intermediate protocol parsing results (e.g., the CRC checksum for Modbus RTU), such as a static array (fixed size).
[0074] The simulation driver function set of this application supports dynamic link library loading, and can load the matching simulation driver through the system API (such as Windows's LoadLibrary()), and use the driver function to call the standard interface function in the driver class (such as InitDriver(), ReadData()) to convert the data into a format that can be recognized by the general server (such as JSON or TCP / IP packet).
[0075] This application also analyzes the differences between common serial communication protocols (such as RS-232 and RS-485) and target communication protocols (such as TCP / IP). For example, consider converting RS-232 to TCP / IP. RS-232 uses asynchronous serial communication, with a data format consisting of start, data, parity, and stop bits. TCP / IP, on the other hand, is a network-based transmission control protocol that transmits data in packets. Detailed conversion rules are developed, such as removing the start and stop bits from the RS-232 data frame, extracting the data and parity bits, encapsulating them in the TCP / IP format, and adding header information such as the IP address and port number, to achieve conversion from the serial communication protocol to the target communication protocol.
[0076] In programming implementation, the state machine can be used as the core architecture to decompose the protocol conversion process into multiple states, such as data receiving state, data parsing state, data encapsulation state, data sending state, etc. The corresponding conversion operation is performed according to the data input state.
[0077] like Figure 2 As shown, the processing module also includes a data cache and processing module, a communication management module and a security encryption module.
[0078] The data cache and processing module, also known as the storage unit, is designed with a ring buffer structure to achieve efficient circular data access, effectively utilizing memory space and enabling fast data reading and writing. The C++ language was chosen for coding, leveraging its powerful memory management capabilities and efficient execution. Multithreading technology enables parallel data processing, improving processing speed. During implementation, the buffer size is dynamically adjusted based on hardware characteristics to ensure smooth data processing.
[0079] Communication Management Module: The design is based on an event-driven model and can respond to various communication events in real time. Specifically, the communication management module responds to serial device access in real time based on the event-driven model. It obtains serial device feature data in a lock-free manner through a ring buffer, and quickly matches it with the simulation driver library and protocol library to achieve plug-and-play driver loading and data conversion. It can be coded in Python, and with the help of its rich network library, a communication framework can be quickly established. By establishing a communication session pool, connections between different devices are managed to improve communication efficiency. Load balancing algorithms can also be introduced to reasonably distribute communication tasks to avoid excessive load on a single connection. Dynamic load balancing algorithms are used to distribute communication tasks to multiple devices. Combined with real-time queue monitoring, single connection overload is avoided to ensure system stability and resource utilization.
[0080] The security encryption module uses the AES encryption algorithm to ensure data transmission security. Coded in Java, it leverages its built-in security library to simplify the encryption process. Digital certificate authentication verifies the identities of both communicating parties and prevents unauthorized access. AES encryption ensures data transmission confidentiality, while digital certificate-based two-way authentication prevents unauthorized access, ensuring end-to-end communication security. Regular encryption key updates during implementation enhance system security.
[0081] In a specific example, a listening program runs on the serial port server, and the controller sends test instructions and control data to the serial port server via a Netcat or Telnet network tool. In response to the serial port server receiving the test instructions and control data, the serial port server obtains serial port device feature information and a serial port device feature information set. The serial port server searches the serial port device feature information set for target serial port device feature information that matches the serial port device feature information, and determines the target serial port device type based on the target serial port device information. The serial port server obtains a target driver type and a target protocol feature corresponding to the target serial port device type. The serial port server performs protocol conversion on the test instruction based on the target protocol feature to ensure that the test instruction meets the protocol requirements of the serial port device, and forwards the protocol conversion test instruction to the serial port device. The serial port device executes the protocol conversion test instruction and returns response data. The serial port server also performs data conversion on the controller data to generate target controller data recognized by the general server. The serial port device receives and executes the conversion test instruction to generate response data. In response to the general server obtaining the target control data and response data, the general server is instructed to generate a test log based on the target control data. In this way, data transmission and processing efficiency can be improved, ensuring smooth operation of the system under complex tasks.
[0082] In one embodiment, the device testing system also includes an update module, which is used to collect new serial port device information and update the serial port device feature set, simulation driver library, and protocol library based on the new serial port device information. A cloud-based driver service platform (update module) can be established as background support for the processing module. This platform collects and organizes the latest serial port device driver and protocol information in real time and regularly updates the simulation driver library and protocol library. When the serial port server encounters a new serial port device or an unknown protocol, it can automatically initiate a request to the cloud-based driver service platform to obtain the latest simulation driver and protocol conversion solution, thereby achieving self-update and upgrade. For example, when testing a new smart home device, if a new serial port device protocol appears, the serial port server obtains relevant information through the cloud-based driver service platform, quickly completes the update of its own software system, and thus successfully completes the testing of the new device.
[0083] like Figure 3As shown in Figure 1, the cloud-based driver service platform consists of a server cluster, a data processing and management module, and a data storage module. Each node in the server cluster collects data and transmits it to the big data analysis engine, which then passes the analysis results to the processing module. The processing module updates the simulation driver library and protocol library based on the analysis results. These two databases push driver updates and protocol conversion solution updates to different serial port servers, respectively, ensuring that the serial port servers can adapt to new serial port devices and protocol changes.
[0084] The first storage unit and the second storage unit of the present application can continuously expand the content of the feature library by regularly downloading updates from the cloud-based driver service platform. The update process adopts an incremental update method, downloading only the changed parts, reducing the amount of data transmission and update time. For example, when the cloud-based driver service platform detects that the communication protocol of a certain type of serial port device has changed, it only pushes the changed protocol feature data to the storage unit of the smart identification chip.
[0085] The real-time update function of the cloud-based driver service platform ensures that the serial device server can promptly adapt to changes in new serial devices and communication protocols. In the face of constantly updated test equipment, it always maintains good compatibility and testing capabilities, providing strong support for the continuous development of equipment testing.
[0086] In this application, by setting up the collaborative work of analog driver and protocol intelligent conversion software system as well as cloud driver service and update mechanism, the serial port server can automatically adapt to various serial port device drivers, eliminating the need to manually install the driver on the laptop side, effectively solving the problems of cumbersome driver installation and poor compatibility.
[0087] In a feasible implementation, the serial port server can be set as a hot-swappable device that supports multiple interfaces. By plugging the hot-swappable device that supports multiple interfaces into the serial port device, communication between the notebook and the serial port device can be achieved. The functions of the first communication module and the second communication module are integrated into the hot-swappable device, which can reduce costs.
[0088] like Figure 4 As shown, an embodiment of the present application provides a device testing system, the method specifically comprising the following steps:
[0089] Step 101: In response to the serial port server receiving the test instruction and control data sent by the controller, the serial port server obtains serial port device feature information and a serial port device feature information set; the serial port server searches for target serial port device feature information that matches the serial port device feature information from the serial port device feature information set, determines the target serial port device type based on the target serial port device information; and obtains the target driver type and target protocol features corresponding to the target serial port device type.
[0090] Specifically, a serial port device feature information set is obtained from the first identification unit of the first communication module, and the serial port device feature information is fuzzy matched with the serial port device feature information set; it is determined whether the serial port device feature information set includes target serial port device feature information that matches the serial port device feature information; if included, the target serial port device type is determined according to the target serial port device feature information, and the target driver type and target protocol features corresponding to the target serial port device type are searched from the simulation driver library and protocol library in the processing module of the serial port server; if not included, the protocol conversion scheme corresponding to the serial port device feature information is determined, and the serial port device feature information set is updated based on the protocol conversion scheme corresponding to the serial port device feature information.
[0091] For serial devices, information such as handshake signals and device IDs is collected; for wireless devices, information such as device broadcast information and Bluetooth addresses is collected. The collected feature data is compared with the information in the serial device feature information set. A fuzzy matching algorithm is used. When the serial device feature information set and the serial device feature information are not completely consistent, a match is made based on a preset similarity threshold. For example, when the similarity threshold is set to 80%, if the collected serial device feature information and the feature information of a particular serial device in the serial device feature information set are at least 80% similar, the match is considered successful. The target serial device type corresponding to the serial device feature information is then obtained. Based on the serial device type, the target driver type and target protocol features corresponding to the target serial device type are determined from the simulation driver library and protocol library.
[0092] Step 102: The serial device server transmits the test instruction to the processing module built into the serial device server.
[0093] Step 103: In response to the processing module receiving the test instruction, the processing module obtains the target driver type and the target protocol characteristics, and selects a target simulation driver that matches the target driver type from the simulation driver library based on the target driver type.
[0094] Step 104: The processing module performs protocol conversion on the test instruction to obtain a converted test instruction. The converted test instruction meets the requirements of the target protocol characteristics and is transmitted to the serial port device.
[0095] Specifically, a conversion protocol feature type of a conversion protocol corresponding to a test instruction and a target protocol feature type of a serial port protocol corresponding to a serial port device are obtained, wherein the target protocol feature type is a first target protocol feature type or a second target protocol feature type; in response to the target protocol feature type being the first target protocol feature type, a first protocol conversion scheme corresponding to the first target protocol feature is obtained, and the test instruction is subjected to protocol conversion based on the first protocol conversion scheme to obtain a conversion test instruction; wherein, performing protocol conversion on the test instruction based on the first protocol conversion scheme to obtain the conversion test instruction includes: parsing a data packet of the conversion protocol, removing header information of the data packet, and retaining application layer data; calculating a cyclic redundancy check code based on the application layer data, performing level conversion, and generating a protocol frame corresponding to the first target protocol feature type to obtain a conversion test instruction; in response to the target protocol feature type being the second target protocol feature type, a second protocol conversion scheme corresponding to the second target protocol feature is obtained, and the test instruction is subjected to protocol conversion based on the second protocol conversion scheme to obtain a conversion test instruction; parsing the data packet of the conversion protocol, removing header information of the data packet, and retaining application layer data; calculating a cyclic redundancy check code based on the application layer data, performing level conversion, and generating a protocol frame corresponding to the second target protocol feature type to obtain a conversion test instruction.
[0096] The serial port protocol feature type (target protocol feature type) corresponding to the serial port device can be RS232 protocol (first target protocol feature type) or RS485 protocol (second target protocol feature type). The controller's commonly used communication protocol (conversion protocol feature type) can be TCP or IP protocol.
[0097] In one embodiment, a typical frame structure of the RS-485 protocol (Modbus RTU) is: [device address][function code][data][CRC check];
[0098] For example, the RS-485 protocol can be: 01 03 00 01 00 01 D5 CA; the device address (01), function code (03), and data field (00 01 00 01) can be extracted. The CRC check (D5 CA) is verified and discarded if invalid.
[0099] Encapsulation format (Modbus TCP): [transaction ID] [protocol ID] [length] [device address] [function code] [data] For example, the TCP / IP protocol can be: 00 01 00 00 00 06 01 03 00 01 00 01.
[0100] Assuming we're converting the RS-485 protocol to TCP / IP, the conversion rule might be to add the following: Transaction ID (00 01): Randomly generated, identifies the request-response correspondence. Protocol ID (00 00): Fixed value, indicating the Modbus protocol. Length (00 06): Number of bytes of subsequent data (device address + function code + data). Preserve original data: Directly copy the device address, function code, and data fields from the RS-485 frame.
[0101] Assuming that the TCP / IP protocol is converted to the RS-485 protocol, the TCP / IP header can be removed, the CRC check can be recalculated, and the RS-485 frame can be generated.
[0102] The processing module can perform real-time protocol conversion, ensuring accurate and efficient data transmission between different protocols without the need to install additional drivers on the laptop. For example, when testing IoT data acquisition equipment, the laptop uses the TCP / IP protocol to send test commands. The serial port server software system converts these commands into RS485 protocol commands that are compatible with the serial port device. At the same time, it uses the simulated driver to process the data, ensuring smooth testing.
[0103] Step 105: In response to the serial port server receiving the control data, the target analog driver is used to perform data conversion processing on the control data to obtain target control data that can be recognized by the universal server.
[0104] Step 106: In response to the serial port device receiving the conversion test instruction, the serial port device executes the conversion test instruction, obtains response data, and transmits the response data to the serial port server. The serial port server forwards the response data to the general server.
[0105] Step 107: In response to the universal server receiving the response data and the target control data, the universal server is instructed to print the response data based on the target control data to generate a test log.
[0106] The embodiment of the present application provides a device testing device, the device testing device is specifically as follows Figure 5 As shown, the device testing apparatus includes: a determination module 20 , a transmission module 21 , a selection module 22 , a conversion module 23 , an execution module 24 and a guidance module 25 .
[0107] a determination module configured to, in response to the serial port server receiving the test instruction and control data sent by the controller, obtain serial port device feature information and a serial port device feature information set; the serial port server searches for target serial port device feature information that matches the serial port device feature information from the serial port device feature information set, and determines a target serial port device type based on the target serial port device information; and obtain a target driver type and a target protocol feature corresponding to the target serial port device type;
[0108] The transmission module is used for the serial device server to transmit the test instructions to the processing module built into the serial device server;
[0109] a selection module configured to, in response to the processing module receiving the test instruction, obtain the target driver type and the target protocol characteristics, and select a target simulation driver matching the target driver type from the simulation driver library based on the target driver type;
[0110] The conversion module is used to process the test instructions by the processing module to perform protocol conversion to obtain a converted test instruction, the converted test instruction meets the requirements of the target protocol characteristics, and transmit the converted test instruction to the serial port device; in response to the serial port server receiving the control data, the control data is converted by using the target simulation driver to obtain the target control data that can be recognized by the general server;
[0111] An execution module, configured to respond to the serial port device receiving the conversion test instruction, the serial port device executing the conversion test instruction, obtaining response data, and transmitting the response data to the serial port server;
[0112] The guiding module is configured to, in response to the universal server receiving the response data and the target control data, guide the universal server to print the response data based on the target control data and generate a test log.
[0113] For the description of the features in the embodiment corresponding to the equipment testing device, please refer to the relevant description of the embodiment corresponding to the equipment testing system, which will not be repeated here.
[0114] The embodiment of the present application also provides a computer device, such as Figure 6 As shown, it includes a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned device testing method embodiments.
[0115] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above-mentioned device testing method embodiments when running.
[0116] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0117] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0118] The above is a detailed introduction to a device testing method provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only intended to help understand the method and core ideas of the present application. It should be pointed out that, for those skilled in the art, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A device testing system, characterized in that: The equipment testing system comprises: Serial port devices; General purpose server; A serial port server, the serial port server being communicatively connected with the serial port device and the general server respectively; a first communication module and a second communication module, wherein the first communication module is communicatively connected to the serial port server, and the second communication module is communicatively connected to the controller and the first communication module respectively; The serial port server has a built-in processing module. In response to the processing module obtaining the test instructions and control data sent by the controller, the processing module determines the target simulation driver and target protocol characteristics of the serial port device, performs protocol conversion on the test instructions according to the target protocol characteristics, and uses the target simulation driver to perform data conversion processing on the control data to obtain target control data recognizable by the general server. The serial port device receives and executes the converted test instructions to generate response data. In response to the general server obtaining the target control data and response data, the general server is instructed to generate a test log based on the target control data.
2. The device testing system according to claim 1, wherein: The first communication module includes a first identification unit and a first storage unit, and the second communication module includes a second identification unit and a second storage unit. The first identification unit is communicatively connected to the first storage unit, and the second identification unit is communicatively connected to the second storage unit. The first identification unit and the second identification unit respectively perform connection identification based on the information stored in the first storage unit and the information stored in the second storage unit to establish a wireless communication connection between the first communication module and the second communication module; The first storage unit stores a serial port device feature information set and first communication module identification information, wherein the serial port device feature information set includes serial port device manufacturer information, serial port device model information, serial port device feature code information, and communication protocol feature information corresponding to the serial port device; the first communication module identification information includes first communication module broadcast information and first communication module Bluetooth address; The second storage unit stores second communication module identification information, where the second communication module identification information includes second communication module broadcast information and a second communication module Bluetooth address.
3. The device testing system according to claim 1, wherein: The first communication module includes a first wireless connection circuit, and the second communication module includes a second wireless connection circuit; The printed circuit boards corresponding to the first wireless connection circuit and the second wireless connection circuit include, from top to bottom, a radio frequency signal layer, a ground layer, a power supply layer, and a digital signal layer; RF routing is set on the RF signal layer, RF ground area and digital ground area are set on both sides of the ground layer, the digital ground area and the RF ground area are connected at a single point, digital power supply and RF power supply are set on both sides of the power supply layer, the digital power supply and the RF power supply are isolated by slots, and digital routing and filtering circuits are set on the digital signal layer.
4. The device testing system according to claim 1, wherein: The processing module includes a simulation driver library and a protocol library. The simulation driver library includes a simulation driver corresponding to the serial port device; the protocol library includes protocol features of the serial port protocol corresponding to the serial port device, protocol features of the communication protocol corresponding to the controller, and a protocol conversion scheme between the serial port protocol and the communication protocol.
5. The device testing system according to claim 1, wherein: The device testing system further comprises an updating module, which is used to collect new serial port device information and update the serial port device feature set, the simulation driver library and the protocol library based on the new serial port device information.
6. A device testing method, based on the device testing system according to any one of claims 1 to 5, characterized in that: The device testing method comprises: In response to the serial port server receiving the test instruction and control data sent by the controller, the serial port server obtains serial port device feature information and a serial port device feature information set; the serial port server searches for target serial port device feature information matching the serial port device feature information from the serial port device feature information set, determines a target serial port device type based on the target serial port device information, and obtains a target driver type and a target protocol feature corresponding to the target serial port device type; The serial port server transmits the test instruction to a processing module built into the serial port server; In response to the processing module receiving the test instruction, the processing module obtains a target driver type and a target protocol feature, and selects a target simulation driver matching the target driver type from a simulation driver library based on the target driver type; The processing module performs protocol conversion on the test instruction to obtain a conversion test instruction, wherein the conversion test instruction meets the requirements of the target protocol characteristics, and transmits the conversion test instruction to the serial port device; In response to the serial port server receiving the control data, performing data conversion processing on the control data by using the target simulation driver to obtain target control data that can be recognized by the general server; In response to the serial port device receiving the conversion test instruction, the serial port device executes the conversion test instruction, obtains response data, and transmits the response data to the serial port server, and the serial port server forwards the response data to the general server; In response to the universal server receiving the response data and the target control data, the universal server is directed to print the response data based on the target control data to generate a test log.
7. The device testing method according to claim 6, characterized in that: The serial port server searches for target serial port device feature information that matches the serial port device feature information from the serial port device feature information set, determines a target serial port device type based on the target serial port device information, and obtains a target driver type and a target protocol feature corresponding to the target serial port device type, including: Obtaining a serial port device feature information set from a first identification unit of a first communication module, and performing fuzzy matching between the serial port device feature information and the serial port device feature information set; and determining whether the serial port device feature information set includes target serial port device feature information that matches the serial port device feature information. If included, determine the target serial port device type according to the target serial port device feature information, and search the target driver type and target protocol features corresponding to the target serial port device type from the simulation driver library and protocol library in the processing module of the serial port server; If not included, a protocol conversion scheme corresponding to the serial port device characteristic information is determined, and the serial port device characteristic information set is updated based on the protocol conversion scheme corresponding to the serial port device characteristic information.
8. The device testing method according to claim 6, characterized in that: The processing module performs protocol conversion on the test instruction to obtain the converted test instruction, including: Obtaining a conversion protocol feature type of a conversion protocol corresponding to a test instruction and a target protocol feature type of a serial port protocol corresponding to a serial port device, wherein the target protocol feature type is a first target protocol feature type or a second target protocol feature type; In response to the target protocol feature type being a first target protocol feature type, obtaining a first protocol conversion scheme corresponding to the first target protocol feature, and performing protocol conversion on the test instruction based on the first protocol conversion scheme to obtain a converted test instruction; The performing protocol conversion on the test instruction based on the first protocol conversion scheme to obtain the converted test instruction includes: Parsing the data packets of the conversion protocol, removing the header information of the data packets, and retaining the application layer data; Calculate a cyclic redundancy check code based on the application layer data, perform level conversion, generate a protocol frame corresponding to the first target protocol feature type, and obtain a conversion test instruction; In response to the target protocol feature type being a second target protocol feature type, obtaining a second protocol conversion scheme corresponding to the second target protocol feature, and performing protocol conversion on the test instruction based on the second protocol conversion scheme to obtain a converted test instruction; The performing protocol conversion on the test instruction based on the second protocol conversion scheme to obtain the converted test instruction includes: Parsing the data packets of the conversion protocol, removing the header information of the data packets, and retaining the application layer data; A cyclic redundancy check code is calculated based on the application layer data, and level conversion is performed to generate a protocol frame corresponding to the second target protocol feature type, thereby obtaining a conversion test instruction.
9. A computer device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the device testing method according to any one of claims 6 to 8 when executing the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the device testing method according to any one of claims 6 to 8 when executed by a processor.
Citation Information
Patent Citations
Serial port equipment communication method and system
CN106572184A
Method and device for monitoring running state on server and electronic equipment
CN119336573A