Class PTZInstructionFormat
java.lang.Object
io.github.lunasaw.gb28181.common.entity.control.instruction.PTZInstructionFormat
PTZ指令格式基础类
根据 A.3.1 指令格式 规范实现
字节1: A5H (指令首字节) 字节2: 组合码1 (高4位版本信息 + 低4位校验位) 字节3: 地址低8位 字节4: 指令码 字节5: 数据1 字节6: 数据2 字节7: 组合码2 (高4位数据3 + 低4位地址高4位) 字节8: 校验码
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte
指令首字节 固定为A5Hstatic final byte
版本信息 本标准版本1.0 -
Constructor Summary
ConstructorsConstructorDescriptionPTZInstructionFormat
(int address, byte instructionCode, byte data1, byte data2, byte data3) 构造函数 -
Method Summary
Modifier and TypeMethodDescriptionstatic PTZInstructionFormat
fromByteArray
(byte[] bytes) 从字节数组创建指令static PTZInstructionFormat
fromHexString
(String hexString) 从十六进制字符串解析byte
getData3()
获取数据3int
获取完整地址boolean
isValid()
验证指令格式是否正确void
重新计算校验码byte[]
转换为字节数组转换为十六进制字符串
-
Field Details
-
INSTRUCTION_HEADER
public static final byte INSTRUCTION_HEADER指令首字节 固定为A5H- See Also:
-
VERSION
public static final byte VERSION版本信息 本标准版本1.0- See Also:
-
-
Constructor Details
-
PTZInstructionFormat
public PTZInstructionFormat(int address, byte instructionCode, byte data1, byte data2, byte data3) 构造函数- Parameters:
address
- 设备地址 (0x000-0xFFF)instructionCode
- 指令码data1
- 数据1data2
- 数据2data3
- 数据3 (组合码2高4位)
-
-
Method Details
-
recalculateChecksum
public void recalculateChecksum()重新计算校验码 -
getFullAddress
public int getFullAddress()获取完整地址 -
getData3
public byte getData3()获取数据3 -
toByteArray
public byte[] toByteArray()转换为字节数组 -
fromByteArray
从字节数组创建指令 -
toHexString
转换为十六进制字符串 -
fromHexString
从十六进制字符串解析 -
isValid
public boolean isValid()验证指令格式是否正确
-