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(&notification) != 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;
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
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;
}
Esempio n. 4
0
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;
}
Esempio n. 5
0
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;
}