#include <iostream>
#include <sys/time.h>
timeval previousTime;
-#else
-//#ifndef DEBUGGING
+#endif // DEBUGGING
#include <linux/types.h>
#include <linux/ioctl.h>
-#endif // DEBUGGING
#include <fcntl.h>
// Includes I'm using for error handling stuff:
#ifdef DEBUGGING
// check the current time:
gettimeofday(&previousTime, NULL);
-#else
-//#ifndef DEBUGGING
+#endif // DEBUGGING
fileDescriptor = open(PATH_TO_LIRC_DEVICE, O_WRONLY);
if (fileDescriptor == -1)
ss << "Error is " << strerror(errno) << "\n";
throw PIRException(ss.str());
}
-#endif // DEBUGGING
}
++blah;
}
std::cout << std::endl;
-#else
+#endif // DEBUGGING
if (write(fileDescriptor, buffer, index * sizeof(int)) == -1)
{
std::stringstream ss;
ss << "IR device returned error: " << strerror(errno) << "\n";
throw PIRException(ss.str());
}
-#endif // DEBUGGING
// Reset the index:
index = 0;
#ifdef DEBUGGING
std::cout << "Setting frequency to " << frequency << "\n";
-#else
+#endif // DEBUGGING
if (ioctl(fileDescriptor, _IOW('i', 0x13, __u32), &frequency) == -1)
{
std::stringstream ss;
ss << "IR device returned error: " << strerror(errno) << "\n";
throw PIRException(ss.str());
}
-#endif // DEBUGGING
}
#ifdef DEBUGGING
std::cout << "Setting duty cycle to " << dutyCycle << "\n";
-#else
+#endif // DEBUGGING
if (ioctl(fileDescriptor, _IOW('i', 0x15, __u32), &dutyCycle) == -1)
{
std::stringstream ss;
ss << "IR device returned error: " << strerror(errno) << "\n";
throw PIRException(ss.str());
}
-#endif // DEBUGGING
}