コード例 #1
0
ファイル: usbrestore.c プロジェクト: jamesyan84/zbase
int GetTotalFiles(char * filepath, int *totalFile, int *totalSize)
{
	int iRet = 0;
	int isDir = 0;
	char *size = NULL;
	char *files = NULL;
	
	IXML_Document   * Dom = NULL;
	
	if(!filepath || strlen(filepath) <= 0){

		iRet = -8;
		goto FuncOut;
	}
	if(!CheckFilePresent(filepath,&isDir))
	{
		iRet = -8;
		goto FuncOut;
	}
	if(!(Dom = ixmlLoadDocument(filepath)))
	{
		fprintf(stderr, "Load Document error\n");
		iRet = -9;
		goto FuncOut;
	}
	size = ixmlGetFirstDocumentItem(Dom,"TotalSize");
	files = ixmlGetFirstDocumentItem(Dom,"TotalFiles");
	
	if(size == NULL || files == NULL)
	{
		fprintf(stderr, "error get size and files\n");
		iRet = -10;
		goto FuncOut;
	}
	
	*totalFile = atoi(files);
	*totalSize = atoi(size);

FuncOut:
	if(size)
		free(size);
	if(files)
		free(files);
	if(Dom)
		free(Dom);
	
	return iRet;
}
コード例 #2
0
ファイル: inputctr.c プロジェクト: jamesyan84/zbase
KeyMode getState(char *message)
{

	IXML_Document *doc = NULL;
	char *state = NULL;

	if ((doc = ixmlParseBuffer(message)) == NULL)
		return -1;
	
	state = ixmlGetFirstDocumentItem(doc, "value");
	
	ixmlDocument_free(doc);
	if ((strcmp(state, "Powersaving") == 0) || (strcmp(state, "PartialActive") == 0))
	{
		printf("get state is POLICY\n");
		return POLICY;
	}
	else if (strcmp(state, "Active") == 0)
	{
		printf("get state is NORMAL\n");
		return NORMAL;
	}
	else
	{
		printf("get state is -1, failed!!!\n");
		return -1;
	}
}
コード例 #3
0
ファイル: OnlineDownload.c プロジェクト: jamesyan84/zbase
/**************************************************************************
* Function: prepareParameter
* Functionality: it will get the parameter from pipe and check it
* @IN : fd: the file description id for the pipe
*      enable: enable or disable flag
* @OUT: 0 success, else failed.
* Used description:
    The parameter is a xml, it will get from the pipe
* Date: 20080108
* Changed history:
* Date 		Who		Reason
* 20080108	kelly  		First  creation
***************************************************************************/
int prepareParameter(char *objID)
{
	IXML_Document	* rootDom = NULL;
	char buffer[1024] = {0};
	char str[1024] = {0}; 
	char *strVal = NULL;

	while(1)
	{
		fgets(str, 1024, stdin);
		str[strlen(str)-1]=0;
		strcat(buffer, str);
		if(strstr(buffer,EndFlag))
			break;
	}

	if(strlen(buffer) == 0)
		goto failed;

	if((rootDom = ixmlParseBuffer(buffer))  == NULL) 
		goto failed;

	strVal = ixmlGetFirstDocumentItem( rootDom,"objID" );
	strcpy(objID,strVal);
	free(strVal);
	
	if (rootDom)
		ixmlDocument_free(rootDom);

	return 0;

failed:
        fprintf(stderr,"Got a command parameter->%s", buffer);
	return -1;
}
コード例 #4
0
ファイル: zfs.c プロジェクト: jamesyan84/zbase
int createThumbnailPhoto(const char *path, char **attr2)
{
	IXML_Document 	*doc = NULL;
	char 			reqXML[2048] = {0};
	char 			thumbnail[1024] = {0};
	char 			respondBuf[2048] = {0};
	char 			*errNum = NULL;
	char 			*errMsg = NULL;
	int  			respondLen = 2048;

	getThumbnail(path, thumbnail);

	if(fileExists(thumbnail) == 1)
		remove(thumbnail);

	sprintf (reqXML, "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
			"<cmd>"
			"<InputLocation>%s</InputLocation>"
			"<OutputLocation>%s</OutputLocation>"
			"<Size>128</Size>"
			"</cmd>",
			path, thumbnail);
	
	if(processTCPReqRsp(ZAPP_ZSCALE_SOCKET, reqXML, strlen(reqXML), respondBuf, &respondLen, 3) == 0){
		if((doc = ixmlParseBuffer(respondBuf)) != NULL){
			errNum = ixmlGetFirstDocumentItem(doc, "err");
			if(strcmp(errNum, "0") != 0){
				errMsg = ixmlGetFirstDocumentItem(doc, "msg");
				ZError(DBG_MISC, "create thumbnail failed. errNum->%s, errMsg-> %s", errNum, errMsg);
				free(errMsg);
			}
			else
				*attr2 = strdup(thumbnail);

			free(errNum);
			ixmlDocument_free(doc);
		}
		else
			ZError(DBG_MISC, "zscale respond is NULL");
	}
	else
		ZError(DBG_MISC, "call zscale failed.");

	return 0;
}
コード例 #5
0
ファイル: zfs.c プロジェクト: jamesyan84/zbase
void getFileSupport(const char *filePath, PZFS pzfs)
{

	IXML_Document *doc = NULL;
	char *tmp = NULL;
	
	if ((doc = ixmlLoadDocument((char *)filePath)) == NULL)
	{
		ZError(DBG_MISC, "Can not load the file -> %s", filePath);
		exit (-1);
	}

	tmp = ixmlGetFirstDocumentItem(doc,"AudioSupported");
	if (strcmp(tmp, "yes") == 0)
		pzfs->audioConfig = 1;
	else
		pzfs->audioConfig = 0;
	if (tmp != NULL)
		free(tmp);

	tmp = ixmlGetFirstDocumentItem(doc,"VideoSupported");
	if (strcmp(tmp, "yes") == 0)
		pzfs->videoConfig= 1;
	else
		pzfs->videoConfig = 0;
	if (tmp != NULL)
		free(tmp);

	tmp = ixmlGetFirstDocumentItem(doc,"PhotoSupported");
	if (strcmp(tmp, "yes") == 0)
		pzfs->photoConfig= 1;
	else
		pzfs->photoConfig = 0;
	
	ixmlDocument_free(doc);
	if (tmp != NULL)
		free(tmp);
}
コード例 #6
0
ファイル: zqactionpreprocess.c プロジェクト: jamesyan84/zbase
int PreEjectDevice(struct Upnp_Action_Request *actEvent)
{
	char *devName = ixmlGetFirstDocumentItem(actEvent->ActionRequest, "dev");

#ifdef Z_CFG_USB_LIBRARY
	if (devName != NULL
			&& GetWorkStatus(WZScan) == WORK_RUNNING
			&& FindActiveDevice(devName, DEV_SCANING)) {
		ZInfo4(DBG_MISC, "find a usb device is scaning, stopping zscan");
		InternalRealStopPCMD(WZScan);
		SetSysState(FLAG_STOP_ZSCAN, 1);
	}
#endif

	free(devName);
	return TRUE;
}
コード例 #7
0
ファイル: zqstate.c プロジェクト: jamesyan84/zbase
int GetDMSState()
{
	IXML_Document *stateDoc = NULL;
	char *state = NULL;
	int dmsState = 0;

	stateDoc = CMDGetStateDMS();
	if(stateDoc == NULL) {
		goto errOut;
	}
	state = ixmlGetFirstDocumentItem(stateDoc, "value");
	if(state == NULL) {
		goto errOut;
	}
	if(strcmp(state,"0") == 0){
		dmsState = DMS_IDLE;
	}
	else if(strcmp(state,"1") == 0){
		dmsState = DMS_STREAMING;
	}
	ZInfo4(DBG_MISC, "Parse DMS state structure success, it is %s", state);

	if(dmsState == DMS_STREAMING && GetSysState(DMSState) == DMS_IDLE){
		SetSysState(DMSState, DMS_STREAMING);
		streamingStart();
	}
	else if(dmsState == DMS_IDLE && GetSysState(DMSState) == DMS_STREAMING){
		SetSysState(DMSState, DMS_IDLE);
		streamingStop();
	}

	if(state != NULL){
		free (state);
	}
	ixmlDocument_free(stateDoc);
	return 0;
errOut:
	if(state != NULL){
		free (state);
	}
	ixmlDocument_free(stateDoc);
	ZError(DBG_MISC, "GetState from DMS Failed!");
	return -1;
}
コード例 #8
0
int cUpnpService::parseIntegerValue(IN IXML_Document* Document, IN const char* Item, OUT int* Value){
    char* Val = NULL;
    int Error = 0;

    Val = ixmlGetFirstDocumentItem(Document, Item, &Error);

    if(Error != 0){
        ERROR("Error while parsing integer value for item=%s", Item);
        Error = -1;
    }
    else if(Val == NULL || !Val){
        WARNING("Value %s empty!", Item);
        *Value = 0;
    }
    else {
        *Value = atoi(Val);
        free(Val);
    }
    return Error;
}
コード例 #9
0
int cUpnpService::parseStringValue(IN IXML_Document* Document, IN const char* Item, OUT char** Value){
    char* Val = NULL;
    int Error = 0;

    Val = ixmlGetFirstDocumentItem(Document, Item, &Error);

    if(Error != 0){
        ERROR("Error while parsing string value for item=%s", Item);
        Error = -1;
    }
    else if(Val == NULL || !Val){
//        WARNING("Value %s empty!", Item);
		MESSAGE(VERBOSE_CDS, "Value %s empty!", Item);
        *Value = NULL;
    }
    else {
        *Value = strdup(Val);
        free(Val);
    }

    return Error;
}
コード例 #10
0
ファイル: cms.c プロジェクト: jamesyan84/zbase
int CMSGetCurrentConnectionInfo(struct Upnp_Action_Request *actEvent)
{
  char          *value = NULL;
  PSERV_COMMON  serv = &dms.dmsServ[DMS_SERVICE_CMS];

  ZTrace(DBG_DMS_CMS, "Entering");
  actEvent->ErrCode = UPNP_E_SUCCESS;

  // From the request get the connection ID...
  if (!(value = ixmlGetFirstDocumentItem(actEvent->ActionRequest, "ConnectionID"))) {
    strcpy(actEvent->ErrStr, "Invalid Arguments");
    actEvent->ErrCode = UPNP_SOAP_E_INVALID_ARGS;
    ZError(DBG_DMS_CMS, "ConnectionID Value not present");
    goto funcOut;
  }

  // Make sure the value is zero...
  if (atoi(value) != 0) {
    strcpy(actEvent->ErrStr, "Invalid Connection Reference");
    actEvent->ErrCode = UPNP_SOAP_E_INVALID_CONN_REF;
    ZError(DBG_DMS_CMS, "ConnectionID Value is not zero->%d", atoi(value));
    goto funcOut;
  }

  // Return variables related to connection id...
  if (UpnpAddToActionResponse(&actEvent->ActionResult,
                              "GetCurrentConnectionInfo",
                              serv->serviceType,
                              "RcsID",
                              "-1") != UPNP_E_SUCCESS) {
    ZError(DBG_DMS_CMS, "Unable to set RcsID");
    goto intError;
  }

  if (UpnpAddToActionResponse(&actEvent->ActionResult,
                              "GetCurrentConnectionInfo",
                              serv->serviceType,
                              "AVTransportID",
                              "-1") != UPNP_E_SUCCESS) {
    ZError(DBG_DMS_CMS, "Unable to set AVTransportID");
    goto intError;
  }

  if (UpnpAddToActionResponse(&actEvent->ActionResult,
                              "GetCurrentConnectionInfo",
                              serv->serviceType,
                              "PeerConnectionManager",
                              "") != UPNP_E_SUCCESS) {
    ZError(DBG_DMS_CMS, "Unable to set PeerConnectionManager");
    goto intError;
  }

  if (UpnpAddToActionResponse(&actEvent->ActionResult,
                              "GetCurrentConnectionInfo",
                              serv->serviceType,
                              "PeerConnectionID",
                              "-1") != UPNP_E_SUCCESS) {
    ZError(DBG_DMS_CMS, "Unable to set PeerConnectionID");
    goto intError;
  }

  if (UpnpAddToActionResponse(&actEvent->ActionResult,
                              "GetCurrentConnectionInfo",
                              serv->serviceType,
                              "Direction",
                              "Output") != UPNP_E_SUCCESS) {
    ZError(DBG_DMS_CMS, "Unable to set Output");
    goto intError;
  }


  if (UpnpAddToActionResponse(&actEvent->ActionResult,
                              "GetCurrentConnectionIDs",
                              serv->serviceType,
                              "Status",
                              "Unknown") != UPNP_E_SUCCESS) {
    ZError(DBG_DMS_CMS, "Unable to set Status");
    goto intError;
  }

  goto funcOut;
  
intError:
  actEvent->ActionResult = NULL;
  actEvent->ErrCode = UPNP_E_INTERNAL_ERROR;
  strcpy(actEvent->ErrStr, "Internal Error");
  
funcOut:
  ZTrace(DBG_DMS_CMS, "Exiting->%d", actEvent->ErrCode);
  if (value) {
    free(value);
  }
  return actEvent->ErrCode;
}
コード例 #11
0
ファイル: zqstate.c プロジェクト: jamesyan84/zbase
void SetDMRState(IXML_Document *stateDoc)
{
	char *dmrState = NULL;
	int idmrState = DMR_STATE_STOPPED;
	char *dmrPlayType = NULL;
	int idmrPlayType = DMR_PLAYTYPE_IDLE;
	char *objID = NULL;
	char *udn = NULL;

	dmrState = ixmlGetFirstDocumentItem(stateDoc, "state");
	if(dmrState == NULL) {
		ZError(DBG_MISC, "Missing DMR state!");
		goto errOut;
	} else if(strcmp(dmrState, "STOPPED") == 0) {
		idmrState = DMR_STATE_STOPPED;
	} else if(strcmp(dmrState, "NO_MEDIA") == 0) {
		idmrState = DMR_STATE_NO_MEDIA;
	} else if(strcmp(dmrState, "PLAYING") == 0) {
		idmrState = DMR_STATE_PLAYING;
	} else if(strcmp(dmrState, "PAUSED_PLAYBACK") == 0) {
		idmrState = DMR_STATE_PAUSED;
	} else {
		ZError(DBG_MISC, "Unknown DMR state! state->%s", dmrState);
		goto errOut;
	}

	if(idmrState == DMR_STATE_PLAYING || idmrState == DMR_STATE_PAUSED) {
		dmrPlayType = ixmlGetFirstDocumentItem(stateDoc, "PlayType");
		if (dmrPlayType == NULL) {
			ZError(DBG_MISC, "Missing PlayType");
			goto errOut;
		} else if(strcmp(dmrPlayType, "IDLE") == 0) {
			idmrPlayType = DMR_PLAYTYPE_IDLE;
		} else if(strcmp(dmrPlayType, "CD") == 0) {
			idmrPlayType = DMR_PLAYTYPE_CD;
		} else if(strcmp(dmrPlayType, "INTERNET_RADIO") == 0) {
			idmrPlayType = DMR_PLAYTYPE_INTERNET_RADIO;
		} else if(strcmp(dmrPlayType, "STREAM") == 0) {
			idmrPlayType = DMR_PLAYTYPE_STREAM;
		} else if(strcmp(dmrPlayType, "MUSIC_ITEM") == 0) {
			idmrPlayType = DMR_PLAYTYPE_MUSIC_ITEM;
		} else if(strcmp(dmrPlayType, "PLAY_QUEUE") == 0) {
			idmrPlayType = DMR_PLAYTYPE_PLAY_QUEUE;
		} else if(strcmp(dmrPlayType, "UNDEFINE") == 0) {
			idmrPlayType = DMR_PLAYTYPE_UNDEFINE;
		} else {
			ZError(DBG_MISC, "Unknown DMR PlayType! PlayType->%s", dmrPlayType);
			goto errOut;
		}

		if(idmrPlayType == DMR_PLAYTYPE_MUSIC_ITEM || idmrPlayType == DMR_PLAYTYPE_PLAY_QUEUE) {
			IXML_Node *objectNode = NULL;
			objectNode = ixmlGetFirstNodeByTagName(stateDoc, "object");
			if(objectNode == NULL) {
				ZInfo4(DBG_MISC, "No playing object!");
				goto errOut;
			}
			objID = ixmlElement_getAttribute((IXML_Element *)objectNode, "id");
			udn = ixmlElement_getAttribute((IXML_Element *)objectNode, "udn");
			if(objID == NULL || udn == NULL) {
				ZInfo4(DBG_MISC, "Wrong playing object udn![%s][%s]", objID, udn);
				goto errOut;
			}
		}
	}
	ZInfo4(DBG_MISC, "state: %s, playtype: %s, objid: %s, udn: %s", dmrState, dmrPlayType, objID, udn);

	switch (idmrState) {
		case DMR_STATE_STOPPED:
		case DMR_STATE_NO_MEDIA:
			SetWorkStatus(WPlayLocalDMS, WORK_STOPPED );
			SetWorkStatus(WPlayExtDMS, WORK_STOPPED );
			SetWorkStatus(WPlayIR, WORK_STOPPED );
			SetWorkStatus(WPlayCD, WORK_STOPPED );
			break;
		case DMR_STATE_PLAYING:
		case DMR_STATE_PAUSED:
			SetWorkStatus(WPlayLocalDMS, WORK_STOPPED );
			SetWorkStatus(WPlayExtDMS, WORK_STOPPED );
			SetWorkStatus(WPlayIR, WORK_STOPPED );
			SetWorkStatus(WPlayCD, WORK_STOPPED );
			SetSysState(DMRState, idmrState);
			SetSysState(DMRPlayType, idmrPlayType);
			switch (idmrPlayType) {
				case DMR_PLAYTYPE_MUSIC_ITEM:
				case DMR_PLAYTYPE_PLAY_QUEUE:
					SetCache(CACHE_PLAYINGOBJECT, objID);
					SetCache(CACHE_PLAYINGUDN, udn);
					char *localudn = UpdateLocalDMSUdn();
					if (strstr(udn, localudn) != NULL) {
						SetWorkStatus(WPlayLocalDMS, WORK_RUNNING);
					} else {
						SetWorkStatus(WPlayExtDMS, WORK_RUNNING);
					}
					break;
				case DMR_PLAYTYPE_CD:
					SetWorkStatus(WPlayCD, WORK_RUNNING);
					SetCache(CACHE_PLAYINGOBJECT, NULL);
					SetCache(CACHE_PLAYINGUDN, NULL);
					break;
				case DMR_PLAYTYPE_INTERNET_RADIO:
					SetWorkStatus(WPlayIR, WORK_RUNNING);
					SetCache(CACHE_PLAYINGOBJECT, objID);
					SetCache(CACHE_PLAYINGUDN, udn);
					break;
				default:
					SetCache(CACHE_PLAYINGOBJECT, NULL);
					SetCache(CACHE_PLAYINGUDN, NULL);
			}
	}

errOut:
	free(dmrState);
	free(dmrPlayType);
	return;
}
コード例 #12
0
ファイル: zqstate.c プロジェクト: jamesyan84/zbase
/*--------------------------------------------------
* Function: GetDMRState
* Description:
* 	GetState from DMR and parse the result into
*   DMRSTATE structure.
* Parameters:
* 	NONE
* Returns:
*--------------------------------------------------*/
MODSTATE *
GetDMRState()
{
	//<ret op="GetState" mod=" zappdmr ">
	//	<err>0 Means OK, else return error</err>
	//	<msg></msg>
	//	<state> STOPPED | PLAYING | PAUSED| NO_MEDIA </state>//If is playing/paused should include following tags 
	// 	<PlayType> IDLE|CD|INTERNET_RADIO|MUSIC_ITEM|PLAY_QUEUE| UNDEFINE </PlayType>
	//	<object id="" udn="">// id is a CDS object; udn is udn of this object
	//</ret>
	MODSTATE *modState = ModStateCreate(ZAPP_DMR);
	if(modState == NULL) {
		return NULL;
	}
	DMRSTATE *dmrState = DMRStateCreate();
	modState->DetailState.dmrState = dmrState;

	IXML_Document *stateDoc = NULL;
	char *state;
	stateDoc = CMDGetStateDMR();
	if(stateDoc == NULL) {
		goto errOut;
	}
	modState->err = GetErrNum(stateDoc);
	if(modState->err != 0) {
		modState->msg = ixmlGetFirstDocumentItem(stateDoc, "msg");
		goto funcOut;
	}

	state = ixmlGetFirstDocumentItem(stateDoc, "state");
	if(state == NULL) {
		goto errOut;
	}
	if(strcmp(state, "STOPPED") == 0) {
		modState->state = DMR_STATE_STOPPED;
	} else if(strcmp(state, "NO_MEDIA") == 0) {
		modState->state = DMR_STATE_NO_MEDIA;
	} else if(strcmp(state, "PLAYING") == 0) {
		modState->state = DMR_STATE_PLAYING;
	} else if(strcmp(state, "PAUSED_PLAYBACK") == 0) {
		modState->state = DMR_STATE_PAUSED;
	} else {
		ZError(DBG_MISC, "Unknown DMR state! state->%s", state);
		free(state);
		goto errOut;
	}
	free(state); state = NULL;

	if(modState->state == DMR_STATE_PLAYING || modState->state == DMR_STATE_PAUSED) {
		state = ixmlGetFirstDocumentItem(stateDoc, "PlayType");
		if(strcmp(state, "IDLE") == 0) {
			dmrState->PlayType = DMR_PLAYTYPE_IDLE;
		} else if(strcmp(state, "CD") == 0) {
			dmrState->PlayType = DMR_PLAYTYPE_CD;
		} else if(strcmp(state, "INTERNET_RADIO") == 0) {
			dmrState->PlayType = DMR_PLAYTYPE_INTERNET_RADIO;
		} else if(strcmp(state, "STREAM") == 0) {
			dmrState->PlayType = DMR_PLAYTYPE_STREAM;
		} else if(strcmp(state, "MUSIC_ITEM") == 0) {
			dmrState->PlayType = DMR_PLAYTYPE_MUSIC_ITEM;
		} else if(strcmp(state, "PLAY_QUEUE") == 0) {
			dmrState->PlayType = DMR_PLAYTYPE_PLAY_QUEUE;
		} else if(strcmp(state, "UNDEFINE") == 0) {
			dmrState->PlayType = DMR_PLAYTYPE_UNDEFINE;
		} else {
			ZError(DBG_MISC, "Unknown DMR PlayType! PlayType->%s", state);
			free(state);
			goto errOut;
		}
		free(state); state = NULL;

		if(dmrState->PlayType == DMR_PLAYTYPE_MUSIC_ITEM || dmrState->PlayType == DMR_PLAYTYPE_PLAY_QUEUE) {
			IXML_Node *objectNode = NULL;
			objectNode = ixmlGetFirstNodeByTagName(stateDoc, "object");
			if(objectNode == NULL) {
				ZInfo4(DBG_MISC, "No playing object!");
				goto errOut;
			}
			char *temp = NULL;
			if((temp = ixmlElement_getAttribute((IXML_Element *)objectNode, "id")) != NULL) {
				dmrState->ObjectID = strdup(temp);
				temp = NULL;
			}
			else {
				ZInfo4(DBG_MISC, "No playing object id!");
				goto errOut;
			}
			if((temp = ixmlElement_getAttribute((IXML_Element *)objectNode, "udn")) != NULL) {
				dmrState->Udn = strdup(temp);
				temp = NULL;
			}
			else {
				ZInfo4(DBG_MISC, "No playing object udn!");
				goto errOut;
			}
		}
	}

funcOut:
	ixmlDocument_free(stateDoc);
	ZInfo4(DBG_MISC, "Parse DMR state structure success");
	return modState;
errOut:
	ixmlDocument_free(stateDoc);
	ZError(DBG_MISC, "GetState from DMR Failed!");
	ModStateFree(modState);
	return NULL;
}
コード例 #13
0
/**************************************************************************
 * Function: ParaseXMLString
 * Functionality: parase the xml string
 * @IN :  XMLString: the xml string

 * @OUT:   NetConfig: fill this struct from xml string 
WifiParam:wifi config parameters
0 OK else error
 * Used description:
 get the xml string and fill the struct NetworkConfig
 * Date: 20080117
 * Changed history:
 * Date          Who             Reason
 * 20080117     sandy           First  creation
 ***************************************************************************/ 
