Class: QuelinkMg::Resp::Gtgsv
Constant Summary collapse
- GTGSV_RESP_KEYS_PREFIX =
%w[protocol_version unique_id device_name sv_count].freeze
- GTGSV_RESP_KEYS_SUFFIX =
%w[send_time count_number].freeze
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from QuelinkMg::Resp::Base
Instance Method Details
#hash ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/quelink-mg/resp/gtgsv.rb', line 9 def hash all_params = @response.split(',') sv_out = all_params[3].to_i sv_arr = [] sv_out.times do |i| sv_arr << "sv_id_#{i}" sv_arr << "sv_power_#{i}" end keys = [GTGSV_RESP_KEYS_PREFIX, sv_arr, GTGSV_RESP_KEYS_SUFFIX].inject(:+) unify_keys(keys.zip(all_params).to_h) end |