// created on 11/3/2005 at 4:04 AM using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; namespace ModbusSharp { class InstrumentBus : MarshalByRefObject { private int comport; private int baudrate; public InstrumentBus(int c, int b) { comport = c; baudrate = b; } public int Init() { // TODO: connect to com port using linux or windows drivers // TODO: try-catch block for handling I/O failure Console.WriteLine("Instrument Bus started on COM Port {0}\n", comport); // TODO: define error codes return 1; } byte[] ReadRegisters (byte address, byte startingregister, byte registercount){ // TODO: read an array of modbus registers return null; // TODO: add all modbus functions (write register, force coil etc.) } } }