ONVIF GSOAP Development

From ago control wiki
Revision as of 20:46, 30 July 2013 by Hari (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Discovery without proxy

	/*
	struct soap *soap;
	struct wsdd__ProbeType probeType;
	struct __wsdd__ProbeMatches matches;
	struct wsdd__ScopesType scopesType;
	struct SOAP_ENV__Header header;

	char uuid_string[37];
	std::string tmpuuid = "urn:uuid:" +  generateUuid();
	printf("tmpuuid: %s\n", tmpuuid.c_str());
	strncpy (uuid_string, tmpuuid.c_str(), 37);

	soap = soap_new();
	if(soap==NULL) {
		printf("ERROR: Can't initalize soap\n");
		return -1;
	}

	soap_set_namespaces(soap, namespaces);
	soap->recv_timeout=5;

	// set header
	soap_default_SOAP_ENV__Header(soap, &header);
	header.wsa__MessageID = uuid_string;
	header.wsa__To = (char *)"urn:schemas-xmlsoap-org:ws:2005:04:discovery";
	header.wsa__Action = (char *)"http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe";
	soap->header = &header;

	soap_default_wsdd__ScopesType (soap, &scopesType);
	scopesType.__item = (char *)"onvif://www.onvif.org";
	soap_default_wsdd__ProbeType(soap, &probeType);
	probeType.Scopes = &scopesType;

	probeType.Types = (char *)"tdn:NetworkVideoTransmitter";

	if (soap_send___wsdd__Probe(soap, "soap.udp://239.255.255.250:3702/", NULL, &probeType) == -1) {
		printf("SOAP error occured: %d %s - %s\n", soap->error, *soap_faultcode(soap), *soap_faultstring(soap));
		return soap->error;
	} else {
		while (soap_recv___wsdd__ProbeMatches(soap, &matches) != -1) {
			printf("match size: %d\n",matches.wsdd__ProbeMatches->__sizeProbeMatch);
			printf("Endpoint Addr: %s\n",matches.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.Address);
			printf("Service Addr: %s\n", matches.wsdd__ProbeMatches->ProbeMatch->XAddrs);
			printf("Type: %s\n", matches.wsdd__ProbeMatches->ProbeMatch->Types);
			printf("Metadata Ver: %d\n",matches.wsdd__ProbeMatches->ProbeMatch->MetadataVersion);
			printf("Scopes Addr: %s\n", matches.wsdd__ProbeMatches->ProbeMatch->Scopes->__item);
		}
	} */
Personal tools