Method: Roma::Command::SystemCommandReceiver#ev_set_latency_avg_calc_rule
- Defined in:
- lib/roma/command/sys_command_receiver.rb
#ev_set_latency_avg_calc_rule(s) ⇒ Object
set_latency_avg_calc_rule <mode> <count> <command1> <command2>.… <mode> is on/off <count> is denominator to calculate average. <commandx> is target command
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'lib/roma/command/sys_command_receiver.rb', line 443 def ev_set_latency_avg_calc_rule(s) #check argument if /^on$|^off$/ !~ s[1] return send_data("CLIENT_ERROR argument 1: please input \"on\" or \"off\"\r\n") elsif s[1] == "on" && (s.length <= 3 || s[2].to_i < 1) return send_data("CLIENT_ERROR number of arguments (0 for 3) and <count> must be greater than zero\r\n") elsif s[1] == "off" && !(s.length == 2) return send_data("CLIENT_ERROR number of arguments (0 for 1, or more 3)\r\n") end #check support commands s.each_index {|idx| if idx >= 3 && (!Event::Handler::ev_list.include?(s[idx]) || Event::Handler::system_commands.include?(s[idx])) return send_data("NOT SUPPORT [#{s[idx]}] command\r\n") end } arg ="rset_latency_avg_calc_rule" s.each_index {|idx| arg += " #{s[idx]}" if idx>=1 } res = broadcast_cmd("#{arg}\r\n") if s[1] =="on" @stats.latency_check_cmd = [] #reset s.each_index {|idx| @stats.latency_check_cmd.push(s[idx]) if idx >= 3 } @stats.latency_check_time_count = s[2].to_i @stats.latency_log = true res[@stats.ap_str] = "ACTIVATED" elsif s[1] =="off" @stats.latency_check_cmd = [] #reset @stats.latency_check_time_count = false @stats.latency_log = false res[@stats.ap_str] = "DEACTIVATED" end @stats.latency_data = Hash.new { |hash,key| hash[key] = {}} send_data("#{res}\r\n") end |