예제 #1
0
파일: rtc6.cs 프로젝트: li1794/rtclib
        public virtual bool Initialize(double kFactor, LaserMode laserMode, string ctbFileName)
        {
            Debug.Assert(this.kFactor > 0);
            RTC6Wrap.n_stop_execution(this.Index + 1);
            uint error      = RTC6Wrap.n_load_program_file(this.Index + 1, string.Empty);
            uint cardCnt    = RTC6Wrap.rtc6_count_cards();
            uint dllVersion = RTC6Wrap.get_dll_version();
            uint hexVersion = RTC6Wrap.get_hex_version();
            uint rtcVersion = RTC6Wrap.get_rtc_version();
            uint lastError  = RTC6Wrap.n_get_last_error(this.Index + 1);
            uint serialNo   = RTC6Wrap.n_get_serial_number(this.Index + 1);

            this.kFactor = kFactor;
            ///active high
            RTC6Wrap.n_set_laser_control(this.Index + 1, 0);

            if (!this.CtlLoadCorrectionFile(CorrectionTableIndex.Table1, ctbFileName))
            {
                return(false);
            }
            if (!this.CtlSelectCorrection(CorrectionTableIndex.Table1))
            {
                return(false);
            }
            RTC6Wrap.n_config_list(this.Index + 1, 4000 * 2, 4000 * 2);
            RTC6Wrap.n_set_laser_mode(this.Index + 1, (uint)laserMode);
            RTC6Wrap.n_set_firstpulse_killer(this.Index + 1, 0);
            RTC6Wrap.n_set_standby(this.Index + 1, 0, 0);
            return(true);
        }
예제 #2
0
파일: rtc6.cs 프로젝트: li1794/rtclib
        public bool CtlGetStatus(RtcStatus status)
        {
            bool result = false;
            uint busy, position;

            busy = position = 0;
            switch (status)
            {
            case RtcStatus.Busy:
                RTC6Wrap.n_get_status(this.Index + 1, out busy, out position);
                result = Convert.ToBoolean(busy > 0);
                break;

            case RtcStatus.NotBusy:
                result = !this.CtlGetStatus(RtcStatus.Busy);
                break;

            case RtcStatus.List1Busy:
                uint l1Status = RTC6Wrap.n_read_status(this.Index + 1);
                result = Convert.ToBoolean(l1Status & 0x0F);
                break;

            case RtcStatus.List2Busy:
                uint l2Status = RTC6Wrap.n_read_status(this.Index + 1);
                result = Convert.ToBoolean(l2Status & 0x10);
                break;

            case RtcStatus.NoError:
                bool aborted   = this.CtlGetStatus(RtcStatus.Aborted);
                uint lastError = RTC6Wrap.n_get_last_error(this.Index + 1);
                bool error     = 0 != lastError;
                result = !aborted && !error;
                break;

            case RtcStatus.Aborted:
                result = this.aborted;
                break;

            case RtcStatus.PositionAckOK:
                uint posAckStatus = RTC6Wrap.n_get_head_status(this.Index + 1, 1);
                result = Convert.ToBoolean(posAckStatus & 0x0F + posAckStatus & 0x10);
                break;

            case RtcStatus.PowerOK:
                uint powStatus = RTC6Wrap.n_get_head_status(this.Index + 1, 1);
                result = Convert.ToBoolean(powStatus & 0x80);
                break;

            case RtcStatus.TempOK:
                uint tempStatus = RTC6Wrap.n_get_head_status(this.Index + 1, 1);
                result = Convert.ToBoolean(tempStatus & 0x40);
                break;
            }
            return(result);
        }
예제 #3
0
파일: rtc6.cs 프로젝트: li1794/rtclib
        public bool CtlReset()
        {
            uint lastError = RTC6Wrap.n_get_last_error(this.Index + 1);

            if (0 != lastError)
            {
                RTC6Wrap.n_reset_error(this.Index + 1, lastError);
            }

            this.aborted = false;
            return(true);
        }
예제 #4
0
        public override bool Initialize(double kFactor, LaserMode laserMode, string ctbFileName)
        {
            Debug.Assert(base.kFactor > 0);
            uint result = RTC6Wrap.init_rtc6_dll();

            RTC6Wrap.eth_set_search_cards_timeout(200 * 1000);
            result = RTC6Wrap.eth_search_cards(
                RTC6Wrap.eth_convert_string_to_ip(this.ipAddress.ToString()),
                RTC6Wrap.eth_convert_string_to_ip(this.subNetMask.ToString()));
            int assign_result = RTC6Wrap.eth_assign_card_ip(
                RTC6Wrap.eth_convert_string_to_ip(this.ipAddress.ToString()),
                base.Index + 1);

            if (base.Index + 1 != assign_result)
            {
                return(false);
            }

            RTC6Wrap.n_stop_execution(base.Index + 1);
            uint error      = RTC6Wrap.n_load_program_file(base.Index + 1, string.Empty);
            uint cardCnt    = RTC6Wrap.rtc6_count_cards();
            uint dllVersion = RTC6Wrap.get_dll_version();
            uint hexVersion = RTC6Wrap.get_hex_version();
            uint rtcVersion = RTC6Wrap.get_rtc_version();

            uint lastError = RTC6Wrap.n_get_last_error(base.Index + 1);

            base.kFactor = kFactor;
            ///active high
            RTC6Wrap.n_set_laser_control(this.Index + 1, 0);

            if (!this.CtlLoadCorrectionFile(CorrectionTableIndex.Table1, ctbFileName))
            {
                return(false);
            }
            if (!this.CtlSelectCorrection(CorrectionTableIndex.Table1))
            {
                return(false);
            }
            RTC6Wrap.n_config_list(this.Index + 1, 4000 * 2, 4000 * 2);
            RTC6Wrap.n_set_laser_mode(this.Index + 1, (uint)laserMode);
            RTC6Wrap.n_set_firstpulse_killer(this.Index + 1, 0);
            RTC6Wrap.n_set_standby(this.Index + 1, 0, 0);
            return(true);
        }