Equipment testing system and method, computer equipment and storage medium
By introducing a serial port server and built-in processing module into the device testing system, the driver and protocol of the serial port device are automatically determined and adapted to the serial port device, and the complexity of driver installation and protocol conversion in the test of different types of serial port devices is solved, achieving an efficient and convenient equipment testing process.
Patent Information
- Application Number
- CN202510696718.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2045-05-28
AI Technical Summary
When applying different types of serial port devices, it is necessary to frequently install the drivers corresponding to the serial port devices, and additionally configure a variety of protocol conversion tools, resulting in complex operation and poor compatibility.
A device testing system is provided, including a serial port device, a general server, a serial port server, a first communication module and a second communication module. The serial port server has a built-in processing module. By obtaining the test instructions and control data sent by the controller, it determines the target analog driver and target protocol characteristics, and performs protocol conversion and data conversion to realize protocol adaptation between the controller and the serial port device.
Through wireless communication connection and automatic driver adaptation, the complexity of serial port cable usage and driver installation is reduced, the efficiency and convenience of equipment testing is improved, and compatibility with general-purpose servers is enhanced.
Smart Images

Figure CN120216273A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of device testing, and particularly to a device testing system, method, computer device, and storage medium. Background Art
[0002] In the current context of continuous innovation in information technology, general-purpose servers play a core role in data processing and computing in various industries. With the booming development of emerging technologies such as the Internet of Things and Industry 4.0, more and more devices access general-purpose servers through serial communication to achieve data interaction and control. In the early days, serial communication mainly relied on serial cables for connection, which could meet the requirements in limited device connection scenarios. However, with the expansion of the industrial scale, a large number of serial devices need to be connected to general-purpose servers for testing and data transmission, and the drawbacks of the traditional serial cable connection method gradually become prominent. At the same time, wireless communication technology has developed rapidly, and technologies such as Wi-Fi and Bluetooth have been widely used in the consumer electronics field. 5G / 4G technology has shown strong 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 need to install their respective corresponding driver programs to achieve normal communication between a laptop and a general-purpose server. Moreover, there are significant differences in the network protocols adapted by laptops and general-purpose servers. In related technologies, when applying different types of serial devices, it is necessary to frequently install the drivers corresponding to the serial devices and additionally configure a variety of protocol conversion tools, which is operationally complex and has poor compatibility. Summary of the Invention
[0004] This application provides a device testing system, method, computer device, and storage medium to at least solve the technical problem in related technologies that when applying different types of serial devices, it is necessary to frequently install the drivers corresponding to the serial devices and additionally configure a variety of protocol conversion tools, resulting in complex operations and poor compatibility.
[0005] This application provides a device testing system, including: A serial device; A general-purpose server; A serial server, which is communicatively connected to the serial device and the general-purpose server respectively; A first communication module and a second communication module, the first communication module is communicatively connected to the serial server, and the second communication module is communicatively connected to the controller and the first communication module respectively; The serial server is built with a processing module. In response to the processing module obtaining the test instruction and control data sent by the controller, the processing module determines the target simulation driver and target protocol characteristics of the serial device, performs protocol conversion on the test instruction 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 device receives and executes the conversion test instruction to generate response data. In response to the general server obtaining the target control data and the response data, the general server is guided by the target control data to generate a test log.
[0006] This application also provides a device testing method, including: In response to the serial server receiving the test instruction and control data sent by the controller, the serial server obtains the serial device characteristic information and the serial device characteristic information set; the serial server searches the serial device characteristic information set for the target serial device characteristic information that matches the serial device characteristic information, and determines the target serial device type based on the target serial device information; obtains the target driver type corresponding to the target serial device type and the target protocol characteristics; The serial server transmits the test instruction to the processing module built in the serial server; 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 the target simulation driver that matches the target driver type from the 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 that meets the requirements of the target protocol characteristics, and transmits the conversion test instruction to the serial device; In response to the serial server receiving the control data, the target simulation driver is used to perform data conversion processing on the control data to obtain target control data recognizable by the general server; In response to the serial device receiving the conversion test instruction, the serial device executes the conversion test instruction to obtain response data, and transmits the response data to the serial server; In response to the general server receiving the response data and the target control data, the general server is guided by the target control data to print the response data and generate a test log.
[0007] This application also provides a computer device, including: a memory for storing a computer program; a processor for implementing the steps of the device testing system in the following embodiments when executing the computer program.
[0008] In response to the serial server receiving the test instruction and control data sent by the controller, the serial server acquires the serial device feature information and the serial device feature information set; the serial server searches in the serial device feature information set for the target serial device feature information that matches the serial device feature information, and determines the target serial device type based on the target serial device information; acquires the target driver type corresponding to the target serial device type and the target protocol feature; The serial server transmits the test instruction to the processing module built in the serial server; In response to the processing module receiving the test instruction, the processing module acquires the target driver type and the target protocol feature, and selects from the analog driver library the target analog driver that matches the target driver type based on the target driver type; The processing module performs protocol conversion on the test instruction to obtain a converted test instruction that meets the requirements of the target protocol feature, and transmits the converted test instruction to the serial device; In response to the serial server receiving the control data, the target analog driver is used to perform data conversion processing on the control data to obtain the target control data recognizable by the general server; In response to the serial device receiving the converted test instruction, the serial device executes the converted test instruction to obtain response data, and transmits the response data to the serial server; In response to the general server receiving the response data and the target control data, based on the target control data, the general server is guided to print the response data to generate a test log.
[0009] This 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 test system in any of the following embodiments are implemented.
[0010] In response to the serial server receiving the test instruction and control data sent by the controller, the serial server acquires the serial device feature information and the serial device feature information set; the serial server searches in the serial device feature information set for the target serial device feature information that matches the serial device feature information, and determines the target serial device type based on the target serial device information; acquires the target driver type corresponding to the target serial device type and the target protocol feature; The serial server transmits the test instruction to the processing module built in the serial server; In response to the processing module receiving the test instruction, the processing module acquires the target driver type and the target protocol feature, and selects from the analog driver library the target analog driver that matches the target driver type based on the target driver type; The processing module performs protocol conversion on the test instruction to obtain a converted test instruction that meets the requirements of the target protocol characteristics, and transmits the converted test instruction to the serial device; In response to the serial server receiving the control data, the target simulation driver is used to perform data conversion processing on the control data to obtain target control data recognizable by the general server; In response to the serial device receiving the converted test instruction, the serial device executes the converted test instruction to obtain response data, and transmits the response data to the serial server; In response to the general server receiving the response data and the target control data, the general server is guided by the target control data to print the response data and generate a test log.
[0011] The device test system provided by this application includes: a serial device, a general server, a serial server, a first communication module, and a second communication module. The serial server is communicatively connected to the serial device and the general server respectively; the first communication module is communicatively connected to the serial server, and the second communication module is communicatively connected to the controller and the first communication module respectively; the serial server has a built-in processing module. In response to the processing module obtaining the test instruction and control data sent by the controller, the processing module determines the target simulation driver and target protocol characteristics of the serial device, performs protocol conversion on the test instruction 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 device receives and executes the converted test instruction to generate response data. In response to the general server obtaining the target control data and the response data, the general server is guided by the target control data to generate a test log.
[0012] In this way, the wireless communication connection between the controller and the serial server is realized through the first communication module and the second communication module, avoiding the installation of a large number of serial cables and the problem of wire entanglement. The target simulation driver of the serial device is determined by the processing module of the serial server, and there is no need to install the driver corresponding to the serial device at the controller end. Moreover, the test instruction of the controller is converted according to the target protocol characteristics, and the converted test instruction is sent to the serial device to achieve protocol adaptation between the controller and the serial device. The target simulation driver is used to perform data conversion processing on the control data to obtain target control data recognizable by the general server, so that the target control data is adapted to the general server. The serial device receives and executes the converted test instruction to generate response data. The general server obtains the target control data and the response data, and the general server is guided by the target control data to generate a test log, which can achieve the technical effect of improving the efficiency and convenience of device testing. Description of the Drawings
[0013] To more clearly illustrate the embodiments of the present application, the accompanying drawings required for the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other accompanying drawings can be obtained based on these drawings without creative efforts.
[0014] Figure 1 Schematic structural diagram of the device test system provided by the embodiment of the present application; Figure 2 Schematic structural diagram of the processing module provided by the embodiment of the present application; Figure 3 Schematic structural diagram of the drive service platform provided by the embodiment of the present application; Figure 4 Schematic flow diagram of the device test method provided by the embodiment of the present application; Figure 5 Schematic block diagram of the device test device provided by the embodiment of the present application; Figure 6 Internal structure diagram of the computer device provided by the embodiment of the present application. Detailed implementation manners
[0015] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present application.
[0016] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or device including a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0017] During the device testing process, connecting a laptop to a serial server using a serial cable involves extremely cumbersome wiring work. Especially in large testing sites where numerous testing devices need to be connected, a large number of serial cables are intertwined, not only increasing the wiring time and cost but also prone to problems such as cable entanglement and damage, seriously affecting the testing efficiency. Moreover, the transmission distance of serial cables is limited. Generally, the effective transmission distance of RS232 serial cables is only about 15 meters, and although RS485 serial cables can reach kilometers, in some complex industrial environments, long-distance transmission still faces problems such as signal attenuation and interference, greatly limiting the deployment scope of testing devices.
[0018] Serial devices of different brands and models often require the installation of their respective corresponding driver programs to achieve normal communication between a laptop and a general server. This process is complex to operate and requires testers to have a certain level of professional knowledge. For some old devices, there may be problems such as difficulty in obtaining driver programs and incompatibility with new operating systems. For example, in the field of industrial automation, some early-produced serial sensors only support the Windows XP system for their driver programs and cannot be installed and used under the current mainstream Windows 10 or even higher version systems, making it difficult to connect these devices to a general server for testing and data transmission. In addition, when testing multiple different types of serial devices, frequently installing and uninstalling driver programs not only takes time and effort but also easily causes system conflicts, further reducing the stability and reliability of the testing work.
[0019] Common communication protocols for serial devices such as RS232 and RS485 are significantly different from network protocols such as TCP / IP commonly used by laptops and general servers. During data transmission, protocol conversion is required, and existing protocol conversion devices or software in the prior art often have a single function and can only support specific protocol conversions, unable to meet the increasingly diverse access requirements of serial devices. This makes it necessary to configure multiple protocol conversion tools additionally when testing serial devices with different protocols, increasing the testing cost and complexity and becoming a major obstacle to efficient data transmission in the device testing process.
[0020] It can be seen that in the device testing process, the traditional method relies on connecting a laptop with a serial cable, which is not only cumbersome in wiring but also requires the installation of corresponding drivers, with complex operations and poor compatibility. This application further aims to comprehensively replace the serial cable connection with wireless technology to achieve convenient communication between testing devices and general servers. At the same time, through innovative design, it achieves automatic adaptation to various drivers or protocol conversion, avoiding the cumbersome driver installation process and significantly improving the serial communication efficiency and convenience of the server.
[0021] To enable those skilled in the art of this technology to better understand the solution of this application, the following further elaborates on this application in combination with the accompanying drawings and specific implementation manners.
[0022] As shown Figure 1 in the figure, an embodiment of the present application provides a device test 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).
[0023] The serial port device is a device connected to a serial communication interface on a computer or other electronic device, which receives / returns data through the serial port and simulates an actual industrial device.
[0024] The general server is used to provide various services or resources for other devices or programs to access, runs a test service program, listens to the data forwarded by the serial port server, and processes and records the test results.
[0025] The controller can be a laptop computer. The controller sends test instructions to the serial port server and is used to monitor the response of the general server and data analysis.
[0026] The serial port server is respectively communicatively connected to the serial port device and the general server, and is used to access the serial port device, obtain the characteristic information of the serial port device, perform data conversion, and implement the communication bridge between the serial port device and the network.
[0027] The first communication module is communicatively connected to the serial port server, and the second communication module is respectively communicatively connected to the controller and the first communication module. The first communication module and the second communication module apply the wireless direct connection technology. When the serial port server and the controller are close, the first communication module corresponding to the serial port server and the second communication module corresponding to the controller will identify the device type and the supported communication protocol with each other, and quickly establish a connection to achieve wireless data transmission between the serial port server and the controller. In this way, the serial cable connection method is abandoned. For example, in the device test of industrial automation equipment, technicians carry a laptop with test software into the test area, and the laptop and the serial port server are instantly connected through the wireless direct connection module, and then the test communication work can be started without manually connecting the serial cable.
[0028] Specifically, the first communication module and the second communication module can build a wireless connection channel based on Wi-Fi Direct or Bluetooth Mesh technology. Their working frequency bands are 2.4GHz and 5GHz dual bands, supporting the IEEE802.11n / ac protocol. The maximum transmission rate can reach 150Mbps in the 2.4GHz band and 433Mbps in the 5GHz band.
[0029] The first communication module further includes a first gain antenna, and the second communication module further includes a second gain antenna. The first gain antenna and the second gain antenna can be high-gain antennas. By configuring the first gain antenna and the second gain antenna, the wireless signal transmission distance and stability are enhanced.
[0030] The first communication module further includes a first identification unit and a first storage unit, and the second communication module further 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 second storage unit respectively to establish a wireless communication connection between the first communication module and the second communication module.
[0031] Wherein, the first storage unit stores a serial port device feature information set and first communication module identification information. 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 the Bluetooth address of the first communication module. The second storage unit stores second communication module identification information, and the second communication module identification information includes second communication module broadcast information and the Bluetooth address of the second communication module.
[0032] Here, the feature code of a serial port device usually refers to a unique identifier used to identify a specific serial port device. These feature codes can include information such as the device's PID (Product ID), VID (Vendor ID), and device path.
[0033] When the controller makes an initial connection with the serial port service, the first identification unit on the serial port server side obtains the first communication module identification information in the first storage unit, and the second identification unit on the controller side obtains the second communication module identification information in the second storage unit. A wireless communication connection between the serial port server and the controller is established through the first communication module identification information and the second communication module identification information. When a serial port device is connected, the serial port server can obtain the serial port device feature information of the connected serial port device, and at the same time search for the serial port device type that matches the serial port device feature information in the serial port device feature information set stored in the first storage unit as the target serial port device type of the connected serial port device.
[0034] The first storage unit and the second storage unit can be information databases, specifically SQLite databases. In one embodiment, for a certain serial port sensor device, the storage form can be that its manufacturer ID is [specific ID value], the device model is [specific model], the feature code is [specific feature code], and the communication protocol is RS - 485. A hash table or a tree - like data structure is used to store the serial port device feature information set to improve the query efficiency.
[0035] Exemplarily, a tree - like data structure can be established with nodes being various serial port device types and sub - nodes being the manufacturer ID, device model, and device feature code corresponding to the serial port device to store the serial port device feature information set.
[0036] 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 a radio frequency signal layer, a ground layer, a power supply layer, and a digital signal layer from top to bottom; The radio frequency signal layer is provided with radio frequency traces. Radio frequency ground areas and digital ground areas are arranged on both sides of the ground layer. The digital ground area and the radio frequency ground area are connected at a single point. Digital power and radio frequency power are arranged on both sides of the power supply layer. The digital power and the radio frequency power are isolated by slots. The digital signal layer is provided with digital traces and filter circuits.
[0037] By separately designing independent wireless connection circuits for the communication modules at the serial port server end and the controller end, adopting a 4-layer printed circuit board design, separating the power supply layer from the ground layer to reduce signal interference. Physically isolating the radio frequency power supply from the digital power supply, and placing the radio frequency circuit close to the antenna interface to reduce signal transmission loss. In the wireless connection module circuit, a filter circuit can also be set to filter the power input, remove clutter interference, and ensure the stable operation of the chip. At the same time, a high-gain antenna is equipped to enhance the transmission distance and stability of the wireless signal. Ensure good electrical isolation and compatibility between the communication module and other hardware modules of the serial port server and the notebook to avoid signal interference.
[0038] In one embodiment, a super capacitor (such as 5V / 1F) can be built into the second communication module to support short-time power-off data transmission. A common mode choke can be connected in series on the UART line at the serial port server end to suppress high-frequency noise. Time division multiplexing (TDM) or CSMA / CA protocol (such as Wi-Fi) can also be used to avoid data collision and multi-device simultaneous connection conflicts.
[0039] The serial port server is built with a processing module. In response to the processing module obtaining the test instruction and control data sent by the controller, the processing module determines the target analog drive and target protocol characteristics of the serial port device, performs protocol conversion on the test instruction according to the target protocol characteristics, and performs data conversion processing on the control data using the target analog drive to obtain target control data recognizable 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 the response data, the general server generates a test log based on the target control data.
[0040] Such as Figure 2As shown in the figure, the processing module includes an analog driver library and a protocol library. The analog driver library includes the analog drivers corresponding to the serial port devices, and most of the serial port device driver types on the market are covered in the analog driver library. The protocol conversion module includes a protocol library; the protocol library includes the protocol characteristics of the serial port protocol corresponding to the serial port device, the protocol characteristics of the communication protocol corresponding to the controller, and the protocol conversion scheme between the serial port protocol and the communication protocol.
[0041] In this application, the driver information of various serial port devices can be obtained through multiple channels such as the official website of the manufacturer, technical manuals, and open source communities. The obtained driver information is sorted out and analyzed to extract key device identification information, data transmission interface functions, interrupt handling mechanisms, etc. For example, for a [device brand and model] serial port device commonly used in the industrial automation field, the identification ID of the device is obtained from its technical manual as [specific ID value], the data reading function is ReadData ([parameter list]), and the interrupt handling function is InterruptHandler (), etc.
[0042] Construct a corresponding set of analog driver functions according to different device types. In programming, C language can be used, and the object-oriented programming idea is used to encapsulate the driver logic. Create a driver class [ClassName], which includes an initialization function InitDriver () for initializing the analog driver program, setting device parameters and data buffers; data reading and writing functions ReadData () and WriteData () for simulating the data reading and writing operations of the device respectively; and an error handling function ErrorHandler () for handling errors that occur during data transmission. By simulating the response of real devices, a unified interface is provided for the upper-layer application in the test environment to ensure that the analog driver functions of different serial port devices are stable and easy to call. Among them, the device parameters can include: communication protocol parameters for defining the protocol types and formats supported by the device; device identification parameters for uniquely identifying the manufacturer and model information of the device; timing control parameters for setting timing behaviors such as response delay and timeout; and function limit parameters for simulating the physical limitations of the device (such as maximum input voltage, sampling rate), etc.
[0043] The data buffer can include a receive buffer, a transmit buffer, and a protocol parsing buffer. Receive buffer: Stores the raw data received from a notebook or server (such as TCP / IP packets) like a ring buffer (Ring Buffer), usually with a size of 1KB - 4KB (set according to the protocol frame length). Transmit buffer: Stores the converted data to be sent to the serial device (such as RS-485 frames) like a FIFO queue, with dynamic expansion: (such as an initial 512B, expanded as needed). Protocol parsing buffer: Temporarily stores the intermediate results of protocol parsing (such as the CRC check value of Modbus RTU), like a static array (fixed size).
[0044] The analog driver function set of this application supports dynamic link library loading. The matching analog driver program can be loaded through the system API (such as LoadLibrary() in Windows), and the standard interface functions in the driver class (such as InitDriver(), ReadData()) can be called using the driver functions to convert the data into a format recognizable by a general server (such as JSON or TCP / IP packets).
[0045] In this application, the differences between common serial communication protocols (such as RS - 232, RS - 485) and the target communication protocol (such as TCP / IP) are also set. For example, taking the conversion of the RS - 232 protocol to the TCP / IP protocol as an example, the RS - 232 protocol uses asynchronous serial communication, and the data format includes a start bit, data bits, a parity bit, and a stop bit; while the TCP / IP protocol is a network-based transmission control protocol, and the data is transmitted in the form of data packets. Detailed conversion rules are formulated, such as removing the start bit and stop bit in the RS -232 data frame, extracting the data bits and parity bit, encapsulating them according to the format of the TCP / IP protocol, and adding header information such as the IP address and port number to achieve the conversion of the serial communication protocol to the target communication protocol.
[0046] In programming implementation, the state machine can be used as the core architecture, and the protocol conversion process can be decomposed into multiple states, such as data reception state, data parsing state, data encapsulation state, data transmission state, etc. Corresponding conversion operations are performed according to the data input state.
[0047] such as Figure 2 As shown, the processing module also includes a data caching and processing module, a communication management module, and a security encryption module.
[0048] Among them, the data cache and processing module, that is, the storage unit, adopts a circular buffer structure in design to achieve efficient cyclic access to data, so as to efficiently utilize the memory space and achieve fast reading and writing of data. When coding, the C++ language is selected for development, taking advantage of its powerful memory management ability and high execution efficiency. The parallel processing of data is realized through multi-threading technology to improve the processing speed. In the implementation stage, the buffer size is dynamically adjusted in combination with the hardware characteristics to ensure the smoothness of data processing.
[0049] Communication management module: It is designed based on the event-driven model and can respond to various communication events in real time. Specifically, the communication management module responds to the access of serial port devices in real time based on the event-driven model, obtains the characteristic data of serial port devices without locks through a circular buffer, and quickly matches with the simulation driver library and protocol library to achieve plug-and-play driver loading and data conversion. Python language can be used for coding, leveraging its rich network libraries to quickly build a communication framework. By establishing a communication session pool to manage the connections between different devices, the communication efficiency is improved. A load balancing algorithm can also be introduced to reasonably allocate communication tasks, avoid excessive load on a single connection, allocate multi-device communication tasks through a dynamic load balancing algorithm, and combine real-time queue monitoring to avoid single connection overload, ensuring system stability and resource utilization.
[0050] Security encryption module: The AES encryption algorithm is selected in design to ensure the security of data transmission. Java language is used for coding, taking advantage of its built-in security library to simplify the encryption process. Through the digital certificate authentication mechanism, the identities of both communication parties are verified to prevent illegal access. The confidentiality of data transmission is ensured through AES encryption, and combined with two-way digital certificate authentication to prevent illegal device access, ensuring end-to-end security of communication. During the implementation process, the encryption key is updated regularly to enhance the security of the system.
[0051] In a specific example, a listening program runs on the serial port server. The controller sends test instructions and control data to the serial port server through network tools such as Netcat or Telnet. In response to the serial port server receiving the test instructions and control data, the serial port server obtains serial port device characteristic information and a set of serial port device characteristic information. The serial port server searches for target serial port device characteristic information that matches the serial port device characteristic information from the set of serial port device characteristic information, and determines the target serial port device type based on the target serial port device information. The target driver type corresponding to the target serial port device type and the target protocol characteristics are obtained. The serial port server performs protocol conversion on the test instructions according to the target protocol characteristics, so that the test instructions meet the protocol requirements of the serial port device, and forwards the protocol-converted test instructions to the serial port device. The serial port device executes the protocol-converted test instructions and returns response data. The serial port server also performs data conversion on the controller data to generate target controller 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 the response data, the general server generates a test log based on the target control data. In this way, the data transmission and processing efficiency can be improved, and the smooth operation of the system under complex tasks is ensured.
[0052] In one embodiment, the device test system further includes an update module. The update module is used to collect new serial port device information and update the serial port device characteristic set, the simulated driver library, and the protocol library based on the new serial port device information. A cloud drive service platform (update module) can be built as the background support for the processing module. This platform collects and organizes the latest serial port device driver information and protocol information in real time, and periodically updates the simulated driver library and the protocol library. When the serial port server encounters a new type of serial port device or an unknown protocol, it can automatically send a request to the cloud drive service platform to obtain the latest simulated driver and protocol conversion scheme, realizing self-update and upgrade. For example, in the device test of new smart home devices, if a new serial port device protocol appears, the serial port server obtains relevant information through the cloud drive service platform and quickly completes the update of its own software system, so as to successfully complete the test work on the new device.
[0053] As Figure 3 shown, the cloud drive 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, and the big data analysis engine passes the analysis results to the processing module. The processing module updates the simulated driver library and the protocol library according to the analysis results. These two databases push driver updates and protocol conversion scheme updates to different serial port servers respectively to ensure that the serial port server can adapt to the changes of new types of serial port devices and protocols.
[0054] The first storage unit and the second storage unit of the present application can be updated by regularly downloading from the cloud drive service platform, continuously expanding the content of the feature library. The update process adopts an incremental update method, only downloading the changed parts, reducing the data transmission volume and update time. For example, when the cloud drive service platform detects that the communication protocol of a certain type of serial port device has changed, only the changed protocol feature data is pushed to the storage unit of the intelligent recognition chip.
[0055] Through the real-time update function of the cloud drive service platform, it is ensured that the serial port server can promptly adapt to the changes of new serial port devices and communication protocols. When facing continuously updated test devices, it always maintains good compatibility and test capabilities, providing a strong guarantee for the continuous development of device testing work.
[0056] In the present application, by setting the coordinated work of the analog drive and protocol intelligent conversion software system and the cloud drive service and update mechanism, the serial port server can automatically adapt to various serial port device drivers without manually installing drivers on the notebook side, effectively solving the problems of cumbersome driver installation and poor compatibility.
[0057] In a feasible implementation manner, the serial port server can be set as a hot-pluggable device supporting multiple interfaces. Plugging the hot-pluggable device supporting multiple interfaces into the serial port device can realize the communication between the notebook and the serial port device, integrating the functions of the first communication module and the second communication module on the hot-pluggable device, thus reducing costs.
[0058] As Figure 4 shown, the embodiment of the present application provides a device testing system, and the method specifically includes the following steps: Step 101: In response to the serial port server receiving the test instruction and control data sent by the controller, the serial port server acquires the serial port device feature information and the serial port device feature information set; the serial port server searches for the target serial port device feature information matching 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; acquires the target driver type corresponding to the target serial port device type and the target protocol feature.
[0059] Specifically, obtain the serial port device feature information set from the first recognition unit of the first communication module, and perform fuzzy matching between the serial port device feature information and the serial port device feature information set; determine whether the target serial port device feature information that matches the serial port device feature information is included in the serial port device feature information set; if it is included, determine the target serial port device type according to the target serial port device feature information, and search for the target driver type and target protocol feature corresponding to the target serial port device type from the analog driver library and protocol library in the processing module of the serial port server; if it is not included, determine the protocol conversion scheme corresponding to the serial port device feature information, and update the serial port device feature information set based on the protocol conversion scheme corresponding to the serial port device feature information.
[0060] For serial port devices, collect information such as their handshake signals and device IDs; for wireless devices, collect their device broadcast information, Bluetooth addresses, etc. Compare the collected feature data with the information in the serial port device feature information set. Use a fuzzy matching algorithm. When the serial port device feature information set and the serial port device feature information are not completely identical, make a judgment according to a preset similarity threshold. For example, when the similarity threshold is set to 80%, if the similarity between the collected serial port device feature information and a certain serial port device feature information in the serial port device feature information set reaches more than 80%, it is considered a successful match, obtain the target serial port device type corresponding to the serial port device feature information, and determine the target driver type and target protocol feature corresponding to the target serial port device type from the analog driver library and protocol library according to the serial port device type.
[0061] Step 102: The serial port server transmits the test instruction to the processing module built in the serial port server.
[0062] Step 103: In response to the processing module receiving the test instruction, the processing module obtains the target driver type and target protocol feature, and selects a target analog driver that matches the target driver type from the analog driver library based on the target driver type.
[0063] Step 104: The processing module performs protocol conversion on the test instruction to obtain a converted test instruction that meets the requirements of the target protocol feature, and transmits the converted test instruction to the serial port device.
[0064] Specifically, obtain the conversion protocol feature type of the conversion protocol corresponding to the test instruction and the target protocol feature type of the serial port protocol corresponding to the serial port device. The target protocol feature type is the first target protocol feature type or the second target protocol feature type. In response to the target protocol feature type being the first target protocol feature type, obtain the first protocol conversion scheme corresponding to the first target protocol feature, and perform protocol conversion on the test instruction based on the first protocol conversion scheme to obtain a converted test instruction. Among them, performing protocol conversion on the test instruction based on the first protocol conversion scheme to obtain a converted test instruction includes: parsing the data packet of the conversion protocol, removing the header information of the data packet, and retaining the application layer data; calculating a cyclic redundancy check code based on the application layer data, performing level conversion, generating a protocol frame corresponding to the first target protocol feature type, and obtaining a converted test instruction. In response to the target protocol feature type being the second target protocol feature type, obtain the second protocol conversion scheme corresponding to the second target protocol feature, and perform protocol conversion on the test instruction based on the second protocol conversion scheme to obtain a converted test instruction. Parse the data packet of the conversion protocol, remove the header information of the data packet, and retain 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 second target protocol feature type, and obtain a converted test instruction.
[0065] The serial port protocol feature type (target protocol feature type) corresponding to the serial port device can be the RS232 protocol (the first target protocol feature type), the RS485 protocol (the second target protocol feature type), and the communication protocol (conversion protocol feature type) commonly used by the controller can be the TCP or IP protocol.
[0066] In an embodiment, the typical frame structure (Modbus RTU) of the RS-485 protocol: [device address][function code][data][CRC check]; Exemplarily, 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. Verify the CRC check (D5 CA), and discard it if it is invalid.
[0067] The encapsulation format (Modbus TCP): [transaction ID][protocol ID][length][device address][function code][data]. Exemplarily, the TCP / IP protocol can be: 00 01 00 00 00 06 01 03 00 01 00 01.
[0068] Assume that the RS-485 protocol is converted to the TCP / IP protocol. The conversion rule can be to add a TCP / IP header: Transaction ID (00 01): Randomly generated, identifying the request-response correspondence. Protocol ID (00 00): Fixed value, indicating the Modbus protocol. Length (00 06): The number of bytes of the subsequent data (device address + function code + data). Preserve the original data: Directly copy the device address, function code, and data fields in the RS-485 frame.
[0069] Assume that the TCP / IP protocol is converted to the RS-485 protocol. Then, the TCP / IP header can be removed, the CRC checksum can be recalculated, and an RS-485 frame can be generated.
[0070] The processing module can perform protocol conversion in real time to ensure accurate and efficient data transmission between different protocols without installing additional drivers on the laptop side. For example, in the test of IoT data acquisition devices, the laptop uses the TCP / IP protocol to send test instructions, and the serial server converts them into RS485 protocol instructions adapted to the serial device through the software system. At the same time, the simulation driver is used to process the data to ensure the smooth progress of the test.
[0071] Step 105: In response to the serial server receiving control data, use the target simulation driver to perform data conversion processing on the control data to obtain target control data recognizable by the general server.
[0072] Step 106: In response to the serial device receiving the conversion test instruction, the serial device executes the conversion test instruction to obtain response data, and transmits the response data to the serial server. The serial server forwards the response data to the general server.
[0073] Step 107: In response to the general server receiving the response data and the target control data, based on the target control data, guide the general server to print the response data to generate a test log.
[0074] An embodiment of the present application provides a device testing apparatus. The device testing apparatus is specifically as Figure 5 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.
[0075] The determination module is used to, in response to the serial server receiving the test instruction and control data sent by the controller, the serial server obtains the serial device feature information and the serial device feature information set; the serial server searches for the target serial device feature information matching the serial device feature information in the serial device feature information set, and determines the target serial device type based on the target serial device information; obtain the target driver type corresponding to the target serial device type and the target protocol feature; A transmission module, configured to enable the serial server to transmit test instructions to a processing module built in the serial server; A selection module, configured to, in response to the processing module receiving the test instructions, enable the processing module to obtain a target driver type and target protocol characteristics, and select a target simulation driver that matches the target driver type from a simulation driver library based on the target driver type; A conversion module, configured to enable the processing module to perform protocol conversion on the test instructions to obtain converted test instructions that meet the requirements of the target protocol characteristics, and transmit the converted test instructions to the serial device; in response to the serial server receiving control data, use the target simulation driver to perform data conversion processing on the control data to obtain target control data recognizable by a general server; An execution module, configured to, in response to the serial device receiving the converted test instructions, enable the serial device to execute the converted test instructions to obtain response data, and transmit the response data to the serial server; A guidance module, configured to, in response to the general server receiving the response data and the target control data, guide the general server to print the response data based on the target control data to generate a test log.
[0076] For the descriptions of the features in the corresponding embodiments of the device testing apparatus, reference may be made to the relevant descriptions in the corresponding embodiments of the device testing system, which will not be elaborated herein one by one.
[0077] An embodiment of the present application further provides a computer device, as Figure 6 shown, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any of the above-described embodiments of the device testing method.
[0078] 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 in any of the above-described embodiments of the device testing method when running.
[0079] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media such as a USB flash drive, a read-only memory (ROM for short), a random access memory (RAM for short), a mobile hard disk, a magnetic disk, or an optical disc that can store a computer program.
[0080] Those skilled in the art may further realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions, but such implementation should not be considered as exceeding the scope of this application.
[0081] The above has introduced in detail a device testing method provided by this application. Specific examples are used herein to illustrate the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A device testing system, characterized in that, The device test system includes: Serial port device; General server; Serial port server, which is communicatively connected to the serial port device and the general server respectively; 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; The serial port server has a built-in processing module. In response to the processing module obtaining the test instruction 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 instruction 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 instruction to generate response data. In response to the general server obtaining the target control data and the response data, the general server generates a test log based on the target control data.
2. The device testing system according to claim 1, wherein, The first communication module further includes a first identification unit and a first storage unit, and the second communication module further 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. 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, 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 the first communication module broadcast information and the first communication module Bluetooth address. The second storage unit stores the second communication module identification information. The second communication module identification information includes the second communication module broadcast information and the second communication module Bluetooth address.
3. The device testing system according to claim 1, wherein 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 board corresponding to the first wireless connection circuit and the second wireless connection circuit includes a radio frequency signal layer, a ground layer, a power supply layer, and a digital signal layer from top to bottom. The radio frequency signal layer is provided with radio frequency traces. Radio frequency ground regions and digital ground regions are provided on both sides of the ground layer. The digital ground region and the radio frequency ground region are connected at a single point. Digital power supply and radio frequency power supply are provided on both sides of the power supply layer. The digital power supply and the radio frequency power supply are isolated by slots. The digital signal layer is provided with digital traces and filter circuits.
4. The device testing system according to claim 1, wherein The processing module includes an analog driver library and a protocol library. The analog driver library includes the analog drivers corresponding to the drivers of the serial port device. The protocol library includes the protocol characteristics of the serial port protocol corresponding to the serial port device, the protocol characteristics of the communication protocol corresponding to the controller, and the protocol conversion scheme between the serial port protocol and the communication protocol.
5. The device testing system according to claim 1, wherein The device test system further includes an update 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-5, characterized in that, The device test method includes: In response to the serial port server receiving a 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 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; obtains the target driver type and 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 the target driver type and the target protocol feature, and selects a target simulation driver that matches the target driver type from the simulation driver library based on the target driver type; The processing module performs protocol conversion on the test instruction to obtain a converted test instruction that meets the requirements of the target protocol feature, and transmits the converted test instruction to the serial port device; In response to the serial port server receiving the control data, the target simulation driver is used to perform data conversion processing on the control data to obtain target control data recognizable by the general server; In response to the serial port device receiving the converted test instruction, the serial port device executes the converted test instruction to obtain 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 general server receiving the response data and the target control data, the general server is guided by the target control data to print the response data to generate a test log.
7. The device testing method according to claim 6, wherein 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; Obtaining the target driver type and target protocol feature corresponding to the target serial port device type includes: Obtaining the serial port device feature information set from the first identification unit of the first communication module, and performing fuzzy matching between the serial port device feature information and the serial port device feature information set; 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 it includes, the target serial port device type is determined according to the target serial port device feature information, and the target driver type and the target protocol feature corresponding to the target serial port device type are searched from the simulation driver library and the protocol library in the processing module of the serial port server; If it does not include, a 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.
8. The device testing method according to claim 6, wherein The processing module performs protocol conversion on the test instruction to obtain a converted test instruction, including: Obtain the conversion protocol feature type of the conversion protocol corresponding to the test instruction and the target protocol feature type of the serial port protocol corresponding to the serial port device, where the target protocol feature type is the first target protocol feature type or the second target protocol feature type; In response to the target protocol feature type being the first target protocol feature type, obtain the first protocol conversion scheme corresponding to the first target protocol feature, and perform protocol conversion on the test instruction based on the first protocol conversion scheme to obtain a converted test instruction; Wherein, the performing protocol conversion on the test instruction based on the first protocol conversion scheme to obtain a converted test instruction includes: Parse the data packet of the conversion protocol, remove the header information of the data packet, and retain the application layer data; Calculate the 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 converted test instruction; In response to the target protocol feature type being the second target protocol feature type, obtain the second protocol conversion scheme corresponding to the second target protocol feature, and perform protocol conversion on the test instruction based on the second protocol conversion scheme to obtain a converted test instruction; Parse the data packet of the conversion protocol, remove the header information of the data packet, and retain the application layer data; Calculate the cyclic redundancy check code based on the application layer data, perform level conversion, generate a protocol frame corresponding to the second target protocol feature type, and obtain a converted test instruction.
9. A computer device, characterized in that, Includes: A memory for storing a computer program; A processor for implementing 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
Server testing system, server testing method, and electronic device
US20250068531A1