[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sc-devel] Fwd: SF.net SVN: supercollider: [6659] trunk/Source/lang/LangPrimSource/ PyrSerialPrim.cpp



Begin forwarded message:
From: kersten@xxxxxxxxxxxxxxxxxxxxx
Date: 21. November 2007 12:49:58 GMT+01:00
To: sc-dev@xxxxxxxxxxxxxxx
Subject: SF.net SVN: supercollider: [6659] trunk/Source/lang/ LangPrimSource/ PyrSerialPrim.cpp


Revision: 6659
          http://svn.sourceforge.net/supercollider/?rev=6659&view=rev
Author:   kersten
Date:     2007-11-21 03:49:58 -0800 (Wed, 21 Nov 2007)

Log Message:
-----------
add more serial baudrates
signal error for unsupported baudrates

Modified Paths:
--------------
    trunk/Source/lang/LangPrimSource/PyrSerialPrim.cpp

Modified: trunk/Source/lang/LangPrimSource/PyrSerialPrim.cpp
===================================================================
--- trunk/Source/lang/LangPrimSource/PyrSerialPrim.cpp 2007-11-20 22:46:35 UTC (rev 6658) +++ trunk/Source/lang/LangPrimSource/PyrSerialPrim.cpp 2007-11-21 11:49:58 UTC (rev 6659)
@@ -35,6 +35,7 @@
 #include <unistd.h>

 #include <stdexcept>
+#include <sstream>

 #include "GC.h"
 #include "PyrKernel.h"
@@ -176,6 +177,15 @@
 	// baudrate
 	speed_t brate;
 	switch (m_options.baudrate) {
+		case 1200:
+			brate = B1200;
+			break;
+		case 1800:
+			brate = B1800;
+			break;
+		case 2400:
+			brate = B2400;
+			break;
 		case 4800:
 			brate = B4800;
 			break;
@@ -188,19 +198,31 @@
 		case 38400:
 			brate = B38400;
 			break;
+#ifndef _POSIX_C_SOURCE
+		case 7200:
+			brate = B7200;
+			break;
+		case 14400:
+			brate = B14400;
+			break;
+		case 28800:
+			brate = B28800;
+			break;
 		case 57600:
 			brate = B57600;
 			break;
+		case 76800:
+			brate = B76800;
+			break;
 		case 115200:
 			brate = B115200;
 			break;
 		case 230400:
 			brate = B230400;
 			break;
+#endif // !_POSIX_C_SOURCE
 		default:
-			brate = B9600;
-			m_options.baudrate=9600;
-			break;
+			throw Error("unsupported baudrate");
 	}

 	cfsetispeed(&toptions, brate);
@@ -459,6 +481,9 @@
 	try {
 		port = new SerialPort(self->uo, portName, options);
 	} catch (SerialPort::Error& e) {
+		std::ostringstream os;
+		os << "SerialPort Error: " << e.what();
+		post(os.str().c_str());
 		return errFailed;
 	}



This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.