[Com0com-cvs] hub4com comhub.cpp, 1.6, 1.7 comhub.h, 1.5, 1.6 port.cpp, 1.1, 1.2 port.h, 1.1, 1.2
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2008-08-15 12:45:12
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21436 Modified Files: comhub.cpp comhub.h port.cpp port.h Log Message: Added fake read filter method to ports Index: port.h =================================================================== RCS file: /cvsroot/com0com/hub4com/port.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** port.h 26 Mar 2008 08:36:47 -0000 1.1 --- port.h 15 Aug 2008 12:44:59 -0000 1.2 *************** *** 20,27 **** * * $Log$ * Revision 1.1 2008/03/26 08:36:47 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.1 2008/03/26 08:36:47 vfrolov * Initial revision * */ *************** *** 51,54 **** --- 53,57 ---- BOOL Init(); BOOL Start(); + BOOL FakeReadFilter(HubMsg *pMsg); BOOL Write(HubMsg *pMsg); void AddXoff(); *************** *** 66,69 **** --- 69,73 ---- PORT_INIT *pInit; PORT_START *pStart; + PORT_FAKE_READ_FILTER *pFakeReadFilter; PORT_WRITE *pWrite; PORT_ADD_XOFF *pAddXoff; Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/port.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** port.cpp 26 Mar 2008 08:36:47 -0000 1.1 --- port.cpp 15 Aug 2008 12:44:59 -0000 1.2 *************** *** 20,27 **** * * $Log$ * Revision 1.1 2008/03/26 08:36:47 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.1 2008/03/26 08:36:47 vfrolov * Initial revision * */ *************** *** 34,38 **** : hub(_hub), num(_num), ! hPort(_hPort) { #ifdef _DEBUG --- 36,40 ---- : hub(_hub), num(_num), ! hPort(_hPort) { #ifdef _DEBUG *************** *** 61,66 **** pInit = ROUTINE_GET(pPortRoutines, pInit); pStart = ROUTINE_GET(pPortRoutines, pStart); pWrite = ROUTINE_GET(pPortRoutines, pWrite); - pAddXoff = ROUTINE_GET(pPortRoutines, pAddXoff); pAddXon = ROUTINE_GET(pPortRoutines, pAddXon); --- 63,68 ---- pInit = ROUTINE_GET(pPortRoutines, pInit); pStart = ROUTINE_GET(pPortRoutines, pStart); + pFakeReadFilter = ROUTINE_GET(pPortRoutines, pFakeReadFilter); pWrite = ROUTINE_GET(pPortRoutines, pWrite); pAddXoff = ROUTINE_GET(pPortRoutines, pAddXoff); pAddXon = ROUTINE_GET(pPortRoutines, pAddXon); *************** *** 91,94 **** --- 93,106 ---- } + BOOL Port::FakeReadFilter(HubMsg *pMsg) + { + _ASSERTE(pMsg != NULL); + + if (!pFakeReadFilter) + return TRUE; + + return pFakeReadFilter(hPort, (HUB_MSG *)pMsg); + } + BOOL Port::Write(HubMsg *pMsg) { Index: comhub.h =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** comhub.h 26 Mar 2008 08:48:18 -0000 1.5 --- comhub.h 15 Aug 2008 12:44:59 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.5 2008/03/26 08:48:18 vfrolov * Initial revision *************** *** 76,79 **** --- 79,83 ---- const char *pPath); BOOL StartAll() const; + BOOL OnFakeRead(Port *pFromPort, HubMsg *pMsg) const; void OnRead(Port *pFromPort, HubMsg *pMsg) const; void AddXoff(Port *pFromPort) const; Index: comhub.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** comhub.cpp 11 Aug 2008 07:15:33 -0000 1.6 --- comhub.cpp 15 Aug 2008 12:44:59 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/08/15 12:44:59 vfrolov + * Added fake read filter method to ports + * * Revision 1.6 2008/08/11 07:15:33 vfrolov * Replaced *************** *** 96,100 **** msg.type = HUB_MSG_TYPE_SET_OPTIONS; ! OnRead(*i, &msg); } --- 99,122 ---- msg.type = HUB_MSG_TYPE_SET_OPTIONS; ! ! if (!OnFakeRead(*i, &msg)) ! return FALSE; ! } ! ! for (Ports::const_iterator i = ports.begin() ; i != ports.end() ; i++) { ! HubMsg msg; ! DWORD options = 0; ! ! msg.type = HUB_MSG_TYPE_GET_OPTIONS; ! msg.u.pv.pVal = &options; ! msg.u.pv.val = DWORD(-1); ! ! if (!OnFakeRead(*i, &msg)) ! return FALSE; ! ! if (options) { ! cout << (*i)->Name() << " WARNING: Requested option(s) 0x" ! << hex << options << dec << " not supported" << endl; ! } } *************** *** 107,110 **** --- 129,142 ---- } + BOOL ComHub::OnFakeRead(Port *pFromPort, HubMsg *pMsg) const + { + if (!pFromPort->FakeReadFilter(pMsg)) + return FALSE; + + OnRead(pFromPort, pMsg); + + return TRUE; + } + void ComHub::OnRead(Port *pFromPort, HubMsg *pMsg) const { |