Exemple #1
0
        public LCard502(LCard502Pars _pars, DOnPr _OnPr = null)
        {
            if (_OnPr != null)
            {
                OnPr += _OnPr;
            }

            LastError = null;
            /* создаем описатель модуля */
            hnd = new L502();

            string serial = FindSerial(_pars.DevNum);

            if (serial == null)
            {
                throw (new Exception("LCard502.LCard502: Ошибка: Устройство не найдено: " + _pars.DevNum.ToString()));
            }
            pr("LCard502 create");
            //            lpcie.Errs res;
            /* устанавливаем связь по выбранному серийному номеру */
            lpcie.Errs res = hnd.Open(serial);
            if (res != 0)
            {
                throw (new Exception(L502.GetErrorString(res) + " Ошибка открытия модуля"));
            }
            /* получаем информацию о модуле */
            L502.Info devinfo = hnd.DevInfo;
        }
Exemple #2
0
 public SGSet(ILCard502 _lcard, SignalListDef _SL, DOnPr _OnPr = null)
 {
     lcard_local = false;
     lcard       = _lcard;
     gspf        = new GSPF(OnPr);
     SL          = _SL;
 }
Exemple #3
0
 public GSPF(DOnPr _OnPr = null)
 {
     if (_OnPr != null)
     {
         OnPr += _OnPr;
     }
 }
Exemple #4
0
 public ComPort(ComPortPars _par, DOnPr _OnPr = null)
     : base(_par, _OnPr)
 {
     hPort = Win32Com.CreateFile(_par.Port, Win32Com.GENERIC_READ | Win32Com.GENERIC_WRITE, 0, IntPtr.Zero, Win32Com.OPEN_EXISTING, 0, IntPtr.Zero);
     if (hPort == (IntPtr)Win32Com.INVALID_HANDLE_VALUE)
     {
         prfatal("Не могу прочитать параметры");
     }
     Win32Com.DCB PortDCB = new Win32Com.DCB();
     if (!Win32Com.GetCommState(hPort, ref PortDCB))
     {
         prfatal("Не могу прочитать параметры");
     }
     PortDCB.BaudRate = _par.BaudRate;
     PortDCB.ByteSize = (byte)_par.ByteSize;
     PortDCB.Parity   = (byte)_par.Parity;
     PortDCB.StopBits = (byte)_par.StopBits;
     Win32Com.COMMTIMEOUTS CommTimeouts = new Win32Com.COMMTIMEOUTS();
     if (!Win32Com.SetCommState(hPort, ref PortDCB))
     {
         prfatal("Не могу установить параметры");
     }
     CommTimeouts.ReadIntervalTimeout        = (uint)_par.ReadIntervalTimeout;
     CommTimeouts.ReadTotalTimeoutConstant   = (uint)_par.ReadTotalTimeoutConstant;
     CommTimeouts.ReadTotalTimeoutMultiplier = (uint)_par.ReadTotalTimeoutMultiplier;
     if (!Win32Com.SetCommTimeouts(hPort, ref CommTimeouts))
     {
         prfatal("Не могу выставить задержки");
     }
 }
Exemple #5
0
 public ComPortBase(ComPortPars _par, DOnPr _OnPr = null)
 {
     OnPr          = _OnPr;
     ProtocolLevel = 0;
     opened        = true;
     pr("Открыт");
 }
Exemple #6
0
 public SGSet(SignalListDef _SL, DOnPr _OnPr = null)
 {
     lcard_local = true;
     OnPr        = _OnPr;
     lcard       = LoadLCard(_OnPr);
     gspf        = new GSPF(OnPr);
     SL          = _SL;
 }
Exemple #7
0
 public BoardSQL(int _board, PCIE1730pars _par, string _schema, bool _PCSide, DOnPr _OnPr = null)
     : base(_par, _OnPr)
 {
     schema = _schema;
     PCSide = _PCSide;
     Devnum = _board;
     CheckTables();
 }
