class Airplay::Device::Features

Public: The feature list of a given device

Attributes

properties[R]

Public Class Methods

new(device) click to toggle source
# File lib/airplay/device/features.rb, line 10
def initialize(device)
  @device = device
  check_features
end

Private Instance Methods

check_features() click to toggle source
# File lib/airplay/device/features.rb, line 17
def check_features
  hex = @device.server_info["features"].to_s.hex
  @properties = {
    video?:                   0 < (hex & ( 1 <<  0 )),
    photo?:                   0 < (hex & ( 1 <<  1 )),
    video_fair_play?:         0 < (hex & ( 1 <<  2 )),
    video_volume_control?:    0 < (hex & ( 1 <<  3 )),
    video_http_live_stream?:  0 < (hex & ( 1 <<  4 )),
    slideshow?:               0 < (hex & ( 1 <<  5 )),
    screen?:                  0 < (hex & ( 1 <<  7 )),
    screen_rotate?:           0 < (hex & ( 1 <<  8 )),
    audio?:                   0 < (hex & ( 1 <<  9 )),
    audio_redundant?:         0 < (hex & ( 1 << 11 )),
    FPSAPv2pt5_AES_GCM?:      0 < (hex & ( 1 << 12 )),
    photo_caching?:           0 < (hex & ( 1 << 13 ))
  }

  @properties.each do |key, value|
    self.class.send(:define_method, key) { value }
  end

end