111
k94314517
2025-02-28 04dba6a17f836b5fbdf0eedff8a129c6785fd8a2
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package org.yzh.protocol.commons.transform.attribute;
 
import io.github.yezhihao.protostar.Schema;
import io.netty.buffer.ByteBuf;
 
/**
 * 进出区域/路线报警 0x12
 * length 6
 */
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;
    }
 
    public byte getAreaType() {
        return areaType;
    }
 
    public void setAreaType(byte areaType) {
        this.areaType = areaType;
    }
 
    public int getAreaId() {
        return areaId;
    }
 
    public void setAreaId(int areaId) {
        this.areaId = areaId;
    }
 
    public byte getDirection() {
        return direction;
    }
 
    public void setDirection(byte direction) {
        this.direction = direction;
    }
 
    @Override
    public int getAlarmType() {
        return key;
    }
 
    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder(80);
        sb.append("InOutAreaAlarm{areaType=").append(areaType);
        sb.append(",areaId=").append(areaId);
        sb.append(",direction=").append(direction);
        sb.append('}');
        return sb.toString();
    }
 
    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);
        }
    }
}