Exemple #8
0
        public static ComPortBase Create(ComPortPars _par, DOnPr _OnPr = null)
        {
#if COMPORT_virtual
            return(new ComPortBase(_par, _OnPr));
#else
            return(new ComPort(_par, _OnPr));
#endif
        }
Exemple #9
0
 protected Board(PCIE1730pars _pars, DOnPr _OnPr)
 {
     OnPr          = _OnPr;
     DigitalOffset = _pars.DigitalOffset;
     portCount_in  = _pars.PortcountIn;
     portCount_out = _pars.PortcountOut;
     Timeout       = _pars.SignalListTimeout;
     values_in     = 0;
     values_out    = 0;
 }
Exemple #10
0
 public Board1730(PCIE1730pars _pars, DOnPr _OnPr)
     : base(_pars, _OnPr)
 {
     ctrl_in  = new InstantDiCtrl();
     ctrl_out = new InstantDoCtrl();
     ctrl_in.SelectedDevice  = new DeviceInformation(_pars.Devnum);
     ctrl_out.SelectedDevice = new DeviceInformation(_pars.Devnum);
     buf_in  = new byte[portCount_in];
     buf_out = new byte[portCount_out];
 }
Exemple #11
0
        static ILCard502 LoadLCard(DOnPr _OnPr = null)
        {
            ILCard502 ret;

#if LCARD_VIRTUAL
            ret = new L502virtual();
#else
            ret = new LCard502(ParAll.ST.Defect.Cross.L502, _OnPr);
#endif
            return(ret);
        }
Exemple #12
0
        public DASP52032_real(BoardPars _pars, DOnPr _OnPr = null)
            : base(_pars, _OnPr)
        {
            int err;
            int DllVersion = 0;

            err = DASP52032Connector.DASP52032_GetDllVersion(ref DllVersion);
            pr("DASP52032_real.DASP52032_real: DllVersion=" + DllVersion.ToString());
            err = DASP52032Connector.DASP52032_QuickInstalled((byte)devnum, 0);
            if (err != 0)
            {
                FN.fatal("DASP52032_real.DASP52032_real: Ошибка: " + DASP52032Connector.GetError(err));
            }
        }
Exemple #13
0
        public LCard502E(LCard502Pars _pars, DOnPr _OnPr = null)
        {
            if (_OnPr != null)
            {
                OnPr += _OnPr;
            }

            LastError = null;
            IPAddress addr = FirstIp();

            if (addr == null)
            {
                throw (new Exception("LCard502E.LCard502E: Ошибка: Устройство не найдено"));
            }
            /* создаем запись, соответствующую заданному адресу */
            X502.DevRec rec = E502.MakeDevRecordByIpAddr(addr, 0, 5000);
            /* создание объекта */
            hnd = X502.Create(rec.DevName);
            /* станавливаем связь устанавливаем связь по созданной записи */
            lpcie.Errs res = hnd.Open(rec);
            if (res != lpcie.Errs.OK)
            {
                throw (new Exception(string.Format("Ошибка открытия модуля: {0}", X502.GetErrorString(res))));
            }

            //return;
            ///* создаем описатель модуля */
            //hnd = new L502();

            //string serial = FindSerial(_pars.DevNum);
            //if (serial == null)
            //    throw (new Exception("LCard502.LCard502: Ошибка: Устройство не найдено: " + _pars.DevNum.ToString()));
            //pr("LCard502 create");
            ////            lpcie.Errs res;
            ///* устанавливаем связь по выбранному серийному номеру */
            //lpcie.Errs res = hnd.Open(serial);
            //if (res != 0)
            //    throw (new Exception(L502.GetErrorString(res) + " Ошибка открытия модуля"));
            ///* получаем информацию о модуле */
            //L502.Info devinfo = hnd.DevInfo;
        }
Exemple #14
0
 public BoardVirtual(PCIE1730pars _pars, DOnPr _OnPr) : base(_pars, _OnPr)
 {
 }