diff --git a/README-CN.md b/README-CN.md
index a5f1e9cc..a1519a7f 100644
--- a/README-CN.md
+++ b/README-CN.md
@@ -1,6 +1,6 @@
# IOT-COMMUNICATION
-[![Maven-v1.5.0](https://img.shields.io/badge/Maven-v1.5.0-brightgreen)](https://mvnrepository.com/artifact/com.github.xingshuangs/iot-communication)
+[![Maven-v1.5.1](https://img.shields.io/badge/Maven-v1.5.1-brightgreen)](https://mvnrepository.com/artifact/com.github.xingshuangs/iot-communication)
![Language-java8](https://img.shields.io/badge/Language-java8-blue)
![Idea-2022.02.03](https://img.shields.io/badge/Idea-2022.02.03-lightgrey)
![CopyRight-Oscura](https://img.shields.io/badge/CopyRight-Oscura-yellow)
@@ -29,7 +29,7 @@
com.github.xingshuangs
iot-communication
- 1.5.0
+ 1.5.1
```
diff --git a/README.md b/README.md
index f631e2d6..62098be5 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# IOT-COMMUNICATION
-[![Maven-v1.5.0](https://img.shields.io/badge/Maven-v1.5.0-brightgreen)](https://mvnrepository.com/artifact/com.github.xingshuangs/iot-communication)
+[![Maven-v1.5.1](https://img.shields.io/badge/Maven-v1.5.1-brightgreen)](https://mvnrepository.com/artifact/com.github.xingshuangs/iot-communication)
![Language-java8](https://img.shields.io/badge/Language-java8-blue)
![Idea-2022.02.03](https://img.shields.io/badge/Idea-2022.02.03-lightgrey)
![CopyRight-Oscura](https://img.shields.io/badge/CopyRight-Oscura-yellow)
@@ -30,7 +30,7 @@ Add the dependency to pom.xml in the JAVA project.
com.github.xingshuangs
iot-communication
- 1.5.0
+ 1.5.1
```
diff --git a/pom.xml b/pom.xml
index 76d1c6b9..9bcdc898 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,17 +6,17 @@
com.github.xingshuangs
iot-communication
- 1.5.0
+ 1.5.1
jar
iot-communication
目前它只是一个物联网通信的工具,包含
- 1、西门子S7通信协议,支持西门子S1500,S1200,S400,S300,S200Smart,西门子机床828D;
- 2、Modbus通信协议,支持ModbusTcp,ModbusRtuOverTcp,ModbusAsciiOverTcp;
- 3、三菱MELSEC(MC)通信协议,支持PLC iQ-R系列, Q/L系列, QnA系列, 目前只测试了L系列;
- 4、RTSP, RTCP, RTP, H264, MP4 (FMP4)协议,RTSP + H264 + FMP4 + WebSocket + MSE + WEB;
- 5、基础字节数组解析转换工具
+ 1、西门子S7通信协议,支持西门子S1500,S1200,S400,S300,S200Smart,西门子机床828D;
+ 2、Modbus通信协议,支持ModbusTcp,ModbusRtuOverTcp,ModbusAsciiOverTcp;
+ 3、三菱MELSEC(MC)通信协议,支持PLC iQ-R系列, Q/L系列, QnA系列, 目前只测试了L系列;
+ 4、RTSP, RTCP, RTP, H264, MP4 (FMP4)协议,RTSP + H264 + FMP4 + WebSocket + MSE + WEB;
+ 5、基础字节数组解析转换工具;
diff --git a/src/main/java/com/github/xingshuangs/iot/protocol/melsec/algorithm/McGroupItem.java b/src/main/java/com/github/xingshuangs/iot/protocol/melsec/algorithm/McGroupItem.java
index dc90f544..4ee2d8fa 100644
--- a/src/main/java/com/github/xingshuangs/iot/protocol/melsec/algorithm/McGroupItem.java
+++ b/src/main/java/com/github/xingshuangs/iot/protocol/melsec/algorithm/McGroupItem.java
@@ -57,6 +57,11 @@ public McGroupItem(int actualLength) {
this.actualLength = actualLength;
}
+ /**
+ * 判定是否在有效范围内
+ *
+ * @return true:是,false:否
+ */
public boolean inRange() {
return this.off + this.len < this.actualLength;
}
diff --git a/src/main/java/com/github/xingshuangs/iot/protocol/rtp/model/payload/ExpGolomb.java b/src/main/java/com/github/xingshuangs/iot/protocol/rtp/model/payload/ExpGolomb.java
index f5c19240..534a66b9 100644
--- a/src/main/java/com/github/xingshuangs/iot/protocol/rtp/model/payload/ExpGolomb.java
+++ b/src/main/java/com/github/xingshuangs/iot/protocol/rtp/model/payload/ExpGolomb.java
@@ -100,6 +100,11 @@ public long readNBit(int size) {
return res;
}
+ /**
+ * 跳过指定size的bit数量
+ *
+ * @param size bit数量
+ */
public void skipBit(int size) {
this.readNBit(size);
}
diff --git a/src/main/java/com/github/xingshuangs/iot/protocol/rtp/model/payload/SeqParameterSet.java b/src/main/java/com/github/xingshuangs/iot/protocol/rtp/model/payload/SeqParameterSet.java
index aab8a5cb..cc8e7c92 100644
--- a/src/main/java/com/github/xingshuangs/iot/protocol/rtp/model/payload/SeqParameterSet.java
+++ b/src/main/java/com/github/xingshuangs/iot/protocol/rtp/model/payload/SeqParameterSet.java
@@ -66,10 +66,20 @@ public class SeqParameterSet {
private boolean aspectRatioInfoPresentFlag;
private double sarScale = 1;
+ /**
+ * 视频宽度
+ *
+ * @return 宽度
+ */
public int getWidth() {
return (int) Math.ceil((((this.picWidthInMbsMinus1 + 1) * 16) - this.frameCropLeftOffset * 2 - this.frameCropRightOffset * 2) * this.sarScale);
}
+ /**
+ * 视频高度
+ *
+ * @return 高度
+ */
public int getHeight() {
return ((2 - (this.frameMbsOnlyFlag ? 1 : 0)) * (this.picHeightInMapUnitsMinus1 + 1) * 16)
- ((this.frameMbsOnlyFlag ? 2 : 4) * (this.frameCropTopOffset + this.frameCropBottomOffset));
@@ -262,6 +272,4 @@ private static double calculateSarRatio(ExpGolomb expGolomb) {
return 1;
}
}
-
-
}
diff --git a/src/main/java/com/github/xingshuangs/iot/protocol/rtp/service/H264VideoParser.java b/src/main/java/com/github/xingshuangs/iot/protocol/rtp/service/H264VideoParser.java
index 004df1e4..a3ea3e49 100644
--- a/src/main/java/com/github/xingshuangs/iot/protocol/rtp/service/H264VideoParser.java
+++ b/src/main/java/com/github/xingshuangs/iot/protocol/rtp/service/H264VideoParser.java
@@ -52,7 +52,7 @@ public class H264VideoParser implements IPayloadParser {
/**
* 负载编号
*/
- private Integer payloadNumber;
+ private final Integer payloadNumber;
/**
* 基准时间戳
@@ -75,6 +75,7 @@ private H264VideoFrame doBuffers(long timestamp) {
if (this.buffers.isEmpty()) {
throw new RtpCommException("the number of buffers is 0");
}
+
H264NaluFuA naluFuA = this.buffers.get(0);
int sum = this.buffers.stream().mapToInt(x -> x.getPayload().length).sum();
ByteWriteBuff buff = new ByteWriteBuff(sum);
@@ -97,6 +98,7 @@ private H264VideoFrame doBuffers(long timestamp) {
*/
@Override
public void processPackage(RtpPackage rtp) {
+ // 过滤负载编号不一致的rtp
if (rtp.getHeader().getPayloadType() != this.payloadNumber) {
log.warn("payload numbers are inconsistent, expect[{}], actual[{}]", this.payloadNumber, rtp.getHeader().getPayloadType());
return;
diff --git a/src/main/java/com/github/xingshuangs/iot/protocol/rtp/service/IPayloadParser.java b/src/main/java/com/github/xingshuangs/iot/protocol/rtp/service/IPayloadParser.java
index 2ca58418..e7e2c3d2 100644
--- a/src/main/java/com/github/xingshuangs/iot/protocol/rtp/service/IPayloadParser.java
+++ b/src/main/java/com/github/xingshuangs/iot/protocol/rtp/service/IPayloadParser.java
@@ -39,7 +39,7 @@ public interface IPayloadParser {
/**
* 处理数据包
*
- * @param rtp rtp数据包
+ * @param rtp rtp数据包
*/
void processPackage(RtpPackage rtp);
diff --git a/src/main/java/com/github/xingshuangs/iot/protocol/s7/enums/EPlcType.java b/src/main/java/com/github/xingshuangs/iot/protocol/s7/enums/EPlcType.java
index 757c154f..8077fc58 100644
--- a/src/main/java/com/github/xingshuangs/iot/protocol/s7/enums/EPlcType.java
+++ b/src/main/java/com/github/xingshuangs/iot/protocol/s7/enums/EPlcType.java
@@ -41,10 +41,19 @@ public enum EPlcType {
;
+ /**
+ * PLC机架号
+ */
private final int rack;
+ /**
+ * PLC槽号
+ */
private final int slot;
+ /**
+ * PDU最大允许长度
+ */
private final int pduLength;
EPlcType(int rack, int slot, int pduLength) {
diff --git a/src/main/java/com/github/xingshuangs/iot/protocol/s7/service/MultiAddressRead.java b/src/main/java/com/github/xingshuangs/iot/protocol/s7/service/MultiAddressRead.java
index a6c3ac49..902ca229 100644
--- a/src/main/java/com/github/xingshuangs/iot/protocol/s7/service/MultiAddressRead.java
+++ b/src/main/java/com/github/xingshuangs/iot/protocol/s7/service/MultiAddressRead.java
@@ -49,7 +49,14 @@ public class MultiAddressRead {
*/
List requestItems = new ArrayList<>();
- public MultiAddressRead addData(String address, int count){
+ /**
+ * 添加数据
+ *
+ * @param address 地址
+ * @param count 字节数量
+ * @return MultiAddressRead
+ */
+ public MultiAddressRead addData(String address, int count) {
this.requestItems.add(AddressUtil.parseByte(address, count));
return this;
}
diff --git a/src/main/java/com/github/xingshuangs/iot/protocol/s7/service/S7PLC.java b/src/main/java/com/github/xingshuangs/iot/protocol/s7/service/S7PLC.java
index 143f01e2..90ad76a3 100644
--- a/src/main/java/com/github/xingshuangs/iot/protocol/s7/service/S7PLC.java
+++ b/src/main/java/com/github/xingshuangs/iot/protocol/s7/service/S7PLC.java
@@ -52,8 +52,6 @@
*/
public class S7PLC extends PLCNetwork {
- public static final int DEFAULT_PDU_LENGTH = 240;
-
public S7PLC() {
this(EPlcType.S1200, LOCALHOST, S7_PORT, EPlcType.S1200.getRack(), EPlcType.S1200.getSlot(), EPlcType.S1200.getPduLength());
}
diff --git a/tips/changeLog.md b/tips/changeLog.md
index 4c9aa44e..6305329d 100644
--- a/tips/changeLog.md
+++ b/tips/changeLog.md
@@ -1,4 +1,17 @@
+## v1.5.1
+
+- 更新时间:2024.04.09
+- S7: 根据PLC类型自动匹配参数,主要是槽号、机架号和PUDLength,解决300或400PLC需要填写不一样的槽号问题,或者1500PLC自动支持960大小的PDULength,而不是默认240,自动优化性能
+- S7: 重写S7服务端的readClientData方法,解决粘包问题
+- Modbus: 补充modbus的异常码
+- MC: 补充三菱协议添加序列号自增功能
+- RTSP: 对视频流为H265协议的识别,直接抛出异常原因,明确问题,目前只支持H264协议
+- RTSP: 添加SPS数据解析的指数哥伦布编码,从中提取视频的宽高数据,追加到视频轨道中
+- RTSP: 解决因SDP中缺失SPS和PPS等信息导致的视频无法播放问题,采用RTP中的SPS和PPS进行兼容处理
+- All: 所有异常消息和日志信息修改为英文,更加国际化
+
## v1.5.0
+
- 更新时间:2023.12.11
- MC:添加**三菱MC协议**,并添加相关教程文档
- S7: 修复读18倍数个int16或写12倍数个int16出现的BUG问题
@@ -9,6 +22,7 @@
- MIT: 所有源程序添加MIT协议声明
## v1.4.4
+
- 更新时间:2023.10.14
- S7: TSAP统一Remote的参数,基础值采用0x0300
- S7: 修复400PLC无法写入的问题,主要由于偷懒导致写操作最后多了一个没用的字节,1200、1500、200smart都是兼容的,老PLC兼容不了
@@ -16,6 +30,7 @@
- RTSP: 修复Rtsp由于长期占用公共线程导致UDP模式最多只能开2个摄像头的问题,目前采用独立线程,不影响公共线程池
## v1.4.3
+
- 更新时间:2023.09.28
- S7: S200-smart修改local为0x1000
- S7: 200smart下载功能实现并测试成功,上传功能优化
@@ -30,6 +45,7 @@
- RTSP: 修复rtsp关闭时因通道断开导致的错误
## v1.4.2
+
- 更新时间:2023.08.17
- S7添加非注解形式的批量读写,可以进行多地址的任意组合,通过S7Parameter配置参数
- S7重构Datum数据类型,实现上传功能(200smart测试成功),下载功能未测试成功,可能PLC的约束,待研究
@@ -43,6 +59,7 @@
- 字节数组解析中添加自定义字节数组数据提取的功能,通过ByteArrayParameter配置参数进行批量读取
## v1.4.1
+
- 更新时间:2023.07.09
- RtspFMp4Proxy添加数据缓存,增加缓存大小,用于重新数据排序,同时将关键帧和普通帧区分开
- RtspClient修复UDP/TCP模式网络异常断开后无法退出循环的问题
@@ -51,6 +68,7 @@
- S7地址格式兼容DB100.DBX0.0、DB100.DBB5、VB100、MW1
## v1.4.0
+
- 更新时间:2023.06.20
- 添加RTSP, RTCP, RTP, H264, MP4相关协议解析
- 添加RTSP客户端,获取视频流
@@ -58,6 +76,7 @@
- S7协议添加DTL数据格式读写,PDULength采用PLC返回的值,槽号默认值设为1
## v1.3.0
+
- 更新时间:2023.05.17
- 添加西门子协议中NCK的寻址方式,主要针对西门子机床828D的数据访问
- S7协议添加对time、date、timeOfDay数据类型的读写
@@ -67,6 +86,7 @@
- modbus添加短连接方式,添加readBoolean方法
## v1.2.7
+
- 更新时间:2023.03.16
- 修复下S7序列化读取时,由于实体类字段超过18个且读取数据量较小导致报文大小超过PDU的BUG
- S7通信支持短连接操作,默认长连接
@@ -75,55 +95,67 @@
- 添加Slf4j日志
## v1.2.6
+
- 更新时间:2022.12.06
- 紧急修复RequestItem中存储区参数一直为DB块导致无法访问其他区的问题
- lombok依赖版本升级到推荐版本
## v1.2.5
+
- 更新时间:2022.12.01
- 修改基础的sourceTSAP和destinationTSAP
- SocketBasic的方法暴露出来
- ByteReadBuff和ByteWriteBuff添加littleEndian字段
## v1.2.4
+
- 更新时间:2022.11.09
- 完善pduLength的数据大小约束
- 自动分割数据量大于pduLength的报文,支持大数据量的读写
## v1.2.3
+
- 更新时间:2022.10.31
- 添加S7协议的序列化访问功能
- 添加字节数组序列化解析功能
## v1.2.2
+
- 更新时间:2022.09.29
- 添加对200smart的PLC兼容,其V区就是DB1区
## v1.2.1
+
- 更新时间:2022.09.27
- 重构字节数组的读写方式,添加ByteReadBuff和ByteWriteBuff两个类
## v1.2.0
+
- 更新时间:2022.07.08
- 添加modbusTcp通信协议
## v1.1.1
+
- 更新时间:2022.05.17
- 移除没用的依赖包
## v1.1.0
+
- 更新时间:2022.05.15
- 添加S7通信协议
## v1.0.2
+
- 更新时间:2022.04.28
- 修复int16,uint16,int32,uint32的解析错误
## v1.0.1
+
- 更新时间:2021.02.25
- 修复float32和float64数据解析成list时候的错误
## v1.0.0
+
- 搭建时间:2021.02.17
- 目的:为了休闲乐趣,简单小尝试
- 项目初始化,添加字节数据解析功能
diff --git a/tutorial/README-S7-CN.md b/tutorial/README-S7-CN.md
index e5299622..740eb0ce 100644
--- a/tutorial/README-S7-CN.md
+++ b/tutorial/README-S7-CN.md
@@ -689,4 +689,6 @@ PLC的网络通信,根据不同型号PLC的PDULength而定,S1200 = 240,S15
| S300 | 240 | **0** | **2** |
| S400 | 480 | **0** | **3** |
| S1200 | 240 | **0** | **1** |
-| S1500 | 960 | **0** | **1** |
\ No newline at end of file
+| S1500 | 960 | **0** | **1** |
+
+> 7、一般PLC同时在线连接数量有限,切勿重复new S7PLC()!!!
\ No newline at end of file
diff --git a/tutorial/README-S7-EN.md b/tutorial/README-S7-EN.md
index bcac9f70..c6ec5845 100644
--- a/tutorial/README-S7-EN.md
+++ b/tutorial/README-S7-EN.md
@@ -692,4 +692,6 @@ Receive:The maximum byte write length is 225 = 240 - 15, 15(response PDU) = 12
| S300 | 240 | **0** | **2** |
| S400 | 480 | **0** | **3** |
| S1200 | 240 | **0** | **1** |
-| S1500 | 960 | **0** | **1** |
\ No newline at end of file
+| S1500 | 960 | **0** | **1** |
+
+> 7、General PLC online connection number is limited, do not repeat new S7PLC()!!!
\ No newline at end of file