com0com-cvs Mailing List for Null-modem emulator (Page 19)
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
You can subscribe to this list here.
2005 |
Jan
|
Feb
(7) |
Mar
|
Apr
|
May
(13) |
Jun
(18) |
Jul
(9) |
Aug
(10) |
Sep
(15) |
Oct
(6) |
Nov
(9) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(4) |
Mar
(4) |
Apr
(2) |
May
(7) |
Jun
(11) |
Jul
(6) |
Aug
(9) |
Sep
(1) |
Oct
(27) |
Nov
(22) |
Dec
(3) |
2007 |
Jan
(13) |
Feb
(16) |
Mar
(2) |
Apr
(3) |
May
(7) |
Jun
(17) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(20) |
Nov
(18) |
Dec
(1) |
2008 |
Jan
|
Feb
(3) |
Mar
(46) |
Apr
(40) |
May
(4) |
Jun
(9) |
Jul
(7) |
Aug
(62) |
Sep
(25) |
Oct
(51) |
Nov
(67) |
Dec
(81) |
2009 |
Jan
(13) |
Feb
(31) |
Mar
(12) |
Apr
|
May
(10) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(10) |
Oct
|
Nov
(3) |
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
|
May
(12) |
Jun
(9) |
Jul
(12) |
Aug
(7) |
Sep
(6) |
Oct
|
Nov
|
Dec
(1) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(11) |
Jun
|
Jul
(26) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(23) |
2012 |
Jan
(7) |
Feb
(3) |
Mar
|
Apr
|
May
(2) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vyacheslav F. <vf...@us...> - 2008-08-29 13:02:43
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27988/serial Modified Files: comio.cpp comport.cpp Log Message: Added ESC_OPTS_MAP_EO2GO() and ESC_OPTS_MAP_GO2EO() Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** comport.cpp 28 Aug 2008 16:07:09 -0000 1.10 --- comport.cpp 29 Aug 2008 13:02:37 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2008/08/29 13:02:37 vfrolov + * Added ESC_OPTS_MAP_EO2GO() and ESC_OPTS_MAP_GO2EO() + * * Revision 1.10 2008/08/28 16:07:09 vfrolov * Tracing of HUB_MSG_TYPE_SET_PIN_STATE moved to the trace filter *************** *** 182,208 **** }; static void WarnIgnoredInOptions( const char *pHead, const char *pTail, ! DWORD options, ! BYTE optsMst, ! BYTE optsLsr) { ! if (optsMst) { ! cerr << pHead << " WARNING: Changing of MODEM STATUS bit(s) 0x" ! << hex << (unsigned)optsMst << dec << " [" ! << FieldToName(codeNameTableModemStatus, optsMst) << "] will be ignored by driver" << pTail << endl; } ! if (optsLsr) { ! cerr << pHead << " WARNING: Changing of LINE STATUS bit(s) 0x" ! << hex << (unsigned)optsLsr << dec << " [" ! << FieldToName(codeNameTableLineStatus, optsLsr) << "] will be ignored by driver" << pTail << endl; } ! cerr << pHead << " WARNING: Requested option(s) 0x" ! << hex << options << dec << " will be ignored by driver" << pTail << endl; } --- 185,227 ---- }; + static FIELD2NAME codeNameTableGoOptions[] = { + TOFIELD2NAME2(GO_, RBR_STATUS), + TOFIELD2NAME2(GO_, RLC_STATUS), + TOFIELD2NAME2(GO_, BREAK_STATUS), + TOFIELD2NAME2(GO_, ESCAPE_MODE), + {0, 0, NULL} + }; + static void WarnIgnoredInOptions( const char *pHead, const char *pTail, ! DWORD goOptions, ! DWORD otherOptions) { ! if (GO_O2V_MODEM_STATUS(goOptions)) { ! cerr << pHead << " WARNING: Changing of MODEM STATUS bit(s) [" ! << FieldToName(codeNameTableModemStatus, GO_O2V_MODEM_STATUS(goOptions)) << "] will be ignored by driver" << pTail << endl; } ! if (GO_O2V_LINE_STATUS(goOptions)) { ! cerr << pHead << " WARNING: Changing of LINE STATUS bit(s) [" ! << FieldToName(codeNameTableLineStatus, GO_O2V_LINE_STATUS(goOptions)) << "] will be ignored by driver" << pTail << endl; } ! goOptions &= ~(GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1)); ! ! if (goOptions) { ! cerr << pHead << " WARNING: Requested option(s) [" ! << FieldToName(codeNameTableGoOptions, goOptions) ! << "] will be ignored by driver" << pTail << endl; ! } ! ! if (otherOptions) { ! cerr << pHead << " WARNING: Requested option(s) [0x" ! << hex << otherOptions << dec ! << "] will be ignored by driver" << pTail << endl; ! } } *************** *** 233,253 **** msg.type = HUB_MSG_TYPE_GET_ESC_OPTS; msg.u.pv.pVal = &escapeOptions; pOnRead(hHub, hMasterPort, &msg); escapeOptions = SetEscMode(handle, escapeOptions, &pBuf, &done); if ((escapeOptions & ESC_OPTS_V2O_ESCCHAR(-1)) == 0) { InOptionsAdd(GO_ESCAPE_MODE); ! if (escapeOptions) { ! WarnIgnoredInOptions(name.c_str(), " (escape mode)", ! escapeOptions, ! ESC_OPTS_O2V_MST(escapeOptions), ! ESC_OPTS_O2V_LSR(escapeOptions)); ! ! msg.type = HUB_MSG_TYPE_FAIL_ESC_OPTS; ! msg.u.val = escapeOptions; ! pOnRead(hHub, hMasterPort, &msg); ! } } } --- 252,272 ---- msg.type = HUB_MSG_TYPE_GET_ESC_OPTS; msg.u.pv.pVal = &escapeOptions; + msg.u.pv.val = 0; pOnRead(hHub, hMasterPort, &msg); escapeOptions = SetEscMode(handle, escapeOptions, &pBuf, &done); + if (escapeOptions & ~ESC_OPTS_V2O_ESCCHAR(-1)) { + WarnIgnoredInOptions(name.c_str(), " (requested for escape mode)", + ESC_OPTS_MAP_EO2GO(escapeOptions), + escapeOptions & ~(ESC_OPTS_MAP_GO2EO(-1) | ESC_OPTS_V2O_ESCCHAR(-1))); + } + if ((escapeOptions & ESC_OPTS_V2O_ESCCHAR(-1)) == 0) { InOptionsAdd(GO_ESCAPE_MODE); ! msg.type = HUB_MSG_TYPE_FAIL_ESC_OPTS; ! msg.u.val = escapeOptions; ! pOnRead(hHub, hMasterPort, &msg); } } *************** *** 275,284 **** DWORD fail_options = (intercepted_options & ~InOptions()); ! if (fail_options) { ! WarnIgnoredInOptions(name.c_str(), "", ! fail_options, ! GO_O2V_MODEM_STATUS(fail_options), ! GO_O2V_LINE_STATUS(fail_options)); ! } msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; --- 294,299 ---- DWORD fail_options = (intercepted_options & ~InOptions()); ! if (fail_options) ! WarnIgnoredInOptions(name.c_str(), "", fail_options, 0); msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; *************** *** 592,602 **** if (::GetCommModemStatus(handle, &stat)) { - /* - cout << name << " MODEM STATUS bit(s): 0x" - << hex << stat << dec << " [" - << FieldToName(codeNameTableModemStatus, stat) - << "]" << endl; - */ - HUB_MSG msg; --- 607,610 ---- Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** comio.cpp 26 Aug 2008 14:23:31 -0000 1.7 --- comio.cpp 29 Aug 2008 13:02:37 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2008/08/29 13:02:37 vfrolov + * Added ESC_OPTS_MAP_EO2GO() and ESC_OPTS_MAP_GO2EO() + * * Revision 1.7 2008/08/26 14:23:31 vfrolov * Added ability to SetEscMode() return LSR and MST for non com0com ports *************** *** 329,345 **** #define LINE_STATUS_BITS (LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR) ! if (escOptions & ESC_OPTS_V2O_MST(MODEM_STATUS_BITS)) opts |= C0CE_INSERT_ENABLE_MST; ! if (escOptions & ESC_OPTS_BREAK_STATUS) opts |= C0CE_INSERT_ENABLE_LSR_BI; ! if (escOptions & ESC_OPTS_V2O_LSR(LINE_STATUS_BITS)) opts |= C0CE_INSERT_ENABLE_LSR; ! if (escOptions & ESC_OPTS_RBR_STATUS) opts |= C0CE_INSERT_ENABLE_RBR; ! if (escOptions & ESC_OPTS_RLC_STATUS) opts |= C0CE_INSERT_ENABLE_RLC; --- 332,348 ---- #define LINE_STATUS_BITS (LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR) ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_V2O_MODEM_STATUS(MODEM_STATUS_BITS))) opts |= C0CE_INSERT_ENABLE_MST; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_BREAK_STATUS)) opts |= C0CE_INSERT_ENABLE_LSR_BI; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_V2O_LINE_STATUS(LINE_STATUS_BITS))) opts |= C0CE_INSERT_ENABLE_LSR; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_RBR_STATUS)) opts |= C0CE_INSERT_ENABLE_RBR; ! if (escOptions & ESC_OPTS_MAP_GO2EO(GO_RLC_STATUS)) opts |= C0CE_INSERT_ENABLE_RLC; *************** *** 410,426 **** if (opts & C0CE_INSERT_ENABLE_MST) ! escOptions &= ~ESC_OPTS_V2O_MST(MODEM_STATUS_BITS); if (opts & C0CE_INSERT_ENABLE_LSR_BI) ! escOptions &= ~ESC_OPTS_BREAK_STATUS; if (opts & C0CE_INSERT_ENABLE_LSR) ! escOptions &= ~ESC_OPTS_V2O_LSR(LINE_STATUS_BITS & ~LINE_STATUS_BI); if (opts & C0CE_INSERT_ENABLE_RBR) ! escOptions &= ~ESC_OPTS_RBR_STATUS; if (opts & C0CE_INSERT_ENABLE_RLC) ! escOptions &= ~ESC_OPTS_RLC_STATUS; return escOptions & ~ESC_OPTS_V2O_ESCCHAR(-1); --- 413,429 ---- if (opts & C0CE_INSERT_ENABLE_MST) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_V2O_MODEM_STATUS(MODEM_STATUS_BITS)); if (opts & C0CE_INSERT_ENABLE_LSR_BI) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_BREAK_STATUS); if (opts & C0CE_INSERT_ENABLE_LSR) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_V2O_LINE_STATUS(LINE_STATUS_BITS & ~LINE_STATUS_BI)); if (opts & C0CE_INSERT_ENABLE_RBR) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_RBR_STATUS); if (opts & C0CE_INSERT_ENABLE_RLC) ! escOptions &= ~ESC_OPTS_MAP_GO2EO(GO_RLC_STATUS); return escOptions & ~ESC_OPTS_V2O_ESCCHAR(-1); |
From: Vyacheslav F. <vf...@us...> - 2008-08-29 13:02:42
|
Update of /cvsroot/com0com/hub4com/plugins In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27988 Modified Files: plugins_api.h Log Message: Added ESC_OPTS_MAP_EO2GO() and ESC_OPTS_MAP_GO2EO() Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** plugins_api.h 22 Aug 2008 16:57:11 -0000 1.10 --- plugins_api.h 29 Aug 2008 13:02:37 -0000 1.11 *************** *** 38,45 **** #define VAL2MASK(v) ((DWORD)(WORD)(v) << 16) #define MASK2VAL(m) ((WORD)((m) >> 16)) /*******************************************************************/ #define HUB_MSG_TYPE_EMPTY (0 | HUB_MSG_UNION_TYPE_NONE) #define HUB_MSG_TYPE_LINE_DATA (1 | HUB_MSG_UNION_TYPE_BUF) ! #define HUB_MSG_TYPE_CONNECT (2 | HUB_MSG_UNION_TYPE_VAL) #define HUB_MSG_TYPE_MODEM_STATUS (3 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_MASK_VAL) #define MODEM_STATUS_DCTS 0x01 --- 38,48 ---- #define VAL2MASK(v) ((DWORD)(WORD)(v) << 16) #define MASK2VAL(m) ((WORD)((m) >> 16)) + #define HUB_MSG_VAL_TYPE_BOOL 0x0200 + #define HUB_MSG_VAL_TYPE_MSG_TYPE 0x0300 + #define HUB_MSG_VAL_TYPE_UINT 0x0400 /*******************************************************************/ #define HUB_MSG_TYPE_EMPTY (0 | HUB_MSG_UNION_TYPE_NONE) #define HUB_MSG_TYPE_LINE_DATA (1 | HUB_MSG_UNION_TYPE_BUF) ! #define HUB_MSG_TYPE_CONNECT (2 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_BOOL) #define HUB_MSG_TYPE_MODEM_STATUS (3 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_MASK_VAL) #define MODEM_STATUS_DCTS 0x01 *************** *** 79,97 **** #define SO_V2O_PIN_STATE(v) ((DWORD)(BYTE)(v)) #define HUB_MSG_TYPE_FAIL_IN_OPTS (8 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_RBR_STATUS (9 | HUB_MSG_UNION_TYPE_VAL) #define HUB_MSG_TYPE_RLC_STATUS (10 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_COUNT_REPEATS (11 | HUB_MSG_UNION_TYPE_PVAL) #define HUB_MSG_TYPE_GET_ESC_OPTS (12 | HUB_MSG_UNION_TYPE_PVAL) ! #define ESC_OPTS_O2V_MST(o) GO_O2V_MODEM_STATUS(o) ! #define ESC_OPTS_V2O_MST(v) GO_V2O_MODEM_STATUS(v) ! #define ESC_OPTS_O2V_LSR(o) GO_O2V_LINE_STATUS(o) ! #define ESC_OPTS_V2O_LSR(v) GO_V2O_LINE_STATUS(v) ! #define ESC_OPTS_RBR_STATUS GO_RBR_STATUS ! #define ESC_OPTS_RLC_STATUS GO_RLC_STATUS ! #define ESC_OPTS_BREAK_STATUS GO_BREAK_STATUS #define ESC_OPTS_O2V_ESCCHAR(o) ((BYTE)(o >> 24)) #define ESC_OPTS_V2O_ESCCHAR(v) ((DWORD)(BYTE)(v) << 24) #define HUB_MSG_TYPE_FAIL_ESC_OPTS (13 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_BREAK_STATUS (14 | HUB_MSG_UNION_TYPE_VAL) /*******************************************************************/ typedef struct _HUB_MSG { --- 82,95 ---- #define SO_V2O_PIN_STATE(v) ((DWORD)(BYTE)(v)) #define HUB_MSG_TYPE_FAIL_IN_OPTS (8 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_RBR_STATUS (9 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_UINT) #define HUB_MSG_TYPE_RLC_STATUS (10 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_COUNT_REPEATS (11 | HUB_MSG_UNION_TYPE_PVAL | HUB_MSG_VAL_TYPE_MSG_TYPE) #define HUB_MSG_TYPE_GET_ESC_OPTS (12 | HUB_MSG_UNION_TYPE_PVAL) ! #define ESC_OPTS_MAP_EO2GO(eo) ((DWORD)(eo) & 0x00FFFFFF) ! #define ESC_OPTS_MAP_GO2EO(go) ((DWORD)(go) & 0x00FFFFFF) #define ESC_OPTS_O2V_ESCCHAR(o) ((BYTE)(o >> 24)) #define ESC_OPTS_V2O_ESCCHAR(v) ((DWORD)(BYTE)(v) << 24) #define HUB_MSG_TYPE_FAIL_ESC_OPTS (13 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_BREAK_STATUS (14 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_BOOL) /*******************************************************************/ typedef struct _HUB_MSG { |
From: Vyacheslav F. <vf...@us...> - 2008-08-29 13:02:42
|
Update of /cvsroot/com0com/hub4com/plugins/escparse In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27988/escparse Modified Files: filter.cpp Log Message: Added ESC_OPTS_MAP_EO2GO() and ESC_OPTS_MAP_GO2EO() Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/escparse/filter.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** filter.cpp 22 Aug 2008 17:02:59 -0000 1.1 --- filter.cpp 29 Aug 2008 13:02:37 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2008/08/29 13:02:37 vfrolov + * Added ESC_OPTS_MAP_EO2GO() and ESC_OPTS_MAP_GO2EO() + * * Revision 1.1 2008/08/22 17:02:59 vfrolov * Initial revision *************** *** 405,428 **** } /////////////////////////////////////////////////////////////// - inline DWORD go2esc(DWORD goOpts) - { - return - ESC_OPTS_V2O_MST(GO_O2V_MODEM_STATUS(goOpts)) | - ESC_OPTS_V2O_LSR(GO_O2V_LINE_STATUS(goOpts)) | - ((goOpts & GO_RBR_STATUS) ? ESC_OPTS_RBR_STATUS : 0) | - ((goOpts & GO_RLC_STATUS) ? ESC_OPTS_RLC_STATUS : 0) | - ((goOpts & GO_BREAK_STATUS) ? ESC_OPTS_BREAK_STATUS : 0); - } - - inline DWORD esc2go(DWORD escOpts) - { - return - GO_V2O_MODEM_STATUS(ESC_OPTS_O2V_MST(escOpts)) | - GO_V2O_LINE_STATUS(ESC_OPTS_O2V_LSR(escOpts)) | - ((escOpts & ESC_OPTS_RBR_STATUS) ? GO_RBR_STATUS : 0) | - ((escOpts & ESC_OPTS_RLC_STATUS) ? GO_RLC_STATUS : 0) | - ((escOpts & ESC_OPTS_BREAK_STATUS) ? GO_BREAK_STATUS : 0); - } - static BOOL CALLBACK InMethod( HFILTER hFilter, --- 408,411 ---- *************** *** 488,492 **** return FALSE; ! *pInMsg->u.pv.pVal = go2esc(pEscParse->Options()) | ESC_OPTS_V2O_ESCCHAR(((Filter *)hFilter)->escapeChar); --- 471,475 ---- return FALSE; ! *pInMsg->u.pv.pVal = ESC_OPTS_MAP_GO2EO(pEscParse->Options()) | ESC_OPTS_V2O_ESCCHAR(((Filter *)hFilter)->escapeChar); *************** *** 502,506 **** return FALSE; ! DWORD fail_options = (pInMsg->u.val & go2esc(pEscParse->Options())); if (fail_options) { --- 485,489 ---- return FALSE; ! DWORD fail_options = (pInMsg->u.val & ESC_OPTS_MAP_GO2EO(pEscParse->Options())); if (fail_options) { *************** *** 510,514 **** << " not accepted" << endl; ! pEscParse->OptionsDel(esc2go(fail_options)); } --- 493,497 ---- << " not accepted" << endl; ! pEscParse->OptionsDel(ESC_OPTS_MAP_EO2GO(fail_options)); } |
From: Vyacheslav F. <vf...@us...> - 2008-08-28 16:07:13
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18456 Modified Files: comport.cpp Log Message: Tracing of HUB_MSG_TYPE_SET_PIN_STATE moved to the trace filter Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** comport.cpp 22 Aug 2008 16:57:12 -0000 1.9 --- comport.cpp 28 Aug 2008 16:07:09 -0000 1.10 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2008/08/28 16:07:09 vfrolov + * Tracing of HUB_MSG_TYPE_SET_PIN_STATE moved to the trace filter + * * Revision 1.9 2008/08/22 16:57:12 vfrolov * Added *************** *** 371,383 **** } - static FIELD2NAME codeNameTableSetPinState[] = { - TOFIELD2NAME2(PIN_STATE_, RTS), - TOFIELD2NAME2(PIN_STATE_, DTR), - TOFIELD2NAME2(PIN_STATE_, OUT1), - TOFIELD2NAME2(PIN_STATE_, OUT2), - TOFIELD2NAME2(PIN_STATE_, BREAK), - {0, 0, NULL} - }; - BOOL ComPort::Write(HUB_MSG *pMsg) { --- 374,377 ---- *************** *** 450,462 **** return FALSE; ! WORD mask = MASK2VAL(pMsg->u.val); ! ! cout << name << " SET_PIN_STATE 0x" << hex << pMsg->u.val << dec << " SET[" ! << FieldToName(codeNameTableSetPinState, pMsg->u.val & mask) ! << "] CLR[" ! << FieldToName(codeNameTableSetPinState, ~pMsg->u.val & mask) ! << "]" << endl; ! ! mask &= maskOutPins; if (mask & PIN_STATE_RTS) { --- 444,448 ---- return FALSE; ! WORD mask = MASK2VAL(pMsg->u.val) & maskOutPins; if (mask & PIN_STATE_RTS) { |
From: Vyacheslav F. <vf...@us...> - 2008-08-28 15:53:17
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13325 Modified Files: hub4com.cpp utils.cpp utils.h Log Message: Added ability to load arguments from standard input and to select fragment for loading Index: utils.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/utils.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** utils.cpp 16 Apr 2008 14:07:12 -0000 1.3 --- utils.cpp 28 Aug 2008 15:53:13 -0000 1.4 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.4 2008/08/28 15:53:13 vfrolov + * Added ability to load arguments from standard input and + * to select fragment for loading + * * Revision 1.3 2008/04/16 14:07:12 vfrolov * Extended STRQTOK_R() *************** *** 85,100 **** char *pSave; ! char *pFile = STRQTOK_R(pTmp, ":", &pSave); ! if (!pFile || !*pFile) { ! cerr << "No file name in " << arg << endl; ! exit(1); } ! ifstream ifile(pFile); ! if (ifile.fail()) { ! cerr << "Can't open file " << pFile << endl; ! exit(1); } --- 89,124 ---- char *pSave; ! char *pFileSpec = STRQTOK_R(pTmp, ":", &pSave); ! char *pFile; ! char *pBegin; ! char *pEnd; ! ! if (pFileSpec) { ! char *pSave2; ! ! pFile = STRQTOK_R(pFileSpec, ",", &pSave2); ! pBegin = STRQTOK_R(NULL, ",", &pSave2); ! pEnd = STRQTOK_R(NULL, ",", &pSave2); ! } else { ! pFile = NULL; ! pBegin = NULL; ! pEnd = NULL; } ! ifstream ifile; ! istream *pInStream; ! if (pFile && *pFile) { ! ifile.open(pFile); ! ! if (ifile.fail()) { ! cerr << "Can't open file " << pFile << endl; ! exit(1); ! } ! ! pInStream = &ifile; ! } else { ! pInStream = &cin; } *************** *** 104,115 **** paramsLoad.push_back(p); ! free(pTmp); ! ! while (ifile.good()) { stringstream line; ! ifile.get(*line.rdbuf()); ! if (!ifile.fail()) { string str = line.str(); string::size_type first_non_space = string::npos; --- 128,137 ---- paramsLoad.push_back(p); ! while (pInStream->good()) { stringstream line; ! pInStream->get(*line.rdbuf()); ! if (!pInStream->fail()) { string str = line.str(); string::size_type first_non_space = string::npos; *************** *** 118,127 **** for (string::size_type i = 0 ; i < str.length() ; i++) { if (!isspace(str[i])) { ! if (first_non_space == string::npos) { ! if (str[i] == '#') ! break; ! first_non_space = i; - } last_non_space = i; --- 140,145 ---- for (string::size_type i = 0 ; i < str.length() ; i++) { if (!isspace(str[i])) { ! if (first_non_space == string::npos) first_non_space = i; last_non_space = i; *************** *** 132,135 **** --- 150,166 ---- str = str.substr(first_non_space, last_non_space + 1 - first_non_space); + if (pBegin && *pBegin) { + if (str == pBegin) + pBegin = NULL; + + continue; + } + + if (pEnd && *pEnd && str == pEnd) + break; + + if (str[0] == '#') + continue; + if (num_recursive > 256) { cerr << "Too many recursive options " << arg << endl; *************** *** 142,152 **** } } else { ! ifile.clear(); } char ch; ! ifile.get(ch); } } /////////////////////////////////////////////////////////////// --- 173,186 ---- } } else { ! if (!pInStream->eof()) ! pInStream->clear(); } char ch; ! pInStream->get(ch); } + + free(pTmp); } /////////////////////////////////////////////////////////////// *************** *** 161,171 **** } /////////////////////////////////////////////////////////////// ! char *STRTOK_R(char *pStr, const char *pDelims, char **ppSave) { if (!pStr) pStr = *ppSave; ! while (IsDelim(*pStr, pDelims)) ! pStr++; if (!*pStr) { --- 195,207 ---- } /////////////////////////////////////////////////////////////// ! char *STRTOK_R(char *pStr, const char *pDelims, char **ppSave, BOOL skipLeadingDelims) { if (!pStr) pStr = *ppSave; ! if (skipLeadingDelims) { ! while (IsDelim(*pStr, pDelims)) ! pStr++; ! } if (!*pStr) { *************** *** 192,202 **** char **ppSave, const char *pQuotes, ! BOOL discard) { if (!pStr) pStr = *ppSave; ! while (IsDelim(*pStr, pDelims)) ! pStr++; if (!*pStr) { --- 228,241 ---- char **ppSave, const char *pQuotes, ! BOOL discardQuotes, ! BOOL skipLeadingDelims) { if (!pStr) pStr = *ppSave; ! if (skipLeadingDelims) { ! while (IsDelim(*pStr, pDelims)) ! pStr++; ! } if (!*pStr) { *************** *** 212,216 **** if (quoted ? (*pStr == pQuotes[1]) : (*pStr == pQuotes[0])) { if (cntMask%2 == 0) { ! if (discard) memmove(pStr, pStr + 1, strlen(pStr + 1) + 1); quoted = !quoted; --- 251,255 ---- if (quoted ? (*pStr == pQuotes[1]) : (*pStr == pQuotes[0])) { if (cntMask%2 == 0) { ! if (discardQuotes) memmove(pStr, pStr + 1, strlen(pStr + 1) + 1); quoted = !quoted; *************** *** 321,327 **** char *pSave; ! for (argv[argc] = STRQTOK_R(pTmp, " ", &pSave) ; argv[argc] ; ! argv[argc] = STRQTOK_R(NULL, " ", &pSave)) { argc++; --- 360,366 ---- char *pSave; ! for (argv[argc] = STRQTOK_R(pTmp, " ", &pSave, "\"\"", TRUE, TRUE) ; argv[argc] ; ! argv[argc] = STRQTOK_R(NULL, " ", &pSave, "\"\"", TRUE, TRUE)) { argc++; Index: hub4com.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** hub4com.cpp 25 Aug 2008 08:15:02 -0000 1.12 --- hub4com.cpp 28 Aug 2008 15:53:13 -0000 1.13 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.13 2008/08/28 15:53:13 vfrolov + * Added ability to load arguments from standard input and + * to select fragment for loading + * * Revision 1.12 2008/08/25 08:15:02 vfrolov * Itilized TimerAPCProc() *************** *** 74,81 **** << endl << "Common options:" << endl ! << " --load=<file>[:<prms>] - load arguments from a file (one argument per line)" << endl ! << " and insert them to the command line. The syntax of" << endl ! << " <prms> is <PRM1>[,<PRM2>...], where <PRMn> will" << endl ! << " replace %%n%%." << endl << " --help - show this help." << endl << " --help=* - show help for all modules." << endl --- 78,91 ---- << endl << "Common options:" << endl ! << " --load=[<file>][,<begin>[,<end>]][:<prms>]" << endl ! << " - load arguments (one argument per line) between" << endl ! << " <begin> and <end> lines from a file <file> (use" << endl ! << " standard input if empty) and insert them into the" << endl ! << " command line. The syntax of <prms> is" << endl ! << " <PRM1>[,<PRM2>...], where <PRMn> will replace" << endl ! << " %%n%% in the arguments. Do loading since begining" << endl ! << " if <begin> is empty. Do loading till end-of-file" << endl ! << " if <end> is empty. Ignore arguments begining with" << endl ! << " '#'." << endl << " --help - show this help." << endl << " --help=* - show help for all modules." << endl *************** *** 136,139 **** --- 146,161 ---- << " " << pProgPath << " --echo-route=0 COM2" << endl << " - receive data from COM2 and send it back to COM2." << endl + << " " << pProgPath << " --load=" << endl + << " --echo-route=0" << endl + << " COM2" << endl + << " ^Z" << endl + << " - the same as above." << endl + << " " << pProgPath << " --load=,_BEGIN_,_END_" << endl + << " blah blah blah" << endl + << " _BEGIN_" << endl + << " --echo-route=0" << endl + << " COM2" << endl + << " _END_" << endl + << " - the same as above." << endl ; } *************** *** 513,526 **** } delete pPlugins; ! if (plugged < 2) { ! if (plugged < 1) { ! Usage(argv[0], *pPlugins); ! exit(1); ! } ! } ! else ! if (defaultRouteData) { Route(hub, "0:All", FALSE, FALSE, routeDataMap); Route(hub, "1:0", FALSE, FALSE, routeDataMap); --- 535,546 ---- } + if (plugged < 1) { + Usage(argv[0], *pPlugins); + exit(1); + } + delete pPlugins; ! if (plugged > 1 && defaultRouteData) { Route(hub, "0:All", FALSE, FALSE, routeDataMap); Route(hub, "1:0", FALSE, FALSE, routeDataMap); Index: utils.h =================================================================== RCS file: /cvsroot/com0com/hub4com/utils.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** utils.h 16 Apr 2008 14:07:12 -0000 1.3 --- utils.h 28 Aug 2008 15:53:13 -0000 1.4 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.4 2008/08/28 15:53:13 vfrolov + * Added ability to load arguments from standard input and + * to select fragment for loading + * * Revision 1.3 2008/04/16 14:07:12 vfrolov * Extended STRQTOK_R() *************** *** 49,53 **** }; /////////////////////////////////////////////////////////////// ! char *STRTOK_R(char *pStr, const char *pDelims, char **ppSave); char *STRQTOK_R( char *pStr, --- 53,57 ---- }; /////////////////////////////////////////////////////////////// ! char *STRTOK_R(char *pStr, const char *pDelims, char **ppSave, BOOL skipLeadingDelims = FALSE); char *STRQTOK_R( char *pStr, *************** *** 55,59 **** char **ppSave, const char *pQuotes = "\"\"", ! BOOL discard = TRUE); BOOL StrToInt(const char *pStr, int *pNum); const char *GetParam(const char *pArg, const char *pPattern); --- 59,64 ---- char **ppSave, const char *pQuotes = "\"\"", ! BOOL discardQuotes = TRUE, ! BOOL skipLeadingDelims = FALSE); BOOL StrToInt(const char *pStr, int *pNum); const char *GetParam(const char *pArg, const char *pPattern); |
From: Vyacheslav F. <vf...@us...> - 2008-08-28 10:31:30
|
Update of /cvsroot/com0com/hub4com/plugins/tcp In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23853 Modified Files: port.cpp tcp.vcproj Log Message: Removed linking with ../../utils.h and ../../utils.cpp Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/port.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** port.cpp 15 Aug 2008 12:44:59 -0000 1.4 --- port.cpp 28 Aug 2008 10:31:25 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/08/28 10:31:25 vfrolov + * Removed linking with ../../utils.h and ../../utils.cpp + * * Revision 1.4 2008/08/15 12:44:59 vfrolov * Added fake read filter method to ports *************** *** 38,44 **** #include "comport.h" #include "import.h" - #include "../../utils.h" /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { --- 41,56 ---- #include "comport.h" #include "import.h" /////////////////////////////////////////////////////////////// + static const char *GetParam(const char *pArg, const char *pPattern) + { + size_t lenPattern = strlen(pPattern); + + if (_strnicmp(pArg, pPattern, lenPattern) != 0) + return NULL; + + return pArg + lenPattern; + } + /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { Index: tcp.vcproj =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/tcp.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcp.vcproj 27 Mar 2008 17:19:18 -0000 1.1 --- tcp.vcproj 28 Aug 2008 10:31:25 -0000 1.2 *************** *** 208,215 **** > </File> - <File - RelativePath="..\..\utils.h" - > - </File> </Filter> <Filter --- 208,211 ---- *************** *** 258,265 **** </FileConfiguration> </File> - <File - RelativePath="..\..\utils.cpp" - > - </File> </Filter> </Files> --- 254,257 ---- |
From: Vyacheslav F. <vf...@us...> - 2008-08-28 10:24:47
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20870 Modified Files: comparams.cpp port.cpp serial.vcproj Log Message: Removed linking with ....utils.h and ....utils.cpp Index: comparams.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comparams.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** comparams.cpp 7 Apr 2008 12:28:03 -0000 1.2 --- comparams.cpp 28 Aug 2008 10:24:35 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/08/28 10:24:35 vfrolov + * Removed linking with ....utils.h and ....utils.cpp + * * Revision 1.2 2008/04/07 12:28:03 vfrolov * Replaced --rt-events option by SET_RT_EVENTS message *************** *** 39,48 **** * Initial revision * - * */ #include "precomp.h" #include "comparams.h" - #include "../../utils.h" /////////////////////////////////////////////////////////////// --- 42,49 ---- Index: serial.vcproj =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/serial.vcproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** serial.vcproj 20 Aug 2008 10:40:19 -0000 1.2 --- serial.vcproj 28 Aug 2008 10:24:35 -0000 1.3 *************** *** 210,217 **** > </File> - <File - RelativePath="..\..\utils.h" - > - </File> </Filter> <Filter --- 210,213 ---- *************** *** 260,267 **** </FileConfiguration> </File> - <File - RelativePath="..\..\utils.cpp" - > - </File> </Filter> </Files> --- 256,259 ---- Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/port.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** port.cpp 20 Aug 2008 14:30:19 -0000 1.7 --- port.cpp 28 Aug 2008 10:24:35 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2008/08/28 10:24:35 vfrolov + * Removed linking with ....utils.h and ....utils.cpp + * * Revision 1.7 2008/08/20 14:30:19 vfrolov * Redesigned serial port options *************** *** 47,53 **** #include "comport.h" #include "import.h" - #include "../../utils.h" /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { --- 50,65 ---- #include "comport.h" #include "import.h" /////////////////////////////////////////////////////////////// + static const char *GetParam(const char *pArg, const char *pPattern) + { + size_t lenPattern = strlen(pPattern); + + if (_strnicmp(pArg, pPattern, lenPattern) != 0) + return NULL; + + return pArg + lenPattern; + } + /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { |
From: Vyacheslav F. <vf...@us...> - 2008-08-27 11:38:33
|
Update of /cvsroot/com0com/hub4com/plugins/awakseq In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8901 Modified Files: filter.cpp Log Message: Fixed CONNECT(FALSE) losing Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/awakseq/filter.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** filter.cpp 20 Aug 2008 09:26:40 -0000 1.5 --- filter.cpp 27 Aug 2008 11:38:29 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/08/27 11:38:29 vfrolov + * Fixed CONNECT(FALSE) losing + * * Revision 1.5 2008/08/20 09:26:40 vfrolov * Fixed typo *************** *** 63,67 **** class State { public: ! State(const BYTE *pAwakSeq) : connectionCounter(0) { StartAwakSeq(pAwakSeq); } void StartAwakSeq(const BYTE *pAwakSeq) { --- 66,71 ---- class State { public: ! State(const BYTE *pAwakSeq) ! : connectSent(FALSE), connectionCounter(0) { StartAwakSeq(pAwakSeq); } void StartAwakSeq(const BYTE *pAwakSeq) { *************** *** 72,81 **** BOOL waitAwakSeq; const BYTE *pAwakSeqNext; int connectionCounter; }; /////////////////////////////////////////////////////////////// - typedef map<int, State*> PortsMap; - typedef pair<int, State*> PortPair; - class Filter { public: --- 76,83 ---- BOOL waitAwakSeq; const BYTE *pAwakSeqNext; + BOOL connectSent; int connectionCounter; }; /////////////////////////////////////////////////////////////// class Filter { public: *************** *** 86,89 **** --- 88,95 ---- private: + + typedef map<int, State*> PortsMap; + typedef pair<int, State*> PortPair; + PortsMap portsMap; }; *************** *** 254,257 **** --- 260,265 ---- pInMsg = pMsgReplaceVal(pInMsg, HUB_MSG_TYPE_CONNECT, TRUE); } + + pState->connectSent = TRUE; } else { pInMsg->u.buf.size = 0; *************** *** 272,276 **** // discard CONNECT(FALSE) from the input stream // if CONNECT(TRUE) was not added yet ! if (pState->waitAwakSeq) pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); --- 280,286 ---- // discard CONNECT(FALSE) from the input stream // if CONNECT(TRUE) was not added yet ! if (pState->connectSent) ! pState->connectSent = FALSE; ! else pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); |
From: Vyacheslav F. <vf...@us...> - 2008-08-26 14:28:52
|
Update of /cvsroot/com0com/hub4com/plugins/pinmap In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13153 Modified Files: filter.cpp Log Message: Removed option --break=break from default Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pinmap/filter.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** filter.cpp 25 Aug 2008 08:08:22 -0000 1.7 --- filter.cpp 26 Aug 2008 14:28:48 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2008/08/26 14:28:48 vfrolov + * Removed option --break=break from default + * * Revision 1.7 2008/08/25 08:08:22 vfrolov * Added init pin state *************** *** 84,94 **** }; /////////////////////////////////////////////////////////////// - #define LSR_BREAK_STATUS 0x01 - #define MST2LSRMST(m) ((WORD)((BYTE)(m))) #define LSR2LSRMST(l) ((WORD)(((WORD)(BYTE)(l)) << 8)) #define LSRMST2MST(lm) ((BYTE)(lm)) #define LSRMST2LSR(lm) ((BYTE)((lm) >> 8)) ! #define LSRMST2GO(lm) (GO_V2O_MODEM_STATUS(LSRMST2MST(lm)) | ((LSRMST2LSR(lm) & LSR_BREAK_STATUS) ? GO_BREAK_STATUS : 0)) static struct { --- 87,96 ---- }; /////////////////////////////////////////////////////////////// #define MST2LSRMST(m) ((WORD)((BYTE)(m))) #define LSR2LSRMST(l) ((WORD)(((WORD)(BYTE)(l)) << 8)) #define LSRMST2MST(lm) ((BYTE)(lm)) #define LSRMST2LSR(lm) ((BYTE)((lm) >> 8)) ! #define LSRMST2GO(lm) (GO_V2O_MODEM_STATUS(LSRMST2MST(lm)) | \ ! ((lm & LSR2LSRMST(LINE_STATUS_BI)) ? GO_BREAK_STATUS : 0)) static struct { *************** *** 100,104 **** {"dcd", MST2LSRMST(MODEM_STATUS_DCD)}, {"ring", MST2LSRMST(MODEM_STATUS_RI)}, ! {"break", LSR2LSRMST(LSR_BREAK_STATUS)}, }; /////////////////////////////////////////////////////////////// --- 102,106 ---- {"dcd", MST2LSRMST(MODEM_STATUS_DCD)}, {"ring", MST2LSRMST(MODEM_STATUS_RI)}, ! {"break", LSR2LSRMST(LINE_STATUS_BI)}, }; /////////////////////////////////////////////////////////////// *************** *** 160,164 **** Parse("rts=cts"); Parse("dtr=dsr"); - Parse("break=break"); } } --- 162,165 ---- *************** *** 274,283 **** << " --out1=[!]<s> - wire input state of <s> to output pin OUT1." << endl << " --out2=[!]<s> - wire input state of <s> to output pin OUT2." << endl ! << " --break=[!]<s> - wire input state of <s> to output pin BREAK." << endl << endl << " The possible values of <s> above can be cts, dsr, dcd, ring or break. The" << endl << " exclamation sign (!) can be used to invert the value. If no any wire option" << endl ! << " specified, then the options --rts=cts --dtr=dsr --break=break are used by" << endl ! << " default." << endl << endl << "OUT method input data stream description:" << endl --- 275,283 ---- << " --out1=[!]<s> - wire input state of <s> to output pin OUT1." << endl << " --out2=[!]<s> - wire input state of <s> to output pin OUT2." << endl ! << " --break=[!]<s> - wire input state of <s> to output state of BREAK." << endl << endl << " The possible values of <s> above can be cts, dsr, dcd, ring or break. The" << endl << " exclamation sign (!) can be used to invert the value. If no any wire option" << endl ! << " specified, then the options --rts=cts --dtr=dsr are used by default." << endl << endl << "OUT method input data stream description:" << endl *************** *** 428,437 **** lmInMask = MST2LSRMST(MASK2VAL(pOutMsg->u.val)); } else { ! lmInVal = (pOutMsg->u.val ? LSR2LSRMST(LSR_BREAK_STATUS) : 0); ! lmInMask = LSR2LSRMST(LSR_BREAK_STATUS); } lmInVal = ((lmInVal & lmInMask) | (pState->lmInVal & ~lmInMask)); - lmInVal &= ((Filter *)hFilter)->lmInMask; InsertPinState(*(Filter *)hFilter, pState->lmInVal ^ lmInVal, lmInVal, &pOutMsg); --- 428,437 ---- lmInMask = MST2LSRMST(MASK2VAL(pOutMsg->u.val)); } else { ! lmInVal = (pOutMsg->u.val ? LSR2LSRMST(LINE_STATUS_BI) : 0); ! lmInMask = LSR2LSRMST(LINE_STATUS_BI); } + lmInMask &= ((Filter *)hFilter)->lmInMask; lmInVal = ((lmInVal & lmInMask) | (pState->lmInVal & ~lmInMask)); InsertPinState(*(Filter *)hFilter, pState->lmInVal ^ lmInVal, lmInVal, &pOutMsg); |
From: Vyacheslav F. <vf...@us...> - 2008-08-26 14:23:35
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11017 Modified Files: comio.cpp Log Message: Added ability to SetEscMode() return LSR and MST for non com0com ports Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** comio.cpp 22 Aug 2008 16:57:11 -0000 1.6 --- comio.cpp 26 Aug 2008 14:23:31 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/08/26 14:23:31 vfrolov + * Added ability to SetEscMode() return LSR and MST for non com0com ports + * * Revision 1.6 2008/08/22 16:57:11 vfrolov * Added *************** *** 353,375 **** DWORD lenOutBufIoctl = 0; ! if (opts & C0CE_INSERT_IOCTL_GET) { ! if (opts & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_BI)) ! lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(UCHAR); ! if (opts & C0CE_INSERT_ENABLE_MST) ! lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(UCHAR); ! if (opts & C0CE_INSERT_ENABLE_RBR) ! lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(ULONG); ! if (opts & C0CE_INSERT_ENABLE_RLC) ! lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(UCHAR)*3; ! if (lenOutBufIoctl) { ! *ppBuf = pBufAlloc(lenOutBufIoctl); ! if (!*ppBuf) ! lenOutBufIoctl = 0; ! } } --- 356,376 ---- DWORD lenOutBufIoctl = 0; ! if (opts & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_BI)) ! lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(UCHAR); ! if (opts & C0CE_INSERT_ENABLE_MST) ! lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(UCHAR); ! if (opts & C0CE_INSERT_ENABLE_RBR) ! lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(ULONG); ! if (opts & C0CE_INSERT_ENABLE_RLC) ! lenOutBufIoctl += sizeof(UCHAR)*2 + sizeof(UCHAR)*3; ! if (lenOutBufIoctl) { ! *ppBuf = pBufAlloc(lenOutBufIoctl); ! if (!*ppBuf) ! lenOutBufIoctl = 0; } *************** *** 386,389 **** --- 387,412 ---- } + if (lenOutBufIoctl && (opts & C0CE_INSERT_IOCTL_GET) == 0) { + BYTE *pBuf = *ppBuf; + + if (opts & (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_LSR_BI)) { + *pBuf++ = escapeChar; + *pBuf++ = SERIAL_LSRMST_LSR_NODATA; + *pBuf++ = (LINE_STATUS_THRE | LINE_STATUS_TEMT); + } + + if (opts & C0CE_INSERT_ENABLE_MST) { + DWORD stat; + + if (::GetCommModemStatus(handle, &stat)) { + *pBuf++ = escapeChar; + *pBuf++ = SERIAL_LSRMST_MST; + *pBuf++ = (BYTE)stat; + } + } + + *pDone = (DWORD)(pBuf - *ppBuf); + } + if (opts & C0CE_INSERT_ENABLE_MST) escOptions &= ~ESC_OPTS_V2O_MST(MODEM_STATUS_BITS); |
From: Vyacheslav F. <vf...@us...> - 2008-08-26 14:07:04
|
Update of /cvsroot/com0com/hub4com/plugins/tcp In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv4161 Modified Files: comio.cpp comio.h Log Message: Execute OnEvent() in main thread context Index: comio.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/comio.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** comio.h 27 Mar 2008 17:17:27 -0000 1.1 --- comio.h 26 Aug 2008 14:07:01 -0000 1.2 *************** *** 20,27 **** * * $Log$ * Revision 1.1 2008/03/27 17:17:27 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2008/08/26 14:07:01 vfrolov + * Execute OnEvent() in main thread context + * * Revision 1.1 2008/03/27 17:17:27 vfrolov * Initial revision * */ *************** *** 88,91 **** --- 90,94 ---- PVOID pParameter, BOOLEAN timerOrWaitFired); + static VOID CALLBACK OnEvent(ULONG_PTR pOverlapped); ComPort &port; *************** *** 108,111 **** --- 111,115 ---- PVOID pParameter, BOOLEAN timerOrWaitFired); + static VOID CALLBACK OnEvent(ULONG_PTR pOverlapped); Listener &listener; Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/comio.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** comio.cpp 27 Mar 2008 17:17:27 -0000 1.1 --- comio.cpp 26 Aug 2008 14:07:01 -0000 1.2 *************** *** 20,27 **** * * $Log$ * Revision 1.1 2008/03/27 17:17:27 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2008/08/26 14:07:01 vfrolov + * Execute OnEvent() in main thread context + * * Revision 1.1 2008/03/27 17:17:27 vfrolov * Initial revision * */ *************** *** 115,119 **** u_short port = ntohs(snRemote.sin_port); ! cout << "Connect(" << hex << hSock << dec << ", " << ((addr >> 24) & 0xFF) << '.' << ((addr >> 16) & 0xFF) << '.' --- 117,121 ---- u_short port = ntohs(snRemote.sin_port); ! cout << "Connect(" << hex << hSock << dec << ", " << ((addr >> 24) & 0xFF) << '.' << ((addr >> 16) & 0xFF) << '.' *************** *** 266,269 **** --- 268,276 ---- } /////////////////////////////////////////////////////////////// + static HANDLE hThread = INVALID_HANDLE_VALUE; + #ifdef _DEBUG + static DWORD idThread; + #endif /* _DEBUG */ + /////////////////////////////////////////////////////////////// WaitEventOverlapped::WaitEventOverlapped(ComPort &_port, SOCKET hSockWait) : port(_port), *************** *** 271,274 **** --- 278,309 ---- hWait(INVALID_HANDLE_VALUE) { + #ifdef _DEBUG + if (hThread == INVALID_HANDLE_VALUE) { + idThread = ::GetCurrentThreadId(); + } else { + _ASSERTE(idThread == ::GetCurrentThreadId()); + } + #endif /* _DEBUG */ + + if (hThread == INVALID_HANDLE_VALUE) { + if (!::DuplicateHandle(::GetCurrentProcess(), + ::GetCurrentThread(), + ::GetCurrentProcess(), + &hThread, + 0, + FALSE, + DUPLICATE_SAME_ACCESS)) + { + hThread = INVALID_HANDLE_VALUE; + + TraceError( + GetLastError(), + "WaitEventOverlapped::WaitEventOverlapped(): DuplicateHandle() %s", + port.Name().c_str()); + + return; + } + } + hEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL); *************** *** 282,286 **** } ! if (!::RegisterWaitForSingleObject(&hWait, hEvent, OnEvent, this, INFINITE, WT_EXECUTEINIOTHREAD)) { TraceError( GetLastError(), --- 317,321 ---- } ! if (!::RegisterWaitForSingleObject(&hWait, hEvent, OnEvent, this, INFINITE, WT_EXECUTEINWAITTHREAD)) { TraceError( GetLastError(), *************** *** 335,338 **** --- 370,378 ---- BOOLEAN /*timerOrWaitFired*/) { + ::QueueUserAPC(OnEvent, hThread, (ULONG_PTR)pOverlapped); + } + + VOID CALLBACK WaitEventOverlapped::OnEvent(ULONG_PTR pOverlapped) + { WaitEventOverlapped *pOver = (WaitEventOverlapped *)pOverlapped; *************** *** 386,389 **** --- 426,456 ---- hWait(INVALID_HANDLE_VALUE) { + #ifdef _DEBUG + if (hThread == INVALID_HANDLE_VALUE) { + idThread = ::GetCurrentThreadId(); + } else { + _ASSERTE(idThread == ::GetCurrentThreadId()); + } + #endif /* _DEBUG */ + + if (hThread == INVALID_HANDLE_VALUE) { + if (!::DuplicateHandle(::GetCurrentProcess(), + ::GetCurrentThread(), + ::GetCurrentProcess(), + &hThread, + 0, + FALSE, + DUPLICATE_SAME_ACCESS)) + { + hThread = INVALID_HANDLE_VALUE; + + TraceError( + GetLastError(), + "ListenOverlapped::ListenOverlapped(): DuplicateHandle()"); + + return; + } + } + hEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL); *************** *** 396,400 **** } ! if (!::RegisterWaitForSingleObject(&hWait, hEvent, OnEvent, this, INFINITE, WT_EXECUTEINIOTHREAD)) { TraceError( GetLastError(), --- 463,467 ---- } ! if (!::RegisterWaitForSingleObject(&hWait, hEvent, OnEvent, this, INFINITE, WT_EXECUTEINWAITTHREAD)) { TraceError( GetLastError(), *************** *** 445,448 **** --- 512,520 ---- BOOLEAN /*timerOrWaitFired*/) { + ::QueueUserAPC(OnEvent, hThread, (ULONG_PTR)pOverlapped); + } + + VOID CALLBACK ListenOverlapped::OnEvent(ULONG_PTR pOverlapped) + { ListenOverlapped *pOver = (ListenOverlapped *)pOverlapped; |
From: Vyacheslav F. <vf...@us...> - 2008-08-25 14:19:05
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11714 Modified Files: handflow.c Log Message: Fixed SERIAL_TRANSMIT_TOGGLE Index: handflow.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/handflow.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** handflow.c 19 Aug 2008 12:40:58 -0000 1.10 --- handflow.c 25 Aug 2008 14:18:58 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2008/08/25 14:18:58 vfrolov + * Fixed SERIAL_TRANSMIT_TOGGLE + * * Revision 1.10 2008/08/19 12:40:58 vfrolov * Replaces C0CE_INSERT_ENABLE_LSR_NBI (insertion on BREAK OFF) *************** *** 305,310 **** UCHAR bits; ! if ((pIoPort->writeHolding & SERIAL_TX_WAITING_ON_BREAK) == 0 && ! (pIoPort->sendXonXoff || pIoPort->irpQueues[C0C_QUEUE_WRITE].pCurrent)) { bits = C0C_MCR_RTS; --- 308,315 ---- UCHAR bits; ! if ((pIoPort->writeHolding & SERIAL_TX_WAITING_ON_BREAK) != 0 || ! !C0C_TX_BUFFER_EMPTY(&pIoPort->txBuf) || ! (pIoPort->irpQueues[C0C_QUEUE_WRITE].pCurrent && !pIoPort->writeHolding) || ! (pIoPort->sendXonXoff && (pIoPort->writeHolding & ~SERIAL_TX_WAITING_FOR_XON) == 0)) { bits = C0C_MCR_RTS; |
From: Vyacheslav F. <vf...@us...> - 2008-08-25 08:15:06
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv26801 Modified Files: hub4com.cpp precomp.h Log Message: Itilized TimerAPCProc() Index: precomp.h =================================================================== RCS file: /cvsroot/com0com/hub4com/precomp.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** precomp.h 16 Apr 2008 14:09:41 -0000 1.4 --- precomp.h 25 Aug 2008 08:15:02 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/08/25 08:15:02 vfrolov + * Itilized TimerAPCProc() + * * Revision 1.4 2008/04/16 14:09:41 vfrolov * Included <set> *************** *** 37,40 **** --- 40,45 ---- #define _PRECOMP_H_ + #define _WIN32_WINNT 0x0500 + #include <windows.h> #include <crtdbg.h> Index: hub4com.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** hub4com.cpp 16 Apr 2008 14:13:59 -0000 1.11 --- hub4com.cpp 25 Aug 2008 08:15:02 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2008/08/25 08:15:02 vfrolov + * Itilized TimerAPCProc() + * * Revision 1.11 2008/04/16 14:13:59 vfrolov * Added ability to specify source posts for OUT method *************** *** 539,542 **** --- 542,553 ---- } /////////////////////////////////////////////////////////////// + static VOID CALLBACK TimerAPCProc( + LPVOID pArg, + DWORD /*dwTimerLowValue*/, + DWORD /*dwTimerHighValue*/) + { + ((ComHub *)pArg)->LostReport(); + } + /////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { *************** *** 546,561 **** if (hub.StartAll()) { ! DWORD nextReportTime = 0; ! for (;;) { ! SleepEx(5000, TRUE); ! DWORD time = GetTickCount(); ! if ((nextReportTime - time - 1) > 10000) { ! hub.LostReport(); ! nextReportTime = time + 5000; } } } --- 557,582 ---- if (hub.StartAll()) { ! HANDLE hTimer = ::CreateWaitableTimer(NULL, FALSE, NULL); ! if (hTimer) { ! LARGE_INTEGER firstReportTime; ! firstReportTime.QuadPart = -100000000; ! if (!::SetWaitableTimer(hTimer, &firstReportTime, 10000, TimerAPCProc, &hub, FALSE)) { ! DWORD err = GetLastError(); ! ! cerr << "WARNING: SetWaitableTimer() - error=" << err << endl; ! ! ::CloseHandle(hTimer); } + } else { + DWORD err = GetLastError(); + + cerr << "WARNING: CreateWaitableTimer() - error=" << err << endl; } + + for (;;) + ::SleepEx(INFINITE, TRUE); } |
From: Vyacheslav F. <vf...@us...> - 2008-08-25 08:08:27
|
Update of /cvsroot/com0com/hub4com/plugins/pinmap In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv24858 Modified Files: filter.cpp Log Message: Added init pin state Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pinmap/filter.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** filter.cpp 22 Aug 2008 16:57:11 -0000 1.6 --- filter.cpp 25 Aug 2008 08:08:22 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/08/25 08:08:22 vfrolov + * Added init pin state + * * Revision 1.6 2008/08/22 16:57:11 vfrolov * Added *************** *** 378,381 **** --- 381,393 ---- // or'e with the required mask to set pin state pOutMsg->u.val |= SO_V2O_PIN_STATE(((Filter *)hFilter)->outMask); + + State *pState = ((Filter *)hFilter)->GetState(nToPort); + + if (!pState) + return FALSE; + + // init pin state + InsertPinState(*(Filter *)hFilter, ((Filter *)hFilter)->lmInMask, pState->lmInVal, &pOutMsg); + break; } |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 17:06:00
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10324 Modified Files: hub4com.sln Log Message: Added filter-escparse project Index: hub4com.sln =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.sln,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** hub4com.sln 11 Aug 2008 07:28:42 -0000 1.7 --- hub4com.sln 22 Aug 2008 17:05:54 -0000 1.8 *************** *** 18,21 **** --- 18,23 ---- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-pinmap", "plugins\pinmap\pinmap.vcproj", "{DC90F370-D011-4C9A-BD59-6BDC9BC161C0}" EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filter-escparse", "plugins\escparse\escparse.vcproj", "{B56122ED-F2E6-4FA1-8E85-B8C606ED9400}" + EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution *************** *** 56,59 **** --- 58,65 ---- {DC90F370-D011-4C9A-BD59-6BDC9BC161C0}.Release|Win32.ActiveCfg = Release|Win32 {DC90F370-D011-4C9A-BD59-6BDC9BC161C0}.Release|Win32.Build.0 = Release|Win32 + {B56122ED-F2E6-4FA1-8E85-B8C606ED9400}.Debug|Win32.ActiveCfg = Debug|Win32 + {B56122ED-F2E6-4FA1-8E85-B8C606ED9400}.Debug|Win32.Build.0 = Debug|Win32 + {B56122ED-F2E6-4FA1-8E85-B8C606ED9400}.Release|Win32.ActiveCfg = Release|Win32 + {B56122ED-F2E6-4FA1-8E85-B8C606ED9400}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 17:03:03
|
Update of /cvsroot/com0com/hub4com/plugins/escparse In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9209 Added Files: .cvsignore filter.cpp precomp.cpp escparse.vcproj precomp.h Log Message: Initial revision --- NEW FILE: precomp.cpp --- /* * $Id: precomp.cpp,v 1.1 2008/08/22 17:02:59 vfrolov Exp $ * * Copyright (c) 2007-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /////////////////////////////////////////////////////////////// #include "precomp.h" /////////////////////////////////////////////////////////////// --- NEW FILE: precomp.h --- /* * $Id: precomp.h,v 1.1 2008/08/22 17:02:59 vfrolov Exp $ * * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: precomp.h,v $ * Revision 1.1 2008/08/22 17:02:59 vfrolov * Initial revision * */ #ifndef _PRECOMP_H_ #define _PRECOMP_H_ #include <windows.h> #include <crtdbg.h> #include <string> #include <map> #include <iostream> using namespace std; #pragma warning(disable:4512) // assignment operator could not be generated #endif /* _PRECOMP_H_ */ --- NEW FILE: .cvsignore --- *.user Release Debug --- NEW FILE: filter.cpp --- /* * $Id: filter.cpp,v 1.1 2008/08/22 17:02:59 vfrolov Exp $ * * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: filter.cpp,v $ * Revision 1.1 2008/08/22 17:02:59 vfrolov * Initial revision * */ #include "precomp.h" #include "../plugins_api.h" #include "../cncext.h" /////////////////////////////////////////////////////////////// #ifndef _DEBUG #define DEBUG_PARAM(par) #else /* _DEBUG */ #define DEBUG_PARAM(par) par #endif /* _DEBUG */ /////////////////////////////////////////////////////////////// static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal = NULL; static ROUTINE_MSG_INSERT_NONE *pMsgInsertNone = NULL; static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; static ROUTINE_MSG_INSERT_BUF *pMsgInsertBuf = NULL; static ROUTINE_MSG_REPLACE_BUF *pMsgReplaceBuf = NULL; static ROUTINE_PORT_NAME_A *pPortName = NULL; static ROUTINE_FILTER_NAME_A *pFilterName = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) { size_t lenPattern = strlen(pPattern); if (_strnicmp(pArg, pPattern, lenPattern) != 0) return NULL; return pArg + lenPattern; } /////////////////////////////////////////////////////////////// class Valid { public: Valid() : isValid(TRUE) {} void Invalidate() { isValid = FALSE; } BOOL IsValid() const { return isValid; } private: BOOL isValid; }; /////////////////////////////////////////////////////////////// class EscParse { public: EscParse(BYTE _escapeChar) : escMode(FALSE), intercepted_options(0), escapeChar(_escapeChar), maskMst(0), maskLsr(0), _options(0) { Reset(); } HUB_MSG *Convert(HUB_MSG *pMsg); DWORD Options() const { return _options; } void OptionsDel(DWORD opts) { _options &= ~opts; maskMst = GO_O2V_MODEM_STATUS(_options); maskLsr = GO_O2V_LINE_STATUS(_options); } void OptionsAdd(DWORD opts) { _options |= opts; maskMst = GO_O2V_MODEM_STATUS(_options); maskLsr = GO_O2V_LINE_STATUS(_options); } BOOL escMode; DWORD intercepted_options; private: void Reset() { state = subState = 0; } HUB_MSG *Flush(HUB_MSG *pMsg); BYTE escapeChar; WORD maskMst; WORD maskLsr; int state; BYTE code; int subState; BYTE data[sizeof(ULONG)]; basic_string<BYTE> line_data; DWORD _options; }; HUB_MSG *EscParse::Flush(HUB_MSG *pMsg) { if (!line_data.empty()) { pMsg = pMsgInsertBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, line_data.data(), (DWORD)line_data.size()); line_data.clear(); } return pMsg; } HUB_MSG *EscParse::Convert(HUB_MSG *pMsg) { if (!escMode) return pMsg; DWORD len = pMsg->u.buf.size; basic_string<BYTE> org(pMsg->u.buf.pBuf, len); const BYTE *pBuf = org.data(); // discard original data from the stream pMsg = pMsgReplaceBuf(pMsg, HUB_MSG_TYPE_LINE_DATA, NULL, 0); for (; len ; len--) { BYTE ch = *pBuf++; switch (state) { case 0: break; case 1: code = ch; state++; case 2: switch (code) { case SERIAL_LSRMST_ESCAPE: line_data.append(&escapeChar, 1); Reset(); break; case SERIAL_LSRMST_LSR_DATA: _ASSERTE(subState >= 0 && subState <= 2); if (subState == 0) { subState++; } else if (subState == 1) { data[0] = ch; // LSR subState++; } else if (subState == 2) { line_data.append(&ch, 1); if (Options() & GO_BREAK_STATUS) { pMsg = Flush(pMsg); pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_BREAK_STATUS, (data[0] & LINE_STATUS_BI) != 0); } if (maskLsr) { pMsg = Flush(pMsg); pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_LINE_STATUS, data[0] | VAL2MASK(maskLsr)); } Reset(); } else { cerr << "ERROR: SERIAL_LSRMST_LSR_DATA subState=" << subState << endl; Reset(); } break; case SERIAL_LSRMST_LSR_NODATA: _ASSERTE(subState >= 0 && subState <= 1); if (subState == 0) { subState++; } else if (subState == 1) { if (Options() & GO_BREAK_STATUS) { pMsg = Flush(pMsg); pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_BREAK_STATUS, (ch & LINE_STATUS_BI) != 0); } if (maskLsr) { pMsg = Flush(pMsg); pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_LINE_STATUS, ch | VAL2MASK(maskLsr)); } Reset(); } else { cerr << "ERROR: SERIAL_LSRMST_LSR_NODATA subState=" << subState << endl; Reset(); } break; case SERIAL_LSRMST_MST: _ASSERTE(subState >= 0 && subState <= 1); if (subState == 0) { subState++; } else if (subState == 1) { if (maskMst) { pMsg = Flush(pMsg); pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_MODEM_STATUS, ch | VAL2MASK(maskMst)); } Reset(); } else { cerr << "ERROR: SERIAL_LSRMST_MST subState=" << subState << endl; Reset(); } break; case C0CE_INSERT_RBR: _ASSERTE(subState >= 0 && subState < (sizeof(ULONG) + 1)); if (subState == 0) { subState++; } else if (subState >= 1 && subState < (sizeof(ULONG) + 1)) { data[subState - 1] = ch; if (subState < sizeof(ULONG)) { subState++; } else { if (Options() & GO_RBR_STATUS) { pMsg = Flush(pMsg); pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_RBR_STATUS, *(ULONG *)data); } Reset(); } } else { cerr << "ERROR: C0CE_INSERT_RBR subState=" << subState << endl; Reset(); } break; case C0CE_INSERT_RLC: _ASSERTE(subState >= 0 && subState <= 3); if (subState == 0) { subState++; } else if (subState >= 1 && subState <= 3) { data[subState - 1] = ch; if (subState < 3) { subState++; } else { if (Options() & GO_RLC_STATUS) { pMsg = Flush(pMsg); pMsg = pMsgInsertVal(pMsg, HUB_MSG_TYPE_RLC_STATUS, *(ULONG *)data); } Reset(); } } else { cerr << "ERROR: C0CE_INSERT_RLC subState=" << subState << endl; _ASSERTE(FALSE); Reset(); } break; default: cerr << "ERROR: SERIAL_LSRMST_" << (WORD)code << " subState=" << subState << endl; Reset(); } continue; default: cerr << "ERROR: state=" << state << endl; Reset(); } if (ch == escapeChar) { state = 1; continue; } line_data.append(&ch, 1); } pMsg = Flush(pMsg); return pMsg; } /////////////////////////////////////////////////////////////// class Filter : public Valid { public: Filter(int argc, const char *const argv[]); void SetHub(HHUB _hHub) { hHub = _hHub; } EscParse *GetEscParse(int nPort); const char *PortName(int nPort) const { return pPortName(hHub, nPort); } const char *FilterName() const { return pFilterName(hHub, (HFILTER)this); } BOOL requestEscMode; BYTE escapeChar; DWORD acceptableOptions; private: HHUB hHub; typedef map<int, EscParse*> PortsMap; typedef pair<int, EscParse*> PortPair; PortsMap portsMap; }; Filter::Filter(int argc, const char *const argv[]) : requestEscMode(TRUE), escapeChar(0xFF), acceptableOptions( GO_RBR_STATUS | GO_RLC_STATUS | GO_BREAK_STATUS | GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1)), hHub(NULL) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { const char *pArg = GetParam(*pArgs, "--"); if (!pArg) { cerr << "Unknown option " << *pArgs << endl; Invalidate(); continue; } } } EscParse *Filter::GetEscParse(int nPort) { PortsMap::iterator iPair = portsMap.find(nPort); if (iPair == portsMap.end()) { portsMap.insert(PortPair(nPort, NULL)); iPair = portsMap.find(nPort); if (iPair == portsMap.end()) return NULL; } if (!iPair->second) iPair->second = new EscParse(escapeChar); return iPair->second; } /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { return PLUGIN_TYPE_FILTER; } /////////////////////////////////////////////////////////////// static const PLUGIN_ABOUT_A about = { sizeof(PLUGIN_ABOUT_A), "escparse", "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Escaped data stream parsing filter", }; static const PLUGIN_ABOUT_A * CALLBACK GetPluginAbout() { return &about; } /////////////////////////////////////////////////////////////// static void CALLBACK Help(const char *pProgPath) { cerr << "Usage:" << endl << " " << pProgPath << " ... --create-filter=" << GetPluginAbout()->pName << "[,<FID>][:<options>] ... --add-filters=<ports>:[...,]<FID>[,...] ..." << endl << endl << "Options:" << endl << endl << "Examples:" << endl << " " << pProgPath << " --create-filter=pinmap --create-filter=" << GetPluginAbout()->pName << " --add-filters=0,1:pinmap," << GetPluginAbout()->pName << " COM1 COM2" << endl << " - transfer data and signals between COM1 and COM2." << endl ; } /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { Filter *pFilter = new Filter(argc, argv); if (!pFilter) return NULL; if (!pFilter->IsValid()) { delete pFilter; return NULL; } return (HFILTER)pFilter; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK Init( HFILTER hFilter, HHUB hHub) { _ASSERTE(hFilter != NULL); _ASSERTE(hHub != NULL); ((Filter *)hFilter)->SetHub(hHub); return TRUE; } /////////////////////////////////////////////////////////////// inline DWORD go2esc(DWORD goOpts) { return ESC_OPTS_V2O_MST(GO_O2V_MODEM_STATUS(goOpts)) | ESC_OPTS_V2O_LSR(GO_O2V_LINE_STATUS(goOpts)) | ((goOpts & GO_RBR_STATUS) ? ESC_OPTS_RBR_STATUS : 0) | ((goOpts & GO_RLC_STATUS) ? ESC_OPTS_RLC_STATUS : 0) | ((goOpts & GO_BREAK_STATUS) ? ESC_OPTS_BREAK_STATUS : 0); } inline DWORD esc2go(DWORD escOpts) { return GO_V2O_MODEM_STATUS(ESC_OPTS_O2V_MST(escOpts)) | GO_V2O_LINE_STATUS(ESC_OPTS_O2V_LSR(escOpts)) | ((escOpts & ESC_OPTS_RBR_STATUS) ? GO_RBR_STATUS : 0) | ((escOpts & ESC_OPTS_RLC_STATUS) ? GO_RLC_STATUS : 0) | ((escOpts & ESC_OPTS_BREAK_STATUS) ? GO_BREAK_STATUS : 0); } static BOOL CALLBACK InMethod( HFILTER hFilter, int nFromPort, HUB_MSG *pInMsg, HUB_MSG ** DEBUG_PARAM(ppEchoMsg)) { _ASSERTE(hFilter != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); _ASSERTE(*ppEchoMsg == NULL); switch (pInMsg->type) { case HUB_MSG_TYPE_COUNT_REPEATS: if (pInMsg->u.pv.val == HUB_MSG_TYPE_GET_IN_OPTS) { // we need it twice to // - get interceptable options from subsequent filters // - accept the received options and request the escape mode (*pInMsg->u.pv.pVal)++; } break; case HUB_MSG_TYPE_GET_IN_OPTS: { EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(nFromPort); if (!pEscParse) return FALSE; // if the subsequent filters require interceptable options then // accept the received options and request the escape mode pEscParse->OptionsAdd((pEscParse->intercepted_options & ((Filter *)hFilter)->acceptableOptions)); if (((Filter *)hFilter)->requestEscMode) { if (pEscParse->Options() && (pInMsg->u.pv.val & GO_ESCAPE_MODE)) { pEscParse->escMode = TRUE; *pInMsg->u.pv.pVal |= GO_ESCAPE_MODE; // request the escape mode } } else { pEscParse->escMode = TRUE; } // get interceptable options from subsequent filters separately DWORD interceptable_options = (pInMsg->u.pv.val & (GO_ESCAPE_MODE | ((Filter *)hFilter)->acceptableOptions)); pInMsg->u.pv.val &= ~interceptable_options; pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); if (pInMsg) { pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; pInMsg->u.pv.pVal = &pEscParse->intercepted_options; pInMsg->u.pv.val = interceptable_options; } break; } case HUB_MSG_TYPE_GET_ESC_OPTS: { EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(nFromPort); if (!pEscParse) return FALSE; *pInMsg->u.pv.pVal = go2esc(pEscParse->Options()) | ESC_OPTS_V2O_ESCCHAR(((Filter *)hFilter)->escapeChar); // hide this message from subsequent filters pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); break; } case HUB_MSG_TYPE_FAIL_ESC_OPTS: { EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(nFromPort); if (!pEscParse) return FALSE; DWORD fail_options = (pInMsg->u.val & go2esc(pEscParse->Options())); if (fail_options) { cerr << ((Filter *)hFilter)->PortName(nFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " escape mode option(s) 0x" << hex << fail_options << dec << " not accepted" << endl; pEscParse->OptionsDel(esc2go(fail_options)); } // hide this message from subsequent filters pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); break; } case HUB_MSG_TYPE_FAIL_IN_OPTS: { EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(nFromPort); if (!pEscParse) return FALSE; if ((pInMsg->u.val & GO_ESCAPE_MODE) && ((Filter *)hFilter)->requestEscMode) { cerr << ((Filter *)hFilter)->PortName(nFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " option ESCAPE_MODE not accepted" << endl; pEscParse->escMode = FALSE; pEscParse->OptionsDel((DWORD)-1); } pInMsg->u.val &= ~GO_ESCAPE_MODE; // hide from subsequent filters DWORD fail_options = (pEscParse->intercepted_options & ~pEscParse->Options()); if (fail_options) { cerr << ((Filter *)hFilter)->PortName(nFromPort) << " WARNING: Intercepted option(s) 0x" << hex << fail_options << dec << " by filter " << ((Filter *)hFilter)->FilterName() << " will be ignored" << endl; // report not supported intercepted options to subsequent filters pInMsg->u.val |= fail_options; } break; } case HUB_MSG_TYPE_LINE_DATA: { _ASSERTE(pInMsg->u.buf.pBuf != NULL || pInMsg->u.buf.size == 0); if (pInMsg->u.buf.size == 0) return TRUE; EscParse *pEscParse = ((Filter *)hFilter)->GetEscParse(nFromPort); if (!pEscParse) return FALSE; pInMsg = pEscParse->Convert(pInMsg); break; } case HUB_MSG_TYPE_MODEM_STATUS: // discard any status settings controlled by this filter pInMsg->u.val &= ~VAL2MASK(GO_O2V_MODEM_STATUS(((Filter *)hFilter)->acceptableOptions)); break; case HUB_MSG_TYPE_LINE_STATUS: // discard any status settings controlled by this filter pInMsg->u.val &= ~VAL2MASK(GO_O2V_LINE_STATUS(((Filter *)hFilter)->acceptableOptions)); break; case HUB_MSG_TYPE_RBR_STATUS: if (((Filter *)hFilter)->acceptableOptions & GO_RBR_STATUS) { // discard any status settings controlled by this filter pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); } break; case HUB_MSG_TYPE_RLC_STATUS: if (((Filter *)hFilter)->acceptableOptions & GO_RLC_STATUS) { // discard any status settings controlled by this filter pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); } break; case HUB_MSG_TYPE_BREAK_STATUS: if (((Filter *)hFilter)->acceptableOptions & GO_BREAK_STATUS) { // discard any status settings controlled by this filter pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); } break; } return pInMsg != NULL; } /////////////////////////////////////////////////////////////// static const FILTER_ROUTINES_A routines = { sizeof(FILTER_ROUTINES_A), GetPluginType, GetPluginAbout, Help, NULL, // ConfigStart NULL, // Config NULL, // ConfigStop Create, Init, InMethod, NULL, // OutMethod }; static const PLUGIN_ROUTINES_A *const plugins[] = { (const PLUGIN_ROUTINES_A *)&routines, NULL }; /////////////////////////////////////////////////////////////// PLUGIN_INIT_A InitA; const PLUGIN_ROUTINES_A *const * CALLBACK InitA( const HUB_ROUTINES_A * pHubRoutines) { if (!ROUTINE_IS_VALID(pHubRoutines, pMsgInsertVal) || !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertNone) || !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceNone) || !ROUTINE_IS_VALID(pHubRoutines, pMsgInsertBuf) || !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceBuf) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || !ROUTINE_IS_VALID(pHubRoutines, pFilterName)) { return NULL; } pMsgInsertVal = pHubRoutines->pMsgInsertVal; pMsgInsertNone = pHubRoutines->pMsgInsertNone; pMsgReplaceNone = pHubRoutines->pMsgReplaceNone; pMsgInsertBuf = pHubRoutines->pMsgInsertBuf; pMsgReplaceBuf = pHubRoutines->pMsgReplaceBuf; pPortName = pHubRoutines->pPortName; pFilterName = pHubRoutines->pFilterName; return plugins; } /////////////////////////////////////////////////////////////// --- NEW FILE: escparse.vcproj --- <?xml version="1.0" encoding="windows-1251"?> <VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="filter-escparse" ProjectGUID="{B56122ED-F2E6-4FA1-8E85-B8C606ED9400}" RootNamespace="hub4com" Keyword="Win32Proj" > <Platforms> <Platform Name="Win32" /> </Platforms> <ToolFiles> </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="2" UseOfMFC="0" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" UsePrecompiledHeader="2" PrecompiledHeaderThrough="precomp.h" PrecompiledHeaderFile="$(IntDir)\precomp.pch" WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" OutputFile="..\..\$(OutDir)\plugins\$(ProjectName).dll" LinkIncremental="2" ModuleDefinitionFile="..\plugins.def" GenerateDebugInformation="true" SubSystem="1" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="Release" IntermediateDirectory="Release" ConfigurationType="2" UseOfMFC="0" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE" RuntimeLibrary="0" UsePrecompiledHeader="2" PrecompiledHeaderThrough="precomp.h" PrecompiledHeaderFile="$(IntDir)\precomp.pch" WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" OutputFile="..\..\$(OutDir)\plugins\$(ProjectName).dll" LinkIncremental="2" ModuleDefinitionFile="..\plugins.def" GenerateDebugInformation="true" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File RelativePath="..\cncext.h" > </File> <File RelativePath="..\plugins_api.h" > </File> <File RelativePath=".\precomp.h" > </File> </Filter> <Filter Name="Source Files" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File RelativePath=".\filter.cpp" > </File> <File RelativePath="..\plugins.def" > </File> <File RelativePath=".\precomp.cpp" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCLCompilerTool" UsePrecompiledHeader="1" /> </FileConfiguration> <FileConfiguration Name="Release|Win32" > <Tool Name="VCCLCompilerTool" UsePrecompiledHeader="1" /> </FileConfiguration> </File> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 16:58:33
|
Update of /cvsroot/com0com/hub4com/plugins/escparse In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7644/escparse Log Message: Directory /cvsroot/com0com/hub4com/plugins/escparse added to the repository |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 16:57:17
|
Update of /cvsroot/com0com/hub4com/plugins/pin2con In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7231/pin2con Modified Files: filter.cpp Log Message: Added HUB_MSG_TYPE_GET_ESC_OPTS HUB_MSG_TYPE_FAIL_ESC_OPTS HUB_MSG_TYPE_BREAK_STATUS Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pin2con/filter.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** filter.cpp 22 Aug 2008 12:45:34 -0000 1.7 --- filter.cpp 22 Aug 2008 16:57:11 -0000 1.8 *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.8 2008/08/22 16:57:11 vfrolov + * Added + * HUB_MSG_TYPE_GET_ESC_OPTS + * HUB_MSG_TYPE_FAIL_ESC_OPTS + * HUB_MSG_TYPE_BREAK_STATUS + * * Revision 1.7 2008/08/22 12:45:34 vfrolov * Added masking to HUB_MSG_TYPE_MODEM_STATUS and HUB_MSG_TYPE_LINE_STATUS *************** *** 105,109 **** {"dcd", GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)}, {"ring", GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)}, ! {"break", GO_V2O_LINE_STATUS(LINE_STATUS_BI)}, }; --- 111,115 ---- {"dcd", GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)}, {"ring", GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)}, ! {"break", GO_BREAK_STATUS}, }; *************** *** 231,234 **** --- 237,260 ---- } /////////////////////////////////////////////////////////////// + static HUB_MSG *InsertConnectState( + Filter &filter, + int nFromPort, + HUB_MSG *pInMsg, + BOOL pinState) + { + State *pState = filter.GetState(nFromPort); + + if (!pState) + return FALSE; + + if (filter.negative) + pinState = !pinState; + + if (pState->connect != pinState) + pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_CONNECT, pState->connect = pinState); + + return pInMsg; + } + static BOOL CALLBACK InMethod( HFILTER hFilter, *************** *** 264,268 **** break; case HUB_MSG_TYPE_LINE_STATUS: ! case HUB_MSG_TYPE_MODEM_STATUS: WORD pin; --- 290,294 ---- break; case HUB_MSG_TYPE_LINE_STATUS: ! case HUB_MSG_TYPE_MODEM_STATUS: { WORD pin; *************** *** 276,298 **** break; ! BOOL connect = ((pInMsg->u.val & pin) != 0); ! ! if (((Filter *)hFilter)->negative) ! connect = !connect; ! ! State *pState = ((Filter *)hFilter)->GetState(nFromPort); ! ! if (!pState) ! return FALSE; ! ! if (pState->connect != connect) { ! pState->connect = connect; ! if (connect) { ! pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_CONNECT, TRUE); ! } else { ! pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_CONNECT, FALSE); ! } ! } break; } --- 302,312 ---- break; ! pInMsg = InsertConnectState(*((Filter *)hFilter), nFromPort, pInMsg, ((pInMsg->u.val & pin) != 0)); ! break; ! } ! case HUB_MSG_TYPE_BREAK_STATUS: ! if (((Filter *)hFilter)->pin & GO_BREAK_STATUS) ! pInMsg = InsertConnectState(*((Filter *)hFilter), nFromPort, pInMsg, pInMsg->u.val != 0); break; } |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 16:57:17
|
Update of /cvsroot/com0com/hub4com/plugins In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7231 Modified Files: plugins_api.h Log Message: Added HUB_MSG_TYPE_GET_ESC_OPTS HUB_MSG_TYPE_FAIL_ESC_OPTS HUB_MSG_TYPE_BREAK_STATUS Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** plugins_api.h 22 Aug 2008 12:45:34 -0000 1.9 --- plugins_api.h 22 Aug 2008 16:57:11 -0000 1.10 *************** *** 71,77 **** #define GO_O2V_LINE_STATUS(o) ((BYTE)((o) >> 8)) #define GO_V2O_LINE_STATUS(v) ((DWORD)(BYTE)(v) << 8) ! #define GO_ESCAPE_MODE 0x00010000 ! #define GO_RBR_STATUS 0x00020000 ! #define GO_RLC_STATUS 0x00040000 #define HUB_MSG_TYPE_SET_OUT_OPTS (7 | HUB_MSG_UNION_TYPE_VAL) #define SO_O2V_PIN_STATE(o) ((BYTE)(o)) --- 71,78 ---- #define GO_O2V_LINE_STATUS(o) ((BYTE)((o) >> 8)) #define GO_V2O_LINE_STATUS(v) ((DWORD)(BYTE)(v) << 8) ! #define GO_RBR_STATUS ((DWORD)1 << 16) ! #define GO_RLC_STATUS ((DWORD)1 << 17) ! #define GO_BREAK_STATUS ((DWORD)1 << 18) ! #define GO_ESCAPE_MODE ((DWORD)1 << 24) #define HUB_MSG_TYPE_SET_OUT_OPTS (7 | HUB_MSG_UNION_TYPE_VAL) #define SO_O2V_PIN_STATE(o) ((BYTE)(o)) *************** *** 81,84 **** --- 82,97 ---- #define HUB_MSG_TYPE_RLC_STATUS (10 | HUB_MSG_UNION_TYPE_VAL) #define HUB_MSG_TYPE_COUNT_REPEATS (11 | HUB_MSG_UNION_TYPE_PVAL) + #define HUB_MSG_TYPE_GET_ESC_OPTS (12 | HUB_MSG_UNION_TYPE_PVAL) + #define ESC_OPTS_O2V_MST(o) GO_O2V_MODEM_STATUS(o) + #define ESC_OPTS_V2O_MST(v) GO_V2O_MODEM_STATUS(v) + #define ESC_OPTS_O2V_LSR(o) GO_O2V_LINE_STATUS(o) + #define ESC_OPTS_V2O_LSR(v) GO_V2O_LINE_STATUS(v) + #define ESC_OPTS_RBR_STATUS GO_RBR_STATUS + #define ESC_OPTS_RLC_STATUS GO_RLC_STATUS + #define ESC_OPTS_BREAK_STATUS GO_BREAK_STATUS + #define ESC_OPTS_O2V_ESCCHAR(o) ((BYTE)(o >> 24)) + #define ESC_OPTS_V2O_ESCCHAR(v) ((DWORD)(BYTE)(v) << 24) + #define HUB_MSG_TYPE_FAIL_ESC_OPTS (13 | HUB_MSG_UNION_TYPE_VAL) + #define HUB_MSG_TYPE_BREAK_STATUS (14 | HUB_MSG_UNION_TYPE_VAL) /*******************************************************************/ typedef struct _HUB_MSG { |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 16:57:17
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7231/serial Modified Files: comio.cpp comio.h comport.cpp comport.h Log Message: Added HUB_MSG_TYPE_GET_ESC_OPTS HUB_MSG_TYPE_FAIL_ESC_OPTS HUB_MSG_TYPE_BREAK_STATUS Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** comport.cpp 22 Aug 2008 12:45:34 -0000 1.8 --- comport.cpp 22 Aug 2008 16:57:12 -0000 1.9 *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.9 2008/08/22 16:57:12 vfrolov + * Added + * HUB_MSG_TYPE_GET_ESC_OPTS + * HUB_MSG_TYPE_FAIL_ESC_OPTS + * HUB_MSG_TYPE_BREAK_STATUS + * * Revision 1.8 2008/08/22 12:45:34 vfrolov * Added masking to HUB_MSG_TYPE_MODEM_STATUS and HUB_MSG_TYPE_LINE_STATUS *************** *** 84,93 **** filterX(FALSE), maskOutPins(0), ! options(0), writeQueueLimit(256), writeQueued(0), writeLost(0), writeLostTotal(0), ! errors(0) { filterX = comParams.InX(); --- 90,101 ---- filterX(FALSE), maskOutPins(0), ! maskMst(0), ! intercepted_options(0), writeQueueLimit(256), writeQueued(0), writeLost(0), writeLostTotal(0), ! errors(0), ! _inOptions(0) { filterX = comParams.InX(); *************** *** 171,174 **** --- 179,207 ---- }; + static void WarnIgnoredInOptions( + const char *pHead, + const char *pTail, + DWORD options, + BYTE optsMst, + BYTE optsLsr) + { + if (optsMst) { + cerr << pHead << " WARNING: Changing of MODEM STATUS bit(s) 0x" + << hex << (unsigned)optsMst << dec << " [" + << FieldToName(codeNameTableModemStatus, optsMst) + << "] will be ignored by driver" << pTail << endl; + } + + if (optsLsr) { + cerr << pHead << " WARNING: Changing of LINE STATUS bit(s) 0x" + << hex << (unsigned)optsLsr << dec << " [" + << FieldToName(codeNameTableLineStatus, optsLsr) + << "] will be ignored by driver" << pTail << endl; + } + + cerr << pHead << " WARNING: Requested option(s) 0x" + << hex << options << dec << " will be ignored by driver" << pTail << endl; + } + static FIELD2NAME codeNameTableComEvents[] = { TOFIELD2NAME2(EV_, CTS), *************** *** 190,242 **** BYTE *pBuf = NULL; DWORD done = 0; ! if (options & GO_ESCAPE_MODE) { ! options = SetEscMode(handle, options, 'a'/*0xFF*/, &pBuf, &done); ! } else { ! if ((options & GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)) != 0) ! events |= EV_CTS; ! if ((options & GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)) != 0) ! events |= EV_DSR; ! if ((options & GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)) != 0) ! events |= EV_RLSD; ! if ((options & GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)) != 0) ! events |= EV_RING; ! options &= ~GO_V2O_MODEM_STATUS( ! MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI); ! } ! BYTE optsMst = GO_O2V_MODEM_STATUS(options); ! if (optsMst) { ! cerr << name << " WARNING: Changing of MODEM STATUS bit(s) 0x" ! << hex << (unsigned)optsMst << dec << " [" ! << FieldToName(codeNameTableModemStatus, optsMst) ! << "] will be ignored" << endl; } ! BYTE optsLsr = GO_O2V_LINE_STATUS(options); ! if (optsLsr) { ! cerr << name << " WARNING: Changing of LINE STATUS bit(s) 0x" ! << hex << (unsigned)optsLsr << dec << " [" ! << FieldToName(codeNameTableLineStatus, optsLsr) ! << "] will be ignored" << endl; } ! HUB_MSG msg; ! if (options) { ! cerr << name << " WARNING: Requested option(s) 0x" ! << hex << options << dec << " will be ignored" << endl; ! msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; ! msg.u.val = options; ! pOnRead(hHub, hMasterPort, &msg); } if (events) { if (!SetComEvents(handle, &events) || !StartWaitCommEvent()) { --- 223,286 ---- BYTE *pBuf = NULL; DWORD done = 0; + HUB_MSG msg; ! if (intercepted_options & GO_ESCAPE_MODE) { ! DWORD escapeOptions = 0; ! msg.type = HUB_MSG_TYPE_GET_ESC_OPTS; ! msg.u.pv.pVal = &escapeOptions; ! pOnRead(hHub, hMasterPort, &msg); ! escapeOptions = SetEscMode(handle, escapeOptions, &pBuf, &done); ! if ((escapeOptions & ESC_OPTS_V2O_ESCCHAR(-1)) == 0) { ! InOptionsAdd(GO_ESCAPE_MODE); ! if (escapeOptions) { ! WarnIgnoredInOptions(name.c_str(), " (escape mode)", ! escapeOptions, ! ESC_OPTS_O2V_MST(escapeOptions), ! ESC_OPTS_O2V_LSR(escapeOptions)); ! msg.type = HUB_MSG_TYPE_FAIL_ESC_OPTS; ! msg.u.val = escapeOptions; ! pOnRead(hHub, hMasterPort, &msg); ! } ! } ! } ! if (intercepted_options & GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)) { ! events |= EV_CTS; ! InOptionsAdd(GO_V2O_MODEM_STATUS(MODEM_STATUS_CTS)); } ! if (intercepted_options & GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)) { ! events |= EV_DSR; ! InOptionsAdd(GO_V2O_MODEM_STATUS(MODEM_STATUS_DSR)); ! } ! if (intercepted_options & GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)) { ! events |= EV_RLSD; ! InOptionsAdd(GO_V2O_MODEM_STATUS(MODEM_STATUS_DCD)); } ! if (intercepted_options & GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)) { ! events |= EV_RING; ! InOptionsAdd(GO_V2O_MODEM_STATUS(MODEM_STATUS_RI)); ! } ! DWORD fail_options = (intercepted_options & ~InOptions()); ! if (fail_options) { ! WarnIgnoredInOptions(name.c_str(), "", ! fail_options, ! GO_O2V_MODEM_STATUS(fail_options), ! GO_O2V_LINE_STATUS(fail_options)); } + msg.type = HUB_MSG_TYPE_FAIL_IN_OPTS; + msg.u.val = fail_options; + pOnRead(hHub, hMasterPort, &msg); + if (events) { if (!SetComEvents(handle, &events) || !StartWaitCommEvent()) { *************** *** 250,255 **** } - CheckComEvents(DWORD(-1)); - if (!StartRead()) { pBufFree(pBuf); --- 294,297 ---- *************** *** 265,272 **** msg.u.buf.pBuf = pBuf; msg.u.buf.size = done; - pOnRead(hHub, hMasterPort, &msg); } return TRUE; } --- 307,315 ---- msg.u.buf.pBuf = pBuf; msg.u.buf.size = done; pOnRead(hHub, hMasterPort, &msg); } + CheckComEvents(DWORD(-1)); + return TRUE; } *************** *** 304,317 **** if (pInMsg->type == HUB_MSG_TYPE_GET_IN_OPTS) { ! // get supported options from subsequent filters separately ! DWORD supported_options = pInMsg->u.pv.val & ( GO_ESCAPE_MODE | GO_RBR_STATUS | GO_RLC_STATUS | GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1)); ! pInMsg->u.pv.val &= ~supported_options; pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); --- 347,361 ---- if (pInMsg->type == HUB_MSG_TYPE_GET_IN_OPTS) { ! // get interceptable options from subsequent filters separately ! DWORD interceptable_options = (pInMsg->u.pv.val & GO_ESCAPE_MODE | GO_RBR_STATUS | GO_RLC_STATUS | + GO_BREAK_STATUS | GO_V2O_MODEM_STATUS(-1) | GO_V2O_LINE_STATUS(-1)); ! pInMsg->u.pv.val &= ~interceptable_options; pInMsg = pMsgInsertNone(pInMsg, HUB_MSG_TYPE_EMPTY); *************** *** 319,324 **** if (pInMsg) { pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; ! pInMsg->u.pv.pVal = &options; ! pInMsg->u.pv.val = supported_options; } } --- 363,368 ---- if (pInMsg) { pInMsg->type = HUB_MSG_TYPE_GET_IN_OPTS; ! pInMsg->u.pv.pVal = &intercepted_options; ! pInMsg->u.pv.val = interceptable_options; } } *************** *** 440,444 **** return FALSE; ! BYTE addedPins = (~maskOutPins & SO_O2V_PIN_STATE(pMsg->u.val)); if (addedPins & PIN_STATE_RTS) { --- 484,488 ---- return FALSE; ! WORD addedPins = (~maskOutPins & SO_O2V_PIN_STATE(pMsg->u.val)); if (addedPins & PIN_STATE_RTS) { *************** *** 558,562 **** void ComPort::CheckComEvents(DWORD eMask) { ! if ((eMask & (EV_CTS|EV_DSR|EV_RLSD|EV_RING)) != 0) { DWORD stat; --- 602,606 ---- void ComPort::CheckComEvents(DWORD eMask) { ! if (maskMst && (eMask & (EV_CTS|EV_DSR|EV_RLSD|EV_RING)) != 0) { DWORD stat; *************** *** 572,576 **** msg.type = HUB_MSG_TYPE_MODEM_STATUS; ! msg.u.val = ((DWORD)(BYTE)stat | VAL2MASK(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI)); pOnRead(hHub, hMasterPort, &msg); --- 616,620 ---- msg.type = HUB_MSG_TYPE_MODEM_STATUS; ! msg.u.val = ((DWORD)(BYTE)stat | VAL2MASK(maskMst)); pOnRead(hHub, hMasterPort, &msg); Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** comport.h 20 Aug 2008 14:30:19 -0000 1.7 --- comport.h 22 Aug 2008 16:57:12 -0000 1.8 *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.8 2008/08/22 16:57:12 vfrolov + * Added + * HUB_MSG_TYPE_GET_ESC_OPTS + * HUB_MSG_TYPE_FAIL_ESC_OPTS + * HUB_MSG_TYPE_BREAK_STATUS + * * Revision 1.7 2008/08/20 14:30:19 vfrolov * Redesigned serial port options *************** *** 106,111 **** int countXoff; BOOL filterX; ! BYTE maskOutPins; ! DWORD options; DWORD writeQueueLimit; --- 112,118 ---- int countXoff; BOOL filterX; ! WORD maskOutPins; ! WORD maskMst; ! DWORD intercepted_options; DWORD writeQueueLimit; *************** *** 114,117 **** --- 121,141 ---- DWORD writeLostTotal; DWORD errors; + + private: + DWORD _inOptions; + + DWORD InOptions() const { + return _inOptions; + } + + void InOptionsDel(DWORD opts) { + _inOptions &= ~opts; + maskMst = GO_O2V_MODEM_STATUS(_inOptions); + } + + void InOptionsAdd(DWORD opts) { + _inOptions |= opts; + maskMst = GO_O2V_MODEM_STATUS(_inOptions); + } }; /////////////////////////////////////////////////////////////// Index: comio.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** comio.h 20 Aug 2008 14:30:19 -0000 1.5 --- comio.h 22 Aug 2008 16:57:12 -0000 1.6 *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.6 2008/08/22 16:57:12 vfrolov + * Added + * HUB_MSG_TYPE_GET_ESC_OPTS + * HUB_MSG_TYPE_FAIL_ESC_OPTS + * HUB_MSG_TYPE_BREAK_STATUS + * * Revision 1.5 2008/08/20 14:30:19 vfrolov * Redesigned serial port options *************** *** 66,70 **** extern BOOL SetComEvents(HANDLE handle, DWORD *events); extern BOOL CommFunction(HANDLE handle, DWORD func); ! extern DWORD SetEscMode(HANDLE handle, DWORD options, BYTE escapeChar, BYTE **ppBuf, DWORD *pDone); /////////////////////////////////////////////////////////////// class ReadOverlapped : private OVERLAPPED --- 72,76 ---- extern BOOL SetComEvents(HANDLE handle, DWORD *events); extern BOOL CommFunction(HANDLE handle, DWORD func); ! extern DWORD SetEscMode(HANDLE handle, DWORD escOptions, BYTE **ppBuf, DWORD *pDone); /////////////////////////////////////////////////////////////// class ReadOverlapped : private OVERLAPPED Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** comio.cpp 20 Aug 2008 14:30:19 -0000 1.5 --- comio.cpp 22 Aug 2008 16:57:11 -0000 1.6 *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.6 2008/08/22 16:57:11 vfrolov + * Added + * HUB_MSG_TYPE_GET_ESC_OPTS + * HUB_MSG_TYPE_FAIL_ESC_OPTS + * HUB_MSG_TYPE_BREAK_STATUS + * * Revision 1.5 2008/08/20 14:30:19 vfrolov * Redesigned serial port options *************** *** 303,307 **** } ! DWORD SetEscMode(HANDLE handle, DWORD options, BYTE escapeChar, BYTE **ppBuf, DWORD *pDone) { _ASSERTE(ppBuf != NULL); --- 309,313 ---- } ! DWORD SetEscMode(HANDLE handle, DWORD escOptions, BYTE **ppBuf, DWORD *pDone) { _ASSERTE(ppBuf != NULL); *************** *** 310,328 **** _ASSERTE(*pDone == 0); if (!escapeChar) ! return options; ULONG opts = (C0CE_INSERT_IOCTL_GET|C0CE_INSERT_IOCTL_RXCLEAR); ! if (options & GO_V2O_MODEM_STATUS(-1)) opts |= C0CE_INSERT_ENABLE_MST; ! if (options & GO_V2O_LINE_STATUS(LINE_STATUS_BI)) opts |= C0CE_INSERT_ENABLE_LSR_BI; ! if (options & GO_RBR_STATUS) opts |= C0CE_INSERT_ENABLE_RBR; ! if (options & GO_RLC_STATUS) opts |= C0CE_INSERT_ENABLE_RLC; --- 316,342 ---- _ASSERTE(*pDone == 0); + BYTE escapeChar = ESC_OPTS_O2V_ESCCHAR(escOptions); + if (!escapeChar) ! return escOptions | ESC_OPTS_V2O_ESCCHAR(-1); ULONG opts = (C0CE_INSERT_IOCTL_GET|C0CE_INSERT_IOCTL_RXCLEAR); ! #define MODEM_STATUS_BITS (MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_RI|MODEM_STATUS_DCD) ! #define LINE_STATUS_BITS (LINE_STATUS_OE|LINE_STATUS_PE|LINE_STATUS_FE|LINE_STATUS_BI|LINE_STATUS_FIFOERR) ! ! if (escOptions & ESC_OPTS_V2O_MST(MODEM_STATUS_BITS)) opts |= C0CE_INSERT_ENABLE_MST; ! if (escOptions & ESC_OPTS_BREAK_STATUS) opts |= C0CE_INSERT_ENABLE_LSR_BI; ! if (escOptions & ESC_OPTS_V2O_LSR(LINE_STATUS_BITS)) ! opts |= C0CE_INSERT_ENABLE_LSR; ! ! if (escOptions & ESC_OPTS_RBR_STATUS) opts |= C0CE_INSERT_ENABLE_RBR; ! if (escOptions & ESC_OPTS_RLC_STATUS) opts |= C0CE_INSERT_ENABLE_RLC; *************** *** 330,334 **** if (!opts) ! return options; BYTE inBufIoctl[sizeof(UCHAR) + C0CE_SIGNATURE_SIZE + sizeof(ULONG)]; --- 344,348 ---- if (!opts) ! return escOptions | ESC_OPTS_V2O_ESCCHAR(-1); BYTE inBufIoctl[sizeof(UCHAR) + C0CE_SIGNATURE_SIZE + sizeof(ULONG)]; *************** *** 369,390 **** *pDone = 0; ! return options; } - options &= ~GO_ESCAPE_MODE; - if (opts & C0CE_INSERT_ENABLE_MST) ! options &= ~GO_V2O_MODEM_STATUS(-1); if (opts & C0CE_INSERT_ENABLE_LSR_BI) ! options &= ~GO_V2O_LINE_STATUS(LINE_STATUS_BI); if (opts & C0CE_INSERT_ENABLE_RBR) ! options &= ~GO_RBR_STATUS; if (opts & C0CE_INSERT_ENABLE_RLC) ! options &= ~GO_RLC_STATUS; ! return options; } /////////////////////////////////////////////////////////////// --- 383,405 ---- *pDone = 0; ! return escOptions | ESC_OPTS_V2O_ESCCHAR(-1); } if (opts & C0CE_INSERT_ENABLE_MST) ! escOptions &= ~ESC_OPTS_V2O_MST(MODEM_STATUS_BITS); if (opts & C0CE_INSERT_ENABLE_LSR_BI) ! escOptions &= ~ESC_OPTS_BREAK_STATUS; ! ! if (opts & C0CE_INSERT_ENABLE_LSR) ! escOptions &= ~ESC_OPTS_V2O_LSR(LINE_STATUS_BITS & ~LINE_STATUS_BI); if (opts & C0CE_INSERT_ENABLE_RBR) ! escOptions &= ~ESC_OPTS_RBR_STATUS; if (opts & C0CE_INSERT_ENABLE_RLC) ! escOptions &= ~ESC_OPTS_RLC_STATUS; ! return escOptions & ~ESC_OPTS_V2O_ESCCHAR(-1); } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 16:57:17
|
Update of /cvsroot/com0com/hub4com/plugins/pinmap In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7231/pinmap Modified Files: filter.cpp Log Message: Added HUB_MSG_TYPE_GET_ESC_OPTS HUB_MSG_TYPE_FAIL_ESC_OPTS HUB_MSG_TYPE_BREAK_STATUS Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pinmap/filter.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** filter.cpp 22 Aug 2008 12:45:34 -0000 1.5 --- filter.cpp 22 Aug 2008 16:57:11 -0000 1.6 *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.6 2008/08/22 16:57:11 vfrolov + * Added + * HUB_MSG_TYPE_GET_ESC_OPTS + * HUB_MSG_TYPE_FAIL_ESC_OPTS + * HUB_MSG_TYPE_BREAK_STATUS + * * Revision 1.5 2008/08/22 12:45:34 vfrolov * Added masking to HUB_MSG_TYPE_MODEM_STATUS and HUB_MSG_TYPE_LINE_STATUS *************** *** 75,83 **** }; /////////////////////////////////////////////////////////////// #define MST2LSRMST(m) ((WORD)((BYTE)(m))) #define LSR2LSRMST(l) ((WORD)(((WORD)(BYTE)(l)) << 8)) #define LSRMST2MST(lm) ((BYTE)(lm)) #define LSRMST2LSR(lm) ((BYTE)((lm) >> 8)) ! #define LSRMST2GO(lm) (GO_V2O_MODEM_STATUS(LSRMST2MST(lm)) | GO_V2O_LINE_STATUS(LSRMST2LSR(lm))) static struct { --- 81,91 ---- }; /////////////////////////////////////////////////////////////// + #define LSR_BREAK_STATUS 0x01 + #define MST2LSRMST(m) ((WORD)((BYTE)(m))) #define LSR2LSRMST(l) ((WORD)(((WORD)(BYTE)(l)) << 8)) #define LSRMST2MST(lm) ((BYTE)(lm)) #define LSRMST2LSR(lm) ((BYTE)((lm) >> 8)) ! #define LSRMST2GO(lm) (GO_V2O_MODEM_STATUS(LSRMST2MST(lm)) | ((LSRMST2LSR(lm) & LSR_BREAK_STATUS) ? GO_BREAK_STATUS : 0)) static struct { *************** *** 89,93 **** {"dcd", MST2LSRMST(MODEM_STATUS_DCD)}, {"ring", MST2LSRMST(MODEM_STATUS_RI)}, ! {"break", LSR2LSRMST(LINE_STATUS_BI)}, }; /////////////////////////////////////////////////////////////// --- 97,101 ---- {"dcd", MST2LSRMST(MODEM_STATUS_DCD)}, {"ring", MST2LSRMST(MODEM_STATUS_RI)}, ! {"break", LSR2LSRMST(LSR_BREAK_STATUS)}, }; /////////////////////////////////////////////////////////////// *************** *** 394,398 **** pOutMsg->u.val &= ~(VAL2MASK(((Filter *)hFilter)->outMask)); break; ! case HUB_MSG_TYPE_LINE_STATUS: case HUB_MSG_TYPE_MODEM_STATUS: { State *pState = ((Filter *)hFilter)->GetState(nToPort); --- 402,406 ---- pOutMsg->u.val &= ~(VAL2MASK(((Filter *)hFilter)->outMask)); break; ! case HUB_MSG_TYPE_BREAK_STATUS: case HUB_MSG_TYPE_MODEM_STATUS: { State *pState = ((Filter *)hFilter)->GetState(nToPort); *************** *** 408,413 **** lmInMask = MST2LSRMST(MASK2VAL(pOutMsg->u.val)); } else { ! lmInVal = LSR2LSRMST(pOutMsg->u.val); ! lmInMask = LSR2LSRMST(MASK2VAL(pOutMsg->u.val)); } --- 416,421 ---- lmInMask = MST2LSRMST(MASK2VAL(pOutMsg->u.val)); } else { ! lmInVal = (pOutMsg->u.val ? LSR2LSRMST(LSR_BREAK_STATUS) : 0); ! lmInMask = LSR2LSRMST(LSR_BREAK_STATUS); } |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 12:46:01
|
Update of /cvsroot/com0com/hub4com/plugins In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12850 Modified Files: plugins_api.h Log Message: Added masking to HUB_MSG_TYPE_MODEM_STATUS and HUB_MSG_TYPE_LINE_STATUS Index: plugins_api.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/plugins_api.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** plugins_api.h 20 Aug 2008 14:30:18 -0000 1.8 --- plugins_api.h 22 Aug 2008 12:45:34 -0000 1.9 *************** *** 34,41 **** #define HUB_MSG_UNION_TYPE_PVAL 0x3000 /*******************************************************************/ #define HUB_MSG_TYPE_EMPTY (0 | HUB_MSG_UNION_TYPE_NONE) #define HUB_MSG_TYPE_LINE_DATA (1 | HUB_MSG_UNION_TYPE_BUF) #define HUB_MSG_TYPE_CONNECT (2 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_MODEM_STATUS (3 | HUB_MSG_UNION_TYPE_VAL) #define MODEM_STATUS_DCTS 0x01 #define MODEM_STATUS_DDSR 0x02 --- 34,46 ---- #define HUB_MSG_UNION_TYPE_PVAL 0x3000 /*******************************************************************/ + #define HUB_MSG_VAL_TYPES_MASK 0x0F00 + #define HUB_MSG_VAL_TYPE_MASK_VAL 0x0100 + #define VAL2MASK(v) ((DWORD)(WORD)(v) << 16) + #define MASK2VAL(m) ((WORD)((m) >> 16)) + /*******************************************************************/ #define HUB_MSG_TYPE_EMPTY (0 | HUB_MSG_UNION_TYPE_NONE) #define HUB_MSG_TYPE_LINE_DATA (1 | HUB_MSG_UNION_TYPE_BUF) #define HUB_MSG_TYPE_CONNECT (2 | HUB_MSG_UNION_TYPE_VAL) ! #define HUB_MSG_TYPE_MODEM_STATUS (3 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_MASK_VAL) #define MODEM_STATUS_DCTS 0x01 #define MODEM_STATUS_DDSR 0x02 *************** *** 46,50 **** #define MODEM_STATUS_RI 0x40 #define MODEM_STATUS_DCD 0x80 ! #define HUB_MSG_TYPE_LINE_STATUS (4 | HUB_MSG_UNION_TYPE_VAL) #define LINE_STATUS_DR 0x01 #define LINE_STATUS_OE 0x02 --- 51,55 ---- #define MODEM_STATUS_RI 0x40 #define MODEM_STATUS_DCD 0x80 ! #define HUB_MSG_TYPE_LINE_STATUS (4 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_MASK_VAL) #define LINE_STATUS_DR 0x01 #define LINE_STATUS_OE 0x02 *************** *** 55,61 **** #define LINE_STATUS_TEMT 0x40 #define LINE_STATUS_FIFOERR 0x80 ! #define HUB_MSG_TYPE_SET_PIN_STATE (5 | HUB_MSG_UNION_TYPE_VAL) ! #define SPS_PIN2MASK(p) ((DWORD)(BYTE)(p) << 16) ! #define SPS_MASK2PIN(m) ((BYTE)((m) >> 16)) #define PIN_STATE_RTS 0x01 #define PIN_STATE_DTR 0x02 --- 60,64 ---- #define LINE_STATUS_TEMT 0x40 #define LINE_STATUS_FIFOERR 0x80 ! #define HUB_MSG_TYPE_SET_PIN_STATE (5 | HUB_MSG_UNION_TYPE_VAL | HUB_MSG_VAL_TYPE_MASK_VAL) #define PIN_STATE_RTS 0x01 #define PIN_STATE_DTR 0x02 |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 12:45:46
|
Update of /cvsroot/com0com/hub4com/plugins/pin2con In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12850/pin2con Modified Files: filter.cpp Log Message: Added masking to HUB_MSG_TYPE_MODEM_STATUS and HUB_MSG_TYPE_LINE_STATUS Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pin2con/filter.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** filter.cpp 20 Aug 2008 14:30:19 -0000 1.6 --- filter.cpp 22 Aug 2008 12:45:34 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/08/22 12:45:34 vfrolov + * Added masking to HUB_MSG_TYPE_MODEM_STATUS and HUB_MSG_TYPE_LINE_STATUS + * * Revision 1.6 2008/08/20 14:30:19 vfrolov * Redesigned serial port options *************** *** 239,249 **** _ASSERTE(*ppEchoMsg == NULL); ! if (pInMsg->type == HUB_MSG_TYPE_GET_IN_OPTS) { _ASSERTE(pInMsg->u.pv.pVal != NULL); // or'e with the required mask to get line status and modem status *pInMsg->u.pv.pVal |= (((Filter *)hFilter)->pin & pInMsg->u.pv.val); ! } ! else ! if (pInMsg->type == HUB_MSG_TYPE_FAIL_IN_OPTS) { DWORD fail_options = (pInMsg->u.val & ((Filter *)hFilter)->pin); --- 242,252 ---- _ASSERTE(*ppEchoMsg == NULL); ! switch (pInMsg->type) { ! case HUB_MSG_TYPE_GET_IN_OPTS: _ASSERTE(pInMsg->u.pv.pVal != NULL); // or'e with the required mask to get line status and modem status *pInMsg->u.pv.pVal |= (((Filter *)hFilter)->pin & pInMsg->u.pv.val); ! break; ! case HUB_MSG_TYPE_FAIL_IN_OPTS: { DWORD fail_options = (pInMsg->u.val & ((Filter *)hFilter)->pin); *************** *** 254,273 **** << " not accepted" << endl; } } ! else ! if (pInMsg->type == HUB_MSG_TYPE_CONNECT) { // discard any CONNECT messages from the input stream pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); ! } ! else ! if (pInMsg->type == HUB_MSG_TYPE_LINE_STATUS || ! pInMsg->type == HUB_MSG_TYPE_MODEM_STATUS) ! { ! BOOL connect; ! if (pInMsg->type == HUB_MSG_TYPE_LINE_STATUS) ! connect = ((pInMsg->u.val & GO_O2V_LINE_STATUS(((Filter *)hFilter)->pin)) != 0); ! else ! connect = ((pInMsg->u.val & GO_O2V_MODEM_STATUS(((Filter *)hFilter)->pin)) != 0); if (((Filter *)hFilter)->negative) --- 257,280 ---- << " not accepted" << endl; } + break; } ! case HUB_MSG_TYPE_CONNECT: // discard any CONNECT messages from the input stream pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY); ! break; ! case HUB_MSG_TYPE_LINE_STATUS: ! case HUB_MSG_TYPE_MODEM_STATUS: ! WORD pin; ! if (pInMsg->type == HUB_MSG_TYPE_LINE_STATUS) { ! pin = GO_O2V_LINE_STATUS(((Filter *)hFilter)->pin); ! } else { ! pin = GO_O2V_MODEM_STATUS(((Filter *)hFilter)->pin); ! } ! ! if ((pin & MASK2VAL(pInMsg->u.val)) == 0) ! break; ! ! BOOL connect = ((pInMsg->u.val & pin) != 0); if (((Filter *)hFilter)->negative) *************** *** 288,291 **** --- 295,299 ---- } } + break; } |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 12:45:38
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12850/serial Modified Files: comport.cpp Log Message: Added masking to HUB_MSG_TYPE_MODEM_STATUS and HUB_MSG_TYPE_LINE_STATUS Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** comport.cpp 20 Aug 2008 14:30:19 -0000 1.7 --- comport.cpp 22 Aug 2008 12:45:34 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2008/08/22 12:45:34 vfrolov + * Added masking to HUB_MSG_TYPE_MODEM_STATUS and HUB_MSG_TYPE_LINE_STATUS + * * Revision 1.7 2008/08/20 14:30:19 vfrolov * Redesigned serial port options *************** *** 403,407 **** return FALSE; ! WORD mask = SPS_MASK2PIN(pMsg->u.val); cout << name << " SET_PIN_STATE 0x" << hex << pMsg->u.val << dec << " SET[" --- 406,410 ---- return FALSE; ! WORD mask = MASK2VAL(pMsg->u.val); cout << name << " SET_PIN_STATE 0x" << hex << pMsg->u.val << dec << " SET[" *************** *** 569,573 **** msg.type = HUB_MSG_TYPE_MODEM_STATUS; ! msg.u.val = stat; pOnRead(hHub, hMasterPort, &msg); --- 572,576 ---- msg.type = HUB_MSG_TYPE_MODEM_STATUS; ! msg.u.val = ((DWORD)(BYTE)stat | VAL2MASK(MODEM_STATUS_CTS|MODEM_STATUS_DSR|MODEM_STATUS_DCD|MODEM_STATUS_RI)); pOnRead(hHub, hMasterPort, &msg); |
From: Vyacheslav F. <vf...@us...> - 2008-08-22 12:45:38
|
Update of /cvsroot/com0com/hub4com/plugins/pinmap In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12850/pinmap Modified Files: filter.cpp Log Message: Added masking to HUB_MSG_TYPE_MODEM_STATUS and HUB_MSG_TYPE_LINE_STATUS Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pinmap/filter.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filter.cpp 20 Aug 2008 14:30:19 -0000 1.4 --- filter.cpp 22 Aug 2008 12:45:34 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/08/22 12:45:34 vfrolov + * Added masking to HUB_MSG_TYPE_MODEM_STATUS and HUB_MSG_TYPE_LINE_STATUS + * * Revision 1.4 2008/08/20 14:30:19 vfrolov * Redesigned serial port options *************** *** 348,352 **** if (mask) { ! DWORD dVal = (SPS_PIN2MASK(mask) | val); //cout << "SET_PIN_STATE 0x" << hex << dVal << dec << endl; *ppOutMsg = pMsgInsertVal(*ppOutMsg, HUB_MSG_TYPE_SET_PIN_STATE, dVal); --- 351,355 ---- if (mask) { ! DWORD dVal = (VAL2MASK(mask) | val); //cout << "SET_PIN_STATE 0x" << hex << dVal << dec << endl; *ppOutMsg = pMsgInsertVal(*ppOutMsg, HUB_MSG_TYPE_SET_PIN_STATE, dVal); *************** *** 389,393 **** case HUB_MSG_TYPE_SET_PIN_STATE: // discard any pin settings controlled by this filter ! pOutMsg->u.val &= ~(SPS_PIN2MASK(((Filter *)hFilter)->outMask)); break; case HUB_MSG_TYPE_LINE_STATUS: --- 392,396 ---- case HUB_MSG_TYPE_SET_PIN_STATE: // discard any pin settings controlled by this filter ! pOutMsg->u.val &= ~(VAL2MASK(((Filter *)hFilter)->outMask)); break; case HUB_MSG_TYPE_LINE_STATUS: *************** *** 399,411 **** WORD lmInVal; ! if (pOutMsg->type == HUB_MSG_TYPE_MODEM_STATUS) ! lmInVal = (MST2LSRMST(pOutMsg->u.val) | (pState->lmInVal & LSR2LSRMST(-1))); ! else ! lmInVal = (LSR2LSRMST(pOutMsg->u.val) | (pState->lmInVal & MST2LSRMST(-1))); lmInVal &= ((Filter *)hFilter)->lmInMask; InsertPinState(*(Filter *)hFilter, pState->lmInVal ^ lmInVal, lmInVal, &pOutMsg); pState->lmInVal = lmInVal; break; --- 402,420 ---- WORD lmInVal; + WORD lmInMask; ! if (pOutMsg->type == HUB_MSG_TYPE_MODEM_STATUS) { ! lmInVal = MST2LSRMST(pOutMsg->u.val); ! lmInMask = MST2LSRMST(MASK2VAL(pOutMsg->u.val)); ! } else { ! lmInVal = LSR2LSRMST(pOutMsg->u.val); ! lmInMask = LSR2LSRMST(MASK2VAL(pOutMsg->u.val)); ! } + lmInVal = ((lmInVal & lmInMask) | (pState->lmInVal & ~lmInMask)); lmInVal &= ((Filter *)hFilter)->lmInMask; InsertPinState(*(Filter *)hFilter, pState->lmInVal ^ lmInVal, lmInVal, &pOutMsg); + pState->lmInVal = lmInVal; break; |