コード例 #1
0
        /// <summary>
        ///  LSPsetdatetime_class constructor
        /// </summary>
        public LSPsetdatetime_class(int year, int month, int day, int hour, int min, int sec, int microsecond)
        {
            string        sTemp;
            ASCIIEncoding encoding = new ASCIIEncoding();

            _type             = CommandType.LSPsetdatetime;
            _data             = new LSPsetdatetime();
            _data.stx         = 0x02;
            sTemp             = "sMN ";
            _data.type        = encoding.GetBytes(sTemp);
            sTemp             = "LSPsetdatetime ";
            _data.cmd         = encoding.GetBytes(sTemp);
            _data.year        = FunctHelper.ConvertShortToHexByteArray((short)year);
            _data.sp0         = 0x20;
            _data.month       = FunctHelper.ByteToHexByteArray((byte)month);
            _data.sp1         = 0x20;
            _data.day         = FunctHelper.ByteToHexByteArray((byte)day);
            _data.sp2         = 0x20;
            _data.hour        = FunctHelper.ByteToHexByteArray((byte)hour);
            _data.sp3         = 0x20;
            _data.minute      = FunctHelper.ByteToHexByteArray((byte)min);
            _data.sp4         = 0x20;
            _data.second      = FunctHelper.ByteToHexByteArray((byte)sec);
            _data.sp5         = 0x20;
            _data.microsecond = FunctHelper.ConvertIntToHexByteArray(microsecond);
            _data.etx         = 0x03;
        }
コード例 #2
0
        /// <summary>
        ///  mLMPsetscancfg_class:
        /// </summary>
        /// <param name="scancfg">select_user_level (ScanCfg type)</param>
        /// <returns></returns>
        public LMDscandatacfg_class(short outputchannel, int remission, int resolution, int unit, short encoder, short position, short device_name, short comment, short time, short output_rate)
        {
            string        sTemp;
            ASCIIEncoding encoding = new ASCIIEncoding();

            _type      = CommandType.LMDscandatacfg;
            _data      = new LMDscandatacfg();
            _data.stx  = 0x02;
            sTemp      = "sWN ";
            _data.type = encoding.GetBytes(sTemp);
            sTemp      = "LMDscandatacfg ";
            _data.cmd  = encoding.GetBytes(sTemp);
            //_data.data_channel0 = FunctHelper.ConvertShortToHexByteArray(outputchannel);
            _data.data_channel0    = FunctHelper.ByteToHexByteArray((byte)outputchannel);
            _data.sp0              = 0x20;
            _data.data_channel1    = new byte[2];
            _data.data_channel1[0] = (byte)0x30;
            _data.data_channel1[1] = (byte)0x30;
            _data.sp1              = 0x20;
            _data.remission        = (byte)(remission + 0x30);
            _data.sp2              = 0x20;
            _data.resolution       = (byte)(resolution + 0x30);
            _data.sp3              = 0x20;
            _data.unit             = (byte)(unit + 0x30);
            _data.sp4              = 0x20;
            // _data.encoder0 = FunctHelper.ConvertShortToHexByteArray(encoder);
            _data.encoder0    = FunctHelper.ByteToHexByteArray((byte)encoder);
            _data.sp5         = 0x20;
            _data.encoder1    = new byte[2];
            _data.encoder1[0] = (byte)0x30;
            _data.encoder1[1] = (byte)0x30;
            _data.sp6         = 0x20;
            _data.position    = (byte)(position + 0x30);
            _data.sp7         = 0x20;
            _data.device_name = (byte)(device_name + 0x30);
            _data.sp8         = 0x20;
            _data.comment     = (byte)(comment + 0x30);
            _data.sp9         = 0x20;
            _data.time        = (byte)(time + 0x30);
            _data.sp10        = 0x20;
            //!!!!!!!!!!!!!!!!!!!!
            _data.output_rate    = new byte[2];
            _data.output_rate[0] = 0x2B;
            _data.output_rate[1] = 0x31;
            //!!!!!!!!!!!!!!!!!!!!
            _data.etx = 0x03;
        }
コード例 #3
0
        /// <summary>
        ///  SetAccessMode constructor
        /// </summary>
        /// <param name="select_user_level">select_user_level:
        ///  02 maintenance
        ///  03 authorized client
        ///  04 Service
        /// </param>
        /// <param name="password"></param>
        /// <returns></returns>
        public SetAccessMode_class(int select_user_level, uint password)
        {
            string        sTemp;
            ASCIIEncoding encoding = new ASCIIEncoding();

            _type               = CommandType.SetAccessMode;
            _data               = new SetAccessMode();
            _data.stx           = 0x02;
            sTemp               = "sMN ";
            _data.type          = encoding.GetBytes(sTemp);
            sTemp               = "SetAccessMode ";
            _data.cmd           = encoding.GetBytes(sTemp);
            _data.user_level    = new byte[3];
            _data.user_level[0] = 0x30;
            _data.user_level[1] = (byte)(select_user_level + 0x30);
            _data.user_level[2] = 0x20;
            _data.password      = FunctHelper.ConvertUintToHexByteArray(password);
            _data.etx           = 0x03;
        }
コード例 #4
0
        /// <summary>
        ///  mLMPsetscancfg_class:
        /// </summary>
        /// <param name="scancfg">select_user_level (ScanCfg type)</param>
        /// <returns></returns>
        public mLMPsetscancfg_class(ScanCfg scancfg)
        {
            string        sTemp;
            ASCIIEncoding encoding = new ASCIIEncoding();

            _type                  = CommandType.mLMPsetscancfg;
            _data                  = new mLMPsetscancfg();
            _data.stx              = 0x02;
            sTemp                  = "sMN ";
            _data.type             = encoding.GetBytes(sTemp);
            sTemp                  = "mLMPsetscancfg ";
            _data.cmd              = encoding.GetBytes(sTemp);
            _data.scan_frequency   = FunctHelper.ConvertUintToHexByteArray(scancfg.scan_frequency);
            _data.sp1              = 0x20;
            _data.value            = FunctHelper.ConvertShortToHexByteArray(1);
            _data.sp2              = 0x20;
            _data.angle_resolution = FunctHelper.ConvertUintToHexByteArray(scancfg.angle_resolution);
            _data.sp3              = 0x20;
            _data.start_angle      = FunctHelper.ConvertIntToHexByteArray(scancfg.start_angle);
            _data.sp4              = 0x20;
            _data.stop_angle       = FunctHelper.ConvertIntToHexByteArray(scancfg.stop_angle);
            _data.etx              = 0x03;
        }