On 22.02.2012 14:59, salorob wrote:
Hi Robert,

Thankyou for your reply.

The code that i simulate in Mono is this one. Simple Send And Receive:


This?

                #define TIOCSRS485 0x542F
                ...
                // Set RS485 mode:
                rs485conf.flags |= SER_RS485_ENABLED;
                if (ioctl (fd, TIOCSRS485, &rs485conf) < 0) {
                        printf("ioctl error\n");
                }


You need to p/invoke ioctl from libc[1] and create a p/invoke
declaration for "struct serial_rs485"[1].

To be able to use ioctl, you must get the file handle of the
serial port. Unfortunately, the SerialPort[3] class does not
expose it, so you'd have to do it via reflection[2].
You must get the value of the field "fd"[4] from the
field "stream"[3] of the class SerialPort[3].

Robert

[1] http://www.mono-project.com/Interop_with_Native_Libraries
[2] http://msdn.microsoft.com/en-us/library/f7ykdhsy%28v=vs.71%29.aspx
[3] https://github.com/mono/mono/blob/master/mcs/class/System/System.IO.Ports/SerialPort.cs [4] https://github.com/mono/mono/blob/master/mcs/class/System/System.IO.Ports/SerialPortStream.cs

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to