Software implementation system and verification method of network communication protocol for geophysical special equipment
Through the distributed cluster architecture and Spring Boot 3 framework, combined with the MQTT protocol and Java asynchronous I/O, the diversity and business requirements of geophysical equipment network communication protocols are solved, and an efficient and scalable communication system is realized, ensuring the equipment Stability and efficiency of access and data transmission.
Patent Information
- Application Number
- CN202411195266.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-08-29
AI Technical Summary
The existing geophysical special equipment network communication protocol cannot meet many business needs such as high sampling rate observation data acquisition, real-time data acquisition, real-time automatic data processing and massive data management, and due to equipment diversity, protocol compatibility and adaptation is difficult.
The distributed cluster architecture is adopted based on the MQTT network communication protocol, Java SDK microservice architecture and Java asynchronous I/O to realize network communication of geophysical special equipment, and build a protocol test unit through the Spring Boot 3 framework to verify device access and management. Introduce heartbeat interval and message retention configurations to ensure connection stability.
An efficient and scalable communication system has been built to ensure the reliability and efficiency of data transmission, support unified access and management of equipment, improve system flexibility and resource utilization, and meet a number of business needs.
Smart Images

Figure CN118714204B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network communication protocols, and in particular to a software implementation system and a verification method of a network communication protocol for geophysical special equipment. Background Art
[0002] With the rapid development of geophysical network, the number of instruments has become larger and larger. The existing network communication protocol for geophysical special equipment can no longer meet the needs of multiple business such as high sampling rate observation data acquisition, real-time data acquisition, real-time automatic data processing, and massive data management. It involves multiple disciplines such as gravity, deformation, geomagnetism, geoelectricity, and underground fluid. Each discipline has its own unique equipment and measuring instruments. These devices may be produced by different manufacturers, support different operating systems and runtime libraries, and even use different development languages to write their internal software. These diversities have brought significant difficulties in protocol compatibility and adaptation in practice. Therefore, a software implementation system and verification method for the network communication protocol for geophysical special equipment are provided. Summary of the invention
[0003] The purpose of the present invention is to provide a software implementation system and verification method of a network communication protocol for geophysical special equipment, so as to solve the problem that the existing network communication protocol for geophysical special equipment mentioned in the above background technology cannot meet multiple business requirements and the equipment is not unified.
[0004] To achieve the above object, on the one hand, the present invention aims to provide a software implementation system of a network communication protocol for geophysical dedicated equipment, comprising:
[0005] A distributed cluster architecture unit, which is based on the MQTT network communication protocol, the JavaSDK microservice architecture and the Java asynchronous I / O for realizing network communication of geophysical special equipment;
[0006] An equipment access and management unit, wherein the equipment access and management unit establishes a platform for unified access, networking and operation status monitoring of geophysical special equipment based on the distributed cluster architecture unit;
[0007] The protocol testing unit uses the Spring Boot 3 framework to verify whether the geophysical dedicated equipment managed by the device access and management unit can correctly communicate using the MQTT protocol, and introduces the heartbeat interval and message retention configuration as test parameters to verify the stable connection status of the device.
[0008] As a further improvement of the technical solution, the distributed cluster architecture unit includes a communication protocol module, a microservice architecture module and an encapsulation module;
[0009] Among them, the communication protocol module uses MQTT v3.1.1 as the basic communication protocol to realize message transmission between devices and uses Java asynchronous I / O to realize network communication;
[0010] The microservice architecture module uses the Java SDK microservice architecture to provide SDK support for devices, which is used to support template and annotation methods to subscribe and publish messages;
[0011] The encapsulation module is used to encapsulate topics, data structures, and MQTT transmission protocols.
[0012] As a further improvement of the technical solution, the communication protocol module uses the MQTT protocol and Java asynchronous I / O (t-io) as the communication protocol between the device and the platform, including the following steps:
[0013] S1.1. Select a Java client library that supports MQTT v3.1.1 and add it to the project's dependencies. Import the t-io library and add it to the project's dependencies.
[0014] S1.2. Create an MQTT client class to manage the connection with the MQTT Broker, and the subscription and publishing of messages;
[0015] S1.3. Configure the t-io library to support asynchronous I / O operations, and use the API provided by the t-io library to implement asynchronous read and write operations to improve the efficiency of network communication.
[0016] As a further improvement of the technical solution, the microservice architecture module adopts the Java SDK microservice architecture to provide SDK support for the device, which is used to support template and annotation mode subscription and publishing of messages, including the following steps:
[0017] S2.1. Create an MQTT client class to manage the connection with the MQTT Broker, and the subscription and publishing of messages.
[0018] S2.2. Create a template class that contains MQTT client operations, which is used to inherit the template class and implement specific functions;
[0019] The specific functions are:
[0020] Including processing received messages and providing interfaces for different message processing strategies;
[0021] It also includes message filtering, dynamic filtering rules are input from the outside, and messages are dynamically filtered according to light intensity and site code;
[0022] S2.3. Create custom annotations to mark the subscription and publishing methods of messages, create an annotation processor class that is responsible for processing methods with custom annotations, and use custom annotations in the client class to mark the message processing methods;
[0023] S2.4. Deploy the client to the geophysical dedicated equipment.
[0024] As a further improvement of the technical solution, the encapsulation module is used to encapsulate the topic, data structure, and MQTT transmission protocol, including the following steps:
[0025] S3.1. Define MQTT topics, including: temperature sensor data, earthquake sensor data, and magnetic field sensor data;
[0026] S3.2, define a data structure to store data of geophysical sensors, the data structure includes device IDid, data type ty, timestamp ti, altitude h, noise level z of the data, and calibration coefficient r of the sensor;
[0027] S3.3. Create an MQTT client connection class to establish a connection with the MQTT server;
[0028] S3.4. Define a method named publish to send a message to the topic;
[0029] S3.5. Define a method called subscribe to subscribe to a topic and process the received messages;
[0030] S3.6. Integrate topics, data structures, MQTT client connection classes, publish methods, and subscribe methods for subscribing to topics, and test them to ensure that the client can publish and receive messages correctly.
[0031] As a further improvement of the technical solution, the protocol test unit includes a configuration and device management module and a test module;
[0032] Among them, the configuration and device management module uses Spring Boot 3 and MyBatis framework to configure the information of the security control gateway; it implements the access management of geophysical special equipment and uses the Spring Security framework to achieve the security of the equipment;
[0033] The test module uses Spring MVC to support real-time data and instruction data testing on the device side. Users manually enter test cases and view test results. It also supports one-click testing on the device side, generates test reports, automatically executes predefined test case sets, and collects test results.
[0034] As a further improvement of the technical solution, the Spring Boot 3 and MyBatis frameworks are used for information configuration of the security control gateway and access management of geophysical dedicated equipment, including the following steps:
[0035] S4.1. Use Spring Boot 3 to create a RESTful API interface to allow users to submit new configuration information. In the backend service, use MyBatis to write the Mapper file and the corresponding DAO layer interface to handle the data insertion operation.
[0036] S4.2. Create a RESTful API interface for updating, deleting, and querying configurations, and use MyBatis's update, delete, and query statements to modify the configuration information in the database;
[0037] S4.3. Create a RESTful API interface for device registration and use MyBatis to save the basic information of the new device;
[0038] S4.4. Create a RESTful API interface for device authentication;
[0039] S4.5. Create a status monitoring RESTful API interface, use MyBatis to store device status information, and regularly query the device status information to obtain the latest status.
[0040] As a further improvement of the technical solution, the test module adopts Spring MVC and specifically includes the following steps:
[0041] S5.1. Add Spring Web MVC dependency in the project's build file; add Gson dependency for serialization and deserialization of JSON data; add MQTT client library dependency;
[0042] S5.2. Create a RESTful controller class named TestController, define a method named manualTest that receives a JSON object containing the test subject and executes the manual test logic, and define a method named oneClickTest that executes the one-click test logic;
[0043] S5.3. Create a class named MqttClient, introduce the heartbeat interval and message retention configuration test parameters in the MqttClient class, and inject it into the controller; implement an initialization method init, in which an MQTT client instance is created and connected to the MQTT server, and implement a publish method, which receives the topic and message content, and then publishes the message to the MQTT server;
[0044] S5.4. Use Postman to send a POST request to the manualTest method. The request body contains a JSON object of the test subject. Send a POST request to oneClickTest to trigger a one-click test.
[0045] As a further improvement of the technical solution, in S5.3, the heartbeat interval and message retention configuration test parameters introduced in the MqttClient class are specifically:
[0046] S5.31. Create a new configuration class AppConfig and use the @Value annotation to inject environment variables: URL, heartbeat interval, and message retention;
[0047] S5.32. In the application.properties file, provide default values for the environment variables: URL defaults to L, heartbeat interval defaults to i, and message retention defaults to f;
[0048] S5.33. In the MqttClient class, obtain the configuration class AppConfig through dependency injection to obtain the URL, heartbeat interval and message retention settings of the MQTT server. In the init method of MqttClient, use the heartbeat interval obtained from the configuration class to set the setKeepAliveInterval method of MqttConnectOptions. In the publish method, use the message retention settings obtained from the configuration class to decide whether to retain the message.
[0049] On the other hand, the present invention provides a verification method for a software implementation system of a network communication protocol for geophysical dedicated equipment, which is used to verify the software implementation system of the network communication protocol for geophysical dedicated equipment, and comprises the following steps:
[0050] S6.1. Realize network communication for geophysical equipment;
[0051] S6.2. Geophysical equipment is uniformly connected to the networking and operation monitoring platform;
[0052] S6.3. Use the Spring Boot 3 framework to verify whether the geophysical equipment can correctly communicate using the MQTT protocol.
[0053] Compared with the prior art, the present invention has the following beneficial effects:
[0054] 1. In the software implementation system of the network communication protocol for geophysical special equipment and its verification method, the MQTT network communication protocol is adopted, which is a lightweight message transmission protocol. Different MQTT QoS levels can be selected according to the importance of the message to ensure the reliability and efficiency of data transmission. The heartbeat mechanism of MQTT can help maintain the state of long connections and ensure the stability of connections. The Java SDK microservice architecture makes the system easy to expand and can dynamically adjust the number of service instances according to the load. Each microservice can be deployed, expanded and upgraded independently, which improves the flexibility of the overall system. Through Java asynchronous I / O (t-io), system resources can be used more effectively and resource waste can be reduced. MQTT provides lightweight message transmission, the microservice architecture ensures flexible service management and deployment, and t-io realizes network communication. Combining MQTT, microservices and t-io can build a highly scalable and efficient communication system.
[0055] 2. In the software implementation system and verification method of the network communication protocol for geophysical special equipment, the SpringBoot framework is used to build the backend service, which provides automatic configuration and support, and can quickly build the project structure. Spring Boot supports the integration of multiple frameworks, including MyBatis, Security, and Actuator. It integrates Spring Security, which can easily implement identity authentication and authorization; MyBatis is an excellent ORM (object-relational mapping) framework that can map Java objects to database tables. MyBatis supports the mapping between Java types and database types, which improves type safety. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is a flowchart of the overall process of the present invention.
[0057] The meaning of each number in the figure is:
[0058] 1. Distributed cluster architecture unit; 2. Equipment access and management unit; 3. Protocol testing unit. DETAILED DESCRIPTION
[0059] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Embodiment 1:
[0060] See also Figure 1 As shown, a software implementation system for a network communication protocol for geophysical dedicated equipment is provided, including
[0061] Distributed cluster architecture unit 1 is based on MQTT network communication protocol, Java SDK microservice architecture and Java asynchronous I / O to realize network communication of geophysical special equipment;
[0062] In this embodiment, the distributed cluster architecture unit 1 includes a communication protocol module, a microservice architecture module and an encapsulation module;
[0063] Among them, the communication protocol module uses MQTT v3.1.1 as the basic communication protocol to realize message transmission between devices and uses Java asynchronous I / O to realize network communication;
[0064] Furthermore, MQTT is a lightweight publish / subscribe messaging protocol that is very suitable for resource-constrained devices. Java's NIO (Non-blocking I / O) allows programs to not be blocked while waiting for I / O operations to complete, which means that other tasks can be performed while waiting for I / O, improving the responsiveness and efficiency of the program. The MQTT protocol itself is very resource-efficient, and asynchronous I / O further improves the resource utilization efficiency of the system. Using the MQTT v3.1.1 protocol and Java asynchronous I / O, you can build an efficient, reliable, and easily scalable network communication system, including the following steps:
[0065] S1.1. Select a Java client library that supports MQTT v3.1.1, such as Eclipse Paho or Hivemq client library, and add it to the project's dependencies. Import the t-io library and add it to the project's dependencies.
[0066] S1.2. Create an MQTT client class to manage the connection with the MQTT Broker, message subscription and publishing; implement the method for the client to connect to the MQTT Broker, including connection and disconnection operations;
[0067] S1.3. Configure the t-io library to support asynchronous I / O operations, and use the API provided by the t-io library to implement asynchronous read and write operations to improve the efficiency of network communication;
[0068] The microservice architecture module uses the Java SDK microservice architecture to provide SDK support for devices, which is used to support template and annotation methods to subscribe and publish messages;
[0069] Furthermore, the template class provides a structured framework that enables developers to quickly integrate MQTT functions. Annotations simplify the code writing process, allowing developers to specify subscription and publishing topics in a declarative way without having to manually write complex subscription and publishing logic. Template classes and annotations can help reduce duplicate code because they encapsulate common behaviors and functions, such as connecting, subscribing, and publishing messages, and improve development efficiency. The following steps are included:
[0070] S2.1. Create an MQTT client class to manage the connection with the MQTT Broker, and the subscription and publishing of messages.
[0071] S2.2. Create a template class that contains MQTT client operations, such as methods for connecting, subscribing, and publishing messages, which is used to inherit the template class and implement specific functions;
[0072] The specific functions are:
[0073] Including processing received messages and providing interfaces for different message processing strategies;
[0074] It also includes message filtering, dynamic filtering rules are input from the outside, and messages are dynamically filtered according to light intensity and site code;
[0075] Dynamic filtering rules dynamically filter messages based on light intensity and site codes. By processing only messages with light intensity reaching a certain threshold, energy can be saved because unnecessary or invalid data will not be processed. Reducing unnecessary data processing enables the system to respond to important information more quickly. Excluding data generated under low light conditions can reduce false alarms or false positives, thereby improving the accuracy of data analysis. Ensuring that only data from specific sites is processed helps achieve more accurate positioning and tracking. By limiting the processing of data from specific sites, the opportunity for unauthorized access or attacks can be reduced. Specifically:
[0076] S2.21. Extend the FilterRule class (data model class that defines filtering rules): add the minimum light intensity, the maximum light intensity and the site code to the FilterRule class, and provide getter and setter methods for the FilterRule class;
[0077] S2.22. Define filtering rules in the configuration center, store the filtering rules in YAML format, and define the device ID, data type, site code, minimum light intensity, maximum light intensity, and whether to enable for each rule;
[0078] S2.23. Create a service FilterRuleService. When the service starts, call the refreshFilterRules() method to initialize the filter rules. The refreshFilterRules() method obtains the latest filter rule list from the configuration center through the REST template (RestTemplate). Define a shouldFilter() method for each message. This method determines whether the message should be filtered based on the site code and light intensity range in the filter rule.
[0079] S2.24. Inject FilterRuleService into the EarthPhysicsMqttClient class, update the processing methods handleTemperatureMessage and handleSeismicMessage, and call the shouldFilter() method before processing the message to check whether the message should be filtered;
[0080] S2.25. Update the Message class to include the site code and light intensity, and provide getter and setter methods for the Message class;
[0081] S2.26. When processing a message, parse the site code and light intensity from the message string and set them into the Message object. Use the Message object to call the shouldFilter() method to decide whether to filter the message.
[0082] S2.3. Create custom annotations to mark the subscription and publishing methods of messages, create an annotation processor class that is responsible for processing methods with custom annotations, and use custom annotations in the client class to mark the message processing methods;
[0083] S2.4, deploying the client to geophysical dedicated equipment;
[0084] The encapsulation module is used to encapsulate topics, data structures, and MQTT transmission protocols to simplify the operation process on the device side;
[0085] Furthermore, encapsulation makes each part (such as the subject, data structure and transmission protocol) an independent module, which can be independently developed, tested and maintained. When a part needs to be updated or repaired, only the relevant encapsulation needs to be modified without affecting other parts of the entire system. The encapsulated modules can be more easily integrated into the existing system, reducing the workload and complexity of integration. The encapsulated components can be reused in multiple projects, reducing the workload of repeated coding. The following steps are included:
[0086] S3.1. Define MQTT topics to distinguish different data streams or devices. Topics include: temperature sensor data, seismic sensor data, and magnetic field sensor data.
[0087] S3.2, define a data structure to store data of geophysical sensors, the data structure includes device IDid, data type ty, timestamp ti, altitude h, noise level z of the data, and calibration coefficient r of the sensor;
[0088] S3.3. Create an MQTT client connection class to establish a connection with the MQTT server;
[0089] S3.4. Define a method named publish to send a message to the topic;
[0090] S3.5. Define a method called subscribe to subscribe to a topic and process the received messages;
[0091] S3.6. Integrate topics, data structures, MQTT client connection classes, publish methods, and subscribe methods for subscribing to topics, and test them to ensure that the client can publish and receive messages correctly.
[0092] The equipment access and management unit 2 establishes a platform for unified access, networking and operation status monitoring of geophysical special equipment based on the distributed cluster architecture unit 1;
[0093] In this embodiment, the device access and management unit 2 provides interfaces and services for device access to the network, so that various geophysical devices can access the network through the MQTT protocol. This unit ensures that all geophysical devices can access the network in a standardized manner and can communicate with other devices or central servers. It also provides an operation monitoring function that can continuously monitor the status, performance and network communication of the device;
[0094] Among them, geophysical special equipment refers to equipment for various geophysical detection and measurement, including seismographs, gravimeters, magnetometers, remote sensing equipment, GPS receivers, etc.
[0095] Protocol test unit 3 uses the Spring Boot 3 framework to verify whether the geophysical dedicated equipment managed by device access and management unit 2 can correctly communicate using the MQTT protocol, and introduces the heartbeat interval and message retention configuration as test parameters to verify the stable connection status of the equipment;
[0096] In this embodiment, the protocol test unit 3 includes a configuration and device management module and a test module;
[0097] Among them, the configuration and device management module uses Spring Boot 3 and MyBatis framework to control the information configuration of the security control gateway, including the creation, modification, deletion and query functions of the configuration, and realizes the access management of geophysical special equipment, including equipment registration, authentication, and status monitoring. The Spring Security framework is used to achieve the security of the equipment.
[0098] Furthermore, Spring Boot supports configuration using YAML or Properties files, making configuration more concise and easy to manage. Spring Boot naturally supports microservice architecture, making it easy to split applications into multiple independent services. Spring Boot integrates the Spring Security framework, which can easily implement authentication and authorization, and can implement fine-grained access control to ensure that only authorized users can access specific resources. MyBatis is an excellent persistence layer framework that can simplify database operations. MyBatis supports SQL mapping files, allowing developers to write native SQL statements and map the results to Java objects, including the following steps:
[0099] S4.1. Use Spring Boot 3 to create a RESTful API interface to allow users to submit new configuration information. In the backend service, use MyBatis to write the Mapper file and the corresponding DAO layer interface to handle the data insertion operation.
[0100] S4.2. Create a RESTful API interface for updating, deleting, and querying configurations, and use MyBatis's update, delete, and query statements to modify the configuration information in the database;
[0101] S4.3. Create a RESTful API interface for device registration and use MyBatis to save the basic information of the new device, including device ID and type;
[0102] S4.4. Create a RESTful API interface for device authentication. In the backend service, implement the authentication logic. You may need to check the device ID, key and other information to confirm the identity of the device.
[0103] S4.5. Create a status monitoring RESTful API interface, use MyBatis to store the device status information, and regularly query the device status information to obtain the latest status. It is also necessary to implement a scheduled task to regularly check the device status.
[0104] The test module uses Spring MVC to support real-time data and instruction data testing on the device side. Users can manually input test cases and view test results. It also supports one-click testing on the device side, generates test reports, automatically executes predefined test case sets, and collects test results.
[0105] Furthermore, Spring MVC supports flexible URL routing configuration, which makes it easy to define different endpoints for device data and instructions. Controller methods can be defined to handle specific HTTP methods (GET, POST, etc.) and can receive various types of parameters, including JSON, XML, etc. Spring MVC can automatically bind data in HTTP requests to Java objects, reducing the workload of manual parsing and conversion of data. Custom data binders can be created to handle complex object binding logic. Spring MVC supports asynchronous request processing, and the @Async annotation can be used to handle long-running tasks and improve response speed. The specific steps include:
[0106] S5.1. Add Spring Web MVC dependencies to the project's build file. Add Gson dependencies for serialization and deserialization of JSON data. Add dependencies for MQTT client libraries, such as Eclipse Paho's MQTT client. These dependencies allow you to use Spring MVC's features and can easily handle JSON data and MQTT communications.
[0107] S5.2. Create a RESTful controller class named TestController, define a method named manualTest, which receives a JSON object containing a test topic and executes the manual test logic, and define a method named oneClickTest, which executes the one-click test logic, that is, looping through a series of preset topics and publishing test messages. These methods allow users to trigger different test operations through HTTP requests;
[0108] S5.3. Create a class named MqttClient, introduce the heartbeat interval (the time interval for the client to send heartbeat messages to the server) and message retention configuration test parameters in the MqttClient class, and inject them into the controller; implement an initialization method init, in which an MQTT client instance is created and connected to the MQTT server, and implement a publish method, which receives the topic and message content, and then publishes the message to the MQTT server;
[0109] Among them, the introduction of the heartbeat interval helps to maintain the stability of the connection between the client and the server. By judging whether the geophysical special equipment uses the MQTT protocol correctly for communication, its connection stability is determined. Specifically, if the server does not receive the client's message within the specified time, it will think that the connection has been disconnected and close the connection; the client sends heartbeat messages regularly to avoid this situation. When the network is unstable, the heartbeat interval can help the client detect the loss of connection more quickly and try to reconnect. Retaining messages can ensure that subscribers receive previously published messages. For new subscribers who need to understand the current status of the system, retaining messages can provide the latest status updates, such as the current readings of sensors. The heartbeat interval and message retention configuration test parameters introduced in the MqttClient class are as follows:
[0110] S5.31. Create a new configuration class AppConfig and use the @Value annotation to inject environment variables: URL, heartbeat interval, and message retention;
[0111] S5.32. In the application.properties file, provide default values for the environment variables: URL defaults to L, heartbeat interval defaults to i, and message retention defaults to f;
[0112] S5.33. In the MqttClient class, obtain the configuration class AppConfig through dependency injection to obtain the URL, heartbeat interval and message retention settings of the MQTT server. In the init method of MqttClient, use the heartbeat interval obtained from the configuration class to set the setKeepAliveInterval method of MqttConnectOptions. In the publish method, use the message retention settings obtained from the configuration class to decide whether to retain the message.
[0113] S5.34. In the TestController class, no additional changes are required because the heartbeat interval and message retention are already handled by the configuration in the MqttClient class;
[0114] S5.34. Use Postman to send a POST request to the manualTest method. The request body contains a JSON object of the test subject. Send a POST request to oneClickTest to trigger a one-click test.
[0115] After the test is completed, to determine whether the geophysical equipment can correctly communicate using the MQTT protocol, the following conditions must be ensured:
[0116] First, confirm that the device has successfully connected to the MQTT server and check the connection status on the device side;
[0117] Subscribe to the corresponding test topic on the device side and listen to whether messages are received. Verify this through the device's log or console output.
[0118] Confirm whether the content of the received message is consistent with the content sent;
[0119] Observe whether the device sends heartbeat messages according to the configured heartbeat interval and whether it can maintain the connection status for a period of time.
[0120] Front-end implementation: Use the Vue framework to build front-end applications, and combine UI libraries such as Element UI to implement interface design; use the Axios HTTP library to communicate with the back-end service to implement data interaction functions; use Vue Router to implement page routing management and support multi-page applications; use Vuex to implement state management and realize data sharing and state synchronization between components.
[0121] Electron-Vite packaging:
[0122] Use Electron to package Vue applications into EXE desktop applications to achieve cross-platform operation. Use Vite as a building tool to improve packaging speed and development experience. Configure Electron's main process and rendering process to implement window management, system tray and other functions of desktop applications. Embodiment 2:
[0123] The difference between Example 2 of the present invention and Example 1 is that this example introduces a software implementation method of a network communication protocol used by a software implementation system of a network communication protocol for geophysical dedicated equipment.
[0124] The verification method of the software implementation system of the network communication protocol of the geophysical special equipment is used to verify the software implementation system of the network communication protocol of the geophysical special equipment, and comprises the following steps:
[0125] S6.1. Realize network communication for geophysical equipment;
[0126] S6.2. Geophysical equipment is uniformly connected to the networking and operation monitoring platform;
[0127] S6.3. Use the Spring Boot 3 framework to verify whether the geophysical equipment can correctly communicate using the MQTT protocol.
[0128] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments, and the above embodiments and descriptions are only preferred examples of the present invention, and are not intended to limit the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, and these changes and improvements all fall within the scope of the present invention to be protected.
Claims
1. A software implementation system for a network communication protocol for geophysical special equipment, characterized in that: include: A distributed cluster architecture unit (1), wherein the distributed cluster architecture unit (1) is used to realize network communication of geophysical special equipment based on MQTT network communication protocol, JavaSDK microservice architecture and Java asynchronous I / O; A device access and management unit (2), wherein the device access and management unit (2) establishes a platform for unified access, networking and operation status monitoring of geophysical special equipment based on the distributed cluster architecture unit (1); A protocol testing unit (3), wherein the protocol testing unit (3) is used to verify whether the geophysical dedicated device managed by the device access and management unit (2) can correctly communicate using the MQTT protocol, and introduces a heartbeat interval and a message retention configuration as test parameters to verify the stable connection state of the device; The protocol test unit (3) includes a configuration and device management module and a test module; Among them, the configuration and device management module uses Spring Boot 3 and MyBatis framework to configure the information of the security control gateway; it implements the access management of geophysical special equipment and uses the Spring Security framework to achieve the security of the equipment; The test module uses Spring MVC to support real-time data and instruction data testing on the device side. Users can manually input test cases and view test results. It also supports one-click testing on the device side, generates test reports, automatically executes predefined test case sets, and collects test results. The Spring Boot 3 and MyBatis frameworks are used for information configuration of the security control gateway and access management of geophysical dedicated equipment, including the following steps: S4.
1. Use Spring Boot 3 to create a RESTful API interface to allow users to submit new configuration information. In the backend service, use MyBatis to write the Mapper file and the corresponding DAO layer interface to handle the data insertion operation. S4.
2. Create a RESTful API interface for updating, deleting, and querying configurations, and use MyBatis's update, delete, and query statements to modify the configuration information in the database; S4.
3. Create a RESTful API interface for device registration and use MyBatis to save the basic information of the new device; S4.
4. Create a RESTful API interface for device authentication; S4.
5. Create a status monitoring RESTful API interface, use MyBatis to store device status information, and regularly query the device status information to obtain the latest status; The test module uses Spring MVC and specifically includes the following steps: S5.
1. Add Spring Web MVC dependency in the project's build file; add Gson dependency for serialization and deserialization of JSON data; add MQTT client library dependency; S5.
2. Create a RESTful controller class named TestController, define a method named manualTest that receives a JSON object containing the test subject and executes the manual test logic, and define a method named oneClickTest that executes the one-click test logic; S5.
3. Create a class named MqttClient, introduce the heartbeat interval and message retention configuration test parameters in the MqttClient class, and inject it into the controller; implement an initialization method init, in which an MQTT client instance is created and connected to the MQTT server, and implement a publish method, which receives the topic and message content, and then publishes the message to the MQTT server; S5.
4. Use Postman to send a POST request to the manualTest method. The request body contains a JSON object of the test subject. Send a POST request to oneClickTest to trigger a one-click test.
2. The software implementation system of the network communication protocol for geophysical special equipment according to claim 1 is characterized by: The distributed cluster architecture unit (1) comprises a communication protocol module, a microservice architecture module and a packaging module; Among them, the communication protocol module uses MQTT v3.1.1 as the basic communication protocol to realize message transmission between devices and uses Java asynchronous I / O to realize network communication; The microservice architecture module uses the Java SDK microservice architecture to provide SDK support for devices, which is used to support template and annotation methods to subscribe and publish messages; The encapsulation module is used to encapsulate topics, data structures, and MQTT transmission protocols.
3. The software implementation system of the network communication protocol for geophysical special equipment according to claim 2 is characterized by: The communication protocol module uses the MQTT protocol and Java asynchronous I / O as the communication protocol between the device and the platform, including the following steps: S1.
1. Select a Java client library that supports MQTT v3.1.1 and add it to the project's dependencies. Import the t-io library and add it to the project's dependencies. S1.
2. Create an MQTT client class to manage the connection with the MQTT Broker, and the subscription and publishing of messages; S1.
3. Configure the t-io library to support asynchronous I / O operations, and use the API provided by the t-io library to implement asynchronous read and write operations to improve the efficiency of network communication.
4. The software implementation system of the network communication protocol for geophysical special equipment according to claim 2 is characterized by: The microservice architecture module adopts the Java SDK microservice architecture to provide SDK support for the device, which is used to support template and annotation mode subscription and publishing of messages, including the following steps: S2.
1. Create an MQTT client class to manage the connection with the MQTT Broker, and the subscription and publishing of messages. S2.
2. Create a template class that contains MQTT client operations and is used to inherit the template class and implement specific functions; The specific functions are: Including processing received messages and providing interfaces for different message processing strategies; It also includes message filtering, dynamic filtering rules are input from the outside, and messages are dynamically filtered according to light intensity and site code; S2.
3. Create custom annotations to mark the subscription and publishing methods of messages, create an annotation processor class that is responsible for processing methods with custom annotations, and use custom annotations in the client class to mark the message processing methods; S2.
4. Deploy the client to the geophysical dedicated equipment.
5. The software implementation system of the network communication protocol for geophysical special equipment according to claim 2 is characterized by: The encapsulation module is used to encapsulate the topic, data structure, and MQTT transmission protocol, including the following steps: S3.
1. Define MQTT topics, including: temperature sensor data, earthquake sensor data, and magnetic field sensor data; S3.2, define a data structure to store data of geophysical sensors, the data structure includes device IDid, data type ty, timestamp ti, altitude h, noise level z of the data, and calibration coefficient r of the sensor; S3.
3. Create an MQTT client connection class to establish a connection with the MQTT server; S3.
4. Define a method named publish to send a message to the topic; S3.
5. Define a method called subscribe to subscribe to a topic and process the received messages; S3.
6. Integrate topics, data structures, MQTT client connection classes, publish methods, and subscribe methods for subscribing to topics, and test them to ensure that the client can publish and receive messages correctly.
6. The software implementation system of the network communication protocol for geophysical special equipment according to claim 5 is characterized by: In S5.3, the heartbeat interval and message retention configuration test parameters introduced in the MqttClient class are specifically: S5.
31. Create a new configuration class AppConfig and use the @Value annotation to inject environment variables: URL, heartbeat interval, and message retention; S5.
32. In the application.properties file, provide default values for the environment variables: URL defaults to L, heartbeat interval defaults to i, and message retention defaults to f; S5.
33. In the MqttClient class, obtain the configuration class AppConfig through dependency injection to obtain the URL, heartbeat interval and message retention settings of the MQTT server. In the init method of MqttClient, use the heartbeat interval obtained from the configuration class to set the setKeepAliveInterval method of MqttConnectOptions. In the publish method, use the message retention settings obtained from the configuration class to decide whether to retain the message.
7. A verification method for a software implementation system of a network communication protocol for geophysical special equipment, used for verifying a software implementation system of a network communication protocol for geophysical special equipment as claimed in any one of claims 1 to 6, characterized in that: The steps include: S6.
1. Realize network communication for geophysical equipment; S6.
2. Geophysical equipment is uniformly connected to the networking and operation monitoring platform; S6.
3. Use the Spring Boot 3 framework to verify whether the geophysical equipment can correctly communicate using the MQTT protocol.
Citation Information
Patent Citations
Public protocol Internet of things platform and device access method
CN109587228A
