Files:

ser16.h       16bit version of serial handler for wxwindows
ser16.cpp  
wx_win16.cpp  wx_win.cpp for wxwin 1.60 modifed to handle serial comm events

serial.h      32 version of serial handler for wxwindows
serial.cpp
wx_win.cpp    wx_win.cpp for wxwin 1.66 modifed to handle serial comm events

readme.       This file




These are src files for a serial port handling class.
They written for Win 3.1 and Win 95.  No attempt was
made to make them portable, but that shouldnt be too
hard.  The code is also not documented very well (actually
not at all :(  ).   Also note that the two versions dont match
exactly.  All of our code now uses the 32bit, but we used the
16 bit for about a 6 months.  If you want to build on the class
I would start with the 32bit rather than the 16.  

If anybody needs help using it just send some mail.

The main idea is:

There is a global Serial class, which I call serialInt.  It is defined
in serial.h.  All calls to open, close, read, write, etc are made through
this class.  For interupt driven event handling you need to connect a
callback function to a serial port.

You instantiate a serial callback class that
has a virtual callback function.  This callback function is called in
the message loop in wx_win.cpp whenever a commnotify event is sent.
The function setCallback() connects the specific serial port to the passed
callback class.   I perfer the use of a callback class rather than a function
pointer so that the callback can have some local data, but a function could
be used just as well I guess.

You can then open the port and all serial messages will be sent to the
give callback.  In the 32bit version you can have different callbacks for
different ports.

The enable and disable functions are used to turn on and off the interupt
handling, so you can also do polled serial communicaition.

All the serial code was hacked out of the tty.c example that
came with msvc 2.0.  I would suggest looking at that too.


Sorry this is so terse, but I am wicked busy.  If anybody wants
me to clear up anything just send some mail.





This code is added to wx_win.cpp to handle the reception
of the commnotify events.

For WIN32 added to message loop in wx_win.cpp
*********************************************
case  WM_COMMNOTIFY:
          {
            if (serialInt.info[wParam].cb) {
               serialInt.info[wParam].cb->doit(wParam+1);
               SetEvent(serialInt.info[wParam].hPostEvent) ;
             }
            break;
         }

*********************************************




for WIN16 added to message loop in wx_win.cpp
*********************************************
 case  WM_COMMNOTIFY:
      {
         if (LOWORD(lParam) & CN_RECEIVE)
            serialInt.cb->doit(wParam);
         break;
      }
*********************************************                                                                                                   }

