void FirstConfig()
{
wxFileConfig OptionIni( wxEmptyString, wxEmptyString,  _T("option.ini"), wxEmptyString, 
                wxCONFIG_USE_LOCAL_FILE|wxCONFIG_USE_NO_ESCAPE_CHARACTERS, *wxConvCurrent ) ;
    OptionIni.Write(_T("SuperUser/UserName"), _T("Admin"));
    OptionIni.Write(_T("SuperUser/Password"), wxEmptyString);
    OptionIni.Write(_T("AutoWks/AddType"), 2);
    OptionIni.Write(_T("AutoWks/PreName"), _T("WKS"));
    OptionIni.Write(_T("AutoWks/NameCode"), 3);
	OptionIni.Write(_T("AutoWks/Template"), wxEmptyString ) ;

	wxArrayString ServerIpList;
    GetIpList(ServerIpList);

    wxString BootCard = wxEmptyString;
    if (ServerIpList.GetCount() > 0) BootCard = ServerIpList[0];
    wxString BootCardList = wxEmptyString;
    for(unsigned int i=0;i<ServerIpList.GetCount();i++)
    {
        if(i!=0)BootCardList = BootCardList + _T("|");
        BootCardList = BootCardList + ServerIpList[i];
    }
    OptionIni.Write(_T("AllocIP/DynamicIP"), false);
    OptionIni.Write(_T("AllocIP/IpList"), BootCardList);
   // OptionIni.Write(_T("AllocIP/StartIP"), GetAltIp(BootCard, _T("11")));
    //OptionIni.Write(_T("AllocIP/StopIP"), GetAltIp(BootCard, _T("254")));
    OptionIni.Write(_T("Other/LogError"), false);

    OptionIni.Write(_T("Other/ManPass"), _T(""));
    OptionIni.Write(_T("Other/SuperPass"), _T(""));
    OptionIni.Flush();
}
Exemple #2
0
SOAP_FMAC5 int SOAP_FMAC6 __wsdd__Probe(struct soap* soap, struct wsdd__ProbeType *wsdd__Probe)
{
	fprintf(stderr, "%s: calling ...\n", __func__);

	char _HwId[64]="urn:uuid:D149F919-4013-437E-B480-3707D96D27A4";

	int  interface_num = 0;
	char ip_list[512]={0};
	// Auto - get local ip address , return back this ip-address
	GetIpList( ip_list , interface_num);

	wsdd__ProbeMatchesType ProbeMatches;
	ProbeMatches.__sizeProbeMatch = interface_num;
	ProbeMatches.ProbeMatch = (struct wsdd__ProbeMatchType *)soap_malloc(soap, 
			sizeof(struct wsdd__ProbeMatchType)*interface_num);

	for(int i=0; i<interface_num; i++) {
		ProbeMatches.ProbeMatch[i].MetadataVersion = 1;
		// should be onvif device mgmt address
		ProbeMatches.ProbeMatch[i].XAddrs = (char *)soap_malloc(soap, sizeof(char) * INFO_LENGTH);
		sprintf(ProbeMatches.ProbeMatch[i].XAddrs, "http://%s:45678/", ip_list+i*20);
		// probe type
		ProbeMatches.ProbeMatch[i].Types = (char *)soap_malloc(soap, sizeof(char) * INFO_LENGTH);
		strcpy( ProbeMatches.ProbeMatch[i].Types , "tdn:NetworkVideoTransmitter" );
		// Scope
		ProbeMatches.ProbeMatch[i].Scopes = (struct wsdd__ScopesType*)soap_malloc(soap,sizeof(struct wsdd__ScopesType));
		ProbeMatches.ProbeMatch[i].Scopes->__item =(char *)soap_malloc(soap, 1024);
		memset(ProbeMatches.ProbeMatch[i].Scopes->__item,0,sizeof(ProbeMatches.ProbeMatch->Scopes->__item));	
		strcat(ProbeMatches.ProbeMatch[i].Scopes->__item, "onvif://www.onvif.org/type/NetworkVideoTransmitter");
		ProbeMatches.ProbeMatch[i].Scopes->MatchBy = NULL;

		//ws-discovery¹æ¶¨ Ϊ¿ÉÑ¡Ïî , ReferenceProperties
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.ReferenceProperties = 
			(struct wsa__ReferencePropertiesType*)soap_malloc(soap,sizeof(struct wsa__ReferencePropertiesType));
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.ReferenceProperties->__size = 0;
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.ReferenceProperties->__any = NULL;
		//ws-discovery¹æ¶¨ Ϊ¿ÉÑ¡Ïî , ReferenceParameters
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.ReferenceParameters = 
			(struct wsa__ReferenceParametersType*)soap_malloc(soap,sizeof(struct wsa__ReferenceParametersType));
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.ReferenceParameters->__size = 0;
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.ReferenceParameters->__any = NULL;
		//ws-discovery¹æ¶¨ Ϊ¿ÉÑ¡Ïî , PortType
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.PortType = 
			(char **)soap_malloc(soap, sizeof(char*) * SMALL_INFO_LENGTH);
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.PortType[0] = 
			(char *)soap_malloc(soap, sizeof(char) * SMALL_INFO_LENGTH);
		strcpy(ProbeMatches.ProbeMatch[i].wsa__EndpointReference.PortType[0], "ttl");
		//ws-discovery¹æ¶¨ Ϊ¿ÉÑ¡Ïî , ServiceName
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.ServiceName = 
			(struct wsa__ServiceNameType*)soap_malloc(soap,sizeof(struct wsa__ServiceNameType));
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.ServiceName->__item = NULL;
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.ServiceName->PortName = NULL;
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.ServiceName->__anyAttribute = NULL;
		//ws-discovery¹æ¶¨ Ϊ¿ÉÑ¡Ïî , __any
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.__any = 
			(char **)soap_malloc(soap, sizeof(char*) * SMALL_INFO_LENGTH);
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.__any[0] = 
			(char *)soap_malloc(soap, sizeof(char) * SMALL_INFO_LENGTH);
		strcpy(ProbeMatches.ProbeMatch[i].wsa__EndpointReference.__any[0], "Any");
		//ws-discovery¹æ¶¨ Ϊ¿ÉÑ¡Ïî , __anyAttribute
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.__anyAttribute = 
			(char *)soap_malloc(soap, sizeof(char) * SMALL_INFO_LENGTH);
		strcpy(ProbeMatches.ProbeMatch[i].wsa__EndpointReference.__anyAttribute, "Attribute");
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.__size = 0;
		//ws-discovery¹æ¶¨ Ϊ¿ÉÑ¡Ïî , Address
		ProbeMatches.ProbeMatch[i].wsa__EndpointReference.Address = (char *)soap_malloc(soap, sizeof(char) * INFO_LENGTH);
		strcpy(ProbeMatches.ProbeMatch[i].wsa__EndpointReference.Address, _HwId);
	}

	if( soap->header == 0 )	{
		soap->header = (::SOAP_ENV__Header*)soap_malloc(soap, sizeof(struct SOAP_ENV__Header));
		soap->header->wsa__RelatesTo = (::wsa__Relationship*)soap_malloc(soap, sizeof(struct wsa__Relationship));
		//it's here
		soap->header->wsa__MessageID =(char *)soap_malloc(soap, sizeof(char) * INFO_LENGTH);
		strcpy(soap->header->wsa__MessageID,_HwId+4);
		soap->header->wsa__RelatesTo->__item = soap->header->wsa__MessageID;
		soap->header->wsa__RelatesTo->RelationshipType = NULL;
		soap->header->wsa__RelatesTo->__anyAttribute = NULL;
	}
	else {
		soap->header->wsa__RelatesTo = (::wsa__Relationship*)soap_malloc(soap, sizeof(struct wsa__Relationship));
		//it's here
		soap->header->wsa__RelatesTo->__item = soap->header->wsa__MessageID;
		soap->header->wsa__RelatesTo->RelationshipType = NULL;
		soap->header->wsa__RelatesTo->__anyAttribute = NULL;

		soap->header->wsa__MessageID =(char *)soap_malloc(soap, sizeof(char) * INFO_LENGTH);
		strcpy(soap->header->wsa__MessageID,_HwId+4);
	}

	soap->header->wsa__From = 0;
	soap->header->wsa__ReplyTo = 0;
	soap->header->wsa__FaultTo = 0;
	soap->header->wsdd__AppSequence = 0;
	soap->header->wsa__To = (char*)soap_malloc(soap, 128);
	strcpy( soap->header->wsa__To , "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
	soap->header->wsa__Action = (char*)soap_malloc(soap, 128);
	strcpy(soap->header->wsa__Action , "http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches");

	/* send over current socket as HTTP OK response: */
	soap_send___wsdd__ProbeMatches(soap, "http://", NULL, &ProbeMatches);
	return SOAP_OK;
}