int ImagingBindingService::Move(_timg__Move *timg__Move, _timg__MoveResponse *timg__MoveResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; auto it = ctx->m_devices.find(timg__Move->VideoSourceToken); if (it != ctx->m_devices.end()) { if (timg__Move->Focus) { if (timg__Move->Focus->Absolute) { int position = timg__Move->Focus->Absolute->Position; ctx->setCtrlValue(it->first, V4L2_CID_FOCUS_ABSOLUTE, position); } if (timg__Move->Focus->Relative) { int position = timg__Move->Focus->Relative->Distance; ctx->setCtrlValue(it->first, V4L2_CID_FOCUS_RELATIVE, position); } } } return SOAP_OK; }
int ImagingBindingService::Stop(_timg__Stop *timg__Stop, _timg__StopResponse *timg__StopResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; auto it = ctx->m_devices.find(timg__Stop->VideoSourceToken); if (it != ctx->m_devices.end()) { ctx->setCtrlValue(it->first, V4L2_CID_AUTO_FOCUS_STOP, 0); } return SOAP_OK; }
int ImagingBindingService::SetImagingSettings(_timg__SetImagingSettings *timg__SetImagingSettings, _timg__SetImagingSettingsResponse *timg__SetImagingSettingsResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; auto it = ctx->m_devices.find(timg__SetImagingSettings->VideoSourceToken); if (it != ctx->m_devices.end()) { if (timg__SetImagingSettings->ImagingSettings->Brightness) { int brightness = *timg__SetImagingSettings->ImagingSettings->Brightness; ctx->setCtrlValue(it->first, V4L2_CID_BRIGHTNESS, brightness); } if (timg__SetImagingSettings->ImagingSettings->Contrast) { int contrast = *timg__SetImagingSettings->ImagingSettings->Contrast; ctx->setCtrlValue(it->first, V4L2_CID_CONTRAST, contrast); } if (timg__SetImagingSettings->ImagingSettings->ColorSaturation) { int saturation = *timg__SetImagingSettings->ImagingSettings->ColorSaturation; ctx->setCtrlValue(it->first, V4L2_CID_SATURATION, saturation); } if (timg__SetImagingSettings->ImagingSettings->Sharpness) { int sharpness = *timg__SetImagingSettings->ImagingSettings->Sharpness; ctx->setCtrlValue(it->first, V4L2_CID_SHARPNESS, sharpness); } if (timg__SetImagingSettings->ImagingSettings->BacklightCompensation) { int backlightCompensation = (timg__SetImagingSettings->ImagingSettings->BacklightCompensation->Mode == tt__BacklightCompensationMode__ON); ctx->setCtrlValue(it->first, V4L2_CID_BACKLIGHT_COMPENSATION, backlightCompensation); } if (timg__SetImagingSettings->ImagingSettings->WideDynamicRange) { int wideDynamicMode = (timg__SetImagingSettings->ImagingSettings->WideDynamicRange->Mode == tt__WideDynamicMode__ON); ctx->setCtrlValue(it->first, V4L2_CID_WIDE_DYNAMIC_RANGE, wideDynamicMode); } if (timg__SetImagingSettings->ImagingSettings->Exposure) { int exposure = (timg__SetImagingSettings->ImagingSettings->Exposure->Mode == tt__ExposureMode__AUTO); ctx->setCtrlValue(it->first, V4L2_CID_EXPOSURE_AUTO, exposure); if (timg__SetImagingSettings->ImagingSettings->Exposure->ExposureTime) { int exposureTime = *timg__SetImagingSettings->ImagingSettings->Exposure->ExposureTime; ctx->setCtrlValue(it->first, V4L2_CID_EXPOSURE_ABSOLUTE, exposureTime); } } if (timg__SetImagingSettings->ImagingSettings->WhiteBalance) { int autoWhiteBalance = (timg__SetImagingSettings->ImagingSettings->WhiteBalance->Mode == tt__WhiteBalanceMode__AUTO); ctx->setCtrlValue(it->first, V4L2_CID_AUTO_WHITE_BALANCE, autoWhiteBalance); if (timg__SetImagingSettings->ImagingSettings->WhiteBalance->CrGain) { int redBalance = *timg__SetImagingSettings->ImagingSettings->WhiteBalance->CrGain; ctx->setCtrlValue(it->first, V4L2_CID_RED_BALANCE, redBalance); } if (timg__SetImagingSettings->ImagingSettings->WhiteBalance->CbGain) { int blueBalance = *timg__SetImagingSettings->ImagingSettings->WhiteBalance->CbGain; ctx->setCtrlValue(it->first, V4L2_CID_BLUE_BALANCE, blueBalance); } } if (timg__SetImagingSettings->ImagingSettings->Focus) { int autofocusMode = (timg__SetImagingSettings->ImagingSettings->Focus->AutoFocusMode == tt__AutoFocusMode__AUTO); ctx->setCtrlValue(it->first, V4L2_CID_FOCUS_AUTO, autofocusMode); } } return SOAP_OK; }