diff options
| author | s-ol <s+removethis@s-ol.nu> | 2024-02-19 21:34:54 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2024-02-19 21:34:54 +0000 |
| commit | 90ea8680c6bf7a63de43422d0b0802b826c732d3 (patch) | |
| tree | 68f6a628ffb901016097bac82c1a9a9518aba1c9 | |
| parent | dissectors/{ch340,pl2303}: fix duplicate DissectorTable errors (diff) | |
| download | t937-serial-90ea8680c6bf7a63de43422d0b0802b826c732d3.tar.gz t937-serial-90ea8680c6bf7a63de43422d0b0802b826c732d3.zip | |
dissectors/t937: rename constants, dissect PWM_*, STARTSTOP, REQ_READ, READ, WRITE
| -rwxr-xr-x | dissectors/t937.lua | 58 |
1 files changed, 51 insertions, 7 deletions
diff --git a/dissectors/t937.lua b/dissectors/t937.lua index cec6e9a..2b0f08e 100755 --- a/dissectors/t937.lua +++ b/dissectors/t937.lua @@ -1,11 +1,18 @@ local proto = Proto("t937", "T-937/M Serial Control")
local FUN_TABLE = {
- [0x01] = "REQUEST_CONN",
- [0xf1] = "CONFIRM_CONN",
- [0x02] = "TEMP_STATUS",
- [0x08] = "SET_HEATER",
- [0x0d] = "SET_EXTRACTOR",
+ [0x01] = "O_CONNECT",
+ [0x02] = "O_TEMPS",
+ [0x03] = "O_READ",
+ [0x06] = "O_ACK_WRITE",
+
+ [0x08] = "C_SET_HEAT",
+ [0x0d] = "C_SET_COOL",
+ [0x10] = "C_STARTSTOP",
+ [0x11] = "C_REQ_READ",
+ [0x20] = "C_WRITE",
+ [0xf1] = "C_ACK_CONNECT",
+ [0xf2] = "C_ACK_READ",
}
proto.experts.checksum = ProtoExpert.new("t937.checksum",
@@ -15,13 +22,33 @@ proto.experts.checksum = ProtoExpert.new("t937.checksum", proto.fields.addr = ProtoField.uint16("t937.address", "Address", base.HEX)
proto.fields.fun = ProtoField.uint8("t937.function", "Function", base.HEX, FUN_TABLE)
-proto.fields.len = ProtoField.uint8("t937.length", "Data Length", base.HEX)
+proto.fields.len = ProtoField.uint8("t937.length", "Data Length", base.DEC)
proto.fields.checksum = ProtoField.uint16("t937.checksum", "Message Checksum", base.HEX)
+proto.fields.conn_status = ProtoField.uint16("t937.conn_status", "Connection Status", base.HEX, {
+ [0x0100] = "CONNECTING",
+ [0x0200] = "CONNECTED",
+})
+
proto.fields.temp1 = ProtoField.uint16("t937.temp1", "Chamber Temp 1", base.UNIT_STRING, {"°C"})
proto.fields.temp2 = ProtoField.uint16("t937.temp2", "Chamber Temp 2", base.UNIT_STRING, {"°C"})
proto.fields.temp3 = ProtoField.uint16("t937.temp3", "Control Board Temp", base.UNIT_STRING, {"°C"})
+proto.fields.pwm = ProtoField.uint8("t937.pwm", "PWM", base.HEX)
+proto.fields.pwm_mode = ProtoField.uint8("t937.pwm_mode", "PWM Mode", base.HEX, {
+ [0x44] = "ON",
+ [0x88] = "OFF",
+})
+
+proto.fields.profile = ProtoField.uint8("t937.profile_num", "Profile Number", base.DEC)
+proto.fields.profile_dur = ProtoField.uint16("t937.profile_dur", "Profile Duration", base.UNIT_STRING, {"s"})
+proto.fields.profile_temps = ProtoField.ubytes("t937.profile_temps", "Profile Temperatures")
+
+proto.fields.startstop = ProtoField.uint8("t937.startstop", "Start/Stop", base.HEX, {
+ [0x11] = "START",
+ [0x22] = "STOP",
+})
+
proto.fields.data = ProtoField.bytes("t937.data", "Raw Data")
local function try_dissect(bytes, pinfo, tree)
@@ -60,10 +87,27 @@ local function try_dissect(bytes, pinfo, tree) sub = sub:add(data, fun_name)
end
- if fun_name == "TEMP_STATUS" then
+ if fun_name == "O_CONNECT"
+ or fun_name == "C_ACK_CONNECT" then
+ sub:add(proto.fields.conn_status, data())
+ elseif fun_name == "O_TEMPS" then
sub:add(proto.fields.temp1, data(0,2))
sub:add(proto.fields.temp2, data(2,2))
sub:add(proto.fields.temp3, data(4,2))
+ elseif fun_name == "C_PWM_HEAT"
+ or fun_name == "C_PWM_COOL" then
+ sub:add(proto.fields.pwm, data(0,1))
+ sub:add(proto.fields.pwm_mode, data(1,1))
+ elseif fun_name == "C_STARTSTOP"
+ or fun_name == "C_REQ_READ" then
+ sub:add(proto.fields.profile, data(0,1), data(0,1):uint()+1)
+ sub:add(proto.fields.startstop, data(1,1))
+ elseif fun_name == "C_WRITE"
+ or fun_name == "O_READ" then
+ local len = data(0,2):uint() * 3
+ sub:add(proto.fields.profile, data(2,1), data(2,1):uint()+1)
+ sub:add(proto.fields.profile_dur, data(9,2), len)
+ sub:add(proto.fields.profile_temps, data(4,2))
end
return buffer:len()
|
