--- /dev/null
+/*
+ * psychlops_devices_nidaqmxbase.cpp
+ * Psychlops Standard Library (Universal)
+ *
+ * Last Modified 2009/04/14 by Kenchi HOSOKAWA
+ * (C) 2009 Kenchi HOSOKAWA, Kazushi MARUYA, Takao SATO
+ */
+
+
+#include <windows.h>
+#include "../../core/math/psychlops_m_util.h"
+#include "../../extension/devices/psychlops_devices_parallelport.h"
+
+
+namespace Psychlops {
+namespace Devices {
+\r
+ //http://support.microsoft.com/kb/413279/JA\r
+ //https://msdn.microsoft.com/ja-jp/library/cc429198.aspx\r
+ //http://support.microsoft.com/kb/823179/ja
+
+ ParallelPort::ParallelPort(size_t pin) : pins(pin) {\r
+ handle = CreateFile("LPT1", GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);\r
+ if(handle == INVALID_HANDLE_VALUE) {\r
+ std::cout << "Failed to open parallel port." <<std::endl;\r
+ handle = 0;\r
+ }\r
+ }
+ ParallelPort::~ParallelPort() {\r
+ if(handle!=0) {\r
+ CloseHandle(handle);\r
+ }\r
+ }\r
+
+ double ParallelPort::getLatency() { return -1; }
+ double ParallelPort::getJitterSD() { return -1; }
+ Interval ParallelPort::getRange() { Interval i; return 0<=i<=5; }
+ bool ParallelPort::isAnalog() { return false; }\r
+
+ double ParallelPort::get() { return 0; }
+ void ParallelPort::put(double v) { ; }
+ void ParallelPort::pulse(double v) {\r
+ unsigned char buff[1];\r
+ DWORD writtenbytes;\r
+ OVERLAPPED m_write;\r
+\r
+ buff[0] = pins;\r
+\r
+ WriteFile(handle, buff, 1, &writtenbytes, &m_write);\r
+ }
+ void ParallelPort::keep(double v) { ; }
+
+}
+} /* <- namespace Psycholops */\r
+