Exception: UVC::UVCDevice::UVCError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/uvc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code = nil, msg = nil) ⇒ UVCError

Returns a new instance of UVCError.



753
754
755
756
# File 'lib/uvc.rb', line 753

def initialize(code = nil, msg = nil)
	@code = code
	super(msg || "error with code %#04x: %s" % [code, error_description])
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



752
753
754
# File 'lib/uvc.rb', line 752

def code
  @code
end

Instance Method Details

#error_descriptionObject



758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
# File 'lib/uvc.rb', line 758

def error_description
	case @code
	when 0x00
		"No error"
	when 0x01
		"Not ready"
	when 0x02
		"Wrong state"
	when 0x03
		"Power"
	when 0x04
		"Out of range"
	when 0x05
		"Invalid unit"
	when 0x06
		"Invalid control"
	when 0x07
		"Invalid Request"
	when 0x08
		"Invalid value within range"
	else
		"unknown"
	end
end