2026-06-26 20b96473f2520590a0dca6b775b81e3ea06a77a0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package cn.iocoder.yudao.module.iot.gateway.serialize;
 
import cn.iocoder.yudao.module.iot.core.enums.IotSerializeTypeEnum;
import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
 
/**
 * IoT 设备消息序列化器接口
 *
 * 用于序列化和反序列化设备消息
 *
 * @author 芋道源码
 */
public interface IotMessageSerializer {
 
    /**
     * 序列化消息
     *
     * @param message 消息
     * @return 编码后的消息内容
     */
    byte[] serialize(IotDeviceMessage message);
 
    /**
     * 反序列化消息
     *
     * @param bytes 消息内容
     * @return 解码后的消息内容
     */
    IotDeviceMessage deserialize(byte[] bytes);
 
    /**
     * 获取序列化类型
     *
     * @return 序列化类型枚举
     */
    IotSerializeTypeEnum getType();
 
}