Compare commits
2 Commits
177350830a
...
e4d07a5306
| Author | SHA1 | Date | |
|---|---|---|---|
| e4d07a5306 | |||
| 4cd520ab78 |
17
Jenkinsfile
vendored
17
Jenkinsfile
vendored
@@ -435,12 +435,23 @@ pipeline {
|
|||||||
// 辅助函数
|
// 辅助函数
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
// 获取变更的文件列表
|
// 获取变更的文件列表(对比上次成功构建,支持多 commit)
|
||||||
def getChangedFiles() {
|
def getChangedFiles() {
|
||||||
def changedFiles = sh(
|
def changedFiles = sh(
|
||||||
script: '''
|
script: '''
|
||||||
PREV=$(git rev-parse HEAD~1 2>/dev/null || echo "")
|
# 优先使用上次成功构建的 commit
|
||||||
[ -z "$PREV" ] && echo "all" || git diff --name-only $PREV HEAD
|
if [ -n "$GIT_PREVIOUS_SUCCESSFUL_COMMIT" ]; then
|
||||||
|
PREV="$GIT_PREVIOUS_SUCCESSFUL_COMMIT"
|
||||||
|
else
|
||||||
|
# 回退到 origin/master(如果有)
|
||||||
|
PREV=$(git rev-parse origin/master 2>/dev/null || git rev-parse HEAD~1 2>/dev/null || echo "")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$PREV" ]; then
|
||||||
|
echo "all"
|
||||||
|
else
|
||||||
|
git diff --name-only $PREV HEAD
|
||||||
|
fi
|
||||||
''',
|
''',
|
||||||
returnStdout: true
|
returnStdout: true
|
||||||
).trim()
|
).trim()
|
||||||
|
|||||||
@@ -56,18 +56,16 @@ public class Jt808Decoder {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expectedBodyLength > actualAvailableLength) {
|
// 使用实际可用的长度处理(兼容设备端长度计算不准确的情况)
|
||||||
log.warn("[bytes2PackageData][消息体长度不匹配: 头部声明={}, 实际可用={}, 数据总长度={}, 消息ID=0x{}]",
|
int actualBodyLength = Math.min(expectedBodyLength, actualAvailableLength);
|
||||||
expectedBodyLength, actualAvailableLength, data.length,
|
if (expectedBodyLength != actualAvailableLength) {
|
||||||
|
log.debug("[bytes2PackageData][消息体长度差异: 头部声明={}, 实际可用={}, 使用={}, 消息ID=0x{}]",
|
||||||
|
expectedBodyLength, actualAvailableLength, actualBodyLength,
|
||||||
Integer.toHexString(msgHeader.getId()));
|
Integer.toHexString(msgHeader.getId()));
|
||||||
// 使用 null 标记长度不匹配(区别于合法的空消息体如心跳)
|
|
||||||
ret.setBodyBytes(null);
|
|
||||||
ret.setCheckSum(data[data.length - 1]);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] bodyBytes = new byte[msgHeader.getBodyLength()];
|
byte[] bodyBytes = new byte[actualBodyLength];
|
||||||
System.arraycopy(data, msgBodyByteStartIndex, bodyBytes, 0, bodyBytes.length);
|
System.arraycopy(data, msgBodyByteStartIndex, bodyBytes, 0, actualBodyLength);
|
||||||
ret.setBodyBytes(bodyBytes);
|
ret.setBodyBytes(bodyBytes);
|
||||||
|
|
||||||
// 3. 解析校验码
|
// 3. 解析校验码
|
||||||
|
|||||||
Reference in New Issue
Block a user