|
@@ -6,6 +6,10 @@ local f_sof2 = ProtoField.uint8("TC_TM_PROTOCOL.sof2", "SOF2", base.HEX)
|
|
|
local f_tm_ctrl = ProtoField.uint8("TC_TM_PROTOCOL.tm_ctrl", "TM Ctrl", base.HEX)
|
|
|
local f_GS_Id = ProtoField.uint8("TC_TM_PROTOCOL.GS_Id", "GS Id", base.HEX)
|
|
|
local f_timestamp = ProtoField.string("TC_TM_PROTOCOL.timestamp", "Timestamp", base.NONE)
|
|
|
+local f_ist = ProtoField.string("TC_TM_PROTOCOL.timestamp_ist", "IST TIME ", base.NONE)
|
|
|
+local f_pst = ProtoField.string("TC_TM_PROTOCOL.timestamp_pst", "PST TIME", base.NONE)
|
|
|
+local f_est = ProtoField.string("TC_TM_PROTOCOL.timestamp_est", "EST TIME", base.NONE)
|
|
|
+local f_mt = ProtoField.string("TC_TM_PROTOCOL.timestamp", "MST TIME", base.NONE)
|
|
|
local f_sequence_no = ProtoField.uint16("TC_TM_PROTOCOL.sequence_no", "Sequence No", base.DEC)
|
|
|
local f_sat_id = ProtoField.uint16("TC_TM_PROTOCOL.sat_id", "SAT Id", base.DEC)
|
|
|
local f_qos = ProtoField.uint8("TC_TM_PROTOCOL.qos", "QoS", base.DEC)
|
|
@@ -27,7 +31,7 @@ local f_tc_data = ProtoField.uint32("TC_TM_PROTOCOL.tc_data", "TC Data", base.DE
|
|
|
|
|
|
-- Add the fields to the protocol
|
|
|
TC_TM_PROTOCOL.fields = {
|
|
|
- f_sof1, f_sof2, f_tm_ctrl,f_GS_Id, f_timestamp, f_sequence_no, f_sat_id,
|
|
|
+ f_sof1, f_sof2, f_tm_ctrl,f_GS_Id, f_timestamp, f_sequence_no, f_sat_id, f_ist, f_pst, f_est, f_mt,
|
|
|
f_qos, f_sa_id, f_da_id, f_rm_id, f_tm_id, f_co_id, f_tm_len, f_tm_data,
|
|
|
f_ext_header_len, f_ext_header_data, f_crc, f_c_mac, f_eof1,f_tc_id ,f_tc_len ,f_tc_data
|
|
|
}
|
|
@@ -40,11 +44,23 @@ function TC_dissector(buffer, pinfo, tree)
|
|
|
local subtree = tree:add(TC_TM_PROTOCOL, buffer(), "TELECOMMAND")
|
|
|
|
|
|
-- Dissect SOF1 and SOF2
|
|
|
- subtree:add(f_sof1 , buffer(4, 1))
|
|
|
- subtree:add(f_sof2, buffer(5, 1))
|
|
|
+ local offset = 0
|
|
|
+
|
|
|
+ for i = 0,1000 do
|
|
|
+ local data = buffer(i,1):le_uint()
|
|
|
+ if data == 0xa5 then
|
|
|
+ offset = i
|
|
|
+ break
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ subtree:add(f_sof1 , buffer(offset, 1))
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ subtree:add(f_sof2, buffer(offset, 1))
|
|
|
+ offset = offset + 1
|
|
|
|
|
|
-- Dissect TC Control byte (TC_Ctrl)
|
|
|
- local offset = 6
|
|
|
local tc_ctrl = buffer(offset, 1):le_uint() -- Get the value of TC Ctrl byte
|
|
|
subtree:add(f_tm_ctrl , tc_ctrl)
|
|
|
offset = offset + 1
|
|
@@ -54,6 +70,23 @@ function TC_dissector(buffer, pinfo, tree)
|
|
|
local timestamp = buffer(offset, 4):le_uint()
|
|
|
local utc_time = os.date("!%Y-%m-%d %H:%M:%S", timestamp)
|
|
|
subtree:add(f_timestamp, timestamp.." ".."("..utc_time..")" )
|
|
|
+
|
|
|
+ local time = timestamp + 19800
|
|
|
+ local ist_time = os.date("!%Y-%m-%d %H:%M:%S", time)
|
|
|
+ subtree:add(f_ist, ist_time)
|
|
|
+
|
|
|
+ time = timestamp - 28800
|
|
|
+ local pst_time = os.date("!%Y-%m-%d %H:%M:%S", time)
|
|
|
+ subtree:add(f_pst, pst_time)
|
|
|
+
|
|
|
+ time = timestamp - 18000
|
|
|
+ local est_time = os.date("!%Y-%m-%d %H:%M:%S", time)
|
|
|
+ subtree:add(f_est, est_time)
|
|
|
+
|
|
|
+ time = timestamp - 25200
|
|
|
+ local mt_time = os.date("!%Y-%m-%d %H:%M:%S", time)
|
|
|
+ subtree:add(f_mt, mt_time)
|
|
|
+
|
|
|
offset = offset + 4
|
|
|
else
|
|
|
subtree:add(f_timestamp, "Invalid data (timestamp)")
|
|
@@ -357,32 +390,56 @@ end
|
|
|
function TM_dissector(buffer, pinfo, tree) -- OBC to GS
|
|
|
|
|
|
local subtree = tree:add(TC_TM_PROTOCOL, buffer(), "TELEMETRY")
|
|
|
- -- Set the protocol column name in Wireshark
|
|
|
-
|
|
|
-
|
|
|
- -- Ensure the buffer is large enough to contain the entire structure (40 bytes)
|
|
|
- -- if buffer:len() < 40 then
|
|
|
- -- return -- Not enough data to dissect
|
|
|
- --end
|
|
|
|
|
|
-- Extract the fields in order as defined in the structure
|
|
|
- subtree:add(f_sof1, buffer(4, 1):uint()) -- SOF1 in HEX
|
|
|
- subtree:add(f_sof2, buffer(5, 1):uint()) -- SOF2 in HEX
|
|
|
- subtree:add(f_tm_ctrl, buffer(6, 1):le_uint()) -- TM Ctrl in HEX
|
|
|
-
|
|
|
+
|
|
|
+ local add
|
|
|
+
|
|
|
+ for i = 0,1000 do
|
|
|
+ local data = buffer(i,1):le_uint()
|
|
|
+ if data == 0xa5 then
|
|
|
+ add = i
|
|
|
+ break
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ subtree:add(f_sof1, buffer(add, 1):le_uint()) -- SOF1 in HEX
|
|
|
+ add = add + 1
|
|
|
+
|
|
|
+ subtree:add(f_sof2, buffer(add, 1):le_uint()) -- SOF2 in HEX
|
|
|
+ add = add + 1
|
|
|
+
|
|
|
+ subtree:add(f_tm_ctrl, buffer(add, 1):le_uint()) -- TM Ctrl in HEX
|
|
|
+ add = add + 1
|
|
|
-- Dissect timestamp
|
|
|
- local timestamp = buffer(7, 4):le_uint()
|
|
|
+ local timestamp = buffer(add, 4):le_uint()
|
|
|
local utc_time = os.date("!%Y-%m-%d %H:%M:%S", timestamp)
|
|
|
subtree:add(f_timestamp, timestamp.." ".."("..utc_time..")" )
|
|
|
|
|
|
+ local time = timestamp + 19800
|
|
|
+ local ist_time = os.date("!%Y-%m-%d %H:%M:%S", time)
|
|
|
+ subtree:add(f_ist, ist_time)
|
|
|
+
|
|
|
+ time = timestamp - 28800
|
|
|
+ local pst_time = os.date("!%Y-%m-%d %H:%M:%S", time)
|
|
|
+ subtree:add(f_pst, pst_time)
|
|
|
+
|
|
|
+ time = timestamp - 18000
|
|
|
+ local est_time = os.date("!%Y-%m-%d %H:%M:%S", time)
|
|
|
+ subtree:add(f_est, est_time)
|
|
|
+
|
|
|
+ time = timestamp - 25200
|
|
|
+ local mt_time = os.date("!%Y-%m-%d %H:%M:%S", time)
|
|
|
+ subtree:add(f_mt, mt_time)
|
|
|
+
|
|
|
+ add = add + 4
|
|
|
|
|
|
- subtree:add(f_sequence_no, buffer(11, 2):le_uint()) -- Sequence No in HEX
|
|
|
-
|
|
|
+ subtree:add(f_sequence_no, buffer(add, 2):le_uint()) -- Sequence No in HEX
|
|
|
+ add = add + 2
|
|
|
|
|
|
-- My logic for SAT Id
|
|
|
- local magic = buffer(13, 1):le_uint()
|
|
|
+ local magic = buffer(add, 1):le_uint()
|
|
|
|
|
|
- local add=13
|
|
|
if bit.band(magic, 0x80) == 0 then
|
|
|
subtree:add(f_sat_id, buffer(add, 1):le_uint()) -- SAT Id in HEX
|
|
|
add=add+1
|
|
@@ -632,10 +689,23 @@ function TC_TM_PROTOCOL.dissector(buffer, pinfo, tree)
|
|
|
|
|
|
pinfo.cols.protocol = "TC_TM"
|
|
|
|
|
|
+ local offset1
|
|
|
+
|
|
|
+ for i = 0,1000 do
|
|
|
+ local data = buffer(i,1):le_uint()
|
|
|
+ if data == 0xa5 then
|
|
|
+ offset1 = i
|
|
|
+ break
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ offset1 = offset1 + 2
|
|
|
-- Create a subtree for this protocol
|
|
|
--local subtree = tree:add(my_udp_protocol, buffer(), "TE")
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- local direction = buffer(6, 1):uint() -- taking tM or tc control byte
|
|
|
+ local direction = buffer(offset1, 1):uint() -- taking tM or tc control byte
|
|
|
|
|
|
if direction & 0x40 == 0x40 then -- if 6th bit is set then it is TM
|
|
|
TM_dissector(buffer, pinfo, tree) -- OBC to GS
|