当前位置: 首页 > 工具软件 > VAPS > 使用案例 >

vaps 接收应用程序数据

宁侯林
2023-12-01
sqxCommsManager   Manager;
sqxCommsSender    Sender;

int _tmain(int argc, _TCHAR* argv[])
{
	sqxCommsLog* pCommsLog = sqxCommsLog::s_pGetInstance();
	pCommsLog->vSetTraceLvl(sqxCommsLog::TRACE_WARNING);

	Manager.SetAppName("nComApp");

	sqxCommsConnectionLoader ConnectionLoader;
	ConnectionLoader.Load("D:\\vaps\\vapstest2\\DataIO\\Connections.xml");
	const sqxCommsProperties* pProperty = ConnectionLoader.pGetProperties("VapsXTtoAppConn");
	if (NULL != pProperty)
	{
		sqxCommsConnection* pConnection = Manager.pCreateConnection(*pProperty);
		if (NULL != pConnection)
		{
			sqxCommsDataDescriptionLoader DDLoader;
			DDLoader.Load("D:\\vaps\\vapstest2\\DataIO\\Float2.dd");

			if (DDLoader.pGetDataDescription())
			{
				Sender.SetDataDescription(DDLoader.pGetDataDescription());
			}

			Sender.AddConnection(pConnection);
			Sender.SetAutoUpdateActive(true, true);
			Sender.SetName("DialBuf");

			pConnection->SetActive(true);

			Manager.AddSender(&Sender);
		}
	}

	while (1)
	{
		static float data = 0;
		data++;
		if (data > 100)
			data = 0;

		Sender.SetData(&data, sizeof(data));
		Manager.Tick();
		Sleep(25);
	}
	return 0;
}

 

 类似资料: