function obc_dissector(buffer, pinfo, tree, TC_TM_PROTOCOL, offset, instance) local f_timestamp1 = ProtoField.uint64("TC_TM_PROTOCOL.timestamp_obc", "Timestamp", base.DEC) local f_fsm_state = ProtoField.uint8("TC_TM_PROTOCOL.fsm_state", "Fsm State", base.DEC) local f_num_resets = ProtoField.uint8("TC_TM_PROTOCOL.num_resets", "Num of resets", base.DEC) local f_io_error = ProtoField.uint16("TC_TM_PROTOCOL.io_error", "IO error", base.DEC) local f_sys_error = ProtoField.uint8("TC_TM_PROTOCOL.sys_error", "Sys error", base.DEC) local f_cpu_until = ProtoField.float("TC_TM_PROTOCOL.cpu_until", "Cpu Until", base.DEC) local f_iram_rem_heap = ProtoField.uint32("TC_TM_PROTOCOL.iram_rem_heap", "Iram rem heap", base.DEC) local f_eram_rem_heap = ProtoField.uint32("TC_TM_PROTOCOL.eram_rem_heap", "Eram rem heap", base.DEC) local f_uptime = ProtoField.uint32("TC_TM_PROTOCOL.uptime", "Uptime", base.DEC) local f_reset_cause = ProtoField.uint8("TC_TM_PROTOCOL.reset_cause", "Reset cause", base.DEC) local f_task_count = ProtoField.uint8("TC_TM_PROTOCOL.task_count", "Task Count", base.DEC) local ipc_fail_cntr = ProtoField.uint16("TC_TM_PROTOCOL.ipc_fail_cntr", "Ipc Fail Cntr", base.DEC) -- Add the fields to the protocol TC_TM_PROTOCOL.fields = { f_timestamp1, f_fsm_state, f_num_resets,f_io_error, f_sys_error, f_cpu_until, f_iram_rem_heap, f_eram_rem_heap, f_uptime, f_reset_cause, f_task_count, f_ipc_fail_cntr } local subtree = tree:add(TC_TM_PROTOCOL, buffer(), "OBC") for i=0, instance-1 do local subtree1 = subtree:add(TC_TM_PROTOCOL, buffer(), "Instance "..i) -- dissect timestamp local data1 --for i=0, 8 do --data1 = buffer(offset, 8):le_uint() subtree1:add(f_timestamp1, buffer(offset, 8):le_uint64()) offset = offset + 8 --dissect fsm_state --local data2 = buffer(offset,1):le_uint() subtree1:add(f_fsm_state, buffer(offset,1):le_uint()) offset = offset + 1 --dissect f_num_resets local data3 = buffer(offset,1):le_uint() subtree1:add(f_num_resets, data3) offset = offset + 1 --dissect io_error subtree1:add(f_io_error , buffer(offset, 2):le_uint()) offset = offset + 2 --dissect sys_error --local data2 = buffer(offset,1):le_uint() subtree1:add(f_sys_error, buffer(offset, 1):le_uint()) offset = offset + 1 --dissect f_cpu_until local cpu_value = buffer(offset, 4):le_float() local formatted_value = string.format("%.6f", cpu_value) subtree1:add(f_cpu_until, formatted_value) offset = offset + 4 --dissect f_iram_rem_heap subtree1:add(f_iram_rem_heap, buffer(offset, 4):le_uint()) offset = offset + 4 --dissect f_eram_rem_heap subtree1:add(f_eram_rem_heap, buffer(offset, 4):le_uint()) offset = offset + 4 --dissect f_uptime subtree1:add(f_uptime, buffer(offset, 4):le_uint()) offset = offset + 4 --dissect f_reset_cause subtree1:add(f_reset_cause, buffer(offset, 1):le_uint()) offset = offset + 1 --dissect f_task_count local task_count = buffer(offset, 1):le_uint() subtree1:add(f_task_count, buffer(offset, 1):le_uint()) offset = offset + 1 for i=0, task_count - 1 do local fail = buffer(offset, 2):le_uint() if fail == 0 then i = i + 2 offset = offset + 2 else subtree1:add(f_ipc_fail_cntr, buffer(offset, 2):le_uint()) offset = offset + 2 i = i + 2 end end end end