vaps 发动数据给应用程序

class MyReceiver : public sqxCommsReceiver
{
public:
	virtual void HandleMessage(const sqxCommsMessage& a_rMessage)
	{
		const float* pIncomingData = static_cast<const float*>(a_rMessage.pGetData());
		sqxCommsLog::s_pGetInstance()->vReportTrace(sqxCommsLog::TRACE_WARNING, "%f", *pIncomingData);
	}
};

sqxCommsManager   Manager;

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\\Float1.dd");
		
			sqxCommsReceiver* pReceiver = new MyReceiver();
			if (DDLoader.pGetDataDescription())
			{
				pReceiver->SetDataDescription(DDLoader.pGetDataDescription());
			}

			pConnection->AddReceiver(pReceiver);
			pConnection->SetActive(true);

			Manager.AddReceiver(pReceiver);
		}
	}

	while (1)
	{
		Manager.Tick();
		Sleep(25);
	}
	return 0;
}

 

展开阅读全文

没有更多推荐了,返回首页