dawn_hearing_map.lua 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. m = Map("dawn", "Hearing Map", translate("Hearing Map"))
  2. m.pageaction = false
  3. s = m:section(NamedSection, "__hearingmap__")
  4. function s.render(self, sid)
  5. local tpl = require "luci.template"
  6. tpl.render_string([[
  7. <%
  8. local utl = require "luci.util"
  9. local status = require "luci.tools.ieee80211"
  10. local stat = utl.ubus("dawn", "get_hearing_map", { })
  11. local name, macs
  12. for name, macs in pairs(stat) do
  13. %>
  14. <div class="cbi-section-node">
  15. <h3>SSID: <%= name %></h3>
  16. <div class="table" id="dawn_hearing_map">
  17. <div class="tr table-titles">
  18. <div class="th">Client MAC</div>
  19. <div class="th">AP MAC</div>
  20. <div class="th">Frequency</div>
  21. <div class="th">HT Sup</div>
  22. <div class="th">VHT Sup</div>
  23. <div class="th">Signal</div>
  24. <div class="th">RCPI</div>
  25. <div class="th">RSNI</div>
  26. <div class="th">Channel Utilization</div>
  27. <div class="th">Station connect to AP</div>
  28. <div class="th">Score</div>
  29. </div>
  30. <%
  31. local mac, data
  32. for mac, data in pairs(macs) do
  33. local mac2, data2
  34. local count_loop = 0
  35. for mac2, data2 in pairs(data) do
  36. %>
  37. <div class="tr">
  38. <% if (count_loop == 0) then %>
  39. <div class="td"><%= mac %></div>
  40. <% else %>
  41. <div></div>
  42. <% end %>
  43. <div class="td"><%= mac2 %></div>
  44. <div class="td"><%= "%.3f" %( data2.freq / 1000 ) %> GHz Channel: <%= "%d" %( status.frequency_to_channel(data2.freq) ) %></div>
  45. <div class="td"><%= (data2.ht_capabilities == true and data2.ht_support == true) and "True" or "False" %></div>
  46. <div class="td"><%= (data2.vht_capabilities == true and data2.vht_support == true) and "True" or "False" %></div>
  47. <div class="td"><%= "%d" %data2.signal %></div>
  48. <div class="td"><%= "%d" %data2.rcpi %></div>
  49. <div class="td"><%= "%d" %data2.rsni %></div>
  50. <div class="td"><%= "%.2f" %(data2.channel_utilization / 2.55) %> %</div>
  51. <div class="td"><%= "%d" %data2.num_sta %></div>
  52. <div class="td"><%= "%d" %data2.score %></div>
  53. </div>
  54. <%
  55. count_loop = count_loop + 1
  56. end
  57. end
  58. %>
  59. </div>
  60. </div>
  61. <%
  62. end
  63. %>
  64. </div>
  65. ]])
  66. end
  67. return m