int ParaseXMLString(char * XMLString, NetworkConfig *NetConfig, PWifiConfig WifiParam)
{
	IXML_Document   * Dom = NULL;

	IXML_NodeList   *nodeList = NULL;
	IXML_Node       *node;

	/*parse the xml string, and get the needed value*/
	if(!(Dom = ixmlParseBuffer(XMLString))){
		fprintf(stderr, "Load Document error\n");
		return -1;
	}
	NetConfig->PreferNetwork = ixmlGetFirstDocumentItem(Dom,"PreferNetwork");
	NetConfig->IPDNS1 = ixmlGetFirstDocumentItem(Dom,"IPDNS1");
	NetConfig->IPDNS2 = ixmlGetFirstDocumentItem(Dom,"IPDNS2");

	if ((nodeList = ixmlDocument_getElementsByTagName(Dom,"Wired")) != NULL) {
		if ((node = ixmlNodeList_item(nodeList, 0)) != NULL) {
			NetConfig->WireConfig.Enabled = ixmlGetFirstElementItem((IXML_Element *)node, "Enabled");
			NetConfig->WireConfig.DHCPEnable = ixmlGetFirstElementItem((IXML_Element *)node, "DHCPEnable");
			NetConfig->WireConfig.IPAddr = ixmlGetFirstElementItem((IXML_Element *)node, "IPAddr");
			NetConfig->WireConfig.IPGateway = ixmlGetFirstElementItem((IXML_Element *)node, "IPGateway");
			NetConfig->WireConfig.IPSubnetMask = ixmlGetFirstElementItem((IXML_Element *)node, "IPSubnetMask");
		}
		if (nodeList)
			ixmlNodeList_free(nodeList);
	}

	if ((nodeList = ixmlDocument_getElementsByTagName(Dom,"Wireless")) != NULL) {
		if ((node = ixmlNodeList_item(nodeList, 0)) != NULL) {
			WifiParam->encryption = ixmlGetFirstElementItem((IXML_Element *)node, "Encryption");
			WifiParam->ssid = ixmlGetFirstElementItem((IXML_Element *)node, "ESSID");
			WifiParam->key = ixmlGetFirstElementItem((IXML_Element *)node, "Key");
			NetConfig->WifiConfig.Enabled = ixmlGetFirstElementItem((IXML_Element *)node, "Enabled");
			NetConfig->WifiConfig.DHCPEnable = ixmlGetFirstElementItem((IXML_Element *)node, "DHCPEnable");
			NetConfig->WifiConfig.IPAddr = ixmlGetFirstElementItem((IXML_Element *)node, "IPAddr");
			NetConfig->WifiConfig.IPGateway = ixmlGetFirstElementItem((IXML_Element *)node, "IPGateway");
			NetConfig->WifiConfig.IPSubnetMask = ixmlGetFirstElementItem((IXML_Element *)node, "IPSubnetMask");
		}
		if (nodeList)
			ixmlNodeList_free(nodeList);
	}


	if(Dom){
		ixmlDocument_free(Dom);
		Dom = NULL;
	}

#if 0
	printf("the DNS is %s %s \n", NetConfig->IPDNS1, NetConfig->IPDNS2);
	printf("the return NetConfig.DHCPStatus is %s\n", NetConfig->DHCPStatus);
	printf("the return NetConfig.PreferNetwork is %s\n", NetConfig->PreferNetwork);

	printf("the return NetConfig.WireConfig.Enabled is %s\n", NetConfig->WireConfig.Enabled);
	printf("the return NetConfig.WireConfig.DHCPEnable is %s\n", NetConfig->WireConfig.DHCPEnable);
	printf("the return NetConfig.WireConfig.IPAddr is %s\n", NetConfig->WireConfig.IPAddr);
	printf("the return NetConfig.WireConfig.IPSubnetMask is %s\n", NetConfig->WireConfig.IPSubnetMask);
	printf("the return NetConfig.WireConfig.IPSubnetMask is %s\n", NetConfig->WireConfig.IPGateway);

	printf("the return NetConfig.WifiConfig.Enabled is %s\n", NetConfig->WifiConfig.Enabled);
	printf("the return NetConfig.WifiConfig.DHCPEnable is %s\n", NetConfig->WifiConfig.DHCPEnable);
	printf("the return NetConfig.WifiConfig.IPAddr is %s\n", NetConfig->WifiConfig.IPAddr);
	printf("the return NetConfig.WifiConfig.IPSubnetMask is %s\n", NetConfig->WifiConfig.IPSubnetMask);
	printf("the return NetConfig.WifiConfig.IPGateway is %s\n", NetConfig->WifiConfig.IPGateway);
#endif

	return 0;
}