/*@@var:*/
variables
{
  mstimer tUnlock; // Timer for generation of Unlock events
  const word kShortUnlock_Timeout = 10; // duration of ShortUnlock event
  const word kCritUnlock_Timeout  = 80; // duration of CriticalUnlock event
}
/*@@end*/

/*@@sysvarChange:SYS::ErrorInjection::ShortUnlock:*/
on sysvar SYS::ErrorInjection::ShortUnlock
{
  if(@this == 1)
  {
    cancelTimer(tUnlock);
    MostSetTxLight(mostGetChannel (), 2);     // 2 ^= nonmodulated light => no lock
    setTimer(tUnlock, kShortUnlock_Timeout);
  }
}
/*@@end*/

/*@@timer:tUnlock:*/
on timer tUnlock
{
  MostSetTxLight(mostGetChannel (), 1); // 1 ^= modulated light => lock
}
/*@@end*/

/*@@sysvarChange:SYS::ErrorInjection::CriticalUnlock:*/
on sysvar SYS::ErrorInjection::CriticalUnlock
{
  if(@this == 1)
  {
    cancelTimer(tUnlock);
    MostSetTxLight(mostGetChannel (), 2);     // 2 ^= nonmodulated light => no lock
    setTimer(tUnlock, kCritUnlock_Timeout);
  }
}
/*@@end*/

