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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
package org.yzh.protocol.commons.transform.parameter;
 
import io.github.yezhihao.protostar.Schema;
import io.github.yezhihao.protostar.annotation.Field;
import io.github.yezhihao.protostar.util.ByteBufUtils;
import io.netty.buffer.ByteBuf;
 
import java.nio.charset.StandardCharsets;
 
/**
 * 胎压监测系统参数
 * @author yezhihao
 * https://gitee.com/yezhihao/jt808-server
 */
public class ParamTPMS {
 
    public static final Integer key = 0xF366;
 
    public static final Schema<ParamTPMS> SCHEMA = new ParamTPMSSchema();
 
    @Field(desc = "轮胎规格型号(例:195/65R1591V,12个字符,默认值'900R20')")
    private String tireType;
    @Field(desc = "胎压单位:0.kg/cm2 1.bar 2.Kpa 3.PSI(默认值3)")
    private int pressureUnit = -1;
    @Field(desc = "正常胎压值(同胎压单位,默认值140)")
    private int normalValue = -1;
    @Field(desc = "胎压不平衡报警阈值(百分比0~100,达到冷态气压值,默认值20)")
    private int imbalanceThreshold = -1;
    @Field(desc = "慢漏气报警阈值(百分比0~100,达到冷态气压值,默认值5)")
    private int lowLeakThreshold = -1;
    @Field(desc = "低压报警阈值(同胎压单位,默认值110)")
    private int lowPressureThreshold = -1;
    @Field(desc = "高压报警阈值(同胎压单位,默认值189)")
    private int highPressureThreshold = -1;
    @Field(desc = "高温报警阈值(摄氏度,默认值80)")
    private int highTemperatureThreshold = -1;
    @Field(desc = "电压报警阈值(百分比0~100,默认值10)")
    private int voltageThreshold = -1;
    @Field(desc = "定时上报时间间隔(秒,取值0~3600,默认值60,0表示不上报)")
    private int reportInterval = -1;
    @Field(desc = "保留项")
    private byte[] reserved = new byte[6];
 
    public String getTireType() {
        return tireType;
    }
 
    public void setTireType(String tireType) {
        this.tireType = tireType;
    }
 
    public int getPressureUnit() {
        return pressureUnit;
    }
 
    public void setPressureUnit(int pressureUnit) {
        this.pressureUnit = pressureUnit;
    }
 
    public int getNormalValue() {
        return normalValue;
    }
 
    public void setNormalValue(int normalValue) {
        this.normalValue = normalValue;
    }
 
    public int getImbalanceThreshold() {
        return imbalanceThreshold;
    }
 
    public void setImbalanceThreshold(int imbalanceThreshold) {
        this.imbalanceThreshold = imbalanceThreshold;
    }
 
    public int getLowLeakThreshold() {
        return lowLeakThreshold;
    }
 
    public void setLowLeakThreshold(int lowLeakThreshold) {
        this.lowLeakThreshold = lowLeakThreshold;
    }
 
    public int getLowPressureThreshold() {
        return lowPressureThreshold;
    }
 
    public void setLowPressureThreshold(int lowPressureThreshold) {
        this.lowPressureThreshold = lowPressureThreshold;
    }
 
    public int getHighPressureThreshold() {
        return highPressureThreshold;
    }
 
    public void setHighPressureThreshold(int highPressureThreshold) {
        this.highPressureThreshold = highPressureThreshold;
    }
 
    public int getHighTemperatureThreshold() {
        return highTemperatureThreshold;
    }
 
    public void setHighTemperatureThreshold(int highTemperatureThreshold) {
        this.highTemperatureThreshold = highTemperatureThreshold;
    }
 
    public int getVoltageThreshold() {
        return voltageThreshold;
    }
 
    public void setVoltageThreshold(int voltageThreshold) {
        this.voltageThreshold = voltageThreshold;
    }
 
    public int getReportInterval() {
        return reportInterval;
    }
 
    public void setReportInterval(int reportInterval) {
        this.reportInterval = reportInterval;
    }
 
    public byte[] getReserved() {
        return reserved;
    }
 
    public void setReserved(byte[] reserved) {
        this.reserved = reserved;
    }
 
    private static class ParamTPMSSchema implements Schema<ParamTPMS> {
 
        private ParamTPMSSchema() {
        }
 
        @Override
        public ParamTPMS readFrom(ByteBuf input) {
            ParamTPMS message = new ParamTPMS();
            message.tireType = input.readCharSequence(12, StandardCharsets.US_ASCII).toString();
            message.pressureUnit = input.readShort();
            message.normalValue = input.readShort();
            message.imbalanceThreshold = input.readShort();
            message.lowLeakThreshold = input.readShort();
            message.lowPressureThreshold = input.readShort();
            message.highPressureThreshold = input.readShort();
            message.highTemperatureThreshold = input.readShort();
            message.voltageThreshold = input.readShort();
            message.reportInterval = input.readShort();
            input.readBytes(message.reserved);
            return message;
        }
 
        @Override
        public void writeTo(ByteBuf output, ParamTPMS message) {
            byte[] bytes = message.getTireType().getBytes(StandardCharsets.US_ASCII);
            ByteBufUtils.writeFixedLength(output, 12, bytes);
            output.writeShort(message.pressureUnit);
            output.writeShort(message.normalValue);
            output.writeShort(message.imbalanceThreshold);
            output.writeShort(message.lowLeakThreshold);
            output.writeShort(message.lowPressureThreshold);
            output.writeShort(message.highPressureThreshold);
            output.writeShort(message.highTemperatureThreshold);
            output.writeShort(message.voltageThreshold);
            output.writeShort(message.reportInterval);
            ByteBufUtils.writeFixedLength(output, 6, message.getReserved());
        }
    }
}