Class: DACPClient::DMAPParser

Inherits:
Object
  • Object
show all
Defined in:
lib/dacpclient/dmapparser.rb

Overview

The DMAPParser class parses DMAP responses

Class Method Summary collapse

Class Method Details

.parse(response) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/dacpclient/dmapparser.rb', line 8

def self.parse(response)
  return nil if response.nil? || response.length < 8
  response = StringIO.new(response)
  ret = TagContainer.new
  key = response.read(4)
  ret.type = TagDefinition[key]
  response.read(4) # ignore length for now
  ret.value = parse_container(response)
  ret
end