OSDN Git Service

123
[psychlops/cpp.git] / psychlops / platform / win32 / psychlops_devices_parallelport_Win32.cpp
index 9f8e0f0..e333375 100644 (file)
@@ -19,35 +19,27 @@ namespace Devices {
        //https://msdn.microsoft.com/ja-jp/library/cc429198.aspx\r
        //http://support.microsoft.com/kb/823179/ja
 
-       GenericParallelPort::GenericParallelPort(size_t pin) : pins(pin) {\r
-               if (!(handle = CreateDC(NULL , "TRIGGER_PARALLEL" , NULL , NULL))) {\r
-                       printf("Parallel port was not found.");\r
+       GenericParallelPort::GenericParallelPort(std::string port_name, size_t pin) : pins(pin) {\r
+               if (!(handle = CreateDC(NULL , port_name.c_str() , NULL , NULL))) {\r
                        handle = 0;\r
+                       throw new Exception("Parallel port was not found.");\r
                }\r
        }
        GenericParallelPort::~GenericParallelPort() {\r
                if(handle!=0) {\r
-                       DeleteDC(handle);\r
+                       DeleteDC((HDC)handle);\r
                }\r
        }\r
 
-       double GenericParallelPort::getLatency() { return -1; }
-       double GenericParallelPort::getJitterSD() { return -1; }
-       Interval GenericParallelPort::getRange() { Interval i; return 0<=i<=5; }
-       bool GenericParallelPort::isAnalog() { return false; }\r
-
-       double GenericParallelPort::get() { return 0; }
-       void GenericParallelPort::put(double v) { ; }
-       void GenericParallelPort::pulse(double v) {\r
+       void GenericParallelPort::trigger() {\r
                DOCINFO diInfo = {0};\r
                diInfo.cbSize = sizeof (DOCINFO);\r
                diInfo.lpszDocName = "";\r
-               if (t%100 == 0 && StartDoc(handle , &diInfo) > 0) {\r
-                       TextOut(handle , 0 , 0 , pins , 1);\r
-                       EndDoc(handle);\r
+               if (StartDoc((HDC)handle , &diInfo) > 0) {\r
+                       TextOut((HDC)handle , 0 , 0 , &pins , 1);\r
+                       EndDoc((HDC)handle);\r
                }\r
        }
-       void GenericParallelPort::keep(double v) { ; }
 
 }
 }      /*      <- namespace Psycholops         */\r