function eps_rd_stored_param_dissector(buffer, pinfo, tree, eps_proto, offset) local f_mppt_cnt = ProtoField.uint8("eps.mppt_cnt", "MPPT Count", base.DEC) local f_op_conv_cnt = ProtoField.uint8("eps.op_conv_cnt", "OP Converter Count", base.DEC) local f_btry_temp_sns_cnt = ProtoField.uint8("eps.btry_temp_sns_cnt", "Battery Temp Sensor Count", base.DEC) local f_heat_elmnt_cnt = ProtoField.uint8("eps.heat_elmnt_cnt", "Heater Element Count", base.DEC) local f_volt_rail_cnt = ProtoField.uint8("eps.volt_rail_cnt", "Voltage Rail Count", base.DEC) local f_mppt_enb = ProtoField.bytes("eps.mppt_enb", "MPPT Enable") local f_op_conv_ena_sts = ProtoField.bytes("eps.op_conv_ena_sts", "OP Convertor Enable Status") local f_op_conv_volt = ProtoField.float("eps.op_conv_volt", "OP Convertor Volt", base.DEC) local f_btry_chrg_cur_lmt = ProtoField.float("eps.btry_chrg_cur_lmt", "Battery Charge Current Limit", base.DEC) local f_btry_dischrg_cur_lmt = ProtoField.float("eps.btry_dischrg_cur_lmt", "Battery Discharge Current Limit", base.DEC) local f_btry_temp_sens_read = ProtoField.bytes("eps.btry_temp_sens_read", "Battery Tempatarure Sensor Read") local f_heat_mode = ProtoField.uint8("eps.heat_mode", "Heat Mode", base.DEC) local f_heat_mode_flags = ProtoField.float("eps.heat_mode_flags", "Heat Mode Flags", base.DEC) local f_volt_rail_cur_val = ProtoField.bytes("eps.volt_rail_cur_val", "Volt Rail Current Value") local f_nrml_mode_thrld_volt = ProtoField.float("eps.nrml_mode_thrld_volt", "Normal Mode Threshold Voltage", base.DEC) local f_safe_mode_thrld_volt = ProtoField.float("eps.safe_mode_thrld_volt", "Safe Mode Threshold Voltage", base.DEC) local f_crtl_mode_thrld_volt = ProtoField.float("eps.crtl_mode_thrld_volt", "Control Mode Threshold Voltage", base.DEC) local f_obc_com_timeout = ProtoField.uint16("eps.obc_com_timeout", "OBC Communication Timeout (Sec Byte1 and Byte2)", base.DEC) local f_num_of_obc_rst_for_eps_rst = ProtoField.uint8("eps.num_of_obc_rst", "Number of OBC Resets for EPS Reset", base.DEC) local f_mcu_count = ProtoField.uint8("eps.mcu_count", "MCU Count", base.DEC) -- Define fields for eps_get_fw_vers_s local f_mjr_fw_vers = ProtoField.uint8("eps.mjr_fw_vers", "Major Firmware Version", base.DEC) local f_mnr_fw_vers = ProtoField.uint8("eps.mnr_fw_vers", "Minor Firmware Version", base.DEC) local f_patch_fw_vers = ProtoField.uint8("eps.patch_fw_vers", "Patch Firmware Version", base.DEC) local f_com_mjr_vers = ProtoField.uint8("eps.com_mjr_vers", "Communication Major Version", base.DEC) local f_com_mnr_vers = ProtoField.uint8("eps.com_mnr_vers", "Communication Minor Version", base.DEC) -- Register fields to the protocol eps_proto.fields = { f_mppt_cnt, f_op_conv_cnt, f_btry_temp_sns_cnt, f_heat_elmnt_cnt, f_volt_rail_cnt, f_mppt_enb, f_op_conv_ena_sts,f_op_conv_volt, f_btry_chrg_cur_lmt, f_btry_dischrg_cur_lmt, f_btry_temp_sens_read, f_heat_mode, f_heat_mode_flags, f_volt_rail_cur_val, f_nrml_mode_thrld_volt, f_safe_mode_thrld_volt, f_crtl_mode_thrld_volt, f_obc_com_timeout, f_num_of_obc_rst_for_eps_rst, f_mcu_count, f_mjr_fw_vers, f_mnr_fw_vers, f_patch_fw_vers, f_com_mjr_vers, f_com_mnr_vers } local subtree = tree:add(eps_proto, buffer(), "EPS RD STORED PARAM") local mppt_cnt = buffer(offset, 1):le_uint() subtree:add(f_mppt_cnt, buffer(offset, 1):le_uint()) offset = offset + 1 local op_conv_cnt = buffer(offset, 1):le_uint() subtree:add(f_op_conv_cnt, buffer(offset, 1):le_uint()) offset = offset + 1 local btry_temp_sns_cnt = buffer(offset, 1):le_uint() subtree:add(f_btry_temp_sns_cnt, buffer(offset, 1):le_uint()) offset = offset + 1 local heat_elmnt_cnt = buffer(offset, 1):le_uint() subtree:add(f_heat_elmnt_cnt, buffer(offset, 1):le_uint()) offset = offset + 1 local volt_rail_cnt = buffer(offset, 1):le_uint() subtree:add(f_volt_rail_cnt, buffer(offset, 1):le_uint()) offset = offset + 1 local mcu_cnt = buffer(offset, 1):le_uint() subtree:add(f_mcu_count, buffer(offset, 1):le_uint()) offset = offset + 1 local count = math.ceil(mppt_cnt / 8) local value local mppt_enable = buffer(offset, count):le_uint() for i = 0,mppt_cnt - 1 do value = (mppt_enable >> i)&1 if value == 0 then subtree:add(f_mppt_enb, mppt_enable):set_text(string.format("MPPT Enable Status %d ----> 0", i)) elseif value == 1 then subtree:add(f_mppt_enb, mppt_enable):set_text(string.format("MPPT Enable Status %d ----> 1", i)) end end offset = offset + 1 local count = math.ceil(op_conv_cnt / 8) local value local data = buffer(offset, count):le_uint() for i = 0,op_conv_cnt - 1 do value = (data >> i)&1 if value == 0 then subtree:add(f_op_conv_ena_sts, data):set_text(string.format("O/P Convertor Enable Status %d ----> 0", i)) elseif value == 1 then subtree:add(f_op_conv_ena_sts, data):set_text(string.format("O/P Convertor Enable Status %d ----> 1", i)) end end offset = offset + 1 --local data = buffer(offset, count):le_uint() for i = 0,op_conv_cnt - 1 do data = buffer(offset, 2):le_uint() data = data / 10 subtree:add(f_op_conv_volt, data):set_text(string.format("O/P Convertor Volt %d -----> %0.1f V", i, data)) offset = offset + 2 end local btry_chrg = buffer(offset, 2):le_uint() btry_chrg = btry_chrg/100 subtree:add(f_btry_chrg_cur_lmt, btry_chrg):set_text(string.format("Battery Charge Current Limit ----> %0.2f", btry_chrg)) offset = offset + 2 local btry_dischrg = buffer(offset, 2):le_uint() btry_dischrg = btry_dischrg/100 subtree:add(f_btry_dischrg_cur_lmt, btry_chrg):set_text(string.format("Battery Discharge Current Limit ----> %0.2f", btry_dischrg)) offset = offset + 2 subtree:add("Battery Temparature Sensor Threshold ---->") for i = 0, btry_temp_sns_cnt - 1 do local data = buffer(offset, 2):le_uint() subtree:add(f_btry_temp_sens_read, data):set_text(string.format(" %d LOW = %d degC , HIGH = %d degC", i, (data&0x00ff), (data>>8)&0x00ff)) offset = offset + 2 end subtree:add(f_heat_mode, buffer(offset, 1)) offset = offset + 1 local count = math.ceil(heat_elmnt_cnt/8) local data = buffer(offset, count):le_uint() local value for i = 0,heat_elmnt_cnt - 1 do value = (data >> i) & 1 subtree:add(f_heat_mode_flags, value):set_text(string.format("Heat Mode Flag Status %d -----> %d", i, value)) end offset = offset + count for i = 0,volt_rail_cnt - 1 do data = buffer(offset, 2):le_uint() data = data / 100 subtree:add(f_volt_rail_cur_val, data):set_text(string.format("Volt Rail Current Value %d -----> %0.2f V", i, data)) offset = offset + 2 end local mode = buffer(offset, 2):le_uint() mode = mode / 10 subtree:add(f_nrml_mode_thrld_volt, mode):set_text(string.format("Normal Mode Threshold Voltage -----> %0.1f V", mode)) offset = offset + 2 local mode = buffer(offset, 2):le_uint() mode = mode / 10 subtree:add(f_safe_mode_thrld_volt, mode):set_text(string.format("Safe Mode Threshold Voltage -----> %0.1f V", mode)) offset = offset + 2 local mode = buffer(offset, 2):le_uint() mode = mode / 10 subtree:add(f_crtl_mode_thrld_volt, mode):set_text(string.format("Critical Mode Threshold Voltage -----> %0.1f V", mode)) offset = offset + 2 subtree:add(f_obc_com_timeout, buffer(offset, 2):le_uint()) offset = offset + 2 subtree:add(f_num_of_obc_rst_for_eps_rst, buffer(offset, 1):le_uint()) offset = offset + 1 -- Parse eps_get_fw_vers_s local fw_vers_tree = subtree:add(eps_proto, buffer(offset, 5), "Firmware Version") for i = 1 ,mcu_cnt do fw_vers_tree:add("EPS MCU ",i) fw_vers_tree:add(f_mjr_fw_vers, buffer(offset, 1):le_uint()) offset = offset + 1 fw_vers_tree:add(f_mnr_fw_vers, buffer(offset, 1):le_uint()) offset = offset + 1 fw_vers_tree:add(f_patch_fw_vers, buffer(offset, 1):le_uint()) offset = offset + 1 fw_vers_tree:add(f_com_mjr_vers, buffer(offset, 1):le_uint()) offset = offset + 1 fw_vers_tree:add(f_com_mnr_vers, buffer(offset, 1):le_uint()) offset = offset + 1 end end