k 2 years ago
parent
commit
92acb12426
39 changed files with 11 additions and 282 deletions
  1. 1 0
      .gitignore
  2. 10 0
      src/main/java/com/jwk/spring/boot/autoconfigure/ModbusAutoConfiguration.java
  3. 0 5
      target/maven-archiver/pom.properties
  4. 0 0
      target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  5. 0 16
      target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  6. 0 0
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
  7. 0 1
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
  8. BIN
      target/modbus-spring-boot-starter.jar
  9. 0 6
      target/modbus-spring-boot-starter/META-INF/MANIFEST.MF
  10. 0 2
      target/modbus-spring-boot-starter/META-INF/additional-spring-configuration-metadata.json
  11. 0 5
      target/modbus-spring-boot-starter/META-INF/maven/com.jwk/modbus-spring-boot-starter/pom.properties
  12. 0 146
      target/modbus-spring-boot-starter/META-INF/maven/com.jwk/modbus-spring-boot-starter/pom.xml
  13. 0 98
      target/modbus-spring-boot-starter/META-INF/spring-configuration-metadata.json
  14. 0 3
      target/modbus-spring-boot-starter/META-INF/spring.factories
  15. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusAutoConfiguration.class
  16. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusProperties$RtuMaster.class
  17. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusProperties$TcpMaster.class
  18. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusProperties.class
  19. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusRtuMasterTemplate.class
  20. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusTcpMasterTemplate.class
  21. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/constant/Constant$FUNCTION_CODE.class
  22. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/constant/Constant.class
  23. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/constant/DATA_TYPE_WRAPPER.class
  24. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/ModbusMasterUtil.class
  25. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/ModbusRtuMaster.class
  26. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/ModbusTcpMaster.class
  27. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/util/rtu/MyProcessImageListener.class
  28. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/util/rtu/SerialPortUtils.class
  29. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/util/rtu/SerialPortWrapperImpl.class
  30. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/test/ModbusTcpMasterUtil.class
  31. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/test/RtuMasterTest.class
  32. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/test/RtuSlaveTest$1.class
  33. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/test/RtuSlaveTest.class
  34. BIN
      target/modbus-spring-boot-starter/com/jwk/spring/boot/test/Test.class
  35. BIN
      target/modbus-spring-boot-starter/lib/RXTXcomm.jar
  36. BIN
      target/modbus-spring-boot-starter/lib/jssc-2.8.0.jar
  37. BIN
      target/modbus-spring-boot-starter/lib/modbus4j-3.0.5.jar
  38. BIN
      target/modbus-spring-boot-starter/lib/rxtxParallel.dll
  39. BIN
      target/modbus-spring-boot-starter/lib/rxtxSerial.dll

+ 1 - 0
.gitignore

@@ -1,2 +1,3 @@
 /.idea/
 /target/
+/modbus-spring-boot-starter.iml

+ 10 - 0
src/main/java/com/jwk/spring/boot/autoconfigure/ModbusAutoConfiguration.java

