|
@@ -0,0 +1,202 @@
|
|
|
+function error_handler_dissectors(buffer, pinfo, tree, TC_TM_PROTOCOL, offset, instance)
|
|
|
+
|
|
|
+
|
|
|
+-- Define the fields of the protocol
|
|
|
+local f_fault_status_ind = ProtoField.uint8("TC_TM_PROTOCOL.fault_status_ind", "Fault Status Indication", base.HEX)
|
|
|
+local f_total_error_groups = ProtoField.uint8("TC_TM_PROTOCOL.total_error_groups", "Total Number of Error Groups", base.DEC)
|
|
|
+
|
|
|
+-- Define the fields for each error group and fault status
|
|
|
+local f_error_group_io = ProtoField.uint8("TC_TM_PROTOCOL.error_group_io", "Total Number of Errors in IO", base.DEC)
|
|
|
+local f_fault_status_io = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_io", "Fault Status of Group IO", base.HEX)
|
|
|
+
|
|
|
+local f_error_group_ahw_set_1 = ProtoField.uint8("TC_TM_PROTOCOL.error_group_ahw_set_1", "Total Number of Errors in AHW_SET-1", base.DEC)
|
|
|
+local f_fault_status_ahw_set_1 = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_ahw_set_1", "Fault Status of Group AHW_SET-1", base.HEX)
|
|
|
+
|
|
|
+local f_error_group_ahw_set_2 = ProtoField.uint8("TC_TM_PROTOCOL.error_group_ahw_set_2", "Total Number of Errors in AHW_SET-2", base.DEC)
|
|
|
+local f_fault_status_ahw_set_2 = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_ahw_set_2", "Fault Status of Group AHW_SET-2", base.HEX)
|
|
|
+
|
|
|
+local f_error_group_system_1 = ProtoField.uint8("TC_TM_PROTOCOL.error_group_system_1", "Total Number of Errors in SYSTEM Group 1", base.DEC)
|
|
|
+local f_fault_status_system_1 = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_system_1", "Fault Status of Group SYSTEM 1", base.HEX)
|
|
|
+
|
|
|
+local f_error_group_system_2 = ProtoField.uint8("TC_TM_PROTOCOL.error_group_system_2", "Total Number of Errors in SYSTEM Group 2", base.DEC)
|
|
|
+local f_fault_status_system_2 = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_system_2", "Fault Status of Group SYSTEM 2", base.HEX)
|
|
|
+
|
|
|
+local f_error_group_comms = ProtoField.uint8("TC_TM_PROTOCOL.error_group_comms", "Total Number of Errors in COMMS", base.DEC)
|
|
|
+local f_fault_status_comms = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_comms", "Fault Status of Group COMMS", base.HEX)
|
|
|
+
|
|
|
+local f_error_group_adcs = ProtoField.uint8("TC_TM_PROTOCOL.error_group_adcs", "Total Number of Errors in ADCS", base.DEC)
|
|
|
+local f_fault_status_adcs = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_adcs", "Fault Status of Group ADCS", base.HEX)
|
|
|
+
|
|
|
+local f_error_group_eps = ProtoField.uint8("TC_TM_PROTOCOL.error_group_eps", "Total Number of Errors in EPS", base.DEC)
|
|
|
+local f_fault_status_eps = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_eps", "Fault Status of Group EPS", base.HEX)
|
|
|
+
|
|
|
+-- Add all fields to the protocol
|
|
|
+tm_protocol.fields = {
|
|
|
+ f_fault_status_ind, f_total_error_groups,
|
|
|
+ f_error_group_io, f_fault_status_io,
|
|
|
+ f_error_group_ahw_set_1, f_fault_status_ahw_set_1,
|
|
|
+ f_error_group_ahw_set_2, f_fault_status_ahw_set_2,
|
|
|
+ f_error_group_system_1, f_fault_status_system_1,
|
|
|
+ f_error_group_system_2, f_fault_status_system_2,
|
|
|
+ f_error_group_comms, f_fault_status_comms,
|
|
|
+ f_error_group_adcs, f_fault_status_adcs,
|
|
|
+ f_error_group_eps, f_fault_status_eps
|
|
|
+}
|
|
|
+
|
|
|
+ -- Create a subtree for the protocol
|
|
|
+ local subtree = tree:add(TC_TM_PROTOCOL, buffer(), "ERROR HANDLER")
|
|
|
+
|
|
|
+ -- Fault Status Indication (1 byte)
|
|
|
+ subtree:add(f_fault_status_ind, buffer(offset, 1):le_uint())
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ -- Total Number of Error Groups (1 byte)
|
|
|
+ subtree:add(f_total_error_groups, buffer(offset, 1):le_uint())
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ -- Dissect each error group based on the description
|
|
|
+ -- Group IO
|
|
|
+ --local error_group_io = buffer(offset, 1):le_uint()
|
|
|
+ subtree:add(f_error_group_io, buffer(offset, 1):le_unit())
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ local temp
|
|
|
+ local temp1
|
|
|
+ temp = buffer(offset, 4):le_uint()
|
|
|
+ for i = 0, error_group_io - 1 do
|
|
|
+ temp1 = (temp >> i) & 0x01
|
|
|
+
|
|
|
+ if temp1 == 0 then
|
|
|
+ subtree:add(f_fault_status_io, temp):set_text(string.format("NOFAULT"))
|
|
|
+ elseif temp1 == 1 then
|
|
|
+ subtree:add(f_fault_status_io, temp):set_text(string.format("FAULT"))
|
|
|
+ end
|
|
|
+ end
|
|
|
+ offset = offset + 4
|
|
|
+
|
|
|
+ -- Group AHW_SET-1
|
|
|
+ --local error_group_ahw_set_1 = buffer(offset, 1):uint()
|
|
|
+ subtree:add(f_error_group_ahw_set_1, buffer(offset, 1):le_uint())
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ temp = buffer(offset, 4):le_uint()
|
|
|
+ for i = 0, error_group_ahw_set_1 - 1 do
|
|
|
+ temp1 = (temp >> i) & 0x01
|
|
|
+
|
|
|
+ if temp1 == 0 then
|
|
|
+ subtree:add(f_fault_status_ahw_set_1, temp):set_text(string.format("NOFAULT"))
|
|
|
+ elseif temp1 == 1 then
|
|
|
+ subtree:add(f_fault_status_ahw_set_1, temp):set_text(string.format("FAULT"))
|
|
|
+ end
|
|
|
+ end
|
|
|
+ offset = offset + 4
|
|
|
+
|
|
|
+ -- Group AHW_SET-2
|
|
|
+ --local error_group_ahw_set_2 = buffer(offset, 1):uint()
|
|
|
+ subtree:add(f_error_group_ahw_set_2, buffer(offset, 1):le_uint())
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ temp = buffer(offset, 4):le_uint()
|
|
|
+ for i = 0, error_group_ahw_set_2 - 1 do
|
|
|
+ temp1 = (temp >> i) & 0x01
|
|
|
+
|
|
|
+ if temp1 == 0 then
|
|
|
+ subtree:add(f_fault_status_ahw_set_2, temp):set_text(string.format("NOFAULT"))
|
|
|
+ elseif temp1 == 1 then
|
|
|
+ subtree:add(f_fault_status_ahw_set_2, temp):set_text(string.format("FAULT"))
|
|
|
+ end
|
|
|
+ end
|
|
|
+ offset = offset + 4
|
|
|
+
|
|
|
+
|
|
|
+ -- Group SYSTEM 1
|
|
|
+ --local error_group_system_1 = buffer(offset, 1):uint()
|
|
|
+ subtree:add(f_error_group_system_1, buffer(offset, 1):le_uint())
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ temp = buffer(offset, 4):le_uint()
|
|
|
+ for i = 0, error_group_system_1 - 1 do
|
|
|
+ temp1 = (temp >> i) & 0x01
|
|
|
+
|
|
|
+ if temp1 == 0 then
|
|
|
+ subtree:add(f_fault_status_system_1, temp):set_text(string.format("NOFAULT"))
|
|
|
+ elseif temp1 == 1 then
|
|
|
+ subtree:add(f_fault_status_system_2, temp):set_text(string.format("FAULT"))
|
|
|
+ end
|
|
|
+ end
|
|
|
+ offset = offset + 4
|
|
|
+
|
|
|
+ -- Group SYSTEM 2
|
|
|
+ --local error_group_system_2 = buffer(offset, 1):uint()
|
|
|
+ subtree:add(f_error_group_system_2, buffer(offset, 1):le_uint())
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ temp = buffer(offset, 4):le_uint()
|
|
|
+ for i = 0, error_group_system_2 - 1 do
|
|
|
+ temp1 = (temp >> i) & 0x01
|
|
|
+
|
|
|
+ if temp1 == 0 then
|
|
|
+ subtree:add(f_fault_status_system_2, temp):set_text(string.format("NOFAULT"))
|
|
|
+ elseif temp1 == 1 then
|
|
|
+ subtree:add(f_fault_status_system_2, temp):set_text(string.format("FAULT"))
|
|
|
+ end
|
|
|
+ end
|
|
|
+ offset = offset + 4
|
|
|
+
|
|
|
+
|
|
|
+ -- Group COMMS
|
|
|
+ --local error_group_comms = buffer(offset, 1):uint()
|
|
|
+ subtree:add(f_error_group_comms, buffer(offset, 1):le_uint())
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ temp = buffer(offset, 4):le_uint()
|
|
|
+ for i = 0, error_group_comms - 1 do
|
|
|
+ temp1 = (temp >> i) & 0x01
|
|
|
+
|
|
|
+ if temp1 == 0 then
|
|
|
+ subtree:add(f_fault_status_comms, temp):set_text(string.format("NOFAULT"))
|
|
|
+ elseif temp1 == 1 then
|
|
|
+ subtree:add(f_fault_status_comms, temp):set_text(string.format("FAULT"))
|
|
|
+ end
|
|
|
+ end
|
|
|
+ offset = offset + 4
|
|
|
+
|
|
|
+
|
|
|
+ -- Group ADCS
|
|
|
+ --local error_group_adcs = buffer(offset, 1):uint()
|
|
|
+ subtree:add(f_error_group_adcs, buffer(offset, 1):le_uint())
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ temp = buffer(offset, 4):le_uint()
|
|
|
+ for i = 0, error_group_adcs - 1 do
|
|
|
+ temp1 = (temp >> i) & 0x01
|
|
|
+
|
|
|
+ if temp1 == 0 then
|
|
|
+ subtree:add(f_fault_status_adcs, temp):set_text(string.format("NOFAULT"))
|
|
|
+ elseif temp1 == 1 then
|
|
|
+ subtree:add(f_fault_status_adcs, temp):set_text(string.format("FAULT"))
|
|
|
+ end
|
|
|
+ end
|
|
|
+ offset = offset + 4
|
|
|
+
|
|
|
+
|
|
|
+ -- Group EPS
|
|
|
+ --local error_group_eps = buffer(offset, 1):uint()
|
|
|
+ subtree:add(f_error_group_eps, buffer(offset, 1):le_uint())
|
|
|
+ offset = offset + 1
|
|
|
+
|
|
|
+ temp = buffer(offset, 4):le_uint()
|
|
|
+ for i = 0, error_group_eps - 1 do
|
|
|
+ temp1 = (temp >> i) & 0x01
|
|
|
+
|
|
|
+ if temp1 == 0 then
|
|
|
+ subtree:add(f_fault_status_eps, temp):set_text(string.format("NOFAULT"))
|
|
|
+ elseif temp1 == 1 then
|
|
|
+ subtree:add(f_fault_status_eps, temp):set_text(string.format("FAULT"))
|
|
|
+ end
|
|
|
+ end
|
|
|
+ offset = offset + 4
|
|
|
+
|
|
|
+
|
|
|
+end
|
|
|
+
|