コード例 #1
0
ファイル: ParameterImpl.cpp プロジェクト: fritzone/pici-nms
/**
 * Deserializes the object from the given XML node from the given XML doc
 */
bool ParameterImpl::deserialize ( xmlDocPtr doc, xmlNodePtr node )
{
    xmlNodePtr nameNode = node->children;   // node containing the "Name" tag
    xmlNodePtr typeNode = nameNode->next;   // node containing the "Type" tag
    xmlNodePtr dataNode = typeNode->next;   // node containing the "Data" tag
    xmlNodePtr contentNode = dataNode->children;    // node containing the "Content" Node, which has the implementation of the underlying object
    name = getXmlValue ( doc, node, "Name" );
    string type = getXmlValue ( doc, node, "Type" );
    DESERIALIZER objCreator = ObjectFactory::getDeserializer ( type );
    SerializableObject* newObj = objCreator ( doc, contentNode );
    value = newObj;
    return true;
}
コード例 #2
0
ファイル: SubmitData.cpp プロジェクト: zfuke164345/MyProject
UpgradeInfo SubmitData::GetUpgradeInfoFromWeb(UpgradeParam param)
{
	QMap<QString,QString> sendData = param.toMap();

	CommSendData2Web(sendData,VersionUpgrade,UpgradeValidate);
	

	UpgradeInfo info;  
	QTextCodec *tc = QTextCodec::codecForName("UTF-8");
	QByteArray ba = http->readAll();
	QString str = tc->toUnicode(ba);
	if (http!=NULL)
		delete http;
	if (loop!=NULL)
		delete loop;
	QDomDocument document; 
	if (!document.setContent(str))
	{
		return info;  
	} 

	QDomElement root = document.documentElement();
	info.strResult = getXmlValue(root,"ResponseCode");
	info.strLastVer = getXmlValue(root,"Version");
	info.strDesc = getXmlValue(root,"Description");
	info.strUpdateDate = getXmlValue(root,"UpdateTime");
	info.strDownUrl = getXmlValue(root,"Url");
	info.strMd5 = getXmlValue(root,"MD5");
	return info;

}
コード例 #3
0
ファイル: SubmitData.cpp プロジェクト: zfuke164345/MyProject
QString SubmitData::GetAndroidDeviceName(MobileInfo nInfo)
{
	QMap<QString,QString> sendData = nInfo.toMap();

	CommSendData2Web(sendData,PackageService,GetDeviceName,true);


	QTextCodec *tc = QTextCodec::codecForName("UTF-8");
	QByteArray ba = http->readAll();
	QString str = tc->toUnicode(ba);
	if (http!=NULL)
		delete http;
	if (loop!=NULL)
		delete loop;
	QDomDocument document; 
	if (!document.setContent(str))
	{
	
		return "";  
	}  
	QDomElement root = document.documentElement();  
	bool bNotNeedLoad = false;
	QString isSuccess=getXmlValue(root,"IsSuccess");	
// 	if (isSuccess.toLower()=="false")
// 	{
// 		
// 		bNotNeedLoad = true;
// 	}
// 	else if (isSuccess=="")
// 	{
// 		machine.Clear();
// 		bNotNeedLoad = true;
// 	}
	
	
	QString name =getXmlValue(root,"ShowName");
	

	return name;
}
コード例 #4
0
ファイル: SubmitData.cpp プロジェクト: zfuke164345/MyProject
// 和甜椒的服务通讯
bool SubmitData::GetDriverInfoFromWeb(GetDriverParam param,DriverInfo &driver)
{
	QMap<QString,QString> sendData = param.toMap();

	CommSendData2Web(sendData,PackageService,GetDriver,true);

	QTextCodec *tc = QTextCodec::codecForName("UTF-8");
	QByteArray ba = http->readAll();
	QString str = tc->toUnicode(ba);

	if (http!=NULL)
		delete http;
	if (loop!=NULL)
		delete loop;
	QDomDocument document; 
	if (!document.setContent(str))
	{
		driver.Clear();
		return false;  
	}  
	QDomElement root = document.documentElement();  

	QString isSuccess=getXmlValue(root,"IsSuccess");
	if (isSuccess=="") 
	{
		driver.Clear();
		qDebug() << "network report infomation error\n\n";
		return false;
	}
	else if (isSuccess.toLower()=="false")
	{
		driver.Clear();
		driver.DriverId = -2;
		qDebug() << "backstage not set driver\n\n";
		return false;
	}
	QString deviceId=getXmlValue(root,"DeviceID");
	driver.DriverId=deviceId.toLongLong();
	driver.Url=getXmlValue(root,"Url");
	driver.MD5=getXmlValue(root,"MD5");
	QString tmpDeviceType=getXmlValue(root,"DeviceType");

	if (tmpDeviceType=="INI")
		driver.DrvierType=1;
	else
		driver.DrvierType=2;

	driver.DriverName=getXmlValue(root,"MachineName");
	driver.StartFile=getXmlValue(root,"StartFile");
	driver.Version=getXmlValue(root,"Version").toInt();
	QString s= getXmlValue(root, "IsDeviceCollect");
	driver.isDeviceCollect= s == "true" ? true : false;
	driver.deviceStatue = getXmlValue(root, "DeviceStatue").toInt();
	QString strType = getXmlValue(root, "DataType");
	bool deviceType = strType == "true" ? true : false;
	if (deviceType) 
	{
		qDebug() << "exact driver recognition\n\n";
	}
	else 
	{
		qDebug() << "general driver recognition\n\n";
	}
	driver.DataType = deviceType;

	return true;
}