--
HaraldBraeuning - 02 Apr 2009
Developers Corner
Use payload from timing telegram in RT Action
using namespace TestMTG;
IncrementCounter::IncrementCounter(const string& name, AbstractRTAction::RTActio
nConfig& rtActCfg) :
RTAction<RTEvent, TestMTGGlobalStore, TestMTGDevice>(name, rtActCfg){}
void IncrementCounter::execute(RTEvent * pEv){
cout << "RT ACtion Counter entered"<< endl;
unsigned long vAcc;
TimingPayload* pTP = dynamic_cast<TimingPayload*>(pEv->getPayload());
if (pTP !=NULL) {
vAcc = pTP->getPayloadValue();
if (vAcc != pGlobalStore->vAcc.get()) return;
}
cout << "RT action with Payload VACC: 0x"<< vAcc << endl;
cout << "executing RT action: TestMTGIncrementCounter"<<endl;
for (unsigned int i=0; i < deviceCollection.size(); i++){
TestMTGDevice * pDev = deviceCollection[i];
int k = pDev->counter.get();
pDev->counter.set(k+1);
}