[
{
selector: Controls::CT_SCANNING_MODE_CONTROL,
length: 1,
encode: lambda {|x| [x ? 1 : 0].pack("C")},
decode: lambda {|x| x.unpack("C")[0] == 1 },
},
{
selector: Controls::CT_AE_MODE_CONTROL,
length: 1,
encode: lambda {|mode| [mode].pack("C")},
decode: lambda {|x| x.unpack("C")[0] },
},
{
selector: Controls::CT_AE_PRIORITY_CONTROL,
length: 1,
encode: lambda {|bAutoExposurePriority| [bAutoExposurePriority].pack("C")},
decode: lambda {|x| x.unpack("C")[0] },
},
{
selector: Controls::CT_EXPOSURE_TIME_ABSOLUTE_CONTROL,
length: 4,
encode: lambda {|dwExposureTimeAbsolute| [dwExposureTimeAbsolute].pack("V")},
decode: lambda {|x| x.unpack("V")[0] },
},
{
selector: Controls::CT_EXPOSURE_TIME_RELATIVE_CONTROL,
length: 1,
encode: lambda {|bExposureTimeRelative| [bExposureTimeRelative].pack("c")},
decode: lambda {|x| x.unpack("c")[0] },
},
{
selector: Controls::CT_FOCUS_ABSOLUTE_CONTROL,
length: 2,
encode: lambda {|wFocusAbsolute| [wFocusAbsolute].pack("v")},
decode: lambda {|x| x.unpack("v")[0] },
},
{
selector: Controls::CT_FOCUS_RELATIVE_CONTROL,
length: 2,
encode: lambda {|(bFocusRelative,bSpeed)| [wFocusAbsolute].pack("cC")},
decode: lambda {|x| x.unpack("cC") },
},
{
selector: Controls::CT_FOCUS_SIMPLE_CONTROL,
length: 1,
encode: lambda {|bFocus| [wFocusAbsolute].pack("C")},
decode: lambda {|x| x.unpack("C") },
},
{
selector: Controls::CT_FOCUS_AUTO_CONTROL,
length: 1,
encode: lambda {|bFocusAuto| [bFocusAuto ? 1 : 0].pack("C")},
decode: lambda {|x| x.unpack("C")[0] == 1},
},
{
selector: Controls::CT_IRIS_ABSOLUTE_CONTROL,
length: 2,
encode: lambda {|wIrisAbsolute| [wIrisAbsolute].pack("v")},
decode: lambda {|x| x.unpack("v")[0] },
},
{
selector: Controls::CT_IRIS_RELATIVE_CONTROL,
length: 1,
encode: lambda {|bIrisRelative| [bIrisRelative].pack("c")},
decode: lambda {|x| x.unpack("c")[0] },
},
{
selector: Controls::CT_ZOOM_ABSOLUTE_CONTROL,
length: 2,
encode: lambda {|wObjectiveFocalLength| [wObjectiveFocalLength].pack("v")},
decode: lambda {|x| x.unpack("v")[0] },
},
{
selector: Controls::CT_ZOOM_RELATIVE_CONTROL,
length: 3,
encode: lambda {|(bZoom, bDigitalZoom, bSpeed)| [bZoom, bDigitalZoom ? 1 : 0, bSpeed].pack("cCC")},
decode: lambda {|x| x.unpack("cCC").tap {|a| a[1] = a[1] == 1 } },
},
{
selector: Controls::CT_PANTILT_ABSOLUTE_CONTROL,
length: 8,
encode: lambda {|(dwPanAbsolute, dwTiltAbsolute)| [dwPanAbsolute, dwTiltAbsolute].pack("l<l<")},
decode: lambda {|x| x.unpack("l<l<") },
},
{
selector: Controls::CT_PANTILT_RELATIVE_CONTROL,
length: 4,
encode: lambda {|(bPanRelative, bPanSpeed, bTiltRelative, bTiltSpeed)| [bPanRelative, bPanSpeed, bTiltRelative, bTiltSpeed].pack("cCcC")},
decode: lambda {|x| x.unpack("cCcC") },
},
{
selector: Controls::CT_ROLL_ABSOLUTE_CONTROL,
length: 2,
encode: lambda {|wRollAbsolute| [wRollAbsolute].pack("s<")},
decode: lambda {|x| x.unpack("s<")[0] },
},
{
selector: Controls::CT_ROLL_RELATIVE_CONTROL,
length: 2,
encode: lambda {|(bRollRelative, bSpeed)| [bRollRelative, bSpeed].pack("cC")},
decode: lambda {|x| x.unpack("cC") },
},
{
selector: Controls::CT_PRIVACY_CONTROL,
length: 1,
encode: lambda {|bPrivacy| [bPrivacy ? 1 : 0].pack("C")},
decode: lambda {|x| x.unpack("C")[0] == 1 },
},
{
selector: Controls::CT_WINDOW_CONTROL,
length: 12,
encode: lambda {|(wWindow_Top, wWindow_Left, wWindow_Bottom, wWindow_Right, wNumSteps, bmNumStepsUnits)| [wWindow_Top, wWindow_Left, wWindow_Bottom, wWindow_Right, wNumSteps, bmNumStepsUnits].pack("vvvvvv")},
decode: lambda {|x| x.unpack("vvvvvv") },
},
{
selector: Controls::CT_REGION_OF_INTEREST_CONTROL,
length: 10,
encode: lambda {|(wROI_Top, wROI_Left, wROI_Bottom, wROI_Right, bmAutoControls)| [wROI_Top, wROI_Left, wROI_Bottom, wROI_Right, bmAutoControls].pack("vvvvv")},
decode: lambda {|x| x.unpack("vvvvv") },
},
{
selector: Controls::SU_INPUT_SELECT_CONTROL,
length: 1,
encode: lambda {|bSelector| [bSelector].pack("C")},
decode: lambda {|x| x.unpack("C")[0] },
},
{
selector: Controls::PU_BACKLIGHT_COMPENSATION_CONTROL,
length: 2,
encode: lambda {|wBacklightCompensation| [wBacklightCompensation].pack("v")},
decode: lambda {|x| x.unpack("v")[0]},
},
{
selector: Controls::PU_BRIGHTNESS_CONTROL,
length: 2,
encode: lambda {|wBrightness| [wBrightness].pack("s<")},
decode: lambda {|x| x.unpack("s<")[0]},
},
{
selector: Controls::PU_CONTRAST_CONTROL,
length: 2,
encode: lambda {|wContrast| [wContrast].pack("v")},
decode: lambda {|x| x.unpack("v")[0]},
},
{
selector: Controls::PU_CONTRAST_AUTO_CONTROL,
length: 1,
encode: lambda {|bContrastAuto| [bContrastAuto ? 1 : 0].pack("C")},
decode: lambda {|x| x.unpack("C")[0] == 1},
},
{
selector: Controls::PU_GAIN_CONTROL,
length: 2,
encode: lambda {|wGain| [wGain].pack("v")},
decode: lambda {|x| x.unpack("v")[0]},
},
{
selector: Controls::PU_POWER_LINE_FREQUENCY_CONTROL,
length: 1,
encode: lambda {|bPowerLineFrequency| [bPowerLineFrequency].pack("C")},
decode: lambda {|x| x.unpack("C")[0]},
},
{
selector: Controls::PU_HUE_CONTROL,
length: 2,
encode: lambda {|wHue| [wHue].pack("v")},
decode: lambda {|x| x.unpack("v")[0]},
},
{
selector: Controls::PU_HUE_AUTO_CONTROL,
length: 1,
encode: lambda {|bHueAuto| [bHueAuto ? 1 : 0].pack("C")},
decode: lambda {|x| x.unpack("C")[0] == 1},
},
{
selector: Controls::PU_SATURATION_CONTROL,
length: 2,
encode: lambda {|wSaturation| [wSaturation].pack("v")},
decode: lambda {|x| x.unpack("v")[0]},
},
{
selector: Controls::PU_SHARPNESS_CONTROL,
length: 2,
encode: lambda {|wSharpness| [wSharpness].pack("v")},
decode: lambda {|x| x.unpack("v")[0]},
},
{
selector: Controls::PU_GAMMA_CONTROL,
length: 2,
encode: lambda {|wGamma| [wGamma].pack("v")},
decode: lambda {|x| x.unpack("v")[0]},
},
{
selector: Controls::PU_WHITE_BALANCE_TEMPERATURE_CONTROL,
length: 2,
encode: lambda {|wWhiteBalanceTemperature| [wWhiteBalanceTemperature].pack("v")},
decode: lambda {|x| x.unpack("v")[0]},
},
{
selector: Controls::PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL,
length: 1,
encode: lambda {|bWhiteBalanceTemperatureAuto| [bWhiteBalanceTemperatureAuto ? 1 : 0].pack("C")},
decode: lambda {|x| x.unpack("C")[0] == 1},
},
{
selector: Controls::PU_WHITE_BALANCE_COMPONENT_CONTROL,
length: 4,
encode: lambda {|(wWhiteBalanceBlue, wWhiteBalanceRed)| [wWhiteBalanceBlue, wWhiteBalanceRed].pack("vv")},
decode: lambda {|x| x.unpack("vv") },
},
{
selector: Controls::PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL,
length: 1,
encode: lambda {|bWhiteBalanceComponentAuto| [bWhiteBalanceComponentAuto ? 1 : 0].pack("C")},
decode: lambda {|x| x.unpack("C")[0] == 1},
},
{
selector: Controls::PU_DIGITAL_MULTIPLIER_CONTROL,
length: 2,
encode: lambda {|wMultiplierStep| [wMultiplierStep].pack("v")},
decode: lambda {|x| x.unpack("v")[0] },
},
{
selector: Controls::PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL,
length: 2,
encode: lambda {|wMultiplierLimit| [wMultiplierLimit].pack("v")},
decode: lambda {|x| x.unpack("v")[0] },
},
{
selector: Controls::PU_ANALOG_VIDEO_STANDARD_CONTROL,
length: 1,
encode: lambda {|bVideoStandard| [bVideoStandard].pack("C")},
decode: lambda {|x| x.unpack("C")[0] },
},
{
selector: Controls::PU_ANALOG_LOCK_STATUS_CONTROL,
length: 1,
encode: lambda {|bStatus| [bStatus].pack("C")},
decode: lambda {|x| x.unpack("C")[0] },
},
]