You are here: Foswiki>FESA Web>HowTo>DevelopersCorner (05 Feb 2010, HaraldBraeuning)Edit Attach
-- 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);
 }
Topic revision: r4 - 05 Feb 2010, HaraldBraeuning
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback