18045010223
2025-07-07 0d3a683a0c97154b1f2e6657398664537e4e3e82
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package org.yzh.protocol.commons.transform.attribute;
 
import io.github.yezhihao.protostar.Schema;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
 
/**
 * 进出区域/路线报警 0x12
 * length 6
 */
@ToString
@Data
@Accessors(chain = true)
public class InOutAreaAlarm extends Alarm {
 
    public static final Integer key = 18;
 
    public static final Schema<InOutAreaAlarm> SCHEMA = new InOutAreaAlarmSchema();
 
    /** 位置类型:1.圆形区域 2.矩形区域 3.多边形区域 4.路线 */
    private byte areaType;
    /** 区域或路段ID */
    private int areaId;
    /** 方向:0.进 1.出 */
    private byte direction;
 
    public InOutAreaAlarm() {
    }
 
    public InOutAreaAlarm(byte areaType, int areaId, byte direction) {
        this.areaType = areaType;
        this.areaId = areaId;
        this.direction = direction;
    }
 
    @Override
    public int getAlarmType() {
        return key;
    }
 
    private static class InOutAreaAlarmSchema implements Schema<InOutAreaAlarm> {
 
        private InOutAreaAlarmSchema() {
        }
 
        @Override
        public InOutAreaAlarm readFrom(ByteBuf input) {
            InOutAreaAlarm message = new InOutAreaAlarm();
            message.areaType = input.readByte();
            message.areaId = input.readInt();
            message.direction = input.readByte();
            return message;
        }
 
        @Override
        public void writeTo(ByteBuf output, InOutAreaAlarm message) {
            output.writeByte(message.areaType);
            output.writeInt(message.areaId);
            output.writeByte(message.direction);
        }
    }
}