extern bool commandInFlight;
extern QMutex commandIFMutex;
+// Debugging:
+#include <iostream>
+
// The official NEC protocol, as I understand it, has the following attributes:
// A "zero" is encoded with a 560 usec pulse, 560 usec space.
// A "one" is encoded with a 560 usec pulse, and 3*560 (1680) usec space.
// The header is a 9000 usec pulse, 4500 usec space.
// Commands end with a trailing 560 usec pulse.
-// A repeat block is a 9000 usec pulse, 2250 usec space, then trailing pulse.
+// A repeat block (if used) is a 9000 usec pulse, 2250 usec space, then
+// trailing pulse.
// Each command runs for 110000 usec before another can be executed.
+// The normal carrier frequency is 38 kHz.
NECProtocol::NECProtocol(
QObject *guiObject,
isExtendedNEC(extNEC),
isShortRepeat(srtRep)
{
+ setMinimumRepetitions(1);
}
// Do we even have this key defined?
if (i == keycodes.end())
{
- std::string s = "Tried to send a non-existent command.\n";
- throw PIRException(s);
+ QMutexLocker cifLocker(&commandIFMutex);
+ commandInFlight = false;
+ return;
+// std::string s = "Tried to send a non-existent command.\n";
+// throw PIRException(s);
}
// construct the device:
// Check whether we've been asked to stop:
if (checkRepeatFlag())
{
+ break;
+/*
QMutexLocker cifLocker(&commandIFMutex);
commandInFlight = false;
return;
+*/
}
}
++repeatCount;
}
+
+ QMutexLocker cifLocker(&commandIFMutex);
+ commandInFlight = false;
}
catch (PIRException e)
{
// inform the gui:
emit commandFailed(e.getError().c_str());
}
-
- QMutexLocker cifLocker(&commandIFMutex);
- commandInFlight = false;
}