Skip to content

Commit

Permalink
* improve inspection
Browse files Browse the repository at this point in the history
  • Loading branch information
kazubu committed Feb 3, 2014
1 parent 8f3d640 commit 309f0cf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions IRData.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,17 @@ def data_inspect_nec

data_hex = [data_bin].pack("B*").unpack("H*")[0]

datan = data_hex[4..data_hex.length]
datan_ary = datan.each_char.each_slice(2).map{|a| a.join}
datan_rev = [datan].pack("H*").unpack("B*").pack("b*").unpack("H*")[0]
datan_rev_ary = datan_rev.each_char.each_slice(2).map{|a| a.join}

return {
:customer_code => data_hex[0..3],
:datan => data_hex[4..data_hex.length],
:datan_rev => [data_hex[4..data_hex.length]].pack("H*").unpack("B*").pack("b*").unpack("H*"),
:datan => datan,
:datan_ary => datan_ary,
:datan_rev => datan_rev,
:datan_rev_ary => datan_rev_ary,
:data_hex => data_hex
}
end
Expand Down

0 comments on commit 309f0cf

Please sign in to comment.