[Ttssh2-commit] [4849] シリアル接続で、マークパリティ , スペースバリティ , 1. 5ストップビットをサポートした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2012年 3月 1日 (木) 18:14:41 JST


Revision: 4849
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4849
Author:   doda
Date:     2012-03-01 18:14:41 +0900 (Thu, 01 Mar 2012)
Log Message:
-----------
シリアル接続で、マークパリティ, スペースバリティ, 1.5ストップビットをサポートした。

Modified Paths:
--------------
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/commlib.c
    trunk/teraterm/ttpdlg/ttdlg.c
    trunk/teraterm/ttpset/ttset.c

-------------- next part --------------
Modified: trunk/teraterm/common/tttypes.h
===================================================================
--- trunk/teraterm/common/tttypes.h	2012-02-29 14:07:03 UTC (rev 4848)
+++ trunk/teraterm/common/tttypes.h	2012-03-01 09:14:41 UTC (rev 4849)
@@ -659,15 +659,18 @@
 	 "230400", "460800", "921600", NULL};
 
   /* Parity ID */
-#define IdParityEven 1
-#define IdParityOdd  2
-#define IdParityNone 3
+#define IdParityNone  1
+#define IdParityOdd   2
+#define IdParityEven  3
+#define IdParityMark  4
+#define IdParitySpace 5
   /* Data bit ID */
 #define IdDataBit7 1
 #define IdDataBit8 2
   /* Stop bit ID */
-#define IdStopBit1 1
-#define IdStopBit2 2
+#define IdStopBit1  1
+#define IdStopBit15 2
+#define IdStopBit2  3
   /* Flow control ID */
 #define IdFlowX 1
 #define IdFlowHard 2

Modified: trunk/teraterm/teraterm/commlib.c
===================================================================
--- trunk/teraterm/teraterm/commlib.c	2012-02-29 14:07:03 UTC (rev 4848)
+++ trunk/teraterm/teraterm/commlib.c	2012-03-01 09:14:41 UTC (rev 4849)
@@ -164,16 +164,24 @@
 	dcb.BaudRate = ts->Baud;
 	dcb.fBinary = TRUE;
 	switch (ts->Parity) {
+		case IdParityNone:
+			dcb.Parity = NOPARITY;
+			break;
+		case IdParityOdd:
+			dcb.fParity = TRUE;
+			dcb.Parity = ODDPARITY;
+			break;
 		case IdParityEven:
 			dcb.fParity = TRUE;
 			dcb.Parity = EVENPARITY;
 			break;
-		case IdParityOdd:
+		case IdParityMark:
 			dcb.fParity = TRUE;
-			dcb.Parity = ODDPARITY;
+			dcb.Parity = MARKPARITY;
 			break;
-		case IdParityNone:
-			dcb.Parity = NOPARITY;
+		case IdParitySpace:
+			dcb.fParity = TRUE;
+			dcb.Parity = SPACEPARITY;
 			break;
 	}
 
@@ -206,6 +214,9 @@
 		case IdStopBit1:
 			dcb.StopBits = ONESTOPBIT;
 			break;
+		case IdStopBit15:
+			dcb.StopBits = ONE5STOPBITS;
+			break;
 		case IdStopBit2:
 			dcb.StopBits = TWOSTOPBITS;
 			break;

Modified: trunk/teraterm/ttpdlg/ttdlg.c
===================================================================
--- trunk/teraterm/ttpdlg/ttdlg.c	2012-02-29 14:07:03 UTC (rev 4848)
+++ trunk/teraterm/ttpdlg/ttdlg.c	2012-03-01 09:14:41 UTC (rev 4849)
@@ -1306,8 +1306,8 @@
 }
 
 static PCHAR far DataList[] = {"7 bit","8 bit",NULL};
-static PCHAR far ParityList[] = {"even","odd","none",NULL};
-static PCHAR far StopList[] = {"1 bit","2 bit",NULL};
+static PCHAR far ParityList[] = {"none", "odd", "even", "mark", "space", NULL};
+static PCHAR far StopList[] = {"1 bit", "1.5 bit", "2 bit", NULL};
 static PCHAR far FlowList[] = {"Xon/Xoff","hardware","none",NULL};
 
 BOOL CALLBACK SerialDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)

Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2012-02-29 14:07:03 UTC (rev 4848)
+++ trunk/teraterm/ttpset/ttset.c	2012-03-01 09:14:41 UTC (rev 4849)
@@ -672,6 +672,10 @@
 		ts->Parity = IdParityEven;
 	else if (_stricmp(Temp, "odd") == 0)
 		ts->Parity = IdParityOdd;
+	else if (_stricmp(Temp, "mark") == 0)
+		ts->Parity = IdParityMark;
+	else if (_stricmp(Temp, "space") == 0)
+		ts->Parity = IdParitySpace;
 	else
 		ts->Parity = IdParityNone;
 
@@ -688,6 +692,8 @@
 	                        Temp, sizeof(Temp), FName);
 	if (_stricmp(Temp, "2") == 0)
 		ts->StopBit = IdStopBit2;
+	else if (_stricmp(Temp, "1.5") == 0)
+		ts->StopBit = IdStopBit15;
 	else
 		ts->StopBit = IdStopBit1;
 
@@ -1958,6 +1964,12 @@
 	case IdParityOdd:
 		strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
 		break;
+	case IdParityMark:
+		strncpy_s(Temp, sizeof(Temp), "mark", _TRUNCATE);
+		break;
+	case IdParitySpace:
+		strncpy_s(Temp, sizeof(Temp), "space", _TRUNCATE);
+		break;
 	default:
 		strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
 	}
@@ -1972,10 +1984,17 @@
 	WritePrivateProfileString(Section, "DataBit", Temp, FName);
 
 	/* Stop bit */
-	if (ts->StopBit == IdStopBit2)
+	switch (ts->StopBit) {
+	case IdStopBit2:
 		strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
-	else
+		break;
+	case IdStopBit15:
+		strncpy_s(Temp, sizeof(Temp), "1.5", _TRUNCATE);
+		break;
+	default:
 		strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
+		break;
+	}
 
 	WritePrivateProfileString(Section, "StopBit", Temp, FName);
 



Ttssh2-commit メーリングリストの案内
Back to archive index