using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace ButcherFactory.SegmentProductionAuto_
{
  static class CallLibrary
  {
    #region 调用 scale DLL       
    public delegate void pFunCallback(IntPtr data, int length, IntPtr net);

    [DllImport("ScaleLibrary.dll", EntryPoint = "SendZero", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
    public static extern int SendZero();//归零

    [DllImport("ScaleLibrary.dll", EntryPoint = "sendPort", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
    public static extern int sendPort(int Port, int Buadrate);//设置端口

    [DllImport("ScaleLibrary.dll", EntryPoint = "isZero", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
    public static extern int isZero();//是否是零点

    [DllImport("ScaleLibrary.dll", EntryPoint = "isStable", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
    public static extern int isStable(); //是否稳定

    [DllImport("ScaleLibrary.dll", EntryPoint = "isTare", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
    public static extern int isTare(); //是否扣重

    [DllImport("ScaleLibrary.dll", EntryPoint = "getStringNet", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
    public static extern IntPtr getStringNet(); //获取解析好的重量

    [DllImport("ScaleLibrary.dll", EntryPoint = "unbindScale", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
    public static extern int unbindScale(); //释放接口
    #endregion

  }
}
