Module: RCS::MicEvidence
- Defined in:
- lib/rcs-common/evidence/mic.rb
Constant Summary collapse
- MIC_LOG_VERSION =
2008121901
Instance Method Summary collapse
- #decode_additional_header(data) ⇒ Object
- #decode_content(common_info, chunks) {|info| ... } ⇒ Object
Instance Method Details
#decode_additional_header(data) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rcs-common/evidence/mic.rb', line 9 def decode_additional_header(data) raise EvidenceDeserializeError.new("incomplete evidence") if data.nil? or data.bytesize == 0 stream = StringIO.new data ret = Hash.new ret[:data] = Hash.new version = read_uint32 stream raise EvidenceDeserializeError.new("invalid log version for voice call") unless version == MIC_LOG_VERSION ret[:data][:sample_rate] = read_uint32 stream low, high = stream.read(8).unpack 'V2' ret[:data][:mic_id] = Time.from_filetime high, low return ret end |
#decode_content(common_info, chunks) {|info| ... } ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rcs-common/evidence/mic.rb', line 28 def decode_content(common_info, chunks) stream = StringIO.new chunks.join info = Hash[common_info] info[:data] ||= Hash.new info[:data][:grid_content] = chunks.join yield info if block_given? :keep_raw end |