@@ -15,6 +15,11 @@ import org.springframework.context.annotation.Configuration;
 public class ModbusAutoConfiguration {
 
 
+    /**
+     * RTU-Master
+     * @param modbusProperties
+     * @return
+     */
     @Bean
     @ConditionalOnProperty(prefix = "modbus.rtu-master", name = "open", havingValue = "true")
     public ModbusRtuMasterTemplate modbusRtuMasterTemplate(ModbusProperties modbusProperties) {
@@ -23,6 +28,11 @@ public class ModbusAutoConfiguration {
                 , rtu.getStopBits(), rtu.getParity(), rtu.getFlowControlIn(), rtu.getFlowControlOut());
     }
 
+    /**
+     * TCP-Master
+     * @param modbusProperties
+     * @return
+     */
     @Bean
     @ConditionalOnProperty(prefix = "modbus.tcp-master", name = "open", havingValue = "true")
     public ModbusTcpMasterTemplate modbusTcpMasterTemplate(ModbusProperties modbusProperties) {

+ 0 - 5
target/maven-archiver/pom.properties

@@ -1,5 +0,0 @@
-#Generated by Maven
-#Tue Dec 13 00:19:07 CST 2022
-version=1.0
-groupId=com.jwk
-artifactId=modbus-spring-boot-starter

+ 0 - 0
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst


+ 0 - 16
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -1,16 +0,0 @@
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/modbus4j/util/rtu/MyProcessImageListener.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/test/RtuSlaveTest.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/modbus4j/ModbusMasterUtil.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/autoconfigure/ModbusProperties.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/autoconfigure/ModbusAutoConfiguration.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/autoconfigure/ModbusRtuMasterTemplate.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/test/ModbusTcpMasterUtil.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/test/Test.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/test/RtuMasterTest.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/modbus4j/util/rtu/SerialPortUtils.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/modbus4j/ModbusRtuMaster.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/modbus4j/ModbusTcpMaster.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/constant/Constant.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/modbus4j/util/rtu/SerialPortWrapperImpl.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/constant/DATA_TYPE_WRAPPER.java
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/main/java/com/jwk/spring/boot/autoconfigure/ModbusTcpMasterTemplate.java

+ 0 - 0
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst


+ 0 - 1
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

@@ -1 +0,0 @@
-/Users/jwk/work/IdeaProjects/modbus-spring-boot-starter/src/test/java/com/jwk/AppTest.java

BIN
target/modbus-spring-boot-starter.jar


+ 0 - 6
target/modbus-spring-boot-starter/META-INF/MANIFEST.MF

@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-Archiver-Version: Plexus Archiver
-Built-By: jwk
-Created-By: Apache Maven 3.6.3
-Build-Jdk: 1.8.0_221
-

+ 0 - 2
target/modbus-spring-boot-starter/META-INF/additional-spring-configuration-metadata.json

@@ -1,2 +0,0 @@
-{
-}

+ 0 - 5
target/modbus-spring-boot-starter/META-INF/maven/com.jwk/modbus-spring-boot-starter/pom.properties

@@ -1,5 +0,0 @@
-#Generated by Maven
-#Tue Dec 13 00:19:07 CST 2022
-version=1.0
-groupId=com.jwk
-artifactId=modbus-spring-boot-starter

+ 0 - 146
target/modbus-spring-boot-starter/META-INF/maven/com.jwk/modbus-spring-boot-starter/pom.xml

@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>com.jwk</groupId>
-  <artifactId>modbus-spring-boot-starter</artifactId>
-  <version>1.0</version>
-
-  <name>modbus-spring-boot-starter</name>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <maven.compiler.source>1.8</maven.compiler.source>
-    <maven.compiler.target>1.8</maven.compiler.target>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-starter-web</artifactId>
-      <version>2.2.4.RELEASE</version>
-    </dependency>
-<!--    生成配置文件提示-->
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-configuration-processor</artifactId>
-      <version>2.2.4.RELEASE</version>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.11</version>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.projectlombok</groupId>
-      <artifactId>lombok</artifactId>
-      <version>1.18.10</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <version>1.7.7</version>
-    </dependency>
-
-    <!-- springboot自带logback-->
-    <dependency>
-      <groupId>ch.qos.logback</groupId>
-      <artifactId>logback-core</artifactId>
-      <version>1.1.11</version>
-    </dependency>
-    <dependency>
-      <groupId>ch.qos.logback</groupId>
-      <artifactId>logback-classic</artifactId>
-      <version>1.1.11</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-      <version>3.9</version>
-    </dependency>
-
-
-    <!--modbus4j start-->
-    <dependency>
-      <groupId>com.RXTXcomm</groupId>
-      <artifactId>RXTXcomm</artifactId>
-      <version>3.0.5</version>
-      <scope>system</scope>
-      <systemPath>${project.basedir}/src/main/resources/lib/RXTXcomm.jar</systemPath>
-    </dependency>
-    <dependency>
-      <groupId>com.serotonin</groupId>
-      <artifactId>modbus4j</artifactId>
-      <version>3.0.5</version>
-      <scope>system</scope>
-      <systemPath>${project.basedir}/src/main/resources/lib/modbus4j-3.0.5.jar</systemPath>
-    </dependency>
-    <dependency>
-      <groupId>org.scream3r</groupId>
-      <artifactId>jssc</artifactId>
-      <version>2.8.0</version>
-      <scope>system</scope>
-      <systemPath>${project.basedir}/src/main/resources/lib/jssc-2.8.0.jar</systemPath>
-    </dependency>
-    <!--modbus4j end-->
-  </dependencies>
-
-  <build>
-    <finalName>${project.artifactId}</finalName>
-    <extensions>
-      <extension>
-        <groupId>org.apache.maven.wagon</groupId>
-        <artifactId>wagon-ssh</artifactId>
-        <version>2.8</version>
-      </extension>
-    </extensions>
-    <plugins>
-      <plugin>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-maven-plugin</artifactId>
-        <configuration>
-          <includeSystemScope>true</includeSystemScope>
-        </configuration>
-      </plugin>
-      <!-- 跳过单元测试 -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <skipTests>true</skipTests>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-  <repositories>
-    <repository>
-      <id>public</id>
-      <name>aliyun nexus</name>
-      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
-      <releases>
-        <enabled>true</enabled>
-      </releases>
-    </repository>
-  </repositories>
-  <pluginRepositories>
-    <pluginRepository>
-      <id>public</id>
-      <name>aliyun nexus</name>
-      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
-      <releases>
-        <enabled>true</enabled>
-      </releases>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-    </pluginRepository>
-  </pluginRepositories>
-</project>

+ 0 - 98
target/modbus-spring-boot-starter/META-INF/spring-configuration-metadata.json

@@ -1,98 +0,0 @@
-{
-  "groups": [
-    {
-      "name": "modbus",
-      "type": "com.jwk.spring.boot.autoconfigure.ModbusProperties",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties"
-    },
-    {
-      "name": "modbus.rtu-master",
-      "type": "com.jwk.spring.boot.autoconfigure.ModbusProperties$RtuMaster",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties"
-    },
-    {
-      "name": "modbus.tcp-master",
-      "type": "com.jwk.spring.boot.autoconfigure.ModbusProperties$TcpMaster",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties"
-    }
-  ],
-  "properties": [
-    {
-      "name": "modbus.rtu-master.baud-rate",
-      "type": "java.lang.Integer",
-      "description": "波特率",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$RtuMaster",
-      "defaultValue": 9600
-    },
-    {
-      "name": "modbus.rtu-master.data-bits",
-      "type": "java.lang.Integer",
-      "description": "数据位的位数,RTU是8位,ASCII是7位",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$RtuMaster",
-      "defaultValue": 8
-    },
-    {
-      "name": "modbus.rtu-master.flow-control-in",
-      "type": "java.lang.Integer",
-      "description": "硬件之间输入流应答控制",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$RtuMaster",
-      "defaultValue": 0
-    },
-    {
-      "name": "modbus.rtu-master.flow-control-out",
-      "type": "java.lang.Integer",
-      "description": "硬件之间输出流应答控制",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$RtuMaster",
-      "defaultValue": 0
-    },
-    {
-      "name": "modbus.rtu-master.open",
-      "type": "java.lang.Boolean",
-      "description": "是否打开串口",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$RtuMaster",
-      "defaultValue": false
-    },
-    {
-      "name": "modbus.rtu-master.parity",
-      "type": "java.lang.Integer",
-      "description": "奇偶校验位,无校验是0,奇校验是1,偶校验是2",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$RtuMaster",
-      "defaultValue": 0
-    },
-    {
-      "name": "modbus.rtu-master.port",
-      "type": "java.lang.String",
-      "description": "串口",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$RtuMaster",
-      "defaultValue": "COM1"
-    },
-    {
-      "name": "modbus.rtu-master.stop-bits",
-      "type": "java.lang.Integer",
-      "description": "停止位的位数,如果无奇偶校验为2,有奇偶校验为1",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$RtuMaster",
-      "defaultValue": 1
-    },
-    {
-      "name": "modbus.tcp-master.host",
-      "type": "java.lang.String",
-      "description": "ip",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$TcpMaster",
-      "defaultValue": "localhost"
-    },
-    {
-      "name": "modbus.tcp-master.open",
-      "type": "java.lang.Boolean",
-      "description": "是否打开Tcp连接",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$TcpMaster",
-      "defaultValue": false
-    },
-    {
-      "name": "modbus.tcp-master.port",
-      "type": "java.lang.Integer",
-      "description": "端口",
-      "sourceType": "com.jwk.spring.boot.autoconfigure.ModbusProperties$TcpMaster"
-    }
-  ],
-  "hints": []
-}

+ 0 - 3
target/modbus-spring-boot-starter/META-INF/spring.factories

@@ -1,3 +0,0 @@
-# Auto Configure
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-com.jwk.spring.boot.autoconfigure.ModbusAutoConfiguration

BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusAutoConfiguration.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusProperties$RtuMaster.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusProperties$TcpMaster.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusProperties.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusRtuMasterTemplate.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/autoconfigure/ModbusTcpMasterTemplate.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/constant/Constant$FUNCTION_CODE.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/constant/Constant.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/constant/DATA_TYPE_WRAPPER.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/ModbusMasterUtil.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/ModbusRtuMaster.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/ModbusTcpMaster.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/util/rtu/MyProcessImageListener.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/util/rtu/SerialPortUtils.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/modbus4j/util/rtu/SerialPortWrapperImpl.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/test/ModbusTcpMasterUtil.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/test/RtuMasterTest.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/test/RtuSlaveTest$1.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/test/RtuSlaveTest.class


BIN
target/modbus-spring-boot-starter/com/jwk/spring/boot/test/Test.class


BIN
target/modbus-spring-boot-starter/lib/RXTXcomm.jar


BIN
target/modbus-spring-boot-starter/lib/jssc-2.8.0.jar


BIN
target/modbus-spring-boot-starter/lib/modbus4j-3.0.5.jar


BIN
target/modbus-spring-boot-starter/lib/rxtxParallel.dll


BIN
target/modbus-spring-boot-starter/lib/rxtxSerial.dll