Module: DjiMqttConnect::Mixins::VideoType

Defined in:
lib/dji_mqtt_connect/mixins/video_type.rb

Overview

Adds video type helper methods Assumes a video_type attribute is present of type Types::VideoType

Instance Method Summary collapse

Instance Method Details

#humanized_video_typeObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dji_mqtt_connect/mixins/video_type.rb', line 12

def humanized_video_type
  if video_type_infrared?
    I18n.t("infrared", scope: "dji_mqtt_connect.video_types") # Infrared
  elsif video_type_normal?
    I18n.t("normal", scope: "dji_mqtt_connect.video_types") # Default
  elsif video_type_wide_angle?
    I18n.t("wide_angle", scope: "dji_mqtt_connect.video_types") # Wide-angle
  elsif video_type_zoom?
    I18n.t("zoom", scope: "dji_mqtt_connect.video_types") # Zoom
  end
end

#video_type?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/dji_mqtt_connect/mixins/video_type.rb', line 8

def video_type?
  Types::VideoType.valid?(video_type)
end

#video_type_infrared?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/dji_mqtt_connect/mixins/video_type.rb', line 24

def video_type_infrared?
  video_type == Types::VIDEO_TYPE_INFRARED
end

#video_type_normal?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/dji_mqtt_connect/mixins/video_type.rb', line 28

def video_type_normal?
  video_type == Types::VIDEO_TYPE_NORMAL
end

#video_type_wide_angle?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/dji_mqtt_connect/mixins/video_type.rb', line 32

def video_type_wide_angle?
  video_type == Types::VIDEO_TYPE_WIDE_ANGLE
end

#video_type_zoom?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/dji_mqtt_connect/mixins/video_type.rb', line 36

def video_type_zoom?
  video_type == Types::VIDEO_TYPE_ZOOM
end