svnno****@sourc*****
svnno****@sourc*****
2015年 1月 9日 (金) 00:19:03 JST
Revision: 5759 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5759 Author: yutakapon Date: 2015-01-09 00:19:02 +0900 (Fri, 09 Jan 2015) Log Message: ----------- チケット #34788 "CD DSR CTS RI"の信号レベルを検出するコマンド getmodemstatus マクロコマンドを追加した。 Ticket Links: ------------ http://sourceforge.jp/projects/ttssh2/tracker/detail/34788 Modified Paths: -------------- trunk/teraterm/common/helpid.h trunk/teraterm/teraterm/ttdde.c trunk/teraterm/ttpmacro/ttl.c trunk/teraterm/ttpmacro/ttmdde.h trunk/teraterm/ttpmacro/ttmparse.c trunk/teraterm/ttpmacro/ttmparse.h -------------- next part -------------- Modified: trunk/teraterm/common/helpid.h =================================================================== --- trunk/teraterm/common/helpid.h 2015-01-04 13:12:58 UTC (rev 5758) +++ trunk/teraterm/common/helpid.h 2015-01-08 15:19:02 UTC (rev 5759) @@ -235,6 +235,7 @@ #define HlpMacroCommandGethostname 92141 #define HlpMacroCommandGetipv4addr 92199 #define HlpMacroCommandGetipv6addr 92200 +#define HlpMacroCommandGetmodemstatus 92213 #define HlpMacroCommandGetpassword 92046 #define HlpMacroCommandGetspecialfolder 92195 #define HlpMacroCommandGettime 92047 Modified: trunk/teraterm/teraterm/ttdde.c =================================================================== --- trunk/teraterm/teraterm/ttdde.c 2015-01-04 13:12:58 UTC (rev 5758) +++ trunk/teraterm/teraterm/ttdde.c 2015-01-08 15:19:02 UTC (rev 5759) @@ -371,6 +371,7 @@ #define CmdLogInfo 'V' #define CmdLogRotate 'W' #define CmdLogAutoClose 'X' +#define CmdGetModemStatus 'Y' HDDEDATA AcceptExecute(HSZ TopicHSz, HDDEDATA Data) { @@ -930,6 +931,30 @@ } break; + case CmdGetModemStatus: // add 'getmodemstatus' (2015.1.8 yutaka) + { + DWORD val, n; + + if (!cv.Open || cv.PortType != IdSerial) + return DDE_FNOTPROCESSED; + + if (GetCommModemStatus(cv.ComID, &val) == 0) // error + return DDE_FNOTPROCESSED; + //val = MS_CTS_ON | MS_DSR_ON | MS_RING_ON | MS_RLSD_ON; + n = 0; + if (val & MS_CTS_ON) + n |= 0x01; + if (val & MS_DSR_ON) + n |= 0x02; + if (val & MS_RING_ON) + n |= 0x04; + if (val & MS_RLSD_ON) + n |= 0x08; + + _snprintf_s(ParamFileName, sizeof(ParamFileName), _TRUNCATE, "%d", n); + } + break; + case CmdGetHostname: // add 'gethostname' (2008.12.15 maya) if (cv.Open) { if (cv.PortType == IdTCPIP) { Modified: trunk/teraterm/ttpmacro/ttl.c =================================================================== --- trunk/teraterm/ttpmacro/ttl.c 2015-01-04 13:12:58 UTC (rev 5758) +++ trunk/teraterm/ttpmacro/ttl.c 2015-01-08 15:19:02 UTC (rev 5759) @@ -2706,6 +2706,37 @@ return Err; } +// COM\x83|\x81[\x83g\x82\xA9\x82烌\x83W\x83X\x83^\x92l\x82\xF0\x93ǂށB +// (2015.1.8 yutaka) +WORD TTLGetModemStatus() +{ + TVarId VarId; + WORD Err; + char Str[MaxStrLen]; + int Num; + + Err = 0; + GetIntVar(&VarId, &Err); + if ((Err == 0) && (GetFirstChar() != 0)) + Err = ErrSyntax; + if ((Err == 0) && (!Linked)) + Err = ErrLinkFirst; + if (Err != 0) return Err; + + memset(Str, 0, sizeof(Str)); + Err = GetTTParam(CmdGetModemStatus, Str, sizeof(Str)); + if (Err == 0) { + Num = atoi(Str); + SetIntVal(VarId, Num); + SetResult(0); + } + else { + SetResult(1); + } + + return Err; +} + // \x8E\xC0\x8Ds\x83t\x83@\x83C\x83\x8B\x82\xA9\x82\xE7\x83o\x81[\x83W\x83\x87\x83\x93\x8F\xEE\x95\xF1\x82\xE9 (2005.2.28 yutaka) static void get_file_version(char *exefile, int *major, int *minor, int *release, int *build) { @@ -5972,6 +6003,8 @@ Err = TTLGetIPv4Addr(); break; case RsvGetIPv6Addr: Err = TTLGetIPv6Addr(); break; + case RsvGetModemStatus: + Err = TTLGetModemStatus(); break; case RsvGetPassword: Err = TTLGetPassword(); break; case RsvSetPassword: Modified: trunk/teraterm/ttpmacro/ttmdde.h =================================================================== --- trunk/teraterm/ttpmacro/ttmdde.h 2015-01-04 13:12:58 UTC (rev 5758) +++ trunk/teraterm/ttpmacro/ttmdde.h 2015-01-08 15:19:02 UTC (rev 5759) @@ -62,6 +62,7 @@ #define CmdLogInfo 'V' #define CmdLogRotate 'W' #define CmdLogAutoClose 'X' +#define CmdGetModemStatus 'Y' #ifdef __cplusplus extern "C" { Modified: trunk/teraterm/ttpmacro/ttmparse.c =================================================================== --- trunk/teraterm/ttpmacro/ttmparse.c 2015-01-04 13:12:58 UTC (rev 5758) +++ trunk/teraterm/ttpmacro/ttmparse.c 2015-01-08 15:19:02 UTC (rev 5759) @@ -259,6 +259,7 @@ else if (_stricmp(Str,"gethostname")==0) *WordId = RsvGetHostname; else if (_stricmp(Str,"getipv4addr")==0) *WordId = RsvGetIPv4Addr; else if (_stricmp(Str,"getipv6addr")==0) *WordId = RsvGetIPv6Addr; + else if (_stricmp(Str,"getmodemstatus") == 0) *WordId = RsvGetModemStatus; else if (_stricmp(Str,"getpassword")==0) *WordId = RsvGetPassword; else if (_stricmp(Str,"getspecialfolder")==0) *WordId = RsvGetSpecialFolder; else if (_stricmp(Str,"gettime")==0) *WordId = RsvGetTime; Modified: trunk/teraterm/ttpmacro/ttmparse.h =================================================================== --- trunk/teraterm/ttpmacro/ttmparse.h 2015-01-04 13:12:58 UTC (rev 5758) +++ trunk/teraterm/ttpmacro/ttmparse.h 2015-01-08 15:19:02 UTC (rev 5759) @@ -242,6 +242,7 @@ #define RsvBringupBox 210 #define RsvLogAutoClose 211 #define RsvUptime 212 +#define RsvGetModemStatus 213 #define RsvOperator 1000 #define RsvBNot 1001