123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- 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
|