bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

common cpp 2 (1.0.13) under win32 platform (winXP)


From: Cronos
Subject: common cpp 2 (1.0.13) under win32 platform (winXP)
Date: Wed, 18 Feb 2004 12:57:22 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624

Hello!

I am developer in a small company and I try to make some cross-platform application for our purposes. But under win32 platform (today is a target platform for our software) I have got several bugs (or my misundestoods?).

First, In the serial.cpp class under windows I have got undesired behaviuor in the input stream (from modem). when I send the some sequense like "ath", I have got only first letter "a". This behaviour is occured due to somthing in the windows reading file mechanizm. I have written additional function for avoid this.

In the serial.h:
...
        enum Queue
        {
                queueInput,
                queueOutput
        };
        typedef enum Queue Queue;
...
public:
...

        /**
         * Get the size of pending queue.
         *
         * @return size of the queue
         * @param que type of the queue
         */
        int getQueueSize(Queue que);
...

In the serial.cpp

...
int Serial::getQueueSize(Queue queue)
{
#ifdef WIN32
        unsigned long   dwError;
        COMSTAT cs;

        ClearCommError(dev, &dwError, &cs);

        switch(queue)
        {
        case queueInput:
                return cs.cbInQue;
        case queueOutput:
                return cs.cbOutQue;
        }
#else
        // not implemented yet...
#endif // !WIN32
        return 0;
}
...


After this changes I have fixed the SerialEcho.cpp sample:
...
    while (isPending(Serial::pendingInput)) {
      int x = getQueueSize(Serial::queueInput);
      cout << "queue size: " << x << endl;

      while (x-- > 0)
        cout.put( get() );
      cout << endl;
    }
...

Additionaly to above, I try to build other samples under win32 by msvc6.0. But almost of they are not contained ws2_32.lib in the project options. Please, check it.

Thank you for good library!

--
С уважением,
ООО НПП "Кронос"






reply via email to

[Prev in Thread] Current Thread [Next in Thread]