Esempio n. 1
0
bool F12Protocol::isSingleShot(
  const CommandSequence &bits)
{
  // We're expecting "firstcode" to contain exactly 8 bits here.  Probably
  // should throw an exception if not!
  CommandSequence::const_reverse_iterator i = bits.rbegin();
  if (i == bits.rend())
  {
    // Throw exception here?
    return false;
  }

  if (*i)
  {
    // This is a single-shot command.
    return true;
  }

  ++i;

  if (i == bits.rend())
  {
    // Throw exception here?
    return false;
  }

  if (*i)
  {
    // This is a single-shot command.
    return true;
  }

  // At this point, it could only be a repeatable command.
  return false;
}
Esempio n. 2
0
bool F12Protocol::isSingleShot(
  const CommandSequence &bits)
{
  CommandSequence::const_reverse_iterator i = bits.rbegin();
  if (i == bits.rend())
  {
    // Throw exception here?
    return false;
  }

  if (*i)
  {
    // This is a single-shot command.
    return true;
  }

  ++i;

  if (i == bits.rend())
  {
    // Throw exception here?
    return false;
  }

  if (*i)
  {
    // This is a single-shot command.
    return true;
  }

  // At this point, it could only be a repeatable command.
  return false;
}