/*@@var:*/
variables
{
  // Ini file variables
  char fileName[20]    = "DummyFBlock.ini";
  char section[20]     = "DUMMY";
  char entryActive[20] = "Active";
  char entryFBlock[20] = "FBlock";
  char entryInst[20]   = "Inst";
}
/*@@end*/

/*@@caplFunc:RegisterDummyFBlock():*///function
RegisterDummyFBlock ()
{
  int i, fblockID;

  @sysvar::HasDummyFBlock = getProfileInt(section, entryActive, 0, fileName);
  @sysvar::DummyFBlockID  = getProfileInt(section, entryFBlock, 0xFB, fileName);
  @sysvar::DummyInstID    = getProfileInt(section, entryInst,   0x01, fileName);

  if(@sysvar::HasDummyFBlock)
  {
    MostApRegisterEx(@sysvar::DummyFBlockID, @sysvar::DummyInstID);
  }
}
/*@@end*/

/*@@stop:StopMeasurement:*/
on stopMeasurement
{
  // write the stored dummy FBlock to a file
  writeProfileInt(section, entryActive, @sysvar::HasDummyFBlock, fileName);
  writeProfileInt(section, entryFBlock, @sysvar::DummyFBlockID, fileName);
  writeProfileInt(section, entryInst,   @sysvar::DummyInstID, fileName);
}
/*@@end*/

/*@@startStart:Start:*/
on start
{
  // needed for those systems where the NetworkMaster expects at least
  // one function fblock per device when requesting the FBlockIDs during system scan
  
  // Read from file
  RegisterDummyFBlock();
  
}
/*@@end*/

/*@@sysvarChange:HasDummyFBlock:*/
on sysvar HasDummyFBlock
{
  if(@this)
  {
    // register dummy FBlock
    MostApRegisterEx(@sysvar::DummyFBlockID, @sysvar::DummyInstID);
  }
  else
  {
    // unregister dummy FBlock
    MostApUnregisterEx(@sysvar::DummyFBlockID, @sysvar::DummyInstID);
  }
}
/*@@end*/

