| | |
| | | |
| | | public short getDataLength() { |
| | | // 计算数据长度: 云盒编号 + 指令编号 + 加密标志 + 动作编号 + 转动角度 |
| | | return (short) (2 + 15 + 1 + 1 + 1); // 帧头 + 数据内容 |
| | | return (short) (1 + 15 + 1 + 1 + 1); // 帧头 + 数据内容 |
| | | } |
| | | |
| | | public void encode(ByteBuf out) { |
| | | out.writeShort(getDataHeader()); // 写入帧头 |
| | | out.writeShort(getDataLength()); // 写入数据长度 |
| | | out.writeByte(getCmdCode()); // 写入指令编号 |
| | | out.writeBytes(boxSn); // 写入云盒编号 |
| | | out.writeByte(getCmdCode()); // 写入指令编号 |
| | | out.writeByte(encryptFlag); // 写入加密标志 |
| | | out.writeByte(actionId); // 写入动作编号 |
| | | out.writeByte(rotationAngle); // 写入转动角度 |