tm_sband_get_tm_all.lua 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. -- tmid - 412
  2. -- Your function definition begins here
  3. function tm_sband_get_tm_all(buffer, pinfo, tree, sband_get_tm_all, offset, instance)
  4. -- Define ProtoFields for s_sband_cmn_tm
  5. local f_cnt = ProtoField.uint64("sband_get_tm_all.cnt", "Count", base.DEC)
  6. local f_timestamp2 = ProtoField.uint64("sband_get_tm_all.timestamp2", "Timestamp", base.DEC)
  7. local f_temp_mcu = ProtoField.uint32("sband_get_tm_all.temp_mcu", "Temp MCU", base.DEC)
  8. local f_temp_fpga = ProtoField.uint32("sband_get_tm_all.temp_fpga", "Temp FPGA", base.DEC)
  9. local f_temp_xcvr = ProtoField.uint32("sband_get_tm_all.temp_xcvr", "Temp XCVR", base.DEC)
  10. local f_volt_vint = ProtoField.double("sband_get_tm_all.volt_vint", "Volt Vint", base.DEC)
  11. local f_volt_vaux = ProtoField.double("sband_get_tm_all.volt_vaux", "Volt Vaux", base.DEC)
  12. local f_volt_vbram = ProtoField.double("sband_get_tm_all.volt_vbram", "Volt Vbram", base.DEC)
  13. local f_volt_vpint = ProtoField.double("sband_get_tm_all.volt_vpint", "Volt Vpint", base.DEC)
  14. local f_volt_vpaux = ProtoField.double("sband_get_tm_all.volt_vpaux", "Volt Vpaux", base.DEC)
  15. local f_volt_vpdro = ProtoField.double("sband_get_tm_all.volt_vpdro", "Volt Vpdro", base.DEC)
  16. --local f_resv_chnl = ProtoField.uint8("sband_get_tm_all.resv_cgnl", "resvchnl", base.DEC)
  17. -- Define ProtoFields for s_sband_rx_tm
  18. local f_rx_cfg_frames = ProtoField.uint32("sband_get_tm_all.rx_cfg_frames", "RX Config Frames", base.DEC)
  19. local f_rx_cfg_detected = ProtoField.uint32("sband_get_tm_all.rx_cfg_detected", "RX Config Detected", base.DEC)
  20. local f_rx_cfg_rssi = ProtoField.float("sband_get_tm_all.rx_cfg_rssi", "RX Config RSSI", base.DEC)
  21. local f_rx_avg_rssi = ProtoField.float("sband_get_tm_all.rx_avg_rssi", "RX Average RSSI", base.DEC)
  22. local f_rx_cfg_freqerr = ProtoField.int32("sband_get_tm_all.rx_cfg_freqerr", "RX Config Frequency Error", base.DEC)
  23. local f_rx_cfg_carrier_lock = ProtoField.uint32("sband_get_tm_all.rx_cfg_carrier_lock", "RX Carrier Lock", base.DEC)
  24. local f_rx_frame_lock = ProtoField.uint32("sband_get_tm_all.rx_frame_lock", "RX Frame Lock", base.DEC)
  25. local f_rx_sir_min = ProtoField.uint32("sband_get_tm_all.rx_sir_min", "RX SIR Min", base.DEC)
  26. local f_rx_sir_max = ProtoField.uint32("sband_get_tm_all.rx_sir_max", "RX SIR Max", base.DEC)
  27. local f_rx_bch_block_cnt = ProtoField.uint32("sband_get_tm_all.rx_bch_block_cnt", "RX BCH Block Count", base.DEC)
  28. local f_rx_bch_err_cnt = ProtoField.uint32("sband_get_tm_all.rx_bch_err_cnt", "RX BCH Error Count", base.DEC)
  29. -- Define ProtoFields for s_sband_tx_tm
  30. local f_tx_cfg_frames = ProtoField.uint32("sband_get_tm_all.tx_cfg_frames", "TX Config Frames", base.DEC)
  31. local f_tx_cfg_pwr_rfl = ProtoField.float("sband_get_tm_all.tx_cfg_pwr_rfl", "TX Power RFL", base.DEC)
  32. -- For the main s_sband_periodic_tm structure
  33. --local f_cmn_tm = ProtoField.bytes("sband_get_tm_store.cmn_tm", "Common Time", base.HEX)
  34. --local f_rx_tm = ProtoField.bytes("sband_get_tm_store.rx_tm", "RX Time", base.HEX)
  35. --local f_tx_tm = ProtoField.bytes("sband_get_tm_store.tx_tm", "TX Time", base.HEX)
  36. -- Add all fields to the protocol
  37. sband_get_tm_all.fields = {
  38. f_timestamp2, f_temp_mcu, f_temp_fpga, f_temp_xcvr, f_volt_vint, f_volt_vaux, f_volt_vbram, f_volt_vpint,
  39. f_volt_vpaux, f_volt_vpdro,
  40. f_rx_cfg_frames, f_rx_cfg_detected, f_rx_cfg_rssi, f_rx_avg_rssi, f_rx_cfg_freqerr,
  41. f_rx_cfg_carrier_lock, f_rx_frame_lock, f_rx_sir_min, f_rx_sir_max, f_rx_bch_block_cnt, f_rx_bch_err_cnt,
  42. f_tx_cfg_frames, f_tx_cfg_pwr_rfl
  43. }
  44. local subtree1 = tree:add(sband_get_tm_all, buffer(), "TM SBAND GET TM STORE")
  45. subtree1:add(f_temp_mcu, buffer(offset, 4):le_uint()) -- 4 bytes for int32
  46. offset = offset + 4
  47. subtree1:add(f_temp_fpga, buffer(offset, 4):le_uint()) -- 4 bytes for int32
  48. offset = offset + 4
  49. subtree1:add(f_temp_xcvr, buffer(offset, 4):le_uint()) -- 4 bytes for int32
  50. offset = offset + 4
  51. local data = buffer(offset, 8):le_float() -- First 4 bytes for z_vel
  52. subtree1:add(f_volt_vint, data ):set_text(string.format("Volt Vint: %.6f ", data))
  53. offset = offset + 8
  54. data = buffer(offset, 8):le_float() -- First 4 bytes for z_vel
  55. subtree1:add(f_volt_vaux, data):set_text(string.format("Volt Vaux: %.6f ", data))
  56. offset = offset + 8
  57. data = buffer(offset, 8):le_float() -- First 4 bytes for z_vel
  58. subtree1:add(f_volt_vbram, data ):set_text(string.format("Volt Vbram: %.6f ", data))
  59. offset = offset + 8
  60. data = buffer(offset, 8):le_float() -- First 4 bytes for z_vel
  61. subtree1:add(f_volt_vpint, data ):set_text(string.format("Volt Vpint: %.6f ", data))
  62. offset = offset + 8
  63. data = buffer(offset, 8):le_float() -- First 4 bytes for z_vel
  64. subtree1:add(f_volt_vpaux, data ):set_text(string.format("Volt Vpaux: %.6f ", data))
  65. offset = offset + 8
  66. data = buffer(offset, 8):le_float() -- First 4 bytes for z_vel
  67. subtree1:add(f_volt_vpdro, data ):set_text(string.format("Volt Vpdro: %.6f ", data))
  68. offset = offset + 8
  69. -- Dissect the s_sband_rx_tm structure
  70. -- Handle the RX structure
  71. print("Recv chnl : 1")
  72. subtree1:add(f_rx_cfg_frames, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  73. offset = offset + 4
  74. subtree1:add(f_rx_cfg_detected, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  75. offset = offset + 4
  76. subtree1:add(f_rx_cfg_rssi, buffer(offset, 4):le_float()):set_text(string.format("Rx Cfg Rssi: %.6f ", buffer(offset, 4):le_float())) -- 4bytes for float(f32)
  77. offset = offset + 4
  78. subtree1:add(f_rx_avg_rssi, buffer(offset, 4):le_float()) :set_text(string.format("Rx avg Rssi: %.6f ", buffer(offset, 4):le_float()))-- 4bytes for float (f32)
  79. offset = offset + 4
  80. subtree1:add(f_rx_cfg_freqerr, buffer(offset, 4):le_uint()) -- 4 bytes for int32
  81. offset = offset + 4
  82. subtree1:add(f_rx_cfg_carrier_lock, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  83. offset = offset + 4
  84. subtree1:add(f_rx_frame_lock, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  85. offset = offset + 4
  86. subtree1:add(f_rx_sir_min, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  87. offset = offset + 4
  88. subtree1:add(f_rx_sir_max, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  89. offset = offset + 4
  90. subtree1:add(f_rx_bch_block_cnt, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  91. offset = offset + 4
  92. subtree1:add(f_rx_bch_err_cnt, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  93. offset = offset + 4
  94. --subtree1:add(f_recv_chnl,2) -- 4 bytes for uint32
  95. print("Recv chnl - 2")
  96. subtree1:add(f_rx_cfg_frames, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  97. offset = offset + 4
  98. subtree1:add(f_rx_cfg_detected, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  99. offset = offset + 4
  100. subtree1:add(f_rx_cfg_rssi, buffer(offset, 4):le_float()):set_text(string.format("Rx Cfg Rssi: %.6f ", buffer(offset, 4):le_float()))--4 bytes for float (f32)
  101. offset = offset + 4
  102. subtree1:add(f_rx_avg_rssi, buffer(offset, 4):le_float()):set_text(string.format("Rx Avg Rssi: %.6f ", buffer(offset, 4):le_float()))-- 4 bytes for float (f32)
  103. offset = offset + 4
  104. subtree1:add(f_rx_cfg_freqerr, buffer(offset, 4):le_uint()) -- 4 bytes for int32
  105. offset = offset + 4
  106. subtree1:add(f_rx_cfg_carrier_lock, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  107. offset = offset + 4
  108. subtree1:add(f_rx_frame_lock, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  109. offset = offset + 4
  110. subtree1:add(f_rx_sir_min, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  111. offset = offset + 4
  112. subtree1:add(f_rx_sir_max, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  113. offset = offset + 4
  114. subtree1:add(f_rx_bch_block_cnt, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  115. offset = offset + 4
  116. subtree1:add(f_rx_bch_err_cnt, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  117. offset = offset + 4
  118. --Dissect the s_sband_tx_tm structure
  119. subtree1:add(f_tx_cfg_frames, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
  120. offset = offset + 4
  121. subtree1:add(f_tx_cfg_pwr_rfl, buffer(offset, 4):le_float()) -- 4 bytes for float (f32)
  122. offset = offset + 4
  123. end -- This closes the function `sband_dissectors`