int DeviceBindingService::GetStorageConfiguration(_tds__GetStorageConfiguration *tds__GetStorageConfiguration, _tds__GetStorageConfigurationResponse *tds__GetStorageConfigurationResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; tds__GetStorageConfigurationResponse->StorageConfiguration = ctx->getStorageCfg(this->soap, "/tmp"); return SOAP_OK; }
int NotificationProducerBindingService::Subscribe(_wsnt__Subscribe *wsnt__Subscribe, _wsnt__SubscribeResponse *wsnt__SubscribeResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; NotificationConsumerBindingProxy* subcriberProxy = new NotificationConsumerBindingProxy(wsnt__Subscribe->ConsumerReference.Address); _wsnt__Notify notification; notification.NotificationMessage.push_back(soap_new_wsnt__NotificationMessageHolderType(subcriberProxy->soap)); notification.NotificationMessage.back()->Message.__any = soap_dom_element(subcriberProxy->soap, (char*)NULL, (char*)NULL, (char*)"subscribed"); if (subcriberProxy->Notify(¬ification) != SOAP_OK) { subcriberProxy->soap_stream_fault(std::cerr); } ctx->m_subscriber.push_back(subcriberProxy); std::cout << __FUNCTION__ << " nb subscriber:" << ctx->m_subscriber.size() << std::endl; std::ostringstream os; os << "http://" << ctx->getServerIpFromClientIp(htonl(this->soap->ip)) << ":" << ctx->m_port; std::string url(os.str()); time_t sec = time(NULL); wsnt__SubscribeResponse->SubscriptionReference.Address = strcpy((char*)soap_malloc(this->soap, url.size()+1), url.c_str()); wsnt__SubscribeResponse->CurrentTime = soap_new_ptr(this->soap,sec); wsnt__SubscribeResponse->TerminationTime = soap_new_ptr(this->soap,sec+3600); return SOAP_OK; }
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::GetMoveOptions(_timg__GetMoveOptions *timg__GetMoveOptions, _timg__GetMoveOptionsResponse *timg__GetMoveOptionsResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; auto it = ctx->m_devices.find(timg__GetMoveOptions->VideoSourceToken); if (it != ctx->m_devices.end()) { timg__GetMoveOptionsResponse->MoveOptions = soap_new_tt__MoveOptions20(this->soap); std::pair<int,int> absRange = ctx->getCtrlRange(it->first, V4L2_CID_FOCUS_ABSOLUTE); if (errno == 0) { timg__GetMoveOptionsResponse->MoveOptions->Absolute = soap_new_tt__AbsoluteFocusOptions(this->soap); float min = absRange.first; float max = absRange.second; timg__GetMoveOptionsResponse->MoveOptions->Absolute->Position = soap_new_req_tt__FloatRange(this->soap, min, max); } std::pair<int,int> relRange = ctx->getCtrlRange(it->first, V4L2_CID_FOCUS_RELATIVE); if (errno == 0) { timg__GetMoveOptionsResponse->MoveOptions->Relative = soap_new_tt__RelativeFocusOptions20(this->soap); float min = relRange.first; float max = relRange.second; timg__GetMoveOptionsResponse->MoveOptions->Relative->Distance = soap_new_req_tt__FloatRange(this->soap, min, max); } } return SOAP_OK; }
int RecordingBindingService::GetServiceCapabilities(_trc__GetServiceCapabilities *trc__GetServiceCapabilities, _trc__GetServiceCapabilitiesResponse *trc__GetServiceCapabilitiesResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; trc__GetServiceCapabilitiesResponse->Capabilities = ctx->getRecordingServiceCapabilities(this->soap); return SOAP_OK; }
int DeviceBindingService::GetWsdlUrl(_tds__GetWsdlUrl *tds__GetWsdlUrl, _tds__GetWsdlUrlResponse *tds__GetWsdlUrlResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; std::ostringstream os; os << "http://" << ctx->getServerIpFromClientIp(htonl(this->soap->ip)) << ":" << ctx->m_port; tds__GetWsdlUrlResponse->WsdlUrl = os.str(); return SOAP_OK; }
int MediaBindingService::GetVideoSourceConfigurations(_trt__GetVideoSourceConfigurations *trt__GetVideoSourceConfigurations, _trt__GetVideoSourceConfigurationsResponse *trt__GetVideoSourceConfigurationsResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; for (auto it: ctx->m_devices) { trt__GetVideoSourceConfigurationsResponse->Configurations.push_back(ctx->getVideoSourceCfg(this->soap, it.first)); } return SOAP_OK; }
int MediaBindingService::GetCompatibleVideoSourceConfigurations(_trt__GetCompatibleVideoSourceConfigurations *trt__GetCompatibleVideoSourceConfigurations, _trt__GetCompatibleVideoSourceConfigurationsResponse *trt__GetCompatibleVideoSourceConfigurationsResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; auto it = ctx->m_devices.find(trt__GetCompatibleVideoSourceConfigurations->ProfileToken); if (it != ctx->m_devices.end()) { trt__GetCompatibleVideoSourceConfigurationsResponse->Configurations.push_back(ctx->getVideoSourceCfg(this->soap, it->first)); } return SOAP_OK; }
int RecordingBindingService::GetRecordingConfiguration(_trc__GetRecordingConfiguration *trc__GetRecordingConfiguration, _trc__GetRecordingConfigurationResponse *trc__GetRecordingConfigurationResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; auto it = ctx->m_devices.find(trc__GetRecordingConfiguration->RecordingToken); if (it != ctx->m_devices.end()) { trc__GetRecordingConfigurationResponse->RecordingConfiguration = ctx->getRecordingCfg(this->soap); } 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 MediaBindingService::GetProfiles(_trt__GetProfiles *trt__GetProfiles, _trt__GetProfilesResponse *trt__GetProfilesResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; for (auto it: ctx->m_devices) { trt__GetProfilesResponse->Profiles.push_back(ctx->getProfile(this->soap, it.first)); } return SOAP_OK; }
int MediaBindingService::GetVideoEncoderConfiguration(_trt__GetVideoEncoderConfiguration *trt__GetVideoEncoderConfiguration, _trt__GetVideoEncoderConfigurationResponse *trt__GetVideoEncoderConfigurationResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; auto it = ctx->m_devices.find(trt__GetVideoEncoderConfiguration->ConfigurationToken); if (it != ctx->m_devices.end()) { trt__GetVideoEncoderConfigurationResponse->Configuration = ctx->getVideoEncoderCfg(this->soap, it->first); } return SOAP_OK; }
int RecordingBindingService::GetRecordingJobs(_trc__GetRecordingJobs *trc__GetRecordingJobs, _trc__GetRecordingJobsResponse *trc__GetRecordingJobsResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; for (auto it: ctx->m_devices) { trc__GetRecordingJobsResponse->JobItem.push_back(soap_new_tt__GetRecordingJobsResponseItem(this->soap)); trc__GetRecordingJobsResponse->JobItem.back()->JobToken = it.first; trc__GetRecordingJobsResponse->JobItem.back()->JobConfiguration = ctx->getRecordingJobConfiguration(this->soap, it.first); } return SOAP_OK; }
int MediaBindingService::GetVideoSourceConfigurationOptions(_trt__GetVideoSourceConfigurationOptions *trt__GetVideoSourceConfigurationOptions, _trt__GetVideoSourceConfigurationOptionsResponse *trt__GetVideoSourceConfigurationOptionsResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; if (trt__GetVideoSourceConfigurationOptions->ConfigurationToken) { auto it = ctx->m_devices.find(trt__GetVideoSourceConfigurationOptions->ConfigurationToken->c_str()); if (it != ctx->m_devices.end()) { trt__GetVideoSourceConfigurationOptionsResponse->Options = ctx->getVideoSourceCfgOptions(soap, it->first); } } return SOAP_OK; }
int EventBindingService::CreatePullPointSubscription(_tev__CreatePullPointSubscription *tev__CreatePullPointSubscription, _tev__CreatePullPointSubscriptionResponse *tev__CreatePullPointSubscriptionResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; std::ostringstream os; os << "http://" << ctx->getServerIpFromClientIp(htonl(this->soap->ip)) << ":" << ctx->m_port; std::string url(os.str()); time_t sec = time(NULL); tev__CreatePullPointSubscriptionResponse->SubscriptionReference.Address = strcpy((char*)soap_malloc(this->soap, url.size()+1), url.c_str()); tev__CreatePullPointSubscriptionResponse->wsnt__CurrentTime = sec; tev__CreatePullPointSubscriptionResponse->wsnt__TerminationTime = sec+3600; return SOAP_OK; }
int dbtestsMain(int argc, char** argv, char** envp) { ::mongo::setTestCommandsEnabled(true); ::mongo::setupSynchronousSignalHandlers(); mongo::dbtests::initWireSpec(); setGlobalServiceContext(createServiceContext()); mongo::runGlobalInitializersOrDie(argc, argv, envp, getGlobalServiceContext()); serverGlobalParams.featureCompatibility.setVersion( ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40); repl::ReplSettings replSettings; replSettings.setOplogSizeBytes(10 * 1024 * 1024); ServiceContext* service = getGlobalServiceContext(); auto logicalClock = stdx::make_unique<LogicalClock>(service); LogicalClock::set(service, std::move(logicalClock)); auto fastClock = stdx::make_unique<ClockSourceMock>(); // Timestamps are split into two 32-bit integers, seconds and "increments". Currently (but // maybe not for eternity), a Timestamp with a value of `0` seconds is always considered // "null" by `Timestamp::isNull`, regardless of its increment value. Ticking the // `ClockSourceMock` only bumps the "increment" counter, thus by default, generating "null" // timestamps. Bumping by one second here avoids any accidental interpretations. fastClock->advance(Seconds(1)); service->setFastClockSource(std::move(fastClock)); auto preciseClock = stdx::make_unique<ClockSourceMock>(); // See above. preciseClock->advance(Seconds(1)); service->setPreciseClockSource(std::move(preciseClock)); repl::ReplicationCoordinator::set( service, std::unique_ptr<repl::ReplicationCoordinator>( new repl::ReplicationCoordinatorMock(service, replSettings))); repl::ReplicationCoordinator::get(getGlobalServiceContext()) ->setFollowerMode(repl::MemberState::RS_PRIMARY) .ignore(); auto storageMock = stdx::make_unique<repl::StorageInterfaceMock>(); repl::DropPendingCollectionReaper::set( service, stdx::make_unique<repl::DropPendingCollectionReaper>(storageMock.get())); getGlobalAuthorizationManager()->setAuthEnabled(false); ScriptEngine::setup(); StartupTest::runTests(); return mongo::dbtests::runDbTests(argc, argv); }
void Client::initThread(const char* desc, ServiceContext* service, transport::SessionHandle session) { invariant(currentClient.getMake()->get() == nullptr); std::string fullDesc; if (session) { fullDesc = str::stream() << desc << session->id(); } else { fullDesc = desc; } setThreadName(fullDesc.c_str()); // Create the client obj, attach to thread *currentClient.get() = service->makeClient(fullDesc, std::move(session)); }
int RecordingBindingService::GetRecordings(_trc__GetRecordings *trc__GetRecordings, _trc__GetRecordingsResponse *trc__GetRecordingsResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; trc__GetRecordingsResponse->RecordingItem.push_back(soap_new_tt__GetRecordingsResponseItem(this->soap)); for (auto it: ctx->m_devices) { trc__GetRecordingsResponse->RecordingItem.back()->RecordingToken = it.first; trc__GetRecordingsResponse->RecordingItem.back()->Configuration = ctx->getRecordingCfg(this->soap); trc__GetRecordingsResponse->RecordingItem.back()->Tracks = soap_new_tt__GetTracksResponseList(soap); trc__GetRecordingsResponse->RecordingItem.back()->Tracks->Track.push_back(soap_new_tt__GetTracksResponseItem(soap)); trc__GetRecordingsResponse->RecordingItem.back()->Tracks->Track.back()->TrackToken = "video"; trc__GetRecordingsResponse->RecordingItem.back()->Tracks->Track.back()->Configuration = ctx->getTracksCfg(this->soap); } return SOAP_OK; }
int MediaBindingService::GetProfile(_trt__GetProfile *trt__GetProfile, _trt__GetProfileResponse *trt__GetProfileResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; int ret = SOAP_FAULT; std::cout << __FUNCTION__ << " search for profile:" << trt__GetProfile->ProfileToken << std::endl; auto it = ctx->m_devices.find(trt__GetProfile->ProfileToken); if (it != ctx->m_devices.end()) { trt__GetProfileResponse->Profile = ctx->getProfile(this->soap, it->first); ret = SOAP_OK; } return ret; }
int MediaBindingService::GetVideoSources(_trt__GetVideoSources *trt__GetVideoSources, _trt__GetVideoSourcesResponse *trt__GetVideoSourcesResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; int width; int height; int format; for (auto it: ctx->m_devices) { if (ctx->getFormat(it.first.c_str(), width, height, format)) { trt__GetVideoSourcesResponse->VideoSources.push_back(soap_new_tt__VideoSource(this->soap)); trt__GetVideoSourcesResponse->VideoSources.back()->token = it.first; trt__GetVideoSourcesResponse->VideoSources.back()->Resolution = soap_new_req_tt__VideoResolution(this->soap, width, height); trt__GetVideoSourcesResponse->VideoSources.back()->Imaging = soap_new_tt__ImagingSettings(this->soap); } } return SOAP_OK; }
int ImagingBindingService::GetOptions(_timg__GetOptions *timg__GetOptions, _timg__GetOptionsResponse *timg__GetOptionsResponse) { int ret = SOAP_FAULT; std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; auto it = ctx->m_devices.find(timg__GetOptions->VideoSourceToken); if (it != ctx->m_devices.end()) { timg__GetOptionsResponse->ImagingOptions = soap_new_tt__ImagingOptions20(this->soap); std::pair<int,int> brightnessRange = ctx->getCtrlRange(it->first, V4L2_CID_BRIGHTNESS); timg__GetOptionsResponse->ImagingOptions->Brightness = soap_new_req_tt__FloatRange(this->soap, brightnessRange.first, brightnessRange.second); std::pair<int,int> contrastRange = ctx->getCtrlRange(it->first, V4L2_CID_CONTRAST); timg__GetOptionsResponse->ImagingOptions->Contrast = soap_new_req_tt__FloatRange(this->soap, contrastRange.first, contrastRange.second); std::pair<int,int> saturationRange = ctx->getCtrlRange(it->first, V4L2_CID_SATURATION); timg__GetOptionsResponse->ImagingOptions->ColorSaturation = soap_new_req_tt__FloatRange(this->soap, saturationRange.first, saturationRange.second); std::pair<int,int> sharpnessRange = ctx->getCtrlRange(it->first, V4L2_CID_SHARPNESS); timg__GetOptionsResponse->ImagingOptions->Sharpness = soap_new_req_tt__FloatRange(this->soap, sharpnessRange.first, sharpnessRange.second); timg__GetOptionsResponse->ImagingOptions->Exposure = soap_new_tt__ExposureOptions20(this->soap); timg__GetOptionsResponse->ImagingOptions->Exposure->Mode.push_back(tt__ExposureMode__AUTO); timg__GetOptionsResponse->ImagingOptions->Exposure->Mode.push_back(tt__ExposureMode__MANUAL); timg__GetOptionsResponse->ImagingOptions->WhiteBalance = soap_new_tt__WhiteBalanceOptions20(this->soap); timg__GetOptionsResponse->ImagingOptions->WhiteBalance->Mode.push_back(tt__WhiteBalanceMode__AUTO); timg__GetOptionsResponse->ImagingOptions->WhiteBalance->Mode.push_back(tt__WhiteBalanceMode__MANUAL); timg__GetOptionsResponse->ImagingOptions->Focus = soap_new_tt__FocusOptions20(this->soap); timg__GetOptionsResponse->ImagingOptions->Focus->AutoFocusModes.push_back(tt__AutoFocusMode__AUTO); timg__GetOptionsResponse->ImagingOptions->Focus->AutoFocusModes.push_back(tt__AutoFocusMode__MANUAL); ret = SOAP_OK; } return ret; }
int ImagingBindingService::GetStatus(_timg__GetStatus *timg__GetStatus, _timg__GetStatusResponse *timg__GetStatusResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; auto it = ctx->m_devices.find(timg__GetStatus->VideoSourceToken); if (it != ctx->m_devices.end()) { timg__GetStatusResponse->Status = soap_new_tt__ImagingStatus20(this->soap); timg__GetStatusResponse->Status->FocusStatus20 = soap_new_tt__FocusStatus20(this->soap); timg__GetStatusResponse->Status->FocusStatus20->Position = ctx->getCtrlValue(it->first, V4L2_CID_FOCUS_ABSOLUTE); int status = ctx->getCtrlValue(it->first,V4L2_CID_AUTO_FOCUS_STATUS); tt__MoveStatus moveStatus = tt__MoveStatus__UNKNOWN; switch (status) { case V4L2_AUTO_FOCUS_STATUS_IDLE: moveStatus = tt__MoveStatus__IDLE ; break; case V4L2_AUTO_FOCUS_STATUS_BUSY: moveStatus = tt__MoveStatus__MOVING; break; } timg__GetStatusResponse->Status->FocusStatus20->MoveStatus = moveStatus; } return SOAP_OK; }
int DeviceBindingService::GetServices(_tds__GetServices *tds__GetServices, _tds__GetServicesResponse *tds__GetServicesResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; std::ostringstream os; os << "http://" << ctx->getServerIpFromClientIp(htonl(this->soap->ip)) << ":" << ctx->m_port; std::string url(os.str()); tds__GetServicesResponse->Service.push_back(soap_new_tds__Service(this->soap)); tds__GetServicesResponse->Service.back()->Namespace = "http://www.onvif.org/ver10/device/wsdl"; tds__GetServicesResponse->Service.back()->XAddr = url; tds__GetServicesResponse->Service.back()->Version = soap_new_req_tt__OnvifVersion(this->soap,2,5); if (tds__GetServices->IncludeCapability) { tds__GetServicesResponse->Service.back()->Capabilities = soap_new__tds__Service_Capabilities(this->soap); tds__DeviceServiceCapabilities *capabilities = ctx->getDeviceServiceCapabilities(this->soap); tds__GetServicesResponse->Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "tds:Capabilities", capabilities, capabilities->soap_type()); } tds__GetServicesResponse->Service.push_back(soap_new_tds__Service(this->soap)); tds__GetServicesResponse->Service.back()->Namespace = "http://www.onvif.org/ver10/media/wsdl"; tds__GetServicesResponse->Service.back()->XAddr = url; tds__GetServicesResponse->Service.back()->Version = soap_new_req_tt__OnvifVersion(this->soap,2,6); if (tds__GetServices->IncludeCapability) { tds__GetServicesResponse->Service.back()->Capabilities = soap_new__tds__Service_Capabilities(this->soap); trt__Capabilities *capabilities = ctx->getMediaServiceCapabilities(this->soap); tds__GetServicesResponse->Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "trt:Capabilities", capabilities, capabilities->soap_type()); } tds__GetServicesResponse->Service.push_back(soap_new_tds__Service(this->soap)); tds__GetServicesResponse->Service.back()->Namespace = "http://www.onvif.org/ver20/imaging/wsdl"; tds__GetServicesResponse->Service.back()->XAddr = url; tds__GetServicesResponse->Service.back()->Version = soap_new_req_tt__OnvifVersion(this->soap,2,5); if (tds__GetServices->IncludeCapability) { tds__GetServicesResponse->Service.back()->Capabilities = soap_new__tds__Service_Capabilities(this->soap); timg__Capabilities *capabilities = ctx->getImagingServiceCapabilities(this->soap); tds__GetServicesResponse->Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "timg:Capabilities", capabilities, capabilities->soap_type()); } tds__GetServicesResponse->Service.push_back(soap_new_tds__Service(this->soap)); tds__GetServicesResponse->Service.back()->Namespace = "http://www.onvif.org/ver10/events/wsdl"; tds__GetServicesResponse->Service.back()->XAddr = url; tds__GetServicesResponse->Service.back()->Version = soap_new_req_tt__OnvifVersion(this->soap,2,6); if (tds__GetServices->IncludeCapability) { tds__GetServicesResponse->Service.back()->Capabilities = soap_new__tds__Service_Capabilities(this->soap); tev__Capabilities *capabilities = ctx->getEventServiceCapabilities(this->soap); tds__GetServicesResponse->Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "tev:Capabilities", capabilities, capabilities->soap_type()); } tds__GetServicesResponse->Service.push_back(soap_new_tds__Service(this->soap)); tds__GetServicesResponse->Service.back()->Namespace = "http://www.onvif.org/ver10/recording/wsdl"; tds__GetServicesResponse->Service.back()->XAddr = url; tds__GetServicesResponse->Service.back()->Version = soap_new_req_tt__OnvifVersion(this->soap,2,5); if (tds__GetServices->IncludeCapability) { tds__GetServicesResponse->Service.back()->Capabilities = soap_new__tds__Service_Capabilities(this->soap); trc__Capabilities *capabilities = ctx->getRecordingServiceCapabilities(this->soap); tds__GetServicesResponse->Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "trc:Capabilities", capabilities, capabilities->soap_type()); } tds__GetServicesResponse->Service.push_back(soap_new_tds__Service(this->soap)); tds__GetServicesResponse->Service.back()->Namespace = "http://www.onvif.org/ver10/replay/wsdl"; tds__GetServicesResponse->Service.back()->XAddr = url; tds__GetServicesResponse->Service.back()->Version = soap_new_req_tt__OnvifVersion(this->soap,2,2); if (tds__GetServices->IncludeCapability) { tds__GetServicesResponse->Service.back()->Capabilities = soap_new__tds__Service_Capabilities(this->soap); trp__Capabilities *capabilities = ctx->getReplayServiceCapabilities(this->soap); tds__GetServicesResponse->Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "trp:Capabilities", capabilities, capabilities->soap_type()); } tds__GetServicesResponse->Service.push_back(soap_new_tds__Service(this->soap)); tds__GetServicesResponse->Service.back()->Namespace = "http://www.onvif.org/ver10/search/wsdl"; tds__GetServicesResponse->Service.back()->XAddr = url; tds__GetServicesResponse->Service.back()->Version = soap_new_req_tt__OnvifVersion(this->soap,2,4); if (tds__GetServices->IncludeCapability) { tds__GetServicesResponse->Service.back()->Capabilities = soap_new__tds__Service_Capabilities(this->soap); tse__Capabilities *capabilities = ctx->getSearchServiceCapabilities(this->soap); tds__GetServicesResponse->Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "trs:Capabilities", capabilities, capabilities->soap_type()); } tds__GetServicesResponse->Service.push_back(soap_new_tds__Service(this->soap)); tds__GetServicesResponse->Service.back()->Namespace = "http://www.onvif.org/ver10/display/wsdl"; tds__GetServicesResponse->Service.back()->XAddr = url; tds__GetServicesResponse->Service.back()->Version = soap_new_req_tt__OnvifVersion(this->soap,2,1); if (tds__GetServices->IncludeCapability) { tds__GetServicesResponse->Service.back()->Capabilities = soap_new__tds__Service_Capabilities(this->soap); tls__Capabilities *capabilities = ctx->getDisplayServiceCapabilities(this->soap); tds__GetServicesResponse->Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "tls:Capabilities", capabilities, capabilities->soap_type()); } tds__GetServicesResponse->Service.push_back(soap_new_tds__Service(this->soap)); tds__GetServicesResponse->Service.back()->Namespace = "http://www.onvif.org/ver10/deviceIO/wsdl"; tds__GetServicesResponse->Service.back()->XAddr = url; tds__GetServicesResponse->Service.back()->Version = soap_new_req_tt__OnvifVersion(this->soap,2,6); if (tds__GetServices->IncludeCapability) { tds__GetServicesResponse->Service.back()->Capabilities = soap_new__tds__Service_Capabilities(this->soap); tmd__Capabilities *capabilities = ctx->getDeviceIOServiceCapabilities(this->soap); tds__GetServicesResponse->Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "tmd:Capabilities", capabilities, capabilities->soap_type()); } tds__GetServicesResponse->Service.push_back(soap_new_tds__Service(this->soap)); tds__GetServicesResponse->Service.back()->Namespace = "http://www.onvif.org/ver10/receiver/wsdl"; tds__GetServicesResponse->Service.back()->XAddr = url; tds__GetServicesResponse->Service.back()->Version = soap_new_req_tt__OnvifVersion(this->soap,2,1); if (tds__GetServices->IncludeCapability) { tds__GetServicesResponse->Service.back()->Capabilities = soap_new__tds__Service_Capabilities(this->soap); trv__Capabilities *capabilities = ctx->getReceiverServiceCapabilities(this->soap); tds__GetServicesResponse->Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "trv:Capabilities", capabilities, capabilities->soap_type()); } return SOAP_OK; }
int ImagingBindingService::GetImagingSettings(_timg__GetImagingSettings *timg__GetImagingSettings, _timg__GetImagingSettingsResponse *timg__GetImagingSettingsResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; auto it = ctx->m_devices.find(timg__GetImagingSettings->VideoSourceToken); if (it != ctx->m_devices.end()) { timg__GetImagingSettingsResponse->ImagingSettings = soap_new_tt__ImagingSettings20(this->soap); float brightness = ctx->getCtrlValue(it->first, V4L2_CID_BRIGHTNESS); if ( errno == 0 ) { timg__GetImagingSettingsResponse->ImagingSettings->Brightness = soap_new_ptr(this->soap, brightness); } float contrast = ctx->getCtrlValue(it->first, V4L2_CID_CONTRAST); if ( errno == 0 ) { timg__GetImagingSettingsResponse->ImagingSettings->Contrast = soap_new_ptr(this->soap, contrast); } float saturation = ctx->getCtrlValue(it->first, V4L2_CID_SATURATION); if ( errno == 0 ) { timg__GetImagingSettingsResponse->ImagingSettings->ColorSaturation = soap_new_ptr(this->soap, saturation); } float sharpness = ctx->getCtrlValue(it->first, V4L2_CID_SHARPNESS); if ( errno == 0 ) { timg__GetImagingSettingsResponse->ImagingSettings->Sharpness = soap_new_ptr(this->soap, sharpness); } int backlightCompensation = ctx->getCtrlValue(it->first, V4L2_CID_BACKLIGHT_COMPENSATION); if ( errno == 0 ) { timg__GetImagingSettingsResponse->ImagingSettings->BacklightCompensation = soap_new_tt__BacklightCompensation20(this->soap); timg__GetImagingSettingsResponse->ImagingSettings->BacklightCompensation->Mode = backlightCompensation ? tt__BacklightCompensationMode__ON : tt__BacklightCompensationMode__OFF; } int wideDynamicRange = ctx->getCtrlValue(it->first, V4L2_CID_WIDE_DYNAMIC_RANGE); if ( errno == 0 ) { timg__GetImagingSettingsResponse->ImagingSettings->WideDynamicRange = soap_new_tt__WideDynamicRange20(this->soap); timg__GetImagingSettingsResponse->ImagingSettings->WideDynamicRange->Mode = wideDynamicRange ? tt__WideDynamicMode__ON : tt__WideDynamicMode__OFF; } int exposure = ctx->getCtrlValue(it->first, V4L2_CID_EXPOSURE_AUTO); if ( errno == 0 ) { timg__GetImagingSettingsResponse->ImagingSettings->Exposure = soap_new_tt__Exposure20(this->soap); timg__GetImagingSettingsResponse->ImagingSettings->Exposure->Mode = exposure ? tt__ExposureMode__AUTO : tt__ExposureMode__MANUAL; float exposureTime = ctx->getCtrlValue(it->first, V4L2_CID_EXPOSURE_ABSOLUTE); timg__GetImagingSettingsResponse->ImagingSettings->Exposure->ExposureTime = soap_new_ptr(this->soap, exposureTime); } int autoWhiteBalance = ctx->getCtrlValue(it->first, V4L2_CID_AUTO_WHITE_BALANCE); if ( errno == 0 ) { timg__GetImagingSettingsResponse->ImagingSettings->WhiteBalance = soap_new_tt__WhiteBalance20(this->soap); timg__GetImagingSettingsResponse->ImagingSettings->WhiteBalance->Mode = autoWhiteBalance ? tt__WhiteBalanceMode__AUTO : tt__WhiteBalanceMode__MANUAL; float redBalance = ctx->getCtrlValue(it->first, V4L2_CID_RED_BALANCE); timg__GetImagingSettingsResponse->ImagingSettings->WhiteBalance->CrGain = soap_new_ptr(this->soap, redBalance); float blueBalance = ctx->getCtrlValue(it->first, V4L2_CID_BLUE_BALANCE); timg__GetImagingSettingsResponse->ImagingSettings->WhiteBalance->CrGain = soap_new_ptr(this->soap, blueBalance); } int autofocusMode = ctx->getCtrlValue(it->first, V4L2_CID_FOCUS_AUTO); if ( errno == 0 ) { timg__GetImagingSettingsResponse->ImagingSettings->Focus = soap_new_tt__FocusConfiguration20(this->soap); timg__GetImagingSettingsResponse->ImagingSettings->Focus->AutoFocusMode = autofocusMode ? tt__AutoFocusMode__AUTO : tt__AutoFocusMode__MANUAL; } } return SOAP_OK; }
void Client::destroy() { invariant(currentClient.get()); invariant(currentClient.get()->get()); currentClient.reset(nullptr); }
void ReplicationCoordinatorExternalStateImpl::killAllUserOperations(OperationContext* txn) { ServiceContext* environment = txn->getServiceContext(); environment->killAllUserOperations(txn, ErrorCodes::InterruptedDueToReplStateChange); }
void Client::initThreadIfNotAlready(const char* desc) { if (currentClient.getMake()->get()) return; initThread(desc); }
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; }
void ReplicationCoordinatorExternalStateImpl::killAllUserOperations(OperationContext* txn) { ServiceContext* environment = getGlobalServiceContext(); environment->killAllUserOperations(txn); }
int DeviceBindingService::GetCapabilities(_tds__GetCapabilities *tds__GetCapabilities, _tds__GetCapabilitiesResponse *tds__GetCapabilitiesResponse) { std::cout << __FUNCTION__ << std::endl; ServiceContext* ctx = (ServiceContext*)this->soap->user; std::ostringstream os; os << "http://" << ctx->getServerIpFromClientIp(htonl(this->soap->ip)) << ":" << ctx->m_port; std::string url(os.str()); tds__GetCapabilitiesResponse->Capabilities = soap_new_tt__Capabilities(this->soap); std::vector<tt__CapabilityCategory>& categories(tds__GetCapabilities->Category); if (categories.empty()) { categories.push_back(tt__CapabilityCategory__All); } for (tt__CapabilityCategory category : categories) { if (!tds__GetCapabilitiesResponse->Capabilities->Device && ( (category == tt__CapabilityCategory__All) || (category == tt__CapabilityCategory__Device) ) ) { tds__GetCapabilitiesResponse->Capabilities->Device = soap_new_tt__DeviceCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Device->XAddr = url; tds__GetCapabilitiesResponse->Capabilities->Device->System = soap_new_tt__SystemCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Device->System->SupportedVersions.push_back(soap_new_req_tt__OnvifVersion(this->soap,2,0)); tds__GetCapabilitiesResponse->Capabilities->Device->Network = soap_new_tt__NetworkCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Device->Security = soap_new_tt__SecurityCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Device->IO = soap_new_tt__IOCapabilities(this->soap); } if (!tds__GetCapabilitiesResponse->Capabilities->Media && ( (category == tt__CapabilityCategory__All) || (category == tt__CapabilityCategory__Media) ) ) { tds__GetCapabilitiesResponse->Capabilities->Media = soap_new_tt__MediaCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Media->XAddr = url; tds__GetCapabilitiesResponse->Capabilities->Media->StreamingCapabilities = soap_new_tt__RealTimeStreamingCapabilities(this->soap); } if (!tds__GetCapabilitiesResponse->Capabilities->Imaging && ( (category == tt__CapabilityCategory__All) || (category == tt__CapabilityCategory__Imaging) ) ) { tds__GetCapabilitiesResponse->Capabilities->Imaging = soap_new_tt__ImagingCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Imaging->XAddr = url; } if (!tds__GetCapabilitiesResponse->Capabilities->Events && ( (category == tt__CapabilityCategory__All) || (category == tt__CapabilityCategory__Events) ) ) { tds__GetCapabilitiesResponse->Capabilities->Events = soap_new_tt__EventCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Events->XAddr = url; } if (!tds__GetCapabilitiesResponse->Capabilities->Extension && (category == tt__CapabilityCategory__All) ) { tds__GetCapabilitiesResponse->Capabilities->Extension = soap_new_tt__CapabilitiesExtension(this->soap); tds__GetCapabilitiesResponse->Capabilities->Extension->Recording = soap_new_tt__RecordingCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Extension->Recording->XAddr = url; tds__GetCapabilitiesResponse->Capabilities->Extension->Recording->MediaProfileSource = true; tds__GetCapabilitiesResponse->Capabilities->Extension->Recording->ReceiverSource = true; tds__GetCapabilitiesResponse->Capabilities->Extension->Replay = soap_new_tt__ReplayCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Extension->Replay->XAddr = url; tds__GetCapabilitiesResponse->Capabilities->Extension->Receiver = soap_new_tt__ReceiverCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Extension->Receiver->XAddr = url; tds__GetCapabilitiesResponse->Capabilities->Extension->Search = soap_new_tt__SearchCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Extension->Search->XAddr = url; tds__GetCapabilitiesResponse->Capabilities->Extension->Display = soap_new_tt__DisplayCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Extension->Display->XAddr = url; tds__GetCapabilitiesResponse->Capabilities->Extension->Display->FixedLayout = true; tds__GetCapabilitiesResponse->Capabilities->Extension->DeviceIO = soap_new_tt__DeviceIOCapabilities(this->soap); tds__GetCapabilitiesResponse->Capabilities->Extension->DeviceIO->XAddr = url; tds__GetCapabilitiesResponse->Capabilities->Extension->DeviceIO->VideoSources = ctx->m_devices.size(); tds__GetCapabilitiesResponse->Capabilities->Extension->DeviceIO->VideoOutputs = 1; } } return SOAP_OK; }