﻿//============================================================-
//	MODBUSRTUCS.CS
//	Class file for libmodbus
//												CONTEC.Co.,Ltd.
//============================================================-
using System;
using System.Runtime.InteropServices;

public enum ModbusRtuConst
{
    //----------------------------------------
    //  パラメータ
    //----------------------------------------
    // ----------------------------------------
    //  MODBUS ADU のサイズ
    // ----------------------------------------
    //Modbus_Application_Protocol_V1_1b.pdf Chapter 4 Section 1 Page 5
    //RS232 / RS485 ADU = 253 bytes + slave (1 byte) + CRC (2 bytes) = 256 bytes
    MODBUS_RTU_MAX_ADU_LENGTH = 256,
}

namespace ModbusRtuCs
{
    public class ModbusRtu
    {
        [DllImport("modbus.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr modbus_new_rtu(string device, int baud, char parity, int data_bit, int stop_bit);

        public IntPtr NewRtu(string device, int baud, char parity, int data_bit, int stop_bit)
        {
            IntPtr ctx = modbus_new_rtu(device, baud, parity, data_bit, stop_bit);
            return ctx;
        }
    }

    // 共通関数の説明

}
