Пример #1
0
        /// <summary>
        ///  LMDscandata constructor
        /// </summary>
        /// <param name="ct">once or coninue mode (ommandType type) </param>
        /// <param name="start">true started, (bool type) </param>
        /// <returns></returns>
        public LMDscandata_class(CommandType ct, bool start)
        {
            string        sTemp;
            ASCIIEncoding encoding = new ASCIIEncoding();

            _type = ct;
            if (ct == CommandType.LMDscandata)
            {
                _data      = new LMDscandata();
                _data.stx  = 0x02;
                sTemp      = "sRN ";
                _data.type = encoding.GetBytes(sTemp);
                sTemp      = "LMDscandata";
                _data.cmd  = encoding.GetBytes(sTemp);
                _data.etx  = 0x03;
            }
            else
            if (ct == CommandType.LMDscandata_E)
            {
                _data_e      = new LMDscandata_E();
                _data_e.stx  = 0x02;
                sTemp        = "sEN ";
                _data_e.type = encoding.GetBytes(sTemp);
                sTemp        = "LMDscandata ";
                _data_e.cmd  = encoding.GetBytes(sTemp);
                if (start)
                {
                    _data_e.measurement = 0x31;
                }
                else
                {
                    _data_e.measurement = 0x30;
                }
                _data_e.etx = 0x03;
            }
        }
Пример #2
0
 /// <summary>
 ///  LMDscandata constructor
 /// </summary>
 /// <param name="ct">once or coninue mode (ommandType type) </param>
 /// <param name="start">true started, (bool type) </param>       
 /// <returns></returns>
 public LMDscandata_class(CommandType ct, bool start)
 {
     string sTemp;
     ASCIIEncoding encoding = new ASCIIEncoding();
     _type = ct;
     if (ct == CommandType.LMDscandata)
     {
         _data = new LMDscandata();
         _data.stx = 0x02;
         sTemp = "sRN ";
         _data.type = encoding.GetBytes(sTemp);
         sTemp = "LMDscandata";
         _data.cmd = encoding.GetBytes(sTemp);
         _data.etx = 0x03;
     }
     else
     if (ct == CommandType.LMDscandata_E)
     {
         _data_e = new LMDscandata_E();
         _data_e.stx = 0x02;
         sTemp = "sEN ";
         _data_e.type = encoding.GetBytes(sTemp);
         sTemp = "LMDscandata ";
         _data_e.cmd = encoding.GetBytes(sTemp);
         if (start)
             _data_e.measurement = 0x31;
         else
             _data_e.measurement = 0x30;
         _data_e.etx = 0x03;
     }
 }