tm_get_sdr_rssi_cfg.lua 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. function tm_get_sdr_rssi_cfg(buffer, pinfo, tree, sdr_rssi_cfg, offset)
  2. -- Define ProtoFields for the structure
  3. local f_valid_rssi_cnt = ProtoField.uint8("sdr_rssi_cfg.valid_rssi_cnt", "Valid RSSI Count", base.DEC)
  4. local f_inv_rssi_cnt = ProtoField.uint8("sdr_rssi_cfg.inv_rssi_cnt", "Invalid RSSI Count", base.DEC)
  5. local f_rssi_min = ProtoField.float("sdr_rssi_cfg.rssi_min", "RSSI Min", base.DEC)
  6. local f_rssi_typ = ProtoField.float("sdr_rssi_cfg.rssi_typ", "RSSI Typ", base.DEC)
  7. local f_rssi_prd_tmr = ProtoField.uint32("sdr_rssi_cfg.rssi_prd_tmr", "RSSI Period Timer", base.DEC)
  8. local f_short_rx_on_tmr = ProtoField.uint32("sdr_rssi_cfg.short_rx_on_tmr", "Short RX On Timer", base.DEC)
  9. local f_long_rx_on_tmr = ProtoField.uint32("sdr_rssi_cfg.long_rx_on_tmr", "Long RX On Timer", base.DEC)
  10. -- Add fields to the protocol
  11. sdr_rssi_cfg.fields = {
  12. f_valid_rssi_cnt,
  13. f_inv_rssi_cnt,
  14. f_rssi_min,
  15. f_rssi_typ,
  16. f_rssi_prd_tmr,
  17. f_short_rx_on_tmr,
  18. f_long_rx_on_tmr
  19. }
  20. -- Add a subtree for the structure
  21. local subtree = tree:add(sdr_rssi_cfg, buffer(), "TM GET SDR RX RSSI CNFG")
  22. -- Dissect each field
  23. -- Valid RSSI Count (1 byte)
  24. local valid_rssi_cnt = buffer(offset, 1):uint()
  25. subtree:add(f_valid_rssi_cnt, buffer(offset, 1)):set_text(string.format("Valid RSSI Count: %d", valid_rssi_cnt))
  26. offset = offset + 1
  27. -- Invalid RSSI Count (1 byte)
  28. local inv_rssi_cnt = buffer(offset, 1):uint()
  29. subtree:add(f_inv_rssi_cnt, buffer(offset, 1)):set_text(string.format("Invalid RSSI Count: %d", inv_rssi_cnt))
  30. offset = offset + 1
  31. -- RSSI Min (4 bytes, float)
  32. local rssi_min = buffer(offset, 4):le_float()
  33. subtree:add(f_rssi_min, buffer(offset, 4)):set_text(string.format("RSSI Min: %.6f", rssi_min))
  34. offset = offset + 4
  35. -- RSSI Typ (4 bytes, float)
  36. local rssi_typ = buffer(offset, 4):le_float()
  37. subtree:add(f_rssi_typ, buffer(offset, 4)):set_text(string.format("RSSI Typ: %.6f", rssi_typ))
  38. offset = offset + 4
  39. -- RSSI Period Timer (4 bytes, uint32)
  40. local rssi_prd_tmr = buffer(offset, 4):le_uint()
  41. subtree:add(f_rssi_prd_tmr, buffer(offset, 4)):set_text(string.format("RSSI Period Timer: %d", rssi_prd_tmr))
  42. offset = offset + 4
  43. -- Short RX On Timer (4 bytes, uint32)
  44. local short_rx_on_tmr = buffer(offset, 4):le_uint()
  45. subtree:add(f_short_rx_on_tmr, buffer(offset, 4)):set_text(string.format("Short RX On Timer: %d", short_rx_on_tmr))
  46. offset = offset + 4
  47. -- Long RX On Timer (4 bytes, uint32)
  48. local long_rx_on_tmr = buffer(offset, 4):le_uint()
  49. subtree:add(f_long_rx_on_tmr, buffer(offset, 4)):set_text(string.format("Long RX On Timer: %d", long_rx_on_tmr))
  50. offset = offset + 4
  51. end