[Mono-list] SerialPort events

jkljajic jkljajic at beotel.rs
Wed Feb 23 17:18:46 EST 2011


I am trying to implement datareceiving on windows and Linux for mono, i have
some success to do some stuff on windows and now its working very good but
in Linux i am not satisfied.
Can some one help me I 'don't have very much experience in Linux c
programing, I get datareceiving work with poll_serial but I try to find way
how to trigger event like in windows  WaitCommEvent and GetOverlappedResult 
if some one have any good suggestion will be welcome.
I try to do like this :

internal unsafe void WaitForCommEvent()
            {

                bool flag = false;
                while (!this.ShutdownLoop)
                {
                        int num = 0;
                        flag = poll_serial(this.handle, out num,1); //Pull
serial for data
                        int num2 = Marshal.GetLastWin32Error();

                        if (flag &&  num ==0 && !this.ShutdownLoop) // Call
event 
                               this.CallEvents(this.eventsOccurred);

                    
                    
                    int a2;
                    while ((a2 =get_bytes_in_buffer(this.handle,1))!=0) //
wait to read all data
                    {
                    }
                }
                if (flag)
                {
                    this.endEventLoop = true;
                    Overlapped.Free(lpOverlapped);
                }
                this.eventLoopEndedSignal.Set();
            }
this work like this

ps. sorry for bad english

-- 
View this message in context: http://mono.1490590.n4.nabble.com/SerialPort-events-tp3321800p3321800